algosdk 2.2.0 → 2.4.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 +5 -7
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +252 -25
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxByName.js +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +1 -1
- package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js +19 -0
- package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -0
- 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/getSyncRound.js +19 -0
- package/dist/cjs/client/v2/algod/getSyncRound.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 +327 -23
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/algod/ready.js +14 -0
- package/dist/cjs/client/v2/algod/ready.js.map +1 -0
- package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js +22 -0
- package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -0
- package/dist/cjs/client/v2/algod/setSyncRound.js +22 -0
- package/dist/cjs/client/v2/algod/setSyncRound.js.map +1 -0
- package/dist/cjs/client/v2/algod/simulateTransaction.js +4 -19
- package/dist/cjs/client/v2/algod/simulateTransaction.js.map +1 -1
- package/dist/cjs/client/v2/algod/suggestedParams.js +1 -0
- package/dist/cjs/client/v2/algod/suggestedParams.js.map +1 -1
- package/dist/cjs/client/v2/algod/unsetSyncRound.js +18 -0
- package/dist/cjs/client/v2/algod/unsetSyncRound.js.map +1 -0
- package/dist/cjs/client/v2/serviceClient.js +3 -0
- package/dist/cjs/client/v2/serviceClient.js.map +1 -1
- package/dist/cjs/composer.js +40 -3
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/transaction.js +1 -2
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +229 -25
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxByName.js +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +1 -1
- package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js +13 -0
- package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -0
- 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/getSyncRound.js +13 -0
- package/dist/esm/client/v2/algod/getSyncRound.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 +317 -22
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/algod/ready.js +8 -0
- package/dist/esm/client/v2/algod/ready.js.map +1 -0
- package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js +16 -0
- package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -0
- package/dist/esm/client/v2/algod/setSyncRound.js +16 -0
- package/dist/esm/client/v2/algod/setSyncRound.js.map +1 -0
- package/dist/esm/client/v2/algod/simulateTransaction.js +4 -19
- package/dist/esm/client/v2/algod/simulateTransaction.js.map +1 -1
- package/dist/esm/client/v2/algod/suggestedParams.js +1 -0
- package/dist/esm/client/v2/algod/suggestedParams.js.map +1 -1
- package/dist/esm/client/v2/algod/unsetSyncRound.js +12 -0
- package/dist/esm/client/v2/algod/unsetSyncRound.js.map +1 -0
- package/dist/esm/client/v2/serviceClient.js +3 -0
- package/dist/esm/client/v2/serviceClient.js.map +1 -1
- package/dist/esm/composer.js +17 -3
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/transaction.js +1 -2
- package/dist/esm/transaction.js.map +1 -1
- package/dist/types/client/v2/algod/algod.d.ts +190 -24
- package/dist/types/client/v2/algod/getApplicationBoxByName.d.ts +1 -1
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +1 -1
- package/dist/types/client/v2/algod/getBlockOffsetTimestamp.d.ts +6 -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/getSyncRound.d.ts +6 -0
- package/dist/types/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.d.ts +10 -0
- package/dist/types/client/v2/algod/models/types.d.ts +283 -29
- package/dist/types/client/v2/algod/ready.d.ts +4 -0
- package/dist/types/client/v2/algod/setBlockOffsetTimestamp.d.ts +9 -0
- package/dist/types/client/v2/algod/setSyncRound.d.ts +9 -0
- package/dist/types/client/v2/algod/simulateTransaction.d.ts +3 -3
- package/dist/types/client/v2/algod/suggestedParams.d.ts +3 -3
- package/dist/types/client/v2/algod/unsetSyncRound.d.ts +5 -0
- package/dist/types/composer.d.ts +5 -2
- package/dist/types/main.d.ts +1 -0
- package/dist/types/makeTxn.d.ts +1 -3
- package/dist/types/types/transactions/base.d.ts +6 -0
- package/package.json +2 -4
- package/src/client/v2/algod/algod.ts +246 -25
- package/src/client/v2/algod/getApplicationBoxByName.ts +1 -1
- package/src/client/v2/algod/getApplicationBoxes.ts +1 -1
- package/src/client/v2/algod/getBlockOffsetTimestamp.ts +17 -0
- package/src/client/v2/algod/getLedgerStateDelta.ts +16 -0
- package/src/client/v2/algod/getLedgerStateDeltaForTransactionGroup.ts +16 -0
- package/src/client/v2/algod/getSyncRound.ts +17 -0
- package/src/client/v2/algod/getTransactionGroupLedgerStateDeltasForRound.ts +29 -0
- package/src/client/v2/algod/models/types.ts +560 -36
- package/src/client/v2/algod/ready.ts +8 -0
- package/src/client/v2/algod/setBlockOffsetTimestamp.ts +20 -0
- package/src/client/v2/algod/setSyncRound.ts +20 -0
- package/src/client/v2/algod/simulateTransaction.ts +6 -22
- package/src/client/v2/algod/suggestedParams.ts +4 -3
- package/src/client/v2/algod/unsetSyncRound.ts +13 -0
- package/src/client/v2/serviceClient.ts +3 -0
- package/src/composer.ts +28 -4
- package/src/main.ts +7 -0
- package/src/makeTxn.ts +2 -4
- package/src/transaction.ts +1 -2
- package/src/types/transactions/base.ts +7 -0
|
@@ -30,8 +30,19 @@ import {
|
|
|
30
30
|
} from '../../urlTokenBaseHTTPClient';
|
|
31
31
|
import LightBlockHeaderProof from './lightBlockHeaderProof';
|
|
32
32
|
import StateProof from './stateproof';
|
|
33
|
+
import SetSyncRound from './setSyncRound';
|
|
34
|
+
import GetSyncRound from './getSyncRound';
|
|
35
|
+
import SetBlockOffsetTimestamp from './setBlockOffsetTimestamp';
|
|
36
|
+
import GetBlockOffsetTimestamp from './getBlockOffsetTimestamp';
|
|
33
37
|
import Disassemble from './disassemble';
|
|
34
38
|
import SimulateRawTransactions from './simulateTransaction';
|
|
39
|
+
import { EncodedSignedTransaction } from '../../../types';
|
|
40
|
+
import * as encoding from '../../../encoding/encoding';
|
|
41
|
+
import Ready from './ready';
|
|
42
|
+
import UnsetSyncRound from './unsetSyncRound';
|
|
43
|
+
import GetLedgerStateDeltaForTransactionGroup from './getLedgerStateDeltaForTransactionGroup';
|
|
44
|
+
import GetLedgerStateDelta from './getLedgerStateDelta';
|
|
45
|
+
import GetTransactionGroupLedgerStateDeltasForRound from './getTransactionGroupLedgerStateDeltasForRound';
|
|
35
46
|
|
|
36
47
|
/**
|
|
37
48
|
* Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
|
|
@@ -86,7 +97,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
86
97
|
* const health = await algodClient.healthCheck().do();
|
|
87
98
|
* ```
|
|
88
99
|
*
|
|
89
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
100
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-health)
|
|
90
101
|
* @category GET
|
|
91
102
|
*/
|
|
92
103
|
healthCheck() {
|
|
@@ -101,7 +112,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
101
112
|
* const versionsDetails = await algodClient.versionsCheck().do();
|
|
102
113
|
* ```
|
|
103
114
|
*
|
|
104
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
115
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-versions)
|
|
105
116
|
* @category GET
|
|
106
117
|
*/
|
|
107
118
|
versionsCheck() {
|
|
@@ -117,7 +128,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
117
128
|
* const result = await waitForConfirmation(algodClient, txid, 3);
|
|
118
129
|
* ```
|
|
119
130
|
*
|
|
120
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
131
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactions)
|
|
121
132
|
*
|
|
122
133
|
* @remarks
|
|
123
134
|
* Often used with {@linkcode waitForConfirmation}
|
|
@@ -137,7 +148,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
137
148
|
* const accountInfo = await algodClient.accountInformation(address).do();
|
|
138
149
|
* ```
|
|
139
150
|
*
|
|
140
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
151
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
141
152
|
* @param account - The address of the account to look up.
|
|
142
153
|
* @category GET
|
|
143
154
|
*/
|
|
@@ -155,7 +166,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
155
166
|
* const accountAssetInfo = await algodClient.accountAssetInformation(address, index).do();
|
|
156
167
|
* ```
|
|
157
168
|
*
|
|
158
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
169
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
159
170
|
* @param account - The address of the account to look up.
|
|
160
171
|
* @param index - The asset ID to look up.
|
|
161
172
|
* @category GET
|
|
@@ -179,7 +190,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
179
190
|
* const accountInfo = await algodClient.accountApplicationInformation(address, index).do();
|
|
180
191
|
* ```
|
|
181
192
|
*
|
|
182
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
193
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
183
194
|
* @param account - The address of the account to look up.
|
|
184
195
|
* @param index - The application ID to look up.
|
|
185
196
|
* @category GET
|
|
@@ -202,7 +213,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
202
213
|
* const block = await algodClient.block(roundNumber).do();
|
|
203
214
|
* ```
|
|
204
215
|
*
|
|
205
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
216
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksround)
|
|
206
217
|
* @param roundNumber - The round number of the block to get.
|
|
207
218
|
* @category GET
|
|
208
219
|
*/
|
|
@@ -219,7 +230,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
219
230
|
* const block = await algodClient.getBlockHash(roundNumber).do();
|
|
220
231
|
* ```
|
|
221
232
|
*
|
|
222
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
233
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundhash)
|
|
223
234
|
* @param roundNumber - The round number of the block to get.
|
|
224
235
|
* @category GET
|
|
225
236
|
*/
|
|
@@ -236,7 +247,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
236
247
|
* const pending = await algodClient.pendingTransactionInformation(txId).do();
|
|
237
248
|
* ```
|
|
238
249
|
*
|
|
239
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
250
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionspendingtxid)
|
|
240
251
|
*
|
|
241
252
|
* @remarks
|
|
242
253
|
* <br><br>
|
|
@@ -272,7 +283,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
272
283
|
* .do();
|
|
273
284
|
* ```
|
|
274
285
|
*
|
|
275
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
286
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionspending)
|
|
276
287
|
* @category GET
|
|
277
288
|
*/
|
|
278
289
|
pendingTransactionsInformation() {
|
|
@@ -299,7 +310,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
299
310
|
* .do();
|
|
300
311
|
* ```
|
|
301
312
|
*
|
|
302
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
313
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddresstransactionspending)
|
|
303
314
|
* @param address - The address of the sender.
|
|
304
315
|
* @category GET
|
|
305
316
|
*/
|
|
@@ -315,7 +326,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
315
326
|
* const status = await algodClient.status().do();
|
|
316
327
|
* ```
|
|
317
328
|
*
|
|
318
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
329
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2status)
|
|
319
330
|
* @category GET
|
|
320
331
|
*/
|
|
321
332
|
status() {
|
|
@@ -331,7 +342,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
331
342
|
* const statusAfterBlock = await algodClient.statusAfterBlock(round).do();
|
|
332
343
|
* ```
|
|
333
344
|
*
|
|
334
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
345
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2statuswait-for-block-afterround)
|
|
335
346
|
* @param round - The number of the round to wait for.
|
|
336
347
|
* @category GET
|
|
337
348
|
*/
|
|
@@ -354,7 +365,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
354
365
|
* });
|
|
355
366
|
* ```
|
|
356
367
|
*
|
|
357
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
368
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionsparams)
|
|
358
369
|
*
|
|
359
370
|
* @remarks
|
|
360
371
|
* Often used with
|
|
@@ -373,7 +384,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
373
384
|
* const supplyDetails = await algodClient.supply().do();
|
|
374
385
|
* ```
|
|
375
386
|
*
|
|
376
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
387
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2ledgersupply)
|
|
377
388
|
* @category GET
|
|
378
389
|
*/
|
|
379
390
|
supply() {
|
|
@@ -389,7 +400,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
389
400
|
* const compiledSmartContract = await algodClient.compile(source).do();
|
|
390
401
|
* ```
|
|
391
402
|
*
|
|
392
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
403
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealcompile)
|
|
393
404
|
* @remarks
|
|
394
405
|
* This endpoint is only enabled when a node's configuration file sets `EnableDeveloperAPI` to true.
|
|
395
406
|
* @param source
|
|
@@ -425,7 +436,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
425
436
|
* const dryRunResult = await algodClient.dryrun(dr).do();
|
|
426
437
|
* ```
|
|
427
438
|
*
|
|
428
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
439
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealdryrun)
|
|
429
440
|
* @param dr
|
|
430
441
|
* @category POST
|
|
431
442
|
*/
|
|
@@ -443,7 +454,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
443
454
|
* const asset = await algodClient.getAssetByID(asset_id).do();
|
|
444
455
|
* ```
|
|
445
456
|
*
|
|
446
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
457
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2assetsasset-id)
|
|
447
458
|
* @param index - The asset ID to look up.
|
|
448
459
|
* @category GET
|
|
449
460
|
*/
|
|
@@ -461,7 +472,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
461
472
|
* const app = await algodClient.getApplicationByID(index).do();
|
|
462
473
|
* ```
|
|
463
474
|
*
|
|
464
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
475
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-id)
|
|
465
476
|
* @param index - The application ID to look up.
|
|
466
477
|
* @category GET
|
|
467
478
|
*/
|
|
@@ -480,7 +491,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
480
491
|
* const boxValue = boxResponse.value;
|
|
481
492
|
* ```
|
|
482
493
|
*
|
|
483
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
494
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idbox)
|
|
484
495
|
* @param index - The application ID to look up.
|
|
485
496
|
* @category GET
|
|
486
497
|
*/
|
|
@@ -503,7 +514,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
503
514
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
504
515
|
* ```
|
|
505
516
|
*
|
|
506
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
517
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
507
518
|
* @param index - The application ID to look up.
|
|
508
519
|
* @category GET
|
|
509
520
|
*/
|
|
@@ -519,7 +530,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
519
530
|
* const genesis = await algodClient.genesis().do();
|
|
520
531
|
* ```
|
|
521
532
|
*
|
|
522
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
533
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-genesis)
|
|
523
534
|
* @category GET
|
|
524
535
|
*/
|
|
525
536
|
genesis() {
|
|
@@ -536,7 +547,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
536
547
|
* const proof = await algodClient.getTransactionProof(round, txId).do();
|
|
537
548
|
* ```
|
|
538
549
|
*
|
|
539
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
550
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundtransactionstxidproof)
|
|
540
551
|
* @param round - The round in which the transaction appears.
|
|
541
552
|
* @param txID - The transaction ID for which to generate a proof.
|
|
542
553
|
* @category GET
|
|
@@ -582,14 +593,224 @@ export default class AlgodClient extends ServiceClient {
|
|
|
582
593
|
*
|
|
583
594
|
* #### Example
|
|
584
595
|
* ```typescript
|
|
596
|
+
* const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn1Params);
|
|
597
|
+
* const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn2Params);
|
|
598
|
+
* const txgroup = algosdk.assignGroupID([txn1, txn2]);
|
|
599
|
+
*
|
|
600
|
+
* // Actually sign the first transaction
|
|
601
|
+
* const signedTxn1 = txgroup[0].signTxn(senderSk).blob;
|
|
602
|
+
* // Simulate does not require signed transactions -- use this method to encode an unsigned transaction
|
|
603
|
+
* const signedTxn2 = algosdk.encodeUnsignedSimulateTransaction(txgroup[1]);
|
|
604
|
+
*
|
|
585
605
|
* const resp = await client.simulateRawTransactions([signedTxn1, signedTxn2]).do();
|
|
586
606
|
* ```
|
|
587
607
|
*
|
|
588
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
608
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactionssimulate)
|
|
589
609
|
* @param stxOrStxs
|
|
590
610
|
* @category POST
|
|
591
611
|
*/
|
|
592
612
|
simulateRawTransactions(stxOrStxs: Uint8Array | Uint8Array[]) {
|
|
593
|
-
|
|
613
|
+
const txnObjects: EncodedSignedTransaction[] = [];
|
|
614
|
+
if (Array.isArray(stxOrStxs)) {
|
|
615
|
+
for (const stxn of stxOrStxs) {
|
|
616
|
+
txnObjects.push(encoding.decode(stxn) as EncodedSignedTransaction);
|
|
617
|
+
}
|
|
618
|
+
} else {
|
|
619
|
+
txnObjects.push(encoding.decode(stxOrStxs) as EncodedSignedTransaction);
|
|
620
|
+
}
|
|
621
|
+
const request = new modelsv2.SimulateRequest({
|
|
622
|
+
txnGroups: [
|
|
623
|
+
new modelsv2.SimulateRequestTransactionGroup({
|
|
624
|
+
txns: txnObjects,
|
|
625
|
+
}),
|
|
626
|
+
],
|
|
627
|
+
});
|
|
628
|
+
return this.simulateTransactions(request);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Simulate transactions being sent to the network.
|
|
633
|
+
*
|
|
634
|
+
* #### Example
|
|
635
|
+
* ```typescript
|
|
636
|
+
* const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn1Params);
|
|
637
|
+
* const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn2Params);
|
|
638
|
+
* const txgroup = algosdk.assignGroupID([txn1, txn2]);
|
|
639
|
+
*
|
|
640
|
+
* // Actually sign the first transaction
|
|
641
|
+
* const signedTxn1 = txgroup[0].signTxn(senderSk).blob;
|
|
642
|
+
* // Simulate does not require signed transactions -- use this method to encode an unsigned transaction
|
|
643
|
+
* const signedTxn2 = algosdk.encodeUnsignedSimulateTransaction(txgroup[1]);
|
|
644
|
+
*
|
|
645
|
+
* const request = new modelsv2.SimulateRequest({
|
|
646
|
+
* txnGroups: [
|
|
647
|
+
* new modelsv2.SimulateRequestTransactionGroup({
|
|
648
|
+
* // Must decode the signed txn bytes into an object
|
|
649
|
+
* txns: [algosdk.decodeObj(signedTxn1), algosdk.decodeObj(signedTxn2)]
|
|
650
|
+
* }),
|
|
651
|
+
* ],
|
|
652
|
+
* });
|
|
653
|
+
* const resp = await client.simulateRawTransactions(request).do();
|
|
654
|
+
* ```
|
|
655
|
+
*
|
|
656
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactionssimulate)
|
|
657
|
+
* @param request
|
|
658
|
+
* @category POST
|
|
659
|
+
*/
|
|
660
|
+
simulateTransactions(request: modelsv2.SimulateRequest) {
|
|
661
|
+
return new SimulateRawTransactions(this.c, request);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Set the offset (in seconds) applied to the block timestamp when creating new blocks in devmode.
|
|
666
|
+
*
|
|
667
|
+
* #### Example
|
|
668
|
+
* ```typesecript
|
|
669
|
+
* const offset = 60
|
|
670
|
+
* await client.setBlockOffsetTimestamp(offset).do();
|
|
671
|
+
* ```
|
|
672
|
+
*
|
|
673
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2devmodeblocksoffsetoffset)
|
|
674
|
+
* @param offset
|
|
675
|
+
* @category POST
|
|
676
|
+
*/
|
|
677
|
+
setBlockOffsetTimestamp(offset: number) {
|
|
678
|
+
return new SetBlockOffsetTimestamp(this.c, this.intDecoding, offset);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Get the offset (in seconds) applied to the block timestamp when creating new blocks in devmode.
|
|
683
|
+
*
|
|
684
|
+
* #### Example
|
|
685
|
+
* ```typesecript
|
|
686
|
+
* const currentOffset = await client.getBlockOffsetTimestamp().do();
|
|
687
|
+
* ```
|
|
688
|
+
*
|
|
689
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2devmodeblocksoffset)
|
|
690
|
+
* @category GET
|
|
691
|
+
*/
|
|
692
|
+
getBlockOffsetTimestamp() {
|
|
693
|
+
return new GetBlockOffsetTimestamp(this.c, this.intDecoding);
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Set the sync round on the ledger (algod must have EnableFollowMode: true), restricting catchup.
|
|
698
|
+
*
|
|
699
|
+
* #### Example
|
|
700
|
+
* ```typesecript
|
|
701
|
+
* const round = 10000
|
|
702
|
+
* await client.setSyncRound(round).do();
|
|
703
|
+
* ```
|
|
704
|
+
*
|
|
705
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2ledgersyncround)
|
|
706
|
+
* @param round
|
|
707
|
+
* @category POST
|
|
708
|
+
*/
|
|
709
|
+
setSyncRound(round: number) {
|
|
710
|
+
return new SetSyncRound(this.c, this.intDecoding, round);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Un-Set the sync round on the ledger (algod must have EnableFollowMode: true), removing the restriction on catchup.
|
|
715
|
+
*
|
|
716
|
+
* #### Example
|
|
717
|
+
* ```typesecript
|
|
718
|
+
* await client.unsetSyncRound().do();
|
|
719
|
+
* ```
|
|
720
|
+
*
|
|
721
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#delete-v2ledgersync)
|
|
722
|
+
* @category DELETE
|
|
723
|
+
*/
|
|
724
|
+
unsetSyncRound() {
|
|
725
|
+
return new UnsetSyncRound(this.c, this.intDecoding);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Get the current sync round on the ledger (algod must have EnableFollowMode: true).
|
|
730
|
+
*
|
|
731
|
+
* #### Example
|
|
732
|
+
* ```typesecript
|
|
733
|
+
* const currentSyncRound = await client.getSyncRound().do();
|
|
734
|
+
* ```
|
|
735
|
+
*
|
|
736
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2ledgersync)
|
|
737
|
+
* @category GET
|
|
738
|
+
*/
|
|
739
|
+
getSyncRound() {
|
|
740
|
+
return new GetSyncRound(this.c, this.intDecoding);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* Ready check which returns 200 OK if algod is healthy and caught up
|
|
745
|
+
*
|
|
746
|
+
* #### Example
|
|
747
|
+
* ```typesecript
|
|
748
|
+
* await client.ready().do();
|
|
749
|
+
* ```
|
|
750
|
+
*
|
|
751
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-ready)
|
|
752
|
+
* @category GET
|
|
753
|
+
*/
|
|
754
|
+
ready() {
|
|
755
|
+
return new Ready(this.c, this.intDecoding);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* GetLedgerStateDeltaForTransactionGroup returns the ledger delta for the txn group identified by id
|
|
760
|
+
*
|
|
761
|
+
* #### Example
|
|
762
|
+
* ```typescript
|
|
763
|
+
* const id = "ABC123";
|
|
764
|
+
* await client.getLedgerStateDeltaForTransactionGroup(id).do();
|
|
765
|
+
* ```
|
|
766
|
+
*
|
|
767
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2deltastxngroupid)
|
|
768
|
+
* @param id txn ID or group ID to be searched for
|
|
769
|
+
* @category GET
|
|
770
|
+
*/
|
|
771
|
+
getLedgerStateDeltaForTransactionGroup(id: string) {
|
|
772
|
+
return new GetLedgerStateDeltaForTransactionGroup(
|
|
773
|
+
this.c,
|
|
774
|
+
this.intDecoding,
|
|
775
|
+
id
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* GetLedgerStateDelta returns the ledger delta for the entire round
|
|
781
|
+
*
|
|
782
|
+
* #### Example
|
|
783
|
+
* ```typescript
|
|
784
|
+
* const round = 12345;
|
|
785
|
+
* await client.getLedgerStateDelta(round).do();
|
|
786
|
+
* ```
|
|
787
|
+
*
|
|
788
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2deltasround)
|
|
789
|
+
* @param round the round number to be searched for
|
|
790
|
+
* @category GET
|
|
791
|
+
*/
|
|
792
|
+
getLedgerStateDelta(round: bigint) {
|
|
793
|
+
return new GetLedgerStateDelta(this.c, this.intDecoding, round);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* GetTransactionGroupLedgerStateDeltasForRound returns all ledger deltas for txn groups in the provided round
|
|
798
|
+
*
|
|
799
|
+
* #### Example
|
|
800
|
+
* ```typescript
|
|
801
|
+
* const round = 12345;
|
|
802
|
+
* await client.getTransactionGroupLedgerStateDeltasForRound(round).do();
|
|
803
|
+
* ```
|
|
804
|
+
*
|
|
805
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2deltasroundtxngroup)
|
|
806
|
+
* @param round the round number to be searched for
|
|
807
|
+
* @category GET
|
|
808
|
+
*/
|
|
809
|
+
getTransactionGroupLedgerStateDeltasForRound(round: bigint) {
|
|
810
|
+
return new GetTransactionGroupLedgerStateDeltasForRound(
|
|
811
|
+
this.c,
|
|
812
|
+
this.intDecoding,
|
|
813
|
+
round
|
|
814
|
+
);
|
|
594
815
|
}
|
|
595
816
|
}
|
|
@@ -15,7 +15,7 @@ import { Box } from './models/types';
|
|
|
15
15
|
* const boxValue = boxResponse.value;
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
18
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idbox)
|
|
19
19
|
* @param index - The application ID to look up.
|
|
20
20
|
* @category GET
|
|
21
21
|
*/
|
|
@@ -13,7 +13,7 @@ import { BoxesResponse } from './models/types';
|
|
|
13
13
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
16
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
17
17
|
* @param index - The application ID to look up.
|
|
18
18
|
* @category GET
|
|
19
19
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import { GetBlockTimeStampOffsetResponse } from './models/types';
|
|
3
|
+
|
|
4
|
+
export default class GetBlockOffsetTimestamp extends JSONRequest<
|
|
5
|
+
GetBlockTimeStampOffsetResponse,
|
|
6
|
+
Record<string, any>
|
|
7
|
+
> {
|
|
8
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9
|
+
path() {
|
|
10
|
+
return `/v2/devmode/blocks/offset`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line class-methods-use-this
|
|
14
|
+
prepare(body: Record<string, any>): GetBlockTimeStampOffsetResponse {
|
|
15
|
+
return GetBlockTimeStampOffsetResponse.from_obj_for_encoding(body);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import HTTPClient from '../../client';
|
|
3
|
+
import IntDecoding from '../../../types/intDecoding';
|
|
4
|
+
|
|
5
|
+
export default class GetLedgerStateDelta extends JSONRequest {
|
|
6
|
+
constructor(c: HTTPClient, intDecoding: IntDecoding, private round: bigint) {
|
|
7
|
+
super(c, intDecoding);
|
|
8
|
+
this.round = round;
|
|
9
|
+
this.query = { format: 'json' };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line class-methods-use-this
|
|
13
|
+
path() {
|
|
14
|
+
return `/v2/deltas/${this.round}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import HTTPClient from '../../client';
|
|
3
|
+
import IntDecoding from '../../../types/intDecoding';
|
|
4
|
+
|
|
5
|
+
export default class GetLedgerStateDeltaForTransactionGroup extends JSONRequest {
|
|
6
|
+
constructor(c: HTTPClient, intDecoding: IntDecoding, private id: string) {
|
|
7
|
+
super(c, intDecoding);
|
|
8
|
+
this.id = id;
|
|
9
|
+
this.query = { format: 'json' };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line class-methods-use-this
|
|
13
|
+
path() {
|
|
14
|
+
return `/v2/deltas/txn/group/${this.id}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import { GetSyncRoundResponse } from './models/types';
|
|
3
|
+
|
|
4
|
+
export default class GetSyncRound extends JSONRequest<
|
|
5
|
+
GetSyncRoundResponse,
|
|
6
|
+
Record<string, any>
|
|
7
|
+
> {
|
|
8
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9
|
+
path() {
|
|
10
|
+
return `/v2/ledger/sync`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line class-methods-use-this
|
|
14
|
+
prepare(body: Record<string, any>): GetSyncRoundResponse {
|
|
15
|
+
return GetSyncRoundResponse.from_obj_for_encoding(body);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import { TransactionGroupLedgerStateDeltasForRoundResponse } from './models/types';
|
|
3
|
+
import HTTPClient from '../../client';
|
|
4
|
+
import IntDecoding from '../../../types/intDecoding';
|
|
5
|
+
|
|
6
|
+
export default class GetTransactionGroupLedgerStateDeltasForRound extends JSONRequest<
|
|
7
|
+
TransactionGroupLedgerStateDeltasForRoundResponse,
|
|
8
|
+
Record<string, any>
|
|
9
|
+
> {
|
|
10
|
+
constructor(c: HTTPClient, intDecoding: IntDecoding, private round: bigint) {
|
|
11
|
+
super(c, intDecoding);
|
|
12
|
+
this.round = round;
|
|
13
|
+
this.query = { format: 'json' };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line class-methods-use-this
|
|
17
|
+
path() {
|
|
18
|
+
return `/v2/deltas/${this.round}/txn/group`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line class-methods-use-this
|
|
22
|
+
prepare(
|
|
23
|
+
body: Record<string, any>
|
|
24
|
+
): TransactionGroupLedgerStateDeltasForRoundResponse {
|
|
25
|
+
return TransactionGroupLedgerStateDeltasForRoundResponse.from_obj_for_encoding(
|
|
26
|
+
body
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|