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.
Files changed (110) hide show
  1. package/README.md +5 -7
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/client/v2/algod/algod.js +215 -23
  5. package/dist/cjs/client/v2/algod/algod.js.map +1 -1
  6. package/dist/cjs/client/v2/algod/getApplicationBoxByName.js +1 -1
  7. package/dist/cjs/client/v2/algod/getApplicationBoxes.js +1 -1
  8. package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js +19 -0
  9. package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -0
  10. package/dist/cjs/client/v2/algod/getSyncRound.js +19 -0
  11. package/dist/cjs/client/v2/algod/getSyncRound.js.map +1 -0
  12. package/dist/cjs/client/v2/algod/models/types.js +361 -8
  13. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  14. package/dist/cjs/client/v2/algod/ready.js +14 -0
  15. package/dist/cjs/client/v2/algod/ready.js.map +1 -0
  16. package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js +22 -0
  17. package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -0
  18. package/dist/cjs/client/v2/algod/setSyncRound.js +22 -0
  19. package/dist/cjs/client/v2/algod/setSyncRound.js.map +1 -0
  20. package/dist/cjs/client/v2/algod/simulateTransaction.js +73 -0
  21. package/dist/cjs/client/v2/algod/simulateTransaction.js.map +1 -0
  22. package/dist/cjs/client/v2/algod/suggestedParams.js +1 -0
  23. package/dist/cjs/client/v2/algod/suggestedParams.js.map +1 -1
  24. package/dist/cjs/client/v2/algod/unsetSyncRound.js +18 -0
  25. package/dist/cjs/client/v2/algod/unsetSyncRound.js.map +1 -0
  26. package/dist/cjs/composer.js +106 -18
  27. package/dist/cjs/composer.js.map +1 -1
  28. package/dist/cjs/encoding/encoding.js +14 -3
  29. package/dist/cjs/encoding/encoding.js.map +1 -1
  30. package/dist/cjs/main.js.map +1 -1
  31. package/dist/cjs/makeTxn.js.map +1 -1
  32. package/dist/cjs/signer.js +17 -1
  33. package/dist/cjs/signer.js.map +1 -1
  34. package/dist/cjs/transaction.js +16 -1
  35. package/dist/cjs/transaction.js.map +1 -1
  36. package/dist/esm/client/v2/algod/algod.js +192 -23
  37. package/dist/esm/client/v2/algod/algod.js.map +1 -1
  38. package/dist/esm/client/v2/algod/getApplicationBoxByName.js +1 -1
  39. package/dist/esm/client/v2/algod/getApplicationBoxes.js +1 -1
  40. package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js +13 -0
  41. package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -0
  42. package/dist/esm/client/v2/algod/getSyncRound.js +13 -0
  43. package/dist/esm/client/v2/algod/getSyncRound.js.map +1 -0
  44. package/dist/esm/client/v2/algod/models/types.js +351 -7
  45. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  46. package/dist/esm/client/v2/algod/ready.js +8 -0
  47. package/dist/esm/client/v2/algod/ready.js.map +1 -0
  48. package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js +16 -0
  49. package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -0
  50. package/dist/esm/client/v2/algod/setSyncRound.js +16 -0
  51. package/dist/esm/client/v2/algod/setSyncRound.js.map +1 -0
  52. package/dist/esm/client/v2/algod/simulateTransaction.js +42 -0
  53. package/dist/esm/client/v2/algod/simulateTransaction.js.map +1 -0
  54. package/dist/esm/client/v2/algod/suggestedParams.js +1 -0
  55. package/dist/esm/client/v2/algod/suggestedParams.js.map +1 -1
  56. package/dist/esm/client/v2/algod/unsetSyncRound.js +12 -0
  57. package/dist/esm/client/v2/algod/unsetSyncRound.js.map +1 -0
  58. package/dist/esm/composer.js +84 -19
  59. package/dist/esm/composer.js.map +1 -1
  60. package/dist/esm/encoding/encoding.js +12 -2
  61. package/dist/esm/encoding/encoding.js.map +1 -1
  62. package/dist/esm/main.js.map +1 -1
  63. package/dist/esm/makeTxn.js.map +1 -1
  64. package/dist/esm/signer.js +15 -0
  65. package/dist/esm/signer.js.map +1 -1
  66. package/dist/esm/transaction.js +14 -0
  67. package/dist/esm/transaction.js.map +1 -1
  68. package/dist/types/client/v2/algod/algod.d.ts +158 -23
  69. package/dist/types/client/v2/algod/getApplicationBoxByName.d.ts +1 -1
  70. package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +1 -1
  71. package/dist/types/client/v2/algod/getBlockOffsetTimestamp.d.ts +6 -0
  72. package/dist/types/client/v2/algod/getSyncRound.d.ts +6 -0
  73. package/dist/types/client/v2/algod/models/types.d.ts +324 -14
  74. package/dist/types/client/v2/algod/ready.d.ts +4 -0
  75. package/dist/types/client/v2/algod/setBlockOffsetTimestamp.d.ts +9 -0
  76. package/dist/types/client/v2/algod/setSyncRound.d.ts +9 -0
  77. package/dist/types/client/v2/algod/simulateTransaction.d.ts +19 -0
  78. package/dist/types/client/v2/algod/suggestedParams.d.ts +3 -3
  79. package/dist/types/client/v2/algod/unsetSyncRound.d.ts +5 -0
  80. package/dist/types/composer.d.ts +31 -1
  81. package/dist/types/encoding/encoding.d.ts +7 -0
  82. package/dist/types/main.d.ts +1 -0
  83. package/dist/types/makeTxn.d.ts +1 -3
  84. package/dist/types/signer.d.ts +5 -0
  85. package/dist/types/transaction.d.ts +9 -0
  86. package/dist/types/types/transactions/base.d.ts +6 -0
  87. package/dist/types/types/transactions/builder.d.ts +1 -1
  88. package/dist/types/types/utils.d.ts +1 -1
  89. package/package.json +2 -2
  90. package/src/client/v2/algod/algod.ts +199 -23
  91. package/src/client/v2/algod/getApplicationBoxByName.ts +1 -1
  92. package/src/client/v2/algod/getApplicationBoxes.ts +1 -1
  93. package/src/client/v2/algod/getBlockOffsetTimestamp.ts +17 -0
  94. package/src/client/v2/algod/getSyncRound.ts +17 -0
  95. package/src/client/v2/algod/models/types.ts +652 -12
  96. package/src/client/v2/algod/ready.ts +8 -0
  97. package/src/client/v2/algod/setBlockOffsetTimestamp.ts +20 -0
  98. package/src/client/v2/algod/setSyncRound.ts +20 -0
  99. package/src/client/v2/algod/simulateTransaction.ts +58 -0
  100. package/src/client/v2/algod/suggestedParams.ts +4 -3
  101. package/src/client/v2/algod/unsetSyncRound.ts +13 -0
  102. package/src/composer.ts +138 -31
  103. package/src/encoding/encoding.ts +13 -2
  104. package/src/main.ts +7 -0
  105. package/src/makeTxn.ts +2 -4
  106. package/src/signer.ts +18 -1
  107. package/src/transaction.ts +17 -0
  108. package/src/types/transactions/base.ts +7 -0
  109. package/src/types/transactions/builder.ts +4 -4
  110. package/src/types/utils.ts +1 -1
