{"id":39171492,"url":"https://github.com/lightsail-network/stellar-contract-bindings","last_synced_at":"2026-01-17T22:23:23.141Z","repository":{"id":264851221,"uuid":"894475140","full_name":"lightsail-network/stellar-contract-bindings","owner":"lightsail-network","description":"CLI tool designed to generate language bindings for Stellar Soroban smart contracts.","archived":false,"fork":false,"pushed_at":"2025-08-23T03:49:21.000Z","size":400,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-25T10:48:40.794Z","etag":null,"topics":["stellar","stellar-cli-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightsail-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-26T12:23:38.000Z","updated_at":"2025-08-23T03:46:24.000Z","dependencies_parsed_at":"2024-11-30T15:19:18.561Z","dependency_job_id":null,"html_url":"https://github.com/lightsail-network/stellar-contract-bindings","commit_stats":null,"previous_names":["lightsail-network/stellar-contract-bindings"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/lightsail-network/stellar-contract-bindings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fstellar-contract-bindings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fstellar-contract-bindings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fstellar-contract-bindings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fstellar-contract-bindings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightsail-network","download_url":"https://codeload.github.com/lightsail-network/stellar-contract-bindings/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fstellar-contract-bindings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28520229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T22:11:28.393Z","status":"ssl_error","status_checked_at":"2026-01-17T22:11:27.841Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["stellar","stellar-cli-plugin"],"created_at":"2026-01-17T22:23:22.430Z","updated_at":"2026-01-17T22:23:23.123Z","avatar_url":"https://github.com/lightsail-network.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stellar-contract-bindings\n\n`stellar-contract-bindings` is a CLI tool designed to generate language bindings for Stellar Soroban smart contracts.\n\nThis tool simplifies the process of interacting with Soroban contracts by generating the necessary code to call contract\nmethods directly from your preferred programming language. Currently, it supports\nPython, Java, Flutter/Dart, PHP, and Swift/iOS. [stellar-cli](https://github.com/stellar/stellar-cli) provides support for TypeScript and Rust.\n\n## Web Interface\nWe have a web interface for generating bindings. You can access via [https://stellar-contract-bindings.fly.dev/](https://stellar-contract-bindings.fly.dev/).\n\n## Installation\n\nYou can install `stellar-contract-bindings` using pip:\n\n```shell\npip install stellar-contract-bindings\n```\n\n## Usage\n\nPlease check the help message for the most up-to-date usage information:\n\n```shell\nstellar-contract-bindings --help\n```\n\n### Examples\n\n#### Python\n```shell\nstellar-contract-bindings python --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --output ./bindings\n```\n\n#### Java\n```shell\nstellar-contract-bindings java --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --output ./bindings --package com.example\n```\n\n#### Flutter/Dart\n```shell\nstellar-contract-bindings flutter --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --output ./lib --class-name MyContract\n```\n\n#### PHP\n```shell\nstellar-contract-bindings php --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --output ./generated --namespace MyApp\\\\Contracts --class-name MyContractClient\n```\n\n#### Swift/iOS\n```shell\nstellar-contract-bindings swift --contract-id CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF --rpc-url https://mainnet.sorobanrpc.com --output ./Sources --class-name MyContract\n```\n\nThese commands will generate language-specific bindings for the specified contract and save them in the respective directories.\n\n### Using the Generated Binding\n\nAfter generating the binding, you can use it to interact with your Soroban contract. Here's an example:\n\n#### Python\n\n```python\nfrom stellar_sdk import Network\nfrom bindings import Client  # Import the generated bindings\n\ncontract_id = \"CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF\"\nrpc_url = \"https://mainnet.sorobanrpc.com\"\nnetwork_passphrase = Network.PUBLIC_NETWORK_PASSPHRASE\n\nclient = Client(contract_id, rpc_url, network_passphrase)\nassembled_tx = client.hello(b\"world\")\nprint(assembled_tx.result())\n# assembled_tx.sign_and_submit()\n```\n\n#### Java\n```java\npublic class Example extends ContractClient {\n    public static void main(String[] args) {\n        KeyPair kp = KeyPair.fromAccountId(\"GD5KKP3LHUDXLDCGKP55NLEOEHMS3Z4BS6IDDZFCYU3BDXUZTBWL7JNF\");\n        Client client = new Client(\"CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF\", \"https://mainnet.sorobanrpc.com\", Network.PUBLIC);\n        AssembledTransaction\u003cList\u003cbyte[]\u003e\u003e tx = client.hello(\"World\".getBytes(), kp.getAccountId(), kp, 100);\n    }\n}\n```\n\n#### Flutter/Dart\n```dart\nimport 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart';\nimport 'lib/my_contract_client.dart'; // Import the generated bindings\n\nvoid main() async {\n  final sourceKeyPair = KeyPair.fromAccountId(\"GD5KKP3LHUDXLDCGKP55NLEOEHMS3Z4BS6IDDZFCYU3BDXUZTBWL7JNF\");\n  // or: final sourceKeyPair = KeyPair.fromSecretSeed(\"S...\");\n  \n  // Create client instance\n  final client = await MyContractClient.forContractId(\n    sourceAccountKeyPair: sourceKeyPair,\n    contractId: \"CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF\",\n    network: Network.PUBLIC,\n    rpcUrl: \"https://mainnet.sorobanrpc.com\",\n  );\n  \n  // Call contract method directly\n  try {\n    final result = await client.hello(input: \"World\");\n    print(\"Contract response: $result\");\n  } catch (e) {\n    print(\"Error calling contract: $e\");\n  }\n  \n  // Or build an assembled transaction for more control\n  final assembledTx = await client.buildHelloTx(\n    input: \"World\",\n    methodOptions: MethodOptions(),\n  );\n}\n```\n\n#### PHP\n```php\n\u003c?php\n\nuse Soneso\\StellarSDK\\Crypto\\KeyPair;\nuse Soneso\\StellarSDK\\Network;\nuse Soneso\\StellarSDK\\Soroban\\Contract\\ClientOptions;\nuse Soneso\\StellarSDK\\Soroban\\Contract\\MethodOptions;\nuse MyApp\\Contracts\\MyContractClient; // Import the generated bindings\n\n// Initialize\n$sourceKeyPair = KeyPair::fromAccountId(\"GD5KKP3LHUDXLDCGKP55NLEOEHMS3Z4BS6IDDZFCYU3BDXUZTBWL7JNF\");\n// or: $sourceKeyPair = KeyPair::fromSeed(\"S...\")\n\n// Create client instance\n$options = new ClientOptions(\n    sourceAccountKeyPair: $sourceKeyPair,\n    contractId: \"CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF\",\n    network: Network::public(),\n    rpcUrl: \"https://mainnet.sorobanrpc.com\"\n);\n\n$client = MyContractClient::forClientOptions($options);\n\n// Call contract method directly\ntry {\n    $result = $client-\u003ehello(\"World\");\n    echo \"Contract response: \" . $result . \"\\n\";\n} catch (Exception $e) {\n    echo \"Error calling contract: \" . $e-\u003egetMessage() . \"\\n\";\n}\n\n// Or build an assembled transaction for more control\n$methodOptions = new MethodOptions();\n$assembledTx = $client-\u003ebuildHelloTx(\"World\", $methodOptions);\n```\n\n#### Swift/iOS\n```swift\nimport stellarsdk\nimport Foundation\n\n// Import the generated bindings\n// Assuming the generated file is named MyContract.swift\n\n// Initialize\nlet sourceKeyPair = try! KeyPair.init(accountId: \"GD5KKP3LHUDXLDCGKP55NLEOEHMS3Z4BS6IDDZFCYU3BDXUZTBWL7JNF\")\n// or: let sourceKeyPair = try! KeyPair.init(secretSeed: \"S...\")\n\n// Create client instance\nlet options = ClientOptions(\n    sourceAccountKeyPair: sourceKeyPair,\n    contractId: \"CDOAW6D7NXAPOCO7TFAWZNJHK62E3IYRGNRVX3VOXNKNVOXCLLPJXQCF\",\n    network: .public,\n    rpcUrl: \"https://mainnet.sorobanrpc.com\"\n)\n\nTask {\n    do {\n        let client = try await MyContract.forClientOptions(options: options)\n        \n        // Call contract method directly\n        let result = try await client.hello(\n            to: \"World\",\n            methodOptions: nil,\n            force: false\n        )\n        print(\"Contract response: \\(result)\")\n        \n        // Or build an assembled transaction for more control\n        let methodOptions = MethodOptions()\n        let assembledTx = try await client.buildHelloTx(\n            to: \"World\",\n            methodOptions: methodOptions\n        )\n        \n    } catch {\n        print(\"Error calling contract: \\(error)\")\n    }\n}\n```\n\n## License\n\nThis project is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! The project is designed to be easy to add support for other languages, please open an issue\nor submit a pull request for any improvements or bug fixes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsail-network%2Fstellar-contract-bindings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightsail-network%2Fstellar-contract-bindings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsail-network%2Fstellar-contract-bindings/lists"}