@algorandfoundation/algokit-utils 7.0.0-beta.9 → 8.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +21 -3
- package/account/account.d.ts +4 -1
- package/account/account.js +10 -7
- package/account/account.js.map +1 -1
- package/account/account.mjs +11 -8
- package/account/account.mjs.map +1 -1
- package/account/get-account-config-from-environment.js.map +1 -1
- package/account/get-account-config-from-environment.mjs.map +1 -1
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.d.ts +1 -1
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs.map +1 -1
- package/amount.d.ts +1 -0
- package/amount.js +3 -2
- package/amount.js.map +1 -1
- package/amount.mjs +3 -3
- package/amount.mjs.map +1 -1
- package/app-client.d.ts +4 -4
- package/app-client.js +4 -4
- package/app-client.js.map +1 -1
- package/app-client.mjs +4 -4
- package/app-client.mjs.map +1 -1
- package/app-deploy.js +25 -15
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +27 -17
- package/app-deploy.mjs.map +1 -1
- package/app.d.ts +2 -2
- package/app.js +9 -6
- package/app.js.map +1 -1
- package/app.mjs +9 -6
- package/app.mjs.map +1 -1
- package/asset.js.map +1 -1
- package/asset.mjs.map +1 -1
- package/debugging/debugging.js.map +1 -1
- package/debugging/debugging.mjs.map +1 -1
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/index.mjs +3 -2
- package/index.mjs.map +1 -1
- package/indexer-lookup.d.ts +10 -8
- package/indexer-lookup.js +14 -10
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +14 -10
- package/indexer-lookup.mjs.map +1 -1
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.d.ts +1 -7
- package/network-client.js +2 -9
- package/network-client.js.map +1 -1
- package/network-client.mjs +2 -9
- package/network-client.mjs.map +1 -1
- package/package.json +5 -5
- package/testing/_asset.d.ts +2 -1
- package/testing/account.d.ts +4 -3
- package/testing/account.js +8 -2
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +9 -3
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.js +5 -6
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +5 -6
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/indexer.js.map +1 -1
- package/testing/indexer.mjs.map +1 -1
- package/testing/test-logger.js +7 -1
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs +7 -1
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs.map +1 -1
- package/transaction/legacy-bridge.js +2 -2
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +3 -3
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts +4 -1
- package/transaction/perform-atomic-transaction-composer-simulate.js +14 -9
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs +15 -10
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +13 -22
- package/transaction/transaction.js +164 -110
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +163 -109
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.js +3 -1
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +3 -1
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +20 -20
- package/types/account-manager.js +36 -27
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +38 -29
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +17 -8
- package/types/account.js +2 -2
- package/types/account.js.map +1 -1
- package/types/account.mjs +3 -3
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.d.ts +1 -2
- package/types/algo-http-client-with-retry.js +33 -3
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs +32 -2
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/algorand-client-interface.d.ts +2 -2
- package/types/algorand-client-transaction-creator.d.ts +16 -14
- package/types/algorand-client-transaction-creator.js +3 -1
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +3 -1
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +109 -105
- package/types/algorand-client-transaction-sender.js +6 -2
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +6 -2
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +6 -7
- package/types/algorand-client.js +3 -6
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +5 -5
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.js.map +1 -1
- package/types/amount.mjs.map +1 -1
- package/types/app-arc56.d.ts +31 -20
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +298 -286
- package/types/app-client.js +148 -41
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +147 -40
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +4 -4
- package/types/app-deployer.js +23 -24
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +25 -26
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +130 -130
- package/types/app-factory.js +4 -5
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +5 -6
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +5 -5
- package/types/app-manager.js +116 -38
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +117 -39
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.js +8 -2
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +8 -2
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +12 -11
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +9 -9
- package/types/asset-manager.js +10 -13
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +10 -13
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +1 -10
- package/types/async-event-emitter.js +0 -5
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +1 -6
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +2 -9
- package/types/client-manager.js +11 -21
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +11 -21
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +58 -46
- package/types/composer.js +154 -105
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +156 -105
- package/types/composer.mjs.map +1 -1
- package/types/config.js.map +1 -1
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +1 -1
- package/types/debugging.js +1 -1
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +1 -1
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.d.ts +2 -1
- package/types/dispenser-client.js +5 -1
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +5 -1
- package/types/dispenser-client.mjs.map +1 -1
- package/types/indexer.d.ts +74 -755
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs.map +1 -1
- package/types/kmd-account-manager.d.ts +2 -2
- package/types/kmd-account-manager.js +1 -1
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +2 -2
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +10 -0
- package/types/lifecycle-events.js +8 -0
- package/types/lifecycle-events.js.map +1 -0
- package/types/lifecycle-events.mjs +8 -0
- package/types/lifecycle-events.mjs.map +1 -0
- package/types/logging.js.map +1 -1
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +2 -3
- package/types/logic-error.js +3 -3
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +3 -3
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.d.ts +1 -1
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +6 -7
- package/util.js.map +1 -1
- package/util.mjs.map +1 -1
- package/types/urlTokenBaseHTTPClient.d.ts +0 -40
- package/types/urlTokenBaseHTTPClient.js +0 -153
- package/types/urlTokenBaseHTTPClient.js.map +0 -1
- package/types/urlTokenBaseHTTPClient.mjs +0 -151
- package/types/urlTokenBaseHTTPClient.mjs.map +0 -1
package/types/logic-error.mjs
CHANGED
|
@@ -23,15 +23,15 @@ class LogicError extends Error {
|
|
|
23
23
|
* Create a new logic error object.
|
|
24
24
|
* @param errorDetails The details of the logic error
|
|
25
25
|
* @param program The TEAL source code, split by line
|
|
26
|
-
* @param
|
|
26
|
+
* @param getLineForPc The source map of the TEAL source code
|
|
27
27
|
*/
|
|
28
|
-
constructor(errorDetails, program,
|
|
28
|
+
constructor(errorDetails, program, getLineForPc) {
|
|
29
29
|
super();
|
|
30
30
|
this.lines = 5;
|
|
31
31
|
this.teal_line = 0;
|
|
32
32
|
this.led = errorDetails;
|
|
33
33
|
this.program = program;
|
|
34
|
-
const line =
|
|
34
|
+
const line = getLineForPc(errorDetails.pc);
|
|
35
35
|
this.teal_line = line === undefined ? 0 : line;
|
|
36
36
|
this.message = `${this.led.msg}. at:${line}. ${this.led.desc}`;
|
|
37
37
|
if (this.teal_line > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logic-error.mjs","sources":["../../src/types/logic-error.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"logic-error.mjs","sources":["../../src/types/logic-error.ts"],"sourcesContent":["const LOGIC_ERROR = /transaction ([A-Z0-9]+): logic eval error: (.*). Details: .*pc=([0-9]+).*/\n\n/**\n * Details about a smart contract logic error\n */\nexport interface LogicErrorDetails {\n /** The ID of the transaction with the logic error */\n txId: string\n /** The program counter where the error was */\n pc: number\n /** The error message */\n msg: string\n /** The full error description */\n desc: string\n /** Any trace information included in the error */\n traces: Record<string, unknown>[]\n}\n\n/** Wraps key functionality around processing logic errors */\nexport class LogicError extends Error {\n /** Takes an error message and parses out the details of any logic errors in there.\n * @param error The error message to parse\n * @returns The logic error details if any, or undefined\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n static parseLogicError(error: any): LogicErrorDetails | undefined {\n const errorMessage = error.message\n const res = LOGIC_ERROR.exec(errorMessage)\n if (res === null || res.length <= 3) return undefined\n\n return {\n txId: res[1],\n msg: res[2],\n desc: errorMessage,\n pc: parseInt(res[3] ? res[3] : '0'),\n traces: error.traces,\n } as LogicErrorDetails\n }\n\n public led: LogicErrorDetails\n public program: string[]\n public lines = 5\n public teal_line = 0\n override stack?: string\n\n /**\n * Create a new logic error object.\n * @param errorDetails The details of the logic error\n * @param program The TEAL source code, split by line\n * @param getLineForPc The source map of the TEAL source code\n */\n constructor(errorDetails: LogicErrorDetails, program: string[], getLineForPc: (pc: number) => number | undefined) {\n super()\n this.led = errorDetails\n this.program = program\n\n const line = getLineForPc(errorDetails.pc)\n this.teal_line = line === undefined ? 0 : line\n\n this.message = `${this.led.msg}. at:${line}. ${this.led.desc}`\n\n if (this.teal_line > 0) {\n const start = this.teal_line > this.lines ? this.teal_line - this.lines : 0\n const stop = program.length > this.teal_line + this.lines ? this.teal_line + this.lines : program.length\n\n const stack_lines = program.slice(start, stop)\n\n stack_lines[stack_lines.length / 2] += ' <--- Error'\n\n this.stack = stack_lines.join('\\n')\n }\n }\n}\n"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,2EAA2E;AAkB/F;AACM,MAAO,UAAW,SAAQ,KAAK,CAAA;AACnC;;;AAGG;;IAEH,OAAO,eAAe,CAAC,KAAU,EAAA;AAC/B,QAAA,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO;QAClC,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC;QAC1C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;AAAE,YAAA,OAAO,SAAS;QAErD,OAAO;AACL,YAAA,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AACZ,YAAA,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACX,YAAA,IAAI,EAAE,YAAY;AAClB,YAAA,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;YACnC,MAAM,EAAE,KAAK,CAAC,MAAM;SACA;;AASxB;;;;;AAKG;AACH,IAAA,WAAA,CAAY,YAA+B,EAAE,OAAiB,EAAE,YAAgD,EAAA;AAC9G,QAAA,KAAK,EAAE;QAXF,IAAK,CAAA,KAAA,GAAG,CAAC;QACT,IAAS,CAAA,SAAA,GAAG,CAAC;AAWlB,QAAA,IAAI,CAAC,GAAG,GAAG,YAAY;AACvB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;QAEtB,MAAM,IAAI,GAAG,YAAY,CAAC,YAAY,CAAC,EAAE,CAAC;AAC1C,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,SAAS,GAAG,CAAC,GAAG,IAAI;AAE9C,QAAA,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAQ,KAAA,EAAA,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;AAE9D,QAAA,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE;YACtB,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC;AAC3E,YAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM;YAExG,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;YAE9C,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa;YAEpD,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;;;AAGxC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TokenHeader } from 'algosdk';
|
|
2
2
|
/** Config for an Algorand SDK client. */
|
|
3
3
|
export interface AlgoClientConfig {
|
|
4
4
|
/** Base URL of the server e.g. http://localhost, https://testnet-api.algonode.cloud/, etc. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-client.js","sources":["../../src/types/network-client.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"network-client.js","sources":["../../src/types/network-client.ts"],"sourcesContent":["import { TokenHeader } from 'algosdk'\n\n/** Config for an Algorand SDK client. */\nexport interface AlgoClientConfig {\n /** Base URL of the server e.g. http://localhost, https://testnet-api.algonode.cloud/, etc. */\n server: string\n /** The port to use e.g. 4001, 443, etc. */\n port?: string | number\n /** The token to use for API authentication (or undefined if none needed) - can be a string, or an object with the header key => value */\n token?: string | TokenHeader\n}\n\n/** Configuration for algod, indexer and kmd clients. */\nexport interface AlgoConfig {\n /** Algod client configuration */\n algodConfig: AlgoClientConfig\n /** Indexer client configuration */\n indexerConfig?: AlgoClientConfig\n /** Kmd configuration */\n kmdConfig?: AlgoClientConfig\n}\n\n/** Details of the current network. */\nexport interface NetworkDetails {\n /** Whether or not the network is TestNet. */\n isTestNet: boolean\n /** Whether or not the network is MainNet. */\n isMainNet: boolean\n /** Whether or not the network is LocalNet. */\n isLocalNet: boolean\n /** The genesis ID of the current network. */\n genesisId: string\n /** The base64 genesis hash of the current network. */\n genesisHash: string\n}\n\n/**\n * Returns true if the given network genesisId is associated with a LocalNet network.\n * @param genesisId The network genesis ID\n * @returns Whether the given genesis ID is associated with a LocalNet network\n */\nexport function genesisIdIsLocalNet(genesisId: string) {\n return genesisId === 'devnet-v1' || genesisId === 'sandnet-v1' || genesisId === 'dockernet-v1'\n}\n"],"names":[],"mappings":";;AAoCA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,KAAK,YAAY,IAAI,SAAS,KAAK,cAAc;AAChG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-client.mjs","sources":["../../src/types/network-client.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"network-client.mjs","sources":["../../src/types/network-client.ts"],"sourcesContent":["import { TokenHeader } from 'algosdk'\n\n/** Config for an Algorand SDK client. */\nexport interface AlgoClientConfig {\n /** Base URL of the server e.g. http://localhost, https://testnet-api.algonode.cloud/, etc. */\n server: string\n /** The port to use e.g. 4001, 443, etc. */\n port?: string | number\n /** The token to use for API authentication (or undefined if none needed) - can be a string, or an object with the header key => value */\n token?: string | TokenHeader\n}\n\n/** Configuration for algod, indexer and kmd clients. */\nexport interface AlgoConfig {\n /** Algod client configuration */\n algodConfig: AlgoClientConfig\n /** Indexer client configuration */\n indexerConfig?: AlgoClientConfig\n /** Kmd configuration */\n kmdConfig?: AlgoClientConfig\n}\n\n/** Details of the current network. */\nexport interface NetworkDetails {\n /** Whether or not the network is TestNet. */\n isTestNet: boolean\n /** Whether or not the network is MainNet. */\n isMainNet: boolean\n /** Whether or not the network is LocalNet. */\n isLocalNet: boolean\n /** The genesis ID of the current network. */\n genesisId: string\n /** The base64 genesis hash of the current network. */\n genesisHash: string\n}\n\n/**\n * Returns true if the given network genesisId is associated with a LocalNet network.\n * @param genesisId The network genesis ID\n * @returns Whether the given genesis ID is associated with a LocalNet network\n */\nexport function genesisIdIsLocalNet(genesisId: string) {\n return genesisId === 'devnet-v1' || genesisId === 'sandnet-v1' || genesisId === 'dockernet-v1'\n}\n"],"names":[],"mappings":"AAoCA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,SAAiB,EAAA;IACnD,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,KAAK,YAAY,IAAI,SAAS,KAAK,cAAc;AAChG;;;;"}
|
package/types/testing.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import algosdk from 'algosdk';
|
|
1
|
+
import algosdk, { Address } from 'algosdk';
|
|
2
2
|
import { TransactionLogger } from '../testing';
|
|
3
3
|
import { TestLogger } from '../testing/test-logger';
|
|
4
4
|
import { AlgoAmount } from '../types/amount';
|
|
5
5
|
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './account';
|
|
6
|
-
import AlgorandClient from './algorand-client';
|
|
7
|
-
import { TransactionLookupResult } from './indexer';
|
|
6
|
+
import { AlgorandClient } from './algorand-client';
|
|
8
7
|
import { AlgoConfig } from './network-client';
|
|
9
8
|
import Account = algosdk.Account;
|
|
10
9
|
import Algodv2 = algosdk.Algodv2;
|
|
@@ -27,13 +26,13 @@ export interface AlgorandTestAutomationContext {
|
|
|
27
26
|
/** Transaction logger that will log transaction IDs for all transactions issued by `algod` */
|
|
28
27
|
transactionLogger: TransactionLogger;
|
|
29
28
|
/** Default, funded test account that is ephemerally created */
|
|
30
|
-
testAccount:
|
|
29
|
+
testAccount: Address & TransactionSignerAccount & Account;
|
|
31
30
|
/** Generate and fund an additional ephemerally created account */
|
|
32
|
-
generateAccount: (params: GetTestAccountParams) => Promise<Account & TransactionSignerAccount>;
|
|
31
|
+
generateAccount: (params: GetTestAccountParams) => Promise<Address & Account & TransactionSignerAccount>;
|
|
33
32
|
/** Wait for the indexer to catch up with all transactions logged by `transactionLogger` */
|
|
34
33
|
waitForIndexer: () => Promise<void>;
|
|
35
34
|
/** Wait for the indexer to catch up with the given transaction ID */
|
|
36
|
-
waitForIndexerTransaction: (transactionId: string) => Promise<
|
|
35
|
+
waitForIndexerTransaction: (transactionId: string) => Promise<algosdk.indexerModels.TransactionResponse>;
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
38
|
* Parameters for the `getTestAccount` function.
|
|
@@ -89,7 +88,7 @@ export interface LogSnapshotConfig {
|
|
|
89
88
|
/** Any transaction IDs or transactions to replace the ID for predictably */
|
|
90
89
|
transactions?: (string | Transaction)[];
|
|
91
90
|
/** Any accounts/addresses to replace the address for predictably */
|
|
92
|
-
accounts?: (string | Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount)[];
|
|
91
|
+
accounts?: (string | Address | Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount)[];
|
|
93
92
|
/** Any app IDs to replace predictably */
|
|
94
93
|
apps?: (string | number | bigint)[];
|
|
95
94
|
}
|
package/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../src/util.ts"],"sourcesContent":["/**\n * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.\n *\n * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type\n * @param value\n */\nexport const toNumber = (value: number | bigint) => {\n if (typeof value === 'number') return value\n\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`,\n )\n } else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`,\n )\n }\n return Number(value)\n}\n\nexport class UnsafeConversionError extends Error {}\n\n/**\n * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.\n * @param minSpendingBalance The minimum spending balance for the wallet\n * @param currentSpendingBalance The current spending balance for the wallet\n * @param minFundingIncrement The minimum amount of funds that can be added to the wallet\n * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance\n */\nexport const calculateFundAmount = (\n minSpendingBalance: bigint,\n currentSpendingBalance: bigint,\n minFundingIncrement: bigint,\n): bigint | null => {\n if (minSpendingBalance > currentSpendingBalance) {\n const minFundAmount = minSpendingBalance - currentSpendingBalance\n return BigInt(Math.max(Number(minFundAmount), Number(minFundingIncrement)))\n } else {\n return null\n }\n}\n\n/**\n * Checks if the current environment is Node.js\n *\n * @returns A boolean indicating whether the current environment is Node.js\n */\nexport const isNode = () => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n}\n\n/**\n * Returns the given array split into chunks of `batchSize` batches.\n * @param array The array to chunk\n * @param batchSize The size of batches to split the array into\n * @returns A generator that yields the array split into chunks of `batchSize` batches\n */\nexport function* chunkArray<T>(array: T[], batchSize: number): Generator<T[], void> {\n for (let i = 0; i < array.length; i += batchSize) yield array.slice(i, i + batchSize)\n}\n\n/**\n * Memoize calls to the given function in an in-memory map.\n * @param fn The function to memoize\n * @returns The memoized function\n */\nexport const memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\nexport const binaryStartsWith = (base: Uint8Array, startsWith: Uint8Array): boolean => {\n if (startsWith.length > base.length) return false\n for (let i = 0; i < startsWith.length; i++) {\n if (base[i] !== startsWith[i]) return false\n }\n return true\n}\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AACU,MAAA,QAAQ,GAAG,CAAC,KAAsB,KAAI;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../src/util.ts"],"sourcesContent":["/**\n * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.\n *\n * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type\n * @param value\n */\nexport const toNumber = (value: number | bigint) => {\n if (typeof value === 'number') return value\n\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`,\n )\n } else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`,\n )\n }\n return Number(value)\n}\n\nexport class UnsafeConversionError extends Error {}\n\n/**\n * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.\n * @param minSpendingBalance The minimum spending balance for the wallet\n * @param currentSpendingBalance The current spending balance for the wallet\n * @param minFundingIncrement The minimum amount of funds that can be added to the wallet\n * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance\n */\nexport const calculateFundAmount = (\n minSpendingBalance: bigint,\n currentSpendingBalance: bigint,\n minFundingIncrement: bigint,\n): bigint | null => {\n if (minSpendingBalance > currentSpendingBalance) {\n const minFundAmount = minSpendingBalance - currentSpendingBalance\n return BigInt(Math.max(Number(minFundAmount), Number(minFundingIncrement)))\n } else {\n return null\n }\n}\n\n/**\n * Checks if the current environment is Node.js\n *\n * @returns A boolean indicating whether the current environment is Node.js\n */\nexport const isNode = () => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n}\n\n/**\n * Returns the given array split into chunks of `batchSize` batches.\n * @param array The array to chunk\n * @param batchSize The size of batches to split the array into\n * @returns A generator that yields the array split into chunks of `batchSize` batches\n */\nexport function* chunkArray<T>(array: T[], batchSize: number): Generator<T[], void> {\n for (let i = 0; i < array.length; i += batchSize) yield array.slice(i, i + batchSize)\n}\n\n/**\n * Memoize calls to the given function in an in-memory map.\n * @param fn The function to memoize\n * @returns The memoized function\n */\nexport const memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\nexport const binaryStartsWith = (base: Uint8Array, startsWith: Uint8Array): boolean => {\n if (startsWith.length > base.length) return false\n for (let i = 0; i < startsWith.length; i++) {\n if (base[i] !== startsWith[i]) return false\n }\n return true\n}\n"],"names":[],"mappings":";;AAAA;;;;;AAKG;AACU,MAAA,QAAQ,GAAG,CAAC,KAAsB,KAAI;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;IAE3C,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;AAC3C,QAAA,MAAM,IAAI,qBAAqB,CAC7B,kBAAkB,KAAK,CAAA,oFAAA,CAAsF,CAC9G;;SACI,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;AAClD,QAAA,MAAM,IAAI,qBAAqB,CAC7B,kBAAkB,KAAK,CAAA,qFAAA,CAAuF,CAC/G;;AAEH,IAAA,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB;AAEM,MAAO,qBAAsB,SAAQ,KAAK,CAAA;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AI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;;AAE7C,IAAA,OAAO,IAAI;AACb;;;;;;;;;"}
|
package/util.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.mjs","sources":["../src/util.ts"],"sourcesContent":["/**\n * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.\n *\n * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type\n * @param value\n */\nexport const toNumber = (value: number | bigint) => {\n if (typeof value === 'number') return value\n\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`,\n )\n } else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`,\n )\n }\n return Number(value)\n}\n\nexport class UnsafeConversionError extends Error {}\n\n/**\n * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.\n * @param minSpendingBalance The minimum spending balance for the wallet\n * @param currentSpendingBalance The current spending balance for the wallet\n * @param minFundingIncrement The minimum amount of funds that can be added to the wallet\n * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance\n */\nexport const calculateFundAmount = (\n minSpendingBalance: bigint,\n currentSpendingBalance: bigint,\n minFundingIncrement: bigint,\n): bigint | null => {\n if (minSpendingBalance > currentSpendingBalance) {\n const minFundAmount = minSpendingBalance - currentSpendingBalance\n return BigInt(Math.max(Number(minFundAmount), Number(minFundingIncrement)))\n } else {\n return null\n }\n}\n\n/**\n * Checks if the current environment is Node.js\n *\n * @returns A boolean indicating whether the current environment is Node.js\n */\nexport const isNode = () => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n}\n\n/**\n * Returns the given array split into chunks of `batchSize` batches.\n * @param array The array to chunk\n * @param batchSize The size of batches to split the array into\n * @returns A generator that yields the array split into chunks of `batchSize` batches\n */\nexport function* chunkArray<T>(array: T[], batchSize: number): Generator<T[], void> {\n for (let i = 0; i < array.length; i += batchSize) yield array.slice(i, i + batchSize)\n}\n\n/**\n * Memoize calls to the given function in an in-memory map.\n * @param fn The function to memoize\n * @returns The memoized function\n */\nexport const memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\nexport const binaryStartsWith = (base: Uint8Array, startsWith: Uint8Array): boolean => {\n if (startsWith.length > base.length) return false\n for (let i = 0; i < startsWith.length; i++) {\n if (base[i] !== startsWith[i]) return false\n }\n return true\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACU,MAAA,QAAQ,GAAG,CAAC,KAAsB,KAAI;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK
|
|
1
|
+
{"version":3,"file":"util.mjs","sources":["../src/util.ts"],"sourcesContent":["/**\n * Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.\n *\n * Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type\n * @param value\n */\nexport const toNumber = (value: number | bigint) => {\n if (typeof value === 'number') return value\n\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`,\n )\n } else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {\n throw new UnsafeConversionError(\n `Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`,\n )\n }\n return Number(value)\n}\n\nexport class UnsafeConversionError extends Error {}\n\n/**\n * Calculates the amount of funds to add to a wallet to bring it up to the minimum spending balance.\n * @param minSpendingBalance The minimum spending balance for the wallet\n * @param currentSpendingBalance The current spending balance for the wallet\n * @param minFundingIncrement The minimum amount of funds that can be added to the wallet\n * @returns The amount of funds to add to the wallet or null if the wallet is already above the minimum spending balance\n */\nexport const calculateFundAmount = (\n minSpendingBalance: bigint,\n currentSpendingBalance: bigint,\n minFundingIncrement: bigint,\n): bigint | null => {\n if (minSpendingBalance > currentSpendingBalance) {\n const minFundAmount = minSpendingBalance - currentSpendingBalance\n return BigInt(Math.max(Number(minFundAmount), Number(minFundingIncrement)))\n } else {\n return null\n }\n}\n\n/**\n * Checks if the current environment is Node.js\n *\n * @returns A boolean indicating whether the current environment is Node.js\n */\nexport const isNode = () => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n}\n\n/**\n * Returns the given array split into chunks of `batchSize` batches.\n * @param array The array to chunk\n * @param batchSize The size of batches to split the array into\n * @returns A generator that yields the array split into chunks of `batchSize` batches\n */\nexport function* chunkArray<T>(array: T[], batchSize: number): Generator<T[], void> {\n for (let i = 0; i < array.length; i += batchSize) yield array.slice(i, i + batchSize)\n}\n\n/**\n * Memoize calls to the given function in an in-memory map.\n * @param fn The function to memoize\n * @returns The memoized function\n */\nexport const memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\nexport const binaryStartsWith = (base: Uint8Array, startsWith: Uint8Array): boolean => {\n if (startsWith.length > base.length) return false\n for (let i = 0; i < startsWith.length; i++) {\n if (base[i] !== startsWith[i]) return false\n }\n return true\n}\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACU,MAAA,QAAQ,GAAG,CAAC,KAAsB,KAAI;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;IAE3C,IAAI,KAAK,GAAG,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AC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AAC/F,KAAC;AACD,IAAA,MAAM,CAAC,KAAK,GAAG,KAAK;AACpB,IAAA,OAAO,MAAuB;AAChC;MAEa,gBAAgB,GAAG,CAAC,IAAgB,EAAE,UAAsB,KAAa;AACpF,IAAA,IAAI,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,KAAK;AACjD,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,KAAK;;AAE7C,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { BaseHTTPClient, BaseHTTPClientResponse, Query } from 'algosdk/dist/types/client/baseHTTPClient';
|
|
2
|
-
export interface AlgodTokenHeader {
|
|
3
|
-
'X-Algo-API-Token': string;
|
|
4
|
-
}
|
|
5
|
-
export interface IndexerTokenHeader {
|
|
6
|
-
'X-Indexer-API-Token': string;
|
|
7
|
-
}
|
|
8
|
-
export interface KMDTokenHeader {
|
|
9
|
-
'X-KMD-API-Token': string;
|
|
10
|
-
}
|
|
11
|
-
export interface CustomTokenHeader {
|
|
12
|
-
[headerName: string]: string;
|
|
13
|
-
}
|
|
14
|
-
export type TokenHeader = AlgodTokenHeader | IndexerTokenHeader | KMDTokenHeader | CustomTokenHeader;
|
|
15
|
-
/**
|
|
16
|
-
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
17
|
-
* and make the REST queries using fetch.
|
|
18
|
-
* This is the default implementation of BaseHTTPClient.
|
|
19
|
-
*/
|
|
20
|
-
export declare class URLTokenBaseHTTPClient implements BaseHTTPClient {
|
|
21
|
-
private defaultHeaders;
|
|
22
|
-
private readonly baseURL;
|
|
23
|
-
private readonly tokenHeader;
|
|
24
|
-
constructor(tokenHeader: TokenHeader, baseServer: string, port?: string | number, defaultHeaders?: Record<string, any>);
|
|
25
|
-
/**
|
|
26
|
-
* Compute the URL for a path relative to the instance's address
|
|
27
|
-
* @param relativePath - A path string
|
|
28
|
-
* @param query - An optional key-value object of query parameters to add to the URL. If the
|
|
29
|
-
* relativePath already has query parameters on it, the additional parameters defined here will
|
|
30
|
-
* be added to the URL without modifying those (unless a key collision occurs).
|
|
31
|
-
* @returns A URL string
|
|
32
|
-
*/
|
|
33
|
-
private getURL;
|
|
34
|
-
private static formatFetchResponseHeaders;
|
|
35
|
-
private static checkHttpError;
|
|
36
|
-
private static formatFetchResponse;
|
|
37
|
-
get(relativePath: string, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
38
|
-
post(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
39
|
-
delete(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
|
|
40
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var buffer = require('buffer');
|
|
4
|
-
|
|
5
|
-
class URLTokenBaseHTTPError extends Error {
|
|
6
|
-
constructor(message, response) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.response = response;
|
|
9
|
-
this.name = 'URLTokenBaseHTTPError';
|
|
10
|
-
this.response = response;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
15
|
-
* and make the REST queries using fetch.
|
|
16
|
-
* This is the default implementation of BaseHTTPClient.
|
|
17
|
-
*/
|
|
18
|
-
class URLTokenBaseHTTPClient {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
constructor(tokenHeader, baseServer, port,
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
defaultHeaders = {}) {
|
|
23
|
-
this.defaultHeaders = defaultHeaders;
|
|
24
|
-
// Append a trailing slash so we can use relative paths. Without the trailing
|
|
25
|
-
// slash, the last path segment will be replaced by the relative path. See
|
|
26
|
-
// usage in `addressWithPath`.
|
|
27
|
-
const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/`;
|
|
28
|
-
const baseServerURL = new URL(fixedBaseServer);
|
|
29
|
-
if (typeof port !== 'undefined') {
|
|
30
|
-
baseServerURL.port = port.toString();
|
|
31
|
-
}
|
|
32
|
-
if (baseServerURL.protocol.length === 0) {
|
|
33
|
-
throw new Error('Invalid base server URL, protocol must be defined.');
|
|
34
|
-
}
|
|
35
|
-
this.baseURL = baseServerURL;
|
|
36
|
-
this.tokenHeader = tokenHeader;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Compute the URL for a path relative to the instance's address
|
|
40
|
-
* @param relativePath - A path string
|
|
41
|
-
* @param query - An optional key-value object of query parameters to add to the URL. If the
|
|
42
|
-
* relativePath already has query parameters on it, the additional parameters defined here will
|
|
43
|
-
* be added to the URL without modifying those (unless a key collision occurs).
|
|
44
|
-
* @returns A URL string
|
|
45
|
-
*/
|
|
46
|
-
getURL(relativePath, query) {
|
|
47
|
-
let fixedRelativePath;
|
|
48
|
-
if (relativePath.startsWith('./')) {
|
|
49
|
-
fixedRelativePath = relativePath;
|
|
50
|
-
}
|
|
51
|
-
else if (relativePath.startsWith('/')) {
|
|
52
|
-
fixedRelativePath = `.${relativePath}`;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
fixedRelativePath = `./${relativePath}`;
|
|
56
|
-
}
|
|
57
|
-
const address = new URL(fixedRelativePath, this.baseURL);
|
|
58
|
-
if (query) {
|
|
59
|
-
for (const [key, value] of Object.entries(query)) {
|
|
60
|
-
address.searchParams.set(key, value);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return address.toString();
|
|
64
|
-
}
|
|
65
|
-
static formatFetchResponseHeaders(headers) {
|
|
66
|
-
const headersObj = {};
|
|
67
|
-
headers.forEach((key, value) => {
|
|
68
|
-
headersObj[key] = value;
|
|
69
|
-
});
|
|
70
|
-
return headersObj;
|
|
71
|
-
}
|
|
72
|
-
static async checkHttpError(res) {
|
|
73
|
-
if (res.ok) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
let body = null;
|
|
77
|
-
let bodyErrorMessage = null;
|
|
78
|
-
try {
|
|
79
|
-
body = new Uint8Array(await res.arrayBuffer());
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
-
const decoded = JSON.parse(buffer.Buffer.from(body).toString());
|
|
82
|
-
if (decoded.message) {
|
|
83
|
-
bodyErrorMessage = decoded.message;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
// ignore any error that happened while we are parsing the error response
|
|
88
|
-
}
|
|
89
|
-
let message = `Network request error. Received status ${res.status} (${res.statusText})`;
|
|
90
|
-
if (bodyErrorMessage) {
|
|
91
|
-
message += `: ${bodyErrorMessage}`;
|
|
92
|
-
}
|
|
93
|
-
throw new URLTokenBaseHTTPError(message, {
|
|
94
|
-
body: body !== null ? body : new Uint8Array(),
|
|
95
|
-
status: res.status,
|
|
96
|
-
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
static async formatFetchResponse(res) {
|
|
100
|
-
await this.checkHttpError(res);
|
|
101
|
-
return {
|
|
102
|
-
body: new Uint8Array(await res.arrayBuffer()),
|
|
103
|
-
status: res.status,
|
|
104
|
-
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
async get(relativePath, query, requestHeaders = {}) {
|
|
108
|
-
// Expand headers for use in fetch
|
|
109
|
-
const headers = {
|
|
110
|
-
...this.tokenHeader,
|
|
111
|
-
...this.defaultHeaders,
|
|
112
|
-
...requestHeaders,
|
|
113
|
-
};
|
|
114
|
-
const res = await fetch(this.getURL(relativePath, query), {
|
|
115
|
-
mode: 'cors',
|
|
116
|
-
headers,
|
|
117
|
-
});
|
|
118
|
-
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
119
|
-
}
|
|
120
|
-
async post(relativePath, data, query, requestHeaders = {}) {
|
|
121
|
-
// Expand headers for use in fetch
|
|
122
|
-
const headers = {
|
|
123
|
-
...this.tokenHeader,
|
|
124
|
-
...this.defaultHeaders,
|
|
125
|
-
...requestHeaders,
|
|
126
|
-
};
|
|
127
|
-
const res = await fetch(this.getURL(relativePath, query), {
|
|
128
|
-
method: 'POST',
|
|
129
|
-
mode: 'cors',
|
|
130
|
-
body: data,
|
|
131
|
-
headers,
|
|
132
|
-
});
|
|
133
|
-
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
134
|
-
}
|
|
135
|
-
async delete(relativePath, data, query, requestHeaders = {}) {
|
|
136
|
-
// Expand headers for use in fetch
|
|
137
|
-
const headers = {
|
|
138
|
-
...this.tokenHeader,
|
|
139
|
-
...this.defaultHeaders,
|
|
140
|
-
...requestHeaders,
|
|
141
|
-
};
|
|
142
|
-
const res = await fetch(this.getURL(relativePath, query), {
|
|
143
|
-
method: 'DELETE',
|
|
144
|
-
mode: 'cors',
|
|
145
|
-
body: data,
|
|
146
|
-
headers,
|
|
147
|
-
});
|
|
148
|
-
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
exports.URLTokenBaseHTTPClient = URLTokenBaseHTTPClient;
|
|
153
|
-
//# sourceMappingURL=urlTokenBaseHTTPClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urlTokenBaseHTTPClient.js","sources":["../../src/types/urlTokenBaseHTTPClient.ts"],"sourcesContent":["// Copied from https://github.com/algorand/js-algorand-sdk/blob/e9635e9ffc9019994f0790ee4b8d9733c6590250/src/client/urlTokenBaseHTTPClient.ts\n// There was an error trying to reference the file from algosdk\n// This is referenced from algo-http-client-with-retry.ts and extended to add retry logic to improve resilience\n// todo: Find out why this can't be referenced from algosdk directly so we don't have to duplicate here\nimport type { BaseHTTPClient, BaseHTTPClientError, BaseHTTPClientResponse, Query } from 'algosdk/dist/types/client/baseHTTPClient'\nimport { Buffer } from 'buffer'\n\nexport interface AlgodTokenHeader {\n 'X-Algo-API-Token': string\n}\n\nexport interface IndexerTokenHeader {\n 'X-Indexer-API-Token': string\n}\n\nexport interface KMDTokenHeader {\n 'X-KMD-API-Token': string\n}\n\nexport interface CustomTokenHeader {\n [headerName: string]: string\n}\n\nclass URLTokenBaseHTTPError extends Error implements BaseHTTPClientError {\n constructor(\n message: string,\n public response: BaseHTTPClientResponse,\n ) {\n super(message)\n this.name = 'URLTokenBaseHTTPError'\n this.response = response\n }\n}\n\nexport type TokenHeader = AlgodTokenHeader | IndexerTokenHeader | KMDTokenHeader | CustomTokenHeader\n\n/**\n * Implementation of BaseHTTPClient that uses a URL and a token\n * and make the REST queries using fetch.\n * This is the default implementation of BaseHTTPClient.\n */\nexport class URLTokenBaseHTTPClient implements BaseHTTPClient {\n private readonly baseURL: URL\n private readonly tokenHeader: TokenHeader\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(\n tokenHeader: TokenHeader,\n baseServer: string,\n port?: string | number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private defaultHeaders: Record<string, any> = {},\n ) {\n // Append a trailing slash so we can use relative paths. Without the trailing\n // slash, the last path segment will be replaced by the relative path. See\n // usage in `addressWithPath`.\n const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/`\n const baseServerURL = new URL(fixedBaseServer)\n if (typeof port !== 'undefined') {\n baseServerURL.port = port.toString()\n }\n\n if (baseServerURL.protocol.length === 0) {\n throw new Error('Invalid base server URL, protocol must be defined.')\n }\n\n this.baseURL = baseServerURL\n this.tokenHeader = tokenHeader\n }\n\n /**\n * Compute the URL for a path relative to the instance's address\n * @param relativePath - A path string\n * @param query - An optional key-value object of query parameters to add to the URL. If the\n * relativePath already has query parameters on it, the additional parameters defined here will\n * be added to the URL without modifying those (unless a key collision occurs).\n * @returns A URL string\n */\n private getURL(relativePath: string, query?: Query<string>): string {\n let fixedRelativePath: string\n if (relativePath.startsWith('./')) {\n fixedRelativePath = relativePath\n } else if (relativePath.startsWith('/')) {\n fixedRelativePath = `.${relativePath}`\n } else {\n fixedRelativePath = `./${relativePath}`\n }\n const address = new URL(fixedRelativePath, this.baseURL)\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n address.searchParams.set(key, value)\n }\n }\n return address.toString()\n }\n\n private static formatFetchResponseHeaders(headers: Headers): Record<string, string> {\n const headersObj: Record<string, string> = {}\n headers.forEach((key, value) => {\n headersObj[key] = value\n })\n return headersObj\n }\n\n private static async checkHttpError(res: Response) {\n if (res.ok) {\n return\n }\n\n let body: Uint8Array | null = null\n let bodyErrorMessage: string | null = null\n\n try {\n body = new Uint8Array(await res.arrayBuffer())\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const decoded: Record<string, any> = JSON.parse(Buffer.from(body).toString())\n if (decoded.message) {\n bodyErrorMessage = decoded.message\n }\n } catch {\n // ignore any error that happened while we are parsing the error response\n }\n\n let message = `Network request error. Received status ${res.status} (${res.statusText})`\n if (bodyErrorMessage) {\n message += `: ${bodyErrorMessage}`\n }\n\n throw new URLTokenBaseHTTPError(message, {\n body: body !== null ? body : new Uint8Array(),\n status: res.status,\n headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),\n })\n }\n\n private static async formatFetchResponse(res: Response): Promise<BaseHTTPClientResponse> {\n await this.checkHttpError(res)\n return {\n body: new Uint8Array(await res.arrayBuffer()),\n status: res.status,\n headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),\n }\n }\n\n async get(relativePath: string, query?: Query<string>, requestHeaders: Record<string, string> = {}): Promise<BaseHTTPClientResponse> {\n // Expand headers for use in fetch\n const headers = {\n ...this.tokenHeader,\n ...this.defaultHeaders,\n ...requestHeaders,\n }\n\n const res = await fetch(this.getURL(relativePath, query), {\n mode: 'cors',\n headers,\n })\n\n return URLTokenBaseHTTPClient.formatFetchResponse(res)\n }\n\n async post(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n // Expand headers for use in fetch\n const headers = {\n ...this.tokenHeader,\n ...this.defaultHeaders,\n ...requestHeaders,\n }\n\n const res = await fetch(this.getURL(relativePath, query), {\n method: 'POST',\n mode: 'cors',\n body: data,\n headers,\n })\n\n return URLTokenBaseHTTPClient.formatFetchResponse(res)\n }\n\n async delete(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n // Expand headers for use in fetch\n const headers = {\n ...this.tokenHeader,\n ...this.defaultHeaders,\n ...requestHeaders,\n }\n\n const res = await fetch(this.getURL(relativePath, query), {\n method: 'DELETE',\n mode: 'cors',\n body: data,\n headers,\n })\n\n return URLTokenBaseHTTPClient.formatFetchResponse(res)\n }\n}\n"],"names":["Buffer"],"mappings":";;;;AAuBA,MAAM,qBAAsB,SAAQ,KAAK,CAAA;IACvC,WACE,CAAA,OAAe,EACR,QAAgC,EAAA;QAEvC,KAAK,CAAC,OAAO,CAAC,CAAA;QAFP,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAwB;AAGvC,QAAA,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;AACnC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;KACzB;AACF,CAAA;AAID;;;;AAIG;MACU,sBAAsB,CAAA;;AAKjC,IAAA,W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AC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;AACxD,YAAA,MAAM,EAAE,MAAM;AACd,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,IAAI,EAAE,IAAI;YACV,OAAO;AACR,SAAA,CAAC,CAAA;AAEF,QAAA,OAAO,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;KACvD;IAED,MAAM,MAAM,CACV,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,cAAA,GAAyC,EAAE,EAAA;;AAG3C,QAAA,MAAM,OAAO,GAAG;YACd,GAAG,IAAI,CAAC,WAAW;YACnB,GAAG,IAAI,CAAC,cAAc;AACtB,YAAA,GAAG,cAAc;SAClB,CAAA;AAED,QAAA,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;AACxD,YAAA,MAAM,EAAE,QAAQ;AAChB,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,IAAI,EAAE,IAAI;YACV,OAAO;AACR,SAAA,CAAC,CAAA;AAEF,QAAA,OAAO,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;KACvD;AACF;;;;"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'buffer';
|
|
2
|
-
|
|
3
|
-
class URLTokenBaseHTTPError extends Error {
|
|
4
|
-
constructor(message, response) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.response = response;
|
|
7
|
-
this.name = 'URLTokenBaseHTTPError';
|
|
8
|
-
this.response = response;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
13
|
-
* and make the REST queries using fetch.
|
|
14
|
-
* This is the default implementation of BaseHTTPClient.
|
|
15
|
-
*/
|
|
16
|
-
class URLTokenBaseHTTPClient {
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
constructor(tokenHeader, baseServer, port,
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
defaultHeaders = {}) {
|
|
21
|
-
this.defaultHeaders = defaultHeaders;
|
|
22
|
-
// Append a trailing slash so we can use relative paths. Without the trailing
|
|
23
|
-
// slash, the last path segment will be replaced by the relative path. See
|
|
24
|
-
// usage in `addressWithPath`.
|
|
25
|
-
const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/`;
|
|
26
|
-
const baseServerURL = new URL(fixedBaseServer);
|
|
27
|
-
if (typeof port !== 'undefined') {
|
|
28
|
-
baseServerURL.port = port.toString();
|
|
29
|
-
}
|
|
30
|
-
if (baseServerURL.protocol.length === 0) {
|
|
31
|
-
throw new Error('Invalid base server URL, protocol must be defined.');
|
|
32
|
-
}
|
|
33
|
-
this.baseURL = baseServerURL;
|
|
34
|
-
this.tokenHeader = tokenHeader;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Compute the URL for a path relative to the instance's address
|
|
38
|
-
* @param relativePath - A path string
|
|
39
|
-
* @param query - An optional key-value object of query parameters to add to the URL. If the
|
|
40
|
-
* relativePath already has query parameters on it, the additional parameters defined here will
|
|
41
|
-
* be added to the URL without modifying those (unless a key collision occurs).
|
|
42
|
-
* @returns A URL string
|
|
43
|
-
*/
|
|
44
|
-
getURL(relativePath, query) {
|
|
45
|
-
let fixedRelativePath;
|
|
46
|
-
if (relativePath.startsWith('./')) {
|
|
47
|
-
fixedRelativePath = relativePath;
|
|
48
|
-
}
|
|
49
|
-
else if (relativePath.startsWith('/')) {
|
|
50
|
-
fixedRelativePath = `.${relativePath}`;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
fixedRelativePath = `./${relativePath}`;
|
|
54
|
-
}
|
|
55
|
-
const address = new URL(fixedRelativePath, this.baseURL);
|
|
56
|
-
if (query) {
|
|
57
|
-
for (const [key, value] of Object.entries(query)) {
|
|
58
|
-
address.searchParams.set(key, value);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return address.toString();
|
|
62
|
-
}
|
|
63
|
-
static formatFetchResponseHeaders(headers) {
|
|
64
|
-
const headersObj = {};
|
|
65
|
-
headers.forEach((key, value) => {
|
|
66
|
-
headersObj[key] = value;
|
|
67
|
-
});
|
|
68
|
-
return headersObj;
|
|
69
|
-
}
|
|
70
|
-
static async checkHttpError(res) {
|
|
71
|
-
if (res.ok) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let body = null;
|
|
75
|
-
let bodyErrorMessage = null;
|
|
76
|
-
try {
|
|
77
|
-
body = new Uint8Array(await res.arrayBuffer());
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
-
const decoded = JSON.parse(Buffer.from(body).toString());
|
|
80
|
-
if (decoded.message) {
|
|
81
|
-
bodyErrorMessage = decoded.message;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// ignore any error that happened while we are parsing the error response
|
|
86
|
-
}
|
|
87
|
-
let message = `Network request error. Received status ${res.status} (${res.statusText})`;
|
|
88
|
-
if (bodyErrorMessage) {
|
|
89
|
-
message += `: ${bodyErrorMessage}`;
|
|
90
|
-
}
|
|
91
|
-
throw new URLTokenBaseHTTPError(message, {
|
|
92
|
-
body: body !== null ? body : new Uint8Array(),
|
|
93
|
-
status: res.status,
|
|
94
|
-
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
static async formatFetchResponse(res) {
|
|
98
|
-
await this.checkHttpError(res);
|
|
99
|
-
return {
|
|
100
|
-
body: new Uint8Array(await res.arrayBuffer()),
|
|
101
|
-
status: res.status,
|
|
102
|
-
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
async get(relativePath, query, requestHeaders = {}) {
|
|
106
|
-
// Expand headers for use in fetch
|
|
107
|
-
const headers = {
|
|
108
|
-
...this.tokenHeader,
|
|
109
|
-
...this.defaultHeaders,
|
|
110
|
-
...requestHeaders,
|
|
111
|
-
};
|
|
112
|
-
const res = await fetch(this.getURL(relativePath, query), {
|
|
113
|
-
mode: 'cors',
|
|
114
|
-
headers,
|
|
115
|
-
});
|
|
116
|
-
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
117
|
-
}
|
|
118
|
-
async post(relativePath, data, query, requestHeaders = {}) {
|
|
119
|
-
// Expand headers for use in fetch
|
|
120
|
-
const headers = {
|
|
121
|
-
...this.tokenHeader,
|
|
122
|
-
...this.defaultHeaders,
|
|
123
|
-
...requestHeaders,
|
|
124
|
-
};
|
|
125
|
-
const res = await fetch(this.getURL(relativePath, query), {
|
|
126
|
-
method: 'POST',
|
|
127
|
-
mode: 'cors',
|
|
128
|
-
body: data,
|
|
129
|
-
headers,
|
|
130
|
-
});
|
|
131
|
-
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
132
|
-
}
|
|
133
|
-
async delete(relativePath, data, query, requestHeaders = {}) {
|
|
134
|
-
// Expand headers for use in fetch
|
|
135
|
-
const headers = {
|
|
136
|
-
...this.tokenHeader,
|
|
137
|
-
...this.defaultHeaders,
|
|
138
|
-
...requestHeaders,
|
|
139
|
-
};
|
|
140
|
-
const res = await fetch(this.getURL(relativePath, query), {
|
|
141
|
-
method: 'DELETE',
|
|
142
|
-
mode: 'cors',
|
|
143
|
-
body: data,
|
|
144
|
-
headers,
|
|
145
|
-
});
|
|
146
|
-
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export { URLTokenBaseHTTPClient };
|
|
151
|
-
//# sourceMappingURL=urlTokenBaseHTTPClient.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urlTokenBaseHTTPClient.mjs","sources":["../../src/types/urlTokenBaseHTTPClient.ts"],"sourcesContent":["// Copied from https://github.com/algorand/js-algorand-sdk/blob/e9635e9ffc9019994f0790ee4b8d9733c6590250/src/client/urlTokenBaseHTTPClient.ts\n// There was an error trying to reference the file from algosdk\n// This is referenced from algo-http-client-with-retry.ts and extended to add retry logic to improve resilience\n// todo: Find out why this can't be referenced from algosdk directly so we don't have to duplicate here\nimport type { BaseHTTPClient, BaseHTTPClientError, BaseHTTPClientResponse, Query } from 'algosdk/dist/types/client/baseHTTPClient'\nimport { Buffer } from 'buffer'\n\nexport interface AlgodTokenHeader {\n 'X-Algo-API-Token': string\n}\n\nexport interface IndexerTokenHeader {\n 'X-Indexer-API-Token': string\n}\n\nexport interface KMDTokenHeader {\n 'X-KMD-API-Token': string\n}\n\nexport interface CustomTokenHeader {\n [headerName: string]: string\n}\n\nclass URLTokenBaseHTTPError extends Error implements BaseHTTPClientError {\n constructor(\n message: string,\n public response: BaseHTTPClientResponse,\n ) {\n super(message)\n this.name = 'URLTokenBaseHTTPError'\n this.response = response\n }\n}\n\nexport type TokenHeader = AlgodTokenHeader | IndexerTokenHeader | KMDTokenHeader | CustomTokenHeader\n\n/**\n * Implementation of BaseHTTPClient that uses a URL and a token\n * and make the REST queries using fetch.\n * This is the default implementation of BaseHTTPClient.\n */\nexport class URLTokenBaseHTTPClient implements BaseHTTPClient {\n private readonly baseURL: URL\n private readonly tokenHeader: TokenHeader\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(\n tokenHeader: TokenHeader,\n baseServer: string,\n port?: string | number,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private defaultHeaders: Record<string, any> = {},\n ) {\n // Append a trailing slash so we can use relative paths. Without the trailing\n // slash, the last path segment will be replaced by the relative path. See\n // usage in `addressWithPath`.\n const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/`\n const baseServerURL = new URL(fixedBaseServer)\n if (typeof port !== 'undefined') {\n baseServerURL.port = port.toString()\n }\n\n if (baseServerURL.protocol.length === 0) {\n throw new Error('Invalid base server URL, protocol must be defined.')\n }\n\n this.baseURL = baseServerURL\n this.tokenHeader = tokenHeader\n }\n\n /**\n * Compute the URL for a path relative to the instance's address\n * @param relativePath - A path string\n * @param query - An optional key-value object of query parameters to add to the URL. If the\n * relativePath already has query parameters on it, the additional parameters defined here will\n * be added to the URL without modifying those (unless a key collision occurs).\n * @returns A URL string\n */\n private getURL(relativePath: string, query?: Query<string>): string {\n let fixedRelativePath: string\n if (relativePath.startsWith('./')) {\n fixedRelativePath = relativePath\n } else if (relativePath.startsWith('/')) {\n fixedRelativePath = `.${relativePath}`\n } else {\n fixedRelativePath = `./${relativePath}`\n }\n const address = new URL(fixedRelativePath, this.baseURL)\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n address.searchParams.set(key, value)\n }\n }\n return address.toString()\n }\n\n private static formatFetchResponseHeaders(headers: Headers): Record<string, string> {\n const headersObj: Record<string, string> = {}\n headers.forEach((key, value) => {\n headersObj[key] = value\n })\n return headersObj\n }\n\n private static async checkHttpError(res: Response) {\n if (res.ok) {\n return\n }\n\n let body: Uint8Array | null = null\n let bodyErrorMessage: string | null = null\n\n try {\n body = new Uint8Array(await res.arrayBuffer())\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const decoded: Record<string, any> = JSON.parse(Buffer.from(body).toString())\n if (decoded.message) {\n bodyErrorMessage = decoded.message\n }\n } catch {\n // ignore any error that happened while we are parsing the error response\n }\n\n let message = `Network request error. Received status ${res.status} (${res.statusText})`\n if (bodyErrorMessage) {\n message += `: ${bodyErrorMessage}`\n }\n\n throw new URLTokenBaseHTTPError(message, {\n body: body !== null ? body : new Uint8Array(),\n status: res.status,\n headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),\n })\n }\n\n private static async formatFetchResponse(res: Response): Promise<BaseHTTPClientResponse> {\n await this.checkHttpError(res)\n return {\n body: new Uint8Array(await res.arrayBuffer()),\n status: res.status,\n headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),\n }\n }\n\n async get(relativePath: string, query?: Query<string>, requestHeaders: Record<string, string> = {}): Promise<BaseHTTPClientResponse> {\n // Expand headers for use in fetch\n const headers = {\n ...this.tokenHeader,\n ...this.defaultHeaders,\n ...requestHeaders,\n }\n\n const res = await fetch(this.getURL(relativePath, query), {\n mode: 'cors',\n headers,\n })\n\n return URLTokenBaseHTTPClient.formatFetchResponse(res)\n }\n\n async post(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n // Expand headers for use in fetch\n const headers = {\n ...this.tokenHeader,\n ...this.defaultHeaders,\n ...requestHeaders,\n }\n\n const res = await fetch(this.getURL(relativePath, query), {\n method: 'POST',\n mode: 'cors',\n body: data,\n headers,\n })\n\n return URLTokenBaseHTTPClient.formatFetchResponse(res)\n }\n\n async delete(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n // Expand headers for use in fetch\n const headers = {\n ...this.tokenHeader,\n ...this.defaultHeaders,\n ...requestHeaders,\n }\n\n const res = await fetch(this.getURL(relativePath, query), {\n method: 'DELETE',\n mode: 'cors',\n body: data,\n headers,\n })\n\n return URLTokenBaseHTTPClient.formatFetchResponse(res)\n }\n}\n"],"names":[],"mappings":";;AAuBA,MAAM,qBAAsB,SAAQ,KAAK,CAAA;IACvC,WACE,CAAA,OAAe,EACR,QAAgC,EAAA;QAEvC,KAAK,CAAC,OAAO,CAAC,CAAA;QAFP,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAwB;AAGvC,QAAA,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;AACnC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;KACzB;AACF,CAAA;AAID;;;;AAIG;MACU,sBAAsB,CAAA;;AAKjC,IAAA,WAAA,CACE,WAAwB,EACxB,UAAkB,EAClB,IAAs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