{ "info": { "author": "NomismaTech", "author_email": "mohammad.rezaei@nomisma.one", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.7" ], "description": "# Using the Nomisma Contract API\nRequirements:\n- Python 3.7.x\n- Web3 >= 4.9\n\nThe API consists of a set of classes that wrap and enhance the Solidity smart contracts.\nAn asynchronous multi-threaded runtime is included and used by these classes.\nAdditionally, a test resource is available to make testing your code simpler. \n\n# Testing your code that uses the API\nThe `test_util` package includes the following test resource classes that should be used in your tests.\n\n`CapitalStructureTestResource`\n\nThese test resources have methods for deploying the contracts and loading python instances of these contracts.\nThe contracts are split into two sets: contracts that have no storage (just code) and should be deployed \njust once, and contracts that have storage, which should be deployed with each independent test case.\n\nYou have to choose an ethereum test implementation for your the tests. Two choices are: ganache or \neth_tester (native python).\n\n## Ganache\nRun ganache-cli with these parameters:\n`ganache-cli --account '0x0000000000000000000000000000000000000000000000000000000000000001',10000000000000000000000`\n\nThis creates a locally running Ethereum test chain and creates 100 accounts with known addresses.\nAdding `-b 1` to the command line args will result in some transaction batching, which is more realistic, but slows down testing.\n\nIn the test resource initialization, point to the ganache instance like this:\n\n```CapitalStructureTestResource(web3=Web3(Web3.HTTPProvider(\"http://127.0.0.1:8545\")))```\n\n## Eth-Tester\nAs of 0.0.3, Eth-tester seems to be broken. Don't use for now.\nYou'll have to install eth-tester (via pip or similar). eth-tester seems limited to 10 accounts, so don't use\nany more accounts than 10 in your tests (the test resource uses some accounts, configurable in its constructor).\n\nIn the test resource initialization, use this form:\n\n```CapitalStructureTestResource(web3=Web3(EthereumTesterProvider()))```\n\n# Why code generation?\nWeb3.py comes with various ways to invoke contracts and it does it without code generation (using\npython's highly dynamic object structure). With code generation, we get the following benefits,\nas compared to web3.py out of the box:\n\n- The contract functions are visible and readable. This is ultimately much better for developers, \nbecause both them and their tools (IDE with auto-completion) have access to the method declarations.\n- python 3 type hinting for parameters and return types\n- payable functions have an extra parameter (to_pay_ether) with a sensible unit (ether)\n- The contract functions can be documented from the solidity docs.\n- idiomatic python snake case names, e.g. `getAddress` -> `get_address`\n- user friendly parameter checking, e.g. correct length for `unit256[4]` (python doesn't have fixed length arrays)\n- performant(async)/user friendly call/transaction wrapping \n\n\n# Development Tool Setup\nRequirements:\n- Python 3.7.x\n- Pipenv: `pip install pipenv`\n- ganache-cli for testing (which usually means installing npm, then `npm install ganache-cli`)\n\nSet `PIPENV_VENV_IN_PROJECT=true` in your environment variables to have a `.venv` directory inside\nthe project folder.\n\n`pipenv shell` opens a shell prompt within the virtual environment for the project.\n`pipenv install` will install the project dependencies. `pipenv install --dev` installs \nthe development dependencies.\n\n# Running Tests\nFor dev purposes, we run most tests with ganache (see above).\n\n# Technical Notes\nWeb3.py converts Solidity `address` type to Python `str`, but we don't type hint addresses as such in the generated\ncode, to make it clear they are not arbitrary strings.\n\n## Releasing\nMake sure `setup.py` has a new version, based on semantic versioning.\nAdd a git tag:\n`git tag nomisma.contractapi-x.y.z -m \"Release x.y.z\"`\n`git push upstream nomisma.contractapi-x.y.z`\nClean the dist directory: `rm -rf dist`\nCreate a distribution (in the project's virtual env, usually via `pipenv shell`): \n`python setup.py sdist`\nUpload to pypi (requires username/pw):\n`twine upload dist/*`", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/NomismaTech/ContractAPI", "keywords": "", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "nomisma.contractapi", "package_url": "https://pypi.org/project/nomisma.contractapi/", "platform": "", "project_url": "https://pypi.org/project/nomisma.contractapi/", "project_urls": { "Homepage": "https://github.com/NomismaTech/ContractAPI" }, "release_url": "https://pypi.org/project/nomisma.contractapi/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "Python API wrappers for Nomisma contracts", "version": "0.0.3" }, "last_serial": 5359849, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "0482e2e984c26fe5ae0ba7c49b4539a6", "sha256": "21d08f7874e53f96125ec5b2f06c8302cab7483f6032b8e24c530108ffa4288f" }, "downloads": -1, "filename": "nomisma.contractapi-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0482e2e984c26fe5ae0ba7c49b4539a6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 102755, "upload_time": "2019-05-06T13:04:58", "url": "https://files.pythonhosted.org/packages/1a/61/4ea8daea40f046b2fd97a32a48d8458476e1cfce7d1123e86692f0308f9a/nomisma.contractapi-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ddfca6ba5ab5c629cc848aee5b39cc1e", "sha256": "1ca492f1b5ab1062de16d958e5ee31d67527c95ec0c88e7bf42cabfc811cc77f" }, "downloads": -1, "filename": "nomisma.contractapi-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ddfca6ba5ab5c629cc848aee5b39cc1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 79066, "upload_time": "2019-05-06T13:05:00", "url": "https://files.pythonhosted.org/packages/e8/74/6d1859294065c251e79e1c574ea220b9852111fef3fa920fbb1af461dee2/nomisma.contractapi-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "87da5a50288aa6c6739be666e7bb065c", "sha256": "e1782803e3b9dd6ac858e78e492ed8a10fd62e68beae8d7cb53d23db194b767b" }, "downloads": -1, "filename": "nomisma.contractapi-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "87da5a50288aa6c6739be666e7bb065c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 103032, "upload_time": "2019-05-08T16:26:11", "url": "https://files.pythonhosted.org/packages/a3/c1/bc135f8da83f0c349e7bcf8ef8aa2a1b44818411c3e28699bbec32271dc4/nomisma.contractapi-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4e422ef867ccd72c2d54fd58f76c3ae", "sha256": "7bfa09132585b17278e4b9ac6bfa229553f870ac00bc8e82a0ed5afe3b40af15" }, "downloads": -1, "filename": "nomisma.contractapi-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e4e422ef867ccd72c2d54fd58f76c3ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 79724, "upload_time": "2019-05-08T16:26:13", "url": "https://files.pythonhosted.org/packages/b5/54/e7708775027f108185837b54bd6313e9cf8bf119f54ee2d3a42618c8e453/nomisma.contractapi-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "bc6f6c203b3a000da5a52626509a967c", "sha256": "5807b209691ea52c32ee5b7a3c39c64d991e1c6c62f6a4bf074c542b01f68e19" }, "downloads": -1, "filename": "nomisma.contractapi-0.0.3.tar.gz", "has_sig": false, "md5_digest": "bc6f6c203b3a000da5a52626509a967c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 81810, "upload_time": "2019-06-04T22:01:31", "url": "https://files.pythonhosted.org/packages/9a/19/8258f75772bf7e456eda74876d751d38257a4af951def049f41441b6ce94/nomisma.contractapi-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bc6f6c203b3a000da5a52626509a967c", "sha256": "5807b209691ea52c32ee5b7a3c39c64d991e1c6c62f6a4bf074c542b01f68e19" }, "downloads": -1, "filename": "nomisma.contractapi-0.0.3.tar.gz", "has_sig": false, "md5_digest": "bc6f6c203b3a000da5a52626509a967c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 81810, "upload_time": "2019-06-04T22:01:31", "url": "https://files.pythonhosted.org/packages/9a/19/8258f75772bf7e456eda74876d751d38257a4af951def049f41441b6ce94/nomisma.contractapi-0.0.3.tar.gz" } ] }