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

To generate bindings for a Soroban contract, use the generate command with the required options:

stellar-contract-bindings generate --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF

Options

  • --contract-id: The contract ID to generate bindings for (required).
  • --rpc-url: The Soroban RPC URL (default: https://mainnet.sorobanrpc.com).
  • --language: The target language for bindings (default: python).
  • --output: Output directory for generated bindings (defaults to the current directory).

Example

stellar-contract-bindings generate --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --language python --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! 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.1.0b1.tar.gz (14.9 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.1.0b1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file stellar_contract_bindings-0.1.0b1.tar.gz.

File metadata

File hashes

Hashes for stellar_contract_bindings-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 0f949ae72ec92a753f9c8ce8ec92a186c9447d2651edd704b0d8cc2dcd42bcc5
MD5 dc69a1c7fe9afbf571cb6e8b5a4f6758
BLAKE2b-256 473198f2a81f78cc375c5b1d59a21ffca1a80b25cfe6ad821b6ee2ce945df0af

See more details on using hashes here.

Provenance

The following attestation bundles were made for stellar_contract_bindings-0.1.0b1.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.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for stellar_contract_bindings-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a0821642c1bb27c88d3a0f4ec815cb232288b7ff2490647db6e95f4a6849a62
MD5 4c7563925ac5c29d60e9a32bf7c288b9
BLAKE2b-256 c01a638ed7ee35e37b08f1fc4b92e7874b92ce732e55a3e15c7fc2359183fe71

See more details on using hashes here.

Provenance

The following attestation bundles were made for stellar_contract_bindings-0.1.0b1-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