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.22.tar.gz (485.0 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.22-cp313-cp313-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.13Windows x86-64

nekoton-0.1.22-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

nekoton-0.1.22-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

nekoton-0.1.22-cp313-cp313-macosx_10_12_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

nekoton-0.1.22-cp312-cp312-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.12Windows x86-64

nekoton-0.1.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nekoton-0.1.22-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nekoton-0.1.22-cp312-cp312-macosx_10_12_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

nekoton-0.1.22-cp311-cp311-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.11Windows x86-64

nekoton-0.1.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nekoton-0.1.22-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nekoton-0.1.22-cp311-cp311-macosx_10_12_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

nekoton-0.1.22-cp310-cp310-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.10Windows x86-64

nekoton-0.1.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nekoton-0.1.22-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.22-cp310-cp310-macosx_10_12_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for nekoton-0.1.22.tar.gz
Algorithm Hash digest
SHA256 31518cb39dd1ff38a1d091cb3a8783f8a2c6f6fdb4f59892e21758b2bddb4ded
MD5 3e19ab2128d1d3876a32ea0b1330001f
BLAKE2b-256 b4c529fc6a2a0cee95dfae7096bcac45fed1703a048fafff2fb1e6bc175462a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5b505e091f963af183fda2ab421aa4f476d39e58839cf74c192958dce86fc0bd
MD5 e7c68ff8370e273234136cfca112cce1
BLAKE2b-256 5fa6f075860510857a8a6a07d55209738ed8d8e294f5cc2f76230e7b1d6f7c8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7f16c8e797594168bf6f35b2dace689659e513faee1cb1bb43f941e6f0d2c59b
MD5 8661d4aa0031856e7d9505249e9ab4d0
BLAKE2b-256 0adbd843e73d528df49efcf944e19cec353a67918238d8fbd1dccbd62a5a6618

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce2def70eec1f3868aefb051a908c97cdac4b80f1062315f359d3cf284c6c9ba
MD5 eb41083b1edb78dd4edc2029c71cc7f6
BLAKE2b-256 ed1d6afdaed3e3dfe7bf464e62d2155df8634092a862402a9529fe89f8b68ff9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a9cf5edc706f5f17d5fdb1b9687ef3d67400184fe1cdc3c499a9358036d45041
MD5 903cd6ca6d461e1ca1c6fc7e02727432
BLAKE2b-256 735e4539527961dcf405afdbb93f07d6f73fb9a366bf10cca3b0c83b75794c0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 328a6a41d9bbaf98c1ced4d94c8e09e2796b0a34e1a5f2738a1413278045aa9a
MD5 c7a33710107d27bd58909fb9d7406c6c
BLAKE2b-256 5eff40a8e0c19bcd18a19f3cdbb37d60dfacd79f7686ba90ed3bad5aee536e6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 965f894a03b5832f24eb0dc9fc259d2191525a79f2cb26f5c7f59ab14524d517
MD5 cdb37beec235658bc0846463f5127ebc
BLAKE2b-256 ef0afde0847ccc49e1a9adf0aae91f7a42a0ee6b0719e1f76af2eee5b40a8e95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3b2ef794bbd9764e2d0123fe664aeeb71cc4f39a5e2ecff5f7a27dcea6cd3fa2
MD5 fc83e8fd769afb03bcf5e018f78d7da1
BLAKE2b-256 f6107adcee0be983468e9aa46044fb34857f15205791ff27e1f952a238d8d9f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 21bfb37ab9a2af009279a8307479aa90b042323ad8147a369f1805d34cd79003
MD5 9b37ea2d408aec679e18ab295f9f1b78
BLAKE2b-256 5e63434af863aed5fe06686ddb73cff9da978a959b47faecc28d4f3fc6bab7a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 86703c313f1141dee7151f7141ab3f445db0478a0d3924284d758ebd83e0b745
MD5 860b52edd0434f41f93781e96b77fd7a
BLAKE2b-256 ad23ca1a5a639c6674c7c76da89f105ccc0b509ba86d2ff3259a5899f881f45b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f3d19af05a5b17136e449d65c08e67096b2fa508a3eb5d8ab66344cb1a9d1f6
MD5 aff9f2e5d2289a1043a847aa6f72d00f
BLAKE2b-256 828bcc38da45927ec7781c55d72327114e6d361c69e3b1db8302aebc95676a23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c9923e25747df83677d7b9b6969b9c1f8bc73f1839e926a80cac559305442ca
MD5 5fb67d7368399bbd77303dcb4ea4e728
BLAKE2b-256 017e9023f0c9b10c2922a7a5410aca7d010ad49169d5cfbf91d316c693e4f46e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7832261ccb43a76f2009f09fa0b4b6549a075546c254e1b6ae1554eef1dcf495
MD5 17cc27fb0b1962e8330b86bf72ebb8f8
BLAKE2b-256 3c6e6e41625b80a0a8634c3b6237ce8c3bbe393aa844eaedaeda574c4dcdcfe2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 35d40f4c9cb7b9381b538f3d4851ab7f97da2169c54e0b0b013f6414fe598855
MD5 93ae0afba4127682b313b8484c36ac50
BLAKE2b-256 a43c036ea5d3e9f4391522bdcbed881558caaeaa36782ca5b9c57be6f8dbc226

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e2451b360e8246d7860906db0f03a89f6d84a877c4a28f83db0c398275fa13d
MD5 b2c1ca700cc8baf46d8719663bb72ab0
BLAKE2b-256 2005802042f2af405a2fa99f29c2313fa59eedfda42d9eade18b287fda9c518b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4267edcb54c8c4c805f67b08b172137263fbdff8757d42463764ba224a43035d
MD5 e487ae5ce6de68e0dcc878bd810ebaaa
BLAKE2b-256 c43f7a9282ede064c5e4a41d1cccc2f569b21f59c0f55450778dd19f3f03362f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.22-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c3f6e8e1e87a8412439c9afb6455f34c3321a08a683fe0959dcb00b88416c6c6
MD5 ee6a53fa23a50f0ef85d2efcdee89a58
BLAKE2b-256 91d1158d572b34b4cf9c86f917eb1162b600fa2946fc05a4cc7705582746e747

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