Skip to main content

No project description provided

Reason this release was yanked:

It has a bug with message delivery

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.15-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.15-cp311-cp311-macosx_11_0_arm64.whl (9.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nekoton-0.1.15-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.15-cp310-cp310-macosx_11_0_arm64.whl (9.4 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.15-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.15-cp39-cp39-macosx_11_0_arm64.whl (9.4 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da9b097f77b0b2b890cac8ab7f41bc1a13b2eaf644fc392316e669fedb72bf6d
MD5 74cabe623ba1dba13707ff9987bbc0b9
BLAKE2b-256 89c4984b37313a2994752e584b5b02b0c820e5ae7019169fcaeb2834f217e980

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c546ab34c704ec50fe295785e177994d94f874c728ab12916d0428f9cd20e344
MD5 1d0b1eb63481d76d9dec9bc505b1d892
BLAKE2b-256 8ab7af4dc46db4c8a52febb6b585487c7ea69cdef754ec56edc378bdec5fe7b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e9b152d2e7288becbbc406d089c09ea1fff319d415685f373993456f48eb683
MD5 5a4f315d03db9813607489e69ad347a5
BLAKE2b-256 56a726dcf959681ecd69081c236aaa501e06152f7d35c465f91d90c471cb9864

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d276f8dcd441c256d87f1cfc904e112454c768d7e40ed09190fb7cdeae0a66fc
MD5 52505d97bb67349fe1a1b4910caea5b5
BLAKE2b-256 c36c636ef1171a0b935846ce46a46239644dec513ec11224b6dae073ffa9537f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6d430e3c46ed6b16c8fd9e1481f721e3d043c0993c66f5457a0ffe488c6520b2
MD5 335076bb54e94986b56c2d3e18334510
BLAKE2b-256 912df8a5fe26bef919783ab4da068d9cd560b9e2c57bc59865fde96f11ec2750

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.15-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4329da96b57697ccad1bb8258d19b35a9eb23530f4cd428d405c85cc204ec2da
MD5 cc47a954464f822c4b4bcf5d92ad9446
BLAKE2b-256 7a20d03ce0300dc222e871bb29cffb9a4bfea2eed91f2a6c7fa59607450d2f38

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