Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Shaptic
left a comment
There was a problem hiding this comment.
Looks awesome so far! Mostly minor comments below, gonna try it out right now too.
| * Generate .gitignore | ||
| */ | ||
| private generateGitignore(): string { | ||
| const gitignore = [ |
There was a problem hiding this comment.
Should we just fetch and write the official one, instead?
Shaptic
left a comment
There was a problem hiding this comment.
Couple more thoughts after running it on a side-project of mine
|
Size Change: +2.24 MB (+5.26%) 🔍 Total Size: 44.8 MB
|
|
Feedback should be addressed. The sdk now generates the same bindings as the cli besides one difference in how ScOptions are handled. The cli typed it as |
There was a problem hiding this comment.
Pull request overview
This PR implements contract binding generation functionality, porting it from stellar-cli to the JavaScript SDK. It adds a CLI tool and programmatic API to generate fully-typed TypeScript client code from Stellar smart contract specifications.
Changes:
- Adds
BindingGeneratorclass for generating TypeScript bindings from contract specs - Implements CLI with
generatecommand supporting local WASM, network hash, and contract ID sources - Includes comprehensive unit, integration, and e2e tests with snapshot testing
Reviewed changes
Copilot reviewed 24 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/bindings/generator.ts |
Core binding generator with factory methods for creating from WASM/network sources |
src/bindings/client.ts |
Generates typed Client class with contract methods |
src/bindings/types.ts |
Generates TypeScript interfaces for contract structs, enums, and unions |
src/bindings/utils.ts |
Utility functions for type mapping, identifier sanitization, and import generation |
src/bindings/wasm_fetcher.ts |
Fetches contract WASM from network via RPC |
src/cli/index.ts |
CLI implementation with network configuration and option parsing |
src/cli/util.ts |
CLI utility functions for file I/O and contract name derivation |
test/integration/bindings.test.ts |
Unit tests for binding generation |
test/e2e/src/bindings.test.ts |
E2e tests for generated bindings compilation and runtime |
test/e2e/src/cli.test.ts |
E2e tests for CLI functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // URLs and paths | ||
| const REPO_URL = | ||
| "https://raw.githubusercontent.com/stellar/stellar-asset-contract-spec/main/stellar-asset-spec.xdr"; |
There was a problem hiding this comment.
Should this be a specific commit SHA?
Co-authored-by: George <Shaptic@users.noreply.github.com>
|
Herculean effort 💪 Thank you @Ryang-21 👏👏👏 |
CLI Usage Examples
From a local WASM file
From a WASM hash on the network
From a deployed contract ID