algosdk 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/client/urlTokenBaseHTTPClient.js +0 -3
- package/dist/cjs/client/urlTokenBaseHTTPClient.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +51 -0
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/getLedgerStateDelta.js +20 -0
- package/dist/cjs/client/v2/algod/getLedgerStateDelta.js.map +1 -0
- package/dist/cjs/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js +20 -0
- package/dist/cjs/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js.map +1 -0
- package/dist/cjs/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js +25 -0
- package/dist/cjs/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js.map +1 -0
- package/dist/cjs/client/v2/algod/models/types.js +301 -6
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js +2 -3
- package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAssetBalances.js +2 -1
- package/dist/cjs/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAssetTransactions.js +2 -4
- package/dist/cjs/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchAccounts.js +2 -1
- package/dist/cjs/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForTransactions.js +61 -62
- package/dist/cjs/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/cjs/client/v2/serviceClient.js +3 -0
- package/dist/cjs/client/v2/serviceClient.js.map +1 -1
- package/dist/cjs/composer.js +1 -1
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/nacl/naclWrappers.js +4 -0
- package/dist/cjs/nacl/naclWrappers.js.map +1 -1
- package/dist/cjs/utils/utils.js +13 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/esm/client/urlTokenBaseHTTPClient.js +0 -3
- package/dist/esm/client/urlTokenBaseHTTPClient.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +51 -0
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/getLedgerStateDelta.js +14 -0
- package/dist/esm/client/v2/algod/getLedgerStateDelta.js.map +1 -0
- package/dist/esm/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js +14 -0
- package/dist/esm/client/v2/algod/getLedgerStateDeltaForTransactionGroup.js.map +1 -0
- package/dist/esm/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js +19 -0
- package/dist/esm/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.js.map +1 -0
- package/dist/esm/client/v2/algod/models/types.js +292 -5
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountTransactions.js +2 -3
- package/dist/esm/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAssetBalances.js +2 -1
- package/dist/esm/client/v2/indexer/lookupAssetBalances.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAssetTransactions.js +2 -4
- package/dist/esm/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchAccounts.js +2 -1
- package/dist/esm/client/v2/indexer/searchAccounts.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForTransactions.js +61 -62
- package/dist/esm/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/esm/client/v2/serviceClient.js +3 -0
- package/dist/esm/client/v2/serviceClient.js.map +1 -1
- package/dist/esm/composer.js +1 -1
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/nacl/naclWrappers.js +4 -0
- package/dist/esm/nacl/naclWrappers.js.map +1 -1
- package/dist/esm/utils/utils.js +11 -0
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/types/client/v2/algod/algod.d.ts +45 -0
- package/dist/types/client/v2/algod/getLedgerStateDelta.d.ts +8 -0
- package/dist/types/client/v2/algod/getLedgerStateDeltaForTransactionGroup.d.ts +8 -0
- package/dist/types/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.d.ts +10 -0
- package/dist/types/client/v2/algod/models/types.d.ts +242 -5
- package/dist/types/client/v2/indexer/lookupAccountTransactions.d.ts +0 -2
- package/dist/types/client/v2/indexer/lookupAssetTransactions.d.ts +0 -3
- package/dist/types/client/v2/indexer/searchForTransactions.d.ts +54 -56
- package/dist/types/utils/utils.d.ts +5 -0
- package/package.json +4 -6
- package/src/client/urlTokenBaseHTTPClient.ts +0 -3
- package/src/client/v2/algod/algod.ts +62 -0
- package/src/client/v2/algod/getLedgerStateDelta.ts +16 -0
- package/src/client/v2/algod/getLedgerStateDeltaForTransactionGroup.ts +16 -0
- package/src/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.ts +29 -0
- package/src/client/v2/algod/models/types.ts +527 -0
- package/src/client/v2/indexer/lookupAccountTransactions.ts +2 -3
- package/src/client/v2/indexer/lookupAssetBalances.ts +2 -1
- package/src/client/v2/indexer/lookupAssetTransactions.ts +2 -4
- package/src/client/v2/indexer/searchAccounts.ts +2 -1
- package/src/client/v2/indexer/searchForTransactions.ts +63 -64
- package/src/client/v2/serviceClient.ts +3 -0
- package/src/composer.ts +1 -1
- package/src/nacl/naclWrappers.ts +6 -0
- package/src/utils/utils.ts +12 -0
|
@@ -300,14 +300,13 @@ export default class LookupAccountTransactions extends JSONRequest {
|
|
|
300
300
|
* .currencyGreaterThan(minBalance - 1)
|
|
301
301
|
* .do();
|
|
302
302
|
* ```
|
|
303
|
-
* @remarks
|
|
304
|
-
* 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.
|
|
305
303
|
*
|
|
306
304
|
* @param greater
|
|
307
305
|
* @category query
|
|
308
306
|
*/
|
|
309
307
|
currencyGreaterThan(greater: number) {
|
|
310
|
-
|
|
308
|
+
// We convert the following to a string for now to correctly include zero values in request parameters.
|
|
309
|
+
this.query['currency-greater-than'] = greater.toString();
|
|
311
310
|
return this;
|
|
312
311
|
}
|
|
313
312
|
|
|
@@ -64,7 +64,8 @@ export default class LookupAssetBalances extends JSONRequest {
|
|
|
64
64
|
* @category query
|
|
65
65
|
*/
|
|
66
66
|
currencyGreaterThan(greater: number) {
|
|
67
|
-
|
|
67
|
+
// We convert the following to a string for now to correctly include zero values in request parameters.
|
|
68
|
+
this.query['currency-greater-than'] = greater.toString();
|
|
68
69
|
return this;
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -252,14 +252,12 @@ export default class LookupAssetTransactions extends JSONRequest {
|
|
|
252
252
|
* .do();
|
|
253
253
|
* ```
|
|
254
254
|
*
|
|
255
|
-
* @remarks
|
|
256
|
-
* 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.
|
|
257
|
-
*
|
|
258
255
|
* @param greater
|
|
259
256
|
* @category query
|
|
260
257
|
*/
|
|
261
258
|
currencyGreaterThan(greater: number) {
|
|
262
|
-
|
|
259
|
+
// We convert the following to a string for now to correctly include zero values in request parameters.
|
|
260
|
+
this.query['currency-greater-than'] = greater.toString();
|
|
263
261
|
return this;
|
|
264
262
|
}
|
|
265
263
|
|
|
@@ -49,7 +49,8 @@ export default class SearchAccounts extends JSONRequest {
|
|
|
49
49
|
* @category query
|
|
50
50
|
*/
|
|
51
51
|
currencyGreaterThan(greater: number) {
|
|
52
|
-
|
|
52
|
+
// We convert the following to a string for now to correctly include zero values in request parameters.
|
|
53
|
+
this.query['currency-greater-than'] = greater.toString();
|
|
53
54
|
return this;
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -242,70 +242,6 @@ export default class SearchForTransactions extends JSONRequest {
|
|
|
242
242
|
return this;
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
/**
|
|
246
|
-
* 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.
|
|
247
|
-
*
|
|
248
|
-
* #### Example 1
|
|
249
|
-
* ```typescript
|
|
250
|
-
* const minBalance = 300000;
|
|
251
|
-
* const txns = await indexerClient
|
|
252
|
-
* .searchForTransactions()
|
|
253
|
-
* .currencyGreaterThan(minBalance - 1)
|
|
254
|
-
* .do();
|
|
255
|
-
* ```
|
|
256
|
-
*
|
|
257
|
-
* #### Example 2
|
|
258
|
-
* ```typescript
|
|
259
|
-
* const assetID = 163650;
|
|
260
|
-
* const minBalance = 300000;
|
|
261
|
-
* const txns = await indexerClient
|
|
262
|
-
* .searchForTransactions()
|
|
263
|
-
* .assetID(assetID)
|
|
264
|
-
* .currencyGreaterThan(minBalance - 1)
|
|
265
|
-
* .do();
|
|
266
|
-
* ```
|
|
267
|
-
* @remarks
|
|
268
|
-
* 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.
|
|
269
|
-
*
|
|
270
|
-
* @param greater
|
|
271
|
-
* @category query
|
|
272
|
-
*/
|
|
273
|
-
currencyGreaterThan(greater: number) {
|
|
274
|
-
this.query['currency-greater-than'] = greater;
|
|
275
|
-
return this;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* 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.
|
|
280
|
-
*
|
|
281
|
-
* #### Example 1
|
|
282
|
-
* ```typescript
|
|
283
|
-
* const maxBalance = 500000;
|
|
284
|
-
* const txns = await indexerClient
|
|
285
|
-
* .searchForTransactions()
|
|
286
|
-
* .currencyLessThan(maxBalance + 1)
|
|
287
|
-
* .do();
|
|
288
|
-
* ```
|
|
289
|
-
*
|
|
290
|
-
* #### Example 2
|
|
291
|
-
* ```typescript
|
|
292
|
-
* const assetID = 163650;
|
|
293
|
-
* const maxBalance = 500000;
|
|
294
|
-
* const txns = await indexerClient
|
|
295
|
-
* .searchForTransactions()
|
|
296
|
-
* .assetID(assetID)
|
|
297
|
-
* .currencyLessThan(maxBalance + 1)
|
|
298
|
-
* .do();
|
|
299
|
-
* ```
|
|
300
|
-
*
|
|
301
|
-
* @param lesser
|
|
302
|
-
* @category query
|
|
303
|
-
*/
|
|
304
|
-
currencyLessThan(lesser: number) {
|
|
305
|
-
this.query['currency-less-than'] = lesser;
|
|
306
|
-
return this;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
245
|
/**
|
|
310
246
|
* Combined with address, defines what address to filter on, as string.
|
|
311
247
|
*
|
|
@@ -432,4 +368,67 @@ export default class SearchForTransactions extends JSONRequest {
|
|
|
432
368
|
this.query['application-id'] = applicationID;
|
|
433
369
|
return this;
|
|
434
370
|
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* 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.
|
|
374
|
+
*
|
|
375
|
+
* #### Example 1
|
|
376
|
+
* ```typescript
|
|
377
|
+
* const minBalance = 300000;
|
|
378
|
+
* const txns = await indexerClient
|
|
379
|
+
* .searchForTransactions()
|
|
380
|
+
* .currencyGreaterThan(minBalance - 1)
|
|
381
|
+
* .do();
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* #### Example 2
|
|
385
|
+
* ```typescript
|
|
386
|
+
* const assetID = 163650;
|
|
387
|
+
* const minBalance = 300000;
|
|
388
|
+
* const txns = await indexerClient
|
|
389
|
+
* .searchForTransactions()
|
|
390
|
+
* .assetID(assetID)
|
|
391
|
+
* .currencyGreaterThan(minBalance - 1)
|
|
392
|
+
* .do();
|
|
393
|
+
* ```
|
|
394
|
+
*
|
|
395
|
+
* @param greater
|
|
396
|
+
* @category query
|
|
397
|
+
*/
|
|
398
|
+
currencyGreaterThan(greater: number) {
|
|
399
|
+
// We convert the following to a string for now to correctly include zero values in request parameters.
|
|
400
|
+
this.query['currency-greater-than'] = greater.toString();
|
|
401
|
+
return this;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* 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.
|
|
406
|
+
*
|
|
407
|
+
* #### Example 1
|
|
408
|
+
* ```typescript
|
|
409
|
+
* const maxBalance = 500000;
|
|
410
|
+
* const txns = await indexerClient
|
|
411
|
+
* .searchForTransactions()
|
|
412
|
+
* .currencyLessThan(maxBalance + 1)
|
|
413
|
+
* .do();
|
|
414
|
+
* ```
|
|
415
|
+
*
|
|
416
|
+
* #### Example 2
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const assetID = 163650;
|
|
419
|
+
* const maxBalance = 500000;
|
|
420
|
+
* const txns = await indexerClient
|
|
421
|
+
* .searchForTransactions()
|
|
422
|
+
* .assetID(assetID)
|
|
423
|
+
* .currencyLessThan(maxBalance + 1)
|
|
424
|
+
* .do();
|
|
425
|
+
* ```
|
|
426
|
+
*
|
|
427
|
+
* @param lesser
|
|
428
|
+
* @category query
|
|
429
|
+
*/
|
|
430
|
+
currencyLessThan(lesser: number) {
|
|
431
|
+
this.query['currency-less-than'] = lesser;
|
|
432
|
+
return this;
|
|
433
|
+
}
|
|
435
434
|
}
|
|
@@ -19,6 +19,9 @@ function convertTokenStringToTokenHeader(
|
|
|
19
19
|
headerIdentifier: TokenHeaderIdentifier
|
|
20
20
|
): TokenHeader {
|
|
21
21
|
const tokenHeader = {};
|
|
22
|
+
if (token === '') {
|
|
23
|
+
return tokenHeader;
|
|
24
|
+
}
|
|
22
25
|
tokenHeader[headerIdentifier] = token;
|
|
23
26
|
return tokenHeader as TokenHeader;
|
|
24
27
|
}
|
package/src/composer.ts
CHANGED
|
@@ -351,7 +351,7 @@ export class AtomicTransactionComposer {
|
|
|
351
351
|
!abiCheckTransactionType(argType, argValue.txn)
|
|
352
352
|
) {
|
|
353
353
|
throw new Error(
|
|
354
|
-
`Expected ${argType}
|
|
354
|
+
`Expected ${argType} TransactionWithSigner for argument at index ${i}`
|
|
355
355
|
);
|
|
356
356
|
}
|
|
357
357
|
if (argValue.txn.group && argValue.txn.group.some((v) => v !== 0)) {
|
package/src/nacl/naclWrappers.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import nacl from 'tweetnacl';
|
|
2
2
|
import sha512 from 'js-sha512';
|
|
3
|
+
import { isReactNative } from '../utils/utils';
|
|
3
4
|
|
|
4
5
|
export function genericHash(arr: sha512.Message) {
|
|
5
6
|
return sha512.sha512_256.array(arr);
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export function randomBytes(length: number) {
|
|
10
|
+
if (isReactNative()) {
|
|
11
|
+
console.warn(
|
|
12
|
+
`It looks like you're running in react-native. In order to perform common crypto operations you will need to polyfill common operations such as crypto.getRandomValues`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
9
15
|
return nacl.randomBytes(length);
|
|
10
16
|
}
|
|
11
17
|
|
package/src/utils/utils.ts
CHANGED
|
@@ -122,3 +122,15 @@ export function isNode() {
|
|
|
122
122
|
typeof process.versions.node !== 'undefined'
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Check whether the environment is ReactNative
|
|
128
|
+
* @returns True if ReactNative, false otherwise
|
|
129
|
+
*/
|
|
130
|
+
export function isReactNative() {
|
|
131
|
+
const { navigator } = globalThis as { navigator?: { product?: string } };
|
|
132
|
+
if (typeof navigator === 'object' && navigator.product === 'ReactNative') {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|