Skip to main content

A python SDK for StarkNet

Project description

starknet.py

StarkNet SDK for Python

codecov pypi build docs license stars starkware

📘 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.1a0.tar.gz (213.0 kB view details)

Uploaded Source

Built Distribution

starknet_py-0.5.1a0-py3-none-any.whl (232.9 kB view details)

Uploaded Python 3

File details

Details for the file starknet-py-0.5.1a0.tar.gz.

File metadata

  • Download URL: starknet-py-0.5.1a0.tar.gz
  • Upload date:
  • Size: 213.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for starknet-py-0.5.1a0.tar.gz
Algorithm Hash digest
SHA256 4766a2346c8fd719bb4ebd06d098292d478d01aee14104bfc04d32fe9687322b
MD5 a88c35aa212505ca2fb6e60cba2d22ac
BLAKE2b-256 8e183c5f9cc77f401e66e2534f352ab13bc17efbc08422c94b56fe21c528d09a

See more details on using hashes here.

File details

Details for the file starknet_py-0.5.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for starknet_py-0.5.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 c33f9cf793e5569635bec7a09efd0b2df258e3bc4c881c3c20839ec37fd440bf
MD5 d5a57f36239722cc495be45a23fd05a2
BLAKE2b-256 3bc7d9dc674f73710b447961435a1be76387999dd548c792014f26e97df73ec3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page