@@ -426,15 +426,15 @@ export declare class ApplicationParams extends BaseModel {
426
426
  */
427
427
  extraProgramPages?: number | bigint;
428
428
  /**
429
- * [\gs) global schema
429
+ * (gs) global state
430
430
  */
431
431
  globalState?: TealKeyValue[];
432
432
  /**
433
- * [\gsch) global schema
433
+ * (gsch) global schema
434
434
  */
435
435
  globalStateSchema?: ApplicationStateSchema;
436
436
  /**
437
- * [\lsch) local schema
437
+ * (lsch) local schema
438
438
  */
439
439
  localStateSchema?: ApplicationStateSchema;
440
440
  /**
@@ -444,9 +444,9 @@ export declare class ApplicationParams extends BaseModel {
444
444
  * @param creator - The address that created this application. This is the address where the
445
445
  * parameters and global state for this application can be found.
446
446
  * @param extraProgramPages - (epp) the amount of extra program pages available to this app.
447
- * @param globalState - [\gs) global schema
448
- * @param globalStateSchema - [\gsch) global schema
449
- * @param localStateSchema - [\lsch) local schema
447
+ * @param globalState - (gs) global state
448
+ * @param globalStateSchema - (gsch) global schema
449
+ * @param localStateSchema - (lsch) local schema
450
450
  */
451
451
  constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }: {
452
452
  approvalProgram: string | Uint8Array;
@@ -1099,6 +1099,64 @@ export declare class EvalDeltaKeyValue extends BaseModel {
1099
1099
  });
1100
1100
  static from_obj_for_encoding(data: Record<string, any>): EvalDeltaKeyValue;
1101
1101
  }
