@stellar/stellar-sdk 16.0.0-rc.1 → 16.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +22 -28
  2. package/dist/stellar-sdk-axios.js +247 -232
  3. package/dist/stellar-sdk-axios.js.map +1 -1
  4. package/dist/stellar-sdk-axios.min.js +1 -1
  5. package/dist/stellar-sdk-axios.min.js.map +1 -1
  6. package/dist/stellar-sdk.js +50 -35
  7. package/dist/stellar-sdk.js.map +1 -1
  8. package/dist/stellar-sdk.min.js +1 -1
  9. package/dist/stellar-sdk.min.js.map +1 -1
  10. package/lib/axios/cjs/base/auth.js +11 -11
  11. package/lib/axios/cjs/base/auth.js.map +1 -1
  12. package/lib/axios/cjs/base/keypair.js +1 -1
  13. package/lib/axios/cjs/base/keypair.js.map +1 -1
  14. package/lib/axios/cjs/bindings/config.js +1 -1
  15. package/lib/axios/cjs/contract/assembled_transaction.js +6 -1
  16. package/lib/axios/cjs/contract/assembled_transaction.js.map +1 -1
  17. package/lib/axios/cjs/contract/types.js.map +1 -1
  18. package/lib/axios/cjs/horizon/horizon_axios_client.js +1 -1
  19. package/lib/axios/cjs/rpc/axios.js +1 -1
  20. package/lib/axios/cjs/rpc/server.js +13 -4
  21. package/lib/axios/cjs/rpc/server.js.map +1 -1
  22. package/lib/axios/esm/base/auth.d.ts +19 -7
  23. package/lib/axios/esm/base/auth.js +11 -11
  24. package/lib/axios/esm/base/auth.js.map +1 -1
  25. package/lib/axios/esm/base/keypair.js +1 -1
  26. package/lib/axios/esm/base/keypair.js.map +1 -1
  27. package/lib/axios/esm/bindings/config.js +1 -1
  28. package/lib/axios/esm/contract/assembled_transaction.js +6 -1
  29. package/lib/axios/esm/contract/assembled_transaction.js.map +1 -1
  30. package/lib/axios/esm/contract/types.d.ts +9 -0
  31. package/lib/axios/esm/contract/types.js.map +1 -1
  32. package/lib/axios/esm/horizon/horizon_axios_client.js +1 -1
  33. package/lib/axios/esm/rpc/axios.js +1 -1
  34. package/lib/axios/esm/rpc/server.d.ts +7 -2
  35. package/lib/axios/esm/rpc/server.js +13 -4
  36. package/lib/axios/esm/rpc/server.js.map +1 -1
  37. package/lib/cjs/base/auth.js +11 -11
  38. package/lib/cjs/base/auth.js.map +1 -1
  39. package/lib/cjs/base/keypair.js +1 -1
  40. package/lib/cjs/base/keypair.js.map +1 -1
  41. package/lib/cjs/bindings/config.js +1 -1
  42. package/lib/cjs/contract/assembled_transaction.js +6 -1
  43. package/lib/cjs/contract/assembled_transaction.js.map +1 -1
  44. package/lib/cjs/contract/types.js.map +1 -1
  45. package/lib/cjs/horizon/horizon_axios_client.js +1 -1
  46. package/lib/cjs/rpc/axios.js +1 -1
  47. package/lib/cjs/rpc/server.js +13 -4
  48. package/lib/cjs/rpc/server.js.map +1 -1
  49. package/lib/esm/base/auth.d.ts +19 -7
  50. package/lib/esm/base/auth.js +11 -11
  51. package/lib/esm/base/auth.js.map +1 -1
  52. package/lib/esm/base/keypair.js +1 -1
  53. package/lib/esm/base/keypair.js.map +1 -1
  54. package/lib/esm/bindings/config.js +1 -1
  55. package/lib/esm/contract/assembled_transaction.js +6 -1
  56. package/lib/esm/contract/assembled_transaction.js.map +1 -1
  57. package/lib/esm/contract/types.d.ts +9 -0
  58. package/lib/esm/contract/types.js.map +1 -1
  59. package/lib/esm/horizon/horizon_axios_client.js +1 -1
  60. package/lib/esm/rpc/axios.js +1 -1
  61. package/lib/esm/rpc/server.d.ts +7 -2
  62. package/lib/esm/rpc/server.js +13 -4
  63. package/lib/esm/rpc/server.js.map +1 -1
  64. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../src/contract/types.ts"],"sourcesContent":["/* disable PascalCase naming convention, to avoid breaking change */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { Transaction, xdr } from \"../base/index.js\";\nimport type { SentTransaction } from \"./sent_transaction.js\";\nimport type { Client } from \"./client.js\";\nimport { Server } from \"../rpc/index.js\";\n\nexport type XDR_BASE64 = string;\n/**\n * An unsigned 32-bit integer.\n */\nexport type u32 = number;\n/**\n * A signed 32-bit integer.\n */\nexport type i32 = number;\n/**\n * An unsigned 64-bit integer.\n */\nexport type u64 = bigint;\n/**\n * A signed 64-bit integer.\n */\nexport type i64 = bigint;\n/**\n * An unsigned 128-bit integer.\n */\nexport type u128 = bigint;\n/**\n * A signed 128-bit integer.\n */\nexport type i128 = bigint;\n/**\n * An unsigned 256-bit integer.\n */\nexport type u256 = bigint;\n/**\n * A signed 256-bit integer.\n */\nexport type i256 = bigint;\nexport type Option<T> = T | undefined;\n/**\n * @deprecated Use {@link Timepoint} instead.\n */\nexport type Typepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Timepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Duration = bigint;\n\n/**\n * A \"regular\" transaction, as opposed to a FeeBumpTransaction.\n */\nexport type Tx = Transaction;\n\nexport interface WalletError {\n message: string; // general description message returned to the client app\n code: number; // unique error code\n ext?: Array<string>; // optional extended details\n}\n\n/**\n * A function to request a wallet to sign a built transaction\n *\n * This function takes an XDR provided by the requester and applies a signature to it.\n * It returns a base64-encoded string XDR-encoded Transaction Envelope with Decorated Signatures\n * and the signer address back to the requester.\n *\n * @param xdr - The XDR string representing the transaction to be signed.\n * @param opts - Options for signing the transaction.\n * - `networkPassphrase`: The network's passphrase on which the transaction is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n * - `submit`: If set to true, submits the transaction immediately after signing.\n * - `submitUrl`: The URL of the network to which the transaction should be submitted, if applicable.\n *\n * @returns A promise resolving to an object with the signed transaction XDR and optional signer address and error.\n */\nexport type SignTransaction = (\n xdr: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n submit?: boolean;\n submitUrl?: string;\n },\n) => Promise<\n {\n signedTxXdr: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * A function to request a wallet to sign an authorization entry preimage.\n *\n * Similar to signing a transaction, this function takes an authorization entry preimage provided by the\n * requester and applies a signature to it.\n * It returns a signed hash of the same authorization entry and the signer address back to the requester.\n *\n * @param authEntry - The authorization entry preimage to be signed.\n * @param opts - Options for signing the authorization entry.\n * - `networkPassphrase`: The network's passphrase on which the authorization entry is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n *\n * @returns A promise resolving to an object with the signed authorization entry and optional signer address and error.\n */\nexport type SignAuthEntry = (\n authEntry: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n },\n) => Promise<\n {\n signedAuthEntry: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * Options for a smart contract client.\n */\nexport type ClientOptions = {\n /**\n * The public key of the source account for this transaction. You can\n * override this for specific methods later; see {@link MethodOptions}.\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated. If you do not provide it during\n * initialization, you can provide it later, either when you initialize a\n * method (see {@link MethodOptions}) or when you call\n * {@link contract.AssembledTransaction.signAndSend | signAndSend}.\n *\n * Matches signature of `signTransaction` from Freighter.\n */\n signTransaction?: SignTransaction;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties. If you do not provide it during initialization, you can\n * provide it later either when you initialize a method (see {@link MethodOptions})\n * or when you call {@link contract.AssembledTransaction.signAuthEntries | signAuthEntries}.\n *\n * Matches signature of `signAuthEntry` from Freighter.\n */\n signAuthEntry?: SignAuthEntry;\n /** The address of the contract the client will interact with. */\n contractId: string;\n /**\n * The network passphrase for the Stellar network this contract is deployed\n * to.\n */\n networkPassphrase: string;\n /**\n * The URL of the RPC instance that will be used to interact with this\n * contract.\n */\n rpcUrl: string;\n /**\n * If true, will allow HTTP requests to the RPC. If false, will\n * only allow HTTPS requests.\n * @defaultValue false\n */\n allowHttp?: boolean;\n /** Optional headers to include in requests to the RPC. */\n headers?: Record<string, string>;\n /**\n * This gets filled in automatically from the ContractSpec when you\n * instantiate a {@link Client}.\n *\n * Background: If the contract you're calling uses the `#[contracterror]`\n * macro to create an `Error` enum, then those errors get included in the\n * on-chain XDR that also describes your contract's methods. Each error will\n * have a specific number.\n *\n * A Client makes method calls with an {@link contract.AssembledTransaction | AssembledTransaction}.\n * When one of these method calls encounters an error, `AssembledTransaction`\n * will first attempt to parse the error as an \"official\" `contracterror`\n * error, by using this passed-in `errorTypes` object. See `parseError`\n * on {@link contract.AssembledTransaction}. If `errorTypes` is blank or no\n * matching error is found, then it will throw the raw error.\n * @defaultValue `{}`\n */\n errorTypes?: Record<number, { message: string }>;\n /**\n * The Server instance to use for RPC calls. If not provided, one will be\n * created automatically from `rpcUrl` and `serverOptions`.\n */\n server?: Server;\n};\n\n/**\n * Options for a smart contract method invocation.\n */\nexport type MethodOptions = {\n /**\n * The fee to pay for the transaction.\n * @defaultValue 100\n */\n fee?: string;\n\n /**\n * The timebounds which should be set for transactions generated by this\n * contract client. {@link contract.DEFAULT_TIMEOUT}\n * @defaultValue 300\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the\n * AssembledTransaction.\n * @defaultValue true\n */\n simulate?: boolean;\n\n /**\n * If true, will automatically attempt to restore the transaction if there\n * are archived entries that need renewal.\n * @defaultValue false\n */\n restore?: boolean;\n\n /**\n * The public key of the source account for this transaction.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated.\n *\n * Matches signature of `signTransaction` from Freighter.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signTransaction?: SignTransaction;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties.\n *\n * Matches signature of `signAuthEntry` from Freighter.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signAuthEntry?: SignAuthEntry;\n};\n\nexport type AssembledTransactionOptions<T = string> = MethodOptions &\n ClientOptions & {\n method: string;\n args?: any[];\n parseResultXdr: (xdr: xdr.ScVal) => T;\n\n /**\n * The address of the account that should sign the transaction. Useful when\n * a wallet holds multiple addresses to ensure signing with the intended one.\n */\n address?: string;\n\n /**\n * This option will be passed through to the SEP43-compatible wallet extension. If true, and if the wallet supports it, the transaction will be signed and immediately submitted to the network by the wallet, bypassing the submit logic in {@link SentTransaction}.\n * @defaultValue false\n */\n submit?: boolean;\n\n /**\n * The URL of the network to which the transaction should be submitted.\n * Only applicable when 'submit' is set to true.\n */\n submitUrl?: string;\n };\n\n/**\n * The default timebounds, in seconds, during which a transaction will be valid.\n * This is attached to the transaction _before_ transaction simulation (it is\n * needed for simulation to succeed). It is also re-calculated and re-added\n * _before_ transaction signing.\n * @defaultValue 300\n */\nexport const DEFAULT_TIMEOUT = 5 * 60;\n\n/**\n * An impossible account on the Stellar network\n * @defaultValue GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\n */\nexport const NULL_ACCOUNT =\n \"GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\";\n"],"names":[],"mappings":"AAmSO,MAAM,kBAAkB,CAAA,GAAI;AAM5B,MAAM,YAAA,GACX;;;;"}
