Skip to content

omahs/starknet.py

 
 

Repository files navigation

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.gateway_client import GatewayClient

key = 1234
contract = await Contract.from_address(
    address="0x01336fa7c870a7403aced14dda865b75f29113230ed84e3a661f7af70fe83e7b",
    client=GatewayClient("testnet"),
)
(value,) = await contract.functions["get_value"].call(key)

Synchronous API

You can access synchronous world with _sync postfix.

from starknet_py.contract import Contract
from starknet_py.net.gateway_client import GatewayClient

key = 1234
contract = Contract.from_address_sync(
    address="0x01336fa7c870a7403aced14dda865b75f29113230ed84e3a661f7af70fe83e7b",
    client=GatewayClient("testnet"),
)
(value,) = contract.functions["get_value"].call_sync(key)

For more examples click here.

About

✨ 🐍 Python SDK for StarkNet.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.1%
  • Cairo 1.8%
  • Shell 0.1%