algosdk 2.1.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 +215 -23
- 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 +361 -8
- 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 +73 -0
- package/dist/cjs/client/v2/algod/simulateTransaction.js.map +1 -0
- 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 +106 -18
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/encoding/encoding.js +14 -3
- package/dist/cjs/encoding/encoding.js.map +1 -1
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/signer.js +17 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/transaction.js +16 -1
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +192 -23
- 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 +351 -7
- 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 +42 -0
- package/dist/esm/client/v2/algod/simulateTransaction.js.map +1 -0
- 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 +84 -19
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/encoding/encoding.js +12 -2
- package/dist/esm/encoding/encoding.js.map +1 -1
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/signer.js +15 -0
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/transaction.js +14 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/types/client/v2/algod/algod.d.ts +158 -23
- 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 +324 -14
- 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 +19 -0
- 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 +31 -1
- package/dist/types/encoding/encoding.d.ts +7 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/makeTxn.d.ts +1 -3
- package/dist/types/signer.d.ts +5 -0
- package/dist/types/transaction.d.ts +9 -0
- package/dist/types/types/transactions/base.d.ts +6 -0
- package/dist/types/types/transactions/builder.d.ts +1 -1
- package/dist/types/types/utils.d.ts +1 -1
- package/package.json +2 -2
- package/src/client/v2/algod/algod.ts +199 -23
- 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 +652 -12
- 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 +58 -0
- package/src/client/v2/algod/suggestedParams.ts +4 -3
- package/src/client/v2/algod/unsetSyncRound.ts +13 -0
- package/src/composer.ts +138 -31
- package/src/encoding/encoding.ts +13 -2
- package/src/main.ts +7 -0
- package/src/makeTxn.ts +2 -4
- package/src/signer.ts +18 -1
- package/src/transaction.ts +17 -0
- package/src/types/transactions/base.ts +7 -0
- package/src/types/transactions/builder.ts +4 -4
- package/src/types/utils.ts +1 -1
|
@@ -27,7 +27,14 @@ import { BaseHTTPClient } from '../../baseHTTPClient';
|
|
|
27
27
|
import { AlgodTokenHeader, CustomTokenHeader } from '../../urlTokenBaseHTTPClient';
|
|
28
28
|
import LightBlockHeaderProof from './lightBlockHeaderProof';
|
|
29
29
|
import StateProof from './stateproof';
|
|
30
|
+
import SetSyncRound from './setSyncRound';
|
|
31
|
+
import GetSyncRound from './getSyncRound';
|
|
32
|
+
import SetBlockOffsetTimestamp from './setBlockOffsetTimestamp';
|
|
33
|
+
import GetBlockOffsetTimestamp from './getBlockOffsetTimestamp';
|
|
30
34
|
import Disassemble from './disassemble';
|
|
35
|
+
import SimulateRawTransactions from './simulateTransaction';
|
|
36
|
+
import Ready from './ready';
|
|
37
|
+
import UnsetSyncRound from './unsetSyncRound';
|
|
31
38
|
/**
|
|
32
39
|
* 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.
|
|
33
40
|
*
|
|
@@ -69,7 +76,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
69
76
|
* const health = await algodClient.healthCheck().do();
|
|
70
77
|
* ```
|
|
71
78
|
*
|
|
72
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
79
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-health)
|
|
73
80
|
* @category GET
|
|
74
81
|
*/
|
|
75
82
|
healthCheck(): HealthCheck;
|
|
@@ -81,7 +88,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
81
88
|
* const versionsDetails = await algodClient.versionsCheck().do();
|
|
82
89
|
* ```
|
|
83
90
|
*
|
|
84
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
91
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-versions)
|
|
85
92
|
* @category GET
|
|
86
93
|
*/
|
|
87
94
|
versionsCheck(): Versions;
|
|
@@ -94,7 +101,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
94
101
|
* const result = await waitForConfirmation(algodClient, txid, 3);
|
|
95
102
|
* ```
|
|
96
103
|
*
|
|
97
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
104
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactions)
|
|
98
105
|
*
|
|
99
106
|
* @remarks
|
|
100
107
|
* Often used with {@linkcode waitForConfirmation}
|
|
@@ -111,7 +118,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
111
118
|
* const accountInfo = await algodClient.accountInformation(address).do();
|
|
112
119
|
* ```
|
|
113
120
|
*
|
|
114
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
121
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
115
122
|
* @param account - The address of the account to look up.
|
|
116
123
|
* @category GET
|
|
117
124
|
*/
|
|
@@ -126,7 +133,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
126
133
|
* const accountAssetInfo = await algodClient.accountAssetInformation(address, index).do();
|
|
127
134
|
* ```
|
|
128
135
|
*
|
|
129
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
136
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
130
137
|
* @param account - The address of the account to look up.
|
|
131
138
|
* @param index - The asset ID to look up.
|
|
132
139
|
* @category GET
|
|
@@ -142,7 +149,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
142
149
|
* const accountInfo = await algodClient.accountApplicationInformation(address, index).do();
|
|
143
150
|
* ```
|
|
144
151
|
*
|
|
145
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
152
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
146
153
|
* @param account - The address of the account to look up.
|
|
147
154
|
* @param index - The application ID to look up.
|
|
148
155
|
* @category GET
|
|
@@ -157,7 +164,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
157
164
|
* const block = await algodClient.block(roundNumber).do();
|
|
158
165
|
* ```
|
|
159
166
|
*
|
|
160
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
167
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksround)
|
|
161
168
|
* @param roundNumber - The round number of the block to get.
|
|
162
169
|
* @category GET
|
|
163
170
|
*/
|
|
@@ -171,7 +178,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
171
178
|
* const block = await algodClient.getBlockHash(roundNumber).do();
|
|
172
179
|
* ```
|
|
173
180
|
*
|
|
174
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
181
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundhash)
|
|
175
182
|
* @param roundNumber - The round number of the block to get.
|
|
176
183
|
* @category GET
|
|
177
184
|
*/
|
|
@@ -185,7 +192,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
185
192
|
* const pending = await algodClient.pendingTransactionInformation(txId).do();
|
|
186
193
|
* ```
|
|
187
194
|
*
|
|
188
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
195
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionspendingtxid)
|
|
189
196
|
*
|
|
190
197
|
* @remarks
|
|
191
198
|
* <br><br>
|
|
@@ -218,7 +225,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
218
225
|
* .do();
|
|
219
226
|
* ```
|
|
220
227
|
*
|
|
221
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
228
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionspending)
|
|
222
229
|
* @category GET
|
|
223
230
|
*/
|
|
224
231
|
pendingTransactionsInformation(): PendingTransactions;
|
|
@@ -242,7 +249,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
242
249
|
* .do();
|
|
243
250
|
* ```
|
|
244
251
|
*
|
|
245
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
252
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddresstransactionspending)
|
|
246
253
|
* @param address - The address of the sender.
|
|
247
254
|
* @category GET
|
|
248
255
|
*/
|
|
@@ -255,7 +262,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
255
262
|
* const status = await algodClient.status().do();
|
|
256
263
|
* ```
|
|
257
264
|
*
|
|
258
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
265
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2status)
|
|
259
266
|
* @category GET
|
|
260
267
|
*/
|
|
261
268
|
status(): Status;
|
|
@@ -268,7 +275,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
268
275
|
* const statusAfterBlock = await algodClient.statusAfterBlock(round).do();
|
|
269
276
|
* ```
|
|
270
277
|
*
|
|
271
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
278
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2statuswait-for-block-afterround)
|
|
272
279
|
* @param round - The number of the round to wait for.
|
|
273
280
|
* @category GET
|
|
274
281
|
*/
|
|
@@ -288,7 +295,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
288
295
|
* });
|
|
289
296
|
* ```
|
|
290
297
|
*
|
|
291
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
298
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2transactionsparams)
|
|
292
299
|
*
|
|
293
300
|
* @remarks
|
|
294
301
|
* Often used with
|
|
@@ -304,7 +311,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
304
311
|
* const supplyDetails = await algodClient.supply().do();
|
|
305
312
|
* ```
|
|
306
313
|
*
|
|
307
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
314
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2ledgersupply)
|
|
308
315
|
* @category GET
|
|
309
316
|
*/
|
|
310
317
|
supply(): Supply;
|
|
@@ -317,7 +324,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
317
324
|
* const compiledSmartContract = await algodClient.compile(source).do();
|
|
318
325
|
* ```
|
|
319
326
|
*
|
|
320
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
327
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealcompile)
|
|
321
328
|
* @remarks
|
|
322
329
|
* This endpoint is only enabled when a node's configuration file sets `EnableDeveloperAPI` to true.
|
|
323
330
|
* @param source
|
|
@@ -347,7 +354,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
347
354
|
* const dryRunResult = await algodClient.dryrun(dr).do();
|
|
348
355
|
* ```
|
|
349
356
|
*
|
|
350
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
357
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2tealdryrun)
|
|
351
358
|
* @param dr
|
|
352
359
|
* @category POST
|
|
353
360
|
*/
|
|
@@ -362,7 +369,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
362
369
|
* const asset = await algodClient.getAssetByID(asset_id).do();
|
|
363
370
|
* ```
|
|
364
371
|
*
|
|
365
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
372
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2assetsasset-id)
|
|
366
373
|
* @param index - The asset ID to look up.
|
|
367
374
|
* @category GET
|
|
368
375
|
*/
|
|
@@ -377,7 +384,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
377
384
|
* const app = await algodClient.getApplicationByID(index).do();
|
|
378
385
|
* ```
|
|
379
386
|
*
|
|
380
|
-
* [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-v2applicationsapplication-id)
|
|
381
388
|
* @param index - The application ID to look up.
|
|
382
389
|
* @category GET
|
|
383
390
|
*/
|
|
@@ -393,7 +400,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
393
400
|
* const boxValue = boxResponse.value;
|
|
394
401
|
* ```
|
|
395
402
|
*
|
|
396
|
-
* [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/#get-v2applicationsapplication-idbox)
|
|
397
404
|
* @param index - The application ID to look up.
|
|
398
405
|
* @category GET
|
|
399
406
|
*/
|
|
@@ -408,7 +415,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
408
415
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
409
416
|
* ```
|
|
410
417
|
*
|
|
411
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
418
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
412
419
|
* @param index - The application ID to look up.
|
|
413
420
|
* @category GET
|
|
414
421
|
*/
|
|
@@ -421,7 +428,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
421
428
|
* const genesis = await algodClient.genesis().do();
|
|
422
429
|
* ```
|
|
423
430
|
*
|
|
424
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
431
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-genesis)
|
|
425
432
|
* @category GET
|
|
426
433
|
*/
|
|
427
434
|
genesis(): Genesis;
|
|
@@ -435,7 +442,7 @@ export default class AlgodClient extends ServiceClient {
|
|
|
435
442
|
* const proof = await algodClient.getTransactionProof(round, txId).do();
|
|
436
443
|
* ```
|
|
437
444
|
*
|
|
438
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
445
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2blocksroundtransactionstxidproof)
|
|
439
446
|
* @param round - The round in which the transaction appears.
|
|
440
447
|
* @param txID - The transaction ID for which to generate a proof.
|
|
441
448
|
* @category GET
|
|
@@ -467,4 +474,132 @@ export default class AlgodClient extends ServiceClient {
|
|
|
467
474
|
* @param round
|
|
468
475
|
*/
|
|
469
476
|
getStateProof(round: number): StateProof;
|
|
477
|
+
/**
|
|
478
|
+
* Simulate a list of a signed transaction objects being sent to the network.
|
|
479
|
+
*
|
|
480
|
+
* #### Example
|
|
481
|
+
* ```typescript
|
|
482
|
+
* const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn1Params);
|
|
483
|
+
* const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn2Params);
|
|
484
|
+
* const txgroup = algosdk.assignGroupID([txn1, txn2]);
|
|
485
|
+
*
|
|
486
|
+
* // Actually sign the first transaction
|
|
487
|
+
* const signedTxn1 = txgroup[0].signTxn(senderSk).blob;
|
|
488
|
+
* // Simulate does not require signed transactions -- use this method to encode an unsigned transaction
|
|
489
|
+
* const signedTxn2 = algosdk.encodeUnsignedSimulateTransaction(txgroup[1]);
|
|
490
|
+
*
|
|
491
|
+
* const resp = await client.simulateRawTransactions([signedTxn1, signedTxn2]).do();
|
|
492
|
+
* ```
|
|
493
|
+
*
|
|
494
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactionssimulate)
|
|
495
|
+
* @param stxOrStxs
|
|
496
|
+
* @category POST
|
|
497
|
+
*/
|
|
498
|
+
simulateRawTransactions(stxOrStxs: Uint8Array | Uint8Array[]): SimulateRawTransactions;
|
|
499
|
+
/**
|
|
500
|
+
* Simulate transactions being sent to the network.
|
|
501
|
+
*
|
|
502
|
+
* #### Example
|
|
503
|
+
* ```typescript
|
|
504
|
+
* const txn1 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn1Params);
|
|
505
|
+
* const txn2 = algosdk.makePaymentTxnWithSuggestedParamsFromObject(txn2Params);
|
|
506
|
+
* const txgroup = algosdk.assignGroupID([txn1, txn2]);
|
|
507
|
+
*
|
|
508
|
+
* // Actually sign the first transaction
|
|
509
|
+
* const signedTxn1 = txgroup[0].signTxn(senderSk).blob;
|
|
510
|
+
* // Simulate does not require signed transactions -- use this method to encode an unsigned transaction
|
|
511
|
+
* const signedTxn2 = algosdk.encodeUnsignedSimulateTransaction(txgroup[1]);
|
|
512
|
+
*
|
|
513
|
+
* const request = new modelsv2.SimulateRequest({
|
|
514
|
+
* txnGroups: [
|
|
515
|
+
* new modelsv2.SimulateRequestTransactionGroup({
|
|
516
|
+
* // Must decode the signed txn bytes into an object
|
|
517
|
+
* txns: [algosdk.decodeObj(signedTxn1), algosdk.decodeObj(signedTxn2)]
|
|
518
|
+
* }),
|
|
519
|
+
* ],
|
|
520
|
+
* });
|
|
521
|
+
* const resp = await client.simulateRawTransactions(request).do();
|
|
522
|
+
* ```
|
|
523
|
+
*
|
|
524
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2transactionssimulate)
|
|
525
|
+
* @param request
|
|
526
|
+
* @category POST
|
|
527
|
+
*/
|
|
528
|
+
simulateTransactions(request: modelsv2.SimulateRequest): SimulateRawTransactions;
|
|
529
|
+
/**
|
|
530
|
+
* Set the offset (in seconds) applied to the block timestamp when creating new blocks in devmode.
|
|
531
|
+
*
|
|
532
|
+
* #### Example
|
|
533
|
+
* ```typesecript
|
|
534
|
+
* const offset = 60
|
|
535
|
+
* await client.setBlockOffsetTimestamp(offset).do();
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2devmodeblocksoffsetoffset)
|
|
539
|
+
* @param offset
|
|
540
|
+
* @category POST
|
|
541
|
+
*/
|
|
542
|
+
setBlockOffsetTimestamp(offset: number): SetBlockOffsetTimestamp;
|
|
543
|
+
/**
|
|
544
|
+
* Get the offset (in seconds) applied to the block timestamp when creating new blocks in devmode.
|
|
545
|
+
*
|
|
546
|
+
* #### Example
|
|
547
|
+
* ```typesecript
|
|
548
|
+
* const currentOffset = await client.getBlockOffsetTimestamp().do();
|
|
549
|
+
* ```
|
|
550
|
+
*
|
|
551
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2devmodeblocksoffset)
|
|
552
|
+
* @category GET
|
|
553
|
+
*/
|
|
554
|
+
getBlockOffsetTimestamp(): GetBlockOffsetTimestamp;
|
|
555
|
+
/**
|
|
556
|
+
* Set the sync round on the ledger (algod must have EnableFollowMode: true), restricting catchup.
|
|
557
|
+
*
|
|
558
|
+
* #### Example
|
|
559
|
+
* ```typesecript
|
|
560
|
+
* const round = 10000
|
|
561
|
+
* await client.setSyncRound(round).do();
|
|
562
|
+
* ```
|
|
563
|
+
*
|
|
564
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#post-v2ledgersyncround)
|
|
565
|
+
* @param round
|
|
566
|
+
* @category POST
|
|
567
|
+
*/
|
|
568
|
+
setSyncRound(round: number): SetSyncRound;
|
|
569
|
+
/**
|
|
570
|
+
* Un-Set the sync round on the ledger (algod must have EnableFollowMode: true), removing the restriction on catchup.
|
|
571
|
+
*
|
|
572
|
+
* #### Example
|
|
573
|
+
* ```typesecript
|
|
574
|
+
* await client.unsetSyncRound().do();
|
|
575
|
+
* ```
|
|
576
|
+
*
|
|
577
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#delete-v2ledgersync)
|
|
578
|
+
* @category DELETE
|
|
579
|
+
*/
|
|
580
|
+
unsetSyncRound(): UnsetSyncRound;
|
|
581
|
+
/**
|
|
582
|
+
* Get the current sync round on the ledger (algod must have EnableFollowMode: true).
|
|
583
|
+
*
|
|
584
|
+
* #### Example
|
|
585
|
+
* ```typesecript
|
|
586
|
+
* const currentSyncRound = await client.getSyncRound().do();
|
|
587
|
+
* ```
|
|
588
|
+
*
|
|
589
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2ledgersync)
|
|
590
|
+
* @category GET
|
|
591
|
+
*/
|
|
592
|
+
getSyncRound(): GetSyncRound;
|
|
593
|
+
/**
|
|
594
|
+
* Ready check which returns 200 OK if algod is healthy and caught up
|
|
595
|
+
*
|
|
596
|
+
* #### Example
|
|
597
|
+
* ```typesecript
|
|
598
|
+
* await client.ready().do();
|
|
599
|
+
* ```
|
|
600
|
+
*
|
|
601
|
+
[Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-ready)
|
|
602
|
+
* @category GET
|
|
603
|
+
*/
|
|
604
|
+
ready(): Ready;
|
|
470
605
|
}
|
|
@@ -13,7 +13,7 @@ import { Box } from './models/types';
|
|
|
13
13
|
* const boxValue = boxResponse.value;
|
|
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-idbox)
|
|
17
17
|
* @param index - The application ID to look up.
|
|
18
18
|
* @category GET
|
|
19
19
|
*/
|
|
@@ -12,7 +12,7 @@ import { BoxesResponse } from './models/types';
|
|
|
12
12
|
* const boxNames = boxesResponse.boxes.map(box => box.name);
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
-
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod
|
|
15
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2applicationsapplication-idboxes)
|
|
16
16
|
* @param index - The application ID to look up.
|
|
17
17
|
* @category GET
|
|
18
18
|
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import { GetBlockTimeStampOffsetResponse } from './models/types';
|
|
3
|
+
export default class GetBlockOffsetTimestamp extends JSONRequest<GetBlockTimeStampOffsetResponse, Record<string, any>> {
|
|
4
|
+
path(): string;
|
|
5
|
+
prepare(body: Record<string, any>): GetBlockTimeStampOffsetResponse;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import { GetSyncRoundResponse } from './models/types';
|
|
3
|
+
export default class GetSyncRound extends JSONRequest<GetSyncRoundResponse, Record<string, any>> {
|
|
4
|
+
path(): string;
|
|
5
|
+
prepare(body: Record<string, any>): GetSyncRoundResponse;
|
|
6
|
+
}
|