From e6e37e0023e319ac104c505d91e2b49255f83dc0 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Mon, 18 Sep 2023 14:43:47 -0400 Subject: [PATCH] chore: update ts bindings --- .github/workflows/bindings-ts.yml | 40 ++ .gitignore | 2 - .../fixtures/test_custom_types/README.md | 8 + .../test_custom_types/dist/cjs/index.d.ts | 4 +- .../test_custom_types/dist/cjs/index.js | 190 ++++++++ .../test_custom_types/dist/cjs/invoke.d.ts | 11 + .../test_custom_types/dist/cjs/invoke.js | 55 +++ .../dist/cjs/method-options.d.ts | 8 + .../test_custom_types/dist/esm/index.d.ts | 434 +++++++++++++++++- .../test_custom_types/dist/esm/index.js | 157 +++++++ .../test_custom_types/dist/esm/invoke.d.ts | 11 + .../test_custom_types/dist/esm/invoke.js | 55 +++ .../dist/esm/method-options.d.ts | 8 + .../test_custom_types/dist/types/index.d.ts | 434 +++++++++++++++++- .../test_custom_types/dist/types/invoke.d.ts | 11 + .../dist/types/method-options.d.ts | 8 + .../test_custom_types/package-lock.json | 77 +++- .../fixtures/test_custom_types/package.json | 4 + .../fixtures/test_custom_types/src/convert.ts | 8 +- .../fixtures/test_custom_types/src/index.ts | 244 +++++++++- .../fixtures/test_custom_types/src/invoke.ts | 65 +++ .../fixtures/test_custom_types/tsconfig.json | 4 +- .../src/boilerplate.rs | 6 +- cmd/crates/soroban-spec-typescript/src/lib.rs | 6 +- .../src/project_template/src/convert.ts | 8 +- .../src/project_template/src/invoke.ts | 14 +- .../src/project_template/tsconfig.json | 4 +- .../soroban-spec-typescript/ts-tests/.env | 1 + .../ts-tests/.gitignore | 4 +- .../soroban-spec-typescript/ts-tests/.nvmrc | 1 + .../ts-tests/.soroban/network/standalone.toml | 2 + .../ts-tests/package-lock.json | 353 ++++++++++++-- .../ts-tests/package.json | 15 +- .../soroban-spec-typescript/ts-tests/soroban | 3 + .../ts-tests/src/test-custom-types.ts | 176 +++++++ .../ts-tests/src/test-hello-world.ts | 22 + .../ts-tests/src/test-methods-as-args.ts | 12 + .../ts-tests/src/util.ts | 27 ++ .../ts-tests/tsconfig.json | 6 +- .../test-wasms/hello_world/src/lib.rs | 6 + 40 files changed, 2419 insertions(+), 85 deletions(-) create mode 100644 .github/workflows/bindings-ts.yml create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/.env create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/.soroban/network/standalone.toml create mode 100755 cmd/crates/soroban-spec-typescript/ts-tests/soroban create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/src/test-methods-as-args.ts create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts diff --git a/.github/workflows/bindings-ts.yml b/.github/workflows/bindings-ts.yml new file mode 100644 index 0000000000..3fb8c407e7 --- /dev/null +++ b/.github/workflows/bindings-ts.yml @@ -0,0 +1,40 @@ +name: bindings typescript + +on: [push] + +jobs: + test: + name: test generated libraries + runs-on: ubuntu-20.04 + services: + rpc: + image: stellar/quickstart:soroban-dev@sha256:a6b03cf6b0433c99f2f799b719f0faadbb79684b1b763e7674ba749fb0f648ee + ports: + - 8000:8000 + env: + ENABLE_LOGS: true + NETWORK: standalone + ENABLE_SOROBAN_RPC: true + options: >- + --health-cmd "curl -X POST \"http://localhost:8000/soroban/rpc\"" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - run: echo $CARGO_TARGET_DIR + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - run: rustup update + - run: cargo build + - run: rustup target add wasm32-unknown-unknown + - run: make build-test-wasms + - run: npm ci && npm run test + working-directory: cmd/crates/soroban-spec-typescript/ts-tests diff --git a/.gitignore b/.gitignore index 3c608cc131..00ec6c1d46 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ target/ .soroban/ !test.toml - -cmd/crates/soroban-spec-typescript/fixtures/ts/package-lock.json diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/README.md b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/README.md index 86ef3b7e48..6329d82fdd 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/README.md +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/README.md @@ -6,7 +6,11 @@ This library was automatically generated by Soroban CLI using a command similar ```bash soroban contract bindings ts \ +<<<<<<< HEAD + --rpc-url https://rpc-futurenet.stellar.org:443 \ +======= --rpc-url https://rpc-futurenet.stellar.org:443/soroban/rpc \ +>>>>>>> main --network-passphrase "Test SDF Future Network ; October 2022" \ --contract-id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK \ --output-dir ./path/to/test_custom_types @@ -30,7 +34,11 @@ However, we've actually encountered [frustration](https://github.com/stellar/sor ```json "scripts": { +<<<<<<< HEAD + "postinstall": "soroban contract bindings ts --rpc-url https://rpc-futurenet.stellar.org:443 --network-passphrase \"Test SDF Future Network ; October 2022\" --id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK --name test_custom_types" +======= "postinstall": "soroban contract bindings ts --rpc-url https://rpc-futurenet.stellar.org:443/soroban/rpc --network-passphrase \"Test SDF Future Network ; October 2022\" --id CBYMYMSDF6FBDNCFJCRC7KMO4REYFPOH2U4N7FXI3GJO6YXNCQ43CDSK --name test_custom_types" +>>>>>>> main } ``` diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts index afc811097f..4346926e0a 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.d.ts @@ -48,8 +48,8 @@ export declare const networks: { }; }; /** - * This is from the rust doc above the struct Test - */ + * This is from the rust doc above the struct Test + */ export interface Test { a: u32; b: boolean; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js index a03274e972..5f27a393f5 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/index.js @@ -86,11 +86,20 @@ var RoyalCard; RoyalCard[RoyalCard["Jack"] = 11] = "Jack"; RoyalCard[RoyalCard["Queen"] = 12] = "Queen"; RoyalCard[RoyalCard["King"] = 13] = "King"; +<<<<<<< HEAD +})(RoyalCard || (exports.RoyalCard = RoyalCard = {})); +======= })(RoyalCard = exports.RoyalCard || (exports.RoyalCard = {})); +>>>>>>> main const Errors = { 1: { message: "Please provide an odd number" } }; class Contract { +<<<<<<< HEAD + options; + spec; +======= +>>>>>>> main constructor(options) { this.options = options; this.spec = new soroban_client_1.ContractSpec([ @@ -130,8 +139,13 @@ class Contract { "AAAAAAAAAAAAAAAMdHVwbGVfc3RydWt0AAAAAQAAAAAAAAAMdHVwbGVfc3RydWt0AAAH0AAAAAtUdXBsZVN0cnVjdAAAAAABAAAH0AAAAAtUdXBsZVN0cnVjdAA=" ]); } +<<<<<<< HEAD + hello = async ({ hello }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= async hello({ hello }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'hello', args: this.spec.funcArgsToScVals("hello", { hello }), ...options, @@ -140,18 +154,30 @@ class Contract { return this.spec.funcResToNative("hello", xdr); }, }); +<<<<<<< HEAD + }; + woid = async (options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async woid(options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'woid', args: this.spec.funcArgsToScVals("woid", {}), ...options, ...this.options, parseResultXdr: () => { }, }); +<<<<<<< HEAD + }; + val = async (options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async val(options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'val', args: this.spec.funcArgsToScVals("val", {}), ...options, @@ -160,10 +186,17 @@ class Contract { return this.spec.funcResToNative("val", xdr); }, }); +<<<<<<< HEAD + }; + u32FailOnEven = async ({ u32_ }, options = {}) => { + try { + return await (0, invoke_js_1.invoke)({ +======= } async u32FailOnEven({ u32_ }, options = {}) { try { return await invoke_js_1.invoke({ +>>>>>>> main method: 'u32_fail_on_even', args: this.spec.funcArgsToScVals("u32_fail_on_even", { u32_ }), ...options, @@ -181,9 +214,15 @@ class Contract { } throw e; } +<<<<<<< HEAD + }; + u32 = async ({ u32_ }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async u32({ u32_ }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'u32_', args: this.spec.funcArgsToScVals("u32_", { u32_ }), ...options, @@ -192,9 +231,15 @@ class Contract { return this.spec.funcResToNative("u32_", xdr); }, }); +<<<<<<< HEAD + }; + i32 = async ({ i32_ }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async i32({ i32_ }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'i32_', args: this.spec.funcArgsToScVals("i32_", { i32_ }), ...options, @@ -203,9 +248,15 @@ class Contract { return this.spec.funcResToNative("i32_", xdr); }, }); +<<<<<<< HEAD + }; + i64 = async ({ i64_ }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async i64({ i64_ }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'i64_', args: this.spec.funcArgsToScVals("i64_", { i64_ }), ...options, @@ -214,12 +265,21 @@ class Contract { return this.spec.funcResToNative("i64_", xdr); }, }); +<<<<<<< HEAD + }; + /** + * Example contract method which takes a struct + */ + struktHel = async ({ strukt }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } /** * Example contract method which takes a struct */ async struktHel({ strukt }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'strukt_hel', args: this.spec.funcArgsToScVals("strukt_hel", { strukt }), ...options, @@ -228,9 +288,15 @@ class Contract { return this.spec.funcResToNative("strukt_hel", xdr); }, }); +<<<<<<< HEAD + }; + strukt = async ({ strukt }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async strukt({ strukt }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'strukt', args: this.spec.funcArgsToScVals("strukt", { strukt }), ...options, @@ -239,9 +305,15 @@ class Contract { return this.spec.funcResToNative("strukt", xdr); }, }); +<<<<<<< HEAD + }; + simple = async ({ simple }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async simple({ simple }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'simple', args: this.spec.funcArgsToScVals("simple", { simple }), ...options, @@ -250,9 +322,15 @@ class Contract { return this.spec.funcResToNative("simple", xdr); }, }); +<<<<<<< HEAD + }; + complex = async ({ complex }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async complex({ complex }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'complex', args: this.spec.funcArgsToScVals("complex", { complex }), ...options, @@ -261,9 +339,15 @@ class Contract { return this.spec.funcResToNative("complex", xdr); }, }); +<<<<<<< HEAD + }; + addresse = async ({ addresse }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async addresse({ addresse }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'addresse', args: this.spec.funcArgsToScVals("addresse", { addresse }), ...options, @@ -272,9 +356,15 @@ class Contract { return this.spec.funcResToNative("addresse", xdr); }, }); +<<<<<<< HEAD + }; + bytes = async ({ bytes }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async bytes({ bytes }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'bytes', args: this.spec.funcArgsToScVals("bytes", { bytes }), ...options, @@ -283,9 +373,15 @@ class Contract { return this.spec.funcResToNative("bytes", xdr); }, }); +<<<<<<< HEAD + }; + bytesN = async ({ bytes_n }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async bytesN({ bytes_n }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'bytes_n', args: this.spec.funcArgsToScVals("bytes_n", { bytes_n }), ...options, @@ -294,9 +390,15 @@ class Contract { return this.spec.funcResToNative("bytes_n", xdr); }, }); +<<<<<<< HEAD + }; + card = async ({ card }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async card({ card }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'card', args: this.spec.funcArgsToScVals("card", { card }), ...options, @@ -305,9 +407,15 @@ class Contract { return this.spec.funcResToNative("card", xdr); }, }); +<<<<<<< HEAD + }; + boolean = async ({ boolean }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async boolean({ boolean }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'boolean', args: this.spec.funcArgsToScVals("boolean", { boolean }), ...options, @@ -316,12 +424,21 @@ class Contract { return this.spec.funcResToNative("boolean", xdr); }, }); +<<<<<<< HEAD + }; + /** + * Negates a boolean value + */ + not = async ({ boolean }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } /** * Negates a boolean value */ async not({ boolean }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'not', args: this.spec.funcArgsToScVals("not", { boolean }), ...options, @@ -330,9 +447,15 @@ class Contract { return this.spec.funcResToNative("not", xdr); }, }); +<<<<<<< HEAD + }; + i128 = async ({ i128 }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async i128({ i128 }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'i128', args: this.spec.funcArgsToScVals("i128", { i128 }), ...options, @@ -341,9 +464,15 @@ class Contract { return this.spec.funcResToNative("i128", xdr); }, }); +<<<<<<< HEAD + }; + u128 = async ({ u128 }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async u128({ u128 }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'u128', args: this.spec.funcArgsToScVals("u128", { u128 }), ...options, @@ -352,9 +481,15 @@ class Contract { return this.spec.funcResToNative("u128", xdr); }, }); +<<<<<<< HEAD + }; + multiArgs = async ({ a, b }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async multiArgs({ a, b }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'multi_args', args: this.spec.funcArgsToScVals("multi_args", { a, b }), ...options, @@ -363,9 +498,15 @@ class Contract { return this.spec.funcResToNative("multi_args", xdr); }, }); +<<<<<<< HEAD + }; + map = async ({ map }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async map({ map }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'map', args: this.spec.funcArgsToScVals("map", { map }), ...options, @@ -374,9 +515,15 @@ class Contract { return this.spec.funcResToNative("map", xdr); }, }); +<<<<<<< HEAD + }; + vec = async ({ vec }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async vec({ vec }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'vec', args: this.spec.funcArgsToScVals("vec", { vec }), ...options, @@ -385,9 +532,15 @@ class Contract { return this.spec.funcResToNative("vec", xdr); }, }); +<<<<<<< HEAD + }; + tuple = async ({ tuple }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async tuple({ tuple }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'tuple', args: this.spec.funcArgsToScVals("tuple", { tuple }), ...options, @@ -396,12 +549,21 @@ class Contract { return this.spec.funcResToNative("tuple", xdr); }, }); +<<<<<<< HEAD + }; + /** + * Example of an optional argument + */ + option = async ({ option }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } /** * Example of an optional argument */ async option({ option }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'option', args: this.spec.funcArgsToScVals("option", { option }), ...options, @@ -410,9 +572,15 @@ class Contract { return this.spec.funcResToNative("option", xdr); }, }); +<<<<<<< HEAD + }; + u256 = async ({ u256 }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async u256({ u256 }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'u256', args: this.spec.funcArgsToScVals("u256", { u256 }), ...options, @@ -421,9 +589,15 @@ class Contract { return this.spec.funcResToNative("u256", xdr); }, }); +<<<<<<< HEAD + }; + i256 = async ({ i256 }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async i256({ i256 }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'i256', args: this.spec.funcArgsToScVals("i256", { i256 }), ...options, @@ -432,9 +606,15 @@ class Contract { return this.spec.funcResToNative("i256", xdr); }, }); +<<<<<<< HEAD + }; + string = async ({ string }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async string({ string }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'string', args: this.spec.funcArgsToScVals("string", { string }), ...options, @@ -443,9 +623,15 @@ class Contract { return this.spec.funcResToNative("string", xdr); }, }); +<<<<<<< HEAD + }; + tupleStrukt = async ({ tuple_strukt }, options = {}) => { + return await (0, invoke_js_1.invoke)({ +======= } async tupleStrukt({ tuple_strukt }, options = {}) { return await invoke_js_1.invoke({ +>>>>>>> main method: 'tuple_strukt', args: this.spec.funcArgsToScVals("tuple_strukt", { tuple_strukt }), ...options, @@ -454,6 +640,10 @@ class Contract { return this.spec.funcResToNative("tuple_strukt", xdr); }, }); +<<<<<<< HEAD + }; +======= } +>>>>>>> main } exports.Contract = Contract; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.d.ts index 1934a69a6b..297f108d34 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.d.ts @@ -1,16 +1,27 @@ import * as SorobanClient from "soroban-client"; +<<<<<<< HEAD +import type { Memo, MemoType, Operation, Transaction, xdr } from "soroban-client"; +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from "./method-options.js"; +export type Tx = Transaction, Operation[]>; +======= import { SorobanRpc } from "soroban-client"; import type { Memo, MemoType, Operation, Transaction, xdr } from "soroban-client"; import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from "./method-options.js"; export declare type Tx = Transaction, Operation[]>; +>>>>>>> main export declare class NotImplementedError extends Error { } declare type Simulation = SorobanRpc.SimulateTransactionResponse; declare type SendTx = SorobanRpc.SendTransactionResponse; declare type GetTx = SorobanRpc.GetTransactionResponse; declare let someRpcResponse: Simulation | SendTx | GetTx; +<<<<<<< HEAD +type SomeRpcResponse = typeof someRpcResponse; +type InvokeArgs = MethodOptions & ClassOptions & { +======= declare type SomeRpcResponse = typeof someRpcResponse; declare type InvokeArgs = MethodOptions & ClassOptions & { +>>>>>>> main method: string; args?: any[]; parseResultXdr: (xdr: string | xdr.ScVal) => T; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.js index c6e606fe56..2cc3107f56 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/invoke.js @@ -2,7 +2,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.sendTx = exports.signTx = exports.invoke = exports.NotImplementedError = void 0; const SorobanClient = require("soroban-client"); +<<<<<<< HEAD +======= const soroban_client_1 = require("soroban-client"); +>>>>>>> main /** * Get account details from the Soroban network for the publicKey currently * selected in Freighter. If not connected to Freighter, return null. @@ -23,7 +26,11 @@ exports.NotImplementedError = NotImplementedError; // defined this way so typeahead shows full union, not named alias let someRpcResponse; async function invoke({ method, args = [], fee = 100, responseType, parseResultXdr, secondsToWait = 10, rpcUrl, networkPassphrase, contractId, wallet, }) { +<<<<<<< HEAD + wallet = wallet ?? (await Promise.resolve().then(() => require("@stellar/freighter-api"))).default; +======= wallet = wallet ?? (await Promise.resolve().then(() => require("@stellar/freighter-api"))); +>>>>>>> main let parse = parseResultXdr; const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith("http://"), @@ -42,6 +49,31 @@ async function invoke({ method, args = [], fee = 100, responseType, parseResultX .setTimeout(SorobanClient.TimeoutInfinite) .build(); const simulated = await server.simulateTransaction(tx); +<<<<<<< HEAD + if (simulated.error) + throw simulated.error; + if (responseType === "simulated") + return simulated; + // is it possible for `auths` to be present but empty? Probably not, but let's be safe. + let authsCount = simulated.result.auth?.length ?? 0; + const writeLength = simulated.transactionData + .build() + .resources() + .footprint() + .readWrite().length; + const isViewCall = authsCount === 0 && writeLength === 0; + if (isViewCall) { + if (responseType === "full") + return simulated; + const retval = simulated.result?.retval; + if (!retval) { + if (simulated.error) { + throw new Error(simulated.error); + } + throw new Error(`Invalid response from simulateTransaction:\n{simulated}`); + } + return parseResultXdr(retval); +======= if (soroban_client_1.SorobanRpc.isSimulationError(simulated)) { throw new Error(simulated.error); } @@ -59,6 +91,7 @@ async function invoke({ method, args = [], fee = 100, responseType, parseResultX return simulated; } return parseResultXdr(simulated.result.retval); +>>>>>>> main } if (authsCount > 1) { throw new NotImplementedError("Multiple auths not yet supported"); @@ -78,10 +111,22 @@ async function invoke({ method, args = [], fee = 100, responseType, parseResultX } tx = await signTx(wallet, SorobanClient.assembleTransaction(tx, networkPassphrase, simulated).build(), networkPassphrase); const raw = await sendTx(tx, secondsToWait, server); +<<<<<<< HEAD + if (responseType === "full") +======= if (responseType === "full") { +>>>>>>> main return raw; } // if `sendTx` awaited the inclusion of the tx in the ledger, it used +<<<<<<< HEAD + // `getTransaction`, which has a `returnValue` field + if ("returnValue" in raw) + return parse(raw.returnValue); + // otherwise, it returned the result of `sendTransaction` + if ("errorResultXdr" in raw) + return parse(raw.errorResultXdr); +======= // `getTransaction`, which has a `resultXdr` field if ("resultXdr" in raw) { const getResult = raw; @@ -96,6 +141,7 @@ async function invoke({ method, args = [], fee = 100, responseType, parseResultX const sendResult = raw; return parse(sendResult.errorResultXdr); } +>>>>>>> main // if neither of these are present, something went wrong console.error("Don't know how to parse result! Returning full RPC response."); return raw; @@ -136,7 +182,11 @@ async function sendTx(tx, secondsToWait, server) { let waitTime = 1000; let exponentialFactor = 1.5; while (Date.now() < waitUntil && +<<<<<<< HEAD + getTransactionResponse.status === "NOT_FOUND") { +======= getTransactionResponse.status === soroban_client_1.SorobanRpc.GetTransactionStatus.NOT_FOUND) { +>>>>>>> main // Wait a beat await new Promise((resolve) => setTimeout(resolve, waitTime)); /// Exponential backoff @@ -144,10 +194,15 @@ async function sendTx(tx, secondsToWait, server) { // See if the transaction is complete getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); } +<<<<<<< HEAD + if (getTransactionResponse.status === "NOT_FOUND") { + console.error(`Waited ${secondsToWait} seconds for transaction to complete, but it did not. Returning anyway. Check the transaction status manually. Info: ${JSON.stringify(sendTransactionResponse, null, 2)}`); +======= if (getTransactionResponse.status === soroban_client_1.SorobanRpc.GetTransactionStatus.NOT_FOUND) { console.error(`Waited ${secondsToWait} seconds for transaction to complete, but it did not. ` + `Returning anyway. Check the transaction status manually. ` + `Info: ${JSON.stringify(sendTransactionResponse, null, 2)}`); +>>>>>>> main } return getTransactionResponse; } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/method-options.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/method-options.d.ts index a959d97f2f..b16b3fcb44 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/method-options.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/method-options.d.ts @@ -13,7 +13,11 @@ export interface Wallet { accountToSign?: string; }) => Promise; } +<<<<<<< HEAD +export type ClassOptions = { +======= export declare type ClassOptions = { +>>>>>>> main contractId: string; networkPassphrase: string; rpcUrl: string; @@ -32,7 +36,11 @@ export declare type ClassOptions = { */ wallet?: Wallet; }; +<<<<<<< HEAD +export type MethodOptions = { +======= export declare type MethodOptions = { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts index afc811097f..e5d49a6077 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.d.ts @@ -1,6 +1,22 @@ import * as SorobanClient from 'soroban-client'; import { ContractSpec, Address } from 'soroban-client'; import { Buffer } from "buffer"; +<<<<<<< HEAD +import type { ClassOptions } from './method-options.js'; +export * from './invoke.js'; +export * from './method-options.js'; +export type u32 = number; +export type i32 = number; +export type u64 = bigint; +export type i64 = bigint; +export type u128 = bigint; +export type i128 = bigint; +export type u256 = bigint; +export type i256 = bigint; +export type Option = T | undefined; +export type Typepoint = bigint; +export type Duration = bigint; +======= import type { ResponseTypes, ClassOptions } from './method-options.js'; export * from './invoke.js'; export * from './method-options.js'; @@ -15,6 +31,7 @@ export declare type i256 = bigint; export declare type Option = T | undefined; export declare type Typepoint = bigint; export declare type Duration = bigint; +>>>>>>> main export { Address }; export interface Error_ { message: string; @@ -48,8 +65,8 @@ export declare const networks: { }; }; /** - * This is from the rust doc above the struct Test - */ + * This is from the rust doc above the struct Test + */ export interface Test { a: u32; b: boolean; @@ -70,8 +87,13 @@ export declare enum RoyalCard { Queen = 12, King = 13 } +<<<<<<< HEAD +export type TupleStruct = readonly [Test, SimpleEnum]; +export type ComplexEnum = { +======= export declare type TupleStruct = readonly [Test, SimpleEnum]; export declare type ComplexEnum = { +>>>>>>> main tag: "Struct"; values: readonly [Test]; } | { @@ -91,13 +113,21 @@ export declare class Contract { readonly options: ClassOptions; spec: ContractSpec; constructor(options: ClassOptions); +<<<<<<< HEAD + hello: ({ hello }: { +======= hello({ hello }: { +>>>>>>> main hello: string; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -105,6 +135,19 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + woid: (options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number | undefined; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -116,6 +159,7 @@ export declare class Contract { * The fee to pay for the transaction. Default: 100. */ fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -123,6 +167,19 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + val: (options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number | undefined; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -134,6 +191,7 @@ export declare class Contract { * The fee to pay for the transaction. Default: 100. */ fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -141,6 +199,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + u32FailOnEven: ({ u32_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -148,12 +215,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; u32FailOnEven({ u32_ }: { +>>>>>>> main u32_: u32; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -161,6 +233,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise | (R extends undefined ? Err | Ok | undefined : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok | undefined)>; + u32: ({ u32_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -168,12 +249,17 @@ export declare class Contract { secondsToWait?: number; }): Promise | (R extends undefined ? Err | Ok : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok)>; u32({ u32_ }: { +>>>>>>> main u32_: u32; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -181,6 +267,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i32: ({ i32_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -188,12 +283,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; i32({ i32_ }: { +>>>>>>> main i32_: i32; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -201,6 +301,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i64: ({ i64_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -208,12 +317,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; i64({ i64_ }: { +>>>>>>> main i64_: i64; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -221,6 +335,18 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + /** + * Example contract method which takes a struct + */ + struktHel: ({ strukt }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -231,12 +357,17 @@ export declare class Contract { * Example contract method which takes a struct */ struktHel({ strukt }: { +>>>>>>> main strukt: Test; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -244,6 +375,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + strukt: ({ strukt }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -251,12 +391,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; strukt({ strukt }: { +>>>>>>> main strukt: Test; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -264,6 +409,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + simple: ({ simple }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -271,12 +425,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; simple({ simple }: { +>>>>>>> main simple: SimpleEnum; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -284,6 +443,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + complex: ({ complex }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -291,12 +459,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; complex({ complex }: { +>>>>>>> main complex: ComplexEnum; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -304,6 +477,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + addresse: ({ addresse }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -311,12 +493,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; addresse({ addresse }: { +>>>>>>> main addresse: Address; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -324,6 +511,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + bytes: ({ bytes }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -331,12 +527,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; bytes({ bytes }: { +>>>>>>> main bytes: Buffer; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -344,6 +545,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + bytesN: ({ bytes_n }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -351,12 +561,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; bytesN({ bytes_n }: { +>>>>>>> main bytes_n: Buffer; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -364,6 +579,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + card: ({ card }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -371,12 +595,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; card({ card }: { +>>>>>>> main card: RoyalCard; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -384,6 +613,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + boolean: ({ boolean }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -391,12 +629,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; boolean({ boolean }: { +>>>>>>> main boolean: boolean; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -404,6 +647,18 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + /** + * Negates a boolean value + */ + not: ({ boolean }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -414,12 +669,17 @@ export declare class Contract { * Negates a boolean value */ not({ boolean }: { +>>>>>>> main boolean: boolean; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -427,6 +687,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i128: ({ i128 }: { + i128: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -435,11 +705,16 @@ export declare class Contract { }): Promise; i128({ i128 }: { i128: i128; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -447,6 +722,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + u128: ({ u128 }: { + u128: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -455,11 +740,16 @@ export declare class Contract { }): Promise; u128({ u128 }: { u128: u128; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -467,6 +757,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + multiArgs: ({ a, b }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -474,13 +773,18 @@ export declare class Contract { secondsToWait?: number; }): Promise; multiArgs({ a, b }: { +>>>>>>> main a: u32; b: boolean; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -488,6 +792,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + map: ({ map }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -495,12 +808,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; map({ map }: { +>>>>>>> main map: Map; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -508,6 +826,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; + vec: ({ vec }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -515,12 +842,17 @@ export declare class Contract { secondsToWait?: number; }): Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; vec({ vec }: { +>>>>>>> main vec: Array; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -528,6 +860,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + tuple: ({ tuple }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -535,12 +876,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; tuple({ tuple }: { +>>>>>>> main tuple: readonly [string, u32]; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -548,6 +894,18 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + /** + * Example of an optional argument + */ + option: ({ option }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -558,12 +916,17 @@ export declare class Contract { * Example of an optional argument */ option({ option }: { +>>>>>>> main option: Option; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -571,6 +934,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Option>; + u256: ({ u256 }: { + u256: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -579,11 +952,16 @@ export declare class Contract { }): Promise; u256({ u256 }: { u256: u256; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -591,6 +969,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i256: ({ i256 }: { + i256: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -599,11 +987,16 @@ export declare class Contract { }): Promise; i256({ i256 }: { i256: i256; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -611,6 +1004,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + string: ({ string }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -618,12 +1020,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; string({ string }: { +>>>>>>> main string: string; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -631,6 +1038,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + tupleStrukt: ({ tuple_strukt }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -638,12 +1054,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; tupleStrukt({ tuple_strukt }: { +>>>>>>> main tuple_strukt: TupleStruct; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -651,10 +1072,19 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number; }): Promise; +>>>>>>> main } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js index 9b6aab7503..e6536fab2e 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/index.js @@ -76,6 +76,11 @@ const Errors = { 1: { message: "Please provide an odd number" } }; export class Contract { +<<<<<<< HEAD + options; + spec; +======= +>>>>>>> main constructor(options) { this.options = options; this.spec = new ContractSpec([ @@ -115,7 +120,11 @@ export class Contract { "AAAAAAAAAAAAAAAMdHVwbGVfc3RydWt0AAAAAQAAAAAAAAAMdHVwbGVfc3RydWt0AAAH0AAAAAtUdXBsZVN0cnVjdAAAAAABAAAH0AAAAAtUdXBsZVN0cnVjdAA=" ]); } +<<<<<<< HEAD + hello = async ({ hello }, options = {}) => { +======= async hello({ hello }, options = {}) { +>>>>>>> main return await invoke({ method: 'hello', args: this.spec.funcArgsToScVals("hello", { hello }), @@ -125,8 +134,13 @@ export class Contract { return this.spec.funcResToNative("hello", xdr); }, }); +<<<<<<< HEAD + }; + woid = async (options = {}) => { +======= } async woid(options = {}) { +>>>>>>> main return await invoke({ method: 'woid', args: this.spec.funcArgsToScVals("woid", {}), @@ -134,8 +148,13 @@ export class Contract { ...this.options, parseResultXdr: () => { }, }); +<<<<<<< HEAD + }; + val = async (options = {}) => { +======= } async val(options = {}) { +>>>>>>> main return await invoke({ method: 'val', args: this.spec.funcArgsToScVals("val", {}), @@ -145,8 +164,13 @@ export class Contract { return this.spec.funcResToNative("val", xdr); }, }); +<<<<<<< HEAD + }; + u32FailOnEven = async ({ u32_ }, options = {}) => { +======= } async u32FailOnEven({ u32_ }, options = {}) { +>>>>>>> main try { return await invoke({ method: 'u32_fail_on_even', @@ -166,8 +190,13 @@ export class Contract { } throw e; } +<<<<<<< HEAD + }; + u32 = async ({ u32_ }, options = {}) => { +======= } async u32({ u32_ }, options = {}) { +>>>>>>> main return await invoke({ method: 'u32_', args: this.spec.funcArgsToScVals("u32_", { u32_ }), @@ -177,8 +206,13 @@ export class Contract { return this.spec.funcResToNative("u32_", xdr); }, }); +<<<<<<< HEAD + }; + i32 = async ({ i32_ }, options = {}) => { +======= } async i32({ i32_ }, options = {}) { +>>>>>>> main return await invoke({ method: 'i32_', args: this.spec.funcArgsToScVals("i32_", { i32_ }), @@ -188,8 +222,13 @@ export class Contract { return this.spec.funcResToNative("i32_", xdr); }, }); +<<<<<<< HEAD + }; + i64 = async ({ i64_ }, options = {}) => { +======= } async i64({ i64_ }, options = {}) { +>>>>>>> main return await invoke({ method: 'i64_', args: this.spec.funcArgsToScVals("i64_", { i64_ }), @@ -199,11 +238,19 @@ export class Contract { return this.spec.funcResToNative("i64_", xdr); }, }); +<<<<<<< HEAD + }; + /** + * Example contract method which takes a struct + */ + struktHel = async ({ strukt }, options = {}) => { +======= } /** * Example contract method which takes a struct */ async struktHel({ strukt }, options = {}) { +>>>>>>> main return await invoke({ method: 'strukt_hel', args: this.spec.funcArgsToScVals("strukt_hel", { strukt }), @@ -213,8 +260,13 @@ export class Contract { return this.spec.funcResToNative("strukt_hel", xdr); }, }); +<<<<<<< HEAD + }; + strukt = async ({ strukt }, options = {}) => { +======= } async strukt({ strukt }, options = {}) { +>>>>>>> main return await invoke({ method: 'strukt', args: this.spec.funcArgsToScVals("strukt", { strukt }), @@ -224,8 +276,13 @@ export class Contract { return this.spec.funcResToNative("strukt", xdr); }, }); +<<<<<<< HEAD + }; + simple = async ({ simple }, options = {}) => { +======= } async simple({ simple }, options = {}) { +>>>>>>> main return await invoke({ method: 'simple', args: this.spec.funcArgsToScVals("simple", { simple }), @@ -235,8 +292,13 @@ export class Contract { return this.spec.funcResToNative("simple", xdr); }, }); +<<<<<<< HEAD + }; + complex = async ({ complex }, options = {}) => { +======= } async complex({ complex }, options = {}) { +>>>>>>> main return await invoke({ method: 'complex', args: this.spec.funcArgsToScVals("complex", { complex }), @@ -246,8 +308,13 @@ export class Contract { return this.spec.funcResToNative("complex", xdr); }, }); +<<<<<<< HEAD + }; + addresse = async ({ addresse }, options = {}) => { +======= } async addresse({ addresse }, options = {}) { +>>>>>>> main return await invoke({ method: 'addresse', args: this.spec.funcArgsToScVals("addresse", { addresse }), @@ -257,8 +324,13 @@ export class Contract { return this.spec.funcResToNative("addresse", xdr); }, }); +<<<<<<< HEAD + }; + bytes = async ({ bytes }, options = {}) => { +======= } async bytes({ bytes }, options = {}) { +>>>>>>> main return await invoke({ method: 'bytes', args: this.spec.funcArgsToScVals("bytes", { bytes }), @@ -268,8 +340,13 @@ export class Contract { return this.spec.funcResToNative("bytes", xdr); }, }); +<<<<<<< HEAD + }; + bytesN = async ({ bytes_n }, options = {}) => { +======= } async bytesN({ bytes_n }, options = {}) { +>>>>>>> main return await invoke({ method: 'bytes_n', args: this.spec.funcArgsToScVals("bytes_n", { bytes_n }), @@ -279,8 +356,13 @@ export class Contract { return this.spec.funcResToNative("bytes_n", xdr); }, }); +<<<<<<< HEAD + }; + card = async ({ card }, options = {}) => { +======= } async card({ card }, options = {}) { +>>>>>>> main return await invoke({ method: 'card', args: this.spec.funcArgsToScVals("card", { card }), @@ -290,8 +372,13 @@ export class Contract { return this.spec.funcResToNative("card", xdr); }, }); +<<<<<<< HEAD + }; + boolean = async ({ boolean }, options = {}) => { +======= } async boolean({ boolean }, options = {}) { +>>>>>>> main return await invoke({ method: 'boolean', args: this.spec.funcArgsToScVals("boolean", { boolean }), @@ -301,11 +388,19 @@ export class Contract { return this.spec.funcResToNative("boolean", xdr); }, }); +<<<<<<< HEAD + }; + /** + * Negates a boolean value + */ + not = async ({ boolean }, options = {}) => { +======= } /** * Negates a boolean value */ async not({ boolean }, options = {}) { +>>>>>>> main return await invoke({ method: 'not', args: this.spec.funcArgsToScVals("not", { boolean }), @@ -315,8 +410,13 @@ export class Contract { return this.spec.funcResToNative("not", xdr); }, }); +<<<<<<< HEAD + }; + i128 = async ({ i128 }, options = {}) => { +======= } async i128({ i128 }, options = {}) { +>>>>>>> main return await invoke({ method: 'i128', args: this.spec.funcArgsToScVals("i128", { i128 }), @@ -326,8 +426,13 @@ export class Contract { return this.spec.funcResToNative("i128", xdr); }, }); +<<<<<<< HEAD + }; + u128 = async ({ u128 }, options = {}) => { +======= } async u128({ u128 }, options = {}) { +>>>>>>> main return await invoke({ method: 'u128', args: this.spec.funcArgsToScVals("u128", { u128 }), @@ -337,8 +442,13 @@ export class Contract { return this.spec.funcResToNative("u128", xdr); }, }); +<<<<<<< HEAD + }; + multiArgs = async ({ a, b }, options = {}) => { +======= } async multiArgs({ a, b }, options = {}) { +>>>>>>> main return await invoke({ method: 'multi_args', args: this.spec.funcArgsToScVals("multi_args", { a, b }), @@ -348,8 +458,13 @@ export class Contract { return this.spec.funcResToNative("multi_args", xdr); }, }); +<<<<<<< HEAD + }; + map = async ({ map }, options = {}) => { +======= } async map({ map }, options = {}) { +>>>>>>> main return await invoke({ method: 'map', args: this.spec.funcArgsToScVals("map", { map }), @@ -359,8 +474,13 @@ export class Contract { return this.spec.funcResToNative("map", xdr); }, }); +<<<<<<< HEAD + }; + vec = async ({ vec }, options = {}) => { +======= } async vec({ vec }, options = {}) { +>>>>>>> main return await invoke({ method: 'vec', args: this.spec.funcArgsToScVals("vec", { vec }), @@ -370,8 +490,13 @@ export class Contract { return this.spec.funcResToNative("vec", xdr); }, }); +<<<<<<< HEAD + }; + tuple = async ({ tuple }, options = {}) => { +======= } async tuple({ tuple }, options = {}) { +>>>>>>> main return await invoke({ method: 'tuple', args: this.spec.funcArgsToScVals("tuple", { tuple }), @@ -381,11 +506,19 @@ export class Contract { return this.spec.funcResToNative("tuple", xdr); }, }); +<<<<<<< HEAD + }; + /** + * Example of an optional argument + */ + option = async ({ option }, options = {}) => { +======= } /** * Example of an optional argument */ async option({ option }, options = {}) { +>>>>>>> main return await invoke({ method: 'option', args: this.spec.funcArgsToScVals("option", { option }), @@ -395,8 +528,13 @@ export class Contract { return this.spec.funcResToNative("option", xdr); }, }); +<<<<<<< HEAD + }; + u256 = async ({ u256 }, options = {}) => { +======= } async u256({ u256 }, options = {}) { +>>>>>>> main return await invoke({ method: 'u256', args: this.spec.funcArgsToScVals("u256", { u256 }), @@ -406,8 +544,13 @@ export class Contract { return this.spec.funcResToNative("u256", xdr); }, }); +<<<<<<< HEAD + }; + i256 = async ({ i256 }, options = {}) => { +======= } async i256({ i256 }, options = {}) { +>>>>>>> main return await invoke({ method: 'i256', args: this.spec.funcArgsToScVals("i256", { i256 }), @@ -417,8 +560,13 @@ export class Contract { return this.spec.funcResToNative("i256", xdr); }, }); +<<<<<<< HEAD + }; + string = async ({ string }, options = {}) => { +======= } async string({ string }, options = {}) { +>>>>>>> main return await invoke({ method: 'string', args: this.spec.funcArgsToScVals("string", { string }), @@ -428,8 +576,13 @@ export class Contract { return this.spec.funcResToNative("string", xdr); }, }); +<<<<<<< HEAD + }; + tupleStrukt = async ({ tuple_strukt }, options = {}) => { +======= } async tupleStrukt({ tuple_strukt }, options = {}) { +>>>>>>> main return await invoke({ method: 'tuple_strukt', args: this.spec.funcArgsToScVals("tuple_strukt", { tuple_strukt }), @@ -439,5 +592,9 @@ export class Contract { return this.spec.funcResToNative("tuple_strukt", xdr); }, }); +<<<<<<< HEAD + }; +======= } +>>>>>>> main } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.d.ts index 1934a69a6b..297f108d34 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.d.ts @@ -1,16 +1,27 @@ import * as SorobanClient from "soroban-client"; +<<<<<<< HEAD +import type { Memo, MemoType, Operation, Transaction, xdr } from "soroban-client"; +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from "./method-options.js"; +export type Tx = Transaction, Operation[]>; +======= import { SorobanRpc } from "soroban-client"; import type { Memo, MemoType, Operation, Transaction, xdr } from "soroban-client"; import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from "./method-options.js"; export declare type Tx = Transaction, Operation[]>; +>>>>>>> main export declare class NotImplementedError extends Error { } declare type Simulation = SorobanRpc.SimulateTransactionResponse; declare type SendTx = SorobanRpc.SendTransactionResponse; declare type GetTx = SorobanRpc.GetTransactionResponse; declare let someRpcResponse: Simulation | SendTx | GetTx; +<<<<<<< HEAD +type SomeRpcResponse = typeof someRpcResponse; +type InvokeArgs = MethodOptions & ClassOptions & { +======= declare type SomeRpcResponse = typeof someRpcResponse; declare type InvokeArgs = MethodOptions & ClassOptions & { +>>>>>>> main method: string; args?: any[]; parseResultXdr: (xdr: string | xdr.ScVal) => T; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.js index 2b28300181..64ee85a64d 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.js +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/invoke.js @@ -1,5 +1,8 @@ import * as SorobanClient from "soroban-client"; +<<<<<<< HEAD +======= import { SorobanRpc } from "soroban-client"; +>>>>>>> main /** * Get account details from the Soroban network for the publicKey currently * selected in Freighter. If not connected to Freighter, return null. @@ -19,7 +22,11 @@ export class NotImplementedError extends Error { // defined this way so typeahead shows full union, not named alias let someRpcResponse; export async function invoke({ method, args = [], fee = 100, responseType, parseResultXdr, secondsToWait = 10, rpcUrl, networkPassphrase, contractId, wallet, }) { +<<<<<<< HEAD + wallet = wallet ?? (await import("@stellar/freighter-api")).default; +======= wallet = wallet ?? (await import("@stellar/freighter-api")); +>>>>>>> main let parse = parseResultXdr; const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith("http://"), @@ -38,6 +45,31 @@ export async function invoke({ method, args = [], fee = 100, responseType, parse .setTimeout(SorobanClient.TimeoutInfinite) .build(); const simulated = await server.simulateTransaction(tx); +<<<<<<< HEAD + if (simulated.error) + throw simulated.error; + if (responseType === "simulated") + return simulated; + // is it possible for `auths` to be present but empty? Probably not, but let's be safe. + let authsCount = simulated.result.auth?.length ?? 0; + const writeLength = simulated.transactionData + .build() + .resources() + .footprint() + .readWrite().length; + const isViewCall = authsCount === 0 && writeLength === 0; + if (isViewCall) { + if (responseType === "full") + return simulated; + const retval = simulated.result?.retval; + if (!retval) { + if (simulated.error) { + throw new Error(simulated.error); + } + throw new Error(`Invalid response from simulateTransaction:\n{simulated}`); + } + return parseResultXdr(retval); +======= if (SorobanRpc.isSimulationError(simulated)) { throw new Error(simulated.error); } @@ -55,6 +87,7 @@ export async function invoke({ method, args = [], fee = 100, responseType, parse return simulated; } return parseResultXdr(simulated.result.retval); +>>>>>>> main } if (authsCount > 1) { throw new NotImplementedError("Multiple auths not yet supported"); @@ -74,10 +107,22 @@ export async function invoke({ method, args = [], fee = 100, responseType, parse } tx = await signTx(wallet, SorobanClient.assembleTransaction(tx, networkPassphrase, simulated).build(), networkPassphrase); const raw = await sendTx(tx, secondsToWait, server); +<<<<<<< HEAD + if (responseType === "full") +======= if (responseType === "full") { +>>>>>>> main return raw; } // if `sendTx` awaited the inclusion of the tx in the ledger, it used +<<<<<<< HEAD + // `getTransaction`, which has a `returnValue` field + if ("returnValue" in raw) + return parse(raw.returnValue); + // otherwise, it returned the result of `sendTransaction` + if ("errorResultXdr" in raw) + return parse(raw.errorResultXdr); +======= // `getTransaction`, which has a `resultXdr` field if ("resultXdr" in raw) { const getResult = raw; @@ -92,6 +137,7 @@ export async function invoke({ method, args = [], fee = 100, responseType, parse const sendResult = raw; return parse(sendResult.errorResultXdr); } +>>>>>>> main // if neither of these are present, something went wrong console.error("Don't know how to parse result! Returning full RPC response."); return raw; @@ -130,7 +176,11 @@ export async function sendTx(tx, secondsToWait, server) { let waitTime = 1000; let exponentialFactor = 1.5; while (Date.now() < waitUntil && +<<<<<<< HEAD + getTransactionResponse.status === "NOT_FOUND") { +======= getTransactionResponse.status === SorobanRpc.GetTransactionStatus.NOT_FOUND) { +>>>>>>> main // Wait a beat await new Promise((resolve) => setTimeout(resolve, waitTime)); /// Exponential backoff @@ -138,10 +188,15 @@ export async function sendTx(tx, secondsToWait, server) { // See if the transaction is complete getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); } +<<<<<<< HEAD + if (getTransactionResponse.status === "NOT_FOUND") { + console.error(`Waited ${secondsToWait} seconds for transaction to complete, but it did not. Returning anyway. Check the transaction status manually. Info: ${JSON.stringify(sendTransactionResponse, null, 2)}`); +======= if (getTransactionResponse.status === SorobanRpc.GetTransactionStatus.NOT_FOUND) { console.error(`Waited ${secondsToWait} seconds for transaction to complete, but it did not. ` + `Returning anyway. Check the transaction status manually. ` + `Info: ${JSON.stringify(sendTransactionResponse, null, 2)}`); +>>>>>>> main } return getTransactionResponse; } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/method-options.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/method-options.d.ts index a959d97f2f..b16b3fcb44 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/method-options.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/method-options.d.ts @@ -13,7 +13,11 @@ export interface Wallet { accountToSign?: string; }) => Promise; } +<<<<<<< HEAD +export type ClassOptions = { +======= export declare type ClassOptions = { +>>>>>>> main contractId: string; networkPassphrase: string; rpcUrl: string; @@ -32,7 +36,11 @@ export declare type ClassOptions = { */ wallet?: Wallet; }; +<<<<<<< HEAD +export type MethodOptions = { +======= export declare type MethodOptions = { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts index afc811097f..e5d49a6077 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/index.d.ts @@ -1,6 +1,22 @@ import * as SorobanClient from 'soroban-client'; import { ContractSpec, Address } from 'soroban-client'; import { Buffer } from "buffer"; +<<<<<<< HEAD +import type { ClassOptions } from './method-options.js'; +export * from './invoke.js'; +export * from './method-options.js'; +export type u32 = number; +export type i32 = number; +export type u64 = bigint; +export type i64 = bigint; +export type u128 = bigint; +export type i128 = bigint; +export type u256 = bigint; +export type i256 = bigint; +export type Option = T | undefined; +export type Typepoint = bigint; +export type Duration = bigint; +======= import type { ResponseTypes, ClassOptions } from './method-options.js'; export * from './invoke.js'; export * from './method-options.js'; @@ -15,6 +31,7 @@ export declare type i256 = bigint; export declare type Option = T | undefined; export declare type Typepoint = bigint; export declare type Duration = bigint; +>>>>>>> main export { Address }; export interface Error_ { message: string; @@ -48,8 +65,8 @@ export declare const networks: { }; }; /** - * This is from the rust doc above the struct Test - */ + * This is from the rust doc above the struct Test + */ export interface Test { a: u32; b: boolean; @@ -70,8 +87,13 @@ export declare enum RoyalCard { Queen = 12, King = 13 } +<<<<<<< HEAD +export type TupleStruct = readonly [Test, SimpleEnum]; +export type ComplexEnum = { +======= export declare type TupleStruct = readonly [Test, SimpleEnum]; export declare type ComplexEnum = { +>>>>>>> main tag: "Struct"; values: readonly [Test]; } | { @@ -91,13 +113,21 @@ export declare class Contract { readonly options: ClassOptions; spec: ContractSpec; constructor(options: ClassOptions); +<<<<<<< HEAD + hello: ({ hello }: { +======= hello({ hello }: { +>>>>>>> main hello: string; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -105,6 +135,19 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + woid: (options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number | undefined; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -116,6 +159,7 @@ export declare class Contract { * The fee to pay for the transaction. Default: 100. */ fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -123,6 +167,19 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + val: (options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number | undefined; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -134,6 +191,7 @@ export declare class Contract { * The fee to pay for the transaction. Default: 100. */ fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -141,6 +199,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + u32FailOnEven: ({ u32_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -148,12 +215,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; u32FailOnEven({ u32_ }: { +>>>>>>> main u32_: u32; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -161,6 +233,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise | (R extends undefined ? Err | Ok | undefined : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok | undefined)>; + u32: ({ u32_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -168,12 +249,17 @@ export declare class Contract { secondsToWait?: number; }): Promise | (R extends undefined ? Err | Ok : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok)>; u32({ u32_ }: { +>>>>>>> main u32_: u32; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -181,6 +267,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i32: ({ i32_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -188,12 +283,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; i32({ i32_ }: { +>>>>>>> main i32_: i32; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -201,6 +301,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i64: ({ i64_ }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -208,12 +317,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; i64({ i64_ }: { +>>>>>>> main i64_: i64; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -221,6 +335,18 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + /** + * Example contract method which takes a struct + */ + struktHel: ({ strukt }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -231,12 +357,17 @@ export declare class Contract { * Example contract method which takes a struct */ struktHel({ strukt }: { +>>>>>>> main strukt: Test; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -244,6 +375,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + strukt: ({ strukt }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -251,12 +391,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; strukt({ strukt }: { +>>>>>>> main strukt: Test; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -264,6 +409,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + simple: ({ simple }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -271,12 +425,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; simple({ simple }: { +>>>>>>> main simple: SimpleEnum; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -284,6 +443,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + complex: ({ complex }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -291,12 +459,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; complex({ complex }: { +>>>>>>> main complex: ComplexEnum; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -304,6 +477,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + addresse: ({ addresse }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -311,12 +493,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; addresse({ addresse }: { +>>>>>>> main addresse: Address; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -324,6 +511,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + bytes: ({ bytes }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -331,12 +527,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; bytes({ bytes }: { +>>>>>>> main bytes: Buffer; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -344,6 +545,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + bytesN: ({ bytes_n }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -351,12 +561,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; bytesN({ bytes_n }: { +>>>>>>> main bytes_n: Buffer; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -364,6 +579,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + card: ({ card }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -371,12 +595,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; card({ card }: { +>>>>>>> main card: RoyalCard; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -384,6 +613,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + boolean: ({ boolean }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -391,12 +629,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; boolean({ boolean }: { +>>>>>>> main boolean: boolean; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -404,6 +647,18 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + /** + * Negates a boolean value + */ + not: ({ boolean }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -414,12 +669,17 @@ export declare class Contract { * Negates a boolean value */ not({ boolean }: { +>>>>>>> main boolean: boolean; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -427,6 +687,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i128: ({ i128 }: { + i128: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -435,11 +705,16 @@ export declare class Contract { }): Promise; i128({ i128 }: { i128: i128; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -447,6 +722,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + u128: ({ u128 }: { + u128: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -455,11 +740,16 @@ export declare class Contract { }): Promise; u128({ u128 }: { u128: u128; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -467,6 +757,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + multiArgs: ({ a, b }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -474,13 +773,18 @@ export declare class Contract { secondsToWait?: number; }): Promise; multiArgs({ a, b }: { +>>>>>>> main a: u32; b: boolean; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -488,6 +792,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + map: ({ map }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -495,12 +808,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; map({ map }: { +>>>>>>> main map: Map; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -508,6 +826,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; + vec: ({ vec }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -515,12 +842,17 @@ export declare class Contract { secondsToWait?: number; }): Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; vec({ vec }: { +>>>>>>> main vec: Array; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -528,6 +860,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + tuple: ({ tuple }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -535,12 +876,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; tuple({ tuple }: { +>>>>>>> main tuple: readonly [string, u32]; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -548,6 +894,18 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + /** + * Example of an optional argument + */ + option: ({ option }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -558,12 +916,17 @@ export declare class Contract { * Example of an optional argument */ option({ option }: { +>>>>>>> main option: Option; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -571,6 +934,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Option>; + u256: ({ u256 }: { + u256: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -579,11 +952,16 @@ export declare class Contract { }): Promise; u256({ u256 }: { u256: u256; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -591,6 +969,16 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + i256: ({ i256 }: { + i256: bigint; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -599,11 +987,16 @@ export declare class Contract { }): Promise; i256({ i256 }: { i256: i256; +>>>>>>> main }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -611,6 +1004,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + string: ({ string }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -618,12 +1020,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; string({ string }: { +>>>>>>> main string: string; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -631,6 +1038,15 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; + tupleStrukt: ({ tuple_strukt }: { +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. @@ -638,12 +1054,17 @@ export declare class Contract { secondsToWait?: number; }): Promise; tupleStrukt({ tuple_strukt }: { +>>>>>>> main tuple_strukt: TupleStruct; }, options?: { /** * The fee to pay for the transaction. Default: 100. */ +<<<<<<< HEAD + fee?: number | undefined; +======= fee?: number; +>>>>>>> main /** * What type of response to return. * @@ -651,10 +1072,19 @@ export declare class Contract { * - `'simulated'` will only simulate/preflight the transaction, even if it's a change/set method that requires auth/signing. Returns full preflight info. * - `'full'` return the full RPC response, meaning either 1. the preflight info, if it's a view/read method that doesn't require auth/signing, or 2. the `sendTransaction` response, if there's a problem with sending the transaction or if you set `secondsToWait` to 0, or 3. the `getTransaction` response, if it's a change method with no `sendTransaction` errors and a positive `secondsToWait`. */ +<<<<<<< HEAD + responseType?: R | undefined; + /** + * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. + */ + secondsToWait?: number | undefined; + }) => Promise; +======= responseType?: R; /** * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number; }): Promise; +>>>>>>> main } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/invoke.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/invoke.d.ts index 1934a69a6b..297f108d34 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/invoke.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/invoke.d.ts @@ -1,16 +1,27 @@ import * as SorobanClient from "soroban-client"; +<<<<<<< HEAD +import type { Memo, MemoType, Operation, Transaction, xdr } from "soroban-client"; +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from "./method-options.js"; +export type Tx = Transaction, Operation[]>; +======= import { SorobanRpc } from "soroban-client"; import type { Memo, MemoType, Operation, Transaction, xdr } from "soroban-client"; import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from "./method-options.js"; export declare type Tx = Transaction, Operation[]>; +>>>>>>> main export declare class NotImplementedError extends Error { } declare type Simulation = SorobanRpc.SimulateTransactionResponse; declare type SendTx = SorobanRpc.SendTransactionResponse; declare type GetTx = SorobanRpc.GetTransactionResponse; declare let someRpcResponse: Simulation | SendTx | GetTx; +<<<<<<< HEAD +type SomeRpcResponse = typeof someRpcResponse; +type InvokeArgs = MethodOptions & ClassOptions & { +======= declare type SomeRpcResponse = typeof someRpcResponse; declare type InvokeArgs = MethodOptions & ClassOptions & { +>>>>>>> main method: string; args?: any[]; parseResultXdr: (xdr: string | xdr.ScVal) => T; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/method-options.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/method-options.d.ts index a959d97f2f..b16b3fcb44 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/method-options.d.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/method-options.d.ts @@ -13,7 +13,11 @@ export interface Wallet { accountToSign?: string; }) => Promise; } +<<<<<<< HEAD +export type ClassOptions = { +======= export declare type ClassOptions = { +>>>>>>> main contractId: string; networkPassphrase: string; rpcUrl: string; @@ -32,7 +36,11 @@ export declare type ClassOptions = { */ wallet?: Wallet; }; +<<<<<<< HEAD +export type MethodOptions = { +======= export declare type MethodOptions = { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json index d2b02b5d11..73308509e0 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package-lock.json @@ -10,7 +10,11 @@ "dependencies": { "@stellar/freighter-api": "1.5.1", "buffer": "6.0.3", +<<<<<<< HEAD + "soroban-client": "0.11.1" +======= "soroban-client": "1.0.0-beta.2" +>>>>>>> main }, "devDependencies": { "typescript": "5.1.6" @@ -18,15 +22,26 @@ }, "node_modules/@stellar/freighter-api": { "version": "1.5.1", +<<<<<<< HEAD + "resolved": "https://registry.npmjs.org/@stellar/freighter-api/-/freighter-api-1.5.1.tgz", + "integrity": "sha512-WEnKEqd+xVLnOq6bJv+fLXod8JQyPjzpOKTpH4g7tG9MM1fmXzD3y2SXJlpCIw8kVqtiC4ynWOlSWX+TKO7KiQ==" +======= "license": "Apache-2.0" +>>>>>>> main }, "node_modules/asynckit": { "version": "0.4.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { "version": "1.5.0", +<<<<<<< HEAD + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", + "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", +======= "license": "MIT", +>>>>>>> main "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -43,6 +58,8 @@ }, "node_modules/base64-js": { "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "funding": [ { "type": "github", @@ -56,8 +73,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/bignumber.js": { "version": "9.1.2", @@ -69,6 +85,8 @@ }, "node_modules/buffer": { "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", @@ -83,7 +101,6 @@ "url": "https://feross.org/support" } ], - "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" @@ -91,7 +108,8 @@ }, "node_modules/combined-stream": { "version": "1.0.8", - "license": "MIT", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -101,20 +119,22 @@ }, "node_modules/delayed-stream": { "version": "1.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "engines": { "node": ">=0.4.0" } }, "node_modules/follow-redirects": { "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", "funding": [ { "type": "individual", "url": "https://github.com/sponsors/RubenVerborgh" } ], - "license": "MIT", "engines": { "node": ">=4.0" }, @@ -126,7 +146,8 @@ }, "node_modules/form-data": { "version": "4.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -138,6 +159,8 @@ }, "node_modules/ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", @@ -151,8 +174,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "BSD-3-Clause" + ] }, "node_modules/inherits": { "version": "2.0.4", @@ -166,14 +188,16 @@ }, "node_modules/mime-db": { "version": "1.52.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { "version": "2.1.35", - "license": "MIT", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dependencies": { "mime-db": "1.52.0" }, @@ -194,7 +218,12 @@ }, "node_modules/proxy-from-env": { "version": "1.1.0", +<<<<<<< HEAD + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" +======= "license": "MIT" +>>>>>>> main }, "node_modules/safe-buffer": { "version": "5.2.1", @@ -238,21 +267,37 @@ } }, "node_modules/soroban-client": { +<<<<<<< HEAD + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-0.11.1.tgz", + "integrity": "sha512-QMlYzHe74sYBr9YMae9xzUOzBbZ4/jandAKD9++q54Y8jc6g5OxG4kuzhgcHNL/H2QF8uo6rmMqdK2+pUHNKGQ==", +======= "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-1.0.0-beta.2.tgz", "integrity": "sha512-v5h3yvef7HkUD3H26w33NUEgRXcPiOSDWEsVzMloaxsprs3N002tXJHvFF+Uw1eYt50Uk6bvqBgvkLwX10VENw==", +>>>>>>> main "dependencies": { "axios": "^1.4.0", "bignumber.js": "^9.1.1", "buffer": "^6.0.3", +<<<<<<< HEAD + "stellar-base": "10.0.0-soroban.7", +======= "stellar-base": "v10.0.0-beta.1", +>>>>>>> main "urijs": "^1.19.1" } }, "node_modules/stellar-base": { +<<<<<<< HEAD + "version": "10.0.0-soroban.7", + "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-soroban.7.tgz", + "integrity": "sha512-5+qqGsFXagtbG0L/oIiTDEIUsnerE7Vwvv/Hp2ugG0sKulcnfxgYjNqeon3Zv13uoJ4dtjslQpVOzLxPlklViQ==", +======= "version": "10.0.0-beta.1", "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-beta.1.tgz", "integrity": "sha512-zXC5AsbUsLi57JruyeIMv23s3iUxq/P2ZFrSJ+FerLIZjSAjY8EDs4zwY4LCuu7swUu46Lm8GK6sqxUZCPekHw==", +>>>>>>> main "dependencies": { "base32.js": "^0.1.0", "bignumber.js": "^9.1.2", @@ -272,8 +317,9 @@ }, "node_modules/typescript": { "version": "5.1.6", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", + "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", "dev": true, - "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -284,6 +330,10 @@ }, "node_modules/urijs": { "version": "1.19.11", +<<<<<<< HEAD + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" +======= "license": "MIT" } }, @@ -433,6 +483,7 @@ }, "urijs": { "version": "1.19.11" +>>>>>>> main } } } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json index efb3acfe25..108b679ae7 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/package.json @@ -4,7 +4,11 @@ "dependencies": { "@stellar/freighter-api": "1.5.1", "buffer": "6.0.3", +<<<<<<< HEAD + "soroban-client": "0.11.1" +======= "soroban-client": "1.0.0-beta.2" +>>>>>>> main }, "scripts": { "build": "node ./scripts/build.mjs" diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/convert.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/convert.ts index ec3087c11b..12d7044aae 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/convert.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/convert.ts @@ -51,13 +51,13 @@ export function scValToJs(val: xdr.ScVal): T { } case xdr.ScValType.scvVec(): { type Element = ElementType; - return val.vec().map(v => scValToJs(v)) as unknown as T; + return val.vec()!.map(v => scValToJs(v)) as unknown as T; } case xdr.ScValType.scvMap(): { type Key = KeyType; type Value = ValueType; let res: any = {}; - val.map().forEach((e) => { + val.map()!.forEach((e) => { let key = scValToJs(e.key()); let value; let v: xdr.ScVal = e.val(); @@ -65,7 +65,7 @@ export function scValToJs(val: xdr.ScVal): T { switch (v?.switch()) { case xdr.ScValType.scvMap(): { let inner_map = new Map() as Map; - v.map().forEach((e) => { + v.map()!.forEach((e) => { let key = scValToJs(e.key()); let value = scValToJs(e.val()); inner_map.set(key, value); @@ -109,4 +109,4 @@ export function i128ToScVal(i: bigint): xdr.ScVal { export function u128ToScVal(i: bigint): xdr.ScVal { return new ScInt(i).toU128(); -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts index 5cce69fe00..f0edd85017 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/index.ts @@ -2,7 +2,11 @@ import * as SorobanClient from 'soroban-client'; import { ContractSpec, Address } from 'soroban-client'; import { Buffer } from "buffer"; import { invoke } from './invoke.js'; +<<<<<<< HEAD +import type { ResponseTypes, ClassOptions } from './method-options.js' +======= import type { ResponseTypes, Wallet, ClassOptions } from './method-options.js' +>>>>>>> main export * from './invoke.js' export * from './method-options.js' @@ -89,6 +93,10 @@ function parseError(message: string): Err | undefined { return undefined; } +<<<<<<< HEAD + +======= +>>>>>>> main export const networks = { futurenet: { networkPassphrase: "Test SDF Future Network ; October 2022", @@ -97,8 +105,8 @@ export const networks = { } as const /** - * This is from the rust doc above the struct Test - */ + * This is from the rust doc above the struct Test + */ export interface Test { a: u32; b: boolean; @@ -160,7 +168,11 @@ export class Contract { "AAAAAAAAAAAAAAAMdHVwbGVfc3RydWt0AAAAAQAAAAAAAAAMdHVwbGVfc3RydWt0AAAH0AAAAAtUdXBsZVN0cnVjdAAAAAABAAAH0AAAAAtUdXBsZVN0cnVjdAA=" ]); } +<<<<<<< HEAD + hello = async ({hello}: {hello: string}, options: { +======= async hello({hello}: {hello: string}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -177,7 +189,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'hello', args: this.spec.funcArgsToScVals("hello", {hello}), @@ -188,9 +204,15 @@ export class Contract { }, }); } +<<<<<<< HEAD + + + woid = async (options: { +======= async woid(options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -207,7 +229,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'woid', args: this.spec.funcArgsToScVals("woid", {}), @@ -218,7 +244,11 @@ export class Contract { } +<<<<<<< HEAD + val = async (options: { +======= async val(options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -235,7 +265,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'val', args: this.spec.funcArgsToScVals("val", {}), @@ -248,7 +282,11 @@ export class Contract { } +<<<<<<< HEAD + u32FailOnEven = async ({u32_}: {u32_: u32}, options: { +======= async u32FailOnEven({u32_}: {u32_: u32}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -265,7 +303,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main try { return await invoke({ method: 'u32_fail_on_even', @@ -286,7 +328,11 @@ export class Contract { } +<<<<<<< HEAD + u32 = async ({u32_}: {u32_: u32}, options: { +======= async u32({u32_}: {u32_: u32}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -303,7 +349,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'u32_', args: this.spec.funcArgsToScVals("u32_", {u32_}), @@ -316,7 +366,11 @@ export class Contract { } +<<<<<<< HEAD + i32 = async ({i32_}: {i32_: i32}, options: { +======= async i32({i32_}: {i32_: i32}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -333,7 +387,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'i32_', args: this.spec.funcArgsToScVals("i32_", {i32_}), @@ -346,7 +404,11 @@ export class Contract { } +<<<<<<< HEAD + i64 = async ({i64_}: {i64_: i64}, options: { +======= async i64({i64_}: {i64_: i64}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -363,7 +425,11 @@ export class Contract { * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'i64_', args: this.spec.funcArgsToScVals("i64_", {i64_}), @@ -377,9 +443,15 @@ export class Contract { /** +<<<<<<< HEAD + * Example contract method which takes a struct + */ +struktHel = async ({strukt}: {strukt: Test}, options: { +======= * Example contract method which takes a struct */ async struktHel({strukt}: {strukt: Test}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -396,7 +468,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'strukt_hel', args: this.spec.funcArgsToScVals("strukt_hel", {strukt}), @@ -409,7 +485,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + strukt = async ({strukt}: {strukt: Test}, options: { +======= async strukt({strukt}: {strukt: Test}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -426,7 +506,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'strukt', args: this.spec.funcArgsToScVals("strukt", {strukt}), @@ -439,7 +523,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + simple = async ({simple}: {simple: SimpleEnum}, options: { +======= async simple({simple}: {simple: SimpleEnum}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -456,7 +544,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'simple', args: this.spec.funcArgsToScVals("simple", {simple}), @@ -469,7 +561,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + complex = async ({complex}: {complex: ComplexEnum}, options: { +======= async complex({complex}: {complex: ComplexEnum}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -486,7 +582,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'complex', args: this.spec.funcArgsToScVals("complex", {complex}), @@ -499,7 +599,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + addresse = async ({addresse}: {addresse: Address}, options: { +======= async addresse({addresse}: {addresse: Address}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -516,7 +620,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'addresse', args: this.spec.funcArgsToScVals("addresse", {addresse}), @@ -529,7 +637,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + bytes = async ({bytes}: {bytes: Buffer}, options: { +======= async bytes({bytes}: {bytes: Buffer}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -546,7 +658,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'bytes', args: this.spec.funcArgsToScVals("bytes", {bytes}), @@ -559,7 +675,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + bytesN = async ({bytes_n}: {bytes_n: Buffer}, options: { +======= async bytesN({bytes_n}: {bytes_n: Buffer}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -576,7 +696,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'bytes_n', args: this.spec.funcArgsToScVals("bytes_n", {bytes_n}), @@ -589,7 +713,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + card = async ({card}: {card: RoyalCard}, options: { +======= async card({card}: {card: RoyalCard}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -606,7 +734,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'card', args: this.spec.funcArgsToScVals("card", {card}), @@ -619,7 +751,11 @@ async struktHel({strukt}: {strukt: Test}, o } +<<<<<<< HEAD + boolean = async ({boolean}: {boolean: boolean}, options: { +======= async boolean({boolean}: {boolean: boolean}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -636,7 +772,11 @@ async struktHel({strukt}: {strukt: Test}, o * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'boolean', args: this.spec.funcArgsToScVals("boolean", {boolean}), @@ -650,9 +790,15 @@ async struktHel({strukt}: {strukt: Test}, o /** +<<<<<<< HEAD + * Negates a boolean value + */ +not = async ({boolean}: {boolean: boolean}, options: { +======= * Negates a boolean value */ async not({boolean}: {boolean: boolean}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -669,7 +815,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'not', args: this.spec.funcArgsToScVals("not", {boolean}), @@ -682,7 +832,11 @@ async not({boolean}: {boolean: boolean}, op } +<<<<<<< HEAD + i128 = async ({i128}: {i128: i128}, options: { +======= async i128({i128}: {i128: i128}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -699,7 +853,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'i128', args: this.spec.funcArgsToScVals("i128", {i128}), @@ -712,7 +870,11 @@ async not({boolean}: {boolean: boolean}, op } +<<<<<<< HEAD + u128 = async ({u128}: {u128: u128}, options: { +======= async u128({u128}: {u128: u128}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -729,7 +891,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'u128', args: this.spec.funcArgsToScVals("u128", {u128}), @@ -742,7 +908,11 @@ async not({boolean}: {boolean: boolean}, op } +<<<<<<< HEAD + multiArgs = async ({a, b}: {a: u32, b: boolean}, options: { +======= async multiArgs({a, b}: {a: u32, b: boolean}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -759,7 +929,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'multi_args', args: this.spec.funcArgsToScVals("multi_args", {a, b}), @@ -772,7 +946,11 @@ async not({boolean}: {boolean: boolean}, op } +<<<<<<< HEAD + map = async ({map}: {map: Map}, options: { +======= async map({map}: {map: Map}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -789,7 +967,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'map', args: this.spec.funcArgsToScVals("map", {map}), @@ -802,7 +984,11 @@ async not({boolean}: {boolean: boolean}, op } +<<<<<<< HEAD + vec = async ({vec}: {vec: Array}, options: { +======= async vec({vec}: {vec: Array}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -819,7 +1005,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'vec', args: this.spec.funcArgsToScVals("vec", {vec}), @@ -832,7 +1022,11 @@ async not({boolean}: {boolean: boolean}, op } +<<<<<<< HEAD + tuple = async ({tuple}: {tuple: readonly [string, u32]}, options: { +======= async tuple({tuple}: {tuple: readonly [string, u32]}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -849,7 +1043,11 @@ async not({boolean}: {boolean: boolean}, op * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'tuple', args: this.spec.funcArgsToScVals("tuple", {tuple}), @@ -863,9 +1061,15 @@ async not({boolean}: {boolean: boolean}, op /** +<<<<<<< HEAD + * Example of an optional argument + */ +option = async ({option}: {option: Option}, options: { +======= * Example of an optional argument */ async option({option}: {option: Option}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -882,7 +1086,11 @@ async option({option}: {option: Option * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'option', args: this.spec.funcArgsToScVals("option", {option}), @@ -895,7 +1103,11 @@ async option({option}: {option: Option } +<<<<<<< HEAD + u256 = async ({u256}: {u256: u256}, options: { +======= async u256({u256}: {u256: u256}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -912,7 +1124,11 @@ async option({option}: {option: Option * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'u256', args: this.spec.funcArgsToScVals("u256", {u256}), @@ -925,7 +1141,11 @@ async option({option}: {option: Option } +<<<<<<< HEAD + i256 = async ({i256}: {i256: i256}, options: { +======= async i256({i256}: {i256: i256}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -942,7 +1162,11 @@ async option({option}: {option: Option * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'i256', args: this.spec.funcArgsToScVals("i256", {i256}), @@ -955,7 +1179,11 @@ async option({option}: {option: Option } +<<<<<<< HEAD + string = async ({string}: {string: string}, options: { +======= async string({string}: {string: string}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -972,7 +1200,11 @@ async option({option}: {option: Option * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'string', args: this.spec.funcArgsToScVals("string", {string}), @@ -985,7 +1217,11 @@ async option({option}: {option: Option } +<<<<<<< HEAD + tupleStrukt = async ({tuple_strukt}: {tuple_strukt: TupleStruct}, options: { +======= async tupleStrukt({tuple_strukt}: {tuple_strukt: TupleStruct}, options: { +>>>>>>> main /** * The fee to pay for the transaction. Default: 100. */ @@ -1002,7 +1238,11 @@ async option({option}: {option: Option * If the simulation shows that this invocation requires auth/signing, `invoke` will wait `secondsToWait` seconds for the transaction to complete before giving up and returning the incomplete {@link SorobanClient.SorobanRpc.GetTransactionResponse} results (or attempting to parse their probably-missing XDR with `parseResultXdr`, depending on `responseType`). Set this to `0` to skip waiting altogether, which will return you {@link SorobanClient.SorobanRpc.SendTransactionResponse} more quickly, before the transaction has time to be included in the ledger. Default: 10. */ secondsToWait?: number +<<<<<<< HEAD + } = {}) => { +======= } = {}) { +>>>>>>> main return await invoke({ method: 'tuple_strukt', args: this.spec.funcArgsToScVals("tuple_strukt", {tuple_strukt}), diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/invoke.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/invoke.ts index 93f823f1ff..2149aed388 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/invoke.ts +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/invoke.ts @@ -1,5 +1,8 @@ import * as SorobanClient from "soroban-client"; +<<<<<<< HEAD +======= import { SorobanRpc } from "soroban-client"; +>>>>>>> main import type { Account, Memo, @@ -37,9 +40,15 @@ async function getAccount( export class NotImplementedError extends Error {} +<<<<<<< HEAD +type Simulation = SorobanClient.SorobanRpc.SimulateTransactionResponse; +type SendTx = SorobanClient.SorobanRpc.SendTransactionResponse; +type GetTx = SorobanClient.SorobanRpc.GetTransactionResponse; +======= type Simulation = SorobanRpc.SimulateTransactionResponse; type SendTx = SorobanRpc.SendTransactionResponse; type GetTx = SorobanRpc.GetTransactionResponse; +>>>>>>> main // defined this way so typeahead shows full union, not named alias let someRpcResponse: Simulation | SendTx | GetTx; @@ -82,7 +91,11 @@ export async function invoke({ contractId, wallet, }: InvokeArgs): Promise { +<<<<<<< HEAD + wallet = wallet ?? (await import("@stellar/freighter-api")).default; +======= wallet = wallet ?? (await import("@stellar/freighter-api")); +>>>>>>> main let parse = parseResultXdr; const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith("http://"), @@ -109,6 +122,35 @@ export async function invoke({ .build(); const simulated = await server.simulateTransaction(tx); +<<<<<<< HEAD + if (simulated.error) throw simulated.error; + if (responseType === "simulated") return simulated; + + // is it possible for `auths` to be present but empty? Probably not, but let's be safe. + let authsCount = simulated.result!.auth?.length ?? 0; + + const writeLength = simulated.transactionData + .build() + .resources() + .footprint() + .readWrite().length; + + const isViewCall = authsCount === 0 && writeLength === 0; + + if (isViewCall) { + if (responseType === "full") return simulated; + + const retval = simulated.result?.retval; + if (!retval) { + if (simulated.error) { + throw new Error(simulated.error as unknown as string); + } + throw new Error( + `Invalid response from simulateTransaction:\n{simulated}` + ); + } + return parseResultXdr(retval); +======= if (SorobanRpc.isSimulationError(simulated)) { throw new Error(simulated.error); } else if (responseType === "simulated") { @@ -127,6 +169,7 @@ export async function invoke({ } return parseResultXdr(simulated.result.retval); +>>>>>>> main } if (authsCount > 1) { @@ -154,6 +197,17 @@ export async function invoke({ ); const raw = await sendTx(tx, secondsToWait, server); +<<<<<<< HEAD + + if (responseType === "full") return raw; + + // if `sendTx` awaited the inclusion of the tx in the ledger, it used + // `getTransaction`, which has a `returnValue` field + if ("returnValue" in raw) return parse(raw.returnValue!); + + // otherwise, it returned the result of `sendTransaction` + if ("errorResultXdr" in raw) return parse(raw.errorResultXdr!); +======= if (responseType === "full") { return raw; } @@ -175,6 +229,7 @@ export async function invoke({ const sendResult = raw as SorobanRpc.SendTransactionResponse; return parse(sendResult.errorResultXdr); } +>>>>>>> main // if neither of these are present, something went wrong console.error("Don't know how to parse result! Returning full RPC response."); @@ -236,7 +291,11 @@ export async function sendTx( while ( Date.now() < waitUntil && +<<<<<<< HEAD + getTransactionResponse.status === "NOT_FOUND" +======= getTransactionResponse.status === SorobanRpc.GetTransactionStatus.NOT_FOUND +>>>>>>> main ) { // Wait a beat await new Promise((resolve) => setTimeout(resolve, waitTime)); @@ -248,6 +307,11 @@ export async function sendTx( ); } +<<<<<<< HEAD + if (getTransactionResponse.status === "NOT_FOUND") { + console.error( + `Waited ${secondsToWait} seconds for transaction to complete, but it did not. Returning anyway. Check the transaction status manually. Info: ${JSON.stringify( +======= if (getTransactionResponse.status === SorobanRpc.GetTransactionStatus.NOT_FOUND) { console.error( `Waited ${ @@ -255,6 +319,7 @@ export async function sendTx( } seconds for transaction to complete, but it did not. ` + `Returning anyway. Check the transaction status manually. ` + `Info: ${JSON.stringify( +>>>>>>> main sendTransactionResponse, null, 2 diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/tsconfig.json b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/tsconfig.json index 12cd92abf9..efd4c61931 100644 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/tsconfig.json +++ b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/tsconfig.json @@ -71,7 +71,7 @@ /* Type Checking */ // "strict": true, /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ @@ -95,4 +95,4 @@ "include": [ "src/*" ] -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-spec-typescript/src/boilerplate.rs b/cmd/crates/soroban-spec-typescript/src/boilerplate.rs index 20d517a2ac..102ec98d0c 100644 --- a/cmd/crates/soroban-spec-typescript/src/boilerplate.rs +++ b/cmd/crates/soroban-spec-typescript/src/boilerplate.rs @@ -13,7 +13,7 @@ use super::generate; static PROJECT_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/src/project_template"); const NETWORK_PASSPHRASE_FUTURENET: &str = "Test SDF Future Network ; October 2022"; -const NETWORK_PASSPHRASE_LOCALNET: &str = "Standalone Network ; February 2017"; +const NETWORK_PASSPHRASE_STANDALONE: &str = "Standalone Network ; February 2017"; pub struct Project(PathBuf); @@ -112,8 +112,8 @@ impl Project { fn format_networks_object(contract_id: &str, network_passphrase: &str) -> String { let network = if network_passphrase == NETWORK_PASSPHRASE_FUTURENET { "futurenet" - } else if network_passphrase == NETWORK_PASSPHRASE_LOCALNET { - "localnet" + } else if network_passphrase == NETWORK_PASSPHRASE_STANDALONE { + "standalone" } else { "unknown" }; diff --git a/cmd/crates/soroban-spec-typescript/src/lib.rs b/cmd/crates/soroban-spec-typescript/src/lib.rs index 7f2ea761d9..f75fac38fd 100644 --- a/cmd/crates/soroban-spec-typescript/src/lib.rs +++ b/cmd/crates/soroban-spec-typescript/src/lib.rs @@ -103,8 +103,8 @@ fn doc_to_ts_doc(doc: &str) -> String { let doc = doc.split('\n').join("\n * "); format!( r#"/** - * {doc} - */ + * {doc} + */ "#, ) } @@ -226,7 +226,7 @@ pub fn entry_to_ts(entry: &Entry) -> String { ); } format!( - r#"{ts_doc}async {js_name}({input}options: {options} = {{}}) {{ + r#"{ts_doc}{js_name} = async ({input}options: {options} = {{}}) => {{ {body} }} "# diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/convert.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/convert.ts index ec3087c11b..12d7044aae 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/convert.ts +++ b/cmd/crates/soroban-spec-typescript/src/project_template/src/convert.ts @@ -51,13 +51,13 @@ export function scValToJs(val: xdr.ScVal): T { } case xdr.ScValType.scvVec(): { type Element = ElementType; - return val.vec().map(v => scValToJs(v)) as unknown as T; + return val.vec()!.map(v => scValToJs(v)) as unknown as T; } case xdr.ScValType.scvMap(): { type Key = KeyType; type Value = ValueType; let res: any = {}; - val.map().forEach((e) => { + val.map()!.forEach((e) => { let key = scValToJs(e.key()); let value; let v: xdr.ScVal = e.val(); @@ -65,7 +65,7 @@ export function scValToJs(val: xdr.ScVal): T { switch (v?.switch()) { case xdr.ScValType.scvMap(): { let inner_map = new Map() as Map; - v.map().forEach((e) => { + v.map()!.forEach((e) => { let key = scValToJs(e.key()); let value = scValToJs(e.val()); inner_map.set(key, value); @@ -109,4 +109,4 @@ export function i128ToScVal(i: bigint): xdr.ScVal { export function u128ToScVal(i: bigint): xdr.ScVal { return new ScInt(i).toU128(); -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/invoke.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/invoke.ts index 5bcd7d80f8..ab5f3bccc8 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/invoke.ts +++ b/cmd/crates/soroban-spec-typescript/src/project_template/src/invoke.ts @@ -158,22 +158,14 @@ export async function invoke({ } // if `sendTx` awaited the inclusion of the tx in the ledger, it used - // `getTransaction`, which has a `resultXdr` field - if ("resultXdr" in raw) { - const getResult = raw as SorobanRpc.GetTransactionResponse; - if (getResult.status !== SorobanRpc.GetTransactionStatus.SUCCESS) { - console.error('Transaction submission failed! Returning full RPC response.'); - return raw; - } + // `getTransaction`, which has a `returnValue` field + if ("returnValue" in raw) return parse(raw.returnValue!); return parse(raw.resultXdr.result().toXDR("base64")); } // otherwise, it returned the result of `sendTransaction` - if ("errorResultXdr" in raw) { - const sendResult = raw as SorobanRpc.SendTransactionResponse; - return parse(sendResult.errorResultXdr); - } + if ("errorResultXdr" in raw) return parse(raw.errorResultXdr!); // if neither of these are present, something went wrong console.error("Don't know how to parse result! Returning full RPC response."); diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/tsconfig.json b/cmd/crates/soroban-spec-typescript/src/project_template/tsconfig.json index 12cd92abf9..efd4c61931 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/tsconfig.json +++ b/cmd/crates/soroban-spec-typescript/src/project_template/tsconfig.json @@ -71,7 +71,7 @@ /* Type Checking */ // "strict": true, /* Enable all strict type-checking options. */ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ @@ -95,4 +95,4 @@ "include": [ "src/*" ] -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/.env b/cmd/crates/soroban-spec-typescript/ts-tests/.env new file mode 100644 index 0000000000..b86805d8d1 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/.env @@ -0,0 +1 @@ +SOROBAN_NETWORK=standalone \ No newline at end of file diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore b/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore index a9cc241d8d..0e1c46abaa 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore +++ b/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore @@ -1,3 +1,5 @@ build node_modules -yarn.lock \ No newline at end of file +yarn.lock +!.soroban/network/standalone.toml +contract-id-*.txt diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc b/cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc new file mode 100644 index 0000000000..03db17dcc4 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/.nvmrc @@ -0,0 +1 @@ +v20.6.0 diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/.soroban/network/standalone.toml b/cmd/crates/soroban-spec-typescript/ts-tests/.soroban/network/standalone.toml new file mode 100644 index 0000000000..5ab0864503 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/.soroban/network/standalone.toml @@ -0,0 +1,2 @@ +rpc_url = "http://localhost:8000/soroban/rpc" +network_passphrase = "Standalone Network ; February 2017" diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json index 954928b097..6006756853 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json @@ -4,11 +4,17 @@ "requires": true, "packages": { "": { + "hasInstallScript": true, "devDependencies": { "@ava/typescript": "^4.1.0", "@types/node": "^20.4.9", "ava": "^5.3.1", + "soroban-client": "^0.11.0", "typescript": "^5.1.6" + }, + "engines": { + "node": ">=20.6.0", + "npm": ">=9.8.1" } }, "node_modules/@ava/typescript": { @@ -60,9 +66,9 @@ } }, "node_modules/@types/node": { - "version": "20.4.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.9.tgz", - "integrity": "sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==", + "version": "20.5.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.9.tgz", + "integrity": "sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==", "dev": true }, "node_modules/acorn": { @@ -178,6 +184,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, "node_modules/ava": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ava/-/ava-5.3.1.tgz", @@ -243,6 +255,55 @@ } } }, + "node_modules/axios": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.0.tgz", + "integrity": "sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/base32.js": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base32.js/-/base32.js-0.1.0.tgz", + "integrity": "sha512-n3TkB02ixgBOhTvANakDb4xaMXnYUVkNoRFJjQflcqMQhyEKxEHdj3E6N8t8sUQ0mjH/3/JxzlXuz3ul/J90pQ==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -270,10 +331,34 @@ "node": ">=8" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/callsites": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-4.0.0.tgz", - "integrity": "sha512-y3jRROutgpKdz5vzEhWM34TidDU8vkJppF8dszITeb1PQmSqV3DTxyV8G/lyO/DNvtE1YTedehmw9MPZsCBHxQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-4.1.0.tgz", + "integrity": "sha512-aBMbD1Xxay75ViYezwT40aQONfr+pSXTHwNKvIXhXD6+LY3F1dLIcceoC5OZKBVHbXcysz1hL9D2w0JJIMXpUw==", "dev": true, "engines": { "node": ">=12.20" @@ -494,6 +579,18 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/common-path-prefix": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", @@ -589,6 +686,15 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -691,12 +797,6 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/execa/node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, "node_modules/fast-diff": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", @@ -772,10 +872,44 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, "optional": true, @@ -847,6 +981,26 @@ "node": ">=14.18.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -886,6 +1040,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, "node_modules/irregular-plurals": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz", @@ -1009,6 +1169,12 @@ "node": ">= 0.8" } }, + "node_modules/js-xdr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/js-xdr/-/js-xdr-3.0.0.tgz", + "integrity": "sha512-tSt6UKJ2L7t+yaQURGkHo9kop9qnVbChTlCu62zNiDbDZQoZb/YjUj2iFJ3lgelhfg9p5bhO2o/QX+g36TPsSQ==", + "dev": true + }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -1150,6 +1316,27 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", @@ -1168,6 +1355,18 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/node-gyp-build": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", + "dev": true, + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/nofilter": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", @@ -1406,6 +1605,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -1501,6 +1706,26 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -1531,6 +1756,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -1553,16 +1791,10 @@ } }, "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/slash": { "version": "4.0.0", @@ -1592,6 +1824,30 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, + "node_modules/sodium-native": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.0.4.tgz", + "integrity": "sha512-faqOKw4WQKK7r/ybn6Lqo1F9+L5T6NlBJJYvpxbZPetpWylUVqz449mvlwIBKBqxEHbWakWuOlUt8J3Qpc4sWw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "dependencies": { + "node-gyp-build": "^4.6.0" + } + }, + "node_modules/soroban-client": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/soroban-client/-/soroban-client-0.11.2.tgz", + "integrity": "sha512-cc8d3YlaNzWR1prOggOlt2BmhWiHWgxebxavs7l2QOhzyG5qN2zQGnbCprVeMlOsY/tsI51liEEHAmtLROphqA==", + "dev": true, + "dependencies": { + "axios": "^1.4.0", + "bignumber.js": "^9.1.1", + "buffer": "^6.0.3", + "stellar-base": "10.0.0-soroban.8", + "urijs": "^1.19.1" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -1619,6 +1875,23 @@ "node": ">=8" } }, + "node_modules/stellar-base": { + "version": "10.0.0-soroban.8", + "resolved": "https://registry.npmjs.org/stellar-base/-/stellar-base-10.0.0-soroban.8.tgz", + "integrity": "sha512-mtj+4EcCnp4ZyH2FzRl62/DAstTXOddHVRZdzFQ94WgyQz2yVNzt+ANDS1D/7ku4d2mIzoJIj9l0/H0A5nRgXQ==", + "dev": true, + "dependencies": { + "base32.js": "^0.1.0", + "bignumber.js": "^9.1.2", + "buffer": "^6.0.3", + "js-xdr": "^3.0.0", + "sha.js": "^2.3.6", + "tweetnacl": "^1.0.3" + }, + "optionalDependencies": { + "sodium-native": "^4.0.1" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -1708,6 +1981,12 @@ "node": ">=8.0" } }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "dev": true + }, "node_modules/type-fest": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", @@ -1721,9 +2000,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -1733,6 +2012,12 @@ "node": ">=14.17" } }, + "node_modules/urijs": { + "version": "1.19.11", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==", + "dev": true + }, "node_modules/well-known-symbols": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", @@ -1852,6 +2137,18 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/write-file-atomic/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package.json b/cmd/crates/soroban-spec-typescript/ts-tests/package.json index c840d93356..c76a0f5eab 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/package.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package.json @@ -2,12 +2,21 @@ "private": true, "type": "module", "scripts": { + "postinstall": "curl -X POST \"http://localhost:8000/soroban/rpc\" && npm run fund && npm run deploy && npm run bindings || { echo \"Make sure you're running standalone RPC network on localhost:8000\" && exit 1; }", + "fund": "./soroban config identity fund", + "bindings:custom-types": "./soroban contract bindings typescript --contract-id $(cat contract-id-custom-types.txt) --output-dir ./node_modules/test-custom-types --overwrite", + "bindings:hello-world": "./soroban contract bindings typescript --contract-id $(cat contract-id-hello-world.txt) --output-dir ./node_modules/test-hello-world --overwrite", + "bindings": "npm run bindings:custom-types && npm run bindings:hello-world", + "deploy:custom-types": "(./soroban contract deploy --wasm ../../../../target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm) > contract-id-custom-types.txt", + "deploy:hello-world": "(./soroban contract deploy --wasm ../../../../target/wasm32-unknown-unknown/test-wasms/test_hello_world.wasm) > contract-id-hello-world.txt", + "deploy": "npm run deploy:custom-types && npm run deploy:hello-world", "test": "ava" }, "devDependencies": { "@ava/typescript": "^4.1.0", "@types/node": "^20.4.9", "ava": "^5.3.1", + "soroban-client": "^0.11.0", "typescript": "^5.1.6" }, "ava": { @@ -17,5 +26,9 @@ }, "compile": "tsc" } - } + }, + "engines": { + "node": ">=20.6.0", + "npm": ">=9.8.1" + } } diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/soroban b/cmd/crates/soroban-spec-typescript/ts-tests/soroban new file mode 100755 index 0000000000..8e5e7fcd5f --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/soroban @@ -0,0 +1,3 @@ +#!/bin/bash + +cargo run -p soroban-cli -- "$@" diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts new file mode 100644 index 0000000000..13c9e0712b --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-custom-types.ts @@ -0,0 +1,176 @@ +import test from 'ava' +import { publicKey, rpcUrl, wallet } from './util.js' +import { Contract, Ok, Err, networks, Address } from 'test-custom-types' + +const addr = Address.fromString(publicKey) + +const contract = new Contract({ ...networks.standalone, rpcUrl, wallet}); + +test('hello', async t => { + t.is(await contract.hello({ hello: 'tests' }), 'tests') +}) + +test('woid', async t => { + t.is(await contract.woid(), undefined) +}) + +// Bug in soroban client, will be fixed in next release +test('u32_fail_on_even', async t => { + t.deepEqual(await contract.u32FailOnEven({ u32_: 1 }), new Ok(1)) + t.deepEqual(await contract.u32FailOnEven({ u32_: 0 }), new Err({ message: "Please provide an odd number" })) +}) + +test('u32', async t => { + t.is(await contract.u32({ u32_: 1 }), 1) +}) + +test('i32', async t => { + t.is(await contract.i32({ i32_: 1 }), 1) +}) + +test('i64', async t => { + t.is(await contract.i64({ i64_: 1n }), 1n) +}) + +test("strukt_hel", async (t) => { + let test = { a: 0, b: true, c: "world" } + t.deepEqual(await contract.struktHel({ strukt: test }), ["Hello", "world"]) +}) + +test("strukt", async (t) => { + let test = { a: 0, b: true, c: "hello" } + t.deepEqual(await contract.strukt({ strukt: test }), test) +}) + +test('simple first', async t => { + const simple = { tag: 'First', values: undefined } as const + t.deepEqual(await contract.simple({ simple }), simple) +}) + +test('simple second', async t => { + const simple = { tag: 'Second', values: undefined } as const + t.deepEqual(await contract.simple({ simple }), simple) +}) + +test('simple third', async t => { + const simple = { tag: 'Third', values: undefined } as const + t.deepEqual(await contract.simple({ simple }), simple) +}) + +test('complex with struct', async t => { + const arg = { tag: 'Struct', values: [{ a: 0, b: true, c: 'hello' }] } as const + const ret = { tag: 'Struct', values: [{ a: 0, b: true, c: 'hello' }] } + t.deepEqual(await contract.complex({ complex: arg }), ret) +}) + +test('complex with tuple', async t => { + const arg = { tag: 'Tuple', values: [[{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }]] } as const + const ret = { tag: 'Tuple', values: [[{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }]] } + t.deepEqual(await contract.complex({ complex: arg }), ret) +}) + +test('complex with enum', async t => { + const arg = { tag: 'Enum', values: [{ tag: 'First', values: undefined }] } as const + const ret = { tag: 'Enum', values: [{ tag: 'First', values: undefined }] } + t.deepEqual(await contract.complex({ complex: arg }), ret) +}) + +test('complex with asset', async t => { + const arg = { tag: 'Asset', values: [addr, 1n] } as const + const ret = { tag: 'Asset', values: [addr, 1n] } + t.deepEqual(await contract.complex({ complex: arg }), ret) +}) + +test('complex with void', async t => { + const complex = { tag: 'Void', values: undefined } as const + t.deepEqual(await contract.complex({ complex }), complex) +}) + +test('addresse', async t => { + t.deepEqual(await contract.addresse({ addresse: addr }), addr) +}) + +test('bytes', async t => { + const bytes = Buffer.from('hello') + t.deepEqual(await contract.bytes({ bytes }), bytes) +}) + +test('bytes_n', async t => { + const bytes_n = Buffer.from('123456789') // what's the correct way to construct bytes_n? + t.deepEqual(await contract.bytesN({ bytes_n }), bytes_n) +}) + +test('card', async t => { + const card = 11 + t.is(await contract.card({ card }), card) +}) + +test('boolean', async t => { + t.is(await contract.boolean({ boolean: true }), true) +}) + +test('not', async t => { + t.is(await contract.not({ boolean: true }), false) +}) + +test('i128', async t => { + t.is(await contract.i128({ i128: -1n }), -1n) +}) + +test('u128', async t => { + t.is(await contract.u128({ u128: 1n }), 1n) +}) + +test('multi_args', async t => { + t.is(await contract.multiArgs({ a: 1, b: true }), 1) + t.is(await contract.multiArgs({ a: 1, b: false }), 0) +}) + +test('map', async t => { + const map = new Map() + map.set(1, true) + map.set(2, false) + // map.set(3, 'hahaha') // should throw an error + t.deepEqual(await contract.map({ map }), map) +}) + +test('vec', async t => { + const vec = [1, 2, 3] + t.deepEqual(await contract.vec({ vec }), vec) +}) + +test('tuple', async t => { + const tuple = ['hello', 1] as const + t.deepEqual(await contract.tuple({ tuple }), tuple) +}) + +test('option', async t => { + // this makes sense + t.deepEqual(await contract.option({ option: 1 }), 1) + + // this passes but shouldn't + t.deepEqual(await contract.option({ option: undefined }), undefined) + + // this is the behavior we probably want, but fails + // t.deepEqual(await contract.option(), undefined) // typing and implementation require the object + // t.deepEqual(await contract.option({}), undefined) // typing requires argument; implementation would be fine with this + // t.deepEqual(await contract.option({ option: undefined }), undefined) +}) + +test('u256', async t => { + t.is(await contract.u256({ u256: 1n }), 1n) +}) + +test('i256', async t => { + t.is(await contract.i256({ i256: -1n }), -1n) +}) + +test('string', async t => { + t.is(await contract.string({ string: 'hello' }), 'hello') +}) + +test('tuple_strukt', async t => { + const arg = [{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }] as const + const res = [{ a: 0, b: true, c: 'hello' }, { tag: 'First', values: undefined }] + t.deepEqual(await contract.tupleStrukt({ tuple_strukt: arg }), res) +}) diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts new file mode 100644 index 0000000000..7ec386f546 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-hello-world.ts @@ -0,0 +1,22 @@ +import test from "ava"; +import { wallet, publicKey, rpcUrl } from "./util.js"; +import { Address, Contract, networks } from "test-hello-world"; + +const addr = Address.fromString(publicKey); + +const contract = new Contract({...networks.standalone, rpcUrl, wallet}); + +test("hello", async (t) => { + t.deepEqual(await contract.hello({ world: "tests" }), ["Hello", "tests"]); +}); + +// Currently must run tests in serial because nonce logic not smart enough to handle concurrent calls. +test.serial("auth", async (t) => { + t.deepEqual(await contract.auth({ addr, world: 'lol' }), addr) +}); + +test.serial("inc", async (t) => { + t.is(await contract.getCount(), 0); + t.is(await contract.inc({}), 1) + t.is(await contract.getCount(), 1); +}); diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test-methods-as-args.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-methods-as-args.ts new file mode 100644 index 0000000000..f89dd45298 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test-methods-as-args.ts @@ -0,0 +1,12 @@ +import test from "ava"; +import { wallet, publicKey, rpcUrl } from "./util.js"; +import { Address, Contract, networks } from "test-hello-world"; + +const contract = new Contract({...networks.standalone, rpcUrl, wallet}); + +// this test checks that apps can pass methods as arguments to other methods and have them still work +const hello = contract.hello + +test("hello", async (t) => { + t.deepEqual(await hello({ world: "tests" }), ["Hello", "tests"]); +}); diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts new file mode 100644 index 0000000000..f8955c44eb --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts @@ -0,0 +1,27 @@ +import { Keypair, TransactionBuilder } from "soroban-client"; + +export const rpcUrl = "http://localhost:8000/soroban/rpc"; +export const secretKey = + "SC36BWNUOCZAO7DMEJNNKFV6BOTPJP7IG5PSHLUOLT6DZFRU3D3XGIXW"; + +const keypair = Keypair.fromSecret(secretKey); +export const publicKey = keypair.publicKey(); +const networkPassphrase = "Standalone Network ; February 2017"; + +export const wallet = { + isConnected: () => Promise.resolve(true), + isAllowed: () => Promise.resolve(true), + getUserInfo: () => Promise.resolve({ publicKey }), + signTransaction: async ( + tx: string, + _opts?: { + network?: string; + networkPassphrase?: string; + accountToSign?: string; + } + ) => { + const t = TransactionBuilder.fromXDR(tx, networkPassphrase); + t.sign(keypair); + return t.toXDR(); + }, +}; diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json b/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json index 36823a0e2c..b90870f4e5 100644 --- a/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json +++ b/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json @@ -22,9 +22,9 @@ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "ESNext", /* Specify what module code is generated. */ + "module": "NodeNext", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ @@ -98,4 +98,4 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ } -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs index 7bdf62194b..30476a5cc8 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/src/lib.rs @@ -30,6 +30,12 @@ impl Contract { addr } + // get current count + pub fn get_count(env: Env) -> u32 { + env.storage().temporary().get(&COUNTER).unwrap_or(0) + } + + // increment count and return new one pub fn inc(env: Env) -> u32 { let mut count: u32 = env.storage().persistent().get(&COUNTER).unwrap_or(0); // Panic if the value of COUNTER is not u32. log!(&env, "count: {}", count);