{ "info": { "author": "William Morriss", "author_email": "wjmelements@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Binance Chain Transaction Library\nThis library provides a low-level interface for interacting with different Binance Chain transactions.\n\n## Installation\n```sh\npip3 install bnb-tx\n```\n\nOr, in your `Pipfile`:\n```\nbnb-tx = \"==0.0.4\"\n```\n\n\n## Usage\nThe following is an example that uses the `ecdsa` library to sign.\n\n```python3\nimport ecdsa\ndef uncompressed_public_key(sk):\n \"\"\" Derive uncompressed public key \"\"\"\n order = sk.curve.generator.order()\n p = sk.verifying_key.pubkey.point\n x_str = ecdsa.util.number_to_string(p.x(), order)\n y_str = ecdsa.util.number_to_string(p.y(), order)\n uncompressed = b'\\x04' + x_str + y_str\n return uncompressed\n\n\nfrom binance_transaction import BnbTransaction, NewOrder, address_bytes, BUY, GTE, LIMIT_ORDER\n\nsk = ecdsa.SigningKey.from_pem(open('secp256k1-key.pem').read())\nfrom_address = 'bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0'\naccount_number = 96025 # https://docs.binance.org/api-reference/dex-api/paths.html#apiv1accountaddress\nsequence_number = 888\ntx = BnbTransaction(account_number, sequence_number)\norder_id = f'{address_bytes(from_address).hex().upper()}-{sequence_number + 1}'\ntx.add_msg(NewOrder(from_address, order_id, 'BNB_TUSDB-888', LIMIT_ORDER, BUY, 3500000000, 500000000, GTE))\nprint(tx.signing_json())\nsig = sk.sign_digest(tx.signing_hash())\npublic_key = uncompressed_public_key(sk)\ntx.apply_sig(sig, public_key)\nsigned_transaction_bytes = tx.encode()\nprint(f'Signed bytes: {signed_transaction_bytes.hex()}')\n```\n\n## Support\nNot all transaction types are supported.\nPlease consult this table for details.\nIf you need support, please submit a [pull request](https://github.com/trusttoken/bnb-tx-python/pulls).\n\n| Message Type | encode | decode | from\\_obj |\n|---------------|--------|--------|-----------|\n| Send | \u2705 | | \u2705 |\n| NewOrder | \u2705 | | \u2705 |\n| CancelOrder | \u2705 | | \u2705 |\n| Issue | \u2705 | | \u2705 |\n| Mint | \u2705 | | \u2705 |\n| Burn | \u2705 | | \u2705 |\n| Freeze | \u2705 | | \u2705 |\n| Unfreeze | \u2705 | | \u2705 |\n| TimeLock | \u2705 | | \u2705 |\n| TimeUnlock | \u2705 | | \u2705 |\n| TimeRelock | \u2705 | | \u2705 |\n| Proposal | \u2705 | | \u2705 |\n| Vote | \u2705 | | \u2705 |\n\n\n\n## Contributing\nSee [CONTRIBUTING](CONTRIBUTING.md).\n\n\n## License\nLGPLv3", "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/trusttoken/bnb-tx-python", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "bnb-tx", "package_url": "https://pypi.org/project/bnb-tx/", "platform": "", "project_url": "https://pypi.org/project/bnb-tx/", "project_urls": { "Homepage": "https://github.com/trusttoken/bnb-tx-python" }, "release_url": "https://pypi.org/project/bnb-tx/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Binance Chain Transactions", "version": "0.0.4" }, "last_serial": 5627180, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "f4a3bc52654fc3defd3aa1e371545317", "sha256": "eec6a746e0f30ccab21a6c222f8aad0a9eb64c519b65a650a0415fdbc90625fc" }, "downloads": -1, "filename": "bnb-tx-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f4a3bc52654fc3defd3aa1e371545317", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11817, "upload_time": "2019-08-03T04:40:14", "url": "https://files.pythonhosted.org/packages/19/8c/1805c2cbafea27de316cab112103c1838a7064b952c7dd09b595c84fd7f9/bnb-tx-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f4a3bc52654fc3defd3aa1e371545317", "sha256": "eec6a746e0f30ccab21a6c222f8aad0a9eb64c519b65a650a0415fdbc90625fc" }, "downloads": -1, "filename": "bnb-tx-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f4a3bc52654fc3defd3aa1e371545317", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11817, "upload_time": "2019-08-03T04:40:14", "url": "https://files.pythonhosted.org/packages/19/8c/1805c2cbafea27de316cab112103c1838a7064b952c7dd09b595c84fd7f9/bnb-tx-0.0.4.tar.gz" } ] }