Skip to main content

CLI tool designed to generate language bindings for Stellar Soroban smart contracts.

Project description

stellar-contract-bindings

stellar-contract-bindings is a CLI tool designed to generate language bindings for Stellar Soroban smart contracts.

This tool simplifies the process of interacting with Soroban contracts by generating the necessary code to call contract methods directly from your preferred programming language. Currently, it supports Python. stellar-cli provides support for TypeScript and Rust.

Installation

You can install stellar-contract-bindings using pip:

pip install stellar-contract-bindings

Usage

Please check the help message for the most up-to-date usage information:

stellar-contract-bindings --help

Example

stellar-contract-bindings python --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --output ./bindings

This command will generate Python binding for the specified contract and save it in the ./bindings directory.

Using the Generated Binding

Python

After generating the binding, you can use it to interact with your Soroban contract. Here's an example:

from stellar_sdk import Network
from bindings import Client  # Import the generated bindings

contract_id = "CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF"
rpc_url = "https://mainnet.sorobanrpc.com"
network_passphrase = Network.PUBLIC_NETWORK_PASSPHRASE

client = Client(contract_id, rpc_url, network_passphrase)
assembled_tx = client.hello(b"world")
print(assembled_tx.result())
# assembled_tx.sign_and_submit()

License

This project is licensed under the Apache-2.0 License. See the LICENSE file for details.

Contributing

Contributions are welcome! The project is designed to be easy to add support for other languages, please open an issue or submit a pull request for any improvements or bug fixes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stellar_contract_bindings-0.2.1b0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stellar_contract_bindings-0.2.1b0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file stellar_contract_bindings-0.2.1b0.tar.gz.

File metadata

File hashes

Hashes for stellar_contract_bindings-0.2.1b0.tar.gz
Algorithm Hash digest
SHA256 10e569e2cdb68aa2e24484faa743e5bf51e5e15ee4f676806a483fce82014c47
MD5 80afd6191864b0997a6f118556cb9412
BLAKE2b-256 207d656d9408a668f1c6c3f48e8a1557fcfb809e1f7fc7d5c593acdc03165226

See more details on using hashes here.

Provenance

The following attestation bundles were made for stellar_contract_bindings-0.2.1b0.tar.gz:

Publisher: continuous-integration-workflow.yml on lightsail-network/stellar-contract-bindings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stellar_contract_bindings-0.2.1b0-py3-none-any.whl.

File metadata

File hashes

Hashes for stellar_contract_bindings-0.2.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 8959b73073a3c7e38ddd55802bacb1110ccbe7f21a9560f462d2676748bed348
MD5 3294e5852e18e1a2571b449452c16c60
BLAKE2b-256 fd49965cc68d9b4cc8a0b6fe8a92e3eb1453015df17ac64cb20c68c182984aa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for stellar_contract_bindings-0.2.1b0-py3-none-any.whl:

Publisher: continuous-integration-workflow.yml on lightsail-network/stellar-contract-bindings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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