software-mansion / starknet.py

โœจ ๐Ÿ Python SDK for Starknet.

Home Page:https://starknetpy.rtfd.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

starknet.py

Starknet SDK for Python

codecov pypi build docs license stars starkware

๐Ÿ“˜ Documentation

โš™๏ธ Installation

Installation varies between operating systems.

See our documentation on complete instructions

โ–ถ๏ธ Example usage

Asynchronous API

This is the recommended way of using the SDK.

from starknet_py.contract import Contract
from starknet_py.net.full_node_client import FullNodeClient

contract = await Contract.from_address(
    address="0x06689f1bf69af5b8e94e5ab9778c885b37c593d1156234eb423967621f596e73",
    client=FullNodeClient(node_url="https://your.node.url"),
)
(value,) = await contract.functions["get_balance"].call()

Synchronous API

You can access synchronous world with _sync postfix.

from starknet_py.contract import Contract
from starknet_py.net.full_node_client import FullNodeClient

contract = Contract.from_address_sync(
    address="0x06689f1bf69af5b8e94e5ab9778c885b37c593d1156234eb423967621f596e73",
    client=FullNodeClient(node_url="https://your.node.url"),
)
(value,) = contract.functions["get_balance"].call_sync()

For more examples click here.

About

โœจ ๐Ÿ Python SDK for Starknet.

https://starknetpy.rtfd.io/

License:MIT License


Languages

Language:Python 89.1%Language:Cairo 10.5%Language:Shell 0.4%