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

Uploaded CPython 3.13Windows x86-64

nekoton-0.1.23-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.23-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

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

Uploaded CPython 3.12Windows x86-64

nekoton-0.1.23-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.23-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Uploaded CPython 3.11Windows x86-64

nekoton-0.1.23-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.23-cp311-cp311-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.12+ x86-64

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

Uploaded CPython 3.10Windows x86-64

nekoton-0.1.23-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.23-cp310-cp310-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

nekoton-0.1.23-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.23.tar.gz.

File metadata

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

File hashes

Hashes for nekoton-0.1.23.tar.gz
Algorithm Hash digest
SHA256 66e7e0f0b4b676aab3bbf91893a3827c6d360e9adc7cb5d3a138f36d59e39f6b
MD5 79a676f95690a6ef72aa11c92f63bb38
BLAKE2b-256 19b601111f696fcc9b92b200d3b3f4be14fc6955c7ca20ebb189dd848563dbe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d59054f30399292a21909ef282ed5ffaa9f8175f305c59b7b303ac4572eba682
MD5 f151a13bba2439b5f7b73b6812d3917a
BLAKE2b-256 5f581e382c3c170095e520a41d6bb409b860dee50a121e373fac763f3ebc48bd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2fd737e16dec4cca833784b09498996c296a466297ccee22a0b947e69909cd79
MD5 c5765fa764b33271f28bd1ae17fbf281
BLAKE2b-256 481daa113e8d971ae1dd16f038a10c47eedcc88a8419bb55f77e144e39c0e1f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 037cdc00766c3661959032a03b2f7a63a526c19032a7756b174201691f81c991
MD5 772d4449580ba04e2aadc645e260ce10
BLAKE2b-256 3cba3d6c7a454b81be9d67c889babf9ed2af2823ce55c9258b3ae778d79be40f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a259ce537c2f9bc2d2e309e4907954af39fbc1440420ebfdbaf6e22a28630e6d
MD5 d67ae335015a3a47732380d9c5b1633b
BLAKE2b-256 0462552287286ba078462f0b5f779346f26a0bb35468b32798134b2f709f7007

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1d05b01a37fe3a8a07c9f23ba8fb0921f583c91ce6b21fb639b1d558ed8e3e57
MD5 60350ec649c01b805f4feb99000c25f9
BLAKE2b-256 f8e81dd3dca67edb3e28f4be095bf1fb6f207a0226a064ca60402c294de2759f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f1ab922629c5d3d19e12806a3b2bf3dde4504c22a94f66d869d238386b58c377
MD5 eb1eafa7fd36e86048e54b8d918880fd
BLAKE2b-256 cfb8710c341a99d4e1482a5c866bc68568b1e5709ec85773849e0b26d7d01909

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9825eaff100274a7d557f4e03300a7fe9c8cbbffb5d98ebe33070af44e1c563f
MD5 ae2bd42f95312193d578fa6a38718060
BLAKE2b-256 a632d916e68accea4462c169318da185e44c83bc55f954c06f92750ba3a7fc93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 935142408fdefc252293a18c8887c2b3116e1760b87185428efa7e886ff11e55
MD5 af81291b903e727d3f5da5a5936ce55f
BLAKE2b-256 dcec34b4b54098682f52c882acd03e7d0dfab5d2772bbf748c1556644c1c4eed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ce39fca2cde6f844d8c38f350157cc89374ce911196aea4a884d763cc2014605
MD5 cf090e29d68b304372ffad584df3a2a4
BLAKE2b-256 f54ad46c33169206d6001bf6e4cbd7ba408396dcf20988e6f545ec2f7ddd7706

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a41541c8832b8e787a03ff1f86cfda1612e8b2cd9276ed6f8b2402e9c3cd355
MD5 f03480fc71ac5f8f0824b32bdb6cb6a9
BLAKE2b-256 6810dd0475ea44b055fee9abaede0b27f291a915d92928fef77a32a9f8722952

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fe8588bb03813c14b0ec2e649b6eb9d896b080571c91f283eaa6492c28479de
MD5 7e1e3fcc8ef7e97c35e0a8bf445b62a8
BLAKE2b-256 ce7d07ef32c71a46d4e9019db4e806ccd477d61e489475c248e61227305fd096

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1a1fca1741ed2aa7c03e27c6633f120c1aa9b0433c7b03f83cc71cc78aa0786a
MD5 56fc03b46506cf7915f3e51820e59264
BLAKE2b-256 8120e3b4a0315254939d9508169bdb79d637f10256fb0fe4baf3f300fd821014

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a11fa28d8c2f0f8a2944c5e61c5124fb69ee2e95e5ef93021b7459065faf6346
MD5 457cd3c8ef37e1e2e8a356a02f343c15
BLAKE2b-256 39c3ae8d7175fe67c04248ab4f03ad3de6a173b60a30191faaefb9b964351813

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ce6802ea85a536f8d87ff55bc76022668837cb62d38350cae56df742fed2022
MD5 0b05f1d19a837a17ba24368c9af82128
BLAKE2b-256 19b89dd811200fd465d1a1fb4416dc6d89e959f87ebc8ed9c7820f920a1f62ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9318fede97a172a8acef7b70afbf13ab593a53169a780524c5dbc1b06e0edcdf
MD5 f4e7a12e3c2722a7c165a794a78f36f2
BLAKE2b-256 74b55e856b1ee5529c5fbf6db4ab9dea43e2379a4994087e824af97373e3f7ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nekoton-0.1.23-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9734d0a8f64fae4a250e8f05e9f2443a790501c76a20f7e8135ffeba004cb466
MD5 38eb7e353906a71b6e407caab6bf0c40
BLAKE2b-256 7a5377beaa8303deb8f9e07569c866fc03f602cd29311d07266aed0a09cfbc8b

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