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.17-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nekoton-0.1.17-cp312-cp312-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nekoton-0.1.17-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nekoton-0.1.17-cp311-cp311-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nekoton-0.1.17-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nekoton-0.1.17-cp310-cp310-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.17-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

nekoton-0.1.17-cp39-cp39-macosx_11_0_arm64.whl (3.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb1344da9abec26572c863dec349cc923d819ff90ff9dce2a752c54a51a3fbd9
MD5 d3e0d361fcd1c24a79636900d261e04a
BLAKE2b-256 430f4251b6924fd50043f4072fc56d690fe55831373dd1071d88fa0b02362818

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47903e434ed1b3e5cf971d424a17d7b98de99b1b808e4425a62c78f8b08ad7d2
MD5 670d2f2810dfe00652a6edfa4b8535f5
BLAKE2b-256 bbc033d79e81a82dafb11cae32906988f6e6172ba2f5bd6d0d244d883239cff3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b4ca928028d5ca87a37febe1bfb15345bbfb1be7eb8b3e19e737199a30d226e0
MD5 74f2bd4d59617b32ff032f4724f4cc02
BLAKE2b-256 95ad0e9eaa2114fb6324ac26d1e7b4864293525742480e9322df304e1d98f658

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92f6ebbf9a959417e293ebcc90e4a7c9529d9e0214e752a2fc7fe4dd42744c57
MD5 d683a306a5b463f0c65d635b39f1b9f3
BLAKE2b-256 1fbdce0def8e62f76c56e6db67950d28ac1b8e16d98f2bb2f09d902dc5c0a830

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a60c97c4afb2d3eb7af6f126e037449655a4edaf4d45680eee6a0cb08609f448
MD5 4f712e47b2fb525ccd5f322a0f668fa3
BLAKE2b-256 8c65c6ea48ce170ec5fc940c2b8bb0a877e667624a7b7f4ce49fc3f07e6674e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41ce9286aa6498d9f83ad7567e100afc55da5577c27fbac5900784ee04c94eae
MD5 6d0180276d5b31e77901c04686d3452d
BLAKE2b-256 08bbfb4f336b890f4f534616b19aa10c669dd8aaeb15fa8e1435081d240b05c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c58508008a344c9fedc04d1abe0a90ad490e464aaf02453dbbd9a56e86e5c411
MD5 50c313e16fcebd01e1e534262eefb9f4
BLAKE2b-256 a7ca96463ad5db98ae94e82ff751a139b9ce60b278627b5ef87c2cfdf287c97f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.17-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41cb6e2f10cc7a9c5c2c538c8e973fe7fa13447afff468f2387de943fa13e155
MD5 95a7b4bce86d2469145f78d846a11bb8
BLAKE2b-256 6c0c1aa72ec6561dbef920c86d77e9ea2d653c24e6be499768e8f87daac50290

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