algosdk 2.4.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/client/urlTokenBaseHTTPClient.js +0 -3
  5. package/dist/cjs/client/urlTokenBaseHTTPClient.js.map +1 -1
  6. package/dist/cjs/client/v2/algod/algod.js +17 -0
  7. package/dist/cjs/client/v2/algod/algod.js.map +1 -1
  8. package/dist/cjs/client/v2/algod/getBlockTxids.js +19 -0
  9. package/dist/cjs/client/v2/algod/getBlockTxids.js.map +1 -0
  10. package/dist/cjs/client/v2/algod/models/types.js +716 -18
  11. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  12. package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js +2 -3
  13. package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
  14. package/dist/cjs/client/v2/indexer/lookupAssetBalances.js +2 -1
  15. package/dist/cjs/client/v2/indexer/lookupAssetBalances.js.map +1 -1
  16. package/dist/cjs/client/v2/indexer/lookupAssetTransactions.js +2 -4
  17. package/dist/cjs/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
  18. package/dist/cjs/client/v2/indexer/searchAccounts.js +2 -1
  19. package/dist/cjs/client/v2/indexer/searchAccounts.js.map +1 -1
  20. package/dist/cjs/client/v2/indexer/searchForTransactions.js +61 -62
  21. package/dist/cjs/client/v2/indexer/searchForTransactions.js.map +1 -1
  22. package/dist/cjs/nacl/naclWrappers.js +4 -0
  23. package/dist/cjs/nacl/naclWrappers.js.map +1 -1
  24. package/dist/cjs/signer.js +6 -1
  25. package/dist/cjs/signer.js.map +1 -1
  26. package/dist/cjs/utils/utils.js +13 -1
  27. package/dist/cjs/utils/utils.js.map +1 -1
  28. package/dist/esm/client/urlTokenBaseHTTPClient.js +0 -3
  29. package/dist/esm/client/urlTokenBaseHTTPClient.js.map +1 -1
  30. package/dist/esm/client/v2/algod/algod.js +17 -0
  31. package/dist/esm/client/v2/algod/algod.js.map +1 -1
  32. package/dist/esm/client/v2/algod/getBlockTxids.js +13 -0
  33. package/dist/esm/client/v2/algod/getBlockTxids.js.map +1 -0
  34. package/dist/esm/client/v2/algod/models/types.js +699 -16
  35. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  36. package/dist/esm/client/v2/indexer/lookupAccountTransactions.js +2 -3
  37. package/dist/esm/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
  38. package/dist/esm/client/v2/indexer/lookupAssetBalances.js +2 -1
  39. package/dist/esm/client/v2/indexer/lookupAssetBalances.js.map +1 -1
  40. package/dist/esm/client/v2/indexer/lookupAssetTransactions.js +2 -4
  41. package/dist/esm/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
  42. package/dist/esm/client/v2/indexer/searchAccounts.js +2 -1
  43. package/dist/esm/client/v2/indexer/searchAccounts.js.map +1 -1
  44. package/dist/esm/client/v2/indexer/searchForTransactions.js +61 -62
  45. package/dist/esm/client/v2/indexer/searchForTransactions.js.map +1 -1
  46. package/dist/esm/nacl/naclWrappers.js +4 -0
  47. package/dist/esm/nacl/naclWrappers.js.map +1 -1
  48. package/dist/esm/signer.js +6 -1
  49. package/dist/esm/signer.js.map +1 -1
  50. package/dist/esm/utils/utils.js +11 -0
  51. package/dist/esm/utils/utils.js.map +1 -1
  52. package/dist/types/client/v2/algod/algod.d.ts +15 -0
  53. package/dist/types/client/v2/algod/getBlockTxids.d.ts +8 -0
  54. package/dist/types/client/v2/algod/models/types.d.ts +606 -10
  55. package/dist/types/client/v2/indexer/lookupAccountTransactions.d.ts +0 -2
  56. package/dist/types/client/v2/indexer/lookupAssetTransactions.d.ts +0 -3
  57. package/dist/types/client/v2/indexer/searchForTransactions.d.ts +54 -56
  58. package/dist/types/utils/utils.d.ts +5 -0
  59. package/package.json +5 -5
  60. package/src/client/urlTokenBaseHTTPClient.ts +0 -3
  61. package/src/client/v2/algod/algod.ts +18 -0
  62. package/src/client/v2/algod/getBlockTxids.ts +18 -0
  63. package/src/client/v2/algod/models/types.ts +1263 -13
  64. package/src/client/v2/indexer/lookupAccountTransactions.ts +2 -3
  65. package/src/client/v2/indexer/lookupAssetBalances.ts +2 -1
  66. package/src/client/v2/indexer/lookupAssetTransactions.ts +2 -4
  67. package/src/client/v2/indexer/searchAccounts.ts +2 -1
  68. package/src/client/v2/indexer/searchForTransactions.ts +63 -64
  69. package/src/nacl/naclWrappers.ts +6 -0
  70. package/src/signer.ts +5 -1
  71. package/src/utils/utils.ts +12 -0
