Add rpc.Server.queryContract for one-line read-only contract calls#1502
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1ee9a78da
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1e427d597
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
amazing! can you add an integration test against testnet to confirm the happy path works E2E for both a Wasm contract and a SAC? |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| const server = | ||
| options.server ?? | ||
| new Server(rpcUrl, { | ||
| allowHttp, | ||
| headers, | ||
| }); |
* Make contract.Client factories generic for typed runtime clients * Add `rpc.Server.getContractMethods` for contract method discovery (#1505) * Add rpc.Server.getContractMethods for contract method discovery * Document queryContract and getContractMethods in the invoke-a-contract guide * Type the contract.Client examples in the invoke and auth guides
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…om` (#1501) * Handle SAC in contract.Client.from * Docs updated * Fix tests * Optimize * Fix and update docs * Update error response * Rollup: enable inlineDynamicImports * Update error message + outdated comment * Add rpc.Server.queryContract for one-line read-only contract calls (#1502) * Add rpc.Server.queryContract for one-line read-only contract calls * Sanitize method name * Check only contract methods before invoking * e2e test happy path * Make contract.Client factories generic for typed runtime clients (#1504) * Make contract.Client factories generic for typed runtime clients * Add `rpc.Server.getContractMethods` for contract method discovery (#1505) * Add rpc.Server.getContractMethods for contract method discovery * Document queryContract and getContractMethods in the invoke-a-contract guide * Type the contract.Client examples in the invoke and auth guides * Updated changelog * Return { result, isReadCall } from queryContract (#1511)
Adds
rpc.Server.queryContract(contractId, method, args?, networkPassphrase?)— a one-line read-only contract query that returns a spec-decoded result, no manual transaction assembly/simulation required. Works transparently for both Wasm contracts and built-in Stellar Asset Contracts (SACs).Changes
queryContractonrpc.Server: resolves the network passphrase (viagetNetwork()unless provided), builds a SAC-aware client, simulates the call, and returns.result.Client.fromnow honors a caller-providedoptions.server(matchingfromWasmHashand the constructor), soqueryContractreuses the server's transport (headers, interceptors, allowHttp).NOTE: Based on #1501