@algorandfoundation/algokit-utils 7.0.0 → 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.
Files changed (148) hide show
  1. package/README.md +14 -3
  2. package/account/account.d.ts +4 -1
  3. package/account/account.js +4 -3
  4. package/account/account.js.map +1 -1
  5. package/account/account.mjs +5 -4
  6. package/account/account.mjs.map +1 -1
  7. package/account/get-dispenser-account.d.ts +1 -1
  8. package/amount.d.ts +1 -0
  9. package/amount.js +3 -2
  10. package/amount.js.map +1 -1
  11. package/amount.mjs +3 -3
  12. package/amount.mjs.map +1 -1
  13. package/app-client.d.ts +4 -4
  14. package/app-client.js +4 -4
  15. package/app-client.js.map +1 -1
  16. package/app-client.mjs +4 -4
  17. package/app-client.mjs.map +1 -1
  18. package/app-deploy.js +23 -5
  19. package/app-deploy.js.map +1 -1
  20. package/app-deploy.mjs +24 -6
  21. package/app-deploy.mjs.map +1 -1
  22. package/app.js +7 -4
  23. package/app.js.map +1 -1
  24. package/app.mjs +7 -4
  25. package/app.mjs.map +1 -1
  26. package/index.js +1 -1
  27. package/index.mjs +2 -2
  28. package/indexer-lookup.d.ts +10 -8
  29. package/indexer-lookup.js +14 -10
  30. package/indexer-lookup.js.map +1 -1
  31. package/indexer-lookup.mjs +14 -10
  32. package/indexer-lookup.mjs.map +1 -1
  33. package/network-client.d.ts +1 -7
  34. package/network-client.js +2 -9
  35. package/network-client.js.map +1 -1
  36. package/network-client.mjs +2 -9
  37. package/network-client.mjs.map +1 -1
  38. package/package.json +2 -2
  39. package/testing/_asset.d.ts +2 -1
  40. package/testing/account.d.ts +4 -3
  41. package/testing/account.js +8 -2
  42. package/testing/account.js.map +1 -1
  43. package/testing/account.mjs +9 -3
  44. package/testing/account.mjs.map +1 -1
  45. package/testing/fixtures/algorand-fixture.js +5 -6
  46. package/testing/fixtures/algorand-fixture.js.map +1 -1
  47. package/testing/fixtures/algorand-fixture.mjs +5 -6
  48. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  49. package/testing/test-logger.js +7 -1
  50. package/testing/test-logger.js.map +1 -1
  51. package/testing/test-logger.mjs +7 -1
  52. package/testing/test-logger.mjs.map +1 -1
  53. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +4 -1
  54. package/transaction/perform-atomic-transaction-composer-simulate.js +14 -10
  55. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  56. package/transaction/perform-atomic-transaction-composer-simulate.mjs +15 -11
  57. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  58. package/transaction/transaction.d.ts +1 -17
  59. package/transaction/transaction.js +110 -82
  60. package/transaction/transaction.js.map +1 -1
  61. package/transaction/transaction.mjs +112 -83
  62. package/transaction/transaction.mjs.map +1 -1
  63. package/transfer/transfer.js +3 -1
  64. package/transfer/transfer.js.map +1 -1
  65. package/transfer/transfer.mjs +3 -1
  66. package/transfer/transfer.mjs.map +1 -1
  67. package/types/account-manager.d.ts +20 -20
  68. package/types/account-manager.js +27 -20
  69. package/types/account-manager.js.map +1 -1
  70. package/types/account-manager.mjs +28 -21
  71. package/types/account-manager.mjs.map +1 -1
  72. package/types/account.d.ts +8 -8
  73. package/types/account.js +2 -2
  74. package/types/account.js.map +1 -1
  75. package/types/account.mjs +3 -3
  76. package/types/account.mjs.map +1 -1
  77. package/types/algo-http-client-with-retry.d.ts +1 -2
  78. package/types/algo-http-client-with-retry.js +33 -3
  79. package/types/algo-http-client-with-retry.js.map +1 -1
  80. package/types/algo-http-client-with-retry.mjs +32 -2
  81. package/types/algo-http-client-with-retry.mjs.map +1 -1
  82. package/types/algorand-client-transaction-creator.d.ts +11 -11
  83. package/types/algorand-client-transaction-sender.d.ts +97 -97
  84. package/types/algorand-client-transaction-sender.js.map +1 -1
  85. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  86. package/types/algorand-client.d.ts +3 -3
  87. package/types/algorand-client.js +1 -1
  88. package/types/algorand-client.js.map +1 -1
  89. package/types/algorand-client.mjs +1 -1
  90. package/types/algorand-client.mjs.map +1 -1
  91. package/types/app-client.d.ts +280 -279
  92. package/types/app-client.js +10 -10
  93. package/types/app-client.js.map +1 -1
  94. package/types/app-client.mjs +11 -11
  95. package/types/app-client.mjs.map +1 -1
  96. package/types/app-deployer.d.ts +4 -4
  97. package/types/app-deployer.js +22 -23
  98. package/types/app-deployer.js.map +1 -1
  99. package/types/app-deployer.mjs +23 -24
  100. package/types/app-deployer.mjs.map +1 -1
  101. package/types/app-factory.d.ts +128 -138
  102. package/types/app-factory.js +4 -3
  103. package/types/app-factory.js.map +1 -1
  104. package/types/app-factory.mjs +5 -4
  105. package/types/app-factory.mjs.map +1 -1
  106. package/types/app-manager.d.ts +5 -5
  107. package/types/app-manager.js +11 -15
  108. package/types/app-manager.js.map +1 -1
  109. package/types/app-manager.mjs +12 -16
  110. package/types/app-manager.mjs.map +1 -1
  111. package/types/app.d.ts +4 -4
  112. package/types/app.js.map +1 -1
  113. package/types/app.mjs.map +1 -1
  114. package/types/asset-manager.d.ts +5 -5
  115. package/types/asset-manager.js +8 -11
  116. package/types/asset-manager.js.map +1 -1
  117. package/types/asset-manager.mjs +8 -11
  118. package/types/asset-manager.mjs.map +1 -1
  119. package/types/client-manager.d.ts +2 -9
  120. package/types/client-manager.js +9 -19
  121. package/types/client-manager.js.map +1 -1
  122. package/types/client-manager.mjs +9 -19
  123. package/types/client-manager.mjs.map +1 -1
  124. package/types/composer.d.ts +22 -22
  125. package/types/composer.js +73 -83
  126. package/types/composer.js.map +1 -1
  127. package/types/composer.mjs +74 -84
  128. package/types/composer.mjs.map +1 -1
  129. package/types/dispenser-client.d.ts +2 -1
  130. package/types/dispenser-client.js +5 -1
  131. package/types/dispenser-client.js.map +1 -1
  132. package/types/dispenser-client.mjs +5 -1
  133. package/types/dispenser-client.mjs.map +1 -1
  134. package/types/indexer.d.ts +74 -755
  135. package/types/indexer.js.map +1 -1
  136. package/types/indexer.mjs.map +1 -1
  137. package/types/kmd-account-manager.d.ts +2 -2
  138. package/types/kmd-account-manager.js.map +1 -1
  139. package/types/kmd-account-manager.mjs.map +1 -1
  140. package/types/network-client.d.ts +1 -1
  141. package/types/network-client.js.map +1 -1
  142. package/types/network-client.mjs.map +1 -1
  143. package/types/testing.d.ts +5 -6
  144. package/types/urlTokenBaseHTTPClient.d.ts +0 -40
  145. package/types/urlTokenBaseHTTPClient.js +0 -153
  146. package/types/urlTokenBaseHTTPClient.js.map +0 -1
  147. package/types/urlTokenBaseHTTPClient.mjs +0 -151
  148. package/types/urlTokenBaseHTTPClient.mjs.map +0 -1
@@ -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;QAFP,IAAQ,CAAA,QAAA,GAAR,QAAQ;AAGf,QAAA,IAAI,CAAC,IAAI,GAAG,uBAAuB;AACnC,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ;;AAE3B;AAID;;;;AAIG;MACU,sBAAsB,CAAA;;AAKjC,IAAA,WAAA,CACE,WAAwB,EACxB,UAAkB,EAClB,IAAsB;;AAEd,IAAA,cAAA,GAAsC,EAAE,EAAA;QAAxC,IAAc,CAAA,cAAA,GAAd,cAAc;;;;AAKtB,QAAA,MAAM,eAAe,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,UAAU,GAAG,CAAG,EAAA,UAAU,GAAG;AAChF,QAAA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC;AAC9C,QAAA,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;AAC/B,YAAA,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE;;QAGtC,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACvC,YAAA,MAAM,IAAI,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,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}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