mospy-wallet


Namemospy-wallet JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
SummaryThis package is a fork of cosmospy and is a light framework for the cosmos ecosystem
upload_time2024-08-03 15:02:46
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseBSD 3-Clause License
keywords cosmos cosmospy mospy
VCS
bugtrack_url
requirements bech32 cosmospy_protobuf ecdsa grpcio hdwallets httpx mnemonic protobuf safe-pysha3 pysha3 pycryptodome
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": null,
    "name": "mospy-wallet",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "cosmos, cosmospy, mospy",
    "author": null,
    "author_email": "ctrl-felix <dev@ctrl-felix.de>",
    "download_url": "https://files.pythonhosted.org/packages/ff/d2/c17c2a929eeaf9e8b09ae10393abf5d70edb6fe2c7419e07b5f78a6033ff/mospy_wallet-0.6.0.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.6.0",
    "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": "53d6f8f873b6c801b67a69736bb74490c19cd08dcd817db629fb8357db787e78",
                "md5": "20a4e5526c1bc25daa44b630185ce5d8",
                "sha256": "52802646d61db9f3850fd0ca0508e751a99763896f15985d5be4d2f556b4e1f4"
            },
            "downloads": -1,
            "filename": "mospy_wallet-0.6.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20a4e5526c1bc25daa44b630185ce5d8",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 17605,
            "upload_time": "2024-08-03T15:02:45",
            "upload_time_iso_8601": "2024-08-03T15:02:45.076275Z",
            "url": "https://files.pythonhosted.org/packages/53/d6/f8f873b6c801b67a69736bb74490c19cd08dcd817db629fb8357db787e78/mospy_wallet-0.6.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffd2c17c2a929eeaf9e8b09ae10393abf5d70edb6fe2c7419e07b5f78a6033ff",
                "md5": "ce9f6af51743a9240ba7606d010e1858",
                "sha256": "aa85d0b185bc134161e5115d928492ce3e235a6751c9c2be0d8c7d347ce4e7d4"
            },
            "downloads": -1,
            "filename": "mospy_wallet-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ce9f6af51743a9240ba7606d010e1858",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19857,
            "upload_time": "2024-08-03T15:02:46",
            "upload_time_iso_8601": "2024-08-03T15:02:46.586807Z",
            "url": "https://files.pythonhosted.org/packages/ff/d2/c17c2a929eeaf9e8b09ae10393abf5d70edb6fe2c7419e07b5f78a6033ff/mospy_wallet-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-03 15:02:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ctrl-Felix",
    "github_project": "mospy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "bech32",
            "specs": [
                [
                    "==",
                    "1.2.0"
                ]
            ]
        },
        {
            "name": "cosmospy_protobuf",
            "specs": [
                [
                    ">=",
                    "0.2.0"
                ]
            ]
        },
        {
            "name": "ecdsa",
            "specs": [
                [
                    ">=",
                    "0.19.0"
                ]
            ]
        },
        {
            "name": "grpcio",
            "specs": [
                [
                    ">=",
                    "1.56.2"
                ]
            ]
        },
        {
            "name": "hdwallets",
            "specs": [
                [
                    "==",
                    "0.1.2"
                ]
            ]
        },
        {
            "name": "httpx",
            "specs": [
                [
                    "~=",
                    "0.23.0"
                ]
            ]
        },
        {
            "name": "mnemonic",
            "specs": [
                [
                    "==",
                    "0.20"
                ]
            ]
        },
        {
            "name": "protobuf",
            "specs": [
                [
                    "==",
                    "4.22.1"
                ]
            ]
        },
        {
            "name": "safe-pysha3",
            "specs": [
                [
                    "==",
                    "1.0.3"
                ]
            ]
        },
        {
            "name": "pysha3",
            "specs": [
                [
                    "==",
                    "1.0.2"
                ]
            ]
        },
        {
            "name": "pycryptodome",
            "specs": [
                [
                    "==",
                    "3.20.0"
                ]
            ]
        }
    ],
    "lcname": "mospy-wallet"
}
        
Elapsed time: 9.37324s