From 325cf4fb0af3063b56561b996e79be25adbefeeb Mon Sep 17 00:00:00 2001 From: Chad Ostrowski <221614+chadoh@users.noreply.github.com> Date: Fri, 18 Aug 2023 08:46:04 -0400 Subject: [PATCH] feat(bindings-ts)!: require configuring network settings (#852) * feat(bindings-ts)!: require configuring network settings Generated libraries now export a `Contract` class that needs to be instantiated by the user with RPC URL, Network Passphrase, and contract ID. * feat(bindings-ts): add test config for generated fixtures * feat: test drive error-parsing in client libs this logic was totally broken! thanks for showing us, tests. * chore: add failing custom type test * chore: demonstrate complex enum shortcomings you can see here that - the input needs the `as const` - but to make that work for complex types, a `readonly` is needed in the typing additionally, the input and output are typed differently: - the input needs to be wrapped in an array - the output does not also, for enums that do not have `values`, you still need to specify `values: undefined` * chore: demonstrate many struct encoding problems * chore: demonstrate many struct encoding problems * feat: no more need for `Method` suffix When we exported functions for each method, we needed to make sure we only used safe JS words. This no longer matters, since they're exposed as methods on the `Contract` class. Since this change required rebuilding the snapshot, I also made sure the `readonly` settings were added to the source, rather than manually to the snapshot. * chore: finish testing all custom_type methods * chore: remove placeholder signing machinery * feat: add `networks` export to generated library * chore: update generated README * chore: fix formatting of generated file * build: appease clippy * docs: remove outdated '--name' from example * docs: fix example in doc comment Re: https://typedoc.org/tags/example/, it is best to use both `@example` and the triple-backtick code block * build: update snapshot build command * docs: improve method-options TSDoc --------- Co-authored-by: Willem Wyndham --- Makefile | 6 +- .../fixtures/test_custom_types/README.md | 49 +- .../test_custom_types/dist/cjs/constants.d.ts | 18 - .../test_custom_types/dist/cjs/constants.js | 22 - .../test_custom_types/dist/cjs/index.d.ts | 1419 +++++------- .../test_custom_types/dist/cjs/index.js | 682 +++--- .../test_custom_types/dist/cjs/invoke.d.ts | 8 +- .../test_custom_types/dist/cjs/invoke.js | 37 +- .../dist/cjs/method-options.d.ts | 31 +- .../test_custom_types/dist/cjs/server.d.ts | 6 - .../test_custom_types/dist/cjs/server.js | 10 - .../test_custom_types/dist/esm/constants.d.ts | 18 - .../test_custom_types/dist/esm/constants.js | 19 - .../test_custom_types/dist/esm/index.d.ts | 1419 +++++------- .../test_custom_types/dist/esm/index.js | 651 +++--- .../test_custom_types/dist/esm/invoke.d.ts | 8 +- .../test_custom_types/dist/esm/invoke.js | 37 +- .../dist/esm/method-options.d.ts | 31 +- .../test_custom_types/dist/esm/server.d.ts | 6 - .../test_custom_types/dist/esm/server.js | 7 - .../dist/types/constants.d.ts | 18 - .../test_custom_types/dist/types/index.d.ts | 1419 +++++------- .../test_custom_types/dist/types/invoke.d.ts | 8 +- .../dist/types/method-options.d.ts | 31 +- .../test_custom_types/dist/types/server.d.ts | 6 - .../test_custom_types/package-lock.json | 58 +- .../test_custom_types/src/constants.ts | 25 - .../fixtures/test_custom_types/src/index.ts | 1902 +++++++--------- .../fixtures/test_custom_types/src/invoke.ts | 42 +- .../test_custom_types/src/method-options.ts | 32 +- .../fixtures/test_custom_types/src/server.ts | 8 - .../src/boilerplate.rs | 36 +- cmd/crates/soroban-spec-typescript/src/lib.rs | 140 +- .../src/project_template/README.md | 17 +- .../src/project_template/src/constants.ts | 25 - .../src/project_template/src/index.ts | 22 +- .../src/project_template/src/invoke.ts | 42 +- .../project_template/src/method-options.ts | 32 +- .../src/project_template/src/server.ts | 8 - .../ts-tests/.gitignore | 2 + .../ts-tests/package-lock.json | 1960 +++++++++++++++++ .../ts-tests/package.json | 21 + .../ts-tests/src/test.ts | 188 ++ .../ts-tests/tsconfig.json | 101 + .../test-wasms/custom_type/src/lib.rs | 6 +- .../soroban-test/tests/it/custom_types.rs | 4 +- 46 files changed, 5919 insertions(+), 4718 deletions(-) delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.d.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.js delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.d.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.js delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.d.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.js delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.d.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.js delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/constants.d.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/server.d.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/constants.ts delete mode 100644 cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/server.ts delete mode 100644 cmd/crates/soroban-spec-typescript/src/project_template/src/constants.ts delete mode 100644 cmd/crates/soroban-spec-typescript/src/project_template/src/server.ts create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/.gitignore create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/package.json create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/src/test.ts create mode 100644 cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json diff --git a/Makefile b/Makefile index 46072456f..1172a0155 100644 --- a/Makefile +++ b/Makefile @@ -103,10 +103,10 @@ lint: typescript-bindings-fixtures: build-test-wasms cargo run -- contract bindings typescript \ --wasm ./target/wasm32-unknown-unknown/test-wasms/test_custom_types.wasm \ - --contract-name test_custom_types \ - --contract-id CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE \ + --contract-id CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4 \ --network futurenet \ - --output-dir ./cmd/crates/soroban-spec-typescript/fixtures + --output-dir ./cmd/crates/soroban-spec-typescript/fixtures/test_custom_types \ + --overwrite # PHONY lists all the targets that aren't file names, so that make would skip the timestamp based check. 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 19a6925cf..d3b60edc8 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,44 +6,49 @@ This library was automatically generated by Soroban CLI using a command similar ```bash soroban contract bindings ts \ - --rpc-url https://rpc-futurenet.stellar.org/soroban/rpc \ + --rpc-url https://rpc-futurenet.stellar.org:443 \ --network-passphrase "Test SDF Future Network ; October 2022" \ - --id CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE \ - --name test_custom_types + --contract-id CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4 \ + --output-dir ./path/to/test_custom_types ``` -It uses these settings by default, but you can override them with environment variables if you need to: +The network passphrase and contract ID are exported from [index.ts](./src/index.ts) in the `networks` constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update `networks` with other valid options. This will help your contract consumers use this library more easily. -- **Contract ID**: `CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE` +# To publish or not to publish - Override with environment variable `SOROBAN_TEST_CUSTOM_TYPES_CONTRACT_ID` or `PUBLIC_SOROBAN_TEST_CUSTOM_TYPES_CONTRACT_ID` +This library is suitable for publishing to NPM. You can publish it to NPM using the `npm publish` command. -- **RPC endpoint**: `https://rpc-futurenet.stellar.org/soroban/rpc` +But you don't need to publish this library to NPM to use it. You can add it to your project's `package.json` using a file path: - Override with environment variable `SOROBAN_RPC_URL` or `PUBLIC_SOROBAN_RPC_URL` - -- **Network Passphrase**: `Test SDF Future Network ; October 2022` - - Override with environment variable `SOROBAN_NETWORK_PASSPHRASE` or `PUBLIC_SOROBAN_NETWORK_PASSPHRASE` - -# Use it +```json +"dependencies": { + "test_custom_types": "./path/to/this/folder" +} +``` -You don't need to publish this library to NPM to use it. You can add it to your project's `package.json` using a file path: +However, we've actually encountered [frustration](https://github.com/stellar/soroban-example-dapp/pull/117#discussion_r1232873560) using local libraries with NPM in this way. Though it seems a bit messy, we suggest generating the library directly to your `node_modules` folder automatically after each install by using a `postinstall` script. We've had the least trouble with this approach. NPM will automatically remove what it sees as erroneous directories during the `install` step, and then regenerate them when it gets to your `postinstall` step, which will keep the library up-to-date with your contract. ```json -{ - "dependencies": { - "test_custom_types": "./path/to/this/folder" - } +"scripts": { + "postinstall": "soroban contract bindings ts --rpc-url https://rpc-futurenet.stellar.org:443 --network-passphrase \"Test SDF Future Network ; October 2022\" --id CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4 --name test_custom_types" } ``` -Then you can import it into your editor and see inline documentation for all of its exports: +Obviously you need to adjust the above command based on the actual command you used to generate the library. + +# Use it + +Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods: ```js -import * as testCustomTypes from "test_custom_types" +import { Contract, networks } from "test_custom_types" + +const contract = new Contract({ + ...networks.futurenet, // for example; check which networks this library exports + rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers +}) -testCustomTypes.| +contract.| ``` As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that `|` to get a list of all exports and inline-documentation for each. It exports a separate [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code. diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.d.ts deleted file mode 100644 index a36801fa0..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * The Soroban contract ID for the test_custom_types contract. - */ -export declare const CONTRACT_ID = "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE"; -/** - * The Soroban contract ID for the test_custom_types contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -export declare const CONTRACT_ID_HEX: string; -/** - * The Soroban network passphrase used to initialize this library. - */ -export declare const NETWORK_PASSPHRASE = "Test SDF Future Network ; October 2022"; -/** - * The Soroban RPC endpoint used to initialize this library. - */ -export declare const RPC_URL = "https://rpc-futurenet.stellar.org/soroban/rpc"; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.js deleted file mode 100644 index 07725f2bf..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/constants.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.RPC_URL = exports.NETWORK_PASSPHRASE = exports.CONTRACT_ID_HEX = exports.CONTRACT_ID = void 0; -const soroban_client_1 = require("soroban-client"); -/** - * The Soroban contract ID for the test_custom_types contract. - */ -exports.CONTRACT_ID = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; -/** - * The Soroban contract ID for the test_custom_types contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -exports.CONTRACT_ID_HEX = new soroban_client_1.Contract(exports.CONTRACT_ID).contractId('hex'); -/** - * The Soroban network passphrase used to initialize this library. - */ -exports.NETWORK_PASSPHRASE = 'Test SDF Future Network ; October 2022'; -/** - * The Soroban RPC endpoint used to initialize this library. - */ -exports.RPC_URL = 'https://rpc-futurenet.stellar.org/soroban/rpc'; 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 a57f20c79..5fcbe41a4 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 @@ -1,9 +1,8 @@ import * as SorobanClient from 'soroban-client'; import { Buffer } from "buffer"; -import type { ResponseTypes, Wallet } from './method-options.js'; -export * from './constants.js'; -export * from './server.js'; +import type { ResponseTypes, 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; @@ -41,6 +40,12 @@ export declare class Err implements Result { isOk(): boolean; isErr(): boolean; } +export declare const networks: { + readonly futurenet: { + readonly networkPassphrase: "Test SDF Future Network ; October 2022"; + readonly contractId: "CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4"; + }; +}; /** * This is from the rust doc above the struct Test */ @@ -64,866 +69,590 @@ export declare enum RoyalCard { Queen = 12, King = 13 } -export type TupleStruct = [Test, SimpleEnum]; +export type TupleStruct = readonly [Test, SimpleEnum]; export type ComplexEnum = { tag: "Struct"; - values: [Test]; + values: readonly [Test]; } | { tag: "Tuple"; - values: [TupleStruct]; + values: readonly [TupleStruct]; } | { tag: "Enum"; - values: [SimpleEnum]; + values: readonly [SimpleEnum]; } | { tag: "Asset"; - values: [Address, i128]; + values: readonly [Address, i128]; } | { tag: "Void"; values: void; }; -export declare function hello({ hello }: { - hello: string; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function woid(options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function val(options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u32FailOnEven({ u32_ }: { - u32_: u32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - responseType?: R; +export declare class Contract { + readonly options: ClassOptions; + constructor(options: ClassOptions); + hello({ hello }: { + hello: string; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + woid(options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + val(options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u32FailOnEven({ u32_ }: { + u32_: u32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 | (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_ }: { + u32_: u32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i32({ i32_ }: { + i32_: i32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i64({ i64_ }: { + i64_: i64; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise | Ok : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok>; -export declare function u32({ u32_ }: { - u32_: u32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i32({ i32_ }: { - i32_: i32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i64({ i64_ }: { - i64_: i64; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Example contract method which takes a struct */ -export declare function struktHel({ strukt }: { - strukt: Test; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function strukt({ strukt }: { - strukt: Test; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function simple({ simple }: { - simple: SimpleEnum; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function complex({ complex }: { - complex: ComplexEnum; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function addresse({ addresse }: { - addresse: Address; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function bytes({ bytes }: { - bytes: Buffer; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function bytesN({ bytes_n }: { - bytes_n: Buffer; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function card({ card }: { - card: RoyalCard; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; + struktHel({ strukt }: { + strukt: Test; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + strukt({ strukt }: { + strukt: Test; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + simple({ simple }: { + simple: SimpleEnum; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + complex({ complex }: { + complex: ComplexEnum; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + addresse({ addresse }: { + addresse: Address; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + bytes({ bytes }: { + bytes: Buffer; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + bytesN({ bytes_n }: { + bytes_n: Buffer; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + card({ card }: { + card: RoyalCard; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + boolean({ boolean }: { + boolean: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function booleanMethod({ boolean }: { - boolean: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Negates a boolean value */ -export declare function not({ boolean }: { - boolean: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i128({ i128 }: { - i128: i128; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u128({ u128 }: { - u128: u128; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function multiArgs({ a, b }: { - a: u32; - b: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function map({ map }: { - map: Map; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; -export declare function vec({ vec }: { - vec: Array; -}, options?: { + not({ boolean }: { + boolean: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i128({ i128 }: { + i128: i128; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u128({ u128 }: { + u128: u128; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + multiArgs({ a, b }: { + a: u32; + b: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + map({ map }: { + map: Map; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; + vec({ vec }: { + vec: Array; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + tuple({ tuple }: { + tuple: readonly [string, u32]; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `readonly [string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function tuple({ tuple }: { - tuple: [string, u32]; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `[string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Example of an optional argument */ -export declare function option({ option }: { - option: Option; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u256({ u256 }: { - u256: u256; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i256({ i256 }: { - i256: i256; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function string({ string }: { - string: string; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function tupleStrukt({ tuple_strukt }: { - tuple_strukt: TupleStruct; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; + option({ option }: { + option: Option; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u256({ u256 }: { + u256: u256; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i256({ i256 }: { + i256: i256; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + string({ string }: { + string: string; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + tupleStrukt({ tuple_strukt }: { + tuple_strukt: TupleStruct; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; +} 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 aca05283e..9345bceb2 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 @@ -14,14 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.tupleStrukt = exports.string = exports.i256 = exports.u256 = exports.option = exports.tuple = exports.vec = exports.map = exports.multiArgs = exports.u128 = exports.i128 = exports.not = exports.booleanMethod = exports.card = exports.bytesN = exports.bytes = exports.addresse = exports.complex = exports.simple = exports.strukt = exports.struktHel = exports.i64 = exports.i32 = exports.u32 = exports.u32FailOnEven = exports.val = exports.woid = exports.hello = exports.RoyalCard = exports.Err = exports.Ok = void 0; +exports.Contract = exports.RoyalCard = exports.networks = exports.Err = exports.Ok = void 0; const soroban_client_1 = require("soroban-client"); const buffer_1 = require("buffer"); const convert_js_1 = require("./convert.js"); const invoke_js_1 = require("./invoke.js"); -__exportStar(require("./constants.js"), exports); -__exportStar(require("./server.js"), exports); __exportStar(require("./invoke.js"), exports); +__exportStar(require("./method-options.js"), exports); ; ; class Ok { @@ -66,22 +65,28 @@ if (typeof window !== 'undefined') { //@ts-ignore Buffer exists window.Buffer = window.Buffer || buffer_1.Buffer; } -const regex = /ContractError\((\d+)\)/; -function getError(err) { - const match = err.match(regex); +const regex = /Error\(Contract, #(\d+)\)/; +function parseError(message) { + const match = message.match(regex); if (!match) { return undefined; } - if (Errors == undefined) { + if (Errors === undefined) { return undefined; } - // @ts-ignore let i = parseInt(match[1], 10); - if (i < Errors.length) { - return new Err(Errors[i]); + let err = Errors[i]; + if (err) { + return new Err(err); } return undefined; } +exports.networks = { + futurenet: { + networkPassphrase: "Test SDF Future Network ; October 2022", + contractId: "CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4", + } +}; function TestToXdr(test) { if (!test) { return soroban_client_1.xdr.ScVal.scvVoid(); @@ -192,338 +197,343 @@ function ComplexEnumFromXdr(base64Xdr) { } return { tag, values }; } -const Errors = [ - { message: "Unknown error has occurred" } -]; -async function hello({ hello }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'hello', - args: [((i) => soroban_client_1.xdr.ScVal.scvSymbol(i))(hello)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.hello = hello; -async function woid(options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'woid', - ...options, - parseResultXdr: () => { }, - }); -} -exports.woid = woid; -async function val(options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'val', - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.val = val; -async function u32FailOnEven({ u32_ }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'u32_fail_on_even', - args: [((i) => soroban_client_1.xdr.ScVal.scvU32(i))(u32_)], - ...options, - parseResultXdr: (xdr) => { - try { - return new Ok((0, convert_js_1.scValStrToJs)(xdr)); - } - catch (e) { - //@ts-ignore - let err = getError(e.message); - if (err) { +const Errors = { + 1: { message: "Please provide an odd number" } +}; +class Contract { + options; + constructor(options) { + this.options = options; + } + async hello({ hello }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'hello', + args: [((i) => soroban_client_1.xdr.ScVal.scvSymbol(i))(hello)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async woid(options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'woid', + ...options, + ...this.options, + parseResultXdr: () => { }, + }); + } + async val(options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'val', + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async u32FailOnEven({ u32_ }, options = {}) { + try { + return await (0, invoke_js_1.invoke)({ + method: 'u32_fail_on_even', + args: [((i) => soroban_client_1.xdr.ScVal.scvU32(i))(u32_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return new Ok((0, convert_js_1.scValStrToJs)(xdr)); + }, + }); + } + catch (e) { + if (typeof e === 'string') { + let err = parseError(e); + if (err) return err; - } - else { - throw e; - } } - }, - }); -} -exports.u32FailOnEven = u32FailOnEven; -async function u32({ u32_ }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'u32_', - args: [((i) => soroban_client_1.xdr.ScVal.scvU32(i))(u32_)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.u32 = u32; -async function i32({ i32_ }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'i32_', - args: [((i) => soroban_client_1.xdr.ScVal.scvI32(i))(i32_)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.i32 = i32; -async function i64({ i64_ }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'i64_', - args: [((i) => soroban_client_1.xdr.ScVal.scvI64(soroban_client_1.xdr.Int64.fromString(i.toString())))(i64_)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.i64 = i64; -/** + throw e; + } + } + async u32({ u32_ }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'u32_', + args: [((i) => soroban_client_1.xdr.ScVal.scvU32(i))(u32_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async i32({ i32_ }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'i32_', + args: [((i) => soroban_client_1.xdr.ScVal.scvI32(i))(i32_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async i64({ i64_ }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'i64_', + args: [((i) => soroban_client_1.xdr.ScVal.scvI64(soroban_client_1.xdr.Int64.fromString(i.toString())))(i64_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + /** * Example contract method which takes a struct */ -async function struktHel({ strukt }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'strukt_hel', - args: [((i) => TestToXdr(i))(strukt)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.struktHel = struktHel; -async function strukt({ strukt }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'strukt', - args: [((i) => TestToXdr(i))(strukt)], - ...options, - parseResultXdr: (xdr) => { - return TestFromXdr(xdr); - }, - }); -} -exports.strukt = strukt; -async function simple({ simple }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'simple', - args: [((i) => SimpleEnumToXdr(i))(simple)], - ...options, - parseResultXdr: (xdr) => { - return SimpleEnumFromXdr(xdr); - }, - }); -} -exports.simple = simple; -async function complex({ complex }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'complex', - args: [((i) => ComplexEnumToXdr(i))(complex)], - ...options, - parseResultXdr: (xdr) => { - return ComplexEnumFromXdr(xdr); - }, - }); -} -exports.complex = complex; -async function addresse({ addresse }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'addresse', - args: [((i) => (0, convert_js_1.addressToScVal)(i))(addresse)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.addresse = addresse; -async function bytes({ bytes }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'bytes', - args: [((i) => soroban_client_1.xdr.ScVal.scvBytes(i))(bytes)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.bytes = bytes; -async function bytesN({ bytes_n }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'bytes_n', - args: [((i) => soroban_client_1.xdr.ScVal.scvBytes(i))(bytes_n)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.bytesN = bytesN; -async function card({ card }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'card', - args: [((i) => RoyalCardToXdr(i))(card)], - ...options, - parseResultXdr: (xdr) => { - return RoyalCardFromXdr(xdr); - }, - }); -} -exports.card = card; -async function booleanMethod({ boolean }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'boolean', - args: [((i) => soroban_client_1.xdr.ScVal.scvBool(i))(boolean)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.booleanMethod = booleanMethod; -/** + async struktHel({ strukt }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'strukt_hel', + args: [((i) => TestToXdr(i))(strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async strukt({ strukt }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'strukt', + args: [((i) => TestToXdr(i))(strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return TestFromXdr(xdr); + }, + }); + } + async simple({ simple }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'simple', + args: [((i) => SimpleEnumToXdr(i))(simple)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return SimpleEnumFromXdr(xdr); + }, + }); + } + async complex({ complex }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'complex', + args: [((i) => ComplexEnumToXdr(i))(complex)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return ComplexEnumFromXdr(xdr); + }, + }); + } + async addresse({ addresse }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'addresse', + args: [((i) => (0, convert_js_1.addressToScVal)(i))(addresse)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async bytes({ bytes }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'bytes', + args: [((i) => soroban_client_1.xdr.ScVal.scvBytes(i))(bytes)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async bytesN({ bytes_n }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'bytes_n', + args: [((i) => soroban_client_1.xdr.ScVal.scvBytes(i))(bytes_n)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async card({ card }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'card', + args: [((i) => RoyalCardToXdr(i))(card)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return RoyalCardFromXdr(xdr); + }, + }); + } + async boolean({ boolean }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'boolean', + args: [((i) => soroban_client_1.xdr.ScVal.scvBool(i))(boolean)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + /** * Negates a boolean value */ -async function not({ boolean }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'not', - args: [((i) => soroban_client_1.xdr.ScVal.scvBool(i))(boolean)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.not = not; -async function i128({ i128 }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'i128', - args: [((i) => (0, convert_js_1.i128ToScVal)(i))(i128)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.i128 = i128; -async function u128({ u128 }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'u128', - args: [((i) => (0, convert_js_1.u128ToScVal)(i))(u128)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.u128 = u128; -async function multiArgs({ a, b }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'multi_args', - args: [((i) => soroban_client_1.xdr.ScVal.scvU32(i))(a), - ((i) => soroban_client_1.xdr.ScVal.scvBool(i))(b)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.multiArgs = multiArgs; -async function map({ map }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'map', - args: [((i) => soroban_client_1.xdr.ScVal.scvMap(Array.from(i.entries()).map(([key, value]) => { - return new soroban_client_1.xdr.ScMapEntry({ - key: ((i) => soroban_client_1.xdr.ScVal.scvU32(i))(key), - val: ((i) => soroban_client_1.xdr.ScVal.scvBool(i))(value) - }); - })))(map)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.map = map; -async function vec({ vec }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'vec', - args: [((i) => soroban_client_1.xdr.ScVal.scvVec(i.map((i) => soroban_client_1.xdr.ScVal.scvU32(i))))(vec)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.vec = vec; -async function tuple({ tuple }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'tuple', - args: [((i) => soroban_client_1.xdr.ScVal.scvVec([((i) => soroban_client_1.xdr.ScVal.scvSymbol(i))(i[0]), - ((i) => soroban_client_1.xdr.ScVal.scvU32(i))(i[1])]))(tuple)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.tuple = tuple; -/** + async not({ boolean }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'not', + args: [((i) => soroban_client_1.xdr.ScVal.scvBool(i))(boolean)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async i128({ i128 }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'i128', + args: [((i) => (0, convert_js_1.i128ToScVal)(i))(i128)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async u128({ u128 }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'u128', + args: [((i) => (0, convert_js_1.u128ToScVal)(i))(u128)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async multiArgs({ a, b }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'multi_args', + args: [((i) => soroban_client_1.xdr.ScVal.scvU32(i))(a), + ((i) => soroban_client_1.xdr.ScVal.scvBool(i))(b)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async map({ map }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'map', + args: [((i) => soroban_client_1.xdr.ScVal.scvMap(Array.from(i.entries()).map(([key, value]) => { + return new soroban_client_1.xdr.ScMapEntry({ + key: ((i) => soroban_client_1.xdr.ScVal.scvU32(i))(key), + val: ((i) => soroban_client_1.xdr.ScVal.scvBool(i))(value) + }); + })))(map)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async vec({ vec }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'vec', + args: [((i) => soroban_client_1.xdr.ScVal.scvVec(i.map((i) => soroban_client_1.xdr.ScVal.scvU32(i))))(vec)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async tuple({ tuple }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'tuple', + args: [((i) => soroban_client_1.xdr.ScVal.scvVec([((i) => soroban_client_1.xdr.ScVal.scvSymbol(i))(i[0]), + ((i) => soroban_client_1.xdr.ScVal.scvU32(i))(i[1])]))(tuple)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + /** * Example of an optional argument */ -async function option({ option }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'option', - args: [((i) => (!i) ? soroban_client_1.xdr.ScVal.scvVoid() : soroban_client_1.xdr.ScVal.scvU32(i))(option)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.option = option; -async function u256({ u256 }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'u256', - args: [((i) => i)(u256)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.u256 = u256; -async function i256({ i256 }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'i256', - args: [((i) => i)(i256)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.i256 = i256; -async function string({ string }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'string', - args: [((i) => soroban_client_1.xdr.ScVal.scvString(i))(string)], - ...options, - parseResultXdr: (xdr) => { - return (0, convert_js_1.scValStrToJs)(xdr); - }, - }); -} -exports.string = string; -async function tupleStrukt({ tuple_strukt }, options = {}) { - return await (0, invoke_js_1.invoke)({ - method: 'tuple_strukt', - args: [((i) => TupleStructToXdr(i))(tuple_strukt)], - ...options, - parseResultXdr: (xdr) => { - return TupleStructFromXdr(xdr); - }, - }); + async option({ option }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'option', + args: [((i) => (!i) ? soroban_client_1.xdr.ScVal.scvVoid() : soroban_client_1.xdr.ScVal.scvU32(i))(option)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async u256({ u256 }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'u256', + args: [((i) => i)(u256)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async i256({ i256 }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'i256', + args: [((i) => i)(i256)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async string({ string }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'string', + args: [((i) => soroban_client_1.xdr.ScVal.scvString(i))(string)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return (0, convert_js_1.scValStrToJs)(xdr); + }, + }); + } + async tupleStrukt({ tuple_strukt }, options = {}) { + return await (0, invoke_js_1.invoke)({ + method: 'tuple_strukt', + args: [((i) => TupleStructToXdr(i))(tuple_strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return TupleStructFromXdr(xdr); + }, + }); + } } -exports.tupleStrukt = tupleStrukt; +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 ddd4eb62f..033c64592 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,6 +1,6 @@ import * as SorobanClient from 'soroban-client'; import type { Memo, MemoType, Operation, Transaction } from 'soroban-client'; -import type { Options, ResponseTypes, Wallet } from './method-options.js'; +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from './method-options.js'; export type Tx = Transaction, Operation[]>; export declare class NotImplementedError extends Error { } @@ -9,7 +9,7 @@ type SendTx = SorobanClient.SorobanRpc.SendTransactionResponse; type GetTx = SorobanClient.SorobanRpc.GetTransactionResponse; declare let someRpcResponse: Simulation | SendTx | GetTx; type SomeRpcResponse = typeof someRpcResponse; -type InvokeArgs = Options & { +type InvokeArgs = MethodOptions & ClassOptions & { method: string; args?: any[]; parseResultXdr?: (xdr: string) => T; @@ -30,7 +30,7 @@ export declare function invoke( * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -export declare function signTx(wallet: Wallet, tx: Tx): Promise; +export declare function signTx(wallet: Wallet, tx: Tx, networkPassphrase: string): Promise; /** * Send a transaction to the Soroban network. * @@ -41,5 +41,5 @@ export declare function signTx(wallet: Wallet, tx: Tx): Promise; * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -export declare function sendTx(tx: Tx, secondsToWait: number): Promise; +export declare function sendTx(tx: Tx, secondsToWait: number, server: SorobanClient.Server): Promise; export {}; 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 de0e11c42..6912acebf 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,13 +2,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.sendTx = exports.signTx = exports.invoke = exports.NotImplementedError = void 0; const SorobanClient = require("soroban-client"); -const constants_js_1 = require("./constants.js"); -const server_js_1 = require("./server.js"); /** * Get account details from the Soroban network for the publicKey currently * selected in Freighter. If not connected to Freighter, return null. */ -async function getAccount(wallet) { +async function getAccount(wallet, server) { if (!await wallet.isConnected() || !await wallet.isAllowed()) { return null; } @@ -16,27 +14,30 @@ async function getAccount(wallet) { if (!publicKey) { return null; } - return await server_js_1.Server.getAccount(publicKey); + return await server.getAccount(publicKey); } class NotImplementedError extends Error { } 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, wallet, }) { +async function invoke({ method, args = [], fee = 100, responseType, parseResultXdr, secondsToWait = 10, rpcUrl, networkPassphrase, contractId, wallet, }) { wallet = wallet ?? await Promise.resolve().then(() => require('@stellar/freighter-api')); - const walletAccount = await getAccount(wallet); + const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith('http://') }); + const walletAccount = await getAccount(wallet, server); // use a placeholder null account if not yet connected to Freighter so that view calls can still work const account = walletAccount ?? new SorobanClient.Account('GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF', '0'); - const contract = new SorobanClient.Contract(constants_js_1.CONTRACT_ID); + const contract = new SorobanClient.Contract(contractId); let tx = new SorobanClient.TransactionBuilder(account, { fee: fee.toString(10), - networkPassphrase: constants_js_1.NETWORK_PASSPHRASE, + networkPassphrase, }) .addOperation(contract.call(method, ...args)) .setTimeout(SorobanClient.TimeoutInfinite) .build(); - const simulated = await server_js_1.Server.simulateTransaction(tx); + const simulated = await server.simulateTransaction(tx); + 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. @@ -73,8 +74,8 @@ async function invoke({ method, args = [], fee = 100, responseType, parseResultX if (!walletAccount) { throw new Error('Not connected to Freighter'); } - tx = await signTx(wallet, SorobanClient.assembleTransaction(tx, constants_js_1.NETWORK_PASSPHRASE, simulated)); - const raw = await sendTx(tx, secondsToWait); + tx = await signTx(wallet, SorobanClient.assembleTransaction(tx, networkPassphrase, simulated), networkPassphrase); + const raw = await sendTx(tx, secondsToWait, server); if (responseType === 'full') return raw; // if `sendTx` awaited the inclusion of the tx in the ledger, it used @@ -97,11 +98,11 @@ exports.invoke = invoke; * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -async function signTx(wallet, tx) { +async function signTx(wallet, tx, networkPassphrase) { const signed = await wallet.signTransaction(tx.toXDR(), { - networkPassphrase: constants_js_1.NETWORK_PASSPHRASE, + networkPassphrase, }); - return SorobanClient.TransactionBuilder.fromXDR(signed, constants_js_1.NETWORK_PASSPHRASE); + return SorobanClient.TransactionBuilder.fromXDR(signed, networkPassphrase); } exports.signTx = signTx; /** @@ -114,12 +115,12 @@ exports.signTx = signTx; * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -async function sendTx(tx, secondsToWait) { - const sendTransactionResponse = await server_js_1.Server.sendTransaction(tx); +async function sendTx(tx, secondsToWait, server) { + const sendTransactionResponse = await server.sendTransaction(tx); if (sendTransactionResponse.status !== "PENDING" || secondsToWait === 0) { return sendTransactionResponse; } - let getTransactionResponse = await server_js_1.Server.getTransaction(sendTransactionResponse.hash); + let getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); const waitUntil = new Date((Date.now() + secondsToWait * 1000)).valueOf(); let waitTime = 1000; let exponentialFactor = 1.5; @@ -129,7 +130,7 @@ async function sendTx(tx, secondsToWait) { /// Exponential backoff waitTime = waitTime * exponentialFactor; // See if the transaction is complete - getTransactionResponse = await server_js_1.Server.getTransaction(sendTransactionResponse.hash); + getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); } if (getTransactionResponse.status === "NOT_FOUND") { console.log(`Waited ${secondsToWait} seconds for transaction to complete, but it did not. Returning anyway. Check the transaction status manually. Info: ${JSON.stringify(sendTransactionResponse, null, 2)}`); 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 88014d05d..f861ff1f2 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,26 @@ export interface Wallet { accountToSign?: string; }) => Promise; } -export type Options = { +export type ClassOptions = { + contractId: string; + networkPassphrase: string; + rpcUrl: string; + /** + * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: + * + * @example + * ```ts + * import freighter from "@stellar/freighter-api"; + * import { Contract } from "test_custom_types"; + * const contract = new Contract({ + * …, + * wallet: freighter, + * }) + * ``` + */ + wallet?: Wallet; +}; +export type MethodOptions = { /** * The fee to pay for the transaction. Default: 100. */ @@ -30,15 +49,5 @@ export type Options = { * 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; }; export {}; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.d.ts deleted file mode 100644 index bbfda5d68..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as SorobanClient from 'soroban-client'; -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -export declare const Server: SorobanClient.Server; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.js deleted file mode 100644 index 53c199f22..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/cjs/server.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Server = void 0; -const SorobanClient = require("soroban-client"); -const constants_js_1 = require("./constants.js"); -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -exports.Server = new SorobanClient.Server(constants_js_1.RPC_URL, { allowHttp: constants_js_1.RPC_URL.startsWith('http://') }); diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.d.ts deleted file mode 100644 index a36801fa0..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * The Soroban contract ID for the test_custom_types contract. - */ -export declare const CONTRACT_ID = "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE"; -/** - * The Soroban contract ID for the test_custom_types contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -export declare const CONTRACT_ID_HEX: string; -/** - * The Soroban network passphrase used to initialize this library. - */ -export declare const NETWORK_PASSPHRASE = "Test SDF Future Network ; October 2022"; -/** - * The Soroban RPC endpoint used to initialize this library. - */ -export declare const RPC_URL = "https://rpc-futurenet.stellar.org/soroban/rpc"; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.js deleted file mode 100644 index b72f8b29a..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/constants.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Contract } from 'soroban-client'; -/** - * The Soroban contract ID for the test_custom_types contract. - */ -export const CONTRACT_ID = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; -/** - * The Soroban contract ID for the test_custom_types contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -export const CONTRACT_ID_HEX = new Contract(CONTRACT_ID).contractId('hex'); -/** - * The Soroban network passphrase used to initialize this library. - */ -export const NETWORK_PASSPHRASE = 'Test SDF Future Network ; October 2022'; -/** - * The Soroban RPC endpoint used to initialize this library. - */ -export const RPC_URL = 'https://rpc-futurenet.stellar.org/soroban/rpc'; 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 a57f20c79..5fcbe41a4 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,9 +1,8 @@ import * as SorobanClient from 'soroban-client'; import { Buffer } from "buffer"; -import type { ResponseTypes, Wallet } from './method-options.js'; -export * from './constants.js'; -export * from './server.js'; +import type { ResponseTypes, 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; @@ -41,6 +40,12 @@ export declare class Err implements Result { isOk(): boolean; isErr(): boolean; } +export declare const networks: { + readonly futurenet: { + readonly networkPassphrase: "Test SDF Future Network ; October 2022"; + readonly contractId: "CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4"; + }; +}; /** * This is from the rust doc above the struct Test */ @@ -64,866 +69,590 @@ export declare enum RoyalCard { Queen = 12, King = 13 } -export type TupleStruct = [Test, SimpleEnum]; +export type TupleStruct = readonly [Test, SimpleEnum]; export type ComplexEnum = { tag: "Struct"; - values: [Test]; + values: readonly [Test]; } | { tag: "Tuple"; - values: [TupleStruct]; + values: readonly [TupleStruct]; } | { tag: "Enum"; - values: [SimpleEnum]; + values: readonly [SimpleEnum]; } | { tag: "Asset"; - values: [Address, i128]; + values: readonly [Address, i128]; } | { tag: "Void"; values: void; }; -export declare function hello({ hello }: { - hello: string; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function woid(options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function val(options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u32FailOnEven({ u32_ }: { - u32_: u32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - responseType?: R; +export declare class Contract { + readonly options: ClassOptions; + constructor(options: ClassOptions); + hello({ hello }: { + hello: string; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + woid(options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + val(options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u32FailOnEven({ u32_ }: { + u32_: u32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 | (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_ }: { + u32_: u32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i32({ i32_ }: { + i32_: i32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i64({ i64_ }: { + i64_: i64; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise | Ok : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok>; -export declare function u32({ u32_ }: { - u32_: u32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i32({ i32_ }: { - i32_: i32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i64({ i64_ }: { - i64_: i64; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Example contract method which takes a struct */ -export declare function struktHel({ strukt }: { - strukt: Test; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function strukt({ strukt }: { - strukt: Test; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function simple({ simple }: { - simple: SimpleEnum; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function complex({ complex }: { - complex: ComplexEnum; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function addresse({ addresse }: { - addresse: Address; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function bytes({ bytes }: { - bytes: Buffer; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function bytesN({ bytes_n }: { - bytes_n: Buffer; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function card({ card }: { - card: RoyalCard; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; + struktHel({ strukt }: { + strukt: Test; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + strukt({ strukt }: { + strukt: Test; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + simple({ simple }: { + simple: SimpleEnum; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + complex({ complex }: { + complex: ComplexEnum; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + addresse({ addresse }: { + addresse: Address; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + bytes({ bytes }: { + bytes: Buffer; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + bytesN({ bytes_n }: { + bytes_n: Buffer; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + card({ card }: { + card: RoyalCard; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + boolean({ boolean }: { + boolean: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function booleanMethod({ boolean }: { - boolean: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Negates a boolean value */ -export declare function not({ boolean }: { - boolean: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i128({ i128 }: { - i128: i128; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u128({ u128 }: { - u128: u128; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function multiArgs({ a, b }: { - a: u32; - b: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function map({ map }: { - map: Map; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; -export declare function vec({ vec }: { - vec: Array; -}, options?: { + not({ boolean }: { + boolean: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i128({ i128 }: { + i128: i128; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u128({ u128 }: { + u128: u128; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + multiArgs({ a, b }: { + a: u32; + b: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + map({ map }: { + map: Map; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; + vec({ vec }: { + vec: Array; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + tuple({ tuple }: { + tuple: readonly [string, u32]; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `readonly [string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function tuple({ tuple }: { - tuple: [string, u32]; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `[string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Example of an optional argument */ -export declare function option({ option }: { - option: Option; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u256({ u256 }: { - u256: u256; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i256({ i256 }: { - i256: i256; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function string({ string }: { - string: string; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function tupleStrukt({ tuple_strukt }: { - tuple_strukt: TupleStruct; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; + option({ option }: { + option: Option; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u256({ u256 }: { + u256: u256; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i256({ i256 }: { + i256: i256; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + string({ string }: { + string: string; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + tupleStrukt({ tuple_strukt }: { + tuple_strukt: TupleStruct; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; +} 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 c26badfeb..e9a5932bc 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 @@ -2,9 +2,8 @@ import { xdr } from 'soroban-client'; import { Buffer } from "buffer"; import { scValStrToJs, scValToJs, addressToScVal, u128ToScVal, i128ToScVal, strToScVal } from './convert.js'; import { invoke } from './invoke.js'; -export * from './constants.js'; -export * from './server.js'; export * from './invoke.js'; +export * from './method-options.js'; ; ; export class Ok { @@ -47,22 +46,28 @@ if (typeof window !== 'undefined') { //@ts-ignore Buffer exists window.Buffer = window.Buffer || Buffer; } -const regex = /ContractError\((\d+)\)/; -function getError(err) { - const match = err.match(regex); +const regex = /Error\(Contract, #(\d+)\)/; +function parseError(message) { + const match = message.match(regex); if (!match) { return undefined; } - if (Errors == undefined) { + if (Errors === undefined) { return undefined; } - // @ts-ignore let i = parseInt(match[1], 10); - if (i < Errors.length) { - return new Err(Errors[i]); + let err = Errors[i]; + if (err) { + return new Err(err); } return undefined; } +export const networks = { + futurenet: { + networkPassphrase: "Test SDF Future Network ; October 2022", + contractId: "CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4", + } +}; function TestToXdr(test) { if (!test) { return xdr.ScVal.scvVoid(); @@ -173,310 +178,342 @@ function ComplexEnumFromXdr(base64Xdr) { } return { tag, values }; } -const Errors = [ - { message: "Unknown error has occurred" } -]; -export async function hello({ hello }, options = {}) { - return await invoke({ - method: 'hello', - args: [((i) => xdr.ScVal.scvSymbol(i))(hello)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function woid(options = {}) { - return await invoke({ - method: 'woid', - ...options, - parseResultXdr: () => { }, - }); -} -export async function val(options = {}) { - return await invoke({ - method: 'val', - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function u32FailOnEven({ u32_ }, options = {}) { - return await invoke({ - method: 'u32_fail_on_even', - args: [((i) => xdr.ScVal.scvU32(i))(u32_)], - ...options, - parseResultXdr: (xdr) => { - try { - return new Ok(scValStrToJs(xdr)); - } - catch (e) { - //@ts-ignore - let err = getError(e.message); - if (err) { +const Errors = { + 1: { message: "Please provide an odd number" } +}; +export class Contract { + options; + constructor(options) { + this.options = options; + } + async hello({ hello }, options = {}) { + return await invoke({ + method: 'hello', + args: [((i) => xdr.ScVal.scvSymbol(i))(hello)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async woid(options = {}) { + return await invoke({ + method: 'woid', + ...options, + ...this.options, + parseResultXdr: () => { }, + }); + } + async val(options = {}) { + return await invoke({ + method: 'val', + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async u32FailOnEven({ u32_ }, options = {}) { + try { + return await invoke({ + method: 'u32_fail_on_even', + args: [((i) => xdr.ScVal.scvU32(i))(u32_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return new Ok(scValStrToJs(xdr)); + }, + }); + } + catch (e) { + if (typeof e === 'string') { + let err = parseError(e); + if (err) return err; - } - else { - throw e; - } } - }, - }); -} -export async function u32({ u32_ }, options = {}) { - return await invoke({ - method: 'u32_', - args: [((i) => xdr.ScVal.scvU32(i))(u32_)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function i32({ i32_ }, options = {}) { - return await invoke({ - method: 'i32_', - args: [((i) => xdr.ScVal.scvI32(i))(i32_)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function i64({ i64_ }, options = {}) { - return await invoke({ - method: 'i64_', - args: [((i) => xdr.ScVal.scvI64(xdr.Int64.fromString(i.toString())))(i64_)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -/** + throw e; + } + } + async u32({ u32_ }, options = {}) { + return await invoke({ + method: 'u32_', + args: [((i) => xdr.ScVal.scvU32(i))(u32_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async i32({ i32_ }, options = {}) { + return await invoke({ + method: 'i32_', + args: [((i) => xdr.ScVal.scvI32(i))(i32_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async i64({ i64_ }, options = {}) { + return await invoke({ + method: 'i64_', + args: [((i) => xdr.ScVal.scvI64(xdr.Int64.fromString(i.toString())))(i64_)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + /** * Example contract method which takes a struct */ -export async function struktHel({ strukt }, options = {}) { - return await invoke({ - method: 'strukt_hel', - args: [((i) => TestToXdr(i))(strukt)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function strukt({ strukt }, options = {}) { - return await invoke({ - method: 'strukt', - args: [((i) => TestToXdr(i))(strukt)], - ...options, - parseResultXdr: (xdr) => { - return TestFromXdr(xdr); - }, - }); -} -export async function simple({ simple }, options = {}) { - return await invoke({ - method: 'simple', - args: [((i) => SimpleEnumToXdr(i))(simple)], - ...options, - parseResultXdr: (xdr) => { - return SimpleEnumFromXdr(xdr); - }, - }); -} -export async function complex({ complex }, options = {}) { - return await invoke({ - method: 'complex', - args: [((i) => ComplexEnumToXdr(i))(complex)], - ...options, - parseResultXdr: (xdr) => { - return ComplexEnumFromXdr(xdr); - }, - }); -} -export async function addresse({ addresse }, options = {}) { - return await invoke({ - method: 'addresse', - args: [((i) => addressToScVal(i))(addresse)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function bytes({ bytes }, options = {}) { - return await invoke({ - method: 'bytes', - args: [((i) => xdr.ScVal.scvBytes(i))(bytes)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function bytesN({ bytes_n }, options = {}) { - return await invoke({ - method: 'bytes_n', - args: [((i) => xdr.ScVal.scvBytes(i))(bytes_n)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function card({ card }, options = {}) { - return await invoke({ - method: 'card', - args: [((i) => RoyalCardToXdr(i))(card)], - ...options, - parseResultXdr: (xdr) => { - return RoyalCardFromXdr(xdr); - }, - }); -} -export async function booleanMethod({ boolean }, options = {}) { - return await invoke({ - method: 'boolean', - args: [((i) => xdr.ScVal.scvBool(i))(boolean)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -/** + async struktHel({ strukt }, options = {}) { + return await invoke({ + method: 'strukt_hel', + args: [((i) => TestToXdr(i))(strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async strukt({ strukt }, options = {}) { + return await invoke({ + method: 'strukt', + args: [((i) => TestToXdr(i))(strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return TestFromXdr(xdr); + }, + }); + } + async simple({ simple }, options = {}) { + return await invoke({ + method: 'simple', + args: [((i) => SimpleEnumToXdr(i))(simple)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return SimpleEnumFromXdr(xdr); + }, + }); + } + async complex({ complex }, options = {}) { + return await invoke({ + method: 'complex', + args: [((i) => ComplexEnumToXdr(i))(complex)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return ComplexEnumFromXdr(xdr); + }, + }); + } + async addresse({ addresse }, options = {}) { + return await invoke({ + method: 'addresse', + args: [((i) => addressToScVal(i))(addresse)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async bytes({ bytes }, options = {}) { + return await invoke({ + method: 'bytes', + args: [((i) => xdr.ScVal.scvBytes(i))(bytes)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async bytesN({ bytes_n }, options = {}) { + return await invoke({ + method: 'bytes_n', + args: [((i) => xdr.ScVal.scvBytes(i))(bytes_n)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async card({ card }, options = {}) { + return await invoke({ + method: 'card', + args: [((i) => RoyalCardToXdr(i))(card)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return RoyalCardFromXdr(xdr); + }, + }); + } + async boolean({ boolean }, options = {}) { + return await invoke({ + method: 'boolean', + args: [((i) => xdr.ScVal.scvBool(i))(boolean)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + /** * Negates a boolean value */ -export async function not({ boolean }, options = {}) { - return await invoke({ - method: 'not', - args: [((i) => xdr.ScVal.scvBool(i))(boolean)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function i128({ i128 }, options = {}) { - return await invoke({ - method: 'i128', - args: [((i) => i128ToScVal(i))(i128)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function u128({ u128 }, options = {}) { - return await invoke({ - method: 'u128', - args: [((i) => u128ToScVal(i))(u128)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function multiArgs({ a, b }, options = {}) { - return await invoke({ - method: 'multi_args', - args: [((i) => xdr.ScVal.scvU32(i))(a), - ((i) => xdr.ScVal.scvBool(i))(b)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function map({ map }, options = {}) { - return await invoke({ - method: 'map', - args: [((i) => xdr.ScVal.scvMap(Array.from(i.entries()).map(([key, value]) => { - return new xdr.ScMapEntry({ - key: ((i) => xdr.ScVal.scvU32(i))(key), - val: ((i) => xdr.ScVal.scvBool(i))(value) - }); - })))(map)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function vec({ vec }, options = {}) { - return await invoke({ - method: 'vec', - args: [((i) => xdr.ScVal.scvVec(i.map((i) => xdr.ScVal.scvU32(i))))(vec)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function tuple({ tuple }, options = {}) { - return await invoke({ - method: 'tuple', - args: [((i) => xdr.ScVal.scvVec([((i) => xdr.ScVal.scvSymbol(i))(i[0]), - ((i) => xdr.ScVal.scvU32(i))(i[1])]))(tuple)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -/** + async not({ boolean }, options = {}) { + return await invoke({ + method: 'not', + args: [((i) => xdr.ScVal.scvBool(i))(boolean)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async i128({ i128 }, options = {}) { + return await invoke({ + method: 'i128', + args: [((i) => i128ToScVal(i))(i128)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async u128({ u128 }, options = {}) { + return await invoke({ + method: 'u128', + args: [((i) => u128ToScVal(i))(u128)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async multiArgs({ a, b }, options = {}) { + return await invoke({ + method: 'multi_args', + args: [((i) => xdr.ScVal.scvU32(i))(a), + ((i) => xdr.ScVal.scvBool(i))(b)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async map({ map }, options = {}) { + return await invoke({ + method: 'map', + args: [((i) => xdr.ScVal.scvMap(Array.from(i.entries()).map(([key, value]) => { + return new xdr.ScMapEntry({ + key: ((i) => xdr.ScVal.scvU32(i))(key), + val: ((i) => xdr.ScVal.scvBool(i))(value) + }); + })))(map)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async vec({ vec }, options = {}) { + return await invoke({ + method: 'vec', + args: [((i) => xdr.ScVal.scvVec(i.map((i) => xdr.ScVal.scvU32(i))))(vec)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async tuple({ tuple }, options = {}) { + return await invoke({ + method: 'tuple', + args: [((i) => xdr.ScVal.scvVec([((i) => xdr.ScVal.scvSymbol(i))(i[0]), + ((i) => xdr.ScVal.scvU32(i))(i[1])]))(tuple)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + /** * Example of an optional argument */ -export async function option({ option }, options = {}) { - return await invoke({ - method: 'option', - args: [((i) => (!i) ? xdr.ScVal.scvVoid() : xdr.ScVal.scvU32(i))(option)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function u256({ u256 }, options = {}) { - return await invoke({ - method: 'u256', - args: [((i) => i)(u256)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function i256({ i256 }, options = {}) { - return await invoke({ - method: 'i256', - args: [((i) => i)(i256)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function string({ string }, options = {}) { - return await invoke({ - method: 'string', - args: [((i) => xdr.ScVal.scvString(i))(string)], - ...options, - parseResultXdr: (xdr) => { - return scValStrToJs(xdr); - }, - }); -} -export async function tupleStrukt({ tuple_strukt }, options = {}) { - return await invoke({ - method: 'tuple_strukt', - args: [((i) => TupleStructToXdr(i))(tuple_strukt)], - ...options, - parseResultXdr: (xdr) => { - return TupleStructFromXdr(xdr); - }, - }); + async option({ option }, options = {}) { + return await invoke({ + method: 'option', + args: [((i) => (!i) ? xdr.ScVal.scvVoid() : xdr.ScVal.scvU32(i))(option)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async u256({ u256 }, options = {}) { + return await invoke({ + method: 'u256', + args: [((i) => i)(u256)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async i256({ i256 }, options = {}) { + return await invoke({ + method: 'i256', + args: [((i) => i)(i256)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async string({ string }, options = {}) { + return await invoke({ + method: 'string', + args: [((i) => xdr.ScVal.scvString(i))(string)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return scValStrToJs(xdr); + }, + }); + } + async tupleStrukt({ tuple_strukt }, options = {}) { + return await invoke({ + method: 'tuple_strukt', + args: [((i) => TupleStructToXdr(i))(tuple_strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr) => { + return TupleStructFromXdr(xdr); + }, + }); + } } 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 ddd4eb62f..033c64592 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,6 +1,6 @@ import * as SorobanClient from 'soroban-client'; import type { Memo, MemoType, Operation, Transaction } from 'soroban-client'; -import type { Options, ResponseTypes, Wallet } from './method-options.js'; +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from './method-options.js'; export type Tx = Transaction, Operation[]>; export declare class NotImplementedError extends Error { } @@ -9,7 +9,7 @@ type SendTx = SorobanClient.SorobanRpc.SendTransactionResponse; type GetTx = SorobanClient.SorobanRpc.GetTransactionResponse; declare let someRpcResponse: Simulation | SendTx | GetTx; type SomeRpcResponse = typeof someRpcResponse; -type InvokeArgs = Options & { +type InvokeArgs = MethodOptions & ClassOptions & { method: string; args?: any[]; parseResultXdr?: (xdr: string) => T; @@ -30,7 +30,7 @@ export declare function invoke( * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -export declare function signTx(wallet: Wallet, tx: Tx): Promise; +export declare function signTx(wallet: Wallet, tx: Tx, networkPassphrase: string): Promise; /** * Send a transaction to the Soroban network. * @@ -41,5 +41,5 @@ export declare function signTx(wallet: Wallet, tx: Tx): Promise; * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -export declare function sendTx(tx: Tx, secondsToWait: number): Promise; +export declare function sendTx(tx: Tx, secondsToWait: number, server: SorobanClient.Server): Promise; export {}; 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 4afba1d28..76fe86595 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,11 +1,9 @@ import * as SorobanClient from 'soroban-client'; -import { NETWORK_PASSPHRASE, CONTRACT_ID } from './constants.js'; -import { Server } from './server.js'; /** * Get account details from the Soroban network for the publicKey currently * selected in Freighter. If not connected to Freighter, return null. */ -async function getAccount(wallet) { +async function getAccount(wallet, server) { if (!await wallet.isConnected() || !await wallet.isAllowed()) { return null; } @@ -13,26 +11,29 @@ async function getAccount(wallet) { if (!publicKey) { return null; } - return await Server.getAccount(publicKey); + return await server.getAccount(publicKey); } 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, wallet, }) { +export async function invoke({ method, args = [], fee = 100, responseType, parseResultXdr, secondsToWait = 10, rpcUrl, networkPassphrase, contractId, wallet, }) { wallet = wallet ?? await import('@stellar/freighter-api'); - const walletAccount = await getAccount(wallet); + const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith('http://') }); + const walletAccount = await getAccount(wallet, server); // use a placeholder null account if not yet connected to Freighter so that view calls can still work const account = walletAccount ?? new SorobanClient.Account('GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF', '0'); - const contract = new SorobanClient.Contract(CONTRACT_ID); + const contract = new SorobanClient.Contract(contractId); let tx = new SorobanClient.TransactionBuilder(account, { fee: fee.toString(10), - networkPassphrase: NETWORK_PASSPHRASE, + networkPassphrase, }) .addOperation(contract.call(method, ...args)) .setTimeout(SorobanClient.TimeoutInfinite) .build(); - const simulated = await Server.simulateTransaction(tx); + const simulated = await server.simulateTransaction(tx); + 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. @@ -69,8 +70,8 @@ export async function invoke({ method, args = [], fee = 100, responseType, parse if (!walletAccount) { throw new Error('Not connected to Freighter'); } - tx = await signTx(wallet, SorobanClient.assembleTransaction(tx, NETWORK_PASSPHRASE, simulated)); - const raw = await sendTx(tx, secondsToWait); + tx = await signTx(wallet, SorobanClient.assembleTransaction(tx, networkPassphrase, simulated), networkPassphrase); + const raw = await sendTx(tx, secondsToWait, server); if (responseType === 'full') return raw; // if `sendTx` awaited the inclusion of the tx in the ledger, it used @@ -92,11 +93,11 @@ export async function invoke({ method, args = [], fee = 100, responseType, parse * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -export async function signTx(wallet, tx) { +export async function signTx(wallet, tx, networkPassphrase) { const signed = await wallet.signTransaction(tx.toXDR(), { - networkPassphrase: NETWORK_PASSPHRASE, + networkPassphrase, }); - return SorobanClient.TransactionBuilder.fromXDR(signed, NETWORK_PASSPHRASE); + return SorobanClient.TransactionBuilder.fromXDR(signed, networkPassphrase); } /** * Send a transaction to the Soroban network. @@ -108,12 +109,12 @@ export async function signTx(wallet, tx) { * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -export async function sendTx(tx, secondsToWait) { - const sendTransactionResponse = await Server.sendTransaction(tx); +export async function sendTx(tx, secondsToWait, server) { + const sendTransactionResponse = await server.sendTransaction(tx); if (sendTransactionResponse.status !== "PENDING" || secondsToWait === 0) { return sendTransactionResponse; } - let getTransactionResponse = await Server.getTransaction(sendTransactionResponse.hash); + let getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); const waitUntil = new Date((Date.now() + secondsToWait * 1000)).valueOf(); let waitTime = 1000; let exponentialFactor = 1.5; @@ -123,7 +124,7 @@ export async function sendTx(tx, secondsToWait) { /// Exponential backoff waitTime = waitTime * exponentialFactor; // See if the transaction is complete - getTransactionResponse = await Server.getTransaction(sendTransactionResponse.hash); + getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); } if (getTransactionResponse.status === "NOT_FOUND") { console.log(`Waited ${secondsToWait} seconds for transaction to complete, but it did not. Returning anyway. Check the transaction status manually. Info: ${JSON.stringify(sendTransactionResponse, null, 2)}`); 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 88014d05d..f861ff1f2 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,26 @@ export interface Wallet { accountToSign?: string; }) => Promise; } -export type Options = { +export type ClassOptions = { + contractId: string; + networkPassphrase: string; + rpcUrl: string; + /** + * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: + * + * @example + * ```ts + * import freighter from "@stellar/freighter-api"; + * import { Contract } from "test_custom_types"; + * const contract = new Contract({ + * …, + * wallet: freighter, + * }) + * ``` + */ + wallet?: Wallet; +}; +export type MethodOptions = { /** * The fee to pay for the transaction. Default: 100. */ @@ -30,15 +49,5 @@ export type Options = { * 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; }; export {}; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.d.ts deleted file mode 100644 index bbfda5d68..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as SorobanClient from 'soroban-client'; -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -export declare const Server: SorobanClient.Server; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.js b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.js deleted file mode 100644 index 38700f094..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/esm/server.js +++ /dev/null @@ -1,7 +0,0 @@ -import * as SorobanClient from 'soroban-client'; -import { RPC_URL } from './constants.js'; -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -export const Server = new SorobanClient.Server(RPC_URL, { allowHttp: RPC_URL.startsWith('http://') }); diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/constants.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/constants.d.ts deleted file mode 100644 index a36801fa0..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/constants.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * The Soroban contract ID for the test_custom_types contract. - */ -export declare const CONTRACT_ID = "CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE"; -/** - * The Soroban contract ID for the test_custom_types contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -export declare const CONTRACT_ID_HEX: string; -/** - * The Soroban network passphrase used to initialize this library. - */ -export declare const NETWORK_PASSPHRASE = "Test SDF Future Network ; October 2022"; -/** - * The Soroban RPC endpoint used to initialize this library. - */ -export declare const RPC_URL = "https://rpc-futurenet.stellar.org/soroban/rpc"; 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 a57f20c79..5fcbe41a4 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,9 +1,8 @@ import * as SorobanClient from 'soroban-client'; import { Buffer } from "buffer"; -import type { ResponseTypes, Wallet } from './method-options.js'; -export * from './constants.js'; -export * from './server.js'; +import type { ResponseTypes, 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; @@ -41,6 +40,12 @@ export declare class Err implements Result { isOk(): boolean; isErr(): boolean; } +export declare const networks: { + readonly futurenet: { + readonly networkPassphrase: "Test SDF Future Network ; October 2022"; + readonly contractId: "CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4"; + }; +}; /** * This is from the rust doc above the struct Test */ @@ -64,866 +69,590 @@ export declare enum RoyalCard { Queen = 12, King = 13 } -export type TupleStruct = [Test, SimpleEnum]; +export type TupleStruct = readonly [Test, SimpleEnum]; export type ComplexEnum = { tag: "Struct"; - values: [Test]; + values: readonly [Test]; } | { tag: "Tuple"; - values: [TupleStruct]; + values: readonly [TupleStruct]; } | { tag: "Enum"; - values: [SimpleEnum]; + values: readonly [SimpleEnum]; } | { tag: "Asset"; - values: [Address, i128]; + values: readonly [Address, i128]; } | { tag: "Void"; values: void; }; -export declare function hello({ hello }: { - hello: string; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function woid(options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function val(options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u32FailOnEven({ u32_ }: { - u32_: u32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - responseType?: R; +export declare class Contract { + readonly options: ClassOptions; + constructor(options: ClassOptions); + hello({ hello }: { + hello: string; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + woid(options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + val(options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u32FailOnEven({ u32_ }: { + u32_: u32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 | (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_ }: { + u32_: u32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i32({ i32_ }: { + i32_: i32; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i64({ i64_ }: { + i64_: i64; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise | Ok : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Err | Ok>; -export declare function u32({ u32_ }: { - u32_: u32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i32({ i32_ }: { - i32_: i32; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i64({ i64_ }: { - i64_: i64; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Example contract method which takes a struct */ -export declare function struktHel({ strukt }: { - strukt: Test; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function strukt({ strukt }: { - strukt: Test; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function simple({ simple }: { - simple: SimpleEnum; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function complex({ complex }: { - complex: ComplexEnum; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function addresse({ addresse }: { - addresse: Address; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function bytes({ bytes }: { - bytes: Buffer; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function bytesN({ bytes_n }: { - bytes_n: Buffer; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function card({ card }: { - card: RoyalCard; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; + struktHel({ strukt }: { + strukt: Test; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + strukt({ strukt }: { + strukt: Test; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + simple({ simple }: { + simple: SimpleEnum; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + complex({ complex }: { + complex: ComplexEnum; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + addresse({ addresse }: { + addresse: Address; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + bytes({ bytes }: { + bytes: Buffer; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + bytesN({ bytes_n }: { + bytes_n: Buffer; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + card({ card }: { + card: RoyalCard; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + boolean({ boolean }: { + boolean: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function booleanMethod({ boolean }: { - boolean: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Negates a boolean value */ -export declare function not({ boolean }: { - boolean: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i128({ i128 }: { - i128: i128; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u128({ u128 }: { - u128: u128; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function multiArgs({ a, b }: { - a: u32; - b: boolean; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function map({ map }: { - map: Map; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; -export declare function vec({ vec }: { - vec: Array; -}, options?: { + not({ boolean }: { + boolean: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i128({ i128 }: { + i128: i128; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u128({ u128 }: { + u128: u128; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + multiArgs({ a, b }: { + a: u32; + b: boolean; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + map({ map }: { + map: Map; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 : R extends "simulated" ? SorobanClient.SorobanRpc.SimulateTransactionResponse : R extends "full" ? SorobanClient.SorobanRpc.SimulateTransactionResponse | SorobanClient.SorobanRpc.SendTransactionResponse | SorobanClient.SorobanRpc.GetTransactionResponse : Map>; + vec({ vec }: { + vec: Array; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + tuple({ tuple }: { + tuple: readonly [string, u32]; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `readonly [string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function tuple({ tuple }: { - tuple: [string, u32]; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `[string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -/** * Example of an optional argument */ -export declare function option({ option }: { - option: Option; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function u256({ u256 }: { - u256: u256; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function i256({ i256 }: { - i256: i256; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function string({ string }: { - string: string; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; -export declare function tupleStrukt({ tuple_strukt }: { - tuple_strukt: TupleStruct; -}, options?: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number; - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; -}): Promise; + option({ option }: { + option: Option; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + u256({ u256 }: { + u256: u256; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + i256({ i256 }: { + i256: i256; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + string({ string }: { + string: string; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; + tupleStrukt({ tuple_strukt }: { + tuple_strukt: TupleStruct; + }, options?: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number; + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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; +} 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 ddd4eb62f..033c64592 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,6 +1,6 @@ import * as SorobanClient from 'soroban-client'; import type { Memo, MemoType, Operation, Transaction } from 'soroban-client'; -import type { Options, ResponseTypes, Wallet } from './method-options.js'; +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from './method-options.js'; export type Tx = Transaction, Operation[]>; export declare class NotImplementedError extends Error { } @@ -9,7 +9,7 @@ type SendTx = SorobanClient.SorobanRpc.SendTransactionResponse; type GetTx = SorobanClient.SorobanRpc.GetTransactionResponse; declare let someRpcResponse: Simulation | SendTx | GetTx; type SomeRpcResponse = typeof someRpcResponse; -type InvokeArgs = Options & { +type InvokeArgs = MethodOptions & ClassOptions & { method: string; args?: any[]; parseResultXdr?: (xdr: string) => T; @@ -30,7 +30,7 @@ export declare function invoke( * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -export declare function signTx(wallet: Wallet, tx: Tx): Promise; +export declare function signTx(wallet: Wallet, tx: Tx, networkPassphrase: string): Promise; /** * Send a transaction to the Soroban network. * @@ -41,5 +41,5 @@ export declare function signTx(wallet: Wallet, tx: Tx): Promise; * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -export declare function sendTx(tx: Tx, secondsToWait: number): Promise; +export declare function sendTx(tx: Tx, secondsToWait: number, server: SorobanClient.Server): Promise; export {}; 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 88014d05d..f861ff1f2 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,26 @@ export interface Wallet { accountToSign?: string; }) => Promise; } -export type Options = { +export type ClassOptions = { + contractId: string; + networkPassphrase: string; + rpcUrl: string; + /** + * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: + * + * @example + * ```ts + * import freighter from "@stellar/freighter-api"; + * import { Contract } from "test_custom_types"; + * const contract = new Contract({ + * …, + * wallet: freighter, + * }) + * ``` + */ + wallet?: Wallet; +}; +export type MethodOptions = { /** * The fee to pay for the transaction. Default: 100. */ @@ -30,15 +49,5 @@ export type Options = { * 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; - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet; }; export {}; diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/server.d.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/server.d.ts deleted file mode 100644 index bbfda5d68..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/dist/types/server.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import * as SorobanClient from 'soroban-client'; -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -export declare const Server: SorobanClient.Server; 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 ee6f020e9..f5f63980c 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 @@ -39,11 +39,13 @@ }, "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.4.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -60,6 +62,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", @@ -73,8 +77,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/bignumber.js": { "version": "9.1.1", @@ -155,6 +158,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", @@ -169,7 +174,6 @@ "url": "https://feross.org/support" } ], - "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" @@ -191,7 +195,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" }, @@ -277,7 +282,8 @@ }, "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" } @@ -293,7 +299,8 @@ }, "node_modules/detect-node": { "version": "2.1.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" }, "node_modules/diffie-hellman": { "version": "5.0.3", @@ -331,11 +338,13 @@ }, "node_modules/es6-promise": { "version": "4.2.8", - "license": "MIT" + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, "node_modules/eventsource": { "version": "2.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", "engines": { "node": ">=12.0.0" } @@ -351,13 +360,14 @@ }, "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" }, @@ -369,7 +379,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", @@ -413,6 +424,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", @@ -426,8 +439,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "BSD-3-Clause" + ] }, "node_modules/inherits": { "version": "2.0.4", @@ -473,14 +485,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" }, @@ -538,7 +552,8 @@ }, "node_modules/proxy-from-env": { "version": "1.1.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, "node_modules/public-encrypt": { "version": "4.0.3", @@ -689,7 +704,8 @@ }, "node_modules/toml": { "version": "3.0.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" }, "node_modules/tweetnacl": { "version": "1.0.3", @@ -698,8 +714,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" @@ -710,7 +727,8 @@ }, "node_modules/urijs": { "version": "1.19.11", - "license": "MIT" + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" }, "node_modules/util-deprecate": { "version": "1.0.2", diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/constants.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/constants.ts deleted file mode 100644 index 433dd534b..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/constants.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Contract } from 'soroban-client' - -/** - * The Soroban contract ID for the test_custom_types contract. - */ -export const CONTRACT_ID = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE' - -/** - * The Soroban contract ID for the test_custom_types contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -export const CONTRACT_ID_HEX = new Contract(CONTRACT_ID).contractId('hex') - - -/** - * The Soroban network passphrase used to initialize this library. - */ -export const NETWORK_PASSPHRASE = 'Test SDF Future Network ; October 2022' - -/** - * The Soroban RPC endpoint used to initialize this library. - */ -export const RPC_URL = 'https://rpc-futurenet.stellar.org/soroban/rpc' - 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 3c7cb1622..634738e58 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 @@ -3,11 +3,10 @@ import { xdr } from 'soroban-client'; import { Buffer } from "buffer"; import { scValStrToJs, scValToJs, addressToScVal, u128ToScVal, i128ToScVal, strToScVal } from './convert.js'; import { invoke } from './invoke.js'; -import type { ResponseTypes, Wallet } from './method-options.js' +import type { ResponseTypes, Wallet, ClassOptions } from './method-options.js' -export * from './constants.js' -export * from './server.js' export * from './invoke.js' +export * from './method-options.js' export type u32 = number; export type i32 = number; @@ -73,24 +72,31 @@ if (typeof window !== 'undefined') { window.Buffer = window.Buffer || Buffer; } -const regex = /ContractError\((\d+)\)/; +const regex = /Error\(Contract, #(\d+)\)/; -function getError(err: string): Err | undefined { - const match = err.match(regex); +function parseError(message: string): Err | undefined { + const match = message.match(regex); if (!match) { return undefined; } - if (Errors == undefined) { + if (Errors === undefined) { return undefined; } - // @ts-ignore let i = parseInt(match[1], 10); - if (i < Errors.length) { - return new Err(Errors[i]!); + let err = Errors[i]; + if (err) { + return new Err(err); } return undefined; } +export const networks = { + futurenet: { + networkPassphrase: "Test SDF Future Network ; October 2022", + contractId: "CB5T6MLZNWJBUBKEQAUVIG5JJWKYSYVVE2OVN25GMX3VX7CZ7OBAPAU4", + } +} as const + /** * This is from the rust doc above the struct Test */ @@ -143,7 +149,7 @@ function SimpleEnumToXdr(simpleEnum?: SimpleEnum): xdr.ScVal { break; case "Third": res.push(((i) => xdr.ScVal.scvSymbol(i))("Third")); - break; + break; } return xdr.ScVal.scvVec(res); } @@ -173,7 +179,7 @@ function RoyalCardToXdr(val: RoyalCard): xdr.ScVal { return xdr.ScVal.scvI32(val); } -export type TupleStruct = [Test, SimpleEnum]; +export type TupleStruct = readonly [Test, SimpleEnum]; function TupleStructToXdr(tupleStruct?: TupleStruct): xdr.ScVal { if (!tupleStruct) { @@ -191,7 +197,7 @@ function TupleStructFromXdr(base64Xdr: string): TupleStruct { return scValStrToJs(base64Xdr) as TupleStruct; } -export type ComplexEnum = {tag: "Struct", values: [Test]} | {tag: "Tuple", values: [TupleStruct]} | {tag: "Enum", values: [SimpleEnum]} | {tag: "Asset", values: [Address, i128]} | {tag: "Void", values: void}; +export type ComplexEnum = {tag: "Struct", values: readonly [Test]} | {tag: "Tuple", values: readonly [TupleStruct]} | {tag: "Enum", values: readonly [SimpleEnum]} | {tag: "Asset", values: readonly [Address, i128]} | {tag: "Void", values: void}; function ComplexEnumToXdr(complexEnum?: ComplexEnum): xdr.ScVal { if (!complexEnum) { @@ -218,7 +224,7 @@ function ComplexEnumToXdr(complexEnum?: ComplexEnum): xdr.ScVal { break; case "Void": res.push(((i) => xdr.ScVal.scvSymbol(i))("Void")); - break; + break; } return xdr.ScVal.scvVec(res); } @@ -233,1090 +239,868 @@ function ComplexEnumFromXdr(base64Xdr: string): ComplexEnum { return { tag, values } as ComplexEnum; } -const Errors = [ -{message:"Unknown error has occurred"} -] -export async function hello({hello}: {hello: string}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'hello', - args: [((i) => xdr.ScVal.scvSymbol(i))(hello)], - ...options, - parseResultXdr: (xdr): string => { - return scValStrToJs(xdr); - }, - }); +const Errors = { +1: {message:"Please provide an odd number"} } -export async function woid(options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'woid', - ...options, - parseResultXdr: () => {}, - }); -} +export class Contract { + constructor(public readonly options: ClassOptions) {} + async hello({hello}: {hello: string}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'hello', + args: [((i) => xdr.ScVal.scvSymbol(i))(hello)], + ...options, + ...this.options, + parseResultXdr: (xdr): string => { + return scValStrToJs(xdr); + }, + }); + } -export async function val(options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'val', - ...options, - parseResultXdr: (xdr): any => { - return scValStrToJs(xdr); - }, - }); -} -export async function u32FailOnEven({u32_}: {u32_: u32}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'u32_fail_on_even', - args: [((i) => xdr.ScVal.scvU32(i))(u32_)], - ...options, - parseResultXdr: (xdr): Ok | Err | undefined => { - try { + async woid(options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `void`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'woid', + ...options, + ...this.options, + parseResultXdr: () => {}, + }); + } + + + async val(options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `any`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'val', + ...options, + ...this.options, + parseResultXdr: (xdr): any => { + return scValStrToJs(xdr); + }, + }); + } + + + async u32FailOnEven({u32_}: {u32_: u32}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Ok | Err | undefined`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + try { + return await invoke({ + method: 'u32_fail_on_even', + args: [((i) => xdr.ScVal.scvU32(i))(u32_)], + ...options, + ...this.options, + parseResultXdr: (xdr): Ok | Err | undefined => { return new Ok(scValStrToJs(xdr)); - } catch (e) { - //@ts-ignore - let err = getError(e.message); - if (err) { - return err; - } else { - throw e; - } + }, + }); + } catch (e) { + if (typeof e === 'string') { + let err = parseError(e); + if (err) return err; } - }, - }); -} + throw e; + } + } -export async function u32({u32_}: {u32_: u32}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'u32_', - args: [((i) => xdr.ScVal.scvU32(i))(u32_)], - ...options, - parseResultXdr: (xdr): u32 => { - return scValStrToJs(xdr); - }, - }); -} -export async function i32({i32_}: {i32_: i32}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'i32_', - args: [((i) => xdr.ScVal.scvI32(i))(i32_)], - ...options, - parseResultXdr: (xdr): i32 => { - return scValStrToJs(xdr); - }, - }); -} + async u32({u32_}: {u32_: u32}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'u32_', + args: [((i) => xdr.ScVal.scvU32(i))(u32_)], + ...options, + ...this.options, + parseResultXdr: (xdr): u32 => { + return scValStrToJs(xdr); + }, + }); + } -export async function i64({i64_}: {i64_: i64}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'i64_', - args: [((i) => xdr.ScVal.scvI64(xdr.Int64.fromString(i.toString())))(i64_)], - ...options, - parseResultXdr: (xdr): i64 => { - return scValStrToJs(xdr); - }, - }); -} -/** + async i32({i32_}: {i32_: i32}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'i32_', + args: [((i) => xdr.ScVal.scvI32(i))(i32_)], + ...options, + ...this.options, + parseResultXdr: (xdr): i32 => { + return scValStrToJs(xdr); + }, + }); + } + + + async i64({i64_}: {i64_: i64}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i64`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'i64_', + args: [((i) => xdr.ScVal.scvI64(xdr.Int64.fromString(i.toString())))(i64_)], + ...options, + ...this.options, + parseResultXdr: (xdr): i64 => { + return scValStrToJs(xdr); + }, + }); + } + + + /** * Example contract method which takes a struct */ -export async function struktHel({strukt}: {strukt: Test}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'strukt_hel', - args: [((i) => TestToXdr(i))(strukt)], - ...options, - parseResultXdr: (xdr): Array => { - return scValStrToJs(xdr); - }, - }); -} +async struktHel({strukt}: {strukt: Test}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'strukt_hel', + args: [((i) => TestToXdr(i))(strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr): Array => { + return scValStrToJs(xdr); + }, + }); + } -export async function strukt({strukt}: {strukt: Test}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'strukt', - args: [((i) => TestToXdr(i))(strukt)], - ...options, - parseResultXdr: (xdr): Test => { - return TestFromXdr(xdr); - }, - }); -} -export async function simple({simple}: {simple: SimpleEnum}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'simple', - args: [((i) => SimpleEnumToXdr(i))(simple)], - ...options, - parseResultXdr: (xdr): SimpleEnum => { - return SimpleEnumFromXdr(xdr); - }, - }); -} + async strukt({strukt}: {strukt: Test}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Test`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'strukt', + args: [((i) => TestToXdr(i))(strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr): Test => { + return TestFromXdr(xdr); + }, + }); + } -export async function complex({complex}: {complex: ComplexEnum}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'complex', - args: [((i) => ComplexEnumToXdr(i))(complex)], - ...options, - parseResultXdr: (xdr): ComplexEnum => { - return ComplexEnumFromXdr(xdr); - }, - }); -} -export async function addresse({addresse}: {addresse: Address}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'addresse', - args: [((i) => addressToScVal(i))(addresse)], - ...options, - parseResultXdr: (xdr): Address => { - return scValStrToJs(xdr); - }, - }); -} + async simple({simple}: {simple: SimpleEnum}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `SimpleEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'simple', + args: [((i) => SimpleEnumToXdr(i))(simple)], + ...options, + ...this.options, + parseResultXdr: (xdr): SimpleEnum => { + return SimpleEnumFromXdr(xdr); + }, + }); + } -export async function bytes({bytes}: {bytes: Buffer}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'bytes', - args: [((i) => xdr.ScVal.scvBytes(i))(bytes)], - ...options, - parseResultXdr: (xdr): Buffer => { - return scValStrToJs(xdr); - }, - }); -} -export async function bytesN({bytes_n}: {bytes_n: Buffer}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'bytes_n', - args: [((i) => xdr.ScVal.scvBytes(i))(bytes_n)], - ...options, - parseResultXdr: (xdr): Buffer => { - return scValStrToJs(xdr); - }, - }); -} + async complex({complex}: {complex: ComplexEnum}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `ComplexEnum`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'complex', + args: [((i) => ComplexEnumToXdr(i))(complex)], + ...options, + ...this.options, + parseResultXdr: (xdr): ComplexEnum => { + return ComplexEnumFromXdr(xdr); + }, + }); + } -export async function card({card}: {card: RoyalCard}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'card', - args: [((i) => RoyalCardToXdr(i))(card)], - ...options, - parseResultXdr: (xdr): RoyalCard => { - return RoyalCardFromXdr(xdr); - }, - }); -} -export async function booleanMethod({boolean}: {boolean: boolean}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'boolean', - args: [((i) => xdr.ScVal.scvBool(i))(boolean)], - ...options, - parseResultXdr: (xdr): boolean => { - return scValStrToJs(xdr); - }, - }); -} + async addresse({addresse}: {addresse: Address}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Address`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'addresse', + args: [((i) => addressToScVal(i))(addresse)], + ...options, + ...this.options, + parseResultXdr: (xdr): Address => { + return scValStrToJs(xdr); + }, + }); + } -/** + + async bytes({bytes}: {bytes: Buffer}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'bytes', + args: [((i) => xdr.ScVal.scvBytes(i))(bytes)], + ...options, + ...this.options, + parseResultXdr: (xdr): Buffer => { + return scValStrToJs(xdr); + }, + }); + } + + + async bytesN({bytes_n}: {bytes_n: Buffer}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Buffer`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'bytes_n', + args: [((i) => xdr.ScVal.scvBytes(i))(bytes_n)], + ...options, + ...this.options, + parseResultXdr: (xdr): Buffer => { + return scValStrToJs(xdr); + }, + }); + } + + + async card({card}: {card: RoyalCard}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `RoyalCard`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'card', + args: [((i) => RoyalCardToXdr(i))(card)], + ...options, + ...this.options, + parseResultXdr: (xdr): RoyalCard => { + return RoyalCardFromXdr(xdr); + }, + }); + } + + + async boolean({boolean}: {boolean: boolean}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'boolean', + args: [((i) => xdr.ScVal.scvBool(i))(boolean)], + ...options, + ...this.options, + parseResultXdr: (xdr): boolean => { + return scValStrToJs(xdr); + }, + }); + } + + + /** * Negates a boolean value */ -export async function not({boolean}: {boolean: boolean}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'not', - args: [((i) => xdr.ScVal.scvBool(i))(boolean)], - ...options, - parseResultXdr: (xdr): boolean => { - return scValStrToJs(xdr); - }, - }); -} +async not({boolean}: {boolean: boolean}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `boolean`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'not', + args: [((i) => xdr.ScVal.scvBool(i))(boolean)], + ...options, + ...this.options, + parseResultXdr: (xdr): boolean => { + return scValStrToJs(xdr); + }, + }); + } -export async function i128({i128}: {i128: i128}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'i128', - args: [((i) => i128ToScVal(i))(i128)], - ...options, - parseResultXdr: (xdr): i128 => { - return scValStrToJs(xdr); - }, - }); -} -export async function u128({u128}: {u128: u128}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'u128', - args: [((i) => u128ToScVal(i))(u128)], - ...options, - parseResultXdr: (xdr): u128 => { - return scValStrToJs(xdr); - }, - }); -} + async i128({i128}: {i128: i128}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'i128', + args: [((i) => i128ToScVal(i))(i128)], + ...options, + ...this.options, + parseResultXdr: (xdr): i128 => { + return scValStrToJs(xdr); + }, + }); + } + + + async u128({u128}: {u128: u128}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u128`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'u128', + args: [((i) => u128ToScVal(i))(u128)], + ...options, + ...this.options, + parseResultXdr: (xdr): u128 => { + return scValStrToJs(xdr); + }, + }); + } + -export async function multiArgs({a, b}: {a: u32, b: boolean}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'multi_args', - args: [((i) => xdr.ScVal.scvU32(i))(a), + async multiArgs({a, b}: {a: u32, b: boolean}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u32`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'multi_args', + args: [((i) => xdr.ScVal.scvU32(i))(a), ((i) => xdr.ScVal.scvBool(i))(b)], - ...options, - parseResultXdr: (xdr): u32 => { - return scValStrToJs(xdr); - }, - }); -} + ...options, + ...this.options, + parseResultXdr: (xdr): u32 => { + return scValStrToJs(xdr); + }, + }); + } + -export async function map({map}: {map: Map}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'map', - args: [((i) => xdr.ScVal.scvMap(Array.from(i.entries()).map(([key, value]) => { + async map({map}: {map: Map}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Map`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'map', + args: [((i) => xdr.ScVal.scvMap(Array.from(i.entries()).map(([key, value]) => { return new xdr.ScMapEntry({ key: ((i)=>xdr.ScVal.scvU32(i))(key), val: ((i)=>xdr.ScVal.scvBool(i))(value)}) })))(map)], - ...options, - parseResultXdr: (xdr): Map => { - return scValStrToJs(xdr); - }, - }); -} + ...options, + ...this.options, + parseResultXdr: (xdr): Map => { + return scValStrToJs(xdr); + }, + }); + } -export async function vec({vec}: {vec: Array}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'vec', - args: [((i) => xdr.ScVal.scvVec(i.map((i)=>xdr.ScVal.scvU32(i))))(vec)], - ...options, - parseResultXdr: (xdr): Array => { - return scValStrToJs(xdr); - }, - }); -} -export async function tuple({tuple}: {tuple: [string, u32]}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `[string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'tuple', - args: [((i) => xdr.ScVal.scvVec([((i) => xdr.ScVal.scvSymbol(i))(i[0]), + async vec({vec}: {vec: Array}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Array`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'vec', + args: [((i) => xdr.ScVal.scvVec(i.map((i)=>xdr.ScVal.scvU32(i))))(vec)], + ...options, + ...this.options, + parseResultXdr: (xdr): Array => { + return scValStrToJs(xdr); + }, + }); + } + + + async tuple({tuple}: {tuple: readonly [string, u32]}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `readonly [string, u32]`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'tuple', + args: [((i) => xdr.ScVal.scvVec([((i) => xdr.ScVal.scvSymbol(i))(i[0]), ((i) => xdr.ScVal.scvU32(i))(i[1])]))(tuple)], - ...options, - parseResultXdr: (xdr): [string, u32] => { - return scValStrToJs(xdr); - }, - }); -} + ...options, + ...this.options, + parseResultXdr: (xdr): readonly [string, u32] => { + return scValStrToJs(xdr); + }, + }); + } -/** + + /** * Example of an optional argument */ -export async function option({option}: {option: Option}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'option', - args: [((i) => (!i) ? xdr.ScVal.scvVoid() : xdr.ScVal.scvU32(i))(option)], - ...options, - parseResultXdr: (xdr): Option => { - return scValStrToJs(xdr); - }, - }); -} +async option({option}: {option: Option}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `Option`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'option', + args: [((i) => (!i) ? xdr.ScVal.scvVoid() : xdr.ScVal.scvU32(i))(option)], + ...options, + ...this.options, + parseResultXdr: (xdr): Option => { + return scValStrToJs(xdr); + }, + }); + } -export async function u256({u256}: {u256: u256}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'u256', - args: [((i) => i)(u256)], - ...options, - parseResultXdr: (xdr): u256 => { - return scValStrToJs(xdr); - }, - }); -} -export async function i256({i256}: {i256: i256}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'i256', - args: [((i) => i)(i256)], - ...options, - parseResultXdr: (xdr): i256 => { - return scValStrToJs(xdr); - }, - }); -} + async u256({u256}: {u256: u256}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `u256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'u256', + args: [((i) => i)(u256)], + ...options, + ...this.options, + parseResultXdr: (xdr): u256 => { + return scValStrToJs(xdr); + }, + }); + } -export async function string({string}: {string: string}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'string', - args: [((i) => xdr.ScVal.scvString(i))(string)], - ...options, - parseResultXdr: (xdr): string => { - return scValStrToJs(xdr); - }, - }); -} -export async function tupleStrukt({tuple_strukt}: {tuple_strukt: TupleStruct}, options: { - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -} = {}) { - return await invoke({ - method: 'tuple_strukt', - args: [((i) => TupleStructToXdr(i))(tuple_strukt)], - ...options, - parseResultXdr: (xdr): TupleStruct => { - return TupleStructFromXdr(xdr); - }, - }); -} + async i256({i256}: {i256: i256}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `i256`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'i256', + args: [((i) => i)(i256)], + ...options, + ...this.options, + parseResultXdr: (xdr): i256 => { + return scValStrToJs(xdr); + }, + }); + } + + + async string({string}: {string: string}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `string`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'string', + args: [((i) => xdr.ScVal.scvString(i))(string)], + ...options, + ...this.options, + parseResultXdr: (xdr): string => { + return scValStrToJs(xdr); + }, + }); + } + + + async tupleStrukt({tuple_strukt}: {tuple_strukt: TupleStruct}, options: { + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `TupleStruct`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + } = {}) { + return await invoke({ + method: 'tuple_strukt', + args: [((i) => TupleStructToXdr(i))(tuple_strukt)], + ...options, + ...this.options, + parseResultXdr: (xdr): TupleStruct => { + return TupleStructFromXdr(xdr); + }, + }); + } + +} \ No newline at end of file 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 31fdcb025..d671af54f 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,8 +1,6 @@ import * as SorobanClient from 'soroban-client' import type { Account, Memo, MemoType, Operation, Transaction } from 'soroban-client'; -import { NETWORK_PASSPHRASE, CONTRACT_ID } from './constants.js' -import { Server } from './server.js' -import type { Options, ResponseTypes, Wallet } from './method-options.js' +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from './method-options.js' export type Tx = Transaction, Operation[]> @@ -10,7 +8,7 @@ export type Tx = Transaction, Operation[]> * Get account details from the Soroban network for the publicKey currently * selected in Freighter. If not connected to Freighter, return null. */ -async function getAccount(wallet: Wallet): Promise { +async function getAccount(wallet: Wallet, server: SorobanClient.Server): Promise { if (!await wallet.isConnected() || !await wallet.isAllowed()) { return null } @@ -18,7 +16,7 @@ async function getAccount(wallet: Wallet): Promise { if (!publicKey) { return null } - return await Server.getAccount(publicKey) + return await server.getAccount(publicKey) } export class NotImplementedError extends Error { } @@ -31,7 +29,7 @@ type GetTx = SorobanClient.SorobanRpc.GetTransactionResponse let someRpcResponse: Simulation | SendTx | GetTx type SomeRpcResponse = typeof someRpcResponse -type InvokeArgs = Options & { +type InvokeArgs = MethodOptions & ClassOptions & { method: string, args?: any[], parseResultXdr?: (xdr: string) => T, @@ -52,26 +50,31 @@ export async function invoke({ responseType, parseResultXdr, secondsToWait = 10, + rpcUrl, + networkPassphrase, + contractId, wallet, }: InvokeArgs): Promise { wallet = wallet ?? await import('@stellar/freighter-api') - const walletAccount = await getAccount(wallet) + const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith('http://') }); + const walletAccount = await getAccount(wallet, server) // use a placeholder null account if not yet connected to Freighter so that view calls can still work const account = walletAccount ?? new SorobanClient.Account('GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF', '0') - const contract = new SorobanClient.Contract(CONTRACT_ID) + const contract = new SorobanClient.Contract(contractId) let tx = new SorobanClient.TransactionBuilder(account, { fee: fee.toString(10), - networkPassphrase: NETWORK_PASSPHRASE, + networkPassphrase, }) .addOperation(contract.call(method, ...args)) .setTimeout(SorobanClient.TimeoutInfinite) .build() - const simulated = await Server.simulateTransaction(tx) + const simulated = await server.simulateTransaction(tx) + 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. @@ -117,10 +120,11 @@ export async function invoke({ tx = await signTx( wallet, - SorobanClient.assembleTransaction(tx, NETWORK_PASSPHRASE, simulated) as Tx + SorobanClient.assembleTransaction(tx, networkPassphrase, simulated) as Tx, + networkPassphrase, ); - const raw = await sendTx(tx, secondsToWait); + const raw = await sendTx(tx, secondsToWait, server); if (responseType === 'full') return raw @@ -144,14 +148,14 @@ export async function invoke({ * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -export async function signTx(wallet: Wallet, tx: Tx): Promise { +export async function signTx(wallet: Wallet, tx: Tx, networkPassphrase: string): Promise { const signed = await wallet.signTransaction(tx.toXDR(), { - networkPassphrase: NETWORK_PASSPHRASE, + networkPassphrase, }) return SorobanClient.TransactionBuilder.fromXDR( signed, - NETWORK_PASSPHRASE + networkPassphrase, ) as Tx } @@ -165,14 +169,14 @@ export async function signTx(wallet: Wallet, tx: Tx): Promise { * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -export async function sendTx(tx: Tx, secondsToWait: number): Promise { - const sendTransactionResponse = await Server.sendTransaction(tx); +export async function sendTx(tx: Tx, secondsToWait: number, server: SorobanClient.Server): Promise { + const sendTransactionResponse = await server.sendTransaction(tx); if (sendTransactionResponse.status !== "PENDING" || secondsToWait === 0) { return sendTransactionResponse; } - let getTransactionResponse = await Server.getTransaction(sendTransactionResponse.hash); + let getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); const waitUntil = new Date((Date.now() + secondsToWait * 1000)).valueOf() @@ -185,7 +189,7 @@ export async function sendTx(tx: Tx, secondsToWait: number): Promise Promise, } -export type Options = { +export type ClassOptions = { + contractId: string + networkPassphrase: string + rpcUrl: string + /** + * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: + * + * @example + * ```ts + * import freighter from "@stellar/freighter-api"; + * import { Contract } from "test_custom_types"; + * const contract = new Contract({ + * …, + * wallet: freighter, + * }) + * ``` + */ + wallet?: Wallet +} + +export type MethodOptions = { /** * The fee to pay for the transaction. Default: 100. */ @@ -32,14 +52,4 @@ export type Options = { * 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet } diff --git a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/server.ts b/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/server.ts deleted file mode 100644 index 4e78d7cf7..000000000 --- a/cmd/crates/soroban-spec-typescript/fixtures/test_custom_types/src/server.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as SorobanClient from 'soroban-client' -import { RPC_URL } from './constants.js' - -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -export const Server = new SorobanClient.Server(RPC_URL, { allowHttp: RPC_URL.startsWith('http://') }); diff --git a/cmd/crates/soroban-spec-typescript/src/boilerplate.rs b/cmd/crates/soroban-spec-typescript/src/boilerplate.rs index f114b4445..fee02b05a 100644 --- a/cmd/crates/soroban-spec-typescript/src/boilerplate.rs +++ b/cmd/crates/soroban-spec-typescript/src/boilerplate.rs @@ -12,6 +12,9 @@ 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"; + pub struct Project(PathBuf); impl TryInto for PathBuf { @@ -49,7 +52,7 @@ impl Project { spec: &[ScSpecEntry], ) -> std::io::Result<()> { self.replace_placeholder_patterns(contract_name, contract_id, rpc_url, network_passphrase)?; - self.append_index_ts(spec) + self.append_index_ts(spec, contract_id, network_passphrase) } fn replace_placeholder_patterns( @@ -77,9 +80,9 @@ impl Project { [ "package.json", "README.md", - "src/constants.ts", "src/index.ts", "src/invoke.ts", + "src/method-options.ts", ] .into_iter() .try_for_each(|file_name| { @@ -92,11 +95,36 @@ impl Project { }) } - fn append_index_ts(&self, spec: &[ScSpecEntry]) -> std::io::Result<()> { + fn append_index_ts( + &self, + spec: &[ScSpecEntry], + contract_id: &str, + network_passphrase: &str, + ) -> std::io::Result<()> { + let networks = Project::format_networks_object(contract_id, network_passphrase); + let types_and_fns = generate(spec); fs::OpenOptions::new() .append(true) .open(self.0.join("src/index.ts"))? - .write_all(generate(spec).as_bytes()) + .write_all(format!("\n\n{networks}\n\n{types_and_fns}").as_bytes()) + } + + 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 { + "unknown" + }; + format!( + r#"export const networks = {{ + {network}: {{ + networkPassphrase: "{network_passphrase}", + contractId: "{contract_id}", + }} +}} as const"# + ) } } diff --git a/cmd/crates/soroban-spec-typescript/src/lib.rs b/cmd/crates/soroban-spec-typescript/src/lib.rs index 01bdb198c..2e4a94828 100644 --- a/cmd/crates/soroban-spec-typescript/src/lib.rs +++ b/cmd/crates/soroban-spec-typescript/src/lib.rs @@ -61,6 +61,16 @@ pub fn generate_from_wasm(wasm: &[u8]) -> Result { Ok(json) } +fn generate_class(fns: &[Entry]) -> String { + let methods = fns.iter().map(entry_to_ts).join("\n\n "); + format!( + r#"export class Contract {{ + constructor(public readonly options: ClassOptions) {{}} + {methods} +}}"#, + ) +} + pub fn generate(spec: &[ScSpecEntry]) -> String { let mut collected: Vec<_> = spec.iter().map(Entry::from).collect(); if !spec.iter().any(is_error_enum) { @@ -70,7 +80,12 @@ pub fn generate(spec: &[ScSpecEntry]) -> String { cases: vec![], }); } - collected.iter().map(entry_to_ts).join("\n") + let (fns, other): (Vec<_>, Vec<_>) = collected + .into_iter() + .partition(|entry| matches!(entry, Entry::Function { .. })); + let top = other.iter().map(entry_to_ts).join("\n"); + let bottom = generate_class(&fns); + format!("{top}\n\n{bottom}") } fn doc_to_ts_doc(doc: &str) -> String { @@ -94,49 +109,28 @@ fn is_error_enum(entry: &ScSpecEntry) -> bool { fn method_options(return_type: &String) -> String { format!( r#"{{ - /** - * The fee to pay for the transaction. Default: 100. - */ - fee?: number - /** - * What type of response to return. - * - * - `undefined`, the default, parses the returned XDR as `{return_type}`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. - * - `'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`. - */ - 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet -}}"# + /** + * The fee to pay for the transaction. Default: 100. + */ + fee?: number + /** + * What type of response to return. + * + * - `undefined`, the default, parses the returned XDR as `{return_type}`. Runs preflight, checks to see if auth/signing is required, and sends the transaction if so. If there's no error and `secondsToWait` is positive, awaits the finalized transaction. + * - `'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`. + */ + 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 + }}"# ) } fn jsify_name(name: &String) -> String { - match name.as_str() { - "abstract" | "arguments" | "await" | "boolean" | "break" | "byte" | "case" | "catch" - | "char" | "class" | "const" | "continue" | "debugger" | "default" | "delete" | "do" - | "double" | "else" | "enum" | "eval" | "export" | "extends" | "false" | "final" - | "finally" | "float" | "for" | "function" | "goto" | "if" | "implements" | "import" - | "in" | "instanceof" | "int" | "interface" | "let" | "long" | "native" | "new" - | "null" | "package" | "private" | "protected" | "public" | "return" | "short" - | "static" | "super" | "switch" | "synchronized" | "this" | "throw" | "throws" - | "transient" | "true" | "try" | "typeof" | "var" | "void" | "volatile" | "while" - | "with" | "yield" => format!("{name}Method"), - _ => name.to_lower_camel_case(), - } + name.to_lower_camel_case() } #[allow(clippy::too_many_lines)] @@ -169,7 +163,7 @@ pub fn entry_to_ts(entry: &Entry) -> String { return_type = type_to_ts(&outputs[0]); is_result = return_type.starts_with("Result<"); } else { - return_type = format!("[{}]", outputs.iter().map(type_to_ts).join(", ")); + return_type = format!("readonly [{}]", outputs.iter().map(type_to_ts).join(", ")); }; let ts_doc = doc_to_ts_doc(doc); @@ -199,43 +193,45 @@ pub fn entry_to_ts(entry: &Entry) -> String { if return_type != "void" { output = format!(r#"return {output};"#); }; - if is_result { - output = format!( - r#"try {{ - {output} - }} catch (e) {{ - //@ts-ignore - let err = getError(e.message); - if (err) {{ - return err; - }} else {{ - throw e; - }} - }}"# - ); - } let parse_result_xdr = if return_type == "void" { r#"parseResultXdr: () => {}"#.to_owned() } else { format!( r#"parseResultXdr: (xdr): {return_type} => {{ - {output} - }}"# + {output} + }}"# ) }; let js_name = jsify_name(name); let options = method_options(&return_type); let args = (!inputs.is_empty()) - .then(|| format!("args: [{args}],\n ")) + .then(|| format!("args: [{args}],\n ")) .unwrap_or_default(); + let mut body = format!( + r#"return await invoke({{ + method: '{name}', + {args}...options, + ...this.options, + {parse_result_xdr}, + }});"# + ); + if is_result { + body = format!( + r#"try {{ + {body} + }} catch (e) {{ + if (typeof e === 'string') {{ + let err = parseError(e); + if (err) return err; + }} + throw e; + }}"# + ); + } format!( - r#"{ts_doc}export async function {js_name}({input}options: {options} = {{}}) {{ - return await invoke({{ - method: '{name}', - {args}...options, - {parse_result_xdr}, - }}); -}} + r#"{ts_doc}async {js_name}({input}options: {options} = {{}}) {{ + {body} + }} "# ) } @@ -288,7 +284,7 @@ function {name}FromXdr(base64Xdr: string): {name} {{ let fields = fields.iter().map(type_to_ts).join(", "); let void = type_to_js_xdr(&Type::Void); format!( - r#"{docs}export type {name} = [{fields}]; + r#"{docs}export type {name} = readonly [{fields}]; function {name}ToXdr({arg_name}?: {name}): xdr.ScVal {{ if (!{arg_name}) {{ @@ -324,7 +320,7 @@ function {name}ToXdr({arg_name}?: {name}): xdr.ScVal {{ }} let res: xdr.ScVal[] = []; switch ({arg_name}.tag) {{ - {encoded_cases} + {encoded_cases} }} return xdr.ScVal.scvVec(res); }} @@ -367,12 +363,12 @@ function {name}ToXdr(val: {name}): xdr.ScVal {{ let doc = doc_to_ts_doc(doc); let cases = cases .iter() - .map(|c| format!("{{message:\"{}\"}}", c.doc)) + .map(|c| format!("{}: {{message:\"{}\"}}", c.value, c.doc)) .join(",\n "); format!( - r#"{doc}const Errors = [ + r#"{doc}const Errors = {{ {cases} -]"# +}}"# ) } } @@ -466,7 +462,7 @@ pub fn type_to_ts(value: &types::Type) -> String { if elements.is_empty() { "void".to_owned() } else { - format!("[{}]", elements.iter().map(type_to_ts).join(", ")) + format!("readonly [{}]", elements.iter().map(type_to_ts).join(", ")) } } types::Type::Custom { name } => name.clone(), diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/README.md b/cmd/crates/soroban-spec-typescript/src/project_template/README.md index a3525931d..3995e52ba 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/README.md +++ b/cmd/crates/soroban-spec-typescript/src/project_template/README.md @@ -8,11 +8,11 @@ This library was automatically generated by Soroban CLI using a command similar soroban contract bindings ts \ --rpc-url INSERT_RPC_URL_HERE \ --network-passphrase "INSERT_NETWORK_PASSPHRASE_HERE" \ - --id INSERT_CONTRACT_ID_HERE \ - --name INSERT_CONTRACT_NAME_HERE + --contract-id INSERT_CONTRACT_ID_HERE \ + --output-dir ./path/to/INSERT_CONTRACT_NAME_HERE ``` -For now, these settings are hardcoded in the generated library (see the [src/constants.ts](./src/constants.ts) file. In the future, these auto-generated libraries will provide a way to configure these settings at runtime. +The network passphrase and contract ID are exported from [index.ts](./src/index.ts) in the `networks` constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update `networks` with other valid options. This will help your contract consumers use this library more easily. # To publish or not to publish @@ -38,12 +38,17 @@ Obviously you need to adjust the above command based on the actual command you u # Use it -Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exports: +Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods: ```js -import * as INSERT_CAMEL_CASE_CONTRACT_NAME_HERE from "INSERT_CONTRACT_NAME_HERE" +import { Contract, networks } from "INSERT_CONTRACT_NAME_HERE" -INSERT_CAMEL_CASE_CONTRACT_NAME_HERE.| +const contract = new Contract({ + ...networks.futurenet, // for example; check which networks this library exports + rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers +}) + +contract.| ``` As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that `|` to get a list of all exports and inline-documentation for each. It exports a separate [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code. diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/constants.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/constants.ts deleted file mode 100644 index 5fbab75c1..000000000 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/constants.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Contract } from 'soroban-client' - -/** - * The Soroban contract ID for the INSERT_CONTRACT_NAME_HERE contract. - */ -export const CONTRACT_ID = 'INSERT_CONTRACT_ID_HERE' - -/** - * The Soroban contract ID for the INSERT_CONTRACT_NAME_HERE contract, in hex. - * If {@link CONTRACT_ID} is a new-style `C…` string, you will need this hex - * version when making calls to RPC for now. - */ -export const CONTRACT_ID_HEX = new Contract(CONTRACT_ID).contractId('hex') - - -/** - * The Soroban network passphrase used to initialize this library. - */ -export const NETWORK_PASSPHRASE = 'INSERT_NETWORK_PASSPHRASE_HERE' - -/** - * The Soroban RPC endpoint used to initialize this library. - */ -export const RPC_URL = 'INSERT_RPC_URL_HERE' - diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts index c025c0ca8..45a7e73ce 100644 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts +++ b/cmd/crates/soroban-spec-typescript/src/project_template/src/index.ts @@ -3,11 +3,10 @@ import { xdr } from 'soroban-client'; import { Buffer } from "buffer"; import { scValStrToJs, scValToJs, addressToScVal, u128ToScVal, i128ToScVal, strToScVal } from './convert.js'; import { invoke } from './invoke.js'; -import type { ResponseTypes, Wallet } from './method-options.js' +import type { ResponseTypes, Wallet, ClassOptions } from './method-options.js' -export * from './constants.js' -export * from './server.js' export * from './invoke.js' +export * from './method-options.js' export type u32 = number; export type i32 = number; @@ -73,21 +72,20 @@ if (typeof window !== 'undefined') { window.Buffer = window.Buffer || Buffer; } -const regex = /ContractError\((\d+)\)/; +const regex = /Error\(Contract, #(\d+)\)/; -function getError(err: string): Err | undefined { - const match = err.match(regex); +function parseError(message: string): Err | undefined { + const match = message.match(regex); if (!match) { return undefined; } - if (Errors == undefined) { + if (Errors === undefined) { return undefined; } - // @ts-ignore let i = parseInt(match[1], 10); - if (i < Errors.length) { - return new Err(Errors[i]!); + let err = Errors[i]; + if (err) { + return new Err(err); } return undefined; -} - +} \ 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 f1efc6a9b..20c5af90d 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 @@ -1,8 +1,6 @@ import * as SorobanClient from 'soroban-client' import type { Account, Memo, MemoType, Operation, Transaction } from 'soroban-client'; -import { NETWORK_PASSPHRASE, CONTRACT_ID } from './constants.js' -import { Server } from './server.js' -import type { Options, ResponseTypes, Wallet } from './method-options.js' +import type { ClassOptions, MethodOptions, ResponseTypes, Wallet } from './method-options.js' export type Tx = Transaction, Operation[]> @@ -10,7 +8,7 @@ export type Tx = Transaction, Operation[]> * Get account details from the Soroban network for the publicKey currently * selected in Freighter. If not connected to Freighter, return null. */ -async function getAccount(wallet: Wallet): Promise { +async function getAccount(wallet: Wallet, server: SorobanClient.Server): Promise { if (!await wallet.isConnected() || !await wallet.isAllowed()) { return null } @@ -18,7 +16,7 @@ async function getAccount(wallet: Wallet): Promise { if (!publicKey) { return null } - return await Server.getAccount(publicKey) + return await server.getAccount(publicKey) } export class NotImplementedError extends Error { } @@ -31,7 +29,7 @@ type GetTx = SorobanClient.SorobanRpc.GetTransactionResponse let someRpcResponse: Simulation | SendTx | GetTx type SomeRpcResponse = typeof someRpcResponse -type InvokeArgs = Options & { +type InvokeArgs = MethodOptions & ClassOptions & { method: string, args?: any[], parseResultXdr?: (xdr: string) => T, @@ -52,26 +50,31 @@ export async function invoke({ responseType, parseResultXdr, secondsToWait = 10, + rpcUrl, + networkPassphrase, + contractId, wallet, }: InvokeArgs): Promise { wallet = wallet ?? await import('@stellar/freighter-api') - const walletAccount = await getAccount(wallet) + const server = new SorobanClient.Server(rpcUrl, { allowHttp: rpcUrl.startsWith('http://') }); + const walletAccount = await getAccount(wallet, server) // use a placeholder null account if not yet connected to Freighter so that view calls can still work const account = walletAccount ?? new SorobanClient.Account('GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF', '0') - const contract = new SorobanClient.Contract(CONTRACT_ID) + const contract = new SorobanClient.Contract(contractId) let tx = new SorobanClient.TransactionBuilder(account, { fee: fee.toString(10), - networkPassphrase: NETWORK_PASSPHRASE, + networkPassphrase, }) .addOperation(contract.call(method, ...args)) .setTimeout(SorobanClient.TimeoutInfinite) .build() - const simulated = await Server.simulateTransaction(tx) + const simulated = await server.simulateTransaction(tx) + 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. @@ -117,10 +120,11 @@ export async function invoke({ tx = await signTx( wallet, - SorobanClient.assembleTransaction(tx, NETWORK_PASSPHRASE, simulated) as Tx + SorobanClient.assembleTransaction(tx, networkPassphrase, simulated) as Tx, + networkPassphrase, ); - const raw = await sendTx(tx, secondsToWait); + const raw = await sendTx(tx, secondsToWait, server); if (responseType === 'full') return raw @@ -144,14 +148,14 @@ export async function invoke({ * or one of the exported contract methods, you may want to use this function * to sign the transaction with Freighter. */ -export async function signTx(wallet: Wallet, tx: Tx): Promise { +export async function signTx(wallet: Wallet, tx: Tx, networkPassphrase: string): Promise { const signed = await wallet.signTransaction(tx.toXDR(), { - networkPassphrase: NETWORK_PASSPHRASE, + networkPassphrase, }) return SorobanClient.TransactionBuilder.fromXDR( signed, - NETWORK_PASSPHRASE + networkPassphrase, ) as Tx } @@ -165,14 +169,14 @@ export async function signTx(wallet: Wallet, tx: Tx): Promise { * function for its timeout/`secondsToWait` logic, rather than implementing * your own. */ -export async function sendTx(tx: Tx, secondsToWait: number): Promise { - const sendTransactionResponse = await Server.sendTransaction(tx); +export async function sendTx(tx: Tx, secondsToWait: number, server: SorobanClient.Server): Promise { + const sendTransactionResponse = await server.sendTransaction(tx); if (sendTransactionResponse.status !== "PENDING" || secondsToWait === 0) { return sendTransactionResponse; } - let getTransactionResponse = await Server.getTransaction(sendTransactionResponse.hash); + let getTransactionResponse = await server.getTransaction(sendTransactionResponse.hash); const waitUntil = new Date((Date.now() + secondsToWait * 1000)).valueOf() @@ -185,7 +189,7 @@ export async function sendTx(tx: Tx, secondsToWait: number): Promise Promise, } -export type Options = { +export type ClassOptions = { + contractId: string + networkPassphrase: string + rpcUrl: string + /** + * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: + * + * @example + * ```ts + * import freighter from "@stellar/freighter-api"; + * import { Contract } from "INSERT_CONTRACT_NAME_HERE"; + * const contract = new Contract({ + * …, + * wallet: freighter, + * }) + * ``` + */ + wallet?: Wallet +} + +export type MethodOptions = { /** * The fee to pay for the transaction. Default: 100. */ @@ -32,14 +52,4 @@ export type Options = { * 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 - /** - * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example: - * - * ```ts - * import freighter from "@stellar/freighter-api"; - * - * // later, when calling this function: - * wallet: freighter, - */ - wallet?: Wallet } diff --git a/cmd/crates/soroban-spec-typescript/src/project_template/src/server.ts b/cmd/crates/soroban-spec-typescript/src/project_template/src/server.ts deleted file mode 100644 index 4e78d7cf7..000000000 --- a/cmd/crates/soroban-spec-typescript/src/project_template/src/server.ts +++ /dev/null @@ -1,8 +0,0 @@ -import * as SorobanClient from 'soroban-client' -import { RPC_URL } from './constants.js' - -/** - * SorobanClient.Server instance, initialized using {@link RPC_URL} used to - * initialize this library. - */ -export const Server = new SorobanClient.Server(RPC_URL, { allowHttp: RPC_URL.startsWith('http://') }); diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore b/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore new file mode 100644 index 000000000..48912d244 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/.gitignore @@ -0,0 +1,2 @@ +build +node_modules \ No newline at end of file diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json new file mode 100644 index 000000000..954928b09 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package-lock.json @@ -0,0 +1,1960 @@ +{ + "name": "ts-tests", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@ava/typescript": "^4.1.0", + "@types/node": "^20.4.9", + "ava": "^5.3.1", + "typescript": "^5.1.6" + } + }, + "node_modules/@ava/typescript": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-4.1.0.tgz", + "integrity": "sha512-1iWZQ/nr9iflhLK9VN8H+1oDZqe93qxNnyYUz+jTzkYPAHc5fdZXBrqmNIgIfFhWYXK5OaQ5YtC7OmLeTNhVEg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^5.0.0", + "execa": "^7.1.1" + }, + "engines": { + "node": "^14.19 || ^16.15 || ^18 || ^20" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "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==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aggregate-error": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", + "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", + "dev": true, + "dependencies": { + "clean-stack": "^4.0.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arrgv": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arrgv/-/arrgv-1.0.2.tgz", + "integrity": "sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/arrify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-3.0.0.tgz", + "integrity": "sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ava": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ava/-/ava-5.3.1.tgz", + "integrity": "sha512-Scv9a4gMOXB6+ni4toLuhAm9KYWEjsgBglJl+kMGI5+IVDt120CCDZyB5HNU9DjmLI2t4I0GbnxGLmmRfGTJGg==", + "dev": true, + "dependencies": { + "acorn": "^8.8.2", + "acorn-walk": "^8.2.0", + "ansi-styles": "^6.2.1", + "arrgv": "^1.0.2", + "arrify": "^3.0.0", + "callsites": "^4.0.0", + "cbor": "^8.1.0", + "chalk": "^5.2.0", + "chokidar": "^3.5.3", + "chunkd": "^2.0.1", + "ci-info": "^3.8.0", + "ci-parallel-vars": "^1.0.1", + "clean-yaml-object": "^0.1.0", + "cli-truncate": "^3.1.0", + "code-excerpt": "^4.0.0", + "common-path-prefix": "^3.0.0", + "concordance": "^5.0.4", + "currently-unhandled": "^0.4.1", + "debug": "^4.3.4", + "emittery": "^1.0.1", + "figures": "^5.0.0", + "globby": "^13.1.4", + "ignore-by-default": "^2.1.0", + "indent-string": "^5.0.0", + "is-error": "^2.2.2", + "is-plain-object": "^5.0.0", + "is-promise": "^4.0.0", + "matcher": "^5.0.0", + "mem": "^9.0.2", + "ms": "^2.1.3", + "p-event": "^5.0.1", + "p-map": "^5.5.0", + "picomatch": "^2.3.1", + "pkg-conf": "^4.0.0", + "plur": "^5.1.0", + "pretty-ms": "^8.0.0", + "resolve-cwd": "^3.0.0", + "stack-utils": "^2.0.6", + "strip-ansi": "^7.0.1", + "supertap": "^3.0.1", + "temp-dir": "^3.0.0", + "write-file-atomic": "^5.0.1", + "yargs": "^17.7.2" + }, + "bin": { + "ava": "entrypoints/cli.mjs" + }, + "engines": { + "node": ">=14.19 <15 || >=16.15 <17 || >=18" + }, + "peerDependencies": { + "@ava/typescript": "*" + }, + "peerDependenciesMeta": { + "@ava/typescript": { + "optional": true + } + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/blueimp-md5": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", + "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==", + "dev": true + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-4.0.0.tgz", + "integrity": "sha512-y3jRROutgpKdz5vzEhWM34TidDU8vkJppF8dszITeb1PQmSqV3DTxyV8G/lyO/DNvtE1YTedehmw9MPZsCBHxQ==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cbor": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/cbor/-/cbor-8.1.0.tgz", + "integrity": "sha512-DwGjNW9omn6EwP70aXsn7FQJx5kO12tX0bZkaTjzdVFM6/7nhA4t0EENocKGx6D2Bch9PE2KzCUf5SceBdeijg==", + "dev": true, + "dependencies": { + "nofilter": "^3.1.0" + }, + "engines": { + "node": ">=12.19" + } + }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chunkd": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/chunkd/-/chunkd-2.0.1.tgz", + "integrity": "sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==", + "dev": true + }, + "node_modules/ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/ci-parallel-vars": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ci-parallel-vars/-/ci-parallel-vars-1.0.1.tgz", + "integrity": "sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg==", + "dev": true + }, + "node_modules/clean-stack": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", + "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clean-yaml-object": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/clean-yaml-object/-/clean-yaml-object-0.1.0.tgz", + "integrity": "sha512-3yONmlN9CSAkzNwnRCiJQ7Q2xK5mWuEfL3PuTZcAUzhObbXsfsnMptJzXwz93nc5zn9V9TwCVMmV7w4xsm43dw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/code-excerpt": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/code-excerpt/-/code-excerpt-4.0.0.tgz", + "integrity": "sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==", + "dev": true, + "dependencies": { + "convert-to-spaces": "^2.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/common-path-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", + "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", + "dev": true + }, + "node_modules/concordance": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", + "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", + "dev": true, + "dependencies": { + "date-time": "^3.1.0", + "esutils": "^2.0.3", + "fast-diff": "^1.2.0", + "js-string-escape": "^1.0.1", + "lodash": "^4.17.15", + "md5-hex": "^3.0.1", + "semver": "^7.3.2", + "well-known-symbols": "^2.0.0" + }, + "engines": { + "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" + } + }, + "node_modules/convert-to-spaces": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/convert-to-spaces/-/convert-to-spaces-2.0.1.tgz", + "integrity": "sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==", + "dev": true, + "dependencies": { + "array-find-index": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/date-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", + "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", + "dev": true, + "dependencies": { + "time-zone": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emittery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-1.0.1.tgz", + "integrity": "sha512-2ID6FdrMD9KDLldGesP6317G78K7km/kMcwItRtVFva7I/cSEOIaLpewaUb+YLXVwdAp3Ctfxh/V5zIl1sj7dQ==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "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", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/figures": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-by-default": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-2.1.0.tgz", + "integrity": "sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw==", + "dev": true, + "engines": { + "node": ">=10 <11 || >=12 <13 || >=14" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/irregular-plurals": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-3.5.0.tgz", + "integrity": "sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-error": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-error/-/is-error-2.2.2.tgz", + "integrity": "sha512-IOQqts/aHWbiisY5DuPJQ0gcbvaLFCa7fBa9xoLfxBZvQ+ZI/Zh9xoI7Gk+G64N0FdK4AbibytHht2tWgpJWLg==", + "dev": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "dev": true + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/js-string-escape": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/load-json-file": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-7.0.1.tgz", + "integrity": "sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "dependencies": { + "p-defer": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/matcher": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-5.0.0.tgz", + "integrity": "sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/md5-hex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", + "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", + "dev": true, + "dependencies": { + "blueimp-md5": "^2.10.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mem": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/mem/-/mem-9.0.2.tgz", + "integrity": "sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==", + "dev": true, + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sindresorhus/mem?sponsor=1" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/nofilter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/nofilter/-/nofilter-3.1.0.tgz", + "integrity": "sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==", + "dev": true, + "engines": { + "node": ">=12.19" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-event": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-5.0.1.tgz", + "integrity": "sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==", + "dev": true, + "dependencies": { + "p-timeout": "^5.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-5.5.0.tgz", + "integrity": "sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==", + "dev": true, + "dependencies": { + "aggregate-error": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", + "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-ms": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz", + "integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-conf": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-4.0.0.tgz", + "integrity": "sha512-7dmgi4UY4qk+4mj5Cd8v/GExPo0K+SlY+hulOSdfZ/T6jVH6//y7NtzZo5WrfhDBxuQ0jCa7fLZmNaNh7EWL/w==", + "dev": true, + "dependencies": { + "find-up": "^6.0.0", + "load-json-file": "^7.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/plur": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-5.1.0.tgz", + "integrity": "sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==", + "dev": true, + "dependencies": { + "irregular-plurals": "^3.3.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pretty-ms": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz", + "integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==", + "dev": true, + "dependencies": { + "parse-ms": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "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/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "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": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-error": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", + "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", + "dev": true, + "dependencies": { + "type-fest": "^0.13.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "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/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supertap": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/supertap/-/supertap-3.0.1.tgz", + "integrity": "sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw==", + "dev": true, + "dependencies": { + "indent-string": "^5.0.0", + "js-yaml": "^3.14.1", + "serialize-error": "^7.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/temp-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", + "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/time-zone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", + "integrity": "sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/well-known-symbols": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", + "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/write-file-atomic": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz", + "integrity": "sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yocto-queue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", + "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/package.json b/cmd/crates/soroban-spec-typescript/ts-tests/package.json new file mode 100644 index 000000000..c840d9335 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "type": "module", + "scripts": { + "test": "ava" + }, + "devDependencies": { + "@ava/typescript": "^4.1.0", + "@types/node": "^20.4.9", + "ava": "^5.3.1", + "typescript": "^5.1.6" + }, + "ava": { + "typescript": { + "rewritePaths": { + "src/": "build/" + }, + "compile": "tsc" + } + } +} diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/src/test.ts b/cmd/crates/soroban-spec-typescript/ts-tests/src/test.ts new file mode 100644 index 000000000..32e92bacb --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/src/test.ts @@ -0,0 +1,188 @@ +import test from 'ava' +import { Contract, Ok, Err, networks } from '../../fixtures/test_custom_types/dist/esm/index.js' + +const rpcUrl = 'https://rpc-futurenet.stellar.org' +const publicKey = 'GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW' + +const contract = new Contract({ + ...networks.futurenet, + rpcUrl, + wallet: { + isConnected: () => Promise.resolve(true), + isAllowed: () => Promise.resolve(true), + getUserInfo: () => Promise.resolve({ publicKey }), + signTransaction: async (tx: string, opts?: { + network?: string, + networkPassphrase?: string, + accountToSign?: string, + }) => tx, + }, +}) + +test('hello', async t => { + t.is(await contract.hello({ hello: 'tests' }), 'tests') +}) + +test('woid', async t => { + t.is(await contract.woid(), undefined) +}) + +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.failing("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' }, ['First']] } + 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: ['First'] } + t.deepEqual(await contract.complex({ complex: arg }), ret) +}) + +test('complex with asset', async t => { + const arg = { tag: 'Asset', values: [publicKey, 1n] } as const + const ret = { tag: 'Asset', values: publicKey } + 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.is(await contract.addresse({ addresse: publicKey }), publicKey) +}) + +test('bytes', async t => { + const bytes = Buffer.from('hello') + t.deepEqual(await contract.bytes({ bytes }), bytes) +}) + +test.failing('bytes_n', async t => { + const bytes_n = Buffer.from('1') // what's the correct way to construct bytes_n? + t.deepEqual(await contract.bytesN({ bytes_n }), bytes_n) +}) + +test.failing('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 }), Object.fromEntries(map.entries())) +}) + +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.failing('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 }), 0) + + // 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.failing('u256', async t => { + t.is(await contract.u256({ u256: 1n }), 1n) +}) + +test.failing('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' }, ['First']] + t.deepEqual(await contract.tupleStrukt({ tuple_strukt: arg }), res) +}) \ No newline at end of file diff --git a/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json b/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json new file mode 100644 index 000000000..36823a0e2 --- /dev/null +++ b/cmd/crates/soroban-spec-typescript/ts-tests/tsconfig.json @@ -0,0 +1,101 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Language and Environment */ + "target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "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. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + "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. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./build", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + /* 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'. */ + // "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. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Completeness */ + // "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/custom_type/src/lib.rs b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/src/lib.rs index ff64dd310..9e4b442b5 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/src/lib.rs +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/src/lib.rs @@ -49,8 +49,8 @@ pub enum ComplexEnum { #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] #[repr(u32)] pub enum Error { - /// Unknown error has occurred - OhNo = 1, + /// Please provide an odd number + NumberMustBeOdd = 1, } #[contractimpl] impl Contract { @@ -70,7 +70,7 @@ impl Contract { if u32_ % 2 == 1 { Ok(u32_) } else { - Err(Error::OhNo) + Err(Error::NumberMustBeOdd) } } diff --git a/cmd/crates/soroban-test/tests/it/custom_types.rs b/cmd/crates/soroban-test/tests/it/custom_types.rs index 9fb1008b0..b77953043 100644 --- a/cmd/crates/soroban-test/tests/it/custom_types.rs +++ b/cmd/crates/soroban-test/tests/it/custom_types.rs @@ -227,8 +227,8 @@ fn number_arg_return_err() { ]) .unwrap_err(); if let commands::contract::invoke::Error::ContractInvoke(name, doc) = &res { - assert_eq!(name, "OhNo"); - assert_eq!(doc, "Unknown error has occurred"); + assert_eq!(name, "NumberMustBeOdd"); + assert_eq!(doc, "Please provide an odd number"); }; println!("{res:#?}"); });