No project description provided
Project description
nekoton-python 
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nekoton-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: nekoton-0.1.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f4bbbefc7dba7c2f7fb74d3f6c325dbdaa35ef40fd9eabe9cb27d2b5c914ff5
|
|
| MD5 |
1c540ec333574fe444c7fe628b15f9a3
|
|
| BLAKE2b-256 |
ba2d5231f74228362ac7a0e2f9af67f063cdb390e349421b51f670889c69a706
|
File details
Details for the file nekoton-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: nekoton-0.1.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2514fab7d729d91be5271aaca32d10b7999b340c58de10060babe4566ee20221
|
|
| MD5 |
b74cf1fefbcb1e5c9b20a411fe9ec14b
|
|
| BLAKE2b-256 |
824cfdc2086ce60f7e0b703497ea74e21df1b72a2f24f3d223cad1ee288467f3
|