A python SDK for StarkNet
Project description
✨🐍 starknet.py
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.contract import Contract
from starknet.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.contract import Contract
from starknet.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.1.1a0.tar.gz
(68.8 kB
view details)
Built Distribution
File details
Details for the file starknet.py-0.1.1a0.tar.gz
.
File metadata
- Download URL: starknet.py-0.1.1a0.tar.gz
- Upload date:
- Size: 68.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.12 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23ab3513bbfb15ed98f75a8e53a112a1919bac39f1931bdf21de8caf8995628c |
|
MD5 | d39f1de9a0b7ef781b058202e6a7572e |
|
BLAKE2b-256 | 01ac871adc597eafe9a527baa47dbbf396d73abfc2ac28a36e4f8156121b1a46 |
File details
Details for the file starknet.py-0.1.1a0-py3-none-any.whl
.
File metadata
- Download URL: starknet.py-0.1.1a0-py3-none-any.whl
- Upload date:
- Size: 78.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.12 Darwin/21.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cc07d8c02f7d8cc734efc94873634df1335d205d46d61739afc191089b3ee1b |
|
MD5 | 537a9edc295cad52156fa0952eecb3cd |
|
BLAKE2b-256 | 5380758e07f56144ceb2577973bb26d990f82b2f56786354e4ab774534eb3ace |