1102
+ /**
1103
+ * Response containing the timestamp offset in seconds
1104
+ */
1105
+ export declare class GetBlockTimeStampOffsetResponse extends BaseModel {
1106
+ /**
1107
+ * Timestamp offset in seconds.
1108
+ */
1109
+ offset: number | bigint;
1110
+ /**
1111
+ * Creates a new `GetBlockTimeStampOffsetResponse` object.
1112
+ * @param offset - Timestamp offset in seconds.
1113
+ */
1114
+ constructor({ offset }: {
1115
+ offset: number | bigint;
1116
+ });
1117
+ static from_obj_for_encoding(data: Record<string, any>): GetBlockTimeStampOffsetResponse;
1118
+ }
1119
+ /**
1120
+ * Response containing the ledger's minimum sync round
1121
+ */
1122
+ export declare class GetSyncRoundResponse extends BaseModel {
1123
+ /**
1124
+ * The minimum sync round for the ledger.
1125
+ */
1126
+ round: number | bigint;
1127
+ /**
1128
+ * Creates a new `GetSyncRoundResponse` object.
1129
+ * @param round - The minimum sync round for the ledger.
1130
+ */
1131
+ constructor({ round }: {
1132
+ round: number | bigint;
1133
+ });
1134
+ static from_obj_for_encoding(data: Record<string, any>): GetSyncRoundResponse;
1135
+ }
1136
+ /**
1137
+ * A single Delta containing the key, the previous value and the current value for
1138
+ * a single round.
1139
+ */
1140
+ export declare class KvDelta extends BaseModel {
1141
+ /**
1142
+ * The key, base64 encoded.
1143
+ */
1144
+ key?: Uint8Array;
1145
+ /**
1146
+ * The new value of the KV store entry, base64 encoded.
1147
+ */
1148
+ value?: Uint8Array;
1149
+ /**
1150
+ * Creates a new `KvDelta` object.
1151
+ * @param key - The key, base64 encoded.
1152
+ * @param value - The new value of the KV store entry, base64 encoded.
1153
+ */
1154
+ constructor({ key, value, }: {
1155
+ key?: string | Uint8Array;
1156
+ value?: string | Uint8Array;
1157
+ });
1158
+ static from_obj_for_encoding(data: Record<string, any>): KvDelta;
1159
+ }
1102
1160
  /**
1103
1161
  * Proof of membership and position of a light block header.
1104
1162
  */
