Skip to content

feat(cli): add generate-bindings command wrapping the Stellar code generator - #824

Closed
davidugorji wants to merge 1 commit into
BCPathway:mainfrom
davidugorji:feat/701-cli-generate-bindings
Closed

feat(cli): add generate-bindings command wrapping the Stellar code generator#824
davidugorji wants to merge 1 commit into
BCPathway:mainfrom
davidugorji:feat/701-cli-generate-bindings

Conversation

@davidugorji

Copy link
Copy Markdown
Contributor

Implements the generate-bindings CLI utility.

Wraps stellar contract bindings <language> so binding generation is reachable from the project CLI with the configured network already applied. All seven generators are supported (typescript, rust, python, java, flutter, swift, php).

Option combinations are validated before spawning, so misuse is reported by this CLI rather than as an opaque subprocess failure: exactly one contract source, --output-dir where required, and the rust generator restricted to a local --wasm to match its actual flag surface. The binary resolves through STELLAR_CLI_BIN/SOROBAN_CLI_BIN for the soroban→stellar rename, and a missing binary yields an install hint instead of a bare ENOENT.

Verification: tsc clean, 17/17 unit tests pass, and verified end-to-end against Stellar CLI 25.2.0 — typescript generation produced a package exposing the real contract methods, and the rust generator emitted a client module.

Closes #701

…nerator

Adds a `bc-forge generate-bindings` command that drives
`stellar contract bindings <language>` so binding generation is reachable
from the project CLI with the configured network already applied.

All seven generators the Stellar CLI exposes are supported: typescript,
rust, python, java, flutter, swift and php.

Option combinations are validated before spawning, so misuse is reported
by this CLI rather than as an opaque subprocess failure:

- exactly one contract source (--wasm, --wasm-hash or --contract-id)
- --output-dir required for the generators that write a package
- the rust generator accepts a local --wasm only, matching its actual
  flag surface, and is rejected early for network sources

RPC flags are forwarded only when generating from the network, since a
local wasm needs no node. The binary is resolved through STELLAR_CLI_BIN
/ SOROBAN_CLI_BIN to accommodate the soroban -> stellar rename, and a
missing binary produces an install hint instead of a bare ENOENT.

The command runner is injected so tests assert the argument vector
without spawning a process. Verified end to end against Stellar CLI
25.2.0: typescript generation produced a package exposing the real
contract methods, and the rust generator emitted a client module.

Closes BCPathway#701
@davidugorji
davidugorji force-pushed the feat/701-cli-generate-bindings branch from 2b3ed71 to 91a30bc Compare August 26, 2026 15:24
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@davidugorji Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davidugorji

Copy link
Copy Markdown
Contributor Author

Superseded by #829, which bundles all four issues (#699, #700, #701, #759) into a single PR. Closing in favour of that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLI] Utility: Generate ABI/bindings

1 participant