@stellar/stellar-sdk 16.0.1 → 16.1.0
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.
- package/README.md +2 -2
- package/dist/stellar-sdk-axios.js +5608 -4598
- package/dist/stellar-sdk-axios.js.map +1 -1
- package/dist/stellar-sdk-axios.min.js +12 -11
- package/dist/stellar-sdk-axios.min.js.map +1 -1
- package/dist/stellar-sdk.js +3902 -3434
- package/dist/stellar-sdk.js.map +1 -1
- package/dist/stellar-sdk.min.js +17 -17
- package/dist/stellar-sdk.min.js.map +1 -1
- package/lib/axios/cjs/base/auth.js +107 -0
- package/lib/axios/cjs/base/auth.js.map +1 -1
- package/lib/axios/cjs/base/keypair.js +39 -0
- package/lib/axios/cjs/base/keypair.js.map +1 -1
- package/lib/axios/cjs/base/scval.js +34 -0
- package/lib/axios/cjs/base/scval.js.map +1 -1
- package/lib/axios/cjs/bindings/config.js +1 -1
- package/lib/axios/cjs/cli/index.js +1 -1
- package/lib/axios/cjs/cli/index.js.map +1 -1
- package/lib/axios/cjs/contract/assembled_transaction.js +8 -7
- package/lib/axios/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/cjs/contract/client.js +56 -3
- package/lib/axios/cjs/contract/client.js.map +1 -1
- package/lib/axios/cjs/contract/spec.js +7 -3
- package/lib/axios/cjs/contract/spec.js.map +1 -1
- package/lib/axios/cjs/errors/transaction_failed.js +62 -0
- package/lib/axios/cjs/errors/transaction_failed.js.map +1 -0
- package/lib/axios/cjs/errors/wrap_http_error.js +20 -0
- package/lib/axios/cjs/errors/wrap_http_error.js.map +1 -0
- package/lib/axios/cjs/federation/server.js +14 -15
- package/lib/axios/cjs/federation/server.js.map +1 -1
- package/lib/axios/cjs/horizon/call_builder.js +20 -0
- package/lib/axios/cjs/horizon/call_builder.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_api.js +5 -0
- package/lib/axios/cjs/horizon/horizon_api.js.map +1 -1
- package/lib/axios/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/cjs/horizon/server.js +20 -26
- package/lib/axios/cjs/horizon/server.js.map +1 -1
- package/lib/axios/cjs/horizon/trade_aggregation_call_builder.js +20 -0
- package/lib/axios/cjs/horizon/trade_aggregation_call_builder.js.map +1 -1
- package/lib/axios/cjs/index.js +4 -0
- package/lib/axios/cjs/index.js.map +1 -1
- package/lib/axios/cjs/rpc/api.js.map +1 -1
- package/lib/axios/cjs/rpc/axios.js +1 -1
- package/lib/axios/cjs/rpc/server.js +163 -8
- package/lib/axios/cjs/rpc/server.js.map +1 -1
- package/lib/axios/esm/base/auth.d.ts +141 -0
- package/lib/axios/esm/base/auth.js +106 -1
- package/lib/axios/esm/base/auth.js.map +1 -1
- package/lib/axios/esm/base/index.d.ts +2 -2
- package/lib/axios/esm/base/keypair.d.ts +27 -0
- package/lib/axios/esm/base/keypair.js +39 -0
- package/lib/axios/esm/base/keypair.js.map +1 -1
- package/lib/axios/esm/base/scval.d.ts +4 -0
- package/lib/axios/esm/base/scval.js +34 -0
- package/lib/axios/esm/base/scval.js.map +1 -1
- package/lib/axios/esm/bindings/config.js +1 -1
- package/lib/axios/esm/cli/index.js +1 -1
- package/lib/axios/esm/cli/index.js.map +1 -1
- package/lib/axios/esm/contract/assembled_transaction.d.ts +1 -1
- package/lib/axios/esm/contract/assembled_transaction.js +9 -8
- package/lib/axios/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/axios/esm/contract/client.d.ts +49 -3
- package/lib/axios/esm/contract/client.js +56 -3
- package/lib/axios/esm/contract/client.js.map +1 -1
- package/lib/axios/esm/contract/spec.js +7 -3
- package/lib/axios/esm/contract/spec.js.map +1 -1
- package/lib/axios/esm/errors/index.d.ts +1 -0
- package/lib/axios/esm/errors/transaction_failed.d.ts +55 -0
- package/lib/axios/esm/errors/transaction_failed.js +60 -0
- package/lib/axios/esm/errors/transaction_failed.js.map +1 -0
- package/lib/axios/esm/errors/wrap_http_error.d.ts +20 -0
- package/lib/axios/esm/errors/wrap_http_error.js +18 -0
- package/lib/axios/esm/errors/wrap_http_error.js.map +1 -0
- package/lib/axios/esm/federation/server.js +14 -15
- package/lib/axios/esm/federation/server.js.map +1 -1
- package/lib/axios/esm/horizon/call_builder.js +20 -0
- package/lib/axios/esm/horizon/call_builder.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_api.d.ts +12 -1
- package/lib/axios/esm/horizon/horizon_api.js +5 -0
- package/lib/axios/esm/horizon/horizon_api.js.map +1 -1
- package/lib/axios/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/axios/esm/horizon/server.d.ts +10 -4
- package/lib/axios/esm/horizon/server.js +20 -26
- package/lib/axios/esm/horizon/server.js.map +1 -1
- package/lib/axios/esm/horizon/trade_aggregation_call_builder.js +20 -0
- package/lib/axios/esm/horizon/trade_aggregation_call_builder.js.map +1 -1
- package/lib/axios/esm/index.js +2 -1
- package/lib/axios/esm/index.js.map +1 -1
- package/lib/axios/esm/rpc/api.d.ts +21 -0
- package/lib/axios/esm/rpc/api.js.map +1 -1
- package/lib/axios/esm/rpc/axios.js +1 -1
- package/lib/axios/esm/rpc/server.d.ts +104 -1
- package/lib/axios/esm/rpc/server.js +163 -8
- package/lib/axios/esm/rpc/server.js.map +1 -1
- package/lib/cjs/base/auth.js +107 -0
- package/lib/cjs/base/auth.js.map +1 -1
- package/lib/cjs/base/keypair.js +39 -0
- package/lib/cjs/base/keypair.js.map +1 -1
- package/lib/cjs/base/scval.js +34 -0
- package/lib/cjs/base/scval.js.map +1 -1
- package/lib/cjs/bindings/config.js +1 -1
- package/lib/cjs/cli/index.js +1 -1
- package/lib/cjs/cli/index.js.map +1 -1
- package/lib/cjs/contract/assembled_transaction.js +8 -7
- package/lib/cjs/contract/assembled_transaction.js.map +1 -1
- package/lib/cjs/contract/client.js +56 -3
- package/lib/cjs/contract/client.js.map +1 -1
- package/lib/cjs/contract/spec.js +7 -3
- package/lib/cjs/contract/spec.js.map +1 -1
- package/lib/cjs/errors/transaction_failed.js +62 -0
- package/lib/cjs/errors/transaction_failed.js.map +1 -0
- package/lib/cjs/errors/wrap_http_error.js +20 -0
- package/lib/cjs/errors/wrap_http_error.js.map +1 -0
- package/lib/cjs/federation/server.js +14 -15
- package/lib/cjs/federation/server.js.map +1 -1
- package/lib/cjs/horizon/call_builder.js +20 -0
- package/lib/cjs/horizon/call_builder.js.map +1 -1
- package/lib/cjs/horizon/horizon_api.js +5 -0
- package/lib/cjs/horizon/horizon_api.js.map +1 -1
- package/lib/cjs/horizon/horizon_axios_client.js +1 -1
- package/lib/cjs/horizon/server.js +20 -26
- package/lib/cjs/horizon/server.js.map +1 -1
- package/lib/cjs/horizon/trade_aggregation_call_builder.js +20 -0
- package/lib/cjs/horizon/trade_aggregation_call_builder.js.map +1 -1
- package/lib/cjs/index.js +4 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/rpc/api.js.map +1 -1
- package/lib/cjs/rpc/axios.js +1 -1
- package/lib/cjs/rpc/server.js +163 -8
- package/lib/cjs/rpc/server.js.map +1 -1
- package/lib/esm/base/auth.d.ts +141 -0
- package/lib/esm/base/auth.js +106 -1
- package/lib/esm/base/auth.js.map +1 -1
- package/lib/esm/base/index.d.ts +2 -2
- package/lib/esm/base/keypair.d.ts +27 -0
- package/lib/esm/base/keypair.js +39 -0
- package/lib/esm/base/keypair.js.map +1 -1
- package/lib/esm/base/scval.d.ts +4 -0
- package/lib/esm/base/scval.js +34 -0
- package/lib/esm/base/scval.js.map +1 -1
- package/lib/esm/bindings/config.js +1 -1
- package/lib/esm/cli/index.js +1 -1
- package/lib/esm/cli/index.js.map +1 -1
- package/lib/esm/contract/assembled_transaction.d.ts +1 -1
- package/lib/esm/contract/assembled_transaction.js +9 -8
- package/lib/esm/contract/assembled_transaction.js.map +1 -1
- package/lib/esm/contract/client.d.ts +49 -3
- package/lib/esm/contract/client.js +56 -3
- package/lib/esm/contract/client.js.map +1 -1
- package/lib/esm/contract/spec.js +7 -3
- package/lib/esm/contract/spec.js.map +1 -1
- package/lib/esm/errors/index.d.ts +1 -0
- package/lib/esm/errors/transaction_failed.d.ts +55 -0
- package/lib/esm/errors/transaction_failed.js +60 -0
- package/lib/esm/errors/transaction_failed.js.map +1 -0
- package/lib/esm/errors/wrap_http_error.d.ts +20 -0
- package/lib/esm/errors/wrap_http_error.js +18 -0
- package/lib/esm/errors/wrap_http_error.js.map +1 -0
- package/lib/esm/federation/server.js +14 -15
- package/lib/esm/federation/server.js.map +1 -1
- package/lib/esm/horizon/call_builder.js +20 -0
- package/lib/esm/horizon/call_builder.js.map +1 -1
- package/lib/esm/horizon/horizon_api.d.ts +12 -1
- package/lib/esm/horizon/horizon_api.js +5 -0
- package/lib/esm/horizon/horizon_api.js.map +1 -1
- package/lib/esm/horizon/horizon_axios_client.js +1 -1
- package/lib/esm/horizon/server.d.ts +10 -4
- package/lib/esm/horizon/server.js +20 -26
- package/lib/esm/horizon/server.js.map +1 -1
- package/lib/esm/horizon/trade_aggregation_call_builder.js +20 -0
- package/lib/esm/horizon/trade_aggregation_call_builder.js.map +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/rpc/api.d.ts +21 -0
- package/lib/esm/rpc/api.js.map +1 -1
- package/lib/esm/rpc/axios.js +1 -1
- package/lib/esm/rpc/server.d.ts +104 -1
- package/lib/esm/rpc/server.js +163 -8
- package/lib/esm/rpc/server.js.map +1 -1
- package/package.json +27 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../../../src/horizon/server.ts"],"sourcesContent":["/* tslint:disable:variable-name no-namespace */\n\nimport type { BigNumber } from \"../base/util/bignumber.js\";\nimport CustomBigNumber from \"../base/util/bignumber.js\";\nimport {\n Asset,\n FeeBumpTransaction,\n StrKey,\n Transaction,\n xdr,\n} from \"../base/index.js\";\n\nimport type { TransactionBuilder } from \"../base/index.js\";\nimport { CallBuilder } from \"./call_builder.js\";\nimport { Config } from \"../config.js\";\nimport {\n AccountRequiresMemoError,\n BadResponseError,\n NotFoundError,\n} from \"../errors/index.js\";\n\nimport { AccountCallBuilder } from \"./account_call_builder.js\";\nimport { AccountResponse } from \"./account_response.js\";\nimport { AssetsCallBuilder } from \"./assets_call_builder.js\";\nimport { ClaimableBalanceCallBuilder } from \"./claimable_balances_call_builder.js\";\nimport { EffectCallBuilder } from \"./effect_call_builder.js\";\nimport { FriendbotBuilder } from \"./friendbot_builder.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { LedgerCallBuilder } from \"./ledger_call_builder.js\";\nimport { LiquidityPoolCallBuilder } from \"./liquidity_pool_call_builder.js\";\nimport { OfferCallBuilder } from \"./offer_call_builder.js\";\nimport { OperationCallBuilder } from \"./operation_call_builder.js\";\nimport { OrderbookCallBuilder } from \"./orderbook_call_builder.js\";\nimport { PathCallBuilder } from \"./path_call_builder.js\";\nimport { PaymentCallBuilder } from \"./payment_call_builder.js\";\nimport { StrictReceivePathCallBuilder } from \"./strict_receive_path_call_builder.js\";\nimport { StrictSendPathCallBuilder } from \"./strict_send_path_call_builder.js\";\nimport { TradeAggregationCallBuilder } from \"./trade_aggregation_call_builder.js\";\nimport { TradesCallBuilder } from \"./trades_call_builder.js\";\nimport { TransactionCallBuilder } from \"./transaction_call_builder.js\";\nimport {\n createHttpClient,\n getCurrentServerTime,\n} from \"./horizon_axios_client.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\n/**\n * Default transaction submission timeout for Horizon requests, in milliseconds\n * @defaultValue 60000\n */\nexport const SUBMIT_TRANSACTION_TIMEOUT: number = 60 * 1000;\n\nconst STROOPS_IN_LUMEN = 10000000;\n\n// ACCOUNT_REQUIRES_MEMO is the base64 encoding of \"1\".\n// SEP 29 uses this value to define transaction memo requirements for incoming payments.\nconst ACCOUNT_REQUIRES_MEMO = \"MQ==\";\n\nfunction getAmountInLumens(amt: BigNumber) {\n return new CustomBigNumber(amt).div(STROOPS_IN_LUMEN).toString();\n}\n\n/**\n * Server handles the network connection to a [Horizon](https://developers.stellar.org/docs/data/horizon)\n * instance and exposes an interface for requests to that instance.\n *\n * @param serverURL - Horizon Server URL (ex. `https://horizon-testnet.stellar.org`).\n * @param opts - (optional) Options object\n */\nexport class HorizonServer {\n /**\n * Horizon Server URL (ex. `https://horizon-testnet.stellar.org`)\n *\n * TODO: Solve `this.serverURL`.\n */\n public readonly serverURL: URL;\n\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: HorizonServer.Options = {}) {\n this.serverURL = new URL(serverURL);\n\n const allowHttp =\n typeof opts.allowHttp === \"undefined\"\n ? Config.isAllowHttp()\n : opts.allowHttp;\n\n const customHeaders: Record<string, string> = {};\n\n if (opts.appName) {\n customHeaders[\"X-App-Name\"] = opts.appName;\n }\n if (opts.appVersion) {\n customHeaders[\"X-App-Version\"] = opts.appVersion;\n }\n if (opts.authToken) {\n customHeaders[\"X-Auth-Token\"] = opts.authToken;\n }\n if (opts.headers) {\n Object.assign(customHeaders, opts.headers);\n }\n\n this.httpClient = createHttpClient(customHeaders);\n\n if (this.serverURL.protocol !== \"https:\" && !allowHttp) {\n throw new Error(\"Cannot connect to insecure horizon server\");\n }\n }\n\n /**\n * Get timebounds for N seconds from now, when you're creating a transaction\n * with {@link TransactionBuilder}.\n *\n * By default, {@link TransactionBuilder} uses the current local time, but\n * your machine's local time could be different from Horizon's. This gives you\n * more assurance that your timebounds will reflect what you want.\n *\n * Note that this will generate your timebounds when you **init the transaction**,\n * not when you build or submit the transaction! So give yourself enough time to get\n * the transaction built and signed before submitting.\n *\n * @example\n * ```ts\n * const transaction = new StellarSdk.TransactionBuilder(accountId, {\n * fee: await StellarSdk.Server.fetchBaseFee(),\n * timebounds: await StellarSdk.Server.fetchTimebounds(100)\n * })\n * .addOperation(operation)\n * // normally we would need to call setTimeout here, but setting timebounds\n * // earlier does the trick!\n * .build();\n * ```\n *\n * @param seconds - Number of seconds past the current time to wait.\n * @param _isRetry - (optional) True if this is a retry. Only set this internally!\n * This is to avoid a scenario where Horizon is horking up the wrong date.\n * @returns Promise that resolves a `Timebounds` object\n * (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.\n */\n public async fetchTimebounds(\n seconds: number,\n _isRetry: boolean = false,\n ): Promise<HorizonServer.Timebounds> {\n // httpClient instead of this.ledgers so we can get at them headers\n const serverPort = this.serverURL.port;\n const serverKey = serverPort\n ? `${this.serverURL.hostname}:${serverPort}`\n : this.serverURL.hostname;\n const currentTime = getCurrentServerTime(serverKey);\n\n if (currentTime) {\n return {\n minTime: 0,\n maxTime: currentTime + seconds,\n };\n }\n\n // if this is a retry, then the retry has failed, so use local time\n if (_isRetry) {\n return {\n minTime: 0,\n maxTime: Math.floor(new Date().getTime() / 1000) + seconds,\n };\n }\n\n // otherwise, retry (by calling the root endpoint)\n // toString automatically adds the trailing slash\n await this.httpClient.get(this.serverURL.toString());\n return this.fetchTimebounds(seconds, true);\n }\n\n /**\n * Fetch the base fee. Since this hits the server, if the server call fails,\n * you might get an error. You should be prepared to use a default value if\n * that happens!\n * @returns Promise that resolves to the base fee.\n */\n public async fetchBaseFee(): Promise<number> {\n const response = await this.feeStats();\n\n return parseInt(response.last_ledger_base_fee, 10) || 100;\n }\n\n /**\n * Fetch the fee stats endpoint.\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/aggregations/fee-stats | Fee Stats}\n * @returns Promise that resolves to the fee stats returned by Horizon.\n */\n public async feeStats(): Promise<HorizonApi.FeeStatsResponse> {\n const cb = new CallBuilder<HorizonApi.FeeStatsResponse>(\n this.serverURL,\n this.httpClient,\n );\n cb.filter.push([\"fee_stats\"]);\n return cb.call();\n }\n\n /**\n * Fetch the Horizon server's root endpoint.\n * @returns Promise that resolves to the root endpoint returned by Horizon.\n */\n public async root(): Promise<HorizonApi.RootResponse> {\n const cb = new CallBuilder<HorizonApi.RootResponse>(\n this.serverURL,\n this.httpClient,\n );\n return cb.call();\n }\n\n /**\n * Submits a transaction to the network.\n *\n * By default this function calls {@link Horizon.Server.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * If you submit any number of `manageOffer` operations, this will add an\n * attribute to the response that will help you analyze what happened with\n * your offers.\n *\n * For example, you'll want to examine `offerResults` to add affordances like\n * these to your app:\n * - If `wasImmediatelyFilled` is true, then no offer was created. So if you\n * normally watch the `Server.offers` endpoint for offer updates, you\n * instead need to check `Server.trades` to find the result of this filled\n * offer.\n * - If `wasImmediatelyDeleted` is true, then the offer you submitted was\n * deleted without reaching the orderbook or being matched (possibly because\n * your amounts were rounded down to zero). So treat the just-submitted\n * offer request as if it never happened.\n * - If `wasPartiallyFilled` is true, you can tell the user that\n * `amountBought` or `amountSold` have already been transferred.\n *\n * @example\n * ```ts\n * const res = {\n * ...response,\n * offerResults: [\n * {\n * // Exact ordered list of offers that executed, with the exception\n * // that the last one may not have executed entirely.\n * offersClaimed: [\n * sellerId: String,\n * offerId: String,\n * assetSold: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same shape as assetSold\n * assetBought: {}\n * ],\n *\n * // What effect your manageOffer op had\n * effect: \"manageOfferCreated|manageOfferUpdated|manageOfferDeleted\",\n *\n * // Whether your offer immediately got matched and filled\n * wasImmediatelyFilled: Boolean,\n *\n * // Whether your offer immediately got deleted, if for example the order was too small\n * wasImmediatelyDeleted: Boolean,\n *\n * // Whether the offer was partially, but not completely, filled\n * wasPartiallyFilled: Boolean,\n *\n * // The full requested amount of the offer is open for matching\n * isFullyOpen: Boolean,\n *\n * // The total amount of tokens bought / sold during transaction execution\n * amountBought: Number,\n * amountSold: Number,\n *\n * // if the offer was created, updated, or partially filled, this is\n * // the outstanding offer\n * currentOffer: {\n * offerId: String,\n * amount: String,\n * price: {\n * n: String,\n * d: String,\n * },\n *\n * selling: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same as `selling`\n * buying: {},\n * },\n *\n * // the index of this particular operation in the op stack\n * operationIndex: Number\n * }\n * ]\n * }\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-a-transaction | Submit a Transaction}\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves or rejects with response from\n * horizon.\n */\n public async submitTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n timeout: SUBMIT_TRANSACTION_TIMEOUT,\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => {\n if (!response.data.result_xdr) {\n return response.data;\n }\n\n const responseXDR = xdr.TransactionResult.fromXDR(\n response.data.result_xdr,\n \"base64\",\n );\n\n // TODO: fix stellar-base types.\n const results = (responseXDR as any).result().value();\n\n let offerResults;\n let hasManageOffer;\n\n if (results.length) {\n offerResults = results\n // TODO: fix stellar-base types.\n .map((result: any, i: number) => {\n if (\n result.value().switch().name !== \"manageBuyOffer\" &&\n result.value().switch().name !== \"manageSellOffer\"\n ) {\n return null;\n }\n\n hasManageOffer = true;\n\n let amountBought = new CustomBigNumber(0);\n let amountSold = new CustomBigNumber(0);\n\n const offerSuccess = result.value().value().success();\n\n const offersClaimed = offerSuccess\n .offersClaimed()\n // TODO: fix stellar-base types.\n .map((offerClaimedAtom: any) => {\n const offerClaimed = offerClaimedAtom.value();\n\n let sellerId: string = \"\";\n switch (offerClaimedAtom.switch()) {\n case xdr.ClaimAtomType.claimAtomTypeV0():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerEd25519(),\n );\n break;\n case xdr.ClaimAtomType.claimAtomTypeOrderBook():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerId().ed25519(),\n );\n break;\n // It shouldn't be possible for a claimed offer to have type\n // claimAtomTypeLiquidityPool:\n //\n // https://github.com/stellar/stellar-core/blob/c5f6349b240818f716617ca6e0f08d295a6fad9a/src/transactions/TransactionUtils.cpp#L1284\n //\n // However, you can never be too careful.\n default:\n throw new Error(\n `Invalid offer result type: ${offerClaimedAtom.switch()}`,\n );\n }\n\n const claimedOfferAmountBought = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountBought().toString(),\n );\n const claimedOfferAmountSold = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountSold().toString(),\n );\n\n // This is an offer that was filled by the one just submitted.\n // So this offer has an _opposite_ bought/sold frame of ref\n // than from what we just submitted!\n // So add this claimed offer's bought to the SOLD count and vice v\n\n amountBought = amountBought.plus(claimedOfferAmountSold);\n amountSold = amountSold.plus(claimedOfferAmountBought);\n\n const sold = Asset.fromOperation(offerClaimed.assetSold());\n const bought = Asset.fromOperation(\n offerClaimed.assetBought(),\n );\n\n const assetSold = {\n type: sold.getAssetType(),\n assetCode: sold.getCode(),\n issuer: sold.getIssuer(),\n };\n\n const assetBought = {\n type: bought.getAssetType(),\n assetCode: bought.getCode(),\n issuer: bought.getIssuer(),\n };\n\n return {\n sellerId,\n offerId: offerClaimed.offerId().toString(),\n assetSold,\n amountSold: getAmountInLumens(claimedOfferAmountSold),\n assetBought,\n amountBought: getAmountInLumens(claimedOfferAmountBought),\n };\n });\n\n const effect = offerSuccess.offer().switch().name;\n\n let currentOffer;\n\n if (\n typeof offerSuccess.offer().value === \"function\" &&\n offerSuccess.offer().value()\n ) {\n const offerXDR = offerSuccess.offer().value();\n\n currentOffer = {\n offerId: offerXDR.offerId().toString(),\n selling: {},\n buying: {},\n amount: getAmountInLumens(offerXDR.amount().toString()),\n price: {\n n: offerXDR.price().n(),\n d: offerXDR.price().d(),\n },\n };\n\n const selling = Asset.fromOperation(offerXDR.selling());\n\n currentOffer.selling = {\n type: selling.getAssetType(),\n assetCode: selling.getCode(),\n issuer: selling.getIssuer(),\n };\n\n const buying = Asset.fromOperation(offerXDR.buying());\n\n currentOffer.buying = {\n type: buying.getAssetType(),\n assetCode: buying.getCode(),\n issuer: buying.getIssuer(),\n };\n }\n\n return {\n offersClaimed,\n effect,\n operationIndex: i,\n currentOffer,\n\n // this value is in stroops so divide it out\n amountBought: getAmountInLumens(amountBought),\n amountSold: getAmountInLumens(amountSold),\n\n isFullyOpen:\n !offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasPartiallyFilled:\n !!offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasImmediatelyFilled:\n !!offersClaimed.length && effect === \"manageOfferDeleted\",\n wasImmediatelyDeleted:\n !offersClaimed.length && effect === \"manageOfferDeleted\",\n };\n })\n // TODO: fix stellar-base types.\n .filter((result: any) => !!result);\n }\n\n return {\n ...response.data,\n offerResults: hasManageOffer ? offerResults : undefined,\n };\n })\n .catch((response) => {\n if (response instanceof Error) {\n return Promise.reject(response);\n }\n return Promise.reject(\n new BadResponseError(\n `Transaction submission failed. Server responded: ${response.status} ${response.statusText}`,\n response.data,\n ),\n );\n });\n }\n\n /**\n * Submits an asynchronous transaction to the network. Unlike the synchronous version, which blocks\n * and waits for the transaction to be ingested in Horizon, this endpoint relays the response from\n * core directly back to the user.\n *\n * By default, this function calls {@link HorizonServer.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * @see [Submit-Async-Transaction](https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-async-transaction)\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves or rejects with response from\n * horizon.\n */\n public async submitAsyncTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitAsyncTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions_async\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => response.data)\n .catch((response) => {\n if (response instanceof Error) {\n return Promise.reject(response);\n }\n return Promise.reject(\n new BadResponseError(\n `Transaction submission failed. Server responded: ${response.status} ${response.statusText}`,\n response.data,\n ),\n );\n });\n }\n\n /**\n * @returns New {@link AccountCallBuilder} object configured by a current Horizon server configuration.\n */\n public accounts(): AccountCallBuilder {\n return new AccountCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link ClaimableBalanceCallBuilder} object configured by a current Horizon server configuration.\n */\n public claimableBalances(): ClaimableBalanceCallBuilder {\n return new ClaimableBalanceCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LedgerCallBuilder} object configured by a current Horizon server configuration.\n */\n public ledgers(): LedgerCallBuilder {\n return new LedgerCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link TransactionCallBuilder} object configured by a current Horizon server configuration.\n */\n public transactions(): TransactionCallBuilder {\n return new TransactionCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the offers on the DEX.\n *\n * You can query all offers for account using the function `.accountId`.\n *\n * @example\n * ```ts\n * server.offers()\n * .forAccount(accountId).call()\n * .then(function(offers) {\n * console.log(offers);\n * });\n * ```\n *\n * @returns New {@link OfferCallBuilder} object\n */\n public offers(): OfferCallBuilder {\n return new OfferCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param selling - Asset being sold\n * @param buying - Asset being bought\n * @returns New {@link OrderbookCallBuilder} object configured by a current Horizon server configuration.\n */\n public orderbook(selling: Asset, buying: Asset): OrderbookCallBuilder {\n return new OrderbookCallBuilder(\n this.serverURL,\n this.httpClient,\n\n selling,\n buying,\n );\n }\n\n /**\n * Returns\n * @returns New {@link TradesCallBuilder} object configured by a current Horizon server configuration.\n */\n public trades(): TradesCallBuilder {\n return new TradesCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link OperationCallBuilder} object configured by a current Horizon server configuration.\n */\n public operations(): OperationCallBuilder {\n return new OperationCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LiquidityPoolCallBuilder}\n * object configured to the current Horizon server settings.\n */\n public liquidityPools(): LiquidityPoolCallBuilder {\n return new LiquidityPoolCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path\n * payments. A strict receive path payment specifies a series of assets to\n * route a payment through, from source asset (the asset debited from the\n * payer) to destination asset (the asset credited to the payee).\n *\n * A strict receive path search is specified using:\n *\n * * The destination address.\n * * The source address or source assets.\n * * The asset and amount that the destination account should receive.\n *\n * As part of the search, horizon will load a list of assets available to the\n * source address and will find any payment paths from those source assets to\n * the desired destination asset. The search's amount parameter will be used\n * to determine if there a given path can satisfy a payment of the desired\n * amount.\n *\n * If a list of assets is passed as the source, horizon will find any payment\n * paths from those source assets to the desired destination asset.\n *\n * @param source - The sender's account ID or a list of assets. Any returned path will use a source that the sender can hold.\n * @param destinationAsset - The destination asset.\n * @param destinationAmount - The amount, denominated in the destination asset, that any returned path should be able to satisfy.\n * @returns New {@link StrictReceivePathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictReceivePaths(\n source: string | Asset[],\n destinationAsset: Asset,\n destinationAmount: string,\n ): PathCallBuilder {\n return new StrictReceivePathCallBuilder(\n this.serverURL,\n this.httpClient,\n source,\n destinationAsset,\n destinationAmount,\n );\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path payments. A strict send path payment specifies a\n * series of assets to route a payment through, from source asset (the asset debited from the payer) to destination\n * asset (the asset credited to the payee).\n *\n * A strict send path search is specified using:\n *\n * The asset and amount that is being sent.\n * The destination account or the destination assets.\n *\n * @param sourceAsset - The asset to be sent.\n * @param sourceAmount - The amount, denominated in the source asset, that any returned path should be able to satisfy.\n * @param destination - The destination account or the destination assets.\n * @returns New {@link StrictSendPathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictSendPaths(\n sourceAsset: Asset,\n sourceAmount: string,\n destination: string | Asset[],\n ): PathCallBuilder {\n return new StrictSendPathCallBuilder(\n this.serverURL,\n this.httpClient,\n sourceAsset,\n sourceAmount,\n destination,\n );\n }\n\n /**\n * @returns New {@link PaymentCallBuilder} instance configured with the current\n * Horizon server configuration.\n */\n public payments(): PaymentCallBuilder {\n return new PaymentCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link EffectCallBuilder} instance configured with the current\n * Horizon server configuration\n */\n public effects(): EffectCallBuilder {\n return new EffectCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param address - The Stellar ID that you want Friendbot to send lumens to\n * @returns New {@link FriendbotBuilder} instance configured with the current\n * Horizon server configuration\n */\n public friendbot(address: string): FriendbotBuilder {\n return new FriendbotBuilder(this.serverURL, this.httpClient, address);\n }\n\n /**\n * Get a new {@link AssetsCallBuilder} instance configured with the current\n * Horizon server configuration.\n * @returns New AssetsCallBuilder instance\n */\n public assets(): AssetsCallBuilder {\n return new AssetsCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * Fetches an account's most current state in the ledger, then creates and\n * returns an {@link AccountResponse} object.\n *\n * @param accountId - The account to load.\n *\n * @returns Returns a promise to the {@link AccountResponse} object\n * with populated sequence number.\n */\n public async loadAccount(accountId: string): Promise<AccountResponse> {\n const res = await this.accounts().accountId(accountId).call();\n\n return new AccountResponse(res);\n }\n\n /**\n *\n * @param base - base asset\n * @param counter - counter asset\n * @param start_time - lower time boundary represented as millis since epoch\n * @param end_time - upper time boundary represented as millis since epoch\n * @param resolution - segment duration as millis since epoch. *Supported values are 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).\n * @param offset - segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.\n * Returns new {@link TradeAggregationCallBuilder} object configured with the current Horizon server configuration.\n * @returns New TradeAggregationCallBuilder instance\n */\n public tradeAggregation(\n base: Asset,\n counter: Asset,\n start_time: number,\n end_time: number,\n resolution: number,\n offset: number,\n ): TradeAggregationCallBuilder {\n return new TradeAggregationCallBuilder(\n this.serverURL,\n this.httpClient,\n base,\n counter,\n start_time,\n end_time,\n resolution,\n offset,\n );\n }\n\n /**\n * Check if any of the destination accounts requires a memo.\n *\n * This function implements a memo required check as defined in\n * [SEP-29](https://stellar.org/protocol/sep-29). It will load each account\n * which is the destination and check if it has the data field\n * `config.memo_required` set to `\"MQ==\"`.\n *\n * Each account is checked sequentially instead of loading multiple accounts\n * at the same time from Horizon.\n *\n * @see {@link https://stellar.org/protocol/sep-29 | SEP-29: Account Memo Requirements}\n * @param transaction - The transaction to check.\n * @returns - If any of the destination account\n * requires a memo, the promise will throw {@link AccountRequiresMemoError}.\n * @throws */\n public async checkMemoRequired(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<void> {\n if (transaction instanceof FeeBumpTransaction) {\n transaction = transaction.innerTransaction;\n }\n\n if (transaction.memo.type !== \"none\") {\n return;\n }\n\n const destinations = new Set<string>();\n\n for (let i = 0; i < transaction.operations.length; i += 1) {\n const operation = transaction.operations[i];\n\n switch (operation.type) {\n case \"payment\":\n case \"pathPaymentStrictReceive\":\n case \"pathPaymentStrictSend\":\n case \"accountMerge\":\n break;\n default:\n continue;\n }\n const destination = operation.destination;\n if (destinations.has(destination)) {\n continue;\n }\n destinations.add(destination);\n\n // skip M account checks since it implies a memo\n if (destination.startsWith(\"M\")) {\n continue;\n }\n\n try {\n const account = await this.loadAccount(destination);\n if (\n account.data_attr[\"config.memo_required\"] === ACCOUNT_REQUIRES_MEMO\n ) {\n throw new AccountRequiresMemoError(\n \"account requires memo\",\n destination,\n i,\n );\n }\n } catch (e) {\n if (e instanceof AccountRequiresMemoError) {\n throw e;\n }\n\n // fail if the error is different to account not found\n if (!(e instanceof NotFoundError)) {\n throw e;\n }\n\n continue;\n }\n }\n }\n}\n\nexport namespace HorizonServer {\n /**\n * Options for configuring connections to Horizon servers.\n */\n export interface Options {\n /** Allow connecting to http servers, default: `false`. This must be set to false in production deployments! You can also use {@link Config} class to set this globally. */\n allowHttp?: boolean;\n /** Allow set custom header `X-App-Name`, default: `undefined`. */\n appName?: string;\n /** Allow set custom header `X-App-Version`, default: `undefined`. */\n appVersion?: string;\n /** Allow set custom header `X-Auth-Token`, default: `undefined`. */\n authToken?: string;\n headers?: Record<string, string>;\n }\n\n export interface Timebounds {\n minTime: number;\n maxTime: number;\n }\n\n export interface SubmitTransactionOptions {\n skipMemoRequiredCheck?: boolean;\n }\n}\n"],"names":["CustomBigNumber","Config","createHttpClient","getCurrentServerTime","CallBuilder","xdr","StrKey","Asset","BadResponseError","AccountCallBuilder","ClaimableBalanceCallBuilder","LedgerCallBuilder","TransactionCallBuilder","OfferCallBuilder","OrderbookCallBuilder","TradesCallBuilder","OperationCallBuilder","LiquidityPoolCallBuilder","StrictReceivePathCallBuilder","StrictSendPathCallBuilder","PaymentCallBuilder","EffectCallBuilder","FriendbotBuilder","AssetsCallBuilder","AccountResponse","TradeAggregationCallBuilder","FeeBumpTransaction","AccountRequiresMemoError","NotFoundError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDO,MAAM,6BAAqC,EAAA,GAAK;AAEvD,MAAM,gBAAA,GAAmB,GAAA;AAIzB,MAAM,qBAAA,GAAwB,MAAA;AAE9B,SAAS,kBAAkB,GAAA,EAAgB;AACzC,EAAA,OAAO,IAAIA,iBAAA,CAAgB,GAAG,EAAE,GAAA,CAAI,gBAAgB,EAAE,QAAA,EAAS;AACjE;AASO,MAAM,aAAA,CAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA,UAAA;AAAA,EAChB,WAAA,CAAY,SAAA,EAAmB,IAAA,GAA8B,EAAC,EAAG;AAC/D,IAAA,IAAA,CAAK,SAAA,GAAY,IAAI,GAAA,CAAI,SAAS,CAAA;AAElC,IAAA,MAAM,SAAA,GACJ,OAAO,IAAA,CAAK,SAAA,KAAc,cACtBC,aAAA,CAAO,WAAA,KACP,IAAA,CAAK,SAAA;AAEX,IAAA,MAAM,gBAAwC,EAAC;AAE/C,IAAA,IAAI,KAAK,OAAA,EAAS;AAChB,MAAA,aAAA,CAAc,YAAY,IAAI,IAAA,CAAK,OAAA;AAAA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
|
+
{"version":3,"file":"server.js","sources":["../../../../src/horizon/server.ts"],"sourcesContent":["/* tslint:disable:variable-name no-namespace */\n\nimport type { BigNumber } from \"../base/util/bignumber.js\";\nimport CustomBigNumber from \"../base/util/bignumber.js\";\nimport {\n Asset,\n FeeBumpTransaction,\n StrKey,\n Transaction,\n xdr,\n} from \"../base/index.js\";\n\nimport type { TransactionBuilder } from \"../base/index.js\";\nimport { CallBuilder } from \"./call_builder.js\";\nimport { Config } from \"../config.js\";\nimport {\n AccountRequiresMemoError,\n BadResponseError,\n NotFoundError,\n TransactionFailedError,\n} from \"../errors/index.js\";\nimport { wrapHttpError } from \"../errors/wrap_http_error.js\";\n\nimport { AccountCallBuilder } from \"./account_call_builder.js\";\nimport { AccountResponse } from \"./account_response.js\";\nimport { AssetsCallBuilder } from \"./assets_call_builder.js\";\nimport { ClaimableBalanceCallBuilder } from \"./claimable_balances_call_builder.js\";\nimport { EffectCallBuilder } from \"./effect_call_builder.js\";\nimport { FriendbotBuilder } from \"./friendbot_builder.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { LedgerCallBuilder } from \"./ledger_call_builder.js\";\nimport { LiquidityPoolCallBuilder } from \"./liquidity_pool_call_builder.js\";\nimport { OfferCallBuilder } from \"./offer_call_builder.js\";\nimport { OperationCallBuilder } from \"./operation_call_builder.js\";\nimport { OrderbookCallBuilder } from \"./orderbook_call_builder.js\";\nimport { PathCallBuilder } from \"./path_call_builder.js\";\nimport { PaymentCallBuilder } from \"./payment_call_builder.js\";\nimport { StrictReceivePathCallBuilder } from \"./strict_receive_path_call_builder.js\";\nimport { StrictSendPathCallBuilder } from \"./strict_send_path_call_builder.js\";\nimport { TradeAggregationCallBuilder } from \"./trade_aggregation_call_builder.js\";\nimport { TradesCallBuilder } from \"./trades_call_builder.js\";\nimport { TransactionCallBuilder } from \"./transaction_call_builder.js\";\nimport {\n createHttpClient,\n getCurrentServerTime,\n} from \"./horizon_axios_client.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\n/**\n * Default transaction submission timeout for Horizon requests, in milliseconds\n * @defaultValue 60000\n */\nexport const SUBMIT_TRANSACTION_TIMEOUT: number = 60 * 1000;\n\nconst STROOPS_IN_LUMEN = 10000000;\n\n// ACCOUNT_REQUIRES_MEMO is the base64 encoding of \"1\".\n// SEP 29 uses this value to define transaction memo requirements for incoming payments.\nconst ACCOUNT_REQUIRES_MEMO = \"MQ==\";\n\nfunction getAmountInLumens(amt: BigNumber) {\n return new CustomBigNumber(amt).div(STROOPS_IN_LUMEN).toString();\n}\n\n// Maps a transaction submission rejection to an SDK error.\nfunction toSubmissionError(error: any): Error {\n return wrapHttpError(error, (details) => {\n const message = `Transaction submission failed. Server responded: ${details.status} ${details.statusText}`;\n return details.data?.extras?.result_codes\n ? new TransactionFailedError(message, details)\n : new BadResponseError(message, details);\n });\n}\n\n/**\n * Server handles the network connection to a [Horizon](https://developers.stellar.org/docs/data/horizon)\n * instance and exposes an interface for requests to that instance.\n *\n * @param serverURL - Horizon Server URL (ex. `https://horizon-testnet.stellar.org`).\n * @param opts - (optional) Options object\n */\nexport class HorizonServer {\n /**\n * Horizon Server URL (ex. `https://horizon-testnet.stellar.org`)\n *\n * TODO: Solve `this.serverURL`.\n */\n public readonly serverURL: URL;\n\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: HorizonServer.Options = {}) {\n this.serverURL = new URL(serverURL);\n\n const allowHttp =\n typeof opts.allowHttp === \"undefined\"\n ? Config.isAllowHttp()\n : opts.allowHttp;\n\n const customHeaders: Record<string, string> = {};\n\n if (opts.appName) {\n customHeaders[\"X-App-Name\"] = opts.appName;\n }\n if (opts.appVersion) {\n customHeaders[\"X-App-Version\"] = opts.appVersion;\n }\n if (opts.authToken) {\n customHeaders[\"X-Auth-Token\"] = opts.authToken;\n }\n if (opts.headers) {\n Object.assign(customHeaders, opts.headers);\n }\n\n this.httpClient = createHttpClient(customHeaders);\n\n if (this.serverURL.protocol !== \"https:\" && !allowHttp) {\n throw new Error(\"Cannot connect to insecure horizon server\");\n }\n }\n\n /**\n * Get timebounds for N seconds from now, when you're creating a transaction\n * with {@link TransactionBuilder}.\n *\n * By default, {@link TransactionBuilder} uses the current local time, but\n * your machine's local time could be different from Horizon's. This gives you\n * more assurance that your timebounds will reflect what you want.\n *\n * Note that this will generate your timebounds when you **init the transaction**,\n * not when you build or submit the transaction! So give yourself enough time to get\n * the transaction built and signed before submitting.\n *\n * @example\n * ```ts\n * const transaction = new StellarSdk.TransactionBuilder(accountId, {\n * fee: await StellarSdk.Server.fetchBaseFee(),\n * timebounds: await StellarSdk.Server.fetchTimebounds(100)\n * })\n * .addOperation(operation)\n * // normally we would need to call setTimeout here, but setting timebounds\n * // earlier does the trick!\n * .build();\n * ```\n *\n * @param seconds - Number of seconds past the current time to wait.\n * @param _isRetry - (optional) True if this is a retry. Only set this internally!\n * This is to avoid a scenario where Horizon is horking up the wrong date.\n * @returns Promise that resolves a `Timebounds` object\n * (with the shape `{ minTime: 0, maxTime: N }`) that you can set the `timebounds` option to.\n */\n public async fetchTimebounds(\n seconds: number,\n _isRetry: boolean = false,\n ): Promise<HorizonServer.Timebounds> {\n // httpClient instead of this.ledgers so we can get at them headers\n const serverPort = this.serverURL.port;\n const serverKey = serverPort\n ? `${this.serverURL.hostname}:${serverPort}`\n : this.serverURL.hostname;\n const currentTime = getCurrentServerTime(serverKey);\n\n if (currentTime) {\n return {\n minTime: 0,\n maxTime: currentTime + seconds,\n };\n }\n\n // if this is a retry, then the retry has failed, so use local time\n if (_isRetry) {\n return {\n minTime: 0,\n maxTime: Math.floor(new Date().getTime() / 1000) + seconds,\n };\n }\n\n // otherwise, retry (by calling the root endpoint)\n // toString automatically adds the trailing slash\n await this.httpClient.get(this.serverURL.toString());\n return this.fetchTimebounds(seconds, true);\n }\n\n /**\n * Fetch the base fee. Since this hits the server, if the server call fails,\n * you might get an error. You should be prepared to use a default value if\n * that happens!\n * @returns Promise that resolves to the base fee.\n */\n public async fetchBaseFee(): Promise<number> {\n const response = await this.feeStats();\n\n return parseInt(response.last_ledger_base_fee, 10) || 100;\n }\n\n /**\n * Fetch the fee stats endpoint.\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/aggregations/fee-stats | Fee Stats}\n * @returns Promise that resolves to the fee stats returned by Horizon.\n */\n public async feeStats(): Promise<HorizonApi.FeeStatsResponse> {\n const cb = new CallBuilder<HorizonApi.FeeStatsResponse>(\n this.serverURL,\n this.httpClient,\n );\n cb.filter.push([\"fee_stats\"]);\n return cb.call();\n }\n\n /**\n * Fetch the Horizon server's root endpoint.\n * @returns Promise that resolves to the root endpoint returned by Horizon.\n */\n public async root(): Promise<HorizonApi.RootResponse> {\n const cb = new CallBuilder<HorizonApi.RootResponse>(\n this.serverURL,\n this.httpClient,\n );\n return cb.call();\n }\n\n /**\n * Submits a transaction to the network.\n *\n * By default this function calls {@link Horizon.Server.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * If you submit any number of `manageOffer` operations, this will add an\n * attribute to the response that will help you analyze what happened with\n * your offers.\n *\n * For example, you'll want to examine `offerResults` to add affordances like\n * these to your app:\n * - If `wasImmediatelyFilled` is true, then no offer was created. So if you\n * normally watch the `Server.offers` endpoint for offer updates, you\n * instead need to check `Server.trades` to find the result of this filled\n * offer.\n * - If `wasImmediatelyDeleted` is true, then the offer you submitted was\n * deleted without reaching the orderbook or being matched (possibly because\n * your amounts were rounded down to zero). So treat the just-submitted\n * offer request as if it never happened.\n * - If `wasPartiallyFilled` is true, you can tell the user that\n * `amountBought` or `amountSold` have already been transferred.\n *\n * @example\n * ```ts\n * const res = {\n * ...response,\n * offerResults: [\n * {\n * // Exact ordered list of offers that executed, with the exception\n * // that the last one may not have executed entirely.\n * offersClaimed: [\n * sellerId: String,\n * offerId: String,\n * assetSold: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same shape as assetSold\n * assetBought: {}\n * ],\n *\n * // What effect your manageOffer op had\n * effect: \"manageOfferCreated|manageOfferUpdated|manageOfferDeleted\",\n *\n * // Whether your offer immediately got matched and filled\n * wasImmediatelyFilled: Boolean,\n *\n * // Whether your offer immediately got deleted, if for example the order was too small\n * wasImmediatelyDeleted: Boolean,\n *\n * // Whether the offer was partially, but not completely, filled\n * wasPartiallyFilled: Boolean,\n *\n * // The full requested amount of the offer is open for matching\n * isFullyOpen: Boolean,\n *\n * // The total amount of tokens bought / sold during transaction execution\n * amountBought: Number,\n * amountSold: Number,\n *\n * // if the offer was created, updated, or partially filled, this is\n * // the outstanding offer\n * currentOffer: {\n * offerId: String,\n * amount: String,\n * price: {\n * n: String,\n * d: String,\n * },\n *\n * selling: {\n * type: 'native|credit_alphanum4|credit_alphanum12',\n *\n * // these are only present if the asset is not native\n * assetCode: String,\n * issuer: String,\n * },\n *\n * // same as `selling`\n * buying: {},\n * },\n *\n * // the index of this particular operation in the op stack\n * operationIndex: Number\n * }\n * ]\n * }\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-a-transaction | Submit a Transaction}\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves with the response from Horizon. Rejects\n * with a {@link TransactionFailedError} when Horizon reports transaction\n * result codes, a {@link BadResponseError} for any other HTTP error\n * response (the underlying client error is preserved as `cause` on both),\n * or the original error for network-level failures.\n */\n public async submitTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n timeout: SUBMIT_TRANSACTION_TIMEOUT,\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => {\n if (!response.data.result_xdr) {\n return response.data;\n }\n\n const responseXDR = xdr.TransactionResult.fromXDR(\n response.data.result_xdr,\n \"base64\",\n );\n\n // TODO: fix stellar-base types.\n const results = (responseXDR as any).result().value();\n\n let offerResults;\n let hasManageOffer;\n\n if (results.length) {\n offerResults = results\n // TODO: fix stellar-base types.\n .map((result: any, i: number) => {\n if (\n result.value().switch().name !== \"manageBuyOffer\" &&\n result.value().switch().name !== \"manageSellOffer\"\n ) {\n return null;\n }\n\n hasManageOffer = true;\n\n let amountBought = new CustomBigNumber(0);\n let amountSold = new CustomBigNumber(0);\n\n const offerSuccess = result.value().value().success();\n\n const offersClaimed = offerSuccess\n .offersClaimed()\n // TODO: fix stellar-base types.\n .map((offerClaimedAtom: any) => {\n const offerClaimed = offerClaimedAtom.value();\n\n let sellerId: string = \"\";\n switch (offerClaimedAtom.switch()) {\n case xdr.ClaimAtomType.claimAtomTypeV0():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerEd25519(),\n );\n break;\n case xdr.ClaimAtomType.claimAtomTypeOrderBook():\n sellerId = StrKey.encodeEd25519PublicKey(\n offerClaimed.sellerId().ed25519(),\n );\n break;\n // It shouldn't be possible for a claimed offer to have type\n // claimAtomTypeLiquidityPool:\n //\n // https://github.com/stellar/stellar-core/blob/c5f6349b240818f716617ca6e0f08d295a6fad9a/src/transactions/TransactionUtils.cpp#L1284\n //\n // However, you can never be too careful.\n default:\n throw new Error(\n `Invalid offer result type: ${offerClaimedAtom.switch()}`,\n );\n }\n\n const claimedOfferAmountBought = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountBought().toString(),\n );\n const claimedOfferAmountSold = new CustomBigNumber(\n // amountBought is a js-xdr hyper\n offerClaimed.amountSold().toString(),\n );\n\n // This is an offer that was filled by the one just submitted.\n // So this offer has an _opposite_ bought/sold frame of ref\n // than from what we just submitted!\n // So add this claimed offer's bought to the SOLD count and vice v\n\n amountBought = amountBought.plus(claimedOfferAmountSold);\n amountSold = amountSold.plus(claimedOfferAmountBought);\n\n const sold = Asset.fromOperation(offerClaimed.assetSold());\n const bought = Asset.fromOperation(\n offerClaimed.assetBought(),\n );\n\n const assetSold = {\n type: sold.getAssetType(),\n assetCode: sold.getCode(),\n issuer: sold.getIssuer(),\n };\n\n const assetBought = {\n type: bought.getAssetType(),\n assetCode: bought.getCode(),\n issuer: bought.getIssuer(),\n };\n\n return {\n sellerId,\n offerId: offerClaimed.offerId().toString(),\n assetSold,\n amountSold: getAmountInLumens(claimedOfferAmountSold),\n assetBought,\n amountBought: getAmountInLumens(claimedOfferAmountBought),\n };\n });\n\n const effect = offerSuccess.offer().switch().name;\n\n let currentOffer;\n\n if (\n typeof offerSuccess.offer().value === \"function\" &&\n offerSuccess.offer().value()\n ) {\n const offerXDR = offerSuccess.offer().value();\n\n currentOffer = {\n offerId: offerXDR.offerId().toString(),\n selling: {},\n buying: {},\n amount: getAmountInLumens(offerXDR.amount().toString()),\n price: {\n n: offerXDR.price().n(),\n d: offerXDR.price().d(),\n },\n };\n\n const selling = Asset.fromOperation(offerXDR.selling());\n\n currentOffer.selling = {\n type: selling.getAssetType(),\n assetCode: selling.getCode(),\n issuer: selling.getIssuer(),\n };\n\n const buying = Asset.fromOperation(offerXDR.buying());\n\n currentOffer.buying = {\n type: buying.getAssetType(),\n assetCode: buying.getCode(),\n issuer: buying.getIssuer(),\n };\n }\n\n return {\n offersClaimed,\n effect,\n operationIndex: i,\n currentOffer,\n\n // this value is in stroops so divide it out\n amountBought: getAmountInLumens(amountBought),\n amountSold: getAmountInLumens(amountSold),\n\n isFullyOpen:\n !offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasPartiallyFilled:\n !!offersClaimed.length && effect !== \"manageOfferDeleted\",\n wasImmediatelyFilled:\n !!offersClaimed.length && effect === \"manageOfferDeleted\",\n wasImmediatelyDeleted:\n !offersClaimed.length && effect === \"manageOfferDeleted\",\n };\n })\n // TODO: fix stellar-base types.\n .filter((result: any) => !!result);\n }\n\n return {\n ...response.data,\n offerResults: hasManageOffer ? offerResults : undefined,\n };\n })\n .catch((error) => Promise.reject(toSubmissionError(error)));\n }\n\n /**\n * Submits an asynchronous transaction to the network. Unlike the synchronous version, which blocks\n * and waits for the transaction to be ingested in Horizon, this endpoint relays the response from\n * core directly back to the user.\n *\n * By default, this function calls {@link HorizonServer.checkMemoRequired}, you can\n * skip this check by setting the option `skipMemoRequiredCheck` to `true`.\n *\n * @see [Submit-Async-Transaction](https://developers.stellar.org/docs/data/horizon/api-reference/resources/submit-async-transaction)\n * @param transaction - The transaction to submit.\n * @param opts - (optional) Options object\n * - `skipMemoRequiredCheck` (optional): Allow skipping memo\n * required check, default: `false`. See\n * [SEP0029](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md).\n * @returns Promise that resolves with the response from Horizon. Rejects\n * with a {@link TransactionFailedError} when Horizon reports transaction\n * result codes, a {@link BadResponseError} for any other HTTP error\n * response (the underlying client error is preserved as `cause` on both),\n * or the original error for network-level failures.\n */\n public async submitAsyncTransaction(\n transaction: Transaction | FeeBumpTransaction,\n opts: HorizonServer.SubmitTransactionOptions = {\n skipMemoRequiredCheck: false,\n },\n ): Promise<HorizonApi.SubmitAsyncTransactionResponse> {\n // only check for memo required if skipMemoRequiredCheck is false and the transaction doesn't include a memo.\n if (!opts.skipMemoRequiredCheck) {\n await this.checkMemoRequired(transaction);\n }\n\n const tx = encodeURIComponent(\n transaction.toEnvelope().toXDR().toString(\"base64\"),\n );\n const url = new URL(this.serverURL);\n url.pathname = url.pathname\n .split(\"/\")\n .concat([\"transactions_async\"])\n .filter((value) => value.length > 0)\n .join(\"/\");\n\n return this.httpClient\n .post(url.toString(), `tx=${tx}`, {\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n })\n .then((response) => response.data)\n .catch((error) => Promise.reject(toSubmissionError(error)));\n }\n\n /**\n * @returns New {@link AccountCallBuilder} object configured by a current Horizon server configuration.\n */\n public accounts(): AccountCallBuilder {\n return new AccountCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link ClaimableBalanceCallBuilder} object configured by a current Horizon server configuration.\n */\n public claimableBalances(): ClaimableBalanceCallBuilder {\n return new ClaimableBalanceCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LedgerCallBuilder} object configured by a current Horizon server configuration.\n */\n public ledgers(): LedgerCallBuilder {\n return new LedgerCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link TransactionCallBuilder} object configured by a current Horizon server configuration.\n */\n public transactions(): TransactionCallBuilder {\n return new TransactionCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * People on the Stellar network can make offers to buy or sell assets. This endpoint represents all the offers on the DEX.\n *\n * You can query all offers for account using the function `.accountId`.\n *\n * @example\n * ```ts\n * server.offers()\n * .forAccount(accountId).call()\n * .then(function(offers) {\n * console.log(offers);\n * });\n * ```\n *\n * @returns New {@link OfferCallBuilder} object\n */\n public offers(): OfferCallBuilder {\n return new OfferCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param selling - Asset being sold\n * @param buying - Asset being bought\n * @returns New {@link OrderbookCallBuilder} object configured by a current Horizon server configuration.\n */\n public orderbook(selling: Asset, buying: Asset): OrderbookCallBuilder {\n return new OrderbookCallBuilder(\n this.serverURL,\n this.httpClient,\n\n selling,\n buying,\n );\n }\n\n /**\n * Returns\n * @returns New {@link TradesCallBuilder} object configured by a current Horizon server configuration.\n */\n public trades(): TradesCallBuilder {\n return new TradesCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link OperationCallBuilder} object configured by a current Horizon server configuration.\n */\n public operations(): OperationCallBuilder {\n return new OperationCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link LiquidityPoolCallBuilder}\n * object configured to the current Horizon server settings.\n */\n public liquidityPools(): LiquidityPoolCallBuilder {\n return new LiquidityPoolCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path\n * payments. A strict receive path payment specifies a series of assets to\n * route a payment through, from source asset (the asset debited from the\n * payer) to destination asset (the asset credited to the payee).\n *\n * A strict receive path search is specified using:\n *\n * * The destination address.\n * * The source address or source assets.\n * * The asset and amount that the destination account should receive.\n *\n * As part of the search, horizon will load a list of assets available to the\n * source address and will find any payment paths from those source assets to\n * the desired destination asset. The search's amount parameter will be used\n * to determine if there a given path can satisfy a payment of the desired\n * amount.\n *\n * If a list of assets is passed as the source, horizon will find any payment\n * paths from those source assets to the desired destination asset.\n *\n * @param source - The sender's account ID or a list of assets. Any returned path will use a source that the sender can hold.\n * @param destinationAsset - The destination asset.\n * @param destinationAmount - The amount, denominated in the destination asset, that any returned path should be able to satisfy.\n * @returns New {@link StrictReceivePathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictReceivePaths(\n source: string | Asset[],\n destinationAsset: Asset,\n destinationAmount: string,\n ): PathCallBuilder {\n return new StrictReceivePathCallBuilder(\n this.serverURL,\n this.httpClient,\n source,\n destinationAsset,\n destinationAmount,\n );\n }\n\n /**\n * The Stellar Network allows payments to be made between assets through path payments. A strict send path payment specifies a\n * series of assets to route a payment through, from source asset (the asset debited from the payer) to destination\n * asset (the asset credited to the payee).\n *\n * A strict send path search is specified using:\n *\n * The asset and amount that is being sent.\n * The destination account or the destination assets.\n *\n * @param sourceAsset - The asset to be sent.\n * @param sourceAmount - The amount, denominated in the source asset, that any returned path should be able to satisfy.\n * @param destination - The destination account or the destination assets.\n * @returns New {@link StrictSendPathCallBuilder} object configured with the current Horizon server configuration.\n */\n public strictSendPaths(\n sourceAsset: Asset,\n sourceAmount: string,\n destination: string | Asset[],\n ): PathCallBuilder {\n return new StrictSendPathCallBuilder(\n this.serverURL,\n this.httpClient,\n sourceAsset,\n sourceAmount,\n destination,\n );\n }\n\n /**\n * @returns New {@link PaymentCallBuilder} instance configured with the current\n * Horizon server configuration.\n */\n public payments(): PaymentCallBuilder {\n return new PaymentCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @returns New {@link EffectCallBuilder} instance configured with the current\n * Horizon server configuration\n */\n public effects(): EffectCallBuilder {\n return new EffectCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * @param address - The Stellar ID that you want Friendbot to send lumens to\n * @returns New {@link FriendbotBuilder} instance configured with the current\n * Horizon server configuration\n */\n public friendbot(address: string): FriendbotBuilder {\n return new FriendbotBuilder(this.serverURL, this.httpClient, address);\n }\n\n /**\n * Get a new {@link AssetsCallBuilder} instance configured with the current\n * Horizon server configuration.\n * @returns New AssetsCallBuilder instance\n */\n public assets(): AssetsCallBuilder {\n return new AssetsCallBuilder(this.serverURL, this.httpClient);\n }\n\n /**\n * Fetches an account's most current state in the ledger, then creates and\n * returns an {@link AccountResponse} object.\n *\n * @param accountId - The account to load.\n *\n * @returns Returns a promise to the {@link AccountResponse} object\n * with populated sequence number.\n */\n public async loadAccount(accountId: string): Promise<AccountResponse> {\n const res = await this.accounts().accountId(accountId).call();\n\n return new AccountResponse(res);\n }\n\n /**\n *\n * @param base - base asset\n * @param counter - counter asset\n * @param start_time - lower time boundary represented as millis since epoch\n * @param end_time - upper time boundary represented as millis since epoch\n * @param resolution - segment duration as millis since epoch. *Supported values are 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).\n * @param offset - segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.\n * Returns new {@link TradeAggregationCallBuilder} object configured with the current Horizon server configuration.\n * @returns New TradeAggregationCallBuilder instance\n */\n public tradeAggregation(\n base: Asset,\n counter: Asset,\n start_time: number,\n end_time: number,\n resolution: number,\n offset: number,\n ): TradeAggregationCallBuilder {\n return new TradeAggregationCallBuilder(\n this.serverURL,\n this.httpClient,\n base,\n counter,\n start_time,\n end_time,\n resolution,\n offset,\n );\n }\n\n /**\n * Check if any of the destination accounts requires a memo.\n *\n * This function implements a memo required check as defined in\n * [SEP-29](https://stellar.org/protocol/sep-29). It will load each account\n * which is the destination and check if it has the data field\n * `config.memo_required` set to `\"MQ==\"`.\n *\n * Each account is checked sequentially instead of loading multiple accounts\n * at the same time from Horizon.\n *\n * @see {@link https://stellar.org/protocol/sep-29 | SEP-29: Account Memo Requirements}\n * @param transaction - The transaction to check.\n * @returns - If any of the destination account\n * requires a memo, the promise will throw {@link AccountRequiresMemoError}.\n * @throws */\n public async checkMemoRequired(\n transaction: Transaction | FeeBumpTransaction,\n ): Promise<void> {\n if (transaction instanceof FeeBumpTransaction) {\n transaction = transaction.innerTransaction;\n }\n\n if (transaction.memo.type !== \"none\") {\n return;\n }\n\n const destinations = new Set<string>();\n\n for (let i = 0; i < transaction.operations.length; i += 1) {\n const operation = transaction.operations[i];\n\n switch (operation.type) {\n case \"payment\":\n case \"pathPaymentStrictReceive\":\n case \"pathPaymentStrictSend\":\n case \"accountMerge\":\n break;\n default:\n continue;\n }\n const destination = operation.destination;\n if (destinations.has(destination)) {\n continue;\n }\n destinations.add(destination);\n\n // skip M account checks since it implies a memo\n if (destination.startsWith(\"M\")) {\n continue;\n }\n\n try {\n const account = await this.loadAccount(destination);\n if (\n account.data_attr[\"config.memo_required\"] === ACCOUNT_REQUIRES_MEMO\n ) {\n throw new AccountRequiresMemoError(\n \"account requires memo\",\n destination,\n i,\n );\n }\n } catch (e) {\n if (e instanceof AccountRequiresMemoError) {\n throw e;\n }\n\n // fail if the error is different to account not found\n if (!(e instanceof NotFoundError)) {\n throw e;\n }\n\n continue;\n }\n }\n }\n}\n\nexport namespace HorizonServer {\n /**\n * Options for configuring connections to Horizon servers.\n */\n export interface Options {\n /** Allow connecting to http servers, default: `false`. This must be set to false in production deployments! You can also use {@link Config} class to set this globally. */\n allowHttp?: boolean;\n /** Allow set custom header `X-App-Name`, default: `undefined`. */\n appName?: string;\n /** Allow set custom header `X-App-Version`, default: `undefined`. */\n appVersion?: string;\n /** Allow set custom header `X-Auth-Token`, default: `undefined`. */\n authToken?: string;\n headers?: Record<string, string>;\n }\n\n export interface Timebounds {\n minTime: number;\n maxTime: number;\n }\n\n export interface SubmitTransactionOptions {\n skipMemoRequiredCheck?: boolean;\n }\n}\n"],"names":["CustomBigNumber","wrapHttpError","TransactionFailedError","BadResponseError","Config","createHttpClient","getCurrentServerTime","CallBuilder","xdr","StrKey","Asset","AccountCallBuilder","ClaimableBalanceCallBuilder","LedgerCallBuilder","TransactionCallBuilder","OfferCallBuilder","OrderbookCallBuilder","TradesCallBuilder","OperationCallBuilder","LiquidityPoolCallBuilder","StrictReceivePathCallBuilder","StrictSendPathCallBuilder","PaymentCallBuilder","EffectCallBuilder","FriendbotBuilder","AssetsCallBuilder","AccountResponse","TradeAggregationCallBuilder","FeeBumpTransaction","AccountRequiresMemoError","NotFoundError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDO,MAAM,6BAAqC,EAAA,GAAK;AAEvD,MAAM,gBAAA,GAAmB,GAAA;AAIzB,MAAM,qBAAA,GAAwB,MAAA;AAE9B,SAAS,kBAAkB,GAAA,EAAgB;AACzC,EAAA,OAAO,IAAIA,iBAAA,CAAgB,GAAG,EAAE,GAAA,CA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MAAA,IAAI;AACF,QAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,WAAA,CAAY,WAAW,CAAA;AAClD,QAAA,IACE,OAAA,CAAQ,SAAA,CAAU,sBAAsB,CAAA,KAAM,qBAAA,EAC9C;AACA,UAAA,MAAM,IAAIC,8CAAA;AAAA,YACR,uBAAA;AAAA,YACA,WAAA;AAAA,YACA;AAAA,WACF;AAAA,QACF;AAAA,MACF,SAAS,CAAA,EAAG;AACV,QAAA,IAAI,aAAaA,8CAAA,EAA0B;AACzC,UAAA,MAAM,CAAA;AAAA,QACR;AAGA,QAAA,IAAI,EAAE,aAAaC,uBAAA,CAAA,EAAgB;AACjC,UAAA,MAAM,CAAA;AAAA,QACR;AAEA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;;;"}
|
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
var call_builder = require('./call_builder.js');
|
|
4
4
|
var bad_request = require('../errors/bad_request.js');
|
|
5
|
+
require('../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/int.js');
|
|
6
|
+
require('../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/hyper.js');
|
|
7
|
+
require('../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-int.js');
|
|
8
|
+
require('../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/unsigned-hyper.js');
|
|
9
|
+
require('../node_modules/.pnpm/@stellar_js-xdr@4.0.0/node_modules/@stellar/js-xdr/src/xdr-type.js');
|
|
10
|
+
require('buffer');
|
|
11
|
+
require('../base/generated/curr_generated.js');
|
|
12
|
+
require('@noble/hashes/sha2.js');
|
|
13
|
+
require('../base/signing.js');
|
|
14
|
+
require('../base/keypair.js');
|
|
15
|
+
require('base32.js');
|
|
16
|
+
require('../base/util/continued_fraction.js');
|
|
17
|
+
require('../base/util/bignumber.js');
|
|
18
|
+
require('../base/transaction_builder.js');
|
|
19
|
+
require('../base/muxed_account.js');
|
|
20
|
+
require('../base/scval.js');
|
|
21
|
+
require('../base/numbers/uint128.js');
|
|
22
|
+
require('../base/numbers/uint256.js');
|
|
23
|
+
require('../base/numbers/int128.js');
|
|
24
|
+
require('../base/numbers/int256.js');
|
|
5
25
|
|
|
6
26
|
const allowedResolutions = [
|
|
7
27
|
6e4,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trade_aggregation_call_builder.js","sources":["../../../../src/horizon/trade_aggregation_call_builder.ts"],"sourcesContent":["/* tslint:disable: variable-name */\nimport { Asset } from \"../base/index.js\";\nimport { CallBuilder } from \"./call_builder.js\";\nimport { BadRequestError } from \"../errors/index.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { ServerApi } from \"./server_api.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\nconst allowedResolutions = [\n 60000, 300000, 900000, 3600000, 86400000, 604800000,\n];\n\n/**\n * Trade Aggregations facilitate efficient gathering of historical trade data.\n *\n * Do not create this object directly, use {@link Horizon.Server.tradeAggregation}.\n *\n * @param serverUrl - serverUrl Horizon server URL.\n * @param base - base asset\n * @param counter - counter asset\n * @param start_time - lower time boundary represented as millis since epoch\n * @param end_time - upper time boundary represented as millis since epoch\n * @param resolution - segment duration as millis since epoch. *Supported values are 1 minute (60000), 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).\n * @param offset - segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.\n */\nexport class TradeAggregationCallBuilder extends CallBuilder<\n ServerApi.CollectionPage<TradeAggregationRecord>\n> {\n constructor(\n serverUrl: URL,\n httpClient: HttpClient,\n base: Asset,\n counter: Asset,\n start_time: number,\n end_time: number,\n resolution: number,\n offset: number,\n ) {\n super(serverUrl, httpClient);\n this.setPath(\"trade_aggregations\");\n const baseIssuer = base.getIssuer();\n if (!base.isNative() && baseIssuer !== undefined) {\n this.url.searchParams.set(\"base_asset_type\", base.getAssetType());\n this.url.searchParams.set(\"base_asset_code\", base.getCode());\n this.url.searchParams.set(\"base_asset_issuer\", baseIssuer);\n } else {\n this.url.searchParams.set(\"base_asset_type\", \"native\");\n }\n const counterIssuer = counter.getIssuer();\n if (!counter.isNative() && counterIssuer !== undefined) {\n this.url.searchParams.set(\"counter_asset_type\", counter.getAssetType());\n this.url.searchParams.set(\"counter_asset_code\", counter.getCode());\n this.url.searchParams.set(\"counter_asset_issuer\", counterIssuer);\n } else {\n this.url.searchParams.set(\"counter_asset_type\", \"native\");\n }\n if (typeof start_time !== \"number\" || typeof end_time !== \"number\") {\n throw new BadRequestError(\"Invalid time bounds\", [start_time, end_time]);\n } else {\n this.url.searchParams.set(\"start_time\", start_time.toString());\n this.url.searchParams.set(\"end_time\", end_time.toString());\n }\n if (!this.isValidResolution(resolution)) {\n throw new BadRequestError(\"Invalid resolution\", resolution);\n } else {\n this.url.searchParams.set(\"resolution\", resolution.toString());\n }\n if (!this.isValidOffset(offset, resolution)) {\n throw new BadRequestError(\"Invalid offset\", offset);\n } else {\n this.url.searchParams.set(\"offset\", offset.toString());\n }\n }\n\n /**\n * @hidden\n * @param resolution - Trade data resolution in milliseconds\n * @returns true if the resolution is allowed\n */\n private isValidResolution(resolution: number): boolean {\n return allowedResolutions.some((allowed) => allowed === resolution);\n }\n\n /**\n * @hidden\n * @param offset - Time offset in milliseconds\n * @param resolution - Trade data resolution in milliseconds\n * @returns true if the offset is valid\n */\n private isValidOffset(offset: number, resolution: number): boolean {\n const hour = 3600000;\n return !(offset > resolution || offset >= 24 * hour || offset % hour !== 0);\n }\n}\n\ninterface TradeAggregationRecord extends HorizonApi.BaseResponse {\n timestamp: number | string;\n trade_count: number | string;\n base_volume: string;\n counter_volume: string;\n avg: string;\n high: string;\n low: string;\n open: string;\n close: string;\n}\n"],"names":["CallBuilder","BadRequestError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"trade_aggregation_call_builder.js","sources":["../../../../src/horizon/trade_aggregation_call_builder.ts"],"sourcesContent":["/* tslint:disable: variable-name */\nimport { Asset } from \"../base/index.js\";\nimport { CallBuilder } from \"./call_builder.js\";\nimport { BadRequestError } from \"../errors/index.js\";\nimport { HorizonApi } from \"./horizon_api.js\";\nimport { ServerApi } from \"./server_api.js\";\nimport type { HttpClient } from \"../http-client/index.js\";\n\nconst allowedResolutions = [\n 60000, 300000, 900000, 3600000, 86400000, 604800000,\n];\n\n/**\n * Trade Aggregations facilitate efficient gathering of historical trade data.\n *\n * Do not create this object directly, use {@link Horizon.Server.tradeAggregation}.\n *\n * @param serverUrl - serverUrl Horizon server URL.\n * @param base - base asset\n * @param counter - counter asset\n * @param start_time - lower time boundary represented as millis since epoch\n * @param end_time - upper time boundary represented as millis since epoch\n * @param resolution - segment duration as millis since epoch. *Supported values are 1 minute (60000), 5 minutes (300000), 15 minutes (900000), 1 hour (3600000), 1 day (86400000) and 1 week (604800000).\n * @param offset - segments can be offset using this parameter. Expressed in milliseconds. *Can only be used if the resolution is greater than 1 hour. Value must be in whole hours, less than the provided resolution, and less than 24 hours.\n */\nexport class TradeAggregationCallBuilder extends CallBuilder<\n ServerApi.CollectionPage<TradeAggregationRecord>\n> {\n constructor(\n serverUrl: URL,\n httpClient: HttpClient,\n base: Asset,\n counter: Asset,\n start_time: number,\n end_time: number,\n resolution: number,\n offset: number,\n ) {\n super(serverUrl, httpClient);\n this.setPath(\"trade_aggregations\");\n const baseIssuer = base.getIssuer();\n if (!base.isNative() && baseIssuer !== undefined) {\n this.url.searchParams.set(\"base_asset_type\", base.getAssetType());\n this.url.searchParams.set(\"base_asset_code\", base.getCode());\n this.url.searchParams.set(\"base_asset_issuer\", baseIssuer);\n } else {\n this.url.searchParams.set(\"base_asset_type\", \"native\");\n }\n const counterIssuer = counter.getIssuer();\n if (!counter.isNative() && counterIssuer !== undefined) {\n this.url.searchParams.set(\"counter_asset_type\", counter.getAssetType());\n this.url.searchParams.set(\"counter_asset_code\", counter.getCode());\n this.url.searchParams.set(\"counter_asset_issuer\", counterIssuer);\n } else {\n this.url.searchParams.set(\"counter_asset_type\", \"native\");\n }\n if (typeof start_time !== \"number\" || typeof end_time !== \"number\") {\n throw new BadRequestError(\"Invalid time bounds\", [start_time, end_time]);\n } else {\n this.url.searchParams.set(\"start_time\", start_time.toString());\n this.url.searchParams.set(\"end_time\", end_time.toString());\n }\n if (!this.isValidResolution(resolution)) {\n throw new BadRequestError(\"Invalid resolution\", resolution);\n } else {\n this.url.searchParams.set(\"resolution\", resolution.toString());\n }\n if (!this.isValidOffset(offset, resolution)) {\n throw new BadRequestError(\"Invalid offset\", offset);\n } else {\n this.url.searchParams.set(\"offset\", offset.toString());\n }\n }\n\n /**\n * @hidden\n * @param resolution - Trade data resolution in milliseconds\n * @returns true if the resolution is allowed\n */\n private isValidResolution(resolution: number): boolean {\n return allowedResolutions.some((allowed) => allowed === resolution);\n }\n\n /**\n * @hidden\n * @param offset - Time offset in milliseconds\n * @param resolution - Trade data resolution in milliseconds\n * @returns true if the offset is valid\n */\n private isValidOffset(offset: number, resolution: number): boolean {\n const hour = 3600000;\n return !(offset > resolution || offset >= 24 * hour || offset % hour !== 0);\n }\n}\n\ninterface TradeAggregationRecord extends HorizonApi.BaseResponse {\n timestamp: number | string;\n trade_count: number | string;\n base_volume: string;\n counter_volume: string;\n avg: string;\n high: string;\n low: string;\n open: string;\n close: string;\n}\n"],"names":["CallBuilder","BadRequestError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,kBAAA,GAAqB;AAAA,EACzB,GAAA;AAAA,EAAO,GAAA;AAAA,EAAQ,GAAA;AAAA,EAAQ,IAAA;AAAA,EAAS,KAAA;AAAA,EAAU;AAC5C,CAAA;AAeO,MAAM,oCAAoCA,wBAAA,CAE/C;AAAA,EACA,WAAA,CACE,WACA,UAAA,EACA,IAAA,EACA,SACA,UAAA,E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;AAAA,EAC3E;AACF;;;;"}
|
package/lib/axios/cjs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var network = require('./errors/network.js');
|
|
|
4
4
|
var not_found = require('./errors/not_found.js');
|
|
5
5
|
var bad_request = require('./errors/bad_request.js');
|
|
6
6
|
var bad_response = require('./errors/bad_response.js');
|
|
7
|
+
var transaction_failed = require('./errors/transaction_failed.js');
|
|
7
8
|
var account_requires_memo = require('./errors/account_requires_memo.js');
|
|
8
9
|
var config = require('./config.js');
|
|
9
10
|
var utils = require('./utils.js');
|
|
@@ -65,6 +66,7 @@ exports.NetworkError = network.NetworkError;
|
|
|
65
66
|
exports.NotFoundError = not_found.NotFoundError;
|
|
66
67
|
exports.BadRequestError = bad_request.BadRequestError;
|
|
67
68
|
exports.BadResponseError = bad_response.BadResponseError;
|
|
69
|
+
exports.TransactionFailedError = transaction_failed.TransactionFailedError;
|
|
68
70
|
exports.AccountRequiresMemoError = account_requires_memo.AccountRequiresMemoError;
|
|
69
71
|
exports.Config = config.Config;
|
|
70
72
|
exports.Utils = utils.Utils;
|
|
@@ -129,6 +131,8 @@ exports.authorizeEntry = auth.authorizeEntry;
|
|
|
129
131
|
exports.authorizeInvocation = auth.authorizeInvocation;
|
|
130
132
|
exports.buildAuthorizationEntryPreimage = auth.buildAuthorizationEntryPreimage;
|
|
131
133
|
exports.buildWithDelegatesEntry = auth.buildWithDelegatesEntry;
|
|
134
|
+
exports.checkAuthEntryReadiness = auth.checkAuthEntryReadiness;
|
|
135
|
+
exports.inspectAuthEntry = auth.inspectAuthEntry;
|
|
132
136
|
exports.buildInvocationTree = invocation.buildInvocationTree;
|
|
133
137
|
exports.walkInvocationTree = invocation.walkInvocationTree;
|
|
134
138
|
exports.scValToBigInt = index$7.scValToBigInt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["../../../../src/rpc/api.ts"],"sourcesContent":["import { Contract, SorobanDataBuilder, xdr } from \"../base/index.js\";\n\n/* tslint:disable-next-line:no-namespace */\nexport namespace Api {\n export interface GetHealthResponse {\n latestLedger: number;\n ledgerRetentionWindow: number;\n oldestLedger: number;\n status: \"healthy\";\n }\n\n export interface LedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n key: xdr.LedgerKey;\n val: xdr.LedgerEntryData;\n liveUntilLedgerSeq?: number;\n }\n\n export interface RawLedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n /** a base-64 encoded {@link xdr.LedgerKey} instance */\n key: string;\n /** a base-64 encoded {@link xdr.LedgerEntryData} instance */\n xdr: string;\n /**\n * optional, a future ledger number upon which this entry will expire\n * based on https://github.com/stellar/soroban-tools/issues/1010\n */\n liveUntilLedgerSeq?: number;\n }\n\n /** An XDR-parsed version of {@link RawLedgerEntryResult} */\n export interface GetLedgerEntriesResponse {\n entries: LedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries */\n export interface RawGetLedgerEntriesResponse {\n entries?: RawLedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork */\n export interface GetNetworkResponse {\n friendbotUrl?: string;\n passphrase: string;\n protocolVersion: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger */\n export interface GetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n headerXdr: xdr.LedgerHeader;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawGetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeader} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n\n export enum GetTransactionStatus {\n SUCCESS = \"SUCCESS\",\n NOT_FOUND = \"NOT_FOUND\",\n FAILED = \"FAILED\",\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction */\n export type GetTransactionResponse =\n | GetSuccessfulTransactionResponse\n | GetFailedTransactionResponse\n | GetMissingTransactionResponse;\n\n interface GetAnyTransactionResponse {\n status: GetTransactionStatus;\n txHash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n }\n\n export interface GetMissingTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.NOT_FOUND;\n }\n\n export interface GetFailedTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.FAILED;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n events: TransactionEvents;\n }\n\n export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.SUCCESS;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n returnValue?: xdr.ScVal; // present iff resultMeta is a v3|v4\n events: TransactionEvents;\n }\n\n export interface RawGetTransactionResponse {\n status: GetTransactionStatus;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n txHash: string;\n\n // the fields below are set if status is SUCCESS\n applicationOrder?: number;\n feeBump?: boolean;\n ledger?: number;\n createdAt?: number;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export type GetTransactionsRequest =\n | {\n startLedger: number;\n pagination?: {\n cursor?: never;\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n pagination: {\n cursor: string;\n limit?: number;\n };\n };\n\n export interface RawTransactionEvents {\n transactionEventsXdr?: string[];\n contractEventsXdr?: string[][];\n }\n\n export interface RawTransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export interface TransactionEvents {\n transactionEventsXdr: xdr.TransactionEvent[];\n contractEventsXdr: xdr.ContractEvent[][];\n }\n\n export interface TransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n returnValue?: xdr.ScVal;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n events: TransactionEvents;\n }\n\n export interface GetTransactionsResponse {\n transactions: TransactionInfo[];\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export interface RawGetTransactionsResponse {\n transactions: RawTransactionInfo[] | null;\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export type EventType = \"contract\" | \"system\";\n\n export interface EventFilter {\n type?: EventType;\n contractIds?: string[];\n topics?: string[][];\n }\n\n interface RetentionState {\n latestLedger: number;\n oldestLedger: number;\n latestLedgerCloseTime: string;\n oldestLedgerCloseTime: string;\n }\n\n /**\n * Request parameters for fetching events from the Stellar network.\n *\n * **Important**: This type enforces mutually exclusive pagination modes:\n * - **Ledger range mode**: Use `startLedger` and `endLedger` (cursor must be omitted)\n * - **Cursor pagination mode**: Use `cursor` (startLedger and endLedger must be omitted)\n *\n * @example\n * ```ts\n * // ✅ Correct: Ledger range mode\n * const rangeRequest: GetEventsRequest = {\n * filters: [],\n * startLedger: 1000,\n * endLedger: 2000,\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ✅ Correct: Cursor pagination mode\n * const cursorRequest: GetEventsRequest = {\n * filters: [],\n * cursor: \"some-cursor-value\",\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ❌ Invalid: Cannot mix cursor with ledger range\n * const invalidRequest = {\n * filters: [],\n * startLedger: 1000, // ❌ Cannot use with cursor\n * endLedger: 2000, // ❌ Cannot use with cursor\n * cursor: \"cursor\", // ❌ Cannot use with ledger range\n * limit: 100\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents API reference}\n */\n export type GetEventsRequest =\n | {\n filters: Api.EventFilter[];\n startLedger: number;\n endLedger?: number;\n cursor?: never; // explicitly exclude cursor\n limit?: number;\n }\n | {\n filters: Api.EventFilter[];\n cursor: string;\n startLedger?: never; // explicitly exclude startLedger\n endLedger?: never; // explicitly exclude endLedger\n limit?: number;\n };\n\n export interface GetEventsResponse extends RetentionState {\n events: EventResponse[];\n cursor: string;\n }\n\n export interface EventResponse extends BaseEventResponse {\n contractId?: Contract;\n topic: xdr.ScVal[];\n value: xdr.ScVal;\n }\n\n export interface RawGetEventsResponse extends RetentionState {\n events: RawEventResponse[];\n cursor: string;\n }\n\n interface BaseEventResponse {\n id: string;\n type: EventType;\n ledger: number;\n ledgerClosedAt: string;\n transactionIndex: number;\n operationIndex: number;\n inSuccessfulContractCall: boolean;\n txHash: string;\n }\n\n export interface RawEventResponse extends BaseEventResponse {\n contractId: string;\n topic?: string[];\n value: string;\n }\n\n interface RawLedgerEntryChange {\n type: number;\n /** This is LedgerKey in base64 */\n key: string;\n /** This is xdr.LedgerEntry in base64 */\n before: string | null;\n /** This is xdr.LedgerEntry in base64 */\n after: string | null;\n }\n\n export interface LedgerEntryChange {\n type: number;\n key: xdr.LedgerKey;\n before: xdr.LedgerEntry | null;\n after: xdr.LedgerEntry | null;\n }\n\n export type SendTransactionStatus =\n | \"PENDING\"\n | \"DUPLICATE\"\n | \"TRY_AGAIN_LATER\"\n | \"ERROR\";\n\n export interface SendTransactionResponse extends BaseSendTransactionResponse {\n errorResult?: xdr.TransactionResult;\n diagnosticEvents?: xdr.DiagnosticEvent[];\n }\n\n export interface RawSendTransactionResponse extends BaseSendTransactionResponse {\n /**\n * This is a base64-encoded instance of {@link xdr.TransactionResult}, set\n * only when `status` is `\"ERROR\"`.\n *\n * It contains details on why the network rejected the transaction.\n */\n errorResultXdr?: string;\n /**\n * This is a base64-encoded instance of an array of\n * {@link xdr.DiagnosticEvent}s, set only when `status` is `\"ERROR\"` and\n * diagnostic events are enabled on the server.\n */\n diagnosticEventsXdr?: string[];\n }\n\n export interface BaseSendTransactionResponse {\n status: SendTransactionStatus;\n hash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n }\n\n export interface SimulateHostFunctionResult {\n auth: xdr.SorobanAuthorizationEntry[];\n retval: xdr.ScVal;\n }\n\n export type SimulationAuthMode =\n | \"enforce\"\n | \"record\"\n | \"record_allow_nonroot\";\n\n /**\n * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces\n * based on status:\n * - on success, this includes all fields, though `result` is only present\n * if an invocation was simulated (since otherwise there's nothing to\n * \"resultify\")\n * - if there was an expiration error, this includes error and restoration\n * fields\n * - for all other errors, this only includes error fields\n *\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction\n */\n export type SimulateTransactionResponse =\n | SimulateTransactionSuccessResponse\n | SimulateTransactionRestoreResponse\n | SimulateTransactionErrorResponse;\n\n export interface BaseSimulateTransactionResponse {\n /** always present: the JSON-RPC request ID */\n id: string;\n\n /** always present: the LCL known to the server when responding */\n latestLedger: number;\n\n /**\n * The field is always present, but may be empty in cases where:\n * - you didn't simulate an invocation or\n * - there were no events\n */\n events: xdr.DiagnosticEvent[];\n\n /** a private field to mark the schema as parsed */\n _parsed: boolean;\n }\n\n /** Includes simplified fields only present on success. */\n export interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {\n transactionData: SorobanDataBuilder;\n minResourceFee: string;\n\n /** present only for invocation simulation */\n result?: SimulateHostFunctionResult;\n\n /** State Difference information */\n stateChanges?: LedgerEntryChange[];\n }\n\n /** Includes details about why the simulation failed */\n export interface SimulateTransactionErrorResponse extends BaseSimulateTransactionResponse {\n error: string;\n events: xdr.DiagnosticEvent[];\n }\n\n export interface SimulateTransactionRestoreResponse extends SimulateTransactionSuccessResponse {\n result: SimulateHostFunctionResult; // not optional now\n\n /**\n * Indicates that a restoration is necessary prior to submission.\n *\n * In other words, seeing a restoration preamble means that your invocation\n * was executed AS IF the required ledger entries were present, and this\n * field includes information about what you need to restore for the\n * simulation to succeed.\n */\n restorePreamble: {\n minResourceFee: string;\n transactionData: SorobanDataBuilder;\n };\n }\n\n /**\n * Checks if a simulation response indicates an error.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates an error, false otherwise.\n */\n export function isSimulationError(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionErrorResponse {\n return \"error\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates success.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates success, false otherwise.\n */\n export function isSimulationSuccess(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionSuccessResponse {\n return \"transactionData\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates that a restoration is needed.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates a restoration is needed, false otherwise.\n */\n export function isSimulationRestore(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionRestoreResponse {\n return (\n isSimulationSuccess(sim) &&\n \"restorePreamble\" in sim &&\n !!sim.restorePreamble.transactionData\n );\n }\n\n /**\n * Checks if a simulation response is in raw (unparsed) form.\n * @param sim - The simulation response to check.\n * @returns True if the response is raw, false otherwise.\n */\n export function isSimulationRaw(\n sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse,\n ): sim is Api.RawSimulateTransactionResponse {\n return !(sim as Api.SimulateTransactionResponse)._parsed;\n }\n\n interface RawSimulateHostFunctionResult {\n // each string is SorobanAuthorizationEntry XDR in base64\n auth?: string[];\n // invocation return value: the ScVal in base64\n xdr: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction */\n export interface RawSimulateTransactionResponse {\n id: string;\n latestLedger: number;\n error?: string;\n /** This is an xdr.SorobanTransactionData in base64 */\n transactionData?: string;\n /** These are xdr.DiagnosticEvents in base64 */\n events?: string[];\n minResourceFee?: string;\n /**\n * This will only contain a single element if present, because only a single\n * invokeHostFunctionOperation is supported per transaction.\n * */\n results?: RawSimulateHostFunctionResult[];\n /** Present if succeeded but has expired ledger entries */\n restorePreamble?: {\n minResourceFee: string;\n transactionData: string;\n };\n\n /** State difference information */\n stateChanges?: RawLedgerEntryChange[];\n }\n\n export interface GetVersionInfoResponse {\n version: string;\n commitHash: string;\n buildTimestamp: string;\n captiveCoreVersion: string;\n protocolVersion: number; // uint32\n\n /// @deprecated\n commit_hash: string;\n /// @deprecated\n build_timestamp: string;\n /// @deprecated\n captive_core_version: string;\n /// @deprecated\n protocol_version: number; // uint32\n }\n\n export interface GetFeeStatsResponse {\n sorobanInclusionFee: FeeDistribution;\n inclusionFee: FeeDistribution;\n latestLedger: number; // uint32\n }\n\n interface FeeDistribution {\n max: string; // uint64\n min: string; // uint64\n mode: string; // uint64\n p10: string; // uint64\n p20: string; // uint64\n p30: string; // uint64\n p40: string; // uint64\n p50: string; // uint64\n p60: string; // uint64\n p70: string; // uint64\n p80: string; // uint64\n p90: string; // uint64\n p95: string; // uint64\n p99: string; // uint64\n\n transactionCount: string; // uint32\n ledgerCount: number; // uint32\n }\n\n export interface BalanceResponse {\n latestLedger: number;\n /** present only on success, otherwise request malformed or no balance */\n balanceEntry?: {\n /** a 64-bit integer for trustlines, 128-bit value for contracts */\n amount: string;\n authorized: boolean;\n clawback: boolean;\n authorizedToMaintainLiabilities?: boolean; // only present for trustlines\n /** @deprecated Please use `authorizedToMaintainLiabilities` instead */\n revocable?: boolean;\n lastModifiedLedgerSeq?: number;\n liveUntilLedgerSeq?: number;\n };\n }\n\n /**\n * Request parameters for fetching a sequential list of ledgers.\n *\n * This type supports two distinct pagination modes that are mutually exclusive:\n * - **Ledger-based pagination**: Use `startLedger` to begin fetching from a specific ledger sequence\n * - **Cursor-based pagination**: Use `cursor` to continue from a previous response's pagination token\n *\n * @example\n * ```ts\n * // Ledger-based pagination - start from specific ledger\n * const ledgerRequest: GetLedgersRequest = {\n * startLedger: 36233,\n * pagination: {\n * limit: 10\n * }\n * };\n * ```\n *\n * @example\n * ```ts\n * // Cursor-based pagination - continue from previous response\n * const cursorRequest: GetLedgersRequest = {\n * pagination: {\n * cursor: \"36234\",\n * limit: 5\n * }\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers API reference}\n */\n export type GetLedgersRequest =\n | {\n /**\n * Ledger sequence number to start fetching from (inclusive).\n * Must be omitted if cursor is provided. Cannot be less than the oldest ledger or greater\n * than the latest ledger stored on the RPC node.\n */\n startLedger: number;\n /** Pagination configuration for the request. */\n pagination?: {\n cursor?: never;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n /** Pagination configuration for the request. */\n pagination: {\n /**\n * Page cursor for continuing pagination from a previous\n * response. Must be omitted if startLedger is provided.\n */\n cursor: string;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n };\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers */\n export interface GetLedgersResponse {\n ledgers: LedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface RawGetLedgersResponse {\n ledgers: RawLedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface LedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n headerXdr: xdr.LedgerHeaderHistoryEntry;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawLedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeaderHistoryEntry} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n}\n"],"names":["Api","GetTransactionStatus"],"mappings":";;AAGiBA;AAAA,CAAV,CAAUA,IAAAA,KAAV;AAoEE,EAAA,CAAA,CAAKC,qBAAAA,KAAL;AACL,IAAAA,sBAAA,SAAA,CAAA,GAAU,SAAA;AACV,IAAAA,sBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,IAAAA,sBAAA,QAAA,CAAA,GAAS,QAAA;AAAA,EAAA,CAAA,EAHCD,IAAAA,CAAA,oBAAA,KAAAA,IAAAA,CAAA,oBAAA,GAAA,EAAA,CAAA,CAAA;AA4YL,EAAA,SAAS,kBACd,GAAA,EACyC;AACzC,IAAA,OAAO,OAAA,IAAW,GAAA;AAAA,EACpB;AAJO,EAAAA,IAAAA,CAAS,iBAAA,GAAA,iBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,iBAAA,IAAqB,GAAA;AAAA,EAC9B;AAJO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OACE,mBAAA,CAAoB,GAAG,CAAA,IACvB,iBAAA,IAAqB,OACrB,CAAC,CAAC,IAAI,eAAA,CAAgB,eAAA;AAAA,EAE1B;AARO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAeT,EAAA,SAAS,gBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,CAAE,GAAA,CAAwC,OAAA;AAAA,EACnD;AAJO,EAAAA,IAAAA,CAAS,eAAA,GAAA,eAAA;AAAA,CAAA,EArfDA,WAAA,KAAAA,WAAA,GAAA,EAAA,CAAA,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["../../../../src/rpc/api.ts"],"sourcesContent":["import { Contract, SorobanDataBuilder, xdr } from \"../base/index.js\";\n\n/* tslint:disable-next-line:no-namespace */\nexport namespace Api {\n export interface GetHealthResponse {\n latestLedger: number;\n ledgerRetentionWindow: number;\n oldestLedger: number;\n status: \"healthy\";\n }\n\n export interface LedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n key: xdr.LedgerKey;\n val: xdr.LedgerEntryData;\n liveUntilLedgerSeq?: number;\n }\n\n export interface RawLedgerEntryResult {\n lastModifiedLedgerSeq?: number;\n /** a base-64 encoded {@link xdr.LedgerKey} instance */\n key: string;\n /** a base-64 encoded {@link xdr.LedgerEntryData} instance */\n xdr: string;\n /**\n * optional, a future ledger number upon which this entry will expire\n * based on https://github.com/stellar/soroban-tools/issues/1010\n */\n liveUntilLedgerSeq?: number;\n }\n\n /** An XDR-parsed version of {@link RawLedgerEntryResult} */\n export interface GetLedgerEntriesResponse {\n entries: LedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgerEntries */\n export interface RawGetLedgerEntriesResponse {\n entries?: RawLedgerEntryResult[];\n latestLedger: number;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getNetwork */\n export interface GetNetworkResponse {\n friendbotUrl?: string;\n passphrase: string;\n protocolVersion: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLatestLedger */\n export interface GetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n headerXdr: xdr.LedgerHeader;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawGetLatestLedgerResponse {\n id: string;\n sequence: number;\n protocolVersion: string;\n closeTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeader} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n\n export enum GetTransactionStatus {\n SUCCESS = \"SUCCESS\",\n NOT_FOUND = \"NOT_FOUND\",\n FAILED = \"FAILED\",\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getTransaction */\n export type GetTransactionResponse =\n | GetSuccessfulTransactionResponse\n | GetFailedTransactionResponse\n | GetMissingTransactionResponse;\n\n interface GetAnyTransactionResponse {\n status: GetTransactionStatus;\n txHash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n }\n\n export interface GetMissingTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.NOT_FOUND;\n }\n\n export interface GetFailedTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.FAILED;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n events: TransactionEvents;\n }\n\n export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse {\n status: GetTransactionStatus.SUCCESS;\n\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n returnValue?: xdr.ScVal; // present iff resultMeta is a v3|v4\n events: TransactionEvents;\n }\n\n export interface RawGetTransactionResponse {\n status: GetTransactionStatus;\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n txHash: string;\n\n // the fields below are set if status is SUCCESS\n applicationOrder?: number;\n feeBump?: boolean;\n ledger?: number;\n createdAt?: number;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export type GetTransactionsRequest =\n | {\n startLedger: number;\n pagination?: {\n cursor?: never;\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n pagination: {\n cursor: string;\n limit?: number;\n };\n };\n\n export interface RawTransactionEvents {\n transactionEventsXdr?: string[];\n contractEventsXdr?: string[][];\n }\n\n export interface RawTransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr?: string;\n resultXdr?: string;\n resultMetaXdr?: string;\n diagnosticEventsXdr?: string[];\n\n events?: RawTransactionEvents;\n }\n\n export interface TransactionEvents {\n transactionEventsXdr: xdr.TransactionEvent[];\n contractEventsXdr: xdr.ContractEvent[][];\n }\n\n export interface TransactionInfo {\n status: GetTransactionStatus;\n ledger: number;\n createdAt: number;\n applicationOrder: number;\n feeBump: boolean;\n txHash: string;\n\n envelopeXdr: xdr.TransactionEnvelope;\n resultXdr: xdr.TransactionResult;\n resultMetaXdr: xdr.TransactionMeta;\n returnValue?: xdr.ScVal;\n diagnosticEventsXdr?: xdr.DiagnosticEvent[];\n\n events: TransactionEvents;\n }\n\n export interface GetTransactionsResponse {\n transactions: TransactionInfo[];\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export interface RawGetTransactionsResponse {\n transactions: RawTransactionInfo[] | null;\n latestLedger: number;\n latestLedgerCloseTimestamp: number;\n oldestLedger: number;\n oldestLedgerCloseTimestamp: number;\n cursor: string;\n }\n\n export type EventType = \"contract\" | \"system\";\n\n export interface EventFilter {\n type?: EventType;\n contractIds?: string[];\n topics?: string[][];\n }\n\n interface RetentionState {\n latestLedger: number;\n oldestLedger: number;\n latestLedgerCloseTime: string;\n oldestLedgerCloseTime: string;\n }\n\n /**\n * Request parameters for fetching events from the Stellar network.\n *\n * **Important**: This type enforces mutually exclusive pagination modes:\n * - **Ledger range mode**: Use `startLedger` and `endLedger` (cursor must be omitted)\n * - **Cursor pagination mode**: Use `cursor` (startLedger and endLedger must be omitted)\n *\n * @example\n * ```ts\n * // ✅ Correct: Ledger range mode\n * const rangeRequest: GetEventsRequest = {\n * filters: [],\n * startLedger: 1000,\n * endLedger: 2000,\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ✅ Correct: Cursor pagination mode\n * const cursorRequest: GetEventsRequest = {\n * filters: [],\n * cursor: \"some-cursor-value\",\n * limit: 100\n * };\n * ```\n *\n * @example\n * ```ts\n * // ❌ Invalid: Cannot mix cursor with ledger range\n * const invalidRequest = {\n * filters: [],\n * startLedger: 1000, // ❌ Cannot use with cursor\n * endLedger: 2000, // ❌ Cannot use with cursor\n * cursor: \"cursor\", // ❌ Cannot use with ledger range\n * limit: 100\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getEvents | getEvents API reference}\n */\n export type GetEventsRequest =\n | {\n filters: Api.EventFilter[];\n startLedger: number;\n endLedger?: number;\n cursor?: never; // explicitly exclude cursor\n limit?: number;\n }\n | {\n filters: Api.EventFilter[];\n cursor: string;\n startLedger?: never; // explicitly exclude startLedger\n endLedger?: never; // explicitly exclude endLedger\n limit?: number;\n };\n\n export interface GetEventsResponse extends RetentionState {\n events: EventResponse[];\n cursor: string;\n }\n\n export interface EventResponse extends BaseEventResponse {\n contractId?: Contract;\n topic: xdr.ScVal[];\n value: xdr.ScVal;\n }\n\n export interface RawGetEventsResponse extends RetentionState {\n events: RawEventResponse[];\n cursor: string;\n }\n\n interface BaseEventResponse {\n id: string;\n type: EventType;\n ledger: number;\n ledgerClosedAt: string;\n transactionIndex: number;\n operationIndex: number;\n inSuccessfulContractCall: boolean;\n txHash: string;\n }\n\n export interface RawEventResponse extends BaseEventResponse {\n contractId: string;\n topic?: string[];\n value: string;\n }\n\n interface RawLedgerEntryChange {\n type: number;\n /** This is LedgerKey in base64 */\n key: string;\n /** This is xdr.LedgerEntry in base64 */\n before: string | null;\n /** This is xdr.LedgerEntry in base64 */\n after: string | null;\n }\n\n export interface LedgerEntryChange {\n type: number;\n key: xdr.LedgerKey;\n before: xdr.LedgerEntry | null;\n after: xdr.LedgerEntry | null;\n }\n\n export type SendTransactionStatus =\n | \"PENDING\"\n | \"DUPLICATE\"\n | \"TRY_AGAIN_LATER\"\n | \"ERROR\";\n\n export interface SendTransactionResponse extends BaseSendTransactionResponse {\n errorResult?: xdr.TransactionResult;\n diagnosticEvents?: xdr.DiagnosticEvent[];\n }\n\n export interface RawSendTransactionResponse extends BaseSendTransactionResponse {\n /**\n * This is a base64-encoded instance of {@link xdr.TransactionResult}, set\n * only when `status` is `\"ERROR\"`.\n *\n * It contains details on why the network rejected the transaction.\n */\n errorResultXdr?: string;\n /**\n * This is a base64-encoded instance of an array of\n * {@link xdr.DiagnosticEvent}s, set only when `status` is `\"ERROR\"` and\n * diagnostic events are enabled on the server.\n */\n diagnosticEventsXdr?: string[];\n }\n\n export interface BaseSendTransactionResponse {\n status: SendTransactionStatus;\n hash: string;\n latestLedger: number;\n latestLedgerCloseTime: number;\n }\n\n export interface SimulateHostFunctionResult {\n auth: xdr.SorobanAuthorizationEntry[];\n retval: xdr.ScVal;\n }\n\n export type SimulationAuthMode =\n | \"enforce\"\n | \"record\"\n | \"record_allow_nonroot\";\n\n /**\n * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces\n * based on status:\n * - on success, this includes all fields, though `result` is only present\n * if an invocation was simulated (since otherwise there's nothing to\n * \"resultify\")\n * - if there was an expiration error, this includes error and restoration\n * fields\n * - for all other errors, this only includes error fields\n *\n * @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction\n */\n export type SimulateTransactionResponse =\n | SimulateTransactionSuccessResponse\n | SimulateTransactionRestoreResponse\n | SimulateTransactionErrorResponse;\n\n export interface BaseSimulateTransactionResponse {\n /** always present: the JSON-RPC request ID */\n id: string;\n\n /** always present: the LCL known to the server when responding */\n latestLedger: number;\n\n /**\n * The field is always present, but may be empty in cases where:\n * - you didn't simulate an invocation or\n * - there were no events\n */\n events: xdr.DiagnosticEvent[];\n\n /** a private field to mark the schema as parsed */\n _parsed: boolean;\n }\n\n /** Includes simplified fields only present on success. */\n export interface SimulateTransactionSuccessResponse extends BaseSimulateTransactionResponse {\n transactionData: SorobanDataBuilder;\n minResourceFee: string;\n\n /** present only for invocation simulation */\n result?: SimulateHostFunctionResult;\n\n /** State Difference information */\n stateChanges?: LedgerEntryChange[];\n }\n\n /** Includes details about why the simulation failed */\n export interface SimulateTransactionErrorResponse extends BaseSimulateTransactionResponse {\n error: string;\n events: xdr.DiagnosticEvent[];\n }\n\n export interface SimulateTransactionRestoreResponse extends SimulateTransactionSuccessResponse {\n result: SimulateHostFunctionResult; // not optional now\n\n /**\n * Indicates that a restoration is necessary prior to submission.\n *\n * In other words, seeing a restoration preamble means that your invocation\n * was executed AS IF the required ledger entries were present, and this\n * field includes information about what you need to restore for the\n * simulation to succeed.\n */\n restorePreamble: {\n minResourceFee: string;\n transactionData: SorobanDataBuilder;\n };\n }\n\n /**\n * Checks if a simulation response indicates an error.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates an error, false otherwise.\n */\n export function isSimulationError(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionErrorResponse {\n return \"error\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates success.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates success, false otherwise.\n */\n export function isSimulationSuccess(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionSuccessResponse {\n return \"transactionData\" in sim;\n }\n\n /**\n * Checks if a simulation response indicates that a restoration is needed.\n * @param sim - The simulation response to check.\n * @returns True if the response indicates a restoration is needed, false otherwise.\n */\n export function isSimulationRestore(\n sim: SimulateTransactionResponse,\n ): sim is SimulateTransactionRestoreResponse {\n return (\n isSimulationSuccess(sim) &&\n \"restorePreamble\" in sim &&\n !!sim.restorePreamble.transactionData\n );\n }\n\n /**\n * Checks if a simulation response is in raw (unparsed) form.\n * @param sim - The simulation response to check.\n * @returns True if the response is raw, false otherwise.\n */\n export function isSimulationRaw(\n sim: Api.SimulateTransactionResponse | Api.RawSimulateTransactionResponse,\n ): sim is Api.RawSimulateTransactionResponse {\n return !(sim as Api.SimulateTransactionResponse)._parsed;\n }\n\n interface RawSimulateHostFunctionResult {\n // each string is SorobanAuthorizationEntry XDR in base64\n auth?: string[];\n // invocation return value: the ScVal in base64\n xdr: string;\n }\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/simulateTransaction */\n export interface RawSimulateTransactionResponse {\n id: string;\n latestLedger: number;\n error?: string;\n /** This is an xdr.SorobanTransactionData in base64 */\n transactionData?: string;\n /** These are xdr.DiagnosticEvents in base64 */\n events?: string[];\n minResourceFee?: string;\n /**\n * This will only contain a single element if present, because only a single\n * invokeHostFunctionOperation is supported per transaction.\n * */\n results?: RawSimulateHostFunctionResult[];\n /** Present if succeeded but has expired ledger entries */\n restorePreamble?: {\n minResourceFee: string;\n transactionData: string;\n };\n\n /** State difference information */\n stateChanges?: RawLedgerEntryChange[];\n }\n\n export interface GetVersionInfoResponse {\n version: string;\n commitHash: string;\n buildTimestamp: string;\n captiveCoreVersion: string;\n protocolVersion: number; // uint32\n\n /// @deprecated\n commit_hash: string;\n /// @deprecated\n build_timestamp: string;\n /// @deprecated\n captive_core_version: string;\n /// @deprecated\n protocol_version: number; // uint32\n }\n\n export interface GetFeeStatsResponse {\n sorobanInclusionFee: FeeDistribution;\n inclusionFee: FeeDistribution;\n latestLedger: number; // uint32\n }\n\n interface FeeDistribution {\n max: string; // uint64\n min: string; // uint64\n mode: string; // uint64\n p10: string; // uint64\n p20: string; // uint64\n p30: string; // uint64\n p40: string; // uint64\n p50: string; // uint64\n p60: string; // uint64\n p70: string; // uint64\n p80: string; // uint64\n p90: string; // uint64\n p95: string; // uint64\n p99: string; // uint64\n\n transactionCount: string; // uint32\n ledgerCount: number; // uint32\n }\n\n export interface BalanceResponse {\n latestLedger: number;\n /** present only on success, otherwise request malformed or no balance */\n balanceEntry?: {\n /** a 64-bit integer for trustlines, 128-bit value for contracts */\n amount: string;\n authorized: boolean;\n clawback: boolean;\n authorizedToMaintainLiabilities?: boolean; // only present for trustlines\n /** @deprecated Please use `authorizedToMaintainLiabilities` instead */\n revocable?: boolean;\n lastModifiedLedgerSeq?: number;\n liveUntilLedgerSeq?: number;\n };\n }\n\n /**\n * Request parameters for fetching a sequential list of ledgers.\n *\n * This type supports two distinct pagination modes that are mutually exclusive:\n * - **Ledger-based pagination**: Use `startLedger` to begin fetching from a specific ledger sequence\n * - **Cursor-based pagination**: Use `cursor` to continue from a previous response's pagination token\n *\n * @example\n * ```ts\n * // Ledger-based pagination - start from specific ledger\n * const ledgerRequest: GetLedgersRequest = {\n * startLedger: 36233,\n * pagination: {\n * limit: 10\n * }\n * };\n * ```\n *\n * @example\n * ```ts\n * // Cursor-based pagination - continue from previous response\n * const cursorRequest: GetLedgersRequest = {\n * pagination: {\n * cursor: \"36234\",\n * limit: 5\n * }\n * };\n * ```\n *\n * @see {@link https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers | getLedgers API reference}\n */\n export type GetLedgersRequest =\n | {\n /**\n * Ledger sequence number to start fetching from (inclusive).\n * Must be omitted if cursor is provided. Cannot be less than the oldest ledger or greater\n * than the latest ledger stored on the RPC node.\n */\n startLedger: number;\n /** Pagination configuration for the request. */\n pagination?: {\n cursor?: never;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n }\n | {\n startLedger?: never;\n /** Pagination configuration for the request. */\n pagination: {\n /**\n * Page cursor for continuing pagination from a previous\n * response. Must be omitted if startLedger is provided.\n */\n cursor: string;\n /**\n * Maximum number of ledgers to return per page.\n * Valid range: 1-10000. Defaults to 100 if not specified.\n */\n limit?: number;\n };\n };\n\n /** @see https://developers.stellar.org/docs/data/rpc/api-reference/methods/getLedgers */\n export interface GetLedgersResponse {\n ledgers: LedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface RawGetLedgersResponse {\n ledgers: RawLedgerResponse[];\n latestLedger: number;\n latestLedgerCloseTime: number;\n oldestLedger: number;\n oldestLedgerCloseTime: number;\n cursor: string;\n }\n\n export interface LedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n headerXdr: xdr.LedgerHeaderHistoryEntry;\n metadataXdr: xdr.LedgerCloseMeta;\n }\n\n export interface RawLedgerResponse {\n hash: string;\n sequence: number;\n ledgerCloseTime: string;\n /** a base-64 encoded {@link xdr.LedgerHeaderHistoryEntry} instance */\n headerXdr: string;\n /** a base-64 encoded {@link xdr.LedgerCloseMeta} instance */\n metadataXdr: string;\n }\n\n /** A single input parameter of a {@link ContractMethod}. */\n export interface ContractMethodInput {\n /** the declared parameter name */\n name: string;\n /** a human-readable type name, e.g. `U32`, `Address`, or a UDT's name */\n type: string;\n }\n\n /**\n * A callable method declared in a contract's spec, as returned by\n * `RpcServer.getContractMethods`.\n */\n export interface ContractMethod {\n /** the on-chain method name */\n name: string;\n /** the method's parameters, in declaration order */\n inputs: ContractMethodInput[];\n /** human-readable return type name(s); empty when the method returns void */\n outputs: string[];\n /** the method's spec doc string, when the contract declares one */\n doc?: string;\n }\n}\n"],"names":["Api","GetTransactionStatus"],"mappings":";;AAGiBA;AAAA,CAAV,CAAUA,IAAAA,KAAV;AAoEE,EAAA,CAAA,CAAKC,qBAAAA,KAAL;AACL,IAAAA,sBAAA,SAAA,CAAA,GAAU,SAAA;AACV,IAAAA,sBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,IAAAA,sBAAA,QAAA,CAAA,GAAS,QAAA;AAAA,EAAA,CAAA,EAHCD,IAAAA,CAAA,oBAAA,KAAAA,IAAAA,CAAA,oBAAA,GAAA,EAAA,CAAA,CAAA;AA4YL,EAAA,SAAS,kBACd,GAAA,EACyC;AACzC,IAAA,OAAO,OAAA,IAAW,GAAA;AAAA,EACpB;AAJO,EAAAA,IAAAA,CAAS,iBAAA,GAAA,iBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,iBAAA,IAAqB,GAAA;AAAA,EAC9B;AAJO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAWT,EAAA,SAAS,oBACd,GAAA,EAC2C;AAC3C,IAAA,OACE,mBAAA,CAAoB,GAAG,CAAA,IACvB,iBAAA,IAAqB,OACrB,CAAC,CAAC,IAAI,eAAA,CAAgB,eAAA;AAAA,EAE1B;AARO,EAAAA,IAAAA,CAAS,mBAAA,GAAA,mBAAA;AAeT,EAAA,SAAS,gBACd,GAAA,EAC2C;AAC3C,IAAA,OAAO,CAAE,GAAA,CAAwC,OAAA;AAAA,EACnD;AAJO,EAAAA,IAAAA,CAAS,eAAA,GAAA,eAAA;AAAA,CAAA,EArfDA,WAAA,KAAAA,WAAA,GAAA,EAAA,CAAA,CAAA;;"}
|