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.20.tar.gz (484.3 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.20-cp312-none-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.12Windows x86-64

nekoton-0.1.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

nekoton-0.1.20-cp312-cp312-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

nekoton-0.1.20-cp312-cp312-macosx_10_12_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

nekoton-0.1.20-cp311-none-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.11Windows x86-64

nekoton-0.1.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

nekoton-0.1.20-cp311-cp311-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

nekoton-0.1.20-cp311-cp311-macosx_10_12_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

nekoton-0.1.20-cp310-none-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.10Windows x86-64

nekoton-0.1.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

nekoton-0.1.20-cp310-cp310-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.20-cp310-cp310-macosx_10_12_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

nekoton-0.1.20-cp39-none-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.9Windows x86-64

nekoton-0.1.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

nekoton-0.1.20-cp39-cp39-macosx_11_0_arm64.whl (4.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

nekoton-0.1.20-cp39-cp39-macosx_10_12_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for nekoton-0.1.20.tar.gz
Algorithm Hash digest
SHA256 4e0980796c2e07219c231eef597dd7b0071785fa268e4c877a04143d353c4dc3
MD5 79af8ecd0f6605c17721291ea314faaf
BLAKE2b-256 68956fc6e6fbd496d26011ede2364e166672187e53faa7c7da0421eb7d049775

See more details on using hashes here.

File details

Details for the file nekoton-0.1.20-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.20-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 6a2ec72d1e5ed9b8eed0a8634202fe64929b4020166ed82f53c881b9d25f4d24
MD5 143dc5018a9708bd476dcf7175bde359
BLAKE2b-256 db5f932a6fefb06894497fc7c01aaea528b5579d5b5413525e5412cf1564d735

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7135540b91326c9a1298968e2d0d0b0d13f8323e6d8fb063c6ba03d002464e8b
MD5 92b4127fe22d8e8c2d2b74db2461f9d8
BLAKE2b-256 09842be1db18bd4f52b8dff30b813dedb371336d7fc65e959b8ae2bb187d78b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28ad2c2b6fc3109e7d7a62ccc5f4fb19266a5878a7ac1b660e7dc3a42cecbc21
MD5 299a79cb16b36a96a0c6cff245be3233
BLAKE2b-256 f6b9cce31382b99183120a0999c60bbb3c72892ee04422f75954ae08865d42d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3f965e7da64a28d195fb3f8b4288049c0c0bc161df93bedc758c524750bf2760
MD5 d176c95b0457f925a201d015797f8036
BLAKE2b-256 89d901b1df86d54aba9863bf26195b12a7404dcf788f5f83c89df7a0ee68ac7d

See more details on using hashes here.

File details

Details for the file nekoton-0.1.20-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.20-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 f2513034e42bebc402a83418c7ff4ac760fc67aedc934b7d32f822bf1bfc646d
MD5 13766d9e6b3cc2ea03e195918aa1622b
BLAKE2b-256 2f3ff05846f11b436bb9dd63333466d2db3975f9f69b7a32dde9a491b82f7af8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 58013f254b3a05938fede5182ebec25e6a3c0fe859374dad4fb00186658dc84e
MD5 6d27e104bb9d6e18075f4aa8b759c121
BLAKE2b-256 21d5e5b763272b1110f9cee3fec241c606469a53fefbaaba75f27ff8d9686ca5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0139b67ddf3896c81812ca7f8c3f15f1f0450865dc5e87502e606ced88962a3d
MD5 4ba10dd1bfd7d48d181aec48fdf3c406
BLAKE2b-256 fd550f94e160b4e0dc375a458b37cb143d1279ddee1b01c9796ac6602f786c62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9dcd70f996eff418a891e8dd1fec923b603be849d454b5d98f5e2ad0fd863a59
MD5 7ce529b7291662902ef62bd2460fa8a0
BLAKE2b-256 ab7cafa2c78b159e09140e8493134a81b4ee0991b7f53241aa0065cfb88f23b6

See more details on using hashes here.

File details

Details for the file nekoton-0.1.20-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.20-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 ba5bb19834acd8bb9694f66b535d4d41e43ad75420d197ef1ae31465b9cd9c33
MD5 f0762897d0650f6278fd484f0602510f
BLAKE2b-256 86c4274704a55718d1fe5f43d15802a0e39826be46e2197ff862172cbf8121b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 54e1a6949f12248212c0dd0a70b50f140c15f7f2bd28fe9fd8db4f2e4fd56fb8
MD5 5a69b44a3cbf928c09056fc2c12dd187
BLAKE2b-256 15ab4b3bfa1acc7f82df9e6a6fc7e9cf8bdc66bfecc87699c180273ae54e0984

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85a2eac626fd42a799ace348ac57884469b847bd5ac653c365183b46aeef3673
MD5 7224d4358d0da87694214bde6d24d614
BLAKE2b-256 b217b9687eff14c608f07ce84cb907237ffdb8212c9c8d2b184818cd1f6641f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 32c4676f2c6f0aa76f87c29cea17292865fa225f1a47850d873134a6d2e91c79
MD5 1efd0118df1afee0b66516e81e0f8177
BLAKE2b-256 ad7b7e478f9614c9733c538cd51d4ece2775d2ff0ecde69d7cbc72a14a71c484

See more details on using hashes here.

File details

Details for the file nekoton-0.1.20-cp39-none-win_amd64.whl.

File metadata

  • Download URL: nekoton-0.1.20-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 4.1 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.7.1

File hashes

Hashes for nekoton-0.1.20-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 87f0e8d24cb34c48ba77e62ffdb5f69373b93760ad975c36ec64b20d5dbcc879
MD5 473377613edba99b1bc7024449572c30
BLAKE2b-256 fe9ea49c572da92935d5b9434daf148c019a49918e25f7e7c2060ff883f679b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 df6289bf72ce369a4a944ec4958f7d0ea6fc5f9936c5329e0b8661238367f765
MD5 dcc8385360c7c663d10bb788481c0f22
BLAKE2b-256 d90cf7169984f99a9b573c34e16be5836bff5e743844f470a15a9f29f0d6f669

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.20-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 53f257bba94062320ca60ba2fb18f2b1fa12fe889fc53b39fdc777144960384f
MD5 837c031f82fbf0f6a6ccefa102b42d2a
BLAKE2b-256 5a27eff3e9c0d5ba9a80d44972a30665aff1c87fcb11ab182d6850e07e9157f4

See more details on using hashes here.

File details

Details for the file nekoton-0.1.20-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for nekoton-0.1.20-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8fd79b351d730bad61db5a144c342159d735a64924d276446c9fdc6864227b40
MD5 3c500f4931bd676013f40079ad1532c5
BLAKE2b-256 7afb0a8246f96f7dee110a021e21537f10d6b3202280691554cf9dbeadf4ff18

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