{ "info": { "author": "Meheret Tesfaye", "author_email": "meherett@zoho.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# PY-EQUITY\n\n[![Build Status](https://travis-ci.org/meherett/py-equity.svg?branch=master)](https://travis-ci.org/meherett/py-equity)\n![PyPI License](https://img.shields.io/pypi/l/py-equity.svg?color=black)\n![PyPI Version](https://img.shields.io/pypi/v/py-equity.svg?color=blue)\n[![Coverage Status](https://coveralls.io/repos/github/meherett/py-equity/badge.svg?branch=master)](https://coveralls.io/github/meherett/py-equity?branch=master)\n\n*Python wrapper around the BUTXO Equity compiler for Bytom protocol.*\n\n## Installation\n```shell script\n$ pip install py-equity\n```\n\n## Development\nWe welcome pull requests. To get started, just fork this repo, clone it locally, and run:\n```\n$ pip install -e . -r requirements.txt\n```\n\n## Quick Usage\n```python\nfrom equity import Equity\n\nLOCK_WITH_PUBLIC_KEY_SOURCE = \"\"\"\n contract LockWithPublicKey(publicKey: PublicKey) locks valueAmount of valueAsset {\n clause spend(sig: Signature) {\n verify checkTxSig(publicKey, sig)\n unlock valueAmount of valueAsset\n }\n }\n\"\"\"\n\nLOCK_WITH_PUBLIC_KEY_PATH = \"./LockWithPublicKey.equity\"\n\n# LOCK_WITH_PUBLIC_KEY_ARGS = [\n# \"e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78\"\n# ]\n\nequity = Equity(\"http://localhost:9888\")\n\nCOMPILED = equity.compile_source(LOCK_WITH_PUBLIC_KEY_SOURCE,\n \"e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78\")\n\nprint(COMPILED[\"name\"])\nprint(COMPILED[\"program\"])\nprint(COMPILED[\"opcodes\"])\n\nprint(COMPILED)\n\n# Save compiled contract\nequity.save()\n```\n\n`OUTPUT`\n\n```json\n'LockWithPublicKey'\n'20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0'\n'0xe9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78 DEPTH 0xae7cac FALSE CHECKPREDICATE'\n\n{'name': 'LockWithPublicKey', 'source': '\\n contract LockWithPublicKey(publicKey: PublicKey) locks valueAmount of valueAsset {\\n clause spend(sig: Signature) {\\n verify checkTxSig(publicKey, sig)\\n unlock valueAmount of valueAsset\\n }\\n }\\n', 'program': '20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0', 'params': [{'name': 'publicKey', 'type': 'PublicKey'}], 'value': 'valueAmount of valueAsset', 'clause_info': [{'name': 'spend', 'params': [{'name': 'sig', 'type': 'Signature'}], 'values': [{'name': '', 'asset': 'valueAsset', 'amount': 'valueAmount'}]}], 'opcodes': '0xe9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78 DEPTH 0xae7cac FALSE CHECKPREDICATE', 'error': ''}\n```\n\n## CLI\n\nCommand line interface, run the following command:\n\n```shell script\n$ eqt --version\n```\n\nExample `eqt`:\n```shell script\n$ eqt --file LockWithPublicKey.equity --args \"e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78\"\n```\n\nGet help:\n```shell script\n$ eqt --help\n```\n\nFrom there, you can run eqt more commands, `-s\\--save` to save your contract, `-u\\--url` to change Bytom API url. by default (http://localhost:9888).\n\n## Testing\n\nYou can run the tests with:\n\n```\n$ pytest tests\n```\n\nOr use `tox` to run the complete suite against the full set of build targets, or pytest to run specific \ntests against a specific version of Python.\n\n## API\n\n### Class Equity()\n\n**Parameters**\n\n`Optional`:\n- `String` - *url*, Bytom API url, by default (http://localhost:9888).\n- `String` - *api_key*, Bytom API key.\n- `Integer` - *timeout*, request timeout, by default (1).\n\n---\n\n**`compile_source()`**: It is to compiling Bytom smart contract(Equity source).\n\n**Parameters**\n\n`Object`:\n- `String` - *equity_source*, Equity source code.\n\n`Optional`:\n- `Boolean/String/Integer/Array` - **argv*.\n - `Boolean` - *boolean*, boolean parameter.\n - `String` - *string*, string parameter.\n - `Integer` - *integer*, integer parameter.\n\n**Returns**\n\n`Object`:\n- `String` - *name*, contract name.\n- `String` - *source*, contract source code.\n- `String` - *program*, contract program.\n- `Array` - *params*, contract params.\n- `String` - *value*, contract value.\n- `Array` - *clause_info*, contract clause_info.\n- `Array` - *values*, contract values.\n- `String` - *opcodes*, contract opcodes.\n- `String` - *error*, contract error.\n\n**Example**\n\n```python\nLOCK_WITH_PUBLIC_KEY_SOURCE = \"\"\"\n contract LockWithPublicKey(publicKey: PublicKey) locks valueAmount of valueAsset {\n clause spend(sig: Signature) {\n verify checkTxSig(publicKey, sig)\n unlock valueAmount of valueAsset\n }\n }\n\"\"\"\nequity = Equity(\"http://localhost:9888\", timeout=5)\nCOMPILED = equity.compile_source(LOCK_WITH_PUBLIC_KEY_SOURCE,\n \"e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78\")\n\nprint(COMPILED)\n```\n
\nOutput\n\n```json5\n{'name': 'LockWithPublicKey', 'source': '\\n contract LockWithPublicKey(publicKey: PublicKey) locks valueAmount of valueAsset {\\n clause spend(sig: Signature) {\\n verify checkTxSig(publicKey, sig)\\n unlock valueAmount of valueAsset\\n }\\n }\\n', 'program': '20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0', 'params': [{'name': 'publicKey', 'type': 'PublicKey'}], 'value': 'valueAmount of valueAsset', 'clause_info': [{'name': 'spend', 'params': [{'name': 'sig', 'type': 'Signature'}], 'values': [{'name': '', 'asset': 'valueAsset', 'amount': 'valueAmount'}]}], 'opcodes': '0xe9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78 DEPTH 0xae7cac FALSE CHECKPREDICATE', 'error': ''}\n```\n
\n\n----\n\n**`compile_file()`**: It is to compiling Bytom smart contract form Equity file.\n\n**Parameters**\n\n`Object`:\n- `String` - *equity_source*, Equity source code file(.equity or .eqt).\n\n`Optional`:\n- `Boolean/String/Integer/Array` - **argv*.\n - `Boolean` - *boolean*, boolean parameter.\n - `String` - *string*, string parameter.\n - `Integer` - *integer*, integer parameter.\n\n**Returns**\n\n`Object`:\n- `String` - *name*, contract name.\n- `String` - *source*, contract source code.\n- `String` - *program*, contract program.\n- `Array` - *params*, contract params.\n- `String` - *value*, contract value.\n- `Array` - *clause_info*, contract clause_info.\n- `Array` - *values*, contract values.\n- `String` - *opcodes*, contract opcodes.\n- `String` - *error*, contract error.\n\n**Example**\n\n```python\nLOCK_WITH_PUBLIC_KEY_PATH = \"./LockWithPublicKey.equity\"\nequity = Equity(\"http://localhost:9888\", timeout=5)\nCOMPILED = equity.compile_file(LOCK_WITH_PUBLIC_KEY_PATH,\n \"e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78\")\n\nprint(COMPILED)\n```\n
\nOutput\n\n```json5\n{'name': 'LockWithPublicKey', 'source': '\\n contract LockWithPublicKey(publicKey: PublicKey) locks valueAmount of valueAsset {\\n clause spend(sig: Signature) {\\n verify checkTxSig(publicKey, sig)\\n unlock valueAmount of valueAsset\\n }\\n }\\n', 'program': '20e9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e787403ae7cac00c0', 'params': [{'name': 'publicKey', 'type': 'PublicKey'}], 'value': 'valueAmount of valueAsset', 'clause_info': [{'name': 'spend', 'params': [{'name': 'sig', 'type': 'Signature'}], 'values': [{'name': '', 'asset': 'valueAsset', 'amount': 'valueAmount'}]}], 'opcodes': '0xe9108d3ca8049800727f6a3505b3a2710dc579405dde03c250f16d9a7e1e6e78 DEPTH 0xae7cac FALSE CHECKPREDICATE', 'error': ''}\n```\n
\n\n----\n\n**`save()`**: Save compiled equity source.\n\n**Parameters**\n\n`Optional`:\n- `String` - *file_path*, It is for full path with name.\n- `String` - *dir_path*, It is for only dir path.\n\n**Returns**\n\n`Object`:\n- `String` - *name*, contract name.\n\n## AUTHOR\n [MEHERET TESFAYE](https://github.com/meherett)\n\n## LICENSE\n [AGPLv3+](LICENSE)\n\n\n", "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/meherett/py-equity", "keywords": "eqt", "license": "AGPLv3+", "maintainer": "", "maintainer_email": "", "name": "py-equity", "package_url": "https://pypi.org/project/py-equity/", "platform": "", "project_url": "https://pypi.org/project/py-equity/", "project_urls": { "Homepage": "https://github.com/meherett/py-equity" }, "release_url": "https://pypi.org/project/py-equity/0.1.0/", "requires_dist": [ "requests (<3,>=2.22.0)" ], "requires_python": ">=2.7,<4", "summary": "Python wrapper around the BUTXO Equity compiler for Bytom protocol.", "version": "0.1.0" }, "last_serial": 5774413, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "46445e8e771de378dda81469051f6782", "sha256": "0271a63c08ff1e521fe00dbd5b934bb26fc53d8502b473bf93843acab228e4e4" }, "downloads": -1, "filename": "py_equity-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "46445e8e771de378dda81469051f6782", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,<4", "size": 20999, "upload_time": "2019-09-03T07:37:34", "url": "https://files.pythonhosted.org/packages/99/29/b89584131b4f02269fbf656ab651d809a9244060957d331170bc3d710c4c/py_equity-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87f7440272905221571a297dec1ccd2e", "sha256": "3840e03805851b6da91ce09d9ea39223aadae16ec6455c9f1a3021574c51e094" }, "downloads": -1, "filename": "py-equity-0.1.0.tar.gz", "has_sig": false, "md5_digest": "87f7440272905221571a297dec1ccd2e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,<4", "size": 19826, "upload_time": "2019-09-03T07:37:37", "url": "https://files.pythonhosted.org/packages/de/bc/382956f48701d6a06530435c2dd6b0efa995a6188062b9c98f0d464a3073/py-equity-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "46445e8e771de378dda81469051f6782", "sha256": "0271a63c08ff1e521fe00dbd5b934bb26fc53d8502b473bf93843acab228e4e4" }, "downloads": -1, "filename": "py_equity-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "46445e8e771de378dda81469051f6782", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,<4", "size": 20999, "upload_time": "2019-09-03T07:37:34", "url": "https://files.pythonhosted.org/packages/99/29/b89584131b4f02269fbf656ab651d809a9244060957d331170bc3d710c4c/py_equity-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "87f7440272905221571a297dec1ccd2e", "sha256": "3840e03805851b6da91ce09d9ea39223aadae16ec6455c9f1a3021574c51e094" }, "downloads": -1, "filename": "py-equity-0.1.0.tar.gz", "has_sig": false, "md5_digest": "87f7440272905221571a297dec1ccd2e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,<4", "size": 19826, "upload_time": "2019-09-03T07:37:37", "url": "https://files.pythonhosted.org/packages/de/bc/382956f48701d6a06530435c2dd6b0efa995a6188062b9c98f0d464a3073/py-equity-0.1.0.tar.gz" } ] }