Python bindings for NEAR Rust primitives.
Project description
Pyonear
pyonear
is a Python binding to the NEAR Rust API crates. It provides
fast and robust wrappers for building, signing and (de)serializing transactions.
The wrapped types come from the near-primitives,
near-crypto and
near-vm-errors crates.
Installation
pip install pyonear
Example usage
>>> from pyonear.crypto import InMemorySigner, KeyType
>>> from pyonear.account_id import AccountId
>>> from pyonear.crypto_hash import CryptoHash
>>> from pyonear.transaction import Transaction, TransferAction
>>> signer = InMemorySigner.from_random(AccountId("alice.near"), KeyType.ED25519)
>>> signer_id = AccountId("alice.near")
>>> signer = InMemorySigner.from_random(signer_id, KeyType.ED25519)
>>> public_key = signer.public_key
>>> nonce = 0
>>> receiver_id = AccountId("bob.near")
>>> block_hash = CryptoHash.default() # replace with a real blockhash
>>> actions = [TransferAction(1_000_000)]
>>> transaction = Transaction(signer_id, public_key, nonce, receiver_id, block_hash, actions).sign(signer)
>>> transaction.to_base64()
'CgAAAGFsaWNlLm5lYXIA++M56uPzUi8ezkHqJBLjc7ZCzJk88zoIpF5XkjUM13kAAAAAAAAAAAgAAABib2IubmVhcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAANAQg8AAAAAAAAAAAAAAAAAALK42W7t/vpUmDAgtChTUWEVvSE3cQZWRla8spN6KfNv9fWn16klROeblzH480b0a+NSL16YfnvWLnd2C9KLTQk='
Development
Pre-requisites: Rust >= 1.65, Python >= 3.7, Poetry >= 1.1.14
Steps
poetry install
(one time only)poetry shell
maturin develop
pytest
make lint
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 Distribution
pyonear-0.1.0.tar.gz
(59.0 kB
view hashes)
Built Distributions
Close
Hashes for pyonear-0.1.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe88c9f9883aebb6be5c3937950c0a9fe3a9c31108ad7920c5fa6e42cbf39fd0 |
|
MD5 | 2d75dae4cbc167c7bec9f78f5c28c94d |
|
BLAKE2b-256 | eb44c7b6abe76e24ad061139dec510e041080b48906797e3f4c10fda4836cebc |
Close
Hashes for pyonear-0.1.0-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96f31fc817a3e68a49279ad922d4d326d7760c8dc757516f1fb7927fa57bb44a |
|
MD5 | d647357427b8ec0195a045cdb36f882b |
|
BLAKE2b-256 | d09dd375c5318f06c41a074dcff70ef39a0a0162daaf18a177efda72f6e4852d |
Close
Hashes for pyonear-0.1.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8ff4288002ed7d9992da6f1cd755b48c7f5a58080c8a9a7bdcafcb72e960799 |
|
MD5 | ee4ccca21c6b010fdaf31a959a7f2a36 |
|
BLAKE2b-256 | 13a55d582273d664f03d3a5dc36b36050c53af4245e1a2a92a2bfc577e377f9a |
Close
Hashes for pyonear-0.1.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eda3c7d24637612d418faca60afd7189b60e28b3c7680387853a9741262d1104 |
|
MD5 | d2847edf2e95dd37130a69ba1359d1aa |
|
BLAKE2b-256 | 944598387cdae9152013fc1da4255ac88caab80733edf7ef943ff3a04a3491d3 |
Close
Hashes for pyonear-0.1.0-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e78972761da5ff8b9a31588fb7ef0cb4ac9563ac25d0316311a01d75665ba658 |
|
MD5 | e8fad1bdcaf977580b7ea53bbfacb23c |
|
BLAKE2b-256 | 55bfcde5caebb6d7790f245262ec80495ec7aa15e998bd1341289e9feb91e76c |
Close
Hashes for pyonear-0.1.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2202f97445bb674367b7b40dd72ac259961719caba7a6547aa0d39ae261cdab4 |
|
MD5 | a72316b15927e74cbb7b875416a93eb6 |
|
BLAKE2b-256 | de007aeb5d26114f27884461e0ad85590f1218079feae33c51c885123fb0548f |
Close
Hashes for pyonear-0.1.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5a1abbea5c8edcc463a713754850bf7e5868c65a373ae2def306741879e354c |
|
MD5 | 3fec7ca1b13a0d4fcbe4af2e3d6d17f3 |
|
BLAKE2b-256 | 983f085ddcdbc70d775e136332e60d178046eaf39ad86845c8a9f30a0361100f |