algosdk 2.2.0 → 2.3.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 +201 -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/getSyncRound.js +19 -0
- package/dist/cjs/client/v2/algod/getSyncRound.js.map +1 -0
- package/dist/cjs/client/v2/algod/models/types.js +257 -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/composer.js +39 -2
- 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 +178 -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/getSyncRound.js +13 -0
- package/dist/esm/client/v2/algod/getSyncRound.js.map +1 -0
- package/dist/esm/client/v2/algod/models/types.js +250 -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/composer.js +16 -2
- 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 +145 -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/getSyncRound.d.ts +6 -0
- package/dist/types/client/v2/algod/models/types.d.ts +236 -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 -2
- package/src/client/v2/algod/algod.ts +184 -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/getSyncRound.ts +17 -0
- package/src/client/v2/algod/models/types.ts +454 -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/composer.ts +27 -3
- 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,16 @@ 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';
|
|
35
43
|
|
|
36
44
|
/**
|
|
37
45
|
* 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 +94,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
86
94
|
* const health = await algodClient.healthCheck().do();
|
|
87
95
|
* ```
|
|
88
96
|
*
|
|
89
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
97
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-health)
|
|
90
98
|
* @category GET
|
|
91
99
|
*/
|
|
92
100
|
healthCheck() {
|
|
@@ -101,7 +109,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
101
109
|
* const versionsDetails = await algodClient.versionsCheck().do();
|
|
102
110
|
* ```
|
|
103
111
|
*
|
|
104
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
112
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-versions)
|
|
105
113
|
* @category GET
|
|
106
114
|
*/
|
|
107
115
|
versionsCheck() {
|
|
@@ -117,7 +125,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
117
125
|
* const result = await waitForConfirmation(algodClient, txid, 3);
|
|
118
126
|
* ```
|
|
119
127
|
*
|
|
120
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
128
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactions)
|
|
121
129
|
*
|
|
122
130
|
* @remarks
|
|
123
131
|
* Often used with {@linkcode waitForConfirmation}
|
|
@@ -137,7 +145,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
137
145
|
* const accountInfo = await algodClient.accountInformation(address).do();
|
|
138
146
|
* ```
|
|
139
147
|
*
|
|
140
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
148
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
141
149
|
* @param account - The address of the account to look up.
|
|
142
150
|
* @category GET
|
|
143
151
|
*/
|
|
@@ -155,7 +163,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
155
163
|
* const accountAssetInfo = await algodClient.accountAssetInformation(address, index).do();
|
|
156
164
|
* ```
|
|
157
165
|
*
|
|
158
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
166
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
159
167
|
* @param account - The address of the account to look up.
|
|
160
168
|
* @param index - The asset ID to look up.
|
|
161
169
|
* @category GET
|
|
@@ -179,7 +187,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
179
187
|
* const accountInfo = await algodClient.accountApplicationInformation(address, index).do();
|
|
180
188
|
* ```
|
|
181
189
|
*
|
|
182
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
190
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
183
191
|
* @param account - The address of the account to look up.
|
|
184
192
|
* @param index - The application ID to look up.
|
|
185
193
|
* @category GET
|
|
@@ -202,7 +210,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
202
210
|
* const block = await algodClient.block(roundNumber).do();
|
|
203
211
|
* ```
|
|
204
212
|
*
|
|
205
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
213
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksround)
|
|
206
214
|
* @param roundNumber - The round number of the block to get.
|
|
207
215
|
* @category GET
|
|
208
216
|
*/
|
|
@@ -219,7 +227,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
219
227
|
* const block = await algodClient.getBlockHash(roundNumber).do();
|
|
220
228
|
* ```
|
|
221
229
|
*
|
|
222
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
230
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundhash)
|
|
223
231
|
* @param roundNumber - The round number of the block to get.
|
|
224
232
|
* @category GET
|
|
225
233
|
*/
|
|
@@ -236,7 +244,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
236
244
|
* const pending = await algodClient.pendingTransactionInformation(txId).do();
|
|
237
245
|
* ```
|
|
238
246
|
*
|
|
239
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
247
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionspendingtxid)
|
|
240
248
|
*
|
|
241
249
|
* @remarks
|
|
242
250
|
* <br><br>
|
|
@@ -272,7 +280,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
272
280
|
* .do();
|
|
273
281
|
* ```
|
|
274
282
|
*
|
|
275
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
283
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionspending)
|
|
276
284
|
* @category GET
|
|
277
285
|
*/
|
|
278
286
|
pendingTransactionsInformation() {
|
|
@@ -299,7 +307,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
299
307
|
* .do();
|
|
300
308
|
* ```
|
|
301
309
|
*
|
|
302
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
310
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddresstransactionspending)
|
|
303
311
|
* @param address - The address of the sender.
|
|
304
312
|
* @category GET
|
|
305
313
|
*/
|
|
@@ -315,7 +323,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
315
323
|
* const status = await algodClient.status().do();
|
|
316
324
|
* ```
|
|
317
325
|
*
|
|
318
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
326
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2status)
|
|
319
327
|
* @category GET
|
|
320
328
|
*/
|
|
321
329
|
status() {
|
|
@@ -331,7 +339,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
331
339
|
* const statusAfterBlock = await algodClient.statusAfterBlock(round).do();
|
|
332
340
|
* ```
|
|
333
341
|
*
|
|
334
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
342
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2statuswait-for-block-afterround)
|
|
335
343
|
* @param round - The number of the round to wait for.
|
|
336
344
|
* @category GET
|
|
337
345
|
*/
|
|
@@ -354,7 +362,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
354
362
|
* });
|
|
355
363
|
* ```
|
|
356
364
|
*
|
|
357
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
365
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionsparams)
|
|
358
366
|
*
|
|
359
367
|
* @remarks
|
|
360
368
|
* Often used with
|
|
@@ -373,7 +381,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
373
381
|
* const supplyDetails = await algodClient.supply().do();
|
|
374
382
|
* ```
|
|
375
383
|
*
|
|
376
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
384
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2ledgersupply)
|
|
377
385
|
* @category GET
|
|
378
386
|
*/
|
|
379
387
|
supply() {
|
|
@@ -389,7 +397,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
389
397
|
* const compiledSmartContract = await algodClient.compile(source).do();
|
|
390
398
|
* ```
|
|
391
399
|
*
|
|
392
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
400
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealcompile)
|
|
393
401
|
* @remarks
|
|
394
402
|
* This endpoint is only enabled when a node's configuration file sets `EnableDeveloperAPI` to true.
|
|
395
403
|
* @param source
|
|
@@ -425,7 +433,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
425
433
|
* const dryRunResult = await algodClient.dryrun(dr).do();
|
|
426
434
|
* ```
|
|
427
435
|
*
|
|
428
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
436
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealdryrun)
|
|
429
437
|
* @param dr
|
|
430
438
|
* @category POST
|
|
431
439
|
*/
|
|
@@ -443,7 +451,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
443
451
|
* const asset = await algodClient.getAssetByID(asset_id).do();
|
|
444
452
|
* ```
|
|
445
453
|
*
|
|
446
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
454
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2assetsasset-id)
|
|
447
455
|
* @param index - The asset ID to look up.
|
|
448
456
|
* @category GET
|
|
449
457
|
*/
|
|
@@ -461,7 +469,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
461
469
|
* const app = await algodClient.getApplicationByID(index).do();
|
|
462
470
|
* ```
|
|
463
471
|
*
|
|
464
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
472
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-id)
|
|
465
473
|
* @param index - The application ID to look up.
|
|
466
474
|
* @category GET
|
|
467
475
|
*/
|
|
@@ -480,7 +488,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
480
488
|
* const boxValue = boxResponse.value;
|
|
481
489
|
* ```
|
|
482
490
|
*
|
|
483
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
491
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idbox)
|
|
484
492
|
* @param index - The application ID to look up.
|
|
485
493
|
* @category GET
|
|
486
494
|
*/
|
|
@@ -503,7 +511,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
503
511
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
504
512
|
* ```
|
|
505
513
|
*
|
|
506
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
514
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
507
515
|
* @param index - The application ID to look up.
|
|
508
516
|
* @category GET
|
|
509
517
|
*/
|
|
@@ -519,7 +527,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
519
527
|
* const genesis = await algodClient.genesis().do();
|
|
520
528
|
* ```
|
|
521
529
|
*
|
|
522
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
530
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-genesis)
|
|
523
531
|
* @category GET
|
|
524
532
|
*/
|
|
525
533
|
genesis() {
|
|
@@ -536,7 +544,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
536
544
|
* const proof = await algodClient.getTransactionProof(round, txId).do();
|
|
537
545
|
* ```
|
|
538
546
|
*
|
|
539
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
547
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundtransactionstxidproof)
|
|
540
548
|
* @param round - The round in which the transaction appears.
|
|
541
549
|
* @param txID - The transaction ID for which to generate a proof.
|
|
542
550
|
* @category GET
|
|
@@ -582,14 +590,165 @@ export default class AlgodClient extends ServiceClient {
|
|
|
582
590
|
*
|
|
583
591
|
* #### Example
|
|
584
592
|
* ```typescript
|
|
593
|
+
* const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn1Params);
|
|
594
|
+
* const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn2Params);
|
|
595
|
+
* const txgroup = algosdk.assignGroupID([txn1, txn2]);
|
|
596
|
+
*
|
|
597
|
+
* // Actually sign the first transaction
|
|
598
|
+
* const signedTxn1 = txgroup[0].signTxn(senderSk).blob;
|
|
599
|
+
* // Simulate does not require signed transactions -- use this method to encode an unsigned transaction
|
|
600
|
+
* const signedTxn2 = algosdk.encodeUnsignedSimulateTransaction(txgroup[1]);
|
|
601
|
+
*
|
|
585
602
|
* const resp = await client.simulateRawTransactions([signedTxn1, signedTxn2]).do();
|
|
586
603
|
* ```
|
|
587
604
|
*
|
|
588
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
605
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactionssimulate)
|
|
589
606
|
* @param stxOrStxs
|
|
590
607
|
* @category POST
|
|
591
608
|
*/
|
|
592
609
|
simulateRawTransactions(stxOrStxs: Uint8Array | Uint8Array[]) {
|
|
593
|
-
|
|
610
|
+
const txnObjects: EncodedSignedTransaction[] = [];
|
|
611
|
+
if (Array.isArray(stxOrStxs)) {
|
|
612
|
+
for (const stxn of stxOrStxs) {
|
|
613
|
+
txnObjects.push(encoding.decode(stxn) as EncodedSignedTransaction);
|
|
614
|
+
}
|
|
615
|
+
} else {
|
|
616
|
+
txnObjects.push(encoding.decode(stxOrStxs) as EncodedSignedTransaction);
|
|
617
|
+
}
|
|
618
|
+
const request = new modelsv2.SimulateRequest({
|
|
619
|
+
txnGroups: [
|
|
620
|
+
new modelsv2.SimulateRequestTransactionGroup({
|
|
621
|
+
txns: txnObjects,
|
|
622
|
+
}),
|
|
623
|
+
],
|
|
624
|
+
});
|
|
625
|
+
return this.simulateTransactions(request);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Simulate transactions being sent to the network.
|
|
630
|
+
*
|
|
631
|
+
* #### Example
|
|
632
|
+
* ```typescript
|
|
633
|
+
* const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn1Params);
|
|
634
|
+
* const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn2Params);
|
|
635
|
+
* const txgroup = algosdk.assignGroupID([txn1, txn2]);
|
|
636
|
+
*
|
|
637
|
+
* // Actually sign the first transaction
|
|
638
|
+
* const signedTxn1 = txgroup[0].signTxn(senderSk).blob;
|
|
639
|
+
* // Simulate does not require signed transactions -- use this method to encode an unsigned transaction
|
|
640
|
+
* const signedTxn2 = algosdk.encodeUnsignedSimulateTransaction(txgroup[1]);
|
|
641
|
+
*
|
|
642
|
+
* const request = new modelsv2.SimulateRequest({
|
|
643
|
+
* txnGroups: [
|
|
644
|
+
* new modelsv2.SimulateRequestTransactionGroup({
|
|
645
|
+
* // Must decode the signed txn bytes into an object
|
|
646
|
+
* txns: [algosdk.decodeObj(signedTxn1), algosdk.decodeObj(signedTxn2)]
|
|
647
|
+
* }),
|
|
648
|
+
* ],
|
|
649
|
+
* });
|
|
650
|
+
* const resp = await client.simulateRawTransactions(request).do();
|
|
651
|
+
* ```
|
|
652
|
+
*
|
|
653
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactionssimulate)
|
|
654
|
+
* @param request
|
|
655
|
+
* @category POST
|
|
656
|
+
*/
|
|
657
|
+
simulateTransactions(request: modelsv2.SimulateRequest) {
|
|
658
|
+
return new SimulateRawTransactions(this.c, request);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Set the offset (in seconds) applied to the block timestamp when creating new blocks in devmode.
|
|
663
|
+
*
|
|
664
|
+
* #### Example
|
|
665
|
+
* ```typesecript
|
|
666
|
+
* const offset = 60
|
|
667
|
+
* await client.setBlockOffsetTimestamp(offset).do();
|
|
668
|
+
* ```
|
|
669
|
+
*
|
|
670
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2devmodeblocksoffsetoffset)
|
|
671
|
+
* @param offset
|
|
672
|
+
* @category POST
|
|
673
|
+
*/
|
|
674
|
+
setBlockOffsetTimestamp(offset: number) {
|
|
675
|
+
return new SetBlockOffsetTimestamp(this.c, this.intDecoding, offset);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Get the offset (in seconds) applied to the block timestamp when creating new blocks in devmode.
|
|
680
|
+
*
|
|
681
|
+
* #### Example
|
|
682
|
+
* ```typesecript
|
|
683
|
+
* const currentOffset = await client.getBlockOffsetTimestamp().do();
|
|
684
|
+
* ```
|
|
685
|
+
*
|
|
686
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2devmodeblocksoffset)
|
|
687
|
+
* @category GET
|
|
688
|
+
*/
|
|
689
|
+
getBlockOffsetTimestamp() {
|
|
690
|
+
return new GetBlockOffsetTimestamp(this.c, this.intDecoding);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Set the sync round on the ledger (algod must have EnableFollowMode: true), restricting catchup.
|
|
695
|
+
*
|
|
696
|
+
* #### Example
|
|
697
|
+
* ```typesecript
|
|
698
|
+
* const round = 10000
|
|
699
|
+
* await client.setSyncRound(round).do();
|
|
700
|
+
* ```
|
|
701
|
+
*
|
|
702
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2ledgersyncround)
|
|
703
|
+
* @param round
|
|
704
|
+
* @category POST
|
|
705
|
+
*/
|
|
706
|
+
setSyncRound(round: number) {
|
|
707
|
+
return new SetSyncRound(this.c, this.intDecoding, round);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Un-Set the sync round on the ledger (algod must have EnableFollowMode: true), removing the restriction on catchup.
|
|
712
|
+
*
|
|
713
|
+
* #### Example
|
|
714
|
+
* ```typesecript
|
|
715
|
+
* await client.unsetSyncRound().do();
|
|
716
|
+
* ```
|
|
717
|
+
*
|
|
718
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#delete-v2ledgersync)
|
|
719
|
+
* @category DELETE
|
|
720
|
+
*/
|
|
721
|
+
unsetSyncRound() {
|
|
722
|
+
return new UnsetSyncRound(this.c, this.intDecoding);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Get the current sync round on the ledger (algod must have EnableFollowMode: true).
|
|
727
|
+
*
|
|
728
|
+
* #### Example
|
|
729
|
+
* ```typesecript
|
|
730
|
+
* const currentSyncRound = await client.getSyncRound().do();
|
|
731
|
+
* ```
|
|
732
|
+
*
|
|
733
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2ledgersync)
|
|
734
|
+
* @category GET
|
|
735
|
+
*/
|
|
736
|
+
getSyncRound() {
|
|
737
|
+
return new GetSyncRound(this.c, this.intDecoding);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* Ready check which returns 200 OK if algod is healthy and caught up
|
|
742
|
+
*
|
|
743
|
+
* #### Example
|
|
744
|
+
* ```typesecript
|
|
745
|
+
* await client.ready().do();
|
|
746
|
+
* ```
|
|
747
|
+
*
|
|
748
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-ready)
|
|
749
|
+
* @category GET
|
|
750
|
+
*/
|
|
751
|
+
ready() {
|
|
752
|
+
return new Ready(this.c, this.intDecoding);
|
|
594
753
|
}
|
|
595
754
|
}
|
|
@@ -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,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
|
+
}
|