Skip to main content

No project description provided

Project description

Logo

nekoton-python   Latest Version

Python bindings for Nekoton

Usage

Install

pip install nekoton

Example

import asyncio
import nekoton as nt

giver_abi = nt.ContractAbi("""{
    "ABI version": 1,
    "functions": [{
        "name": "sendGrams",
        "inputs": [
            {"name": "dest", "type": "address"},
            {"name": "amount", "type": "uint64"}
        ],
        "outputs": []
    }],
    "events": []
}""")

send_grams = giver_abi.get_function("sendGrams")
assert send_grams is not None


class Giver:
    def __init__(self, transport: nt.Transport, address: nt.Address):
        self._transport = transport
        self._address = address

    @property
    def address(self) -> nt.Address:
        return self._address

    async def give(self, target: nt.Address, amount: nt.Tokens):
        # Prepare external message
        message = send_grams.encode_external_message(
            self._address,
            input={
                "dest": target,
                "amount": amount,
            },
            public_key=None
        ).without_signature()

        # Send external message
        tx = await self._transport.send_external_message(message)
        if tx is None:
            raise RuntimeError("Message expired")

        # Wait until all transactions are produced
        await self._transport.trace_transaction(tx).wait()


async def main():
    transport = nt.JrpcTransport('https://jrpc-broxustestnet.everwallet.net')
    await transport.check_connection()

    giver = Giver(transport, Address('-1:1111111111111111111111111111111111111111111111111111111111111111'))

    await giver.give(giver.address, nt.Tokens(10))


asyncio.run(main())

Local development

  • Install maturin.
  • Configure virtual env:
    python -m venv .env
    source .env/bin/activate
    
  • Dev build:
    maturin develop
    
  • Publish
    maturin build --release --zig --strip
    maturin upload path/to/generated/file.whl
    

Contributing

We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.

License

