A python SDK for StarkNet
Project description
StarkNet SDK for Python
📘 Documentation
Installation
To install this package run
pip install starknet.py
or using Poetry:
poetry add starknet.py
▶️ Example usage
Asynchronous API
This is the recommended way of using the SDK.
from starknet_py.contract import Contract
from starknet_py.net.client import Client
key = 1234
contract = await Contract.from_address("0x01336fa7c870a7403aced14dda865b75f29113230ed84e3a661f7af70fe83e7b", Client("testnet"))
invocation = await contract.functions["set_value"].invoke(key, 7)
await invocation.wait_for_acceptance()
(saved,) = await contract.functions["get_value"].call(key) # 7
Synchronous API
You can access synchronous world with _sync
postfix.
from starknet_py.contract import Contract
from starknet_py.net.client import Client
key = 1234
contract = Contract.from_address_sync("0x01336fa7c870a7403aced14dda865b75f29113230ed84e3a661f7af70fe83e7b", Client("testnet"))
invocation = contract.functions["set_value"].invoke_sync(key, 7)
invocation.wait_for_acceptance_sync()
(saved,) = contract.functions["get_value"].call_sync(key) # 7
See more here.
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
starknet_py-0.5.0a0.tar.gz
(97.8 kB
view details)
File details
Details for the file starknet_py-0.5.0a0.tar.gz
.
File metadata
- Download URL: starknet_py-0.5.0a0.tar.gz
- Upload date:
- Size: 97.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0b1cc3b294aa6b2c2b8d38f45d2cd59f94a1920ce88c572aa3adc64f4300f88 |
|
MD5 | b03e434760674ad5adf34f04337a26ab |
|
BLAKE2b-256 | a2532f4f64d374629cc8c29ae1c9a6021622eff6ce49ac38a1073f51ba7819c3 |