1
+ {"version":3,"file":"types.js","sources":["../../../src/contract/types.ts"],"sourcesContent":["/* disable PascalCase naming convention, to avoid breaking change */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { Transaction, xdr } from \"../base/index.js\";\nimport type { SentTransaction } from \"./sent_transaction.js\";\nimport type { Client } from \"./client.js\";\nimport { Server } from \"../rpc/index.js\";\n\nexport type XDR_BASE64 = string;\n/**\n * An unsigned 32-bit integer.\n */\nexport type u32 = number;\n/**\n * A signed 32-bit integer.\n */\nexport type i32 = number;\n/**\n * An unsigned 64-bit integer.\n */\nexport type u64 = bigint;\n/**\n * A signed 64-bit integer.\n */\nexport type i64 = bigint;\n/**\n * An unsigned 128-bit integer.\n */\nexport type u128 = bigint;\n/**\n * A signed 128-bit integer.\n */\nexport type i128 = bigint;\n/**\n * An unsigned 256-bit integer.\n */\nexport type u256 = bigint;\n/**\n * A signed 256-bit integer.\n */\nexport type i256 = bigint;\nexport type Option<T> = T | undefined;\n/**\n * @deprecated Use {@link Timepoint} instead.\n */\nexport type Typepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Timepoint = bigint;\n/**\n * An unsigned 64-bit integer.\n */\nexport type Duration = bigint;\n\n/**\n * A \"regular\" transaction, as opposed to a FeeBumpTransaction.\n */\nexport type Tx = Transaction;\n\nexport interface WalletError {\n message: string; // general description message returned to the client app\n code: number; // unique error code\n ext?: Array<string>; // optional extended details\n}\n\n/**\n * A function to request a wallet to sign a built transaction\n *\n * This function takes an XDR provided by the requester and applies a signature to it.\n * It returns a base64-encoded string XDR-encoded Transaction Envelope with Decorated Signatures\n * and the signer address back to the requester.\n *\n * @param xdr - The XDR string representing the transaction to be signed.\n * @param opts - Options for signing the transaction.\n * - `networkPassphrase`: The network's passphrase on which the transaction is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n * - `submit`: If set to true, submits the transaction immediately after signing.\n * - `submitUrl`: The URL of the network to which the transaction should be submitted, if applicable.\n *\n * @returns A promise resolving to an object with the signed transaction XDR and optional signer address and error.\n */\nexport type SignTransaction = (\n xdr: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n submit?: boolean;\n submitUrl?: string;\n },\n) => Promise<\n {\n signedTxXdr: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * A function to request a wallet to sign an authorization entry preimage.\n *\n * Similar to signing a transaction, this function takes an authorization entry preimage provided by the\n * requester and applies a signature to it.\n * It returns a signed hash of the same authorization entry and the signer address back to the requester.\n *\n * @param authEntry - The authorization entry preimage to be signed.\n * @param opts - Options for signing the authorization entry.\n * - `networkPassphrase`: The network's passphrase on which the authorization entry is intended to be signed.\n * - `address`: The public key of the account that should be used to sign.\n *\n * @returns A promise resolving to an object with the signed authorization entry and optional signer address and error.\n */\nexport type SignAuthEntry = (\n authEntry: string,\n opts?: {\n networkPassphrase?: string;\n address?: string;\n },\n) => Promise<\n {\n signedAuthEntry: string;\n signerAddress?: string;\n } & { error?: WalletError }\n>;\n\n/**\n * Options for a smart contract client.\n */\nexport type ClientOptions = {\n /**\n * The public key of the source account for this transaction. You can\n * override this for specific methods later; see {@link MethodOptions}.\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated. If you do not provide it during\n * initialization, you can provide it later, either when you initialize a\n * method (see {@link MethodOptions}) or when you call\n * {@link contract.AssembledTransaction.signAndSend | signAndSend}.\n *\n * Matches signature of `signTransaction` from Freighter.\n */\n signTransaction?: SignTransaction;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties. If you do not provide it during initialization, you can\n * provide it later either when you initialize a method (see {@link MethodOptions})\n * or when you call {@link contract.AssembledTransaction.signAuthEntries | signAuthEntries}.\n *\n * Matches signature of `signAuthEntry` from Freighter.\n */\n signAuthEntry?: SignAuthEntry;\n /** The address of the contract the client will interact with. */\n contractId: string;\n /**\n * The network passphrase for the Stellar network this contract is deployed\n * to.\n */\n networkPassphrase: string;\n /**\n * The URL of the RPC instance that will be used to interact with this\n * contract.\n */\n rpcUrl: string;\n /**\n * If true, will allow HTTP requests to the RPC. If false, will\n * only allow HTTPS requests.\n * @defaultValue false\n */\n allowHttp?: boolean;\n /** Optional headers to include in requests to the RPC. */\n headers?: Record<string, string>;\n /**\n * This gets filled in automatically from the ContractSpec when you\n * instantiate a {@link Client}.\n *\n * Background: If the contract you're calling uses the `#[contracterror]`\n * macro to create an `Error` enum, then those errors get included in the\n * on-chain XDR that also describes your contract's methods. Each error will\n * have a specific number.\n *\n * A Client makes method calls with an {@link contract.AssembledTransaction | AssembledTransaction}.\n * When one of these method calls encounters an error, `AssembledTransaction`\n * will first attempt to parse the error as an \"official\" `contracterror`\n * error, by using this passed-in `errorTypes` object. See `parseError`\n * on {@link contract.AssembledTransaction}. If `errorTypes` is blank or no\n * matching error is found, then it will throw the raw error.\n * @defaultValue `{}`\n */\n errorTypes?: Record<number, { message: string }>;\n /**\n * The Server instance to use for RPC calls. If not provided, one will be\n * created automatically from `rpcUrl` and `serverOptions`.\n */\n server?: Server;\n};\n\n/**\n * Options for a smart contract method invocation.\n */\nexport type MethodOptions = {\n /**\n * The fee to pay for the transaction.\n * @defaultValue 100\n */\n fee?: string;\n\n /**\n * The timebounds which should be set for transactions generated by this\n * contract client. {@link contract.DEFAULT_TIMEOUT}\n * @defaultValue 300\n */\n timeoutInSeconds?: number;\n\n /**\n * Whether to automatically simulate the transaction when constructing the\n * AssembledTransaction.\n * @defaultValue true\n */\n simulate?: boolean;\n\n /**\n * If true, will automatically attempt to restore the transaction if there\n * are archived entries that need renewal.\n * @defaultValue false\n */\n restore?: boolean;\n\n /**\n * Request `SOROBAN_CREDENTIALS_ADDRESS_V2` (CAP-71) auth credentials from\n * simulation instead of the legacy `SOROBAN_CREDENTIALS_ADDRESS`. V2\n * credentials are only valid on networks that have activated CAP-71, so leave\n * this off until the activation vote passes for your target network. The\n * default flips to `true` once V2 becomes mandatory.\n * @defaultValue false\n */\n authV2?: boolean;\n\n /**\n * The public key of the source account for this transaction.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n publicKey?: string;\n /**\n * A function to sign the transaction using the private key corresponding to\n * the given `publicKey`. You do not need to provide this, for read-only\n * calls, which only need to be simulated.\n *\n * Matches signature of `signTransaction` from Freighter.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signTransaction?: SignTransaction;\n /**\n * A function to sign a specific auth entry for a transaction, using the\n * private key corresponding to the provided `publicKey`. This is only needed\n * for multi-auth transactions, in which one transaction is signed by\n * multiple parties.\n *\n * Matches signature of `signAuthEntry` from Freighter.\n *\n * Default: the one provided to the {@link Client} in {@link ClientOptions}\n */\n signAuthEntry?: SignAuthEntry;\n};\n\nexport type AssembledTransactionOptions<T = string> = MethodOptions &\n ClientOptions & {\n method: string;\n args?: any[];\n parseResultXdr: (xdr: xdr.ScVal) => T;\n\n /**\n * The address of the account that should sign the transaction. Useful when\n * a wallet holds multiple addresses to ensure signing with the intended one.\n */\n address?: string;\n\n /**\n * This option will be passed through to the SEP43-compatible wallet extension. If true, and if the wallet supports it, the transaction will be signed and immediately submitted to the network by the wallet, bypassing the submit logic in {@link SentTransaction}.\n * @defaultValue false\n */\n submit?: boolean;\n\n /**\n * The URL of the network to which the transaction should be submitted.\n * Only applicable when 'submit' is set to true.\n */\n submitUrl?: string;\n };\n\n/**\n * The default timebounds, in seconds, during which a transaction will be valid.\n * This is attached to the transaction _before_ transaction simulation (it is\n * needed for simulation to succeed). It is also re-calculated and re-added\n * _before_ transaction signing.\n * @defaultValue 300\n */\nexport const DEFAULT_TIMEOUT = 5 * 60;\n\n/**\n * An impossible account on the Stellar network\n * @defaultValue GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\n */\nexport const NULL_ACCOUNT =\n \"GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF\";\n"],"names":[],"mappings":"AA6SO,MAAM,kBAAkB,CAAA,GAAI;AAM5B,MAAM,YAAA,GACX;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { create as createFetchClient } from '../http-client/fetch-client.js';
2
2
 
3
- const version = "16.0.0-rc.1";
3
+ const version = "16.0.0-rc.2";
4
4
  const SERVER_TIME_MAP = {};
5
5
  function toSeconds(ms) {
6
6
  return Math.floor(ms / 1e3);
@@ -1,6 +1,6 @@
1
1
  import { create as createFetchClient } from '../http-client/fetch-client.js';
2
2
 
3
- const version = "16.0.0-rc.1";
3
+ const version = "16.0.0-rc.2";
4
4
  function createHttpClient(headers) {
5
5
  return createFetchClient({
6
6
  headers: {
@@ -518,6 +518,11 @@ export declare class RpcServer {
518
518
  * auth mode to use for simulation: `enforce` for enforcement mode,
519
519
  * `record` for recording mode, or `record_allow_nonroot` for recording
520
520
  * mode that allows non-root authorization
521
+ * @param authV2 - (optional) request `SOROBAN_CREDENTIALS_ADDRESS_V2`
522
+ * (CAP-71) auth credentials from simulation instead of the legacy
523
+ * `SOROBAN_CREDENTIALS_ADDRESS`. Defaults to `false`; only enable it for
524
+ * networks that have activated CAP-71, as V2 credentials are otherwise
525
+ * rejected.
521
526
  *
522
527
  * @returns An object with the
523
528
  * cost, footprint, result/auth requirements (if applicable), and error of
@@ -557,8 +562,8 @@ export declare class RpcServer {
557
562
  * });
558
563
  * ```
559
564
  */
560
- simulateTransaction(tx: Transaction | FeeBumpTransaction, addlResources?: RpcServer.ResourceLeeway, authMode?: Api.SimulationAuthMode): Promise<Api.SimulateTransactionResponse>;
561
- _simulateTransaction(transaction: Transaction | FeeBumpTransaction, addlResources?: RpcServer.ResourceLeeway, authMode?: Api.SimulationAuthMode): Promise<Api.RawSimulateTransactionResponse>;
565
+ simulateTransaction(tx: Transaction | FeeBumpTransaction, addlResources?: RpcServer.ResourceLeeway, authMode?: Api.SimulationAuthMode, authV2?: boolean): Promise<Api.SimulateTransactionResponse>;
566
+ _simulateTransaction(transaction: Transaction | FeeBumpTransaction, addlResources?: RpcServer.ResourceLeeway, authMode?: Api.SimulationAuthMode, authV2?: boolean): Promise<Api.RawSimulateTransactionResponse>;
562
567
  /**
563
568
  * Submit a trial contract invocation, first run a simulation of the contract
564
569
  * invocation as defined on the incoming transaction, and apply the results to
@@ -796,6 +796,11 @@ class RpcServer {
796
796
  * auth mode to use for simulation: `enforce` for enforcement mode,
797
797
  * `record` for recording mode, or `record_allow_nonroot` for recording
798
798
  * mode that allows non-root authorization
799
+ * @param authV2 - (optional) request `SOROBAN_CREDENTIALS_ADDRESS_V2`
800
+ * (CAP-71) auth credentials from simulation instead of the legacy
801
+ * `SOROBAN_CREDENTIALS_ADDRESS`. Defaults to `false`; only enable it for
802
+ * networks that have activated CAP-71, as V2 credentials are otherwise
803
+ * rejected.
799
804
  *
800
805
  * @returns An object with the
801
806
  * cost, footprint, result/auth requirements (if applicable), and error of
@@ -835,12 +840,12 @@ class RpcServer {
835
840
  * });
836
841
  * ```
837
842
  */
838
- async simulateTransaction(tx, addlResources, authMode) {
839
- return this._simulateTransaction(tx, addlResources, authMode).then(
843
+ async simulateTransaction(tx, addlResources, authMode, authV2 = false) {
844
+ return this._simulateTransaction(tx, addlResources, authMode, authV2).then(
840
845
  parseRawSimulation
841
846
  );
842
847
  }
843
- async _simulateTransaction(transaction, addlResources, authMode) {
848
+ async _simulateTransaction(transaction, addlResources, authMode, authV2 = false) {
844
849
  return postObject(
845
850
  this.httpClient,
846
851
  this.serverURL.toString(),
@@ -852,7 +857,11 @@ class RpcServer {
852
857
  resourceConfig: {
853
858
  instructionLeeway: addlResources.cpuInstructions
854
859
  }
855
- }
860
+ },
861
+ // CAP-71: only request ADDRESS_V2 auth credentials when explicitly
862
+ // opted in. They are rejected by networks that have not activated
863
+ // CAP-71, so default to omitting the flag (legacy ADDRESS credentials).
864
+ ...authV2 && { authV2: true }
856
865
  }
857
866
  );
858
867
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sources":["../../../src/rpc/server.ts"],"sourcesContent":["/* tslint:disable:variable-name no-namespace */\nimport {\n Account,\n Address,\n Asset,\n Contract,\n FeeBumpTransaction,\n Keypair,\n StrKey,\n Transaction,\n nativeToScVal,\n scValToNative,\n xdr,\n} from \"../base/index.js\";\n\nimport type { TransactionBuilder } from \"../base/index.js\";\nimport type { Config } from \"../config.js\";\nimport { createHttpClient } from \"./axios.js\";\nimport type { Api as FriendbotApi } from \"../friendbot/index.js\";\nimport * as jsonrpc from \"./jsonrpc.js\";\nimport { Api } from \"./api.js\";\nimport { assembleTransaction } from \"./transaction.js\";\nimport {\n parseRawSendTransaction,\n parseRawSimulation,\n parseRawLedgerEntries,\n parseRawEvents,\n parseRawTransactions,\n parseTransactionInfo,\n parseRawLedger,\n parseRawLatestLedger,\n} from \"./parsers.js\";\nimport { Utils } from \"../utils.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\n/**\n * Default transaction submission timeout for RPC requests, in milliseconds\n * @defaultValue 60000\n */\nexport const SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000;\n\n/**\n * Specifies the durability namespace of contract-related ledger entries.\n *\n * @see {@link https://developers.stellar.org/docs/learn/smart-contract-internals/state-archival | State Archival docs}\n * @see {@link https://docs.rs/soroban-sdk/latest/soroban_sdk/storage/struct.Storage.html | Rust SDK Storage docs}\n */\nexport enum Durability {\n Temporary = \"temporary\",\n Persistent = \"persistent\",\n}\n\nexport namespace RpcServer {\n /**\n * @deprecated Use `Api.GetEventsRequest` instead.\n * @see {@link Api.GetEventsRequest}\n */\n export type GetEventsRequest = Api.GetEventsRequest;\n\n export interface PollingOptions {\n attempts?: number;\n sleepStrategy?: SleepStrategy;\n }\n\n /**\n * Describes additional resource leeways for transaction simulation.\n */\n export interface ResourceLeeway {\n /** Simulate the transaction with more CPU instructions available. */\n cpuInstructions: number;\n }\n\n /**\n * Options for configuring connections to RPC servers.\n */\n export interface Options {\n /** Allow connecting to http servers, default: `false`. This must be set to false in production deployments! */\n allowHttp?: boolean;\n /** Allow a timeout, default: 0. Allows user to avoid nasty lag. */\n timeout?: number;\n /** Additional headers that should be added to any requests to the RPC server. */\n headers?: Record<string, string>;\n }\n}\n\nconst DEFAULT_GET_TRANSACTION_TIMEOUT: number = 30;\n\n/// A strategy that will sleep 1 second each time\n\nexport const BasicSleepStrategy: SleepStrategy = (_iter: number) => 1000;\n\n/// A strategy that will sleep 1 second longer on each attempt\nexport const LinearSleepStrategy: SleepStrategy = (iter: number) => 1000 * iter;\n\n/**\n * A function that returns the number of *milliseconds* to sleep\n * on a given `iter`ation.\n */\nexport type SleepStrategy = (iter: number) => number;\n\nfunction findCreatedAccountSequenceInTransactionMeta(\n meta: xdr.TransactionMeta,\n): string {\n let operations: xdr.OperationMeta[] = [];\n switch (meta.switch()) {\n case 0:\n operations = meta.operations();\n break;\n case 1:\n case 2:\n case 3:\n case 4: // all four have the same interface\n operations = (meta.value() as xdr.TransactionMetaV4).operations();\n break;\n default:\n throw new Error(\"Unexpected transaction meta switch value\");\n }\n const sequenceNumber = operations\n .flatMap((op) => op.changes())\n .find(\n (c) =>\n c.switch() === xdr.LedgerEntryChangeType.ledgerEntryCreated() &&\n c.created().data().switch() === xdr.LedgerEntryType.account(),\n )\n ?.created()\n ?.data()\n ?.account()\n ?.seqNum()\n ?.toString();\n\n if (sequenceNumber) {\n return sequenceNumber;\n }\n throw new Error(\"No account created in transaction\");\n}\n\n/**\n * Handles the network connection to a Soroban RPC instance, exposing an\n * interface for requests to that instance.\n *\n *\n * @param serverURL - Soroban-RPC Server URL (ex. `http://localhost:8000/soroban/rpc`).\n * @param opts - (optional) Options object\n * - `allowHttp` (optional): Allows connecting to insecure http servers\n * (default: `false`). This must be set to false in production deployments!\n * You can also use {@link Config} class to set this globally.\n * - `headers` (optional): Allows setting custom headers\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods | API reference docs}\n */\nexport class RpcServer {\n public readonly serverURL: URL;\n /**\n * HTTP client instance for making requests to Horizon.\n * Exposes interceptors, defaults, and other configuration options.\n *\n * @example\n * ```ts\n * // Add authentication header\n * server.httpClient.defaults.headers['Authorization'] = 'Bearer token';\n *\n * // Add request interceptor\n * server.httpClient.interceptors.request.use((config) => {\n * console.log('Request:', config.url);\n * return config;\n * });\n * ```\n */\n public readonly httpClient: HttpClient;\n constructor(serverURL: string, opts: RpcServer.Options = {}) {\n /**\n * RPC Server URL (ex. `http://localhost:8000/soroban/rpc`).\n */\n this.serverURL = new URL(serverURL);\n this.httpClient = createHttpClient(opts.headers);\n if (this.serverURL.protocol !== \"https:\" && !opts.allowHttp) {\n throw new Error(\n \"Cannot connect to insecure Soroban RPC server if `allowHttp` isn't set\",\n );\n }\n }\n\n /**\n * Fetch a minimal set of current info about a Stellar account.\n *\n * Needed to get the current sequence number for the account so you can build\n * a successful transaction with {@link TransactionBuilder}.\n *\n * @param address - The public address of the account to load.\n * @returns A promise which resolves to the {@link Account}\n * object with a populated sequence number\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const accountId = \"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\";\n * server.getAccount(accountId).then((account) => {\n * console.log(\"sequence:\", account.sequence);\n * });\n * ```\n */\n public async getAccount(address: string): Promise<Account> {\n const entry = await this.getAccountEntry(address);\n return new Account(address, entry.seqNum().toString());\n }\n\n /**\n * Fetch the full account entry for a Stellar account.\n *\n * @param address - The public address of the account to load.\n * @returns Resolves to the full on-chain account\n * entry\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const accountId = \"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\";\n * server.getAccountEntry(accountId).then((account) => {\n * console.log(\"sequence:\", account.balance().toString());\n * });\n * ```\n */\n public async getAccountEntry(address: string): Promise<xdr.AccountEntry> {\n const ledgerKey = xdr.LedgerKey.account(\n new xdr.LedgerKeyAccount({\n accountId: Keypair.fromPublicKey(address).xdrPublicKey(),\n }),\n );\n\n try {\n const resp = await this.getLedgerEntry(ledgerKey);\n return resp.val.account();\n } catch {\n throw new Error(`Account not found: ${address}`);\n }\n }\n\n /**\n * Fetch the full trustline entry for a Stellar account.\n *\n * @param account - The public address of the account whose trustline it is\n * @param asset - The trustline's asset\n * @returns Resolves to the full on-chain trustline\n * entry\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @deprecated Use {@link getAssetBalance}, instead\n * @example\n * ```ts\n * const accountId = \"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\";\n * const asset = new Asset(\n * \"USDC\",\n * \"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5\"\n * );\n * server.getTrustline(accountId, asset).then((entry) => {\n * console.log(`{asset.toString()} balance for ${accountId}:\", entry.balance().toString());\n * });\n * ```\n */\n public async getTrustline(\n account: string,\n asset: Asset,\n ): Promise<xdr.TrustLineEntry> {\n const trustlineLedgerKey = xdr.LedgerKey.trustline(\n new xdr.LedgerKeyTrustLine({\n accountId: Keypair.fromPublicKey(account).xdrAccountId(),\n asset: asset.toTrustLineXDRObject(),\n }),\n );\n\n try {\n const entry = await this.getLedgerEntry(trustlineLedgerKey);\n return entry.val.trustLine();\n } catch {\n throw new Error(\n `Trustline for ${asset.getCode()}:${asset.getIssuer()} not found for ${account}`,\n );\n }\n }\n\n /**\n * Fetch the full claimable balance entry for a Stellar account.\n *\n * @param id - The strkey (`B...`) or hex (`00000000abcde...`) (both\n * IDs with and without the 000... version prefix are accepted) of the\n * claimable balance to load\n * @returns Resolves to the full on-chain\n * claimable balance entry\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const id = \"00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9\";\n * server.getClaimableBalance(id).then((entry) => {\n * console.log(`Claimable balance {id.substr(0, 12)} has:`);\n * console.log(` asset: ${Asset.fromXDRObject(entry.asset()).toString()}`;\n * console.log(` amount: ${entry.amount().toString()}`;\n * });\n * ```\n */\n public async getClaimableBalance(\n id: string,\n ): Promise<xdr.ClaimableBalanceEntry> {\n let balanceId;\n if (StrKey.isValidClaimableBalance(id)) {\n let buffer = StrKey.decodeClaimableBalance(id);\n\n // Pad the version byte to be a full int32 like in the XDR spec\n let v = Buffer.concat([\n Buffer.from(\"\\x00\\x00\\x00\"),\n buffer.subarray(0, 1),\n ]);\n\n // Slap on the rest of it and decode it\n balanceId = xdr.ClaimableBalanceId.fromXDR(\n Buffer.concat([v, buffer.subarray(1)]),\n );\n } else if (id.match(/[a-f0-9]{72}/i)) {\n balanceId = xdr.ClaimableBalanceId.fromXDR(id, \"hex\");\n } else if (id.match(/[a-f0-9]{64}/i)) {\n balanceId = xdr.ClaimableBalanceId.fromXDR(id.padStart(72, \"0\"), \"hex\");\n } else {\n throw new TypeError(`expected 72-char hex ID or strkey, not ${id}`);\n }\n\n const trustlineLedgerKey = xdr.LedgerKey.claimableBalance(\n new xdr.LedgerKeyClaimableBalance({ balanceId }),\n );\n\n try {\n const entry = await this.getLedgerEntry(trustlineLedgerKey);\n return entry.val.claimableBalance();\n } catch {\n throw new Error(`Claimable balance ${id} not found`);\n }\n }\n\n /**\n * Fetch the balance of an asset held by an account or contract.\n *\n * The `address` argument may be provided as a string (as a {@link StrKey}),\n * {@link Address}, or {@link Contract}.\n *\n * @param address - The account or contract whose\n * balance should be fetched.\n * @param asset - The asset whose balance you want to inspect.\n * @param networkPassphrase - (optional) optionally, when requesting the\n * balance of a contract, the network passphrase to which this token\n * applies. If omitted and necessary, a request about network information\n * will be made (see {@link getNetwork}), since contract IDs for assets are\n * specific to a network. You can refer to {@link Networks} for a list of\n * built-in passphrases, e.g., `Networks.TESTNET`.\n * @returns Resolves with balance entry details\n * when available.\n *\n * @throws If the supplied `address` is not a valid account or\n * contract strkey.\n *\n * @example\n * ```ts\n * const usdc = new Asset(\n * \"USDC\",\n * \"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5\"\n * );\n * const balance = await server.getAssetBalance(\"GD...\", usdc);\n * console.log(balance.balanceEntry?.amount);\n * ```\n */\n public async getAssetBalance(\n address: string | Address | Contract,\n asset: Asset,\n networkPassphrase?: string,\n ): Promise<Api.BalanceResponse> {\n let addr: string = address as string;\n // Coalesce to a strkey\n if (typeof address === \"string\") {\n addr = address;\n } else if (address instanceof Address) {\n addr = address.toString();\n } else if (address instanceof Contract) {\n addr = address.toString();\n } else {\n // shouldn't happen, but be defensive\n throw new TypeError(`invalid address: ${address}`);\n }\n\n if (StrKey.isValidEd25519PublicKey(addr)) {\n const [tl, ll] = await Promise.all([\n this.getTrustline(addr, asset),\n this.getLatestLedger(),\n ]);\n\n return {\n latestLedger: ll.sequence,\n balanceEntry: {\n amount: tl.balance().toString(),\n // Extract actual flags from the coalesced value.\n authorized: Boolean(tl.flags() & 0x1), // AUTHORIZED_FLAG\n clawback: Boolean(tl.flags() & 0x4), // TRUSTLINE_CLAWBACK_ENABLED_FLAG\n authorizedToMaintainLiabilities: Boolean(tl.flags() & 0x2), // AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG\n revocable: Boolean(tl.flags() & 0x2), // AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG (deprecated, will be removed in a future major release)\n },\n };\n } else if (StrKey.isValidContract(addr)) {\n return this.getSACBalance(addr, asset, networkPassphrase);\n }\n\n throw new Error(`invalid address: ${address}`);\n }\n\n /**\n * General node health check.\n *\n * @returns A promise which resolves to the\n * {@link Api.GetHealthResponse} object with the status of the\n * server (e.g. \"healthy\").\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getHealth | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * server.getHealth().then((health) => {\n * console.log(\"status:\", health.status);\n * });\n * ```\n */\n\n public async getHealth(): Promise<Api.GetHealthResponse> {\n return jsonrpc.postObject<Api.GetHealthResponse>(\n this.httpClient,\n this.serverURL.toString(),\n \"getHealth\",\n );\n }\n\n /**\n * Reads the current value of contract data ledger entries directly.\n *\n * Allows you to directly inspect the current state of a contract. This is a\n * backup way to access your contract data which may not be available via\n * events or {@link rpc.Server.simulateTransaction}.\n *\n * @param contract - The contract ID containing the\n * data to load as a strkey (`C...` form), a {@link Contract}, or an\n * {@link Address} instance\n * @param key - The key of the contract data to load\n * @param durability - (optional) The \"durability\n * keyspace\" that this ledger key belongs to, which is either 'temporary'\n * or 'persistent' (the default), see {@link rpc.Durability}.\n * @returns The current data value\n *\n * **Warning:** If the data entry in question is a 'temporary' entry, it's\n * entirely possible that it has expired out of existence.\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const contractId = \"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5\";\n * const key = xdr.ScVal.scvSymbol(\"counter\");\n * server.getContractData(contractId, key, Durability.Temporary).then(data => {\n * console.log(\"value:\", data.val);\n * console.log(\"liveUntilLedgerSeq:\", data.liveUntilLedgerSeq);\n * console.log(\"lastModified:\", data.lastModifiedLedgerSeq);\n * console.log(\"latestLedger:\", data.latestLedger);\n * });\n * ```\n */\n\n public async getContractData(\n contract: string | Address | Contract,\n key: xdr.ScVal,\n durability: Durability = Durability.Persistent,\n ): Promise<Api.LedgerEntryResult> {\n // coalesce `contract` param variants to an ScAddress\n let scAddress: xdr.ScAddress;\n if (typeof contract === \"string\") {\n scAddress = new Contract(contract).address().toScAddress();\n } else if (contract instanceof Address) {\n scAddress = contract.toScAddress();\n } else if (contract instanceof Contract) {\n scAddress = contract.address().toScAddress();\n } else {\n throw new TypeError(`unknown contract type: ${contract}`);\n }\n\n let xdrDurability: xdr.ContractDataDurability;\n switch (durability) {\n case Durability.Temporary:\n xdrDurability = xdr.ContractDataDurability.temporary();\n break;\n\n case Durability.Persistent:\n xdrDurability = xdr.ContractDataDurability.persistent();\n break;\n\n default:\n throw new TypeError(`invalid durability: ${durability}`);\n }\n\n const contractKey = xdr.LedgerKey.contractData(\n new xdr.LedgerKeyContractData({\n key,\n contract: scAddress,\n durability: xdrDurability,\n }),\n );\n\n try {\n return await this.getLedgerEntry(contractKey);\n } catch {\n throw {\n code: 404,\n message: `Contract data not found for ${Address.fromScAddress(\n scAddress,\n ).toString()} with key ${key.toXDR(\"base64\")} and durability: ${durability}`,\n };\n }\n }\n\n /**\n * Retrieves the WASM bytecode for a given contract.\n *\n * This method allows you to fetch the WASM bytecode associated with a contract\n * deployed on the Soroban network. The WASM bytecode represents the executable\n * code of the contract.\n *\n * @param contractId - The contract ID containing the WASM bytecode to retrieve\n * @returns A Buffer containing the WASM bytecode\n * @throws If the contract or its associated WASM bytecode cannot be\n * found on the network.\n *\n * @example\n * ```ts\n * const contractId = \"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5\";\n * server.getContractWasmByContractId(contractId).then(wasmBuffer => {\n * console.log(\"WASM bytecode length:\", wasmBuffer.length);\n * // ... do something with the WASM bytecode ...\n * }).catch(err => {\n * console.error(\"Error fetching WASM bytecode:\", err);\n * });\n * ```\n */\n public async getContractWasmByContractId(\n contractId: string,\n ): Promise<Buffer> {\n const contractLedgerKey = new Contract(contractId).getFootprint();\n const response = await this.getLedgerEntries(contractLedgerKey);\n if (!response.entries.length || !response.entries[0]?.val) {\n return Promise.reject({\n code: 404,\n message: `Could not obtain contract hash from server`,\n });\n }\n\n const wasmHash = response.entries[0].val\n .contractData()\n .val()\n .instance()\n .executable()\n .wasmHash();\n\n return this.getContractWasmByHash(wasmHash);\n }\n\n /**\n * Retrieves the WASM bytecode for a given contract hash.\n *\n * This method allows you to fetch the WASM bytecode associated with a contract\n * deployed on the Soroban network using the contract's WASM hash. The WASM bytecode\n * represents the executable code of the contract.\n *\n * @param wasmHash - The WASM hash of the contract\n * @returns A Buffer containing the WASM bytecode\n * @throws If the contract or its associated WASM bytecode cannot be\n * found on the network.\n *\n * @example\n * ```ts\n * const wasmHash = Buffer.from(\"...\");\n * server.getContractWasmByHash(wasmHash).then(wasmBuffer => {\n * console.log(\"WASM bytecode length:\", wasmBuffer.length);\n * // ... do something with the WASM bytecode ...\n * }).catch(err => {\n * console.error(\"Error fetching WASM bytecode:\", err);\n * });\n * ```\n */\n public async getContractWasmByHash(\n wasmHash: Buffer | string,\n format: undefined | \"hex\" | \"base64\" = undefined,\n ): Promise<Buffer> {\n const wasmHashBuffer =\n typeof wasmHash === \"string\"\n ? Buffer.from(wasmHash, format)\n : (wasmHash as Buffer);\n\n const ledgerKeyWasmHash = xdr.LedgerKey.contractCode(\n new xdr.LedgerKeyContractCode({\n hash: wasmHashBuffer,\n }),\n );\n\n const responseWasm = await this.getLedgerEntries(ledgerKeyWasmHash);\n if (!responseWasm.entries.length || !responseWasm.entries[0]?.val) {\n return Promise.reject({\n code: 404,\n message: \"Could not obtain contract wasm from server\",\n });\n }\n const wasmBuffer = responseWasm.entries[0].val.contractCode().code();\n\n return wasmBuffer;\n }\n\n /**\n * Reads the current value of arbitrary ledger entries directly.\n *\n * Allows you to directly inspect the current state of contracts, contract's\n * code, accounts, or any other ledger entries.\n *\n * To fetch a contract's WASM byte-code, built the appropriate\n * {@link xdr.LedgerKeyContractCode} ledger entry key (or see\n * {@link Contract.getFootprint}).\n *\n * @param keys - One or more ledger entry keys to load\n * @returns The current on-chain\n * values for the given ledger keys\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n * @see RpcServer._getLedgerEntries\n * @example\n * ```ts\n * const contractId = \"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM\";\n * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({\n * contractId: StrKey.decodeContract(contractId),\n * key: xdr.ScVal.scvSymbol(\"counter\"),\n * }));\n *\n * server.getLedgerEntries([key]).then(response => {\n * const ledgerData = response.entries[0];\n * console.log(\"key:\", ledgerData.key);\n * console.log(\"value:\", ledgerData.val);\n * console.log(\"liveUntilLedgerSeq:\", ledgerData.liveUntilLedgerSeq);\n * console.log(\"lastModified:\", ledgerData.lastModifiedLedgerSeq);\n * console.log(\"latestLedger:\", response.latestLedger);\n * });\n * ```\n */\n public getLedgerEntries(...keys: xdr.LedgerKey[]) {\n return this._getLedgerEntries(...keys).then(parseRawLedgerEntries);\n }\n\n public _getLedgerEntries(...keys: xdr.LedgerKey[]) {\n return jsonrpc.postObject<Api.RawGetLedgerEntriesResponse>(\n this.httpClient,\n this.serverURL.toString(),\n \"getLedgerEntries\",\n {\n keys: keys.map((k) => k.toXDR(\"base64\")),\n },\n );\n }\n\n public async getLedgerEntry(key: xdr.LedgerKey) {\n const results = await this._getLedgerEntries(key).then(\n parseRawLedgerEntries,\n );\n if (results.entries.length !== 1) {\n throw new Error(`failed to find an entry for key ${key.toXDR(\"base64\")}`);\n }\n return results.entries[0];\n }\n\n /**\n * Poll for a particular transaction with certain parameters.\n *\n * After submitting a transaction, clients can use this to poll for\n * transaction completion and return a definitive state of success or failure.\n *\n * @param hash - the transaction you're polling for\n * @param opts - (optional) polling options\n * - `attempts` (optional): (optional) the number of attempts to make\n * before returning the last-seen status. By default or on invalid inputs,\n * try 5 times.\n * - `sleepStrategy` (optional): (optional) the amount of time\n * to wait for between each attempt. By default, sleep for 1 second between\n * each attempt.\n *\n * @returns the response after a \"found\"\n * response (which may be success or failure) or the last response obtained\n * after polling the maximum number of specified attempts.\n *\n * @example\n * ```ts\n * const h = \"c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a\";\n * const txStatus = await server.pollTransaction(h, {\n * attempts: 100, // I'm a maniac\n * sleepStrategy: rpc.LinearSleepStrategy\n * }); // this will take 5,050 seconds to complete\n * ```\n */\n public async pollTransaction(\n hash: string,\n opts?: RpcServer.PollingOptions,\n ): Promise<Api.GetTransactionResponse> {\n const maxAttempts: number =\n (opts?.attempts ?? 0) < 1\n ? DEFAULT_GET_TRANSACTION_TIMEOUT\n : (opts?.attempts ?? DEFAULT_GET_TRANSACTION_TIMEOUT); // \"positive and defined user value or default\"\n\n let foundInfo: Api.GetTransactionResponse;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n foundInfo = await this.getTransaction(hash);\n if (foundInfo.status !== Api.GetTransactionStatus.NOT_FOUND) {\n return foundInfo;\n }\n\n await Utils.sleep((opts?.sleepStrategy ?? BasicSleepStrategy)(attempt));\n }\n\n return foundInfo!;\n }\n\n /**\n * Fetch the details of a submitted transaction.\n *\n * After submitting a transaction, clients should poll this to tell when the\n * transaction has completed.\n *\n * @param hash - Hex-encoded hash of the transaction to check\n * @returns The status, result, and\n * other details about the transaction\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction | getTransaction docs}\n *\n * @example\n * ```ts\n * const transactionHash = \"c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a\";\n * server.getTransaction(transactionHash).then((tx) => {\n * console.log(\"status:\", tx.status);\n * console.log(\"envelopeXdr:\", tx.envelopeXdr);\n * console.log(\"resultMetaXdr:\", tx.resultMetaXdr);\n * console.log(\"resultXdr:\", tx.resultXdr);\n * });\n * ```\n */\n\n public async getTransaction(\n hash: string,\n ): Promise<Api.GetTransactionResponse> {\n return this._getTransaction(hash).then((raw) => {\n const foundInfo: Omit<\n Api.GetSuccessfulTransactionResponse,\n keyof Api.GetMissingTransactionResponse\n > = {} as any;\n\n if (raw.status !== Api.GetTransactionStatus.NOT_FOUND) {\n Object.assign(foundInfo, parseTransactionInfo(raw));\n }\n\n const result: Api.GetTransactionResponse = {\n status: raw.status,\n txHash: hash,\n latestLedger: raw.latestLedger,\n latestLedgerCloseTime: raw.latestLedgerCloseTime,\n oldestLedger: raw.oldestLedger,\n oldestLedgerCloseTime: raw.oldestLedgerCloseTime,\n ...foundInfo,\n };\n\n return result;\n });\n }\n\n public async _getTransaction(\n hash: string,\n ): Promise<Api.RawGetTransactionResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getTransaction\",\n {\n hash,\n },\n );\n }\n\n /**\n * Fetch transactions starting from a given start ledger or a cursor. The end ledger is the latest ledger\n * in that RPC instance.\n *\n * @param request - The request parameters.\n * @returns - A promise that resolves to the transactions response.\n *\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransactions\n * @example\n * ```ts\n * server.getTransactions({\n * startLedger: 10000,\n * limit: 10,\n * }).then((response) => {\n * console.log(\"Transactions:\", response.transactions);\n * console.log(\"Latest Ledger:\", response.latestLedger);\n * console.log(\"Cursor:\", response.cursor);\n * });\n * ```\n */\n public async getTransactions(\n request: Api.GetTransactionsRequest,\n ): Promise<Api.GetTransactionsResponse> {\n return this._getTransactions(request).then(\n (raw: Api.RawGetTransactionsResponse) => {\n const result: Api.GetTransactionsResponse = {\n transactions: (raw.transactions || []).map(parseRawTransactions),\n latestLedger: raw.latestLedger,\n latestLedgerCloseTimestamp: raw.latestLedgerCloseTimestamp,\n oldestLedger: raw.oldestLedger,\n oldestLedgerCloseTimestamp: raw.oldestLedgerCloseTimestamp,\n cursor: raw.cursor,\n };\n return result;\n },\n );\n }\n\n async _getTransactions(\n request: Api.GetTransactionsRequest,\n ): Promise<Api.RawGetTransactionsResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getTransactions\",\n request,\n );\n }\n\n /**\n * Fetch all events that match a given set of filters.\n *\n * The given filters (see {@link Api.EventFilter}\n * for detailed fields) are combined only in a logical OR fashion, and all of\n * the fields in each filter are optional.\n *\n * To page through events, use the `pagingToken` field on the relevant\n * {@link Api.EventResponse} object to set the `cursor` parameter.\n *\n * @param request - Event filters {@link Api.GetEventsRequest},\n * @returns A paginatable set of the events\n * matching the given event filters\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents docs}\n *\n * @example\n * ```ts\n *\n * server.getEvents({\n * startLedger: 1000,\n * endLedger: 2000,\n * filters: [\n * {\n * type: \"contract\",\n * contractIds: [ \"deadb33f...\" ],\n * topics: [[ \"AAAABQAAAAh0cmFuc2Zlcg==\", \"AAAAAQB6Mcc=\", \"*\" ]]\n * }, {\n * type: \"system\",\n * contractIds: [ \"...c4f3b4b3...\" ],\n * topics: [[ \"*\" ], [ \"*\", \"AAAAAQB6Mcc=\" ]]\n * }, {\n * contractIds: [ \"...c4f3b4b3...\" ],\n * topics: [[ \"AAAABQAAAAh0cmFuc2Zlcg==\" ]]\n * }, {\n * type: \"diagnostic\",\n * topics: [[ \"AAAAAQB6Mcc=\" ]]\n * }\n * ],\n * limit: 10,\n * });\n * ```\n */\n\n public async getEvents(\n request: Api.GetEventsRequest,\n ): Promise<Api.GetEventsResponse> {\n return this._getEvents(request).then(parseRawEvents);\n }\n\n public async _getEvents(\n request: Api.GetEventsRequest,\n ): Promise<Api.RawGetEventsResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getEvents\",\n {\n filters: request.filters ?? [],\n pagination: {\n ...(request.cursor && { cursor: request.cursor }), // add if defined\n ...(request.limit && { limit: request.limit }),\n },\n ...(request.startLedger && {\n startLedger: request.startLedger,\n }),\n ...(request.endLedger && {\n endLedger: request.endLedger,\n }),\n },\n );\n }\n\n /**\n * Fetch metadata about the network this Soroban RPC server is connected to.\n *\n * @returns Metadata about the current\n * network this RPC server is connected to\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork | getNetwork docs}\n *\n * @example\n * ```ts\n * server.getNetwork().then((network) => {\n * console.log(\"friendbotUrl:\", network.friendbotUrl);\n * console.log(\"passphrase:\", network.passphrase);\n * console.log(\"protocolVersion:\", network.protocolVersion);\n * });\n * ```\n */\n\n public async getNetwork(): Promise<Api.GetNetworkResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getNetwork\",\n );\n }\n\n /**\n * Fetch the latest ledger meta info from network which this Soroban RPC\n * server is connected to.\n *\n * @returns metadata about the\n * latest ledger on the network that this RPC server is connected to\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger | getLatestLedger docs}\n *\n * @example\n * ```ts\n * server.getLatestLedger().then((response) => {\n * console.log(\"hash:\", response.id);\n * console.log(\"sequence:\", response.sequence);\n * console.log(\"protocolVersion:\", response.protocolVersion);\n * });\n * ```\n */\n public async getLatestLedger(): Promise<Api.GetLatestLedgerResponse> {\n return this._getLatestLedger().then(parseRawLatestLedger);\n }\n\n public async _getLatestLedger(): Promise<Api.RawGetLatestLedgerResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getLatestLedger\",\n );\n }\n\n /**\n * Submit a trial contract invocation to get back return values, expected\n * ledger footprint, expected authorizations, and expected costs.\n *\n * @param tx - the transaction to simulate,\n * which should include exactly one operation (one of\n * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTtlOp}, or\n * {@link xdr.RestoreFootprintOp}). Any provided footprint or auth\n * information will be ignored.\n * @param addlResources - (optional) any additional resources\n * to add to the simulation-provided ones, for example if you know you will\n * need extra CPU instructions\n * @param authMode - (optional) optionally, specify the type of\n * auth mode to use for simulation: `enforce` for enforcement mode,\n * `record` for recording mode, or `record_allow_nonroot` for recording\n * mode that allows non-root authorization\n *\n * @returns An object with the\n * cost, footprint, result/auth requirements (if applicable), and error of\n * the transaction\n *\n * @see\n * {@link https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/operations-and-transactions | transaction docs}\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction | simulateTransaction docs}\n * @see\n * {@link https://developers.stellar.org/docs/learn/fundamentals/contract-development/contract-interactions/transaction-simulation#authorization | authorization modes}\n * @see module:rpc.Server#prepareTransaction\n * @see module:rpc.assembleTransaction\n *\n * @example\n * ```ts\n * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';\n * const contract = new StellarSdk.Contract(contractId);\n *\n * // Right now, this is just the default fee for this example.\n * const fee = StellarSdk.BASE_FEE;\n * const transaction = new StellarSdk.TransactionBuilder(account, { fee })\n * // Uncomment the following line to build transactions for the live network. Be\n * // sure to also change the horizon hostname.\n * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)\n * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)\n * .setTimeout(30) // valid for the next 30s\n * // Add an operation to call increment() on the contract\n * .addOperation(contract.call(\"increment\"))\n * .build();\n *\n * server.simulateTransaction(transaction).then((sim) => {\n * console.log(\"cost:\", sim.cost);\n * console.log(\"result:\", sim.result);\n * console.log(\"error:\", sim.error);\n * console.log(\"latestLedger:\", sim.latestLedger);\n * });\n * ```\n */\n\n public async simulateTransaction(\n tx: Transaction | FeeBumpTransaction,\n addlResources?: RpcServer.ResourceLeeway,\n authMode?: Api.SimulationAuthMode,\n ): Promise<Api.SimulateTransactionResponse> {\n return this._simulateTransaction(tx, addlResources, authMode).then(\n parseRawSimulation,\n );\n }\n\n public async _simulateTransaction(\n transaction: Transaction | FeeBumpTransaction,\n addlResources?: RpcServer.ResourceLeeway,\n authMode?: Api.SimulationAuthMode,\n ): Promise<Api.RawSimulateTransactionResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"simulateTransaction\",\n {\n transaction: transaction.toXDR(),\n authMode,\n ...(addlResources !== undefined && {\n resourceConfig: {\n instructionLeeway: addlResources.cpuInstructions,\n },\n }),\n },\n );\n }\n\n /**\n * Submit a trial contract invocation, first run a simulation of the contract\n * invocation as defined on the incoming transaction, and apply the results to\n * a new copy of the transaction which is then returned. Setting the ledger\n * footprint and authorization, so the resulting transaction is ready for\n * signing & sending.\n *\n * The returned transaction will also have an updated fee that is the sum of\n * fee set on incoming transaction with the contract resource fees estimated\n * from simulation. It is advisable to check the fee on returned transaction\n * and validate or take appropriate measures for interaction with user to\n * confirm it is acceptable.\n *\n * You can call the {@link rpc.Server.simulateTransaction} method\n * directly first if you want to inspect estimated fees for a given\n * transaction in detail first, then re-assemble it manually or via\n * {@link rpc.assembleTransaction}.\n *\n * @param tx - the transaction to\n * prepare. It should include exactly one operation, which must be one of\n * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTtlOp},\n * or {@link xdr.RestoreFootprintOp}.\n *\n * Any provided footprint will be overwritten. However, if your operation\n * has existing auth entries, they will be preferred over ALL auth entries\n * from the simulation. In other words, if you include auth entries, you\n * don't care about the auth returned from the simulation. Other fields\n * (footprint, etc.) will be filled as normal.\n * @returns A copy of the\n * transaction with the expected authorizations (in the case of\n * invocation), resources, and ledger footprints added. The transaction fee\n * will also automatically be padded with the contract's minimum resource\n * fees discovered from the simulation.\n * @throws * If simulation fails\n *\n * @see module:rpc.assembleTransaction\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction | simulateTransaction docs}\n *\n * @example\n * ```ts\n * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';\n * const contract = new StellarSdk.Contract(contractId);\n *\n * // Right now, this is just the default fee for this example.\n * const fee = StellarSdk.BASE_FEE;\n * const transaction = new StellarSdk.TransactionBuilder(account, { fee })\n * // Uncomment the following line to build transactions for the live network. Be\n * // sure to also change the horizon hostname.\n * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)\n * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)\n * .setTimeout(30) // valid for the next 30s\n * // Add an operation to call increment() on the contract\n * .addOperation(contract.call(\"increment\"))\n * .build();\n *\n * const preparedTransaction = await server.prepareTransaction(transaction);\n *\n * // Sign this transaction with the secret key\n * // NOTE: signing is transaction is network specific. Test network transactions\n * // won't work in the public network. To switch networks, use the Network object\n * // as explained above (look for StellarSdk.Network).\n * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);\n * preparedTransaction.sign(sourceKeypair);\n *\n * server.sendTransaction(transaction).then(result => {\n * console.log(\"hash:\", result.hash);\n * console.log(\"status:\", result.status);\n * console.log(\"errorResultXdr:\", result.errorResultXdr);\n * });\n * ```\n */\n public async prepareTransaction(tx: Transaction | FeeBumpTransaction) {\n const simResponse = await this.simulateTransaction(tx);\n if (Api.isSimulationError(simResponse)) {\n throw new Error(simResponse.error);\n }\n\n return assembleTransaction(tx, simResponse).build();\n }\n\n /**\n * Submit a real transaction to the Stellar network.\n *\n * Unlike Horizon, RPC does not wait for transaction completion. It\n * simply validates the transaction and enqueues it. Clients should call\n * {@link rpc.Server.getTransaction} to learn about transaction\n * success/failure.\n *\n * @param transaction - to submit\n * @returns the\n * transaction id, status, and any error if available\n *\n * @see {@link https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/operations-and-transactions | transaction docs}\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/sendTransaction | sendTransaction docs}\n *\n * @example\n * ```ts\n * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';\n * const contract = new StellarSdk.Contract(contractId);\n *\n * // Right now, this is just the default fee for this example.\n * const fee = StellarSdk.BASE_FEE;\n * const transaction = new StellarSdk.TransactionBuilder(account, { fee })\n * // Uncomment the following line to build transactions for the live network. Be\n * // sure to also change the horizon hostname.\n * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)\n * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)\n * .setTimeout(30) // valid for the next 30s\n * // Add an operation to call increment() on the contract\n * .addOperation(contract.call(\"increment\"))\n * .build();\n *\n * // Sign this transaction with the secret key\n * // NOTE: signing is transaction is network specific. Test network transactions\n * // won't work in the public network. To switch networks, use the Network object\n * // as explained above (look for StellarSdk.Network).\n * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);\n * transaction.sign(sourceKeypair);\n *\n * server.sendTransaction(transaction).then((result) => {\n * console.log(\"hash:\", result.hash);\n * console.log(\"status:\", result.status);\n * console.log(\"errorResultXdr:\", result.errorResultXdr);\n * });\n * ```\n */\n public async sendTransaction(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<Api.SendTransactionResponse> {\n return this._sendTransaction(transaction).then(parseRawSendTransaction);\n }\n\n public async _sendTransaction(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<Api.RawSendTransactionResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"sendTransaction\",\n {\n transaction: transaction.toXDR(),\n },\n );\n }\n\n /**\n * Fund a new account using the network's Friendbot faucet, if any.\n *\n * @param address - The address or account instance that we\n * want to create and fund with Friendbot\n * @param friendbotUrl - (optional) Optionally, an explicit address for\n * friendbot (by default: this calls the Soroban RPC\n * {@link rpc.Server.getNetwork | getNetwork} method to try to\n * discover this network's Friendbot url).\n * @returns An {@link Account} object for the created\n * account, or the existing account if it's already funded with the\n * populated sequence number (note that the account will not be \"topped\n * off\" if it already exists)\n * @throws If Friendbot is not configured on this network or request failure\n *\n * @see {@link https://developers.stellar.org/docs/learn/fundamentals/networks#friendbot | Friendbot docs}\n * @see {@link Friendbot.Api.Response}\n *\n * @deprecated Use {@link Server.fundAddress} instead, which supports both\n * account (G...) and contract (C...) addresses.\n *\n * @example\n * ```ts\n * server\n * .requestAirdrop(\"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\")\n * .then((accountCreated) => {\n * console.log(\"accountCreated:\", accountCreated);\n * }).catch((error) => {\n * console.error(\"error:\", error);\n * });\n * ```\n */\n public async requestAirdrop(\n address: string | Pick<Account, \"accountId\">,\n friendbotUrl?: string,\n ): Promise<Account> {\n const account = typeof address === \"string\" ? address : address.accountId();\n friendbotUrl = friendbotUrl || (await this.getNetwork()).friendbotUrl;\n if (!friendbotUrl) {\n throw new Error(\"No friendbot URL configured for current network\");\n }\n\n try {\n const response = await this.httpClient.post<FriendbotApi.Response>(\n `${friendbotUrl}?addr=${encodeURIComponent(account)}`,\n );\n\n let meta: xdr.TransactionMeta;\n if (!response.data.result_meta_xdr) {\n const txMeta = await this.getTransaction(response.data.hash);\n if (txMeta.status !== Api.GetTransactionStatus.SUCCESS) {\n throw new Error(`Funding account ${address} failed`);\n }\n meta = txMeta.resultMetaXdr;\n } else {\n meta = xdr.TransactionMeta.fromXDR(\n response.data.result_meta_xdr,\n \"base64\",\n );\n }\n\n const sequence = findCreatedAccountSequenceInTransactionMeta(meta);\n return new Account(account, sequence);\n } catch (error: any) {\n if (error.response?.status === 400) {\n if (\n error.response.data?.detail?.includes(\"createAccountAlreadyExist\")\n ) {\n // Account already exists, load the sequence number\n return this.getAccount(account);\n }\n }\n throw error;\n }\n }\n\n /**\n * Fund an address using the network's Friendbot faucet, if any.\n *\n * This method supports both account (G...) and contract (C...) addresses.\n *\n * @param address - The address to fund. Can be either a Stellar\n * account (G...) or contract (C...) address.\n * @param friendbotUrl - (optional) Optionally, an explicit Friendbot URL\n * (by default: this calls the Stellar RPC\n * {@link rpc.Server.getNetwork | getNetwork} method to try to\n * discover this network's Friendbot url).\n * @returns The transaction\n * response from the Friendbot funding transaction.\n * @throws If Friendbot is not configured on this network or the\n * funding transaction fails.\n *\n * @see {@link https://developers.stellar.org/docs/learn/fundamentals/networks#friendbot | Friendbot docs}\n *\n * @example\n * ```ts\n * // Funding an account (G... address)\n * const tx = await server.fundAddress(\"GBZC6Y2Y7...\");\n * console.log(\"Funded! Hash:\", tx.txHash);\n * // If you need the Account object:\n * const account = await server.getAccount(\"GBZC6Y2Y7...\");\n * ```\n *\n * @example\n * ```ts\n * // Funding a contract (C... address)\n * const tx = await server.fundAddress(\"CBZC6Y2Y7...\");\n * console.log(\"Contract funded! Hash:\", tx.txHash);\n * ```\n */\n public async fundAddress(\n address: string,\n friendbotUrl?: string,\n ): Promise<Api.GetSuccessfulTransactionResponse> {\n if (\n !StrKey.isValidEd25519PublicKey(address) &&\n !StrKey.isValidContract(address)\n ) {\n throw new Error(\n `Invalid address: ${address}. Expected a Stellar account (G...) or contract (C...) address.`,\n );\n }\n\n friendbotUrl = friendbotUrl || (await this.getNetwork()).friendbotUrl;\n if (!friendbotUrl) {\n throw new Error(\"No friendbot URL configured for current network\");\n }\n\n try {\n const response = await this.httpClient.post<FriendbotApi.Response>(\n `${friendbotUrl}?addr=${encodeURIComponent(address)}`,\n );\n\n const txResponse = await this.getTransaction(response.data.hash);\n if (txResponse.status !== Api.GetTransactionStatus.SUCCESS) {\n throw new Error(\n `Funding address ${address} failed: transaction status ${txResponse.status}`,\n );\n }\n\n return txResponse;\n } catch (error: any) {\n if (error.response?.status === 400) {\n throw new Error(error.response.data?.detail ?? \"Bad Request\");\n }\n throw error;\n }\n }\n\n /**\n * Provides an analysis of the recent fee stats for regular and smart\n * contract operations.\n *\n * @returns the fee stats\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getFeeStats\n */\n public async getFeeStats(): Promise<Api.GetFeeStatsResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getFeeStats\",\n );\n }\n\n /**\n * Provides information about the current version details of the Soroban RPC and captive-core\n *\n * @returns the version info\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getVersionInfo\n */\n public async getVersionInfo(): Promise<Api.GetVersionInfoResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getVersionInfo\",\n );\n }\n\n /**\n * Returns a contract's balance of a particular SAC asset, if any.\n *\n * This is a convenience wrapper around {@link Server.getLedgerEntries}.\n *\n * @param address - the contract (string `C...`) whose balance of\n * `sac` you want to know\n * @param sac - the built-in SAC token (e.g. `USDC:GABC...`) that\n * you are querying from the given `contract`.\n * @param networkPassphrase - (optional) optionally, the network passphrase to\n * which this token applies. If omitted, a request about network\n * information will be made (see {@link getNetwork}), since contract IDs\n * for assets are specific to a network. You can refer to {@link Networks}\n * for a list of built-in passphrases, e.g., `Networks.TESTNET`.\n *\n * @returns , which will contain the balance\n * entry details if and only if the request returned a valid balance ledger\n * entry. If it doesn't, the `balanceEntry` field will not exist.\n *\n * @throws If `address` is not a valid contract ID (C...).\n *\n * @see getLedgerEntries\n * @see https://developers.stellar.org/docs/tokens/stellar-asset-contract\n *\n * @deprecated Use {@link getAssetBalance}, instead\n * @example\n * ```ts\n * // assume `address` is some contract or account with an XLM balance\n * // assume server is an instantiated `Server` instance.\n * const entry = (await server.getSACBalance(\n * new Address(address),\n * Asset.native(),\n * Networks.PUBLIC\n * ));\n *\n * // assumes BigInt support:\n * console.log(\n * entry.balanceEntry ?\n * BigInt(entry.balanceEntry.amount) :\n * \"Address has no XLM\");\n * ```\n */\n public async getSACBalance(\n address: string | Address,\n sac: Asset,\n networkPassphrase?: string,\n ): Promise<Api.BalanceResponse> {\n const addressString =\n address instanceof Address ? address.toString() : address;\n\n if (!StrKey.isValidContract(addressString)) {\n throw new TypeError(`expected contract ID, got ${addressString}`);\n }\n\n // Call out to RPC if passphrase isn't provided.\n const passphrase: string =\n networkPassphrase ?? (await this.getNetwork().then((n) => n.passphrase));\n\n // Turn SAC into predictable contract ID\n const sacId = sac.contractId(passphrase);\n\n // Rust union enum type with \"Balance(ScAddress)\" structure\n const key = nativeToScVal([\"Balance\", addressString], {\n type: [\"symbol\", \"address\"],\n });\n\n // Note a quirk here: the contract address in the key is the *token*\n // rather than the *holding contract*. This is because each token stores a\n // balance entry for each contract, not the other way around (i.e. XLM\n // holds a reserve for contract X, rather that contract X having a balance\n // of N XLM).\n const ledgerKey = xdr.LedgerKey.contractData(\n new xdr.LedgerKeyContractData({\n contract: new Address(sacId).toScAddress(),\n durability: xdr.ContractDataDurability.persistent(),\n key,\n }),\n );\n\n const response = await this.getLedgerEntries(ledgerKey);\n if (response.entries.length === 0) {\n return { latestLedger: response.latestLedger };\n }\n\n const { lastModifiedLedgerSeq, liveUntilLedgerSeq, val } =\n response.entries[0];\n\n if (val.switch().value !== xdr.LedgerEntryType.contractData().value) {\n return { latestLedger: response.latestLedger };\n }\n\n const entry = scValToNative(val.contractData().val());\n\n // Since we are requesting a SAC's contract data, we know for a fact that\n // it should follow the expected structure format. Thus, we can presume\n // these fields exist:\n return {\n latestLedger: response.latestLedger,\n balanceEntry: {\n liveUntilLedgerSeq,\n lastModifiedLedgerSeq,\n amount: entry.amount.toString(),\n authorized: entry.authorized,\n clawback: entry.clawback,\n },\n };\n }\n\n /**\n * Fetch a detailed list of ledgers starting from a specified point.\n *\n * Returns ledger data with support for pagination as long as the requested\n * pages fall within the history retention of the RPC provider.\n *\n * @param request - The request parameters for fetching ledgers. {@link Api.GetLedgersRequest}\n * @returns A promise that resolves to the\n * ledgers response containing an array of ledger data and pagination info. {@link Api.GetLedgersResponse}\n *\n * @throws If startLedger is less than the oldest ledger stored in this\n * node, or greater than the latest ledger seen by this node.\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers docs}\n *\n * @example\n * ```ts\n * // Fetch ledgers starting from a specific sequence number\n * server.getLedgers({\n * startLedger: 36233,\n * pagination: {\n * limit: 10\n * }\n * }).then((response) => {\n * console.log(\"Ledgers:\", response.ledgers);\n * console.log(\"Latest Ledger:\", response.latestLedger);\n * console.log(\"Cursor:\", response.cursor);\n * });\n * ```\n *\n * @example\n * ```ts\n * // Paginate through ledgers using cursor\n * const firstPage = await server.getLedgers({\n * startLedger: 36233,\n * pagination: {\n * limit: 5\n * }\n * });\n *\n * const nextPage = await server.getLedgers({\n * pagination: {\n * cursor: firstPage.cursor,\n * limit: 5\n * }\n * });\n * ```\n */\n\n public async getLedgers(\n request: Api.GetLedgersRequest,\n ): Promise<Api.GetLedgersResponse> {\n return this._getLedgers(request).then((raw) => {\n const result: Api.GetLedgersResponse = {\n ledgers: (raw.ledgers || []).map(parseRawLedger),\n latestLedger: raw.latestLedger,\n latestLedgerCloseTime: raw.latestLedgerCloseTime,\n oldestLedger: raw.oldestLedger,\n oldestLedgerCloseTime: raw.oldestLedgerCloseTime,\n cursor: raw.cursor,\n };\n return result;\n });\n }\n\n public async _getLedgers(\n request: Api.GetLedgersRequest,\n ): Promise<Api.RawGetLedgersResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getLedgers\",\n request,\n );\n }\n}\n"],"names":["Durability","xdr","jsonrpc.postObject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACL,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,YAAA,YAAA,CAAA,GAAa,YAAA;AAFH,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAsCZ,MAAM,+BAAA,GAA0C,EAAA;AAIzC,MAAM,kBAAA,GAAoC,CAAC,KAAA,KAAkB;AAG7D,MAAM,mBAAA,GAAqC,CAAC,IAAA,KAAiB,GAAA,GAAO;AAQ3E,SAAS,4CACP,IAAA,EACQ;AACR,EAAA,IAAI,aAAkC,EAAC;AACvC,EAAA,QAAQ,IAAA,CAAK,QAAO;AAAG,IACrB,KAAK,CAAA;AACH,MAAA,UAAA,GAAa,KAAK,UAAA,EAAW;AAC7B,MAAA;AAAA,IACF,KAAK,CAAA;AAAA,IACL,KAAK,CAAA;AAAA,IACL,KAAK,CAAA;AAAA,IACL,KAAK,CAAA;AACH,MAAA,UAAA,GAAc,IAAA,CAAK,KAAA,EAAM,CAA4B,UAAA,EAAW;AAChE,MAAA;AAAA,IACF;AACE,MAAA,MAAM,IAAI,MAAM,0CAA0C,CAAA;AAAA;AAE9D,EAAA,MAAM,cAAA,GAAiB,WACpB,OAAA,CAAQ,CAAC,OAAO,EAAA,CAAG,OAAA,EAAS,CAAA,CAC5B,IAAA;AAAA,IACC,CAAC,CAAA,KACC,CAAA,CAAE,QAAO,KAAMC,KAAA,CAAI,sBAAsB,kBAAA,EAAmB,IAC5D,CAAA,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AAY,KAAA,CAAM,UAAA;AAAA,QAClB,UAAU,KAAA,CAAM;AAAA;AAClB,KACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmDA,MAAa,WACX,OAAA,EACiC;AACjC,IAAA,OAAO,KAAK,WAAA,CAAY,OAAO,CAAA,CAAE,IAAA,CAAK,CAAC,GAAA,KAAQ;AAC7C,MAAA,MAAM,MAAA,GAAiC;AAAA,QACrC,UAAU,GAAA,CAAI,OAAA,IAAW,EAAC,EAAG,IAAI,cAAc,CAAA;AAAA,QAC/C,cAAc,GAAA,CAAI,YAAA;AAAA,QAClB,uBAAuB,GAAA,CAAI,qBAAA;AAAA,QAC3B,cAAc,GAAA,CAAI,YAAA;AAAA,QAClB,uBAAuB,GAAA,CAAI,qBAAA;AAAA,QAC3B,QAAQ,GAAA,CAAI;AAAA,OACd;AACA,MAAA,OAAO,MAAA;AAAA,IACT,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,MAAa,YACX,OAAA,EACoC;AACpC,IAAA,OAAOC,UAAQ;AAAA,MACb,IAAA,CAAK,UAAA;AAAA,MACL,IAAA,CAAK,UAAU,QAAA,EAAS;AAAA,MACxB,YAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"server.js","sources":["../../../src/rpc/server.ts"],"sourcesContent":["/* tslint:disable:variable-name no-namespace */\nimport {\n Account,\n Address,\n Asset,\n Contract,\n FeeBumpTransaction,\n Keypair,\n StrKey,\n Transaction,\n nativeToScVal,\n scValToNative,\n xdr,\n} from \"../base/index.js\";\n\nimport type { TransactionBuilder } from \"../base/index.js\";\nimport type { Config } from \"../config.js\";\nimport { createHttpClient } from \"./axios.js\";\nimport type { Api as FriendbotApi } from \"../friendbot/index.js\";\nimport * as jsonrpc from \"./jsonrpc.js\";\nimport { Api } from \"./api.js\";\nimport { assembleTransaction } from \"./transaction.js\";\nimport {\n parseRawSendTransaction,\n parseRawSimulation,\n parseRawLedgerEntries,\n parseRawEvents,\n parseRawTransactions,\n parseTransactionInfo,\n parseRawLedger,\n parseRawLatestLedger,\n} from \"./parsers.js\";\nimport { Utils } from \"../utils.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\n/**\n * Default transaction submission timeout for RPC requests, in milliseconds\n * @defaultValue 60000\n */\nexport const SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000;\n\n/**\n * Specifies the durability namespace of contract-related ledger entries.\n *\n * @see {@link https://developers.stellar.org/docs/learn/smart-contract-internals/state-archival | State Archival docs}\n * @see {@link https://docs.rs/soroban-sdk/latest/soroban_sdk/storage/struct.Storage.html | Rust SDK Storage docs}\n */\nexport enum Durability {\n Temporary = \"temporary\",\n Persistent = \"persistent\",\n}\n\nexport namespace RpcServer {\n /**\n * @deprecated Use `Api.GetEventsRequest` instead.\n * @see {@link Api.GetEventsRequest}\n */\n export type GetEventsRequest = Api.GetEventsRequest;\n\n export interface PollingOptions {\n attempts?: number;\n sleepStrategy?: SleepStrategy;\n }\n\n /**\n * Describes additional resource leeways for transaction simulation.\n */\n export interface ResourceLeeway {\n /** Simulate the transaction with more CPU instructions available. */\n cpuInstructions: number;\n }\n\n /**\n * Options for configuring connections to RPC servers.\n */\n export interface Options {\n /** Allow connecting to http servers, default: `false`. This must be set to false in production deployments! */\n allowHttp?: boolean;\n /** Allow a timeout, default: 0. Allows user to avoid nasty lag. */\n timeout?: number;\n /** Additional headers that should be added to any requests to the RPC server. */\n headers?: Record<string, string>;\n }\n}\n\nconst DEFAULT_GET_TRANSACTION_TIMEOUT: number = 30;\n\n/// A strategy that will sleep 1 second each time\n\nexport const BasicSleepStrategy: SleepStrategy = (_iter: number) => 1000;\n\n/// A strategy that will sleep 1 second longer on each attempt\nexport const LinearSleepStrategy: SleepStrategy = (iter: number) => 1000 * iter;\n\n/**\n * A function that returns the number of *milliseconds* to sleep\n * on a given `iter`ation.\n */\nexport type SleepStrategy = (iter: number) => number;\n\nfunction findCreatedAccountSequenceInTransactionMeta(\n meta: xdr.TransactionMeta,\n): string {\n let operations: xdr.OperationMeta[] = [];\n switch (meta.switch()) {\n case 0:\n operations = meta.operations();\n break;\n case 1:\n case 2:\n case 3:\n case 4: // all four have the same interface\n operations = (meta.value() as xdr.TransactionMetaV4).operations();\n break;\n default:\n throw new Error(\"Unexpected transaction meta switch value\");\n }\n const sequenceNumber = operations\n .flatMap((op) => op.changes())\n .find(\n (c) =>\n c.switch() === xdr.LedgerEntryChangeType.ledgerEntryCreated() &&\n c.created().data().switch() === xdr.LedgerEntryType.account(),\n )\n ?.created()\n ?.data()\n ?.account()\n ?.seqNum()\n ?.toString();\n\n if (sequenceNumber) {\n return sequenceNumber;\n }\n throw new Error(\"No account created in transaction\");\n}\n\n/**\n * Handles the network connection to a Soroban RPC instance, exposing an\n * interface for requests to that instance.\n *\n *\n * @param serverURL - Soroban-RPC Server URL (ex. `http://localhost:8000/soroban/rpc`).\n * @param opts - (optional) Options object\n * - `allowHttp` (optional): Allows connecting to insecure http servers\n * (default: `false`). This must be set to false in production deployments!\n * You can also use {@link Config} class to set this globally.\n * - `headers` (optional): Allows setting custom headers\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods | API reference docs}\n */\nexport class RpcServer {\n public readonly serverURL: URL;\n /**\n * HTTP client instance for making requests to Horizon.\n * Exposes interceptors, defaults, and other configuration options.\n *\n * @example\n * ```ts\n * // Add authentication header\n * server.httpClient.defaults.headers['Authorization'] = 'Bearer token';\n *\n * // Add request interceptor\n * server.httpClient.interceptors.request.use((config) => {\n * console.log('Request:', config.url);\n * return config;\n * });\n * ```\n */\n public readonly httpClient: HttpClient;\n constructor(serverURL: string, opts: RpcServer.Options = {}) {\n /**\n * RPC Server URL (ex. `http://localhost:8000/soroban/rpc`).\n */\n this.serverURL = new URL(serverURL);\n this.httpClient = createHttpClient(opts.headers);\n if (this.serverURL.protocol !== \"https:\" && !opts.allowHttp) {\n throw new Error(\n \"Cannot connect to insecure Soroban RPC server if `allowHttp` isn't set\",\n );\n }\n }\n\n /**\n * Fetch a minimal set of current info about a Stellar account.\n *\n * Needed to get the current sequence number for the account so you can build\n * a successful transaction with {@link TransactionBuilder}.\n *\n * @param address - The public address of the account to load.\n * @returns A promise which resolves to the {@link Account}\n * object with a populated sequence number\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const accountId = \"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\";\n * server.getAccount(accountId).then((account) => {\n * console.log(\"sequence:\", account.sequence);\n * });\n * ```\n */\n public async getAccount(address: string): Promise<Account> {\n const entry = await this.getAccountEntry(address);\n return new Account(address, entry.seqNum().toString());\n }\n\n /**\n * Fetch the full account entry for a Stellar account.\n *\n * @param address - The public address of the account to load.\n * @returns Resolves to the full on-chain account\n * entry\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const accountId = \"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\";\n * server.getAccountEntry(accountId).then((account) => {\n * console.log(\"sequence:\", account.balance().toString());\n * });\n * ```\n */\n public async getAccountEntry(address: string): Promise<xdr.AccountEntry> {\n const ledgerKey = xdr.LedgerKey.account(\n new xdr.LedgerKeyAccount({\n accountId: Keypair.fromPublicKey(address).xdrPublicKey(),\n }),\n );\n\n try {\n const resp = await this.getLedgerEntry(ledgerKey);\n return resp.val.account();\n } catch {\n throw new Error(`Account not found: ${address}`);\n }\n }\n\n /**\n * Fetch the full trustline entry for a Stellar account.\n *\n * @param account - The public address of the account whose trustline it is\n * @param asset - The trustline's asset\n * @returns Resolves to the full on-chain trustline\n * entry\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @deprecated Use {@link getAssetBalance}, instead\n * @example\n * ```ts\n * const accountId = \"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\";\n * const asset = new Asset(\n * \"USDC\",\n * \"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5\"\n * );\n * server.getTrustline(accountId, asset).then((entry) => {\n * console.log(`{asset.toString()} balance for ${accountId}:\", entry.balance().toString());\n * });\n * ```\n */\n public async getTrustline(\n account: string,\n asset: Asset,\n ): Promise<xdr.TrustLineEntry> {\n const trustlineLedgerKey = xdr.LedgerKey.trustline(\n new xdr.LedgerKeyTrustLine({\n accountId: Keypair.fromPublicKey(account).xdrAccountId(),\n asset: asset.toTrustLineXDRObject(),\n }),\n );\n\n try {\n const entry = await this.getLedgerEntry(trustlineLedgerKey);\n return entry.val.trustLine();\n } catch {\n throw new Error(\n `Trustline for ${asset.getCode()}:${asset.getIssuer()} not found for ${account}`,\n );\n }\n }\n\n /**\n * Fetch the full claimable balance entry for a Stellar account.\n *\n * @param id - The strkey (`B...`) or hex (`00000000abcde...`) (both\n * IDs with and without the 000... version prefix are accepted) of the\n * claimable balance to load\n * @returns Resolves to the full on-chain\n * claimable balance entry\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const id = \"00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9\";\n * server.getClaimableBalance(id).then((entry) => {\n * console.log(`Claimable balance {id.substr(0, 12)} has:`);\n * console.log(` asset: ${Asset.fromXDRObject(entry.asset()).toString()}`;\n * console.log(` amount: ${entry.amount().toString()}`;\n * });\n * ```\n */\n public async getClaimableBalance(\n id: string,\n ): Promise<xdr.ClaimableBalanceEntry> {\n let balanceId;\n if (StrKey.isValidClaimableBalance(id)) {\n let buffer = StrKey.decodeClaimableBalance(id);\n\n // Pad the version byte to be a full int32 like in the XDR spec\n let v = Buffer.concat([\n Buffer.from(\"\\x00\\x00\\x00\"),\n buffer.subarray(0, 1),\n ]);\n\n // Slap on the rest of it and decode it\n balanceId = xdr.ClaimableBalanceId.fromXDR(\n Buffer.concat([v, buffer.subarray(1)]),\n );\n } else if (id.match(/[a-f0-9]{72}/i)) {\n balanceId = xdr.ClaimableBalanceId.fromXDR(id, \"hex\");\n } else if (id.match(/[a-f0-9]{64}/i)) {\n balanceId = xdr.ClaimableBalanceId.fromXDR(id.padStart(72, \"0\"), \"hex\");\n } else {\n throw new TypeError(`expected 72-char hex ID or strkey, not ${id}`);\n }\n\n const trustlineLedgerKey = xdr.LedgerKey.claimableBalance(\n new xdr.LedgerKeyClaimableBalance({ balanceId }),\n );\n\n try {\n const entry = await this.getLedgerEntry(trustlineLedgerKey);\n return entry.val.claimableBalance();\n } catch {\n throw new Error(`Claimable balance ${id} not found`);\n }\n }\n\n /**\n * Fetch the balance of an asset held by an account or contract.\n *\n * The `address` argument may be provided as a string (as a {@link StrKey}),\n * {@link Address}, or {@link Contract}.\n *\n * @param address - The account or contract whose\n * balance should be fetched.\n * @param asset - The asset whose balance you want to inspect.\n * @param networkPassphrase - (optional) optionally, when requesting the\n * balance of a contract, the network passphrase to which this token\n * applies. If omitted and necessary, a request about network information\n * will be made (see {@link getNetwork}), since contract IDs for assets are\n * specific to a network. You can refer to {@link Networks} for a list of\n * built-in passphrases, e.g., `Networks.TESTNET`.\n * @returns Resolves with balance entry details\n * when available.\n *\n * @throws If the supplied `address` is not a valid account or\n * contract strkey.\n *\n * @example\n * ```ts\n * const usdc = new Asset(\n * \"USDC\",\n * \"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5\"\n * );\n * const balance = await server.getAssetBalance(\"GD...\", usdc);\n * console.log(balance.balanceEntry?.amount);\n * ```\n */\n public async getAssetBalance(\n address: string | Address | Contract,\n asset: Asset,\n networkPassphrase?: string,\n ): Promise<Api.BalanceResponse> {\n let addr: string = address as string;\n // Coalesce to a strkey\n if (typeof address === \"string\") {\n addr = address;\n } else if (address instanceof Address) {\n addr = address.toString();\n } else if (address instanceof Contract) {\n addr = address.toString();\n } else {\n // shouldn't happen, but be defensive\n throw new TypeError(`invalid address: ${address}`);\n }\n\n if (StrKey.isValidEd25519PublicKey(addr)) {\n const [tl, ll] = await Promise.all([\n this.getTrustline(addr, asset),\n this.getLatestLedger(),\n ]);\n\n return {\n latestLedger: ll.sequence,\n balanceEntry: {\n amount: tl.balance().toString(),\n // Extract actual flags from the coalesced value.\n authorized: Boolean(tl.flags() & 0x1), // AUTHORIZED_FLAG\n clawback: Boolean(tl.flags() & 0x4), // TRUSTLINE_CLAWBACK_ENABLED_FLAG\n authorizedToMaintainLiabilities: Boolean(tl.flags() & 0x2), // AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG\n revocable: Boolean(tl.flags() & 0x2), // AUTHORIZED_TO_MAINTAIN_LIABILITIES_FLAG (deprecated, will be removed in a future major release)\n },\n };\n } else if (StrKey.isValidContract(addr)) {\n return this.getSACBalance(addr, asset, networkPassphrase);\n }\n\n throw new Error(`invalid address: ${address}`);\n }\n\n /**\n * General node health check.\n *\n * @returns A promise which resolves to the\n * {@link Api.GetHealthResponse} object with the status of the\n * server (e.g. \"healthy\").\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getHealth | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * server.getHealth().then((health) => {\n * console.log(\"status:\", health.status);\n * });\n * ```\n */\n\n public async getHealth(): Promise<Api.GetHealthResponse> {\n return jsonrpc.postObject<Api.GetHealthResponse>(\n this.httpClient,\n this.serverURL.toString(),\n \"getHealth\",\n );\n }\n\n /**\n * Reads the current value of contract data ledger entries directly.\n *\n * Allows you to directly inspect the current state of a contract. This is a\n * backup way to access your contract data which may not be available via\n * events or {@link rpc.Server.simulateTransaction}.\n *\n * @param contract - The contract ID containing the\n * data to load as a strkey (`C...` form), a {@link Contract}, or an\n * {@link Address} instance\n * @param key - The key of the contract data to load\n * @param durability - (optional) The \"durability\n * keyspace\" that this ledger key belongs to, which is either 'temporary'\n * or 'persistent' (the default), see {@link rpc.Durability}.\n * @returns The current data value\n *\n * **Warning:** If the data entry in question is a 'temporary' entry, it's\n * entirely possible that it has expired out of existence.\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n *\n * @example\n * ```ts\n * const contractId = \"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5\";\n * const key = xdr.ScVal.scvSymbol(\"counter\");\n * server.getContractData(contractId, key, Durability.Temporary).then(data => {\n * console.log(\"value:\", data.val);\n * console.log(\"liveUntilLedgerSeq:\", data.liveUntilLedgerSeq);\n * console.log(\"lastModified:\", data.lastModifiedLedgerSeq);\n * console.log(\"latestLedger:\", data.latestLedger);\n * });\n * ```\n */\n\n public async getContractData(\n contract: string | Address | Contract,\n key: xdr.ScVal,\n durability: Durability = Durability.Persistent,\n ): Promise<Api.LedgerEntryResult> {\n // coalesce `contract` param variants to an ScAddress\n let scAddress: xdr.ScAddress;\n if (typeof contract === \"string\") {\n scAddress = new Contract(contract).address().toScAddress();\n } else if (contract instanceof Address) {\n scAddress = contract.toScAddress();\n } else if (contract instanceof Contract) {\n scAddress = contract.address().toScAddress();\n } else {\n throw new TypeError(`unknown contract type: ${contract}`);\n }\n\n let xdrDurability: xdr.ContractDataDurability;\n switch (durability) {\n case Durability.Temporary:\n xdrDurability = xdr.ContractDataDurability.temporary();\n break;\n\n case Durability.Persistent:\n xdrDurability = xdr.ContractDataDurability.persistent();\n break;\n\n default:\n throw new TypeError(`invalid durability: ${durability}`);\n }\n\n const contractKey = xdr.LedgerKey.contractData(\n new xdr.LedgerKeyContractData({\n key,\n contract: scAddress,\n durability: xdrDurability,\n }),\n );\n\n try {\n return await this.getLedgerEntry(contractKey);\n } catch {\n throw {\n code: 404,\n message: `Contract data not found for ${Address.fromScAddress(\n scAddress,\n ).toString()} with key ${key.toXDR(\"base64\")} and durability: ${durability}`,\n };\n }\n }\n\n /**\n * Retrieves the WASM bytecode for a given contract.\n *\n * This method allows you to fetch the WASM bytecode associated with a contract\n * deployed on the Soroban network. The WASM bytecode represents the executable\n * code of the contract.\n *\n * @param contractId - The contract ID containing the WASM bytecode to retrieve\n * @returns A Buffer containing the WASM bytecode\n * @throws If the contract or its associated WASM bytecode cannot be\n * found on the network.\n *\n * @example\n * ```ts\n * const contractId = \"CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5\";\n * server.getContractWasmByContractId(contractId).then(wasmBuffer => {\n * console.log(\"WASM bytecode length:\", wasmBuffer.length);\n * // ... do something with the WASM bytecode ...\n * }).catch(err => {\n * console.error(\"Error fetching WASM bytecode:\", err);\n * });\n * ```\n */\n public async getContractWasmByContractId(\n contractId: string,\n ): Promise<Buffer> {\n const contractLedgerKey = new Contract(contractId).getFootprint();\n const response = await this.getLedgerEntries(contractLedgerKey);\n if (!response.entries.length || !response.entries[0]?.val) {\n return Promise.reject({\n code: 404,\n message: `Could not obtain contract hash from server`,\n });\n }\n\n const wasmHash = response.entries[0].val\n .contractData()\n .val()\n .instance()\n .executable()\n .wasmHash();\n\n return this.getContractWasmByHash(wasmHash);\n }\n\n /**\n * Retrieves the WASM bytecode for a given contract hash.\n *\n * This method allows you to fetch the WASM bytecode associated with a contract\n * deployed on the Soroban network using the contract's WASM hash. The WASM bytecode\n * represents the executable code of the contract.\n *\n * @param wasmHash - The WASM hash of the contract\n * @returns A Buffer containing the WASM bytecode\n * @throws If the contract or its associated WASM bytecode cannot be\n * found on the network.\n *\n * @example\n * ```ts\n * const wasmHash = Buffer.from(\"...\");\n * server.getContractWasmByHash(wasmHash).then(wasmBuffer => {\n * console.log(\"WASM bytecode length:\", wasmBuffer.length);\n * // ... do something with the WASM bytecode ...\n * }).catch(err => {\n * console.error(\"Error fetching WASM bytecode:\", err);\n * });\n * ```\n */\n public async getContractWasmByHash(\n wasmHash: Buffer | string,\n format: undefined | \"hex\" | \"base64\" = undefined,\n ): Promise<Buffer> {\n const wasmHashBuffer =\n typeof wasmHash === \"string\"\n ? Buffer.from(wasmHash, format)\n : (wasmHash as Buffer);\n\n const ledgerKeyWasmHash = xdr.LedgerKey.contractCode(\n new xdr.LedgerKeyContractCode({\n hash: wasmHashBuffer,\n }),\n );\n\n const responseWasm = await this.getLedgerEntries(ledgerKeyWasmHash);\n if (!responseWasm.entries.length || !responseWasm.entries[0]?.val) {\n return Promise.reject({\n code: 404,\n message: \"Could not obtain contract wasm from server\",\n });\n }\n const wasmBuffer = responseWasm.entries[0].val.contractCode().code();\n\n return wasmBuffer;\n }\n\n /**\n * Reads the current value of arbitrary ledger entries directly.\n *\n * Allows you to directly inspect the current state of contracts, contract's\n * code, accounts, or any other ledger entries.\n *\n * To fetch a contract's WASM byte-code, built the appropriate\n * {@link xdr.LedgerKeyContractCode} ledger entry key (or see\n * {@link Contract.getFootprint}).\n *\n * @param keys - One or more ledger entry keys to load\n * @returns The current on-chain\n * values for the given ledger keys\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries | getLedgerEntries docs}\n * @see RpcServer._getLedgerEntries\n * @example\n * ```ts\n * const contractId = \"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM\";\n * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({\n * contractId: StrKey.decodeContract(contractId),\n * key: xdr.ScVal.scvSymbol(\"counter\"),\n * }));\n *\n * server.getLedgerEntries([key]).then(response => {\n * const ledgerData = response.entries[0];\n * console.log(\"key:\", ledgerData.key);\n * console.log(\"value:\", ledgerData.val);\n * console.log(\"liveUntilLedgerSeq:\", ledgerData.liveUntilLedgerSeq);\n * console.log(\"lastModified:\", ledgerData.lastModifiedLedgerSeq);\n * console.log(\"latestLedger:\", response.latestLedger);\n * });\n * ```\n */\n public getLedgerEntries(...keys: xdr.LedgerKey[]) {\n return this._getLedgerEntries(...keys).then(parseRawLedgerEntries);\n }\n\n public _getLedgerEntries(...keys: xdr.LedgerKey[]) {\n return jsonrpc.postObject<Api.RawGetLedgerEntriesResponse>(\n this.httpClient,\n this.serverURL.toString(),\n \"getLedgerEntries\",\n {\n keys: keys.map((k) => k.toXDR(\"base64\")),\n },\n );\n }\n\n public async getLedgerEntry(key: xdr.LedgerKey) {\n const results = await this._getLedgerEntries(key).then(\n parseRawLedgerEntries,\n );\n if (results.entries.length !== 1) {\n throw new Error(`failed to find an entry for key ${key.toXDR(\"base64\")}`);\n }\n return results.entries[0];\n }\n\n /**\n * Poll for a particular transaction with certain parameters.\n *\n * After submitting a transaction, clients can use this to poll for\n * transaction completion and return a definitive state of success or failure.\n *\n * @param hash - the transaction you're polling for\n * @param opts - (optional) polling options\n * - `attempts` (optional): (optional) the number of attempts to make\n * before returning the last-seen status. By default or on invalid inputs,\n * try 5 times.\n * - `sleepStrategy` (optional): (optional) the amount of time\n * to wait for between each attempt. By default, sleep for 1 second between\n * each attempt.\n *\n * @returns the response after a \"found\"\n * response (which may be success or failure) or the last response obtained\n * after polling the maximum number of specified attempts.\n *\n * @example\n * ```ts\n * const h = \"c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a\";\n * const txStatus = await server.pollTransaction(h, {\n * attempts: 100, // I'm a maniac\n * sleepStrategy: rpc.LinearSleepStrategy\n * }); // this will take 5,050 seconds to complete\n * ```\n */\n public async pollTransaction(\n hash: string,\n opts?: RpcServer.PollingOptions,\n ): Promise<Api.GetTransactionResponse> {\n const maxAttempts: number =\n (opts?.attempts ?? 0) < 1\n ? DEFAULT_GET_TRANSACTION_TIMEOUT\n : (opts?.attempts ?? DEFAULT_GET_TRANSACTION_TIMEOUT); // \"positive and defined user value or default\"\n\n let foundInfo: Api.GetTransactionResponse;\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n foundInfo = await this.getTransaction(hash);\n if (foundInfo.status !== Api.GetTransactionStatus.NOT_FOUND) {\n return foundInfo;\n }\n\n await Utils.sleep((opts?.sleepStrategy ?? BasicSleepStrategy)(attempt));\n }\n\n return foundInfo!;\n }\n\n /**\n * Fetch the details of a submitted transaction.\n *\n * After submitting a transaction, clients should poll this to tell when the\n * transaction has completed.\n *\n * @param hash - Hex-encoded hash of the transaction to check\n * @returns The status, result, and\n * other details about the transaction\n *\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction | getTransaction docs}\n *\n * @example\n * ```ts\n * const transactionHash = \"c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a\";\n * server.getTransaction(transactionHash).then((tx) => {\n * console.log(\"status:\", tx.status);\n * console.log(\"envelopeXdr:\", tx.envelopeXdr);\n * console.log(\"resultMetaXdr:\", tx.resultMetaXdr);\n * console.log(\"resultXdr:\", tx.resultXdr);\n * });\n * ```\n */\n\n public async getTransaction(\n hash: string,\n ): Promise<Api.GetTransactionResponse> {\n return this._getTransaction(hash).then((raw) => {\n const foundInfo: Omit<\n Api.GetSuccessfulTransactionResponse,\n keyof Api.GetMissingTransactionResponse\n > = {} as any;\n\n if (raw.status !== Api.GetTransactionStatus.NOT_FOUND) {\n Object.assign(foundInfo, parseTransactionInfo(raw));\n }\n\n const result: Api.GetTransactionResponse = {\n status: raw.status,\n txHash: hash,\n latestLedger: raw.latestLedger,\n latestLedgerCloseTime: raw.latestLedgerCloseTime,\n oldestLedger: raw.oldestLedger,\n oldestLedgerCloseTime: raw.oldestLedgerCloseTime,\n ...foundInfo,\n };\n\n return result;\n });\n }\n\n public async _getTransaction(\n hash: string,\n ): Promise<Api.RawGetTransactionResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getTransaction\",\n {\n hash,\n },\n );\n }\n\n /**\n * Fetch transactions starting from a given start ledger or a cursor. The end ledger is the latest ledger\n * in that RPC instance.\n *\n * @param request - The request parameters.\n * @returns - A promise that resolves to the transactions response.\n *\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransactions\n * @example\n * ```ts\n * server.getTransactions({\n * startLedger: 10000,\n * limit: 10,\n * }).then((response) => {\n * console.log(\"Transactions:\", response.transactions);\n * console.log(\"Latest Ledger:\", response.latestLedger);\n * console.log(\"Cursor:\", response.cursor);\n * });\n * ```\n */\n public async getTransactions(\n request: Api.GetTransactionsRequest,\n ): Promise<Api.GetTransactionsResponse> {\n return this._getTransactions(request).then(\n (raw: Api.RawGetTransactionsResponse) => {\n const result: Api.GetTransactionsResponse = {\n transactions: (raw.transactions || []).map(parseRawTransactions),\n latestLedger: raw.latestLedger,\n latestLedgerCloseTimestamp: raw.latestLedgerCloseTimestamp,\n oldestLedger: raw.oldestLedger,\n oldestLedgerCloseTimestamp: raw.oldestLedgerCloseTimestamp,\n cursor: raw.cursor,\n };\n return result;\n },\n );\n }\n\n async _getTransactions(\n request: Api.GetTransactionsRequest,\n ): Promise<Api.RawGetTransactionsResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getTransactions\",\n request,\n );\n }\n\n /**\n * Fetch all events that match a given set of filters.\n *\n * The given filters (see {@link Api.EventFilter}\n * for detailed fields) are combined only in a logical OR fashion, and all of\n * the fields in each filter are optional.\n *\n * To page through events, use the `pagingToken` field on the relevant\n * {@link Api.EventResponse} object to set the `cursor` parameter.\n *\n * @param request - Event filters {@link Api.GetEventsRequest},\n * @returns A paginatable set of the events\n * matching the given event filters\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents docs}\n *\n * @example\n * ```ts\n *\n * server.getEvents({\n * startLedger: 1000,\n * endLedger: 2000,\n * filters: [\n * {\n * type: \"contract\",\n * contractIds: [ \"deadb33f...\" ],\n * topics: [[ \"AAAABQAAAAh0cmFuc2Zlcg==\", \"AAAAAQB6Mcc=\", \"*\" ]]\n * }, {\n * type: \"system\",\n * contractIds: [ \"...c4f3b4b3...\" ],\n * topics: [[ \"*\" ], [ \"*\", \"AAAAAQB6Mcc=\" ]]\n * }, {\n * contractIds: [ \"...c4f3b4b3...\" ],\n * topics: [[ \"AAAABQAAAAh0cmFuc2Zlcg==\" ]]\n * }, {\n * type: \"diagnostic\",\n * topics: [[ \"AAAAAQB6Mcc=\" ]]\n * }\n * ],\n * limit: 10,\n * });\n * ```\n */\n\n public async getEvents(\n request: Api.GetEventsRequest,\n ): Promise<Api.GetEventsResponse> {\n return this._getEvents(request).then(parseRawEvents);\n }\n\n public async _getEvents(\n request: Api.GetEventsRequest,\n ): Promise<Api.RawGetEventsResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getEvents\",\n {\n filters: request.filters ?? [],\n pagination: {\n ...(request.cursor && { cursor: request.cursor }), // add if defined\n ...(request.limit && { limit: request.limit }),\n },\n ...(request.startLedger && {\n startLedger: request.startLedger,\n }),\n ...(request.endLedger && {\n endLedger: request.endLedger,\n }),\n },\n );\n }\n\n /**\n * Fetch metadata about the network this Soroban RPC server is connected to.\n *\n * @returns Metadata about the current\n * network this RPC server is connected to\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork | getNetwork docs}\n *\n * @example\n * ```ts\n * server.getNetwork().then((network) => {\n * console.log(\"friendbotUrl:\", network.friendbotUrl);\n * console.log(\"passphrase:\", network.passphrase);\n * console.log(\"protocolVersion:\", network.protocolVersion);\n * });\n * ```\n */\n\n public async getNetwork(): Promise<Api.GetNetworkResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getNetwork\",\n );\n }\n\n /**\n * Fetch the latest ledger meta info from network which this Soroban RPC\n * server is connected to.\n *\n * @returns metadata about the\n * latest ledger on the network that this RPC server is connected to\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger | getLatestLedger docs}\n *\n * @example\n * ```ts\n * server.getLatestLedger().then((response) => {\n * console.log(\"hash:\", response.id);\n * console.log(\"sequence:\", response.sequence);\n * console.log(\"protocolVersion:\", response.protocolVersion);\n * });\n * ```\n */\n public async getLatestLedger(): Promise<Api.GetLatestLedgerResponse> {\n return this._getLatestLedger().then(parseRawLatestLedger);\n }\n\n public async _getLatestLedger(): Promise<Api.RawGetLatestLedgerResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getLatestLedger\",\n );\n }\n\n /**\n * Submit a trial contract invocation to get back return values, expected\n * ledger footprint, expected authorizations, and expected costs.\n *\n * @param tx - the transaction to simulate,\n * which should include exactly one operation (one of\n * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTtlOp}, or\n * {@link xdr.RestoreFootprintOp}). Any provided footprint or auth\n * information will be ignored.\n * @param addlResources - (optional) any additional resources\n * to add to the simulation-provided ones, for example if you know you will\n * need extra CPU instructions\n * @param authMode - (optional) optionally, specify the type of\n * auth mode to use for simulation: `enforce` for enforcement mode,\n * `record` for recording mode, or `record_allow_nonroot` for recording\n * mode that allows non-root authorization\n * @param authV2 - (optional) request `SOROBAN_CREDENTIALS_ADDRESS_V2`\n * (CAP-71) auth credentials from simulation instead of the legacy\n * `SOROBAN_CREDENTIALS_ADDRESS`. Defaults to `false`; only enable it for\n * networks that have activated CAP-71, as V2 credentials are otherwise\n * rejected.\n *\n * @returns An object with the\n * cost, footprint, result/auth requirements (if applicable), and error of\n * the transaction\n *\n * @see\n * {@link https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/operations-and-transactions | transaction docs}\n * @see\n * {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction | simulateTransaction docs}\n * @see\n * {@link https://developers.stellar.org/docs/learn/fundamentals/contract-development/contract-interactions/transaction-simulation#authorization | authorization modes}\n * @see module:rpc.Server#prepareTransaction\n * @see module:rpc.assembleTransaction\n *\n * @example\n * ```ts\n * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';\n * const contract = new StellarSdk.Contract(contractId);\n *\n * // Right now, this is just the default fee for this example.\n * const fee = StellarSdk.BASE_FEE;\n * const transaction = new StellarSdk.TransactionBuilder(account, { fee })\n * // Uncomment the following line to build transactions for the live network. Be\n * // sure to also change the horizon hostname.\n * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)\n * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)\n * .setTimeout(30) // valid for the next 30s\n * // Add an operation to call increment() on the contract\n * .addOperation(contract.call(\"increment\"))\n * .build();\n *\n * server.simulateTransaction(transaction).then((sim) => {\n * console.log(\"cost:\", sim.cost);\n * console.log(\"result:\", sim.result);\n * console.log(\"error:\", sim.error);\n * console.log(\"latestLedger:\", sim.latestLedger);\n * });\n * ```\n */\n\n public async simulateTransaction(\n tx: Transaction | FeeBumpTransaction,\n addlResources?: RpcServer.ResourceLeeway,\n authMode?: Api.SimulationAuthMode,\n authV2: boolean = false,\n ): Promise<Api.SimulateTransactionResponse> {\n return this._simulateTransaction(tx, addlResources, authMode, authV2).then(\n parseRawSimulation,\n );\n }\n\n public async _simulateTransaction(\n transaction: Transaction | FeeBumpTransaction,\n addlResources?: RpcServer.ResourceLeeway,\n authMode?: Api.SimulationAuthMode,\n authV2: boolean = false,\n ): Promise<Api.RawSimulateTransactionResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"simulateTransaction\",\n {\n transaction: transaction.toXDR(),\n authMode,\n ...(addlResources !== undefined && {\n resourceConfig: {\n instructionLeeway: addlResources.cpuInstructions,\n },\n }),\n // CAP-71: only request ADDRESS_V2 auth credentials when explicitly\n // opted in. They are rejected by networks that have not activated\n // CAP-71, so default to omitting the flag (legacy ADDRESS credentials).\n ...(authV2 && { authV2: true }),\n },\n );\n }\n\n /**\n * Submit a trial contract invocation, first run a simulation of the contract\n * invocation as defined on the incoming transaction, and apply the results to\n * a new copy of the transaction which is then returned. Setting the ledger\n * footprint and authorization, so the resulting transaction is ready for\n * signing & sending.\n *\n * The returned transaction will also have an updated fee that is the sum of\n * fee set on incoming transaction with the contract resource fees estimated\n * from simulation. It is advisable to check the fee on returned transaction\n * and validate or take appropriate measures for interaction with user to\n * confirm it is acceptable.\n *\n * You can call the {@link rpc.Server.simulateTransaction} method\n * directly first if you want to inspect estimated fees for a given\n * transaction in detail first, then re-assemble it manually or via\n * {@link rpc.assembleTransaction}.\n *\n * @param tx - the transaction to\n * prepare. It should include exactly one operation, which must be one of\n * {@link xdr.InvokeHostFunctionOp}, {@link xdr.ExtendFootprintTtlOp},\n * or {@link xdr.RestoreFootprintOp}.\n *\n * Any provided footprint will be overwritten. However, if your operation\n * has existing auth entries, they will be preferred over ALL auth entries\n * from the simulation. In other words, if you include auth entries, you\n * don't care about the auth returned from the simulation. Other fields\n * (footprint, etc.) will be filled as normal.\n * @returns A copy of the\n * transaction with the expected authorizations (in the case of\n * invocation), resources, and ledger footprints added. The transaction fee\n * will also automatically be padded with the contract's minimum resource\n * fees discovered from the simulation.\n * @throws * If simulation fails\n *\n * @see module:rpc.assembleTransaction\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction | simulateTransaction docs}\n *\n * @example\n * ```ts\n * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';\n * const contract = new StellarSdk.Contract(contractId);\n *\n * // Right now, this is just the default fee for this example.\n * const fee = StellarSdk.BASE_FEE;\n * const transaction = new StellarSdk.TransactionBuilder(account, { fee })\n * // Uncomment the following line to build transactions for the live network. Be\n * // sure to also change the horizon hostname.\n * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)\n * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)\n * .setTimeout(30) // valid for the next 30s\n * // Add an operation to call increment() on the contract\n * .addOperation(contract.call(\"increment\"))\n * .build();\n *\n * const preparedTransaction = await server.prepareTransaction(transaction);\n *\n * // Sign this transaction with the secret key\n * // NOTE: signing is transaction is network specific. Test network transactions\n * // won't work in the public network. To switch networks, use the Network object\n * // as explained above (look for StellarSdk.Network).\n * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);\n * preparedTransaction.sign(sourceKeypair);\n *\n * server.sendTransaction(transaction).then(result => {\n * console.log(\"hash:\", result.hash);\n * console.log(\"status:\", result.status);\n * console.log(\"errorResultXdr:\", result.errorResultXdr);\n * });\n * ```\n */\n public async prepareTransaction(tx: Transaction | FeeBumpTransaction) {\n const simResponse = await this.simulateTransaction(tx);\n if (Api.isSimulationError(simResponse)) {\n throw new Error(simResponse.error);\n }\n\n return assembleTransaction(tx, simResponse).build();\n }\n\n /**\n * Submit a real transaction to the Stellar network.\n *\n * Unlike Horizon, RPC does not wait for transaction completion. It\n * simply validates the transaction and enqueues it. Clients should call\n * {@link rpc.Server.getTransaction} to learn about transaction\n * success/failure.\n *\n * @param transaction - to submit\n * @returns the\n * transaction id, status, and any error if available\n *\n * @see {@link https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/operations-and-transactions | transaction docs}\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/sendTransaction | sendTransaction docs}\n *\n * @example\n * ```ts\n * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE';\n * const contract = new StellarSdk.Contract(contractId);\n *\n * // Right now, this is just the default fee for this example.\n * const fee = StellarSdk.BASE_FEE;\n * const transaction = new StellarSdk.TransactionBuilder(account, { fee })\n * // Uncomment the following line to build transactions for the live network. Be\n * // sure to also change the horizon hostname.\n * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC)\n * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET)\n * .setTimeout(30) // valid for the next 30s\n * // Add an operation to call increment() on the contract\n * .addOperation(contract.call(\"increment\"))\n * .build();\n *\n * // Sign this transaction with the secret key\n * // NOTE: signing is transaction is network specific. Test network transactions\n * // won't work in the public network. To switch networks, use the Network object\n * // as explained above (look for StellarSdk.Network).\n * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey);\n * transaction.sign(sourceKeypair);\n *\n * server.sendTransaction(transaction).then((result) => {\n * console.log(\"hash:\", result.hash);\n * console.log(\"status:\", result.status);\n * console.log(\"errorResultXdr:\", result.errorResultXdr);\n * });\n * ```\n */\n public async sendTransaction(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<Api.SendTransactionResponse> {\n return this._sendTransaction(transaction).then(parseRawSendTransaction);\n }\n\n public async _sendTransaction(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<Api.RawSendTransactionResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"sendTransaction\",\n {\n transaction: transaction.toXDR(),\n },\n );\n }\n\n /**\n * Fund a new account using the network's Friendbot faucet, if any.\n *\n * @param address - The address or account instance that we\n * want to create and fund with Friendbot\n * @param friendbotUrl - (optional) Optionally, an explicit address for\n * friendbot (by default: this calls the Soroban RPC\n * {@link rpc.Server.getNetwork | getNetwork} method to try to\n * discover this network's Friendbot url).\n * @returns An {@link Account} object for the created\n * account, or the existing account if it's already funded with the\n * populated sequence number (note that the account will not be \"topped\n * off\" if it already exists)\n * @throws If Friendbot is not configured on this network or request failure\n *\n * @see {@link https://developers.stellar.org/docs/learn/fundamentals/networks#friendbot | Friendbot docs}\n * @see {@link Friendbot.Api.Response}\n *\n * @deprecated Use {@link Server.fundAddress} instead, which supports both\n * account (G...) and contract (C...) addresses.\n *\n * @example\n * ```ts\n * server\n * .requestAirdrop(\"GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4\")\n * .then((accountCreated) => {\n * console.log(\"accountCreated:\", accountCreated);\n * }).catch((error) => {\n * console.error(\"error:\", error);\n * });\n * ```\n */\n public async requestAirdrop(\n address: string | Pick<Account, \"accountId\">,\n friendbotUrl?: string,\n ): Promise<Account> {\n const account = typeof address === \"string\" ? address : address.accountId();\n friendbotUrl = friendbotUrl || (await this.getNetwork()).friendbotUrl;\n if (!friendbotUrl) {\n throw new Error(\"No friendbot URL configured for current network\");\n }\n\n try {\n const response = await this.httpClient.post<FriendbotApi.Response>(\n `${friendbotUrl}?addr=${encodeURIComponent(account)}`,\n );\n\n let meta: xdr.TransactionMeta;\n if (!response.data.result_meta_xdr) {\n const txMeta = await this.getTransaction(response.data.hash);\n if (txMeta.status !== Api.GetTransactionStatus.SUCCESS) {\n throw new Error(`Funding account ${address} failed`);\n }\n meta = txMeta.resultMetaXdr;\n } else {\n meta = xdr.TransactionMeta.fromXDR(\n response.data.result_meta_xdr,\n \"base64\",\n );\n }\n\n const sequence = findCreatedAccountSequenceInTransactionMeta(meta);\n return new Account(account, sequence);\n } catch (error: any) {\n if (error.response?.status === 400) {\n if (\n error.response.data?.detail?.includes(\"createAccountAlreadyExist\")\n ) {\n // Account already exists, load the sequence number\n return this.getAccount(account);\n }\n }\n throw error;\n }\n }\n\n /**\n * Fund an address using the network's Friendbot faucet, if any.\n *\n * This method supports both account (G...) and contract (C...) addresses.\n *\n * @param address - The address to fund. Can be either a Stellar\n * account (G...) or contract (C...) address.\n * @param friendbotUrl - (optional) Optionally, an explicit Friendbot URL\n * (by default: this calls the Stellar RPC\n * {@link rpc.Server.getNetwork | getNetwork} method to try to\n * discover this network's Friendbot url).\n * @returns The transaction\n * response from the Friendbot funding transaction.\n * @throws If Friendbot is not configured on this network or the\n * funding transaction fails.\n *\n * @see {@link https://developers.stellar.org/docs/learn/fundamentals/networks#friendbot | Friendbot docs}\n *\n * @example\n * ```ts\n * // Funding an account (G... address)\n * const tx = await server.fundAddress(\"GBZC6Y2Y7...\");\n * console.log(\"Funded! Hash:\", tx.txHash);\n * // If you need the Account object:\n * const account = await server.getAccount(\"GBZC6Y2Y7...\");\n * ```\n *\n * @example\n * ```ts\n * // Funding a contract (C... address)\n * const tx = await server.fundAddress(\"CBZC6Y2Y7...\");\n * console.log(\"Contract funded! Hash:\", tx.txHash);\n * ```\n */\n public async fundAddress(\n address: string,\n friendbotUrl?: string,\n ): Promise<Api.GetSuccessfulTransactionResponse> {\n if (\n !StrKey.isValidEd25519PublicKey(address) &&\n !StrKey.isValidContract(address)\n ) {\n throw new Error(\n `Invalid address: ${address}. Expected a Stellar account (G...) or contract (C...) address.`,\n );\n }\n\n friendbotUrl = friendbotUrl || (await this.getNetwork()).friendbotUrl;\n if (!friendbotUrl) {\n throw new Error(\"No friendbot URL configured for current network\");\n }\n\n try {\n const response = await this.httpClient.post<FriendbotApi.Response>(\n `${friendbotUrl}?addr=${encodeURIComponent(address)}`,\n );\n\n const txResponse = await this.getTransaction(response.data.hash);\n if (txResponse.status !== Api.GetTransactionStatus.SUCCESS) {\n throw new Error(\n `Funding address ${address} failed: transaction status ${txResponse.status}`,\n );\n }\n\n return txResponse;\n } catch (error: any) {\n if (error.response?.status === 400) {\n throw new Error(error.response.data?.detail ?? \"Bad Request\");\n }\n throw error;\n }\n }\n\n /**\n * Provides an analysis of the recent fee stats for regular and smart\n * contract operations.\n *\n * @returns the fee stats\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getFeeStats\n */\n public async getFeeStats(): Promise<Api.GetFeeStatsResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getFeeStats\",\n );\n }\n\n /**\n * Provides information about the current version details of the Soroban RPC and captive-core\n *\n * @returns the version info\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getVersionInfo\n */\n public async getVersionInfo(): Promise<Api.GetVersionInfoResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getVersionInfo\",\n );\n }\n\n /**\n * Returns a contract's balance of a particular SAC asset, if any.\n *\n * This is a convenience wrapper around {@link Server.getLedgerEntries}.\n *\n * @param address - the contract (string `C...`) whose balance of\n * `sac` you want to know\n * @param sac - the built-in SAC token (e.g. `USDC:GABC...`) that\n * you are querying from the given `contract`.\n * @param networkPassphrase - (optional) optionally, the network passphrase to\n * which this token applies. If omitted, a request about network\n * information will be made (see {@link getNetwork}), since contract IDs\n * for assets are specific to a network. You can refer to {@link Networks}\n * for a list of built-in passphrases, e.g., `Networks.TESTNET`.\n *\n * @returns , which will contain the balance\n * entry details if and only if the request returned a valid balance ledger\n * entry. If it doesn't, the `balanceEntry` field will not exist.\n *\n * @throws If `address` is not a valid contract ID (C...).\n *\n * @see getLedgerEntries\n * @see https://developers.stellar.org/docs/tokens/stellar-asset-contract\n *\n * @deprecated Use {@link getAssetBalance}, instead\n * @example\n * ```ts\n * // assume `address` is some contract or account with an XLM balance\n * // assume server is an instantiated `Server` instance.\n * const entry = (await server.getSACBalance(\n * new Address(address),\n * Asset.native(),\n * Networks.PUBLIC\n * ));\n *\n * // assumes BigInt support:\n * console.log(\n * entry.balanceEntry ?\n * BigInt(entry.balanceEntry.amount) :\n * \"Address has no XLM\");\n * ```\n */\n public async getSACBalance(\n address: string | Address,\n sac: Asset,\n networkPassphrase?: string,\n ): Promise<Api.BalanceResponse> {\n const addressString =\n address instanceof Address ? address.toString() : address;\n\n if (!StrKey.isValidContract(addressString)) {\n throw new TypeError(`expected contract ID, got ${addressString}`);\n }\n\n // Call out to RPC if passphrase isn't provided.\n const passphrase: string =\n networkPassphrase ?? (await this.getNetwork().then((n) => n.passphrase));\n\n // Turn SAC into predictable contract ID\n const sacId = sac.contractId(passphrase);\n\n // Rust union enum type with \"Balance(ScAddress)\" structure\n const key = nativeToScVal([\"Balance\", addressString], {\n type: [\"symbol\", \"address\"],\n });\n\n // Note a quirk here: the contract address in the key is the *token*\n // rather than the *holding contract*. This is because each token stores a\n // balance entry for each contract, not the other way around (i.e. XLM\n // holds a reserve for contract X, rather that contract X having a balance\n // of N XLM).\n const ledgerKey = xdr.LedgerKey.contractData(\n new xdr.LedgerKeyContractData({\n contract: new Address(sacId).toScAddress(),\n durability: xdr.ContractDataDurability.persistent(),\n key,\n }),\n );\n\n const response = await this.getLedgerEntries(ledgerKey);\n if (response.entries.length === 0) {\n return { latestLedger: response.latestLedger };\n }\n\n const { lastModifiedLedgerSeq, liveUntilLedgerSeq, val } =\n response.entries[0];\n\n if (val.switch().value !== xdr.LedgerEntryType.contractData().value) {\n return { latestLedger: response.latestLedger };\n }\n\n const entry = scValToNative(val.contractData().val());\n\n // Since we are requesting a SAC's contract data, we know for a fact that\n // it should follow the expected structure format. Thus, we can presume\n // these fields exist:\n return {\n latestLedger: response.latestLedger,\n balanceEntry: {\n liveUntilLedgerSeq,\n lastModifiedLedgerSeq,\n amount: entry.amount.toString(),\n authorized: entry.authorized,\n clawback: entry.clawback,\n },\n };\n }\n\n /**\n * Fetch a detailed list of ledgers starting from a specified point.\n *\n * Returns ledger data with support for pagination as long as the requested\n * pages fall within the history retention of the RPC provider.\n *\n * @param request - The request parameters for fetching ledgers. {@link Api.GetLedgersRequest}\n * @returns A promise that resolves to the\n * ledgers response containing an array of ledger data and pagination info. {@link Api.GetLedgersResponse}\n *\n * @throws If startLedger is less than the oldest ledger stored in this\n * node, or greater than the latest ledger seen by this node.\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers docs}\n *\n * @example\n * ```ts\n * // Fetch ledgers starting from a specific sequence number\n * server.getLedgers({\n * startLedger: 36233,\n * pagination: {\n * limit: 10\n * }\n * }).then((response) => {\n * console.log(\"Ledgers:\", response.ledgers);\n * console.log(\"Latest Ledger:\", response.latestLedger);\n * console.log(\"Cursor:\", response.cursor);\n * });\n * ```\n *\n * @example\n * ```ts\n * // Paginate through ledgers using cursor\n * const firstPage = await server.getLedgers({\n * startLedger: 36233,\n * pagination: {\n * limit: 5\n * }\n * });\n *\n * const nextPage = await server.getLedgers({\n * pagination: {\n * cursor: firstPage.cursor,\n * limit: 5\n * }\n * });\n * ```\n */\n\n public async getLedgers(\n request: Api.GetLedgersRequest,\n ): Promise<Api.GetLedgersResponse> {\n return this._getLedgers(request).then((raw) => {\n const result: Api.GetLedgersResponse = {\n ledgers: (raw.ledgers || []).map(parseRawLedger),\n latestLedger: raw.latestLedger,\n latestLedgerCloseTime: raw.latestLedgerCloseTime,\n oldestLedger: raw.oldestLedger,\n oldestLedgerCloseTime: raw.oldestLedgerCloseTime,\n cursor: raw.cursor,\n };\n return result;\n });\n }\n\n public async _getLedgers(\n request: Api.GetLedgersRequest,\n ): Promise<Api.RawGetLedgersResponse> {\n return jsonrpc.postObject(\n this.httpClient,\n this.serverURL.toString(),\n \"getLedgers\",\n request,\n );\n }\n}\n"],"names":["Durability","xdr","jsonrpc.postObject"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACL,EAAAA,YAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,YAAA,YAAA,CAAA,GAAa,YAAA;AAFH,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;AAsCZ,MAAM,+BAAA,GAA0C,EAAA;AAIzC,MAAM,kBAAA,GAAoC,CAAC,KAAA,KAAkB;AAG7D,MAAM,mBAAA,GAAqC,CAAC,IAAA,KAAiB,GAAA,GAAO;AAQ3E,SAAS,4CACP,IAAA,EACQ;AACR,EAAA,IAAI,aAAkC,EAAC;AACvC,EAAA,QAAQ,IAAA,CAAK,QAAO;AAAG,IACrB,KAAK,CAAA;AACH,MAAA,UAAA,GAAa,KAAK,UAAA,EAAW;AAC7B,MAAA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B,uBAAuB,GAAA,CAAI,qBAAA;AAAA,QAC3B,cAAc,GAAA,CAAI,YAAA;AAAA,QAClB,uBAAuB,GAAA,CAAI,qBAAA;AAAA,QAC3B,QAAQ,GAAA,CAAI;AAAA,OACd;AACA,MAAA,OAAO,MAAA;AAAA,IACT,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,MAAa,YACX,OAAA,EACoC;AACpC,IAAA,OAAOC,UAAQ;AAAA,MACb,IAAA,CAAK,UAAA;AAAA,MACL,IAAA,CAAK,UAAU,QAAA,EAAS;AAAA,MACxB,YAAA;AAAA,MACA;AAAA,KACF;AAAA,EACF;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar/stellar-sdk",
3
- "version": "16.0.0-rc.1",
3
+ "version": "16.0.0-rc.2",
4
4
  "type": "module",
5
5
  "packageManager": "pnpm@10.28.0",
6
6
  "description": "A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.",