Name | mospy-wallet JSON |
Version |
0.5.4
JSON |
| download |
home_page | |
Summary | This package is a fork of cosmospy and is a light framework for the cosmos ecosystem |
upload_time | 2024-02-15 18:53:13 |
maintainer | |
docs_url | None |
author | |
requires_python | |
license | BSD 3-Clause License |
keywords |
cosmos
cosmospy
mospy
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# MosPy
MosPy is a fork of the cosmospy library and aims to be a versatile transaction signing library for the whole cosmos ecosystem.
It depends [cosmospy-protobuf](https://github.com/ctrl-Felix/cosmospy-protobuf) for the protos. Through this library you also can add your own transaction types and sign them through Mospy.
## Documentation
A documentation with according examples can be found at https://mospy.ctrl-felix.de
## Get Started
You can find a tutorial series on medium: https://medium.com/@ctrl-felix/mospy-tutorial-1-the-basics-95ec757047dc
## Installation
Mospy is available through (pypi)[https://pypi.org/project/mospy-wallet]
`python -m pip install mospy-wallet`
_Note: The package name in python is mospy even if it is called mospy-wallet on pypi as mospy already existed_
## Quickstart
More examples on: https://mospy.ctrl-felix.de/examples/
```python
import httpx # optional
from mospy import Account, Transaction
account = Account(
seed_phrase="law grab theory better athlete submit awkward hawk state wedding wave monkey audit blame fury wood tag rent furnace exotic jeans drift destroy style",
address_index=12
)
tx = Transaction(
account=account,
gas=1000,
)
tx.set_fee(
amount=100,
denom="uatom"
)
# Add a transfer message to the transaction (multiple messages can be added)
tx.add_msg(
tx_type='transfer',
sender=account,
receipient="cosmos1tkv9rquxr88r7snrg42kxdj9gsnfxxg028kuh9",
amount=1000,
denom="uatom"
)
# Sign and encode transaction to submit it to the network manually
# REST endpoint (RPC or API)
tx_bytes = tx.get_tx_bytes_as_string()
# Submit the transaction through the Tendermint RPC
rpc_url = "https://rpc.cosmos.network/"
pushable_tx = json.dumps(
{
"jsonrpc": "2.0",
"id": 1,
"method": "broadcast_tx_sync", # Available methods: broadcast_tx_sync, broadcast_tx_async, broadcast_tx_commit
"params": {
"tx": tx_bytes
}
}
)
r = httpx.post(rpc_url, data=pushable_tx)
# Submit the transaction through the Cosmos REST API
rpc_api = "https://api.cosmos.network/cosmos/tx/v1beta1/txs"
pushable_tx = json.dumps(
{
"tx_bytes": tx_bytes,
"mode": "BROADCAST_MODE_SYNC" # Available modes: BROADCAST_MODE_SYNC, BROADCAST_MODE_ASYNC, BROADCAST_MODE_BLOCK
}
)
r = httpx.post(rpc_api, data=pushable_tx)
```
## Different transaction types
Mospy is created to support every possible external transaction type.
To make it easier some transaction types are built in and can be added directly to a transaction object.
But it's not difficult to add your own transaction types! More about transaction types can be found in the docs.
Raw data
{
"_id": null,
"home_page": "",
"name": "mospy-wallet",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "cosmos,cosmospy,mospy",
"author": "",
"author_email": "ctrl-felix <dev@ctrl-felix.de>",
"download_url": "https://files.pythonhosted.org/packages/00/d6/0a8b185130aad239dfee973753c8ca6abad2abfd52e4f899a38d7d3f25f7/mospy_wallet-0.5.4.tar.gz",
"platform": null,
"description": "# MosPy\n\nMosPy is a fork of the cosmospy library and aims to be a versatile transaction signing library for the whole cosmos ecosystem.\nIt depends [cosmospy-protobuf](https://github.com/ctrl-Felix/cosmospy-protobuf) for the protos. Through this library you also can add your own transaction types and sign them through Mospy.\n\n## Documentation\n\nA documentation with according examples can be found at https://mospy.ctrl-felix.de\n\n## Get Started\n\nYou can find a tutorial series on medium: https://medium.com/@ctrl-felix/mospy-tutorial-1-the-basics-95ec757047dc\n\n## Installation\n\nMospy is available through (pypi)[https://pypi.org/project/mospy-wallet]\n\n`python -m pip install mospy-wallet`\n\n_Note: The package name in python is mospy even if it is called mospy-wallet on pypi as mospy already existed_\n\n## Quickstart\n\nMore examples on: https://mospy.ctrl-felix.de/examples/\n\n```python\nimport httpx # optional\nfrom mospy import Account, Transaction\n\naccount = Account(\n seed_phrase=\"law grab theory better athlete submit awkward hawk state wedding wave monkey audit blame fury wood tag rent furnace exotic jeans drift destroy style\",\n address_index=12\n)\n\ntx = Transaction(\n account=account,\n gas=1000,\n)\ntx.set_fee(\n amount=100,\n denom=\"uatom\"\n)\n# Add a transfer message to the transaction (multiple messages can be added)\ntx.add_msg(\n tx_type='transfer',\n sender=account,\n receipient=\"cosmos1tkv9rquxr88r7snrg42kxdj9gsnfxxg028kuh9\",\n amount=1000,\n denom=\"uatom\"\n)\n\n# Sign and encode transaction to submit it to the network manually\n\n# REST endpoint (RPC or API)\ntx_bytes = tx.get_tx_bytes_as_string()\n\n# Submit the transaction through the Tendermint RPC\nrpc_url = \"https://rpc.cosmos.network/\"\npushable_tx = json.dumps(\n {\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"broadcast_tx_sync\", # Available methods: broadcast_tx_sync, broadcast_tx_async, broadcast_tx_commit\n \"params\": {\n \"tx\": tx_bytes\n }\n }\n )\nr = httpx.post(rpc_url, data=pushable_tx)\n\n# Submit the transaction through the Cosmos REST API\nrpc_api = \"https://api.cosmos.network/cosmos/tx/v1beta1/txs\"\npushable_tx = json.dumps(\n {\n \"tx_bytes\": tx_bytes,\n \"mode\": \"BROADCAST_MODE_SYNC\" # Available modes: BROADCAST_MODE_SYNC, BROADCAST_MODE_ASYNC, BROADCAST_MODE_BLOCK\n }\n )\nr = httpx.post(rpc_api, data=pushable_tx)\n```\n## Different transaction types\n\nMospy is created to support every possible external transaction type.\nTo make it easier some transaction types are built in and can be added directly to a transaction object.\nBut it's not difficult to add your own transaction types! More about transaction types can be found in the docs.\n",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "This package is a fork of cosmospy and is a light framework for the cosmos ecosystem",
"version": "0.5.4",
"project_urls": {
"Bug Tracker": "https://github.com/ctrl-Felix/mospy/issues",
"Homepage": "https://github.com/ctrl-Felix/mospy/"
},
"split_keywords": [
"cosmos",
"cosmospy",
"mospy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "582a1552e54dcae79471b5911d04afa469c10175b888398f182170754b2b97e2",
"md5": "42b187d0e4ea35c81286a6c425cfa899",
"sha256": "05dfbdcd1316d794bf565e6f0bf238d56b02376e54e18fde5083d05bc09dd743"
},
"downloads": -1,
"filename": "mospy_wallet-0.5.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "42b187d0e4ea35c81286a6c425cfa899",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 16337,
"upload_time": "2024-02-15T18:53:12",
"upload_time_iso_8601": "2024-02-15T18:53:12.064720Z",
"url": "https://files.pythonhosted.org/packages/58/2a/1552e54dcae79471b5911d04afa469c10175b888398f182170754b2b97e2/mospy_wallet-0.5.4-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "00d60a8b185130aad239dfee973753c8ca6abad2abfd52e4f899a38d7d3f25f7",
"md5": "db1e4ff12c02963ba128622456899e17",
"sha256": "814026b4b7e25b1e9e42f46244e4c56c037de1e453bb600b499d766c0246e1ff"
},
"downloads": -1,
"filename": "mospy_wallet-0.5.4.tar.gz",
"has_sig": false,
"md5_digest": "db1e4ff12c02963ba128622456899e17",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18354,
"upload_time": "2024-02-15T18:53:13",
"upload_time_iso_8601": "2024-02-15T18:53:13.611098Z",
"url": "https://files.pythonhosted.org/packages/00/d6/0a8b185130aad239dfee973753c8ca6abad2abfd52e4f899a38d7d3f25f7/mospy_wallet-0.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-15 18:53:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ctrl-Felix",
"github_project": "mospy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "mospy-wallet"
}