Skip to content

Commit

Permalink
feat(ts-bindings): Client.deploy with constructor args
Browse files Browse the repository at this point in the history
- allow omiting `--contract-id` flag to `stellar contract bindings
  typescript` command, passing only `--wasm` instead
- if no `--contract-id` is included, then the contract will not be
  fetched from a network, so no network information is logged in this
  case
- this means it's possible to create TS Bindings libraries for contracts
  that have not yet been deployed, which makes it useful to add types
  for `Client.deploy` to the generated TS Bindings
- add fixture example of `test_constructor` from test-wasms
  • Loading branch information
chadoh committed Nov 21, 2024
1 parent 9853a77 commit e924f39
Show file tree
Hide file tree
Showing 20 changed files with 476 additions and 1,166 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/bindings-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
--health-timeout 5s
--health-retries 50
steps:
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
Expand Down
10 changes: 5 additions & 5 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,20 @@ Generate Rust bindings

Generate a TypeScript / JavaScript package

**Usage:** `stellar contract bindings typescript [OPTIONS] --output-dir <OUTPUT_DIR> --contract-id <CONTRACT_ID>`
**Usage:** `stellar contract bindings typescript [OPTIONS] --output-dir <OUTPUT_DIR>`

###### **Options:**

* `--wasm <WASM>` — Path to optional wasm binary
* `--wasm <WASM>` — Path to wasm file on local filesystem. You must either include this OR `--contract-id`
* `--contract-id <CONTRACT_ID>` — A contract ID/address on a network (if no network settings provided, Testnet will be assumed). You must either include this OR `--wasm`
* `--output-dir <OUTPUT_DIR>` — Where to place generated project
* `--overwrite` — Whether to overwrite output directory if it already exists
* `--contract-id <CONTRACT_ID>` — The contract ID/address on the network
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--rpc-header <RPC_HEADERS>` — RPC Header(s) to include in requests to the RPC provider
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."



Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ publish:
typescript-bindings-fixtures: build-test-wasms
cargo run -- contract bindings typescript \
--wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm \
--contract-id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK \
--network futurenet \
--output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types \
--overwrite && \
cargo run -- contract bindings typescript \
--wasm ./target/wasm32-unknown-unknown/test-wasms/test_constructor.wasm \
--output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_constructor \
--overwrite


Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e924f39

Please sign in to comment.