This project is licensed under the [License Apache].

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nekoton-0.1.21.tar.gz (484.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

nekoton-0.1.21-cp313-cp313-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.13Windows x86-64

nekoton-0.1.21-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

nekoton-0.1.21-cp313-cp313-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

nekoton-0.1.21-cp313-cp313-macosx_10_12_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

nekoton-0.1.21-cp312-cp312-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.12Windows x86-64

nekoton-0.1.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nekoton-0.1.21-cp312-cp312-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nekoton-0.1.21-cp312-cp312-macosx_10_12_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

nekoton-0.1.21-cp311-cp311-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.11Windows x86-64

nekoton-0.1.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nekoton-0.1.21-cp311-cp311-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nekoton-0.1.21-cp311-cp311-macosx_10_12_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

nekoton-0.1.21-cp310-cp310-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.10Windows x86-64

nekoton-0.1.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nekoton-0.1.21-cp310-cp310-macosx_11_0_arm64.whl (4.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.21-cp310-cp310-macosx_10_12_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file nekoton-0.1.21.tar.gz.

File metadata

  • Download URL: nekoton-0.1.21.tar.gz
  • Upload date:
  • Size: 484.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.0

File hashes

Hashes for nekoton-0.1.21.tar.gz
Algorithm Hash digest
SHA256 6fb295a3ad9a1854960deb24a527afe912bb88f46e0357e010618d4bf658edc7
MD5 554625a8c6bdd61323128f4a72d917e0
BLAKE2b-256 073c4e411df902c8cfb51b08fc54d9f7a1dc79ee23c1c0c960e6a43cf0695869

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e5ed5ccf6f0036dd9f31491145b35924d534263ff29e0273548f85a3b30e0c63
MD5 0311f6b1148c4b64d9660bf7cec4d3da
BLAKE2b-256 9f275e3b011e8ec8ada39df94505b761f96c487a95a2620a964cd9a715439c23

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c595410efe06d06264345fa2ef73ecc5f763e544aaabe0a143c56ef8a6f304e2
MD5 185510b5850b0a05282b327f76b13fd0
BLAKE2b-256 b5ecc46bef4e358a7a6f4e6dc6fcda0178c35102f765e7da049962b1bfa9286d

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9dfad7d0bd3cc89fca8dc74dfe41f5d0385ca3cd95fe6adeda9ad89c33c1888a
MD5 158736f3ef46c4607cac236e7cac637b
BLAKE2b-256 32d88529db2125af18748359003a73e1cf15b266f6e8686e05427da76013a7e1

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f111a1870bdfbcba62437fb5bd10e9ecacbbd6a10868e827e978147f69ebca99
MD5 c95296b59e68a1292e5248a3d35fd2f6
BLAKE2b-256 9cdc70582c6cd1900abad09d6b208602a49a7b8674348d9e25165b7c6d1dffeb

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d9511d44dca4d0ffaac650789403362f4155e981e1a5ef8587adce3692c26990
MD5 a95d253e321b8ed114a79bb63d5a1e95
BLAKE2b-256 77afe53fff426ccd56a605ebc350807797fa23389abf24a5aed9442200f0fe28

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c665671671bf5acd2a91ffce9151cdeba076280aecd79bb8b53282b27a34e9dc
MD5 43d04e5539371e49fc56bb9b5d87b605
BLAKE2b-256 7f0cb2b3fabaaad00942d8f892656cb487d3dc8369c86e245bed192d4df0f25d

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d6df33f979b1ef39a6a6955f28aebddc155ba75756f95a475d5d24ce8920016c
MD5 36f62d4ee9b47b775a4adff666ece881
BLAKE2b-256 e15d8a76077b8fb5c090826a897f1a5a506c3f7503273e508e7e2d7368db2337

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1500b4dd986a7bd48700a6cb2ff0b384bc52021603878e1d3ffadf4cdb34b7b0
MD5 b41952a501c38f1a3ca3dd7c9f173d97
BLAKE2b-256 6016516c4b8df664a8cfcbb4133cf14fc37aa24c395009e804c0fbf64d3909a9

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 28228b5ef7e0e399976db7485968641df43b636aeb98c07b5291cc76f93e232b
MD5 4866624e785f95a3ce7aef639ef705d3
BLAKE2b-256 056d05786718137cf4ed83a616364cb99010f4c1896336b49dbd2c3ecfcb91f4

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13eb19dff5d27b08fe14c07cfeb952b3970e9d249e73ea82d5b0825562f3ed52
MD5 9ed73b09f8776bbe01c96e0e9fba9072
BLAKE2b-256 35c48bd4f5b36627e937be3b06aff0872c35d24361a38fa02b463bc1182208d6

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 76c5d32b42dc99b9c6752391bcfd5f4553f6bdbfa71545c934d54959aa095b04
MD5 6cf0f680b412ee1892c55326f5e69c62
BLAKE2b-256 8c31185cfd03eb53e487c327ed17c94eadf0ccc7437e3f072fbc2d61c2d32549

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0265a8635347d1547727f9ef11ad8d2b56daff755a3c171a69f075007756f46c
MD5 706a1a05fbc810783d3359be40c27ccf
BLAKE2b-256 89328e2d35325da58ec42d6acf7d6f796854d7510efb3e63944604f44889a33c

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 993a263fa5bb3397e7d655923020c0a99f7fe3bebfbc4772375d578a05f0560c
MD5 625b44c762c1d8826a7a1ad34339e98a
BLAKE2b-256 ef03da34fc1a8b361ec977f0e4fa0d2702197e488615f95ffc8b2ec684c830e4

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6f05c82aed3ee6af76dc92427528a3b75707b14f86986f6d86f8a3d43abc3fe
MD5 17c2c2bc5a0f6c60365b0a39c3fe8c04
BLAKE2b-256 8ecd51c91b6e8c47330d071a51cd9bd2c6e2f3e44fe8ca16abe4097f265ba40e

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c6df59a5c69bd0468982ef6d1ccec91b0b080df34a79c2c6a81ab437ce717ae
MD5 076d0faed2ad4afb96a0348d69e8b976
BLAKE2b-256 3e5682aad0d54e964ebe74d58904f51f610e225f127a1424f19eefc1183a99ff

See more details on using hashes here.

File details

Details for the file nekoton-0.1.21-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.21-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d6704366a45e190ee101d20d4fde08454a1c6f73d01ad7ce5057a2f1da0f497f
MD5 630ddf542b7921e2015c43c39ada4179
BLAKE2b-256 8262695c5ef54251e70c977ce53a53e47d7d6abde62e526bc3b77509bdf3e2ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page