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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

nekoton-0.1.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nekoton-0.1.18-cp312-cp312-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nekoton-0.1.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nekoton-0.1.18-cp311-cp311-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nekoton-0.1.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nekoton-0.1.18-cp310-cp310-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.18-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

nekoton-0.1.18-cp39-cp39-macosx_11_0_arm64.whl (3.7 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.18-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 896ea045422f0426b6320eccb1ef8ec228bef1706c9f520ba3ffa625f56d0721
MD5 c3584458e40f125d1a45a3cfc537b403
BLAKE2b-256 2d0cd346e17e004439fe21a2bbf22cef463b1d0a4d7e17623318f61aff6c5efd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.18-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 768f508ac1ed48cea2641bbe2905b7c7cb5a2920e546483a84d5933398b04df2
MD5 c342e8f5d9fd7560b8a629cbb1d7a548
BLAKE2b-256 2d409d867e1148be99974bc09fe3cf854788594f12089ce10ed0312ae4e50b91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.18-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da03b8833890340b1db49c044e1174108c4ac91fa34a7cfcbfabe3c419143cd5
MD5 34bd9118fbdf9d89e9ceacb05495bd49
BLAKE2b-256 b9f8c0a1a87bd4422fa209c9cffaa86ef7c6e1e4c38b1fe639948aefae6df78c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.18-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5ac6c988c8d89f732b236fd2ff44bcc303258bf4ac75ed04ad0653ecd47a2cb
MD5 a0032b40b9f2ee003ad3f49f608c643e
BLAKE2b-256 5362e33ec7f64517ca99e81e7ae8548922c9e911f9c394e572493064a61bac43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.18-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f05d5269f3f7ad3446718c0707b7443a9edd1a886f8fce05b8e14ff6cef7c821
MD5 ef98c00777320955bbca9e3b74551361
BLAKE2b-256 8daa14879ddf92bcf6f741e2ffb167d751c6cc0315e6fe0b6b39df6a3eaef32d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.18-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6bf05fc605059c15c99a943040c57f43945963860940a106a4e6bb4d13cd9c4
MD5 e5d99448b187730f7c7a59ccdf6bc8b0
BLAKE2b-256 2e809901e7ecb7e285b8e93f83dfc7b477098131b859d4e5218f4a929b764c5e

See more details on using hashes here.

File details

Details for the file nekoton-0.1.18-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.18-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9cf736ece45934f438357f2a49155c2672e8848c594d2f1f345cecc74fc02340
MD5 33430014ed737c1f57fb0f3b4680663b
BLAKE2b-256 57c1fcd4ea279ab131b6fae1741aea6f9e374c4aef3a54698d2f8e59db9ca596

See more details on using hashes here.

File details

Details for the file nekoton-0.1.18-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.18-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e959acdad2f8c17c7606cddefb479ecb8c45a180ee840043ab971c0df529132
MD5 6e0dbdf7620a88c0a50d514c855e9800
BLAKE2b-256 fcbf65aab8a9ac9309d01625ddf29f1bee9befccbcf0581ec17ae17cfdbc310d

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