@@ -1214,6 +1272,38 @@ export declare class NodeStatusResponse extends BaseModel {
1214
1272
  * The last catchpoint seen by the node
1215
1273
  */
1216
1274
  lastCatchpoint?: string;
1275
+ /**
1276
+ * Upgrade delay
1277
+ */
1278
+ upgradeDelay?: number | bigint;
1279
+ /**
1280
+ * Next protocol round
1281
+ */
1282
+ upgradeNextProtocolVoteBefore?: number | bigint;
1283
+ /**
1284
+ * No votes cast for consensus upgrade
1285
+ */
1286
+ upgradeNoVotes?: number | bigint;
1287
+ /**
1288
+ * This node's upgrade vote
1289
+ */
1290
+ upgradeNodeVote?: boolean;
1291
+ /**
1292
+ * Total voting rounds for current upgrade
1293
+ */
1294
+ upgradeVoteRounds?: number | bigint;
1295
+ /**
1296
+ * Total votes cast for consensus upgrade
1297
+ */
1298
+ upgradeVotes?: number | bigint;
1299
+ /**
1300
+ * Yes votes required for consensus upgrade
1301
+ */
1302
+ upgradeVotesRequired?: number | bigint;
1303
+ /**
1304
+ * Yes votes cast for consensus upgrade
1305
+ */
1306
+ upgradeYesVotes?: number | bigint;
1217
1307
  /**
1218
1308
  * Creates a new `NodeStatusResponse` object.
1219
1309
  * @param catchupTime - CatchupTime in nanoseconds
@@ -1242,8 +1332,16 @@ export declare class NodeStatusResponse extends BaseModel {
1242
1332
  * @param catchpointVerifiedKvs - The number of key-values (KVs) from the current catchpoint that have been
1243
1333
  * verified so far as part of the catchup
1244
1334
  * @param lastCatchpoint - The last catchpoint seen by the node
1245
- */
1246
- constructor({ catchupTime, lastRound, lastVersion, nextVersion, nextVersionRound, nextVersionSupported, stoppedAtUnsupportedRound, timeSinceLastRound, catchpoint, catchpointAcquiredBlocks, catchpointProcessedAccounts, catchpointProcessedKvs, catchpointTotalAccounts, catchpointTotalBlocks, catchpointTotalKvs, catchpointVerifiedAccounts, catchpointVerifiedKvs, lastCatchpoint, }: {
1335
+ * @param upgradeDelay - Upgrade delay
1336
+ * @param upgradeNextProtocolVoteBefore - Next protocol round
1337
+ * @param upgradeNoVotes - No votes cast for consensus upgrade
1338
+ * @param upgradeNodeVote - This node's upgrade vote
1339
+ * @param upgradeVoteRounds - Total voting rounds for current upgrade
1340
+ * @param upgradeVotes - Total votes cast for consensus upgrade
1341
+ * @param upgradeVotesRequired - Yes votes required for consensus upgrade
1342
+ * @param upgradeYesVotes - Yes votes cast for consensus upgrade
1343
+ */
1344
+ constructor({ catchupTime, lastRound, lastVersion, nextVersion, nextVersionRound, nextVersionSupported, stoppedAtUnsupportedRound, timeSinceLastRound, catchpoint, catchpointAcquiredBlocks, catchpointProcessedAccounts, catchpointProcessedKvs, catchpointTotalAccounts, catchpointTotalBlocks, catchpointTotalKvs, catchpointVerifiedAccounts, catchpointVerifiedKvs, lastCatchpoint, upgradeDelay, upgradeNextProtocolVoteBefore, upgradeNoVotes, upgradeNodeVote, upgradeVoteRounds, upgradeVotes, upgradeVotesRequired, upgradeYesVotes, }: {
1247
1345
  catchupTime: number | bigint;
1248
1346
  lastRound: number | bigint;
1249
1347
  lastVersion: string;
@@ -1262,6 +1360,14 @@ export declare class NodeStatusResponse extends BaseModel {
1262
1360
  catchpointVerifiedAccounts?: number | bigint;
1263
1361
  catchpointVerifiedKvs?: number | bigint;
1264
1362
  lastCatchpoint?: string;
1363
+ upgradeDelay?: number | bigint;
1364
+ upgradeNextProtocolVoteBefore?: number | bigint;
1365
+ upgradeNoVotes?: number | bigint;
1366
+ upgradeNodeVote?: boolean;
1367
+ upgradeVoteRounds?: number | bigint;
1368
+ upgradeVotes?: number | bigint;
1369
+ upgradeVotesRequired?: number | bigint;
1370
+ upgradeYesVotes?: number | bigint;
1265
1371
  });
1266
1372
  static from_obj_for_encoding(data: Record<string, any>): NodeStatusResponse;
1267
1373
  }
@@ -1306,7 +1412,7 @@ export declare class PendingTransactionResponse extends BaseModel {
1306
1412
  */
1307
1413
  confirmedRound?: number | bigint;
1308
1414
  /**
1309
- * (gd) Global state key/value changes for the application being executed by this
1415
+ * Global state key/value changes for the application being executed by this
1310
1416
  * transaction.
1311
1417
  */
1312
1418
  globalStateDelta?: EvalDeltaKeyValue[];
@@ -1315,12 +1421,12 @@ export declare class PendingTransactionResponse extends BaseModel {
1315
1421
  */
1316
1422
  innerTxns?: PendingTransactionResponse[];
1317
1423
  /**
1318
- * (ld) Local state key/value changes for the application being executed by this
1424
+ * Local state key/value changes for the application being executed by this
1319
1425
  * transaction.
1320
1426
  */
1321
1427
  localStateDelta?: AccountStateDelta[];
1322
1428
  /**
1323
- * (lg) Logs for the application being executed by this transaction.
1429
+ * Logs for the application being executed by this transaction.
1324
1430
  */
1325
1431
  logs?: Uint8Array[];
1326
1432
  /**
@@ -1344,12 +1450,12 @@ export declare class PendingTransactionResponse extends BaseModel {
1344
1450
  * @param closeRewards - Rewards in microalgos applied to the close remainder to account.
1345
1451
  * @param closingAmount - Closing amount for the transaction.
1346
1452
  * @param confirmedRound - The round where this transaction was confirmed, if present.
1347
- * @param globalStateDelta - (gd) Global state key/value changes for the application being executed by this
1453
+ * @param globalStateDelta - Global state key/value changes for the application being executed by this
1348
1454
  * transaction.
1349
1455
  * @param innerTxns - Inner transactions produced by application execution.
1350
- * @param localStateDelta - (ld) Local state key/value changes for the application being executed by this
1456
+ * @param localStateDelta - Local state key/value changes for the application being executed by this
1351
1457
  * transaction.
1352
- * @param logs - (lg) Logs for the application being executed by this transaction.
1458
+ * @param logs - Logs for the application being executed by this transaction.
1353
1459
  * @param receiverRewards - Rewards in microalgos applied to the receiver account.
1354
1460
  * @param senderRewards - Rewards in microalgos applied to the sender account.
1355
1461
  */
@@ -1413,6 +1519,210 @@ export declare class PostTransactionsResponse extends BaseModel {
1413
1519
  });
1414
1520
  static from_obj_for_encoding(data: Record<string, any>): PostTransactionsResponse;
1415
1521
  }
1522
+ /**
1523
+ * Request type for simulation endpoint.
1524
+ */
1525
+ export declare class SimulateRequest extends BaseModel {
1526
+ /**
1527
+ * The transaction groups to simulate.
1528
+ */
1529
+ txnGroups: SimulateRequestTransactionGroup[];
1530
+ /**
1531
+ * Allow transactions without signatures to be simulated as if they had correct
1532
+ * signatures.
1533
+ */
1534
+ allowEmptySignatures?: boolean;
1535
+ /**
1536
+ * Lifts limits on log opcode usage during simulation.
1537
+ */
1538
+ allowMoreLogging?: boolean;
1539
+ /**
1540
+ * Creates a new `SimulateRequest` object.
1541
+ * @param txnGroups - The transaction groups to simulate.
1542
+ * @param allowEmptySignatures - Allow transactions without signatures to be simulated as if they had correct
1543
+ * signatures.
1544
+ * @param allowMoreLogging - Lifts limits on log opcode usage during simulation.
1545
+ */
1546
+ constructor({ txnGroups, allowEmptySignatures, allowMoreLogging, }: {
1547
+ txnGroups: SimulateRequestTransactionGroup[];
1548
+ allowEmptySignatures?: boolean;
1549
+ allowMoreLogging?: boolean;
1550
+ });
1551
+ static from_obj_for_encoding(data: Record<string, any>): SimulateRequest;
1552
+ }
1553
+ /**
1554
+ * A transaction group to simulate.
1555
+ */
1556
+ export declare class SimulateRequestTransactionGroup extends BaseModel {
1557
+ /**
1558
+ * An atomic transaction group.
1559
+ */
1560
+ txns: EncodedSignedTransaction[];
1561
+ /**
1562
+ * Creates a new `SimulateRequestTransactionGroup` object.
1563
+ * @param txns - An atomic transaction group.
1564
+ */
1565
+ constructor({ txns }: {
1566
+ txns: EncodedSignedTransaction[];
1567
+ });
1568
+ static from_obj_for_encoding(data: Record<string, any>): SimulateRequestTransactionGroup;
1569
+ }
1570
+ /**
1571
+ * Result of a transaction group simulation.
1572
+ */
1573
+ export declare class SimulateResponse extends BaseModel {
1574
+ /**
1575
+ * The round immediately preceding this simulation. State changes through this
1576
+ * round were used to run this simulation.
1577
+ */
1578
+ lastRound: number | bigint;
1579
+ /**
1580
+ * A result object for each transaction group that was simulated.
1581
+ */
1582
+ txnGroups: SimulateTransactionGroupResult[];
1583
+ /**
1584
+ * The version of this response object.
1585
+ */
1586
+ version: number | bigint;
1587
+ /**
1588
+ * The set of parameters and limits override during simulation. If this set of
1589
+ * parameters is present, then evaluation parameters may differ from standard
1590
+ * evaluation in certain ways.
1591
+ */
1592
+ evalOverrides?: SimulationEvalOverrides;
1593
+ /**
1594
+ * Creates a new `SimulateResponse` object.
1595
+ * @param lastRound - The round immediately preceding this simulation. State changes through this
1596
+ * round were used to run this simulation.
1597
+ * @param txnGroups - A result object for each transaction group that was simulated.
1598
+ * @param version - The version of this response object.
1599
+ * @param evalOverrides - The set of parameters and limits override during simulation. If this set of
1600
+ * parameters is present, then evaluation parameters may differ from standard
1601
+ * evaluation in certain ways.
1602
+ */
1603
+ constructor({ lastRound, txnGroups, version, evalOverrides, }: {
1604
+ lastRound: number | bigint;
1605
+ txnGroups: SimulateTransactionGroupResult[];
1606
+ version: number | bigint;
1607
+ evalOverrides?: SimulationEvalOverrides;
1608
+ });
1609
+ static from_obj_for_encoding(data: Record<string, any>): SimulateResponse;
1610
+ }
1611
+ /**
1612
+ * Simulation result for an atomic transaction group
1613
+ */
1614
+ export declare class SimulateTransactionGroupResult extends BaseModel {
1615
+ /**
1616
+ * Simulation result for individual transactions
1617
+ */
1618
+ txnResults: SimulateTransactionResult[];
1619
+ /**
1620
+ * Total budget added during execution of app calls in the transaction group.
1621
+ */
1622
+ appBudgetAdded?: number | bigint;
1623
+ /**
1624
+ * Total budget consumed during execution of app calls in the transaction group.
1625
+ */
1626
+ appBudgetConsumed?: number | bigint;
1627
+ /**
1628
+ * If present, indicates which transaction in this group caused the failure. This
1629
+ * array represents the path to the failing transaction. Indexes are zero based,
1630
+ * the first element indicates the top-level transaction, and successive elements
1631
+ * indicate deeper inner transactions.
1632
+ */
1633
+ failedAt?: (number | bigint)[];
1634
+ /**
1635
+ * If present, indicates that the transaction group failed and specifies why that
1636
+ * happened
1637
+ */
1638
+ failureMessage?: string;
1639
+ /**
1640
+ * Creates a new `SimulateTransactionGroupResult` object.
1641
+ * @param txnResults - Simulation result for individual transactions
1642
+ * @param appBudgetAdded - Total budget added during execution of app calls in the transaction group.
1643
+ * @param appBudgetConsumed - Total budget consumed during execution of app calls in the transaction group.
1644
+ * @param failedAt - If present, indicates which transaction in this group caused the failure. This
1645
+ * array represents the path to the failing transaction. Indexes are zero based,
1646
+ * the first element indicates the top-level transaction, and successive elements
1647
+ * indicate deeper inner transactions.
1648
+ * @param failureMessage - If present, indicates that the transaction group failed and specifies why that
1649
+ * happened
1650
+ */
1651
+ constructor({ txnResults, appBudgetAdded, appBudgetConsumed, failedAt, failureMessage, }: {
1652
+ txnResults: SimulateTransactionResult[];
1653
+ appBudgetAdded?: number | bigint;
1654
+ appBudgetConsumed?: number | bigint;
1655
+ failedAt?: (number | bigint)[];
1656
+ failureMessage?: string;
1657
+ });
1658
+ static from_obj_for_encoding(data: Record<string, any>): SimulateTransactionGroupResult;
1659
+ }
1660
+ /**
1661
+ * Simulation result for an individual transaction
1662
+ */
1663
+ export declare class SimulateTransactionResult extends BaseModel {
1664
+ /**
1665
+ * Details about a pending transaction. If the transaction was recently confirmed,
1666
+ * includes confirmation details like the round and reward details.
1667
+ */
1668
+ txnResult: PendingTransactionResponse;
1669
+ /**
1670
+ * Budget used during execution of an app call transaction. This value includes
1671
+ * budged used by inner app calls spawned by this transaction.
1672
+ */
1673
+ appBudgetConsumed?: number | bigint;
1674
+ /**
1675
+ * Budget used during execution of a logic sig transaction.
1676
+ */
1677
+ logicSigBudgetConsumed?: number | bigint;
1678
+ /**
1679
+ * Creates a new `SimulateTransactionResult` object.
1680
+ * @param txnResult - Details about a pending transaction. If the transaction was recently confirmed,
1681
+ * includes confirmation details like the round and reward details.
1682
+ * @param appBudgetConsumed - Budget used during execution of an app call transaction. This value includes
1683
+ * budged used by inner app calls spawned by this transaction.
1684
+ * @param logicSigBudgetConsumed - Budget used during execution of a logic sig transaction.
1685
+ */
1686
+ constructor({ txnResult, appBudgetConsumed, logicSigBudgetConsumed, }: {
1687
+ txnResult: PendingTransactionResponse;
1688
+ appBudgetConsumed?: number | bigint;
1689
+ logicSigBudgetConsumed?: number | bigint;
1690
+ });
1691
+ static from_obj_for_encoding(data: Record<string, any>): SimulateTransactionResult;
1692
+ }
1693
+ /**
1694
+ * The set of parameters and limits override during simulation. If this set of
1695
+ * parameters is present, then evaluation parameters may differ from standard
1696
+ * evaluation in certain ways.
1697
+ */
1698
+ export declare class SimulationEvalOverrides extends BaseModel {
1699
+ /**
1700
+ * If true, transactions without signatures are allowed and simulated as if they
1701
+ * were properly signed.
1702
+ */
1703
+ allowEmptySignatures?: boolean;
1704
+ /**
1705
+ * The maximum log calls one can make during simulation
1706
+ */
1707
+ maxLogCalls?: number | bigint;
1708
+ /**
1709
+ * The maximum byte number to log during simulation
1710
+ */
1711
+ maxLogSize?: number | bigint;
1712
+ /**
1713
+ * Creates a new `SimulationEvalOverrides` object.
1714
+ * @param allowEmptySignatures - If true, transactions without signatures are allowed and simulated as if they
1715
+ * were properly signed.
1716
+ * @param maxLogCalls - The maximum log calls one can make during simulation
1717
+ * @param maxLogSize - The maximum byte number to log during simulation
1718
+ */
1719
+ constructor({ allowEmptySignatures, maxLogCalls, maxLogSize, }: {
1720
+ allowEmptySignatures?: boolean;
1721
+ maxLogCalls?: number | bigint;
1722
+ maxLogSize?: number | bigint;
1723
+ });
1724
+ static from_obj_for_encoding(data: Record<string, any>): SimulationEvalOverrides;
1725
+ }
1416
1726
  /**
1417
1727
  * Represents a state proof and its corresponding message
1418
1728
  */
@@ -0,0 +1,4 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ export default class Ready extends JSONRequest {
3
+ path(): string;
4
+ }
@@ -0,0 +1,9 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ import HTTPClient from '../../client';
3
+ import IntDecoding from '../../../types/intDecoding';
4
+ export default class SetBlockOffsetTimestamp extends JSONRequest {
5
+ private offset;
6
+ constructor(c: HTTPClient, intDecoding: IntDecoding, offset: number);
7
+ path(): string;
8
+ do(headers?: {}): Promise<any>;
9
+ }
@@ -0,0 +1,9 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ import HTTPClient from '../../client';
3
+ import IntDecoding from '../../../types/intDecoding';
4
+ export default class SetSyncRound extends JSONRequest {
5
+ private round;
6
+ constructor(c: HTTPClient, intDecoding: IntDecoding, round: number);
7
+ path(): string;
8
+ do(headers?: {}): Promise<any>;
9
+ }
@@ -0,0 +1,19 @@
1
+ import HTTPClient from '../../client';
2
+ import JSONRequest from '../jsonrequest';
3
+ import { SimulateRequest, SimulateResponse } from './models/types';
4
+ /**
5
+ * Sets the default header (if not previously set) for simulating a raw
6
+ * transaction.
7
+ * @param headers - A headers object
8
+ */
9
+ export declare function setSimulateTransactionsHeaders(headers?: {}): {};
10
+ /**
11
+ * Simulates signed txns.
12
+ */
13
+ export default class SimulateRawTransactions extends JSONRequest<SimulateResponse, Uint8Array> {
14
+ private requestBytes;
15
+ constructor(c: HTTPClient, request: SimulateRequest);
16
+ path(): string;
17
+ do(headers?: {}): Promise<SimulateResponse>;
18
+ prepare(body: Uint8Array): SimulateResponse;
19
+ }
@@ -1,9 +1,9 @@
1
1
  import JSONRequest from '../jsonrequest';
2
- import { SuggestedParams } from '../../../types/transactions/base';
2
+ import { SuggestedParamsWithMinFee } from '../../../types/transactions/base';
3
3
  /**
4
4
  * Returns the common needed parameters for a new transaction, in a format the transaction builder expects
5
5
  */
6
- export default class SuggestedParamsRequest extends JSONRequest<SuggestedParams> {
6
+ export default class SuggestedParamsRequest extends JSONRequest<SuggestedParamsWithMinFee> {
7
7
  path(): string;
8
- prepare(body: Record<string, any>): SuggestedParams;
8
+ prepare(body: Record<string, any>): SuggestedParamsWithMinFee;
9
9
  }
@@ -0,0 +1,5 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ export default class UnsetSyncRound extends JSONRequest {
3
+ path(): string;
4
+ do(headers?: {}): Promise<any>;
5
+ }
@@ -1,5 +1,6 @@
1
- import { ABIValue, ABIMethod } from './abi';
1
+ import { ABIMethod, ABIValue } from './abi';
2
2
  import Algodv2 from './client/v2/algod/algod';
3
+ import { SimulateResponse, SimulateRequest } from './client/v2/algod/models/types';
3
4
  import { TransactionSigner, TransactionWithSigner } from './signer';
4
5
  import { BoxReference, OnApplicationComplete, SuggestedParams } from './types/transactions/base';
5
6
  export declare type ABIArgument = ABIValue | TransactionWithSigner;
@@ -149,6 +150,26 @@ export declare class AtomicTransactionComposer {
149
150
  * @returns A promise that, upon success, resolves to a list of TxIDs of the submitted transactions.
150
151
  */
151
152
  submit(client: Algodv2): Promise<string[]>;
153
+ /**
154
+ * Simulates the transaction group in the network.
155
+ *
156
+ * The composer will try to sign any transactions in the group, then simulate
157
+ * the results.
158
+ * Simulating the group will not change the composer's status.
159
+ *
160
+ * @param client - An Algodv2 client
161
+ * @param request - SimulateRequest with options in simulation.
162
+ * If provided, the request's transaction group will be overrwritten by the composer's group,
163
+ * only simulation related options will be used.
164
+ *
165
+ * @returns A promise that, upon success, resolves to an object containing an
166
+ * array of results containing one element for each method call transaction
167
+ * in this group (ABIResult[]) and the SimulateResponse object.
168
+ */
169
+ simulate(client: Algodv2, request?: SimulateRequest): Promise<{
170
+ methodResults: ABIResult[];
171
+ simulateResponse: SimulateResponse;
172
+ }>;
152
173
  /**
153
174
  * Send the transaction group to the network and wait until it's committed to a block. An error
154
175
  * will be thrown if submission or execution fails.
@@ -171,4 +192,13 @@ export declare class AtomicTransactionComposer {
171
192
  txIDs: string[];
172
193
  methodResults: ABIResult[];
173
194
  }>;
195
+ /**
196
+ * Parses a single ABI Method transaction log into a ABI result object.
197
+ *
198
+ * @param method
199
+ * @param methodResult
200
+ * @param pendingInfo
201
+ * @returns An ABIResult object
202
+ */
203
+ static parseMethodResponse(method: ABIMethod, methodResult: ABIResult, pendingInfo: Record<string, any>): ABIResult;
174
204
  }
@@ -10,6 +10,13 @@
10
10
  * 5. Binary blob should be used for binary data and string for strings
11
11
  * */
12
12
  export declare const ERROR_CONTAINS_EMPTY_STRING = "The object contains empty or 0 values. First empty or 0 value encountered during encoding: ";
13
+ /**
14
+ * rawEncode encodes objects using msgpack, regardless of whether there are
15
+ * empty or 0 value fields.
16
+ * @param obj - a dictionary to be encoded. May or may not contain empty or 0 values.
17
+ * @returns msgpack representation of the object
18
+ */
19
+ export declare function rawEncode(obj: Record<string | number | symbol, any>): Uint8Array;
13
20
  /**
14
21
  * encode encodes objects using msgpack
15
22
  * @param obj - a dictionary to be encoded. Must not contain empty or 0 values.
@@ -66,6 +66,7 @@ export { default as IntDecoding } from './types/intDecoding';
66
66
  export { default as Account } from './types/account';
67
67
  export { default as Indexer } from './client/v2/indexer/indexer';
68
68
  export { BaseHTTPClient, BaseHTTPClientResponse, BaseHTTPClientError, } from './client/baseHTTPClient';
69
+ export { AlgodTokenHeader, IndexerTokenHeader, KMDTokenHeader, CustomTokenHeader, TokenHeader, } from './client/urlTokenBaseHTTPClient';
69
70
  export { waitForConfirmation } from './wait';
70
71
  export { isValidAddress, encodeAddress, decodeAddress, getApplicationAddress, } from './encoding/address';
71
72
  export { bytesToBigInt, bigIntToBytes } from './encoding/bigint';
@@ -49,9 +49,7 @@ export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegis
49
49
  export declare function makeKeyRegistrationTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperty<MustHaveSuggestedParams<KeyRegistrationTxn>, 'reKeyTo', 'rekeyTo'>, 'from' | 'note' | 'voteKey' | 'selectionKey' | 'stateProofKey' | 'voteFirst' | 'voteLast' | 'voteKeyDilution' | 'suggestedParams' | 'rekeyTo'> & {
50
50
  nonParticipation?: false;
51
51
  }>): txnBuilder.Transaction;
52
- export declare function makeKeyRegistrationTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperty<MustHaveSuggestedParams<KeyRegistrationTxn>, 'reKeyTo', 'rekeyTo'>, 'from' | 'note' | 'suggestedParams' | 'rekeyTo'> & {
53
- nonParticipation: true;
54
- }>): txnBuilder.Transaction;
52
+ export declare function makeKeyRegistrationTxnWithSuggestedParamsFromObject(o: Expand<Pick<RenameProperty<MustHaveSuggestedParams<KeyRegistrationTxn>, 'reKeyTo', 'rekeyTo'>, 'from' | 'note' | 'suggestedParams' | 'rekeyTo' | 'nonParticipation'>>): txnBuilder.Transaction;
55
53
  /** makeAssetCreateTxnWithSuggestedParams takes asset creation arguments and returns a Transaction object
56
54
  * for creating that asset
57
55
  *
@@ -25,6 +25,11 @@ export declare function makeLogicSigAccountTransactionSigner(account: LogicSigAc
25
25
  * @param sks - An array of private keys belonging to the msig which should sign the transactions.
26
26
  */
27
27
  export declare function makeMultiSigAccountTransactionSigner(msig: MultisigMetadata, sks: Uint8Array[]): TransactionSigner;
28
+ /**
29
+ * Create a makeEmptyTransactionSigner that does not specify any signer or
30
+ * signing capabilities. This should only be used to simulate transactions.
31
+ */
32
+ export declare function makeEmptyTransactionSigner(): TransactionSigner;
28
33
  /** Represents an unsigned transactions and a signer that can authorize that transaction. */
29
34
  export interface TransactionWithSigner {
30
35
  /** An unsigned transaction */
@@ -140,6 +140,15 @@ export declare class Transaction implements TransactionStorageStructure {
140
140
  prettyPrint(): void;
141
141
  toString(): string;
142
142
  }
143
+ /**
144
+ * encodeUnsignedSimulateTransaction takes a txnBuilder.Transaction object,
145
+ * converts it into a SignedTransaction-like object, and converts it to a Buffer.
146
+ *
147
+ * Note: this function should only be used to simulate unsigned transactions.
148
+ *
149
+ * @param transactionObject - Transaction object to simulate.
150
+ */
151
+ export declare function encodeUnsignedSimulateTransaction(transactionObject: Transaction): Uint8Array;
143
152
  /**
144
153
  * encodeUnsignedTransaction takes a completed txnBuilder.Transaction object, such as from the makeFoo
145
154
  * family of transactions, and converts it to a Buffer
@@ -101,6 +101,12 @@ export interface SuggestedParams {
101
101
  */
102
102
  genesisHash: string;
103
103
  }
104
+ export declare type SuggestedParamsWithMinFee = SuggestedParams & {
105
+ /**
106
+ * Minimum fee (not per byte) required for the transaction to be confirmed
107
+ */
108
+ minFee: number;
109
+ };
104
110
  /**
105
111
  * A grouping of the app ID and name of the box in an Uint8Array
106
112
  */
@@ -21,7 +21,7 @@ export declare type TransactionBase = TransactionBaseWithoutSuggestedParams | Tr
21
21
  * - A: Additional parameters on top of the base transaction parameters
22
22
  * - O: A set of overwrites for transaction parameters
23
23
  */
24
- export declare type ConstructTransaction<A = {}, O = {}> = DistributiveOverwrite<TransactionBase & A, O>;
24
+ export declare type ConstructTransaction<A = {}, O extends Partial<TransactionBase & A> = {}> = DistributiveOverwrite<TransactionBase & A, O>;
25
25
  /**
26
26
  * Only accept transaction objects that include suggestedParams as an object
27
27
  */
@@ -16,7 +16,7 @@ export declare type Overwrite<T, U extends Partial<T>> = Pick<T, Exclude<keyof T
16
16
  /**
17
17
  * Same as Overwrite, but will distribute the Overwrite over unions
18
18
  */
19
- export declare type DistributiveOverwrite<T, K> = T extends unknown ? Overwrite<T, K> : never;
19
+ export declare type DistributiveOverwrite<T, K extends Partial<T>> = T extends unknown ? Overwrite<T, K> : never;
20
20
  /**
21
21
  * Mark certain keys as prohibited
22
22
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -82,6 +82,6 @@
82
82
  "author": "Algorand, llc",
83
83
  "license": "MIT",
84
84
  "engines": {
85
- "node": ">=14.0.0"
85
+ "node": ">=16.0.0"
86
86
  }
87
87
  }