@@ -238,8 +238,6 @@ export default class LookupAccountTransactions extends JSONRequest {
238
238
  * .currencyGreaterThan(minBalance - 1)
239
239
  * .do();
240
240
  * ```
241
- * @remarks
242
- * If you are looking for transactions with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount.
243
241
  *
244
242
  * @param greater
245
243
  * @category query
@@ -204,9 +204,6 @@ export default class LookupAssetTransactions extends JSONRequest {
204
204
  * .do();
205
205
  * ```
206
206
  *
207
- * @remarks
208
- * If you are looking for transactions with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount.
209
- *
210
207
  * @param greater
211
208
  * @category query
212
209
  */
@@ -192,62 +192,6 @@ export default class SearchForTransactions extends JSONRequest {
192
192
  * @category query
193
193
  */
194
194
  afterTime(after: string): this;
195
- /**
196
- * Filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.
197
- *
198
- * #### Example 1
199
- * ```typescript
200
- * const minBalance = 300000;
201
- * const txns = await indexerClient
202
- * .searchForTransactions()
203
- * .currencyGreaterThan(minBalance - 1)
204
- * .do();
205
- * ```
206
- *
207
- * #### Example 2
208
- * ```typescript
209
- * const assetID = 163650;
210
- * const minBalance = 300000;
211
- * const txns = await indexerClient
212
- * .searchForTransactions()
213
- * .assetID(assetID)
214
- * .currencyGreaterThan(minBalance - 1)
215
- * .do();
216
- * ```
217
- * @remarks
218
- * If you are looking for transactions with the currency amount greater than 0, simply construct the query without `currencyGreaterThan` because it doesn't accept `-1`, and passing the `0` `currency-greater-than` value would exclude transactions with a 0 amount.
219
- *
220
- * @param greater
221
- * @category query
222
- */
223
- currencyGreaterThan(greater: number): this;
224
- /**
225
- * Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.
226
- *
227
- * #### Example 1
228
- * ```typescript
229
- * const maxBalance = 500000;
230
- * const txns = await indexerClient
231
- * .searchForTransactions()
232
- * .currencyLessThan(maxBalance + 1)
233
- * .do();
234
- * ```
235
- *
236
- * #### Example 2
237
- * ```typescript
238
- * const assetID = 163650;
239
- * const maxBalance = 500000;
240
- * const txns = await indexerClient
241
- * .searchForTransactions()
242
- * .assetID(assetID)
243
- * .currencyLessThan(maxBalance + 1)
244
- * .do();
245
- * ```
246
- *
247
- * @param lesser
248
- * @category query
249
- */
250
- currencyLessThan(lesser: number): this;
251
195
  /**
252
196
  * Combined with address, defines what address to filter on, as string.
253
197
  *
@@ -351,4 +295,58 @@ export default class SearchForTransactions extends JSONRequest {
351
295
  * @category query
352
296
  */
353
297
  applicationID(applicationID: number): this;
298
+ /**
299
+ * Filtered results should have an amount greater than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.
300
+ *
301
+ * #### Example 1
302
+ * ```typescript
303
+ * const minBalance = 300000;
304
+ * const txns = await indexerClient
305
+ * .searchForTransactions()
306
+ * .currencyGreaterThan(minBalance - 1)
307
+ * .do();
308
+ * ```
309
+ *
310
+ * #### Example 2
311
+ * ```typescript
312
+ * const assetID = 163650;
313
+ * const minBalance = 300000;
314
+ * const txns = await indexerClient
315
+ * .searchForTransactions()
316
+ * .assetID(assetID)
317
+ * .currencyGreaterThan(minBalance - 1)
318
+ * .do();
319
+ * ```
320
+ *
321
+ * @param greater
322
+ * @category query
323
+ */
324
+ currencyGreaterThan(greater: number): this;
325
+ /**
326
+ * Filtered results should have an amount less than this value, as int, representing microAlgos, unless an asset-id is provided, in which case units are in the asset's units.
327
+ *
328
+ * #### Example 1
329
+ * ```typescript
330
+ * const maxBalance = 500000;
331
+ * const txns = await indexerClient
332
+ * .searchForTransactions()
333
+ * .currencyLessThan(maxBalance + 1)
334
+ * .do();
335
+ * ```
336
+ *
337
+ * #### Example 2
338
+ * ```typescript
339
+ * const assetID = 163650;
340
+ * const maxBalance = 500000;
341
+ * const txns = await indexerClient
342
+ * .searchForTransactions()
343
+ * .assetID(assetID)
344
+ * .currencyLessThan(maxBalance + 1)
345
+ * .do();
346
+ * ```
347
+ *
348
+ * @param lesser
349
+ * @category query
350
+ */
351
+ currencyLessThan(lesser: number): this;
354
352
  }
@@ -45,3 +45,8 @@ export declare function removeUndefinedProperties(obj: Record<string | number |
45
45
  * @returns True if Node.js environment, false otherwise
46
46
  */
47
47
  export declare function isNode(): boolean;
48
+ /**
49
+ * Check whether the environment is ReactNative
50
+ * @returns True if ReactNative, false otherwise
51
+ */
52
+ export declare function isReactNative(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "algo-msgpack-with-bigint": "^2.1.1",
25
25
  "buffer": "^6.0.3",
26
- "cross-fetch": "^3.1.5",
26
+ "cross-fetch": "^4.0.0",
27
27
  "hi-base32": "^0.5.1",
28
28
  "js-sha256": "^0.9.0",
29
29
  "js-sha3": "^0.8.0",
@@ -38,7 +38,7 @@
38
38
  "@typescript-eslint/eslint-plugin": "^4.26.1",
39
39
  "@typescript-eslint/parser": "^4.26.1",
40
40
  "assert": "^2.0.0",
41
- "chromedriver": "^108.0.0",
41
+ "chromedriver": "^116.0.0",
42
42
  "concurrently": "^6.2.0",
43
43
  "cucumber": "^5.1.0",
44
44
  "es-abstract": "^1.18.3",
@@ -54,7 +54,7 @@
54
54
  "mocha": "^9.0.0",
55
55
  "mock-http-server": "^1.4.3",
56
56
  "prettier": "2.2.1",
57
- "selenium-webdriver": "^4.2.0",
57
+ "selenium-webdriver": "^4.10.0",
58
58
  "source-map-loader": "^2.0.2",
59
59
  "ts-loader": "^9.3.1",
60
60
  "ts-node": "^10.9.1",
@@ -80,6 +80,6 @@
80
80
  "author": "Algorand, llc",
81
81
  "license": "MIT",
82
82
  "engines": {
83
- "node": ">=16.0.0"
83
+ "node": ">=18.0.0"
84
84
  }
85
85
  }
@@ -163,7 +163,6 @@ export class URLTokenBaseHTTPClient implements BaseHTTPClient {
163
163
  };
164
164
 
165
165
  const res = await fetch(this.getURL(relativePath, query), {
166
- mode: 'cors',
167
166
  headers,
168
167
  });
169
168
 
@@ -185,7 +184,6 @@ export class URLTokenBaseHTTPClient implements BaseHTTPClient {
185
184
 
186
185
  const res = await fetch(this.getURL(relativePath, query), {
187
186
  method: 'POST',
188
- mode: 'cors',
189
187
  body: data,
190
188
  headers,
191
189
  });
@@ -208,7 +206,6 @@ export class URLTokenBaseHTTPClient implements BaseHTTPClient {
208
206
 
209
207
  const res = await fetch(this.getURL(relativePath, query), {
210
208
  method: 'DELETE',
211
- mode: 'cors',
212
209
  body: data,
213
210
  headers,
214
211
  });
@@ -10,6 +10,7 @@ import Genesis from './genesis';
10
10
  import GetAssetByID from './getAssetByID';
11
11
  import GetApplicationByID from './getApplicationByID';
12
12
  import GetBlockHash from './getBlockHash';
13
+ import GetBlockTxids from './getBlockTxids';
13
14
  import GetApplicationBoxByName from './getApplicationBoxByName';
14
15
  import GetApplicationBoxes from './getApplicationBoxes';
15
16
  import HealthCheck from './healthCheck';
@@ -238,6 +239,23 @@ export default class AlgodClient extends ServiceClient {
238
239
  return new GetBlockHash(this.c, this.intDecoding, roundNumber);
239
240
  }
240
241
 
242
+ /**
243
+ * Get the top level transaction IDs for the block on the given round.
244
+ *
245
+ * #### Example
246
+ * ```typescript
247
+ * const roundNumber = 18038133;
248
+ * const block = await algodClient.getBlockTxids(roundNumber).do();
249
+ * ```
250
+ *
251
+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundtxids)
252
+ * @param roundNumber - The round number of the block to get.
253
+ * @category GET
254
+ */
255
+ getBlockTxids(roundNumber: number) {
256
+ return new GetBlockTxids(this.c, this.intDecoding, roundNumber);
257
+ }
258
+
241
259
  /**
242
260
  * Returns the transaction information for a specific pending transaction.
243
261
  *
@@ -0,0 +1,18 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ import HTTPClient from '../../client';
3
+ import IntDecoding from '../../../types/intDecoding';
4
+
5
+ export default class GetBlockTxids extends JSONRequest {
6
+ round: number;
7
+
8
+ constructor(c: HTTPClient, intDecoding: IntDecoding, roundNumber: number) {
9
+ super(c, intDecoding);
10
+ if (!Number.isInteger(roundNumber))
11
+ throw Error('roundNumber should be an integer');
12
+ this.round = roundNumber;
13
+ }
14
+
15
+ path() {
16
+ return `/v2/blocks/${this.round}/txids`;
17
+ }
18
+ }