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
@@ -877,17 +877,17 @@ export class ApplicationParams extends BaseModel {
877
877
  public extraProgramPages?: number | bigint;
878
878
 
879
879
  /**
880
- * [\gs) global schema
880
+ * (gs) global state
881
881
  */
882
882
  public globalState?: TealKeyValue[];
883
883
 
884
884
  /**
885
- * [\gsch) global schema
885
+ * (gsch) global schema
886
886
  */
887
887
  public globalStateSchema?: ApplicationStateSchema;
888
888
 
889
889
  /**
890
- * [\lsch) local schema
890
+ * (lsch) local schema
891
891
  */
892
892
  public localStateSchema?: ApplicationStateSchema;
893
893
 
@@ -898,9 +898,9 @@ export class ApplicationParams extends BaseModel {
898
898
  * @param creator - The address that created this application. This is the address where the
899
899
  * parameters and global state for this application can be found.
900
900
  * @param extraProgramPages - (epp) the amount of extra program pages available to this app.
901
- * @param globalState - [\gs) global schema
902
- * @param globalStateSchema - [\gsch) global schema
903
- * @param localStateSchema - [\lsch) local schema
901
+ * @param globalState - (gs) global state
902
+ * @param globalStateSchema - (gsch) global schema
903
+ * @param localStateSchema - (lsch) local schema
904
904
  */
905
905
  constructor({
906
906
  approvalProgram,
@@ -2432,6 +2432,132 @@ export class EvalDeltaKeyValue extends BaseModel {
2432
2432
  }
2433
2433
  }
2434
2434
 
2435
+ /**
2436
+ * Response containing the timestamp offset in seconds
2437
+ */
2438
+ export class GetBlockTimeStampOffsetResponse extends BaseModel {
2439
+ /**
2440
+ * Timestamp offset in seconds.
2441
+ */
2442
+ public offset: number | bigint;
2443
+
2444
+ /**
2445
+ * Creates a new `GetBlockTimeStampOffsetResponse` object.
2446
+ * @param offset - Timestamp offset in seconds.
2447
+ */
2448
+ constructor({ offset }: { offset: number | bigint }) {
2449
+ super();
2450
+ this.offset = offset;
2451
+
2452
+ this.attribute_map = {
2453
+ offset: 'offset',
2454
+ };
2455
+ }
2456
+
2457
+ // eslint-disable-next-line camelcase
2458
+ static from_obj_for_encoding(
2459
+ data: Record<string, any>
2460
+ ): GetBlockTimeStampOffsetResponse {
2461
+ /* eslint-disable dot-notation */
2462
+ if (typeof data['offset'] === 'undefined')
2463
+ throw new Error(`Response is missing required field 'offset': ${data}`);
2464
+ return new GetBlockTimeStampOffsetResponse({
2465
+ offset: data['offset'],
2466
+ });
2467
+ /* eslint-enable dot-notation */
2468
+ }
2469
+ }
2470
+
2471
+ /**
2472
+ * Response containing the ledger's minimum sync round
2473
+ */
2474
+ export class GetSyncRoundResponse extends BaseModel {
2475
+ /**
2476
+ * The minimum sync round for the ledger.
2477
+ */
2478
+ public round: number | bigint;
2479
+
2480
+ /**
2481
+ * Creates a new `GetSyncRoundResponse` object.
2482
+ * @param round - The minimum sync round for the ledger.
2483
+ */
2484
+ constructor({ round }: { round: number | bigint }) {
2485
+ super();
2486
+ this.round = round;
2487
+
2488
+ this.attribute_map = {
2489
+ round: 'round',
2490
+ };
2491
+ }
2492
+
2493
+ // eslint-disable-next-line camelcase
2494
+ static from_obj_for_encoding(
2495
+ data: Record<string, any>
2496
+ ): GetSyncRoundResponse {
2497
+ /* eslint-disable dot-notation */
2498
+ if (typeof data['round'] === 'undefined')
2499
+ throw new Error(`Response is missing required field 'round': ${data}`);
2500
+ return new GetSyncRoundResponse({
2501
+ round: data['round'],
2502
+ });
2503
+ /* eslint-enable dot-notation */
2504
+ }
2505
+ }
2506
+
2507
+ /**
2508
+ * A single Delta containing the key, the previous value and the current value for
2509
+ * a single round.
2510
+ */
2511
+ export class KvDelta extends BaseModel {
2512
+ /**
2513
+ * The key, base64 encoded.
2514
+ */
2515
+ public key?: Uint8Array;
2516
+
2517
+ /**
2518
+ * The new value of the KV store entry, base64 encoded.
2519
+ */
2520
+ public value?: Uint8Array;
2521
+
2522
+ /**
2523
+ * Creates a new `KvDelta` object.
2524
+ * @param key - The key, base64 encoded.
2525
+ * @param value - The new value of the KV store entry, base64 encoded.
2526
+ */
2527
+ constructor({
2528
+ key,
2529
+ value,
2530
+ }: {
2531
+ key?: string | Uint8Array;
2532
+ value?: string | Uint8Array;
2533
+ }) {
2534
+ super();
2535
+ this.key =
2536
+ typeof key === 'string'
2537
+ ? new Uint8Array(Buffer.from(key, 'base64'))
2538
+ : key;
2539
+ this.value =
2540
+ typeof value === 'string'
2541
+ ? new Uint8Array(Buffer.from(value, 'base64'))
2542
+ : value;
2543
+
2544
+ this.attribute_map = {
2545
+ key: 'key',
2546
+ value: 'value',
2547
+ };
2548
+ }
2549
+
2550
+ // eslint-disable-next-line camelcase
2551
+ static from_obj_for_encoding(data: Record<string, any>): KvDelta {
2552
+ /* eslint-disable dot-notation */
2553
+ return new KvDelta({
2554
+ key: data['key'],
2555
+ value: data['value'],
2556
+ });
2557
+ /* eslint-enable dot-notation */
2558
+ }
2559
+ }
2560
+
2435
2561
  /**
2436
2562
  * Proof of membership and position of a light block header.
2437
2563
  */
@@ -2607,6 +2733,46 @@ export class NodeStatusResponse extends BaseModel {
2607
2733
  */
2608
2734
  public lastCatchpoint?: string;
2609
2735
 
2736
+ /**
2737
+ * Upgrade delay
2738
+ */
2739
+ public upgradeDelay?: number | bigint;
2740
+
2741
+ /**
2742
+ * Next protocol round
2743
+ */
2744
+ public upgradeNextProtocolVoteBefore?: number | bigint;
2745
+
2746
+ /**
2747
+ * No votes cast for consensus upgrade
2748
+ */
2749
+ public upgradeNoVotes?: number | bigint;
2750
+
2751
+ /**
2752
+ * This node's upgrade vote
2753
+ */
2754
+ public upgradeNodeVote?: boolean;
2755
+
2756
+ /**
2757
+ * Total voting rounds for current upgrade
2758
+ */
2759
+ public upgradeVoteRounds?: number | bigint;
2760
+
2761
+ /**
2762
+ * Total votes cast for consensus upgrade
2763
+ */
2764
+ public upgradeVotes?: number | bigint;
2765
+
2766
+ /**
2767
+ * Yes votes required for consensus upgrade
2768
+ */
2769
+ public upgradeVotesRequired?: number | bigint;
2770
+
2771
+ /**
2772
+ * Yes votes cast for consensus upgrade
2773
+ */
2774
+ public upgradeYesVotes?: number | bigint;
2775
+
2610
2776
  /**
2611
2777
  * Creates a new `NodeStatusResponse` object.
2612
2778
  * @param catchupTime - CatchupTime in nanoseconds
@@ -2635,6 +2801,14 @@ export class NodeStatusResponse extends BaseModel {
2635
2801
  * @param catchpointVerifiedKvs - The number of key-values (KVs) from the current catchpoint that have been
2636
2802
  * verified so far as part of the catchup
2637
2803
  * @param lastCatchpoint - The last catchpoint seen by the node
2804
+ * @param upgradeDelay - Upgrade delay
2805
+ * @param upgradeNextProtocolVoteBefore - Next protocol round
2806
+ * @param upgradeNoVotes - No votes cast for consensus upgrade
2807
+ * @param upgradeNodeVote - This node's upgrade vote
2808
+ * @param upgradeVoteRounds - Total voting rounds for current upgrade
2809
+ * @param upgradeVotes - Total votes cast for consensus upgrade
2810
+ * @param upgradeVotesRequired - Yes votes required for consensus upgrade
2811
+ * @param upgradeYesVotes - Yes votes cast for consensus upgrade
2638
2812
  */
2639
2813
  constructor({
2640
2814
  catchupTime,
@@ -2655,6 +2829,14 @@ export class NodeStatusResponse extends BaseModel {
2655
2829
  catchpointVerifiedAccounts,
2656
2830
  catchpointVerifiedKvs,
2657
2831
  lastCatchpoint,
2832
+ upgradeDelay,
2833
+ upgradeNextProtocolVoteBefore,
2834
+ upgradeNoVotes,
2835
+ upgradeNodeVote,
2836
+ upgradeVoteRounds,
2837
+ upgradeVotes,
2838
+ upgradeVotesRequired,
2839
+ upgradeYesVotes,
2658
2840
  }: {
2659
2841
  catchupTime: number | bigint;
2660
2842
  lastRound: number | bigint;
@@ -2674,6 +2856,14 @@ export class NodeStatusResponse extends BaseModel {
2674
2856
  catchpointVerifiedAccounts?: number | bigint;
2675
2857
  catchpointVerifiedKvs?: number | bigint;
2676
2858
  lastCatchpoint?: string;
2859
+ upgradeDelay?: number | bigint;
2860
+ upgradeNextProtocolVoteBefore?: number | bigint;
2861
+ upgradeNoVotes?: number | bigint;
2862
+ upgradeNodeVote?: boolean;
2863
+ upgradeVoteRounds?: number | bigint;
2864
+ upgradeVotes?: number | bigint;
2865
+ upgradeVotesRequired?: number | bigint;
2866
+ upgradeYesVotes?: number | bigint;
2677
2867
  }) {
2678
2868
  super();
2679
2869
  this.catchupTime = catchupTime;
@@ -2694,6 +2884,14 @@ export class NodeStatusResponse extends BaseModel {
2694
2884
  this.catchpointVerifiedAccounts = catchpointVerifiedAccounts;
2695
2885
  this.catchpointVerifiedKvs = catchpointVerifiedKvs;
2696
2886
  this.lastCatchpoint = lastCatchpoint;
2887
+ this.upgradeDelay = upgradeDelay;
2888
+ this.upgradeNextProtocolVoteBefore = upgradeNextProtocolVoteBefore;
2889
+ this.upgradeNoVotes = upgradeNoVotes;
2890
+ this.upgradeNodeVote = upgradeNodeVote;
2891
+ this.upgradeVoteRounds = upgradeVoteRounds;
2892
+ this.upgradeVotes = upgradeVotes;
2893
+ this.upgradeVotesRequired = upgradeVotesRequired;
2894
+ this.upgradeYesVotes = upgradeYesVotes;
2697
2895
 
2698
2896
  this.attribute_map = {
2699
2897
  catchupTime: 'catchup-time',
@@ -2714,6 +2912,14 @@ export class NodeStatusResponse extends BaseModel {
2714
2912
  catchpointVerifiedAccounts: 'catchpoint-verified-accounts',
2715
2913
  catchpointVerifiedKvs: 'catchpoint-verified-kvs',
2716
2914
  lastCatchpoint: 'last-catchpoint',
2915
+ upgradeDelay: 'upgrade-delay',
2916
+ upgradeNextProtocolVoteBefore: 'upgrade-next-protocol-vote-before',
2917
+ upgradeNoVotes: 'upgrade-no-votes',
2918
+ upgradeNodeVote: 'upgrade-node-vote',
2919
+ upgradeVoteRounds: 'upgrade-vote-rounds',
2920
+ upgradeVotes: 'upgrade-votes',
2921
+ upgradeVotesRequired: 'upgrade-votes-required',
2922
+ upgradeYesVotes: 'upgrade-yes-votes',
2717
2923
  };
2718
2924
  }
2719
2925
 
@@ -2771,6 +2977,14 @@ export class NodeStatusResponse extends BaseModel {
2771
2977
  catchpointVerifiedAccounts: data['catchpoint-verified-accounts'],
2772
2978
  catchpointVerifiedKvs: data['catchpoint-verified-kvs'],
2773
2979
  lastCatchpoint: data['last-catchpoint'],
2980
+ upgradeDelay: data['upgrade-delay'],
2981
+ upgradeNextProtocolVoteBefore: data['upgrade-next-protocol-vote-before'],
2982
+ upgradeNoVotes: data['upgrade-no-votes'],
2983
+ upgradeNodeVote: data['upgrade-node-vote'],
2984
+ upgradeVoteRounds: data['upgrade-vote-rounds'],
2985
+ upgradeVotes: data['upgrade-votes'],
2986
+ upgradeVotesRequired: data['upgrade-votes-required'],
2987
+ upgradeYesVotes: data['upgrade-yes-votes'],
2774
2988
  });
2775
2989
  /* eslint-enable dot-notation */
2776
2990
  }
@@ -2825,7 +3039,7 @@ export class PendingTransactionResponse extends BaseModel {
2825
3039
  public confirmedRound?: number | bigint;
2826
3040
 
2827
3041
  /**
2828
- * (gd) Global state key/value changes for the application being executed by this
3042
+ * Global state key/value changes for the application being executed by this
2829
3043
  * transaction.
2830
3044
  */
2831
3045
  public globalStateDelta?: EvalDeltaKeyValue[];
@@ -2836,13 +3050,13 @@ export class PendingTransactionResponse extends BaseModel {
2836
3050
  public innerTxns?: PendingTransactionResponse[];
2837
3051
 
2838
3052
  /**
2839
- * (ld) Local state key/value changes for the application being executed by this
3053
+ * Local state key/value changes for the application being executed by this
2840
3054
  * transaction.
2841
3055
  */
2842
3056
  public localStateDelta?: AccountStateDelta[];
2843
3057
 
2844
3058
  /**
2845
- * (lg) Logs for the application being executed by this transaction.
3059
+ * Logs for the application being executed by this transaction.
2846
3060
  */
2847
3061
  public logs?: Uint8Array[];
2848
3062
 
@@ -2869,12 +3083,12 @@ export class PendingTransactionResponse extends BaseModel {
2869
3083
  * @param closeRewards - Rewards in microalgos applied to the close remainder to account.
2870
3084
  * @param closingAmount - Closing amount for the transaction.
2871
3085
  * @param confirmedRound - The round where this transaction was confirmed, if present.
2872
- * @param globalStateDelta - (gd) Global state key/value changes for the application being executed by this
3086
+ * @param globalStateDelta - Global state key/value changes for the application being executed by this
2873
3087
  * transaction.
2874
3088
  * @param innerTxns - Inner transactions produced by application execution.
2875
- * @param localStateDelta - (ld) Local state key/value changes for the application being executed by this
3089
+ * @param localStateDelta - Local state key/value changes for the application being executed by this
2876
3090
  * transaction.
2877
- * @param logs - (lg) Logs for the application being executed by this transaction.
3091
+ * @param logs - Logs for the application being executed by this transaction.
2878
3092
  * @param receiverRewards - Rewards in microalgos applied to the receiver account.
2879
3093
  * @param senderRewards - Rewards in microalgos applied to the sender account.
2880
3094
  */
@@ -3084,6 +3298,432 @@ export class PostTransactionsResponse extends BaseModel {
3084
3298
  }
3085
3299
  }
3086
3300
 
3301
+ /**
3302
+ * Request type for simulation endpoint.
3303
+ */
3304
+ export class SimulateRequest extends BaseModel {
3305
+ /**
3306
+ * The transaction groups to simulate.
3307
+ */
3308
+ public txnGroups: SimulateRequestTransactionGroup[];
3309
+
3310
+ /**
3311
+ * Allow transactions without signatures to be simulated as if they had correct
3312
+ * signatures.
3313
+ */
3314
+ public allowEmptySignatures?: boolean;
3315
+
3316
+ /**
3317
+ * Lifts limits on log opcode usage during simulation.
3318
+ */
3319
+ public allowMoreLogging?: boolean;
3320
+
3321
+ /**
3322
+ * Creates a new `SimulateRequest` object.
3323
+ * @param txnGroups - The transaction groups to simulate.
3324
+ * @param allowEmptySignatures - Allow transactions without signatures to be simulated as if they had correct
3325
+ * signatures.
3326
+ * @param allowMoreLogging - Lifts limits on log opcode usage during simulation.
3327
+ */
3328
+ constructor({
3329
+ txnGroups,
3330
+ allowEmptySignatures,
3331
+ allowMoreLogging,
3332
+ }: {
3333
+ txnGroups: SimulateRequestTransactionGroup[];
3334
+ allowEmptySignatures?: boolean;
3335
+ allowMoreLogging?: boolean;
3336
+ }) {
3337
+ super();
3338
+ this.txnGroups = txnGroups;
3339
+ this.allowEmptySignatures = allowEmptySignatures;
3340
+ this.allowMoreLogging = allowMoreLogging;
3341
+
3342
+ this.attribute_map = {
3343
+ txnGroups: 'txn-groups',
3344
+ allowEmptySignatures: 'allow-empty-signatures',
3345
+ allowMoreLogging: 'allow-more-logging',
3346
+ };
3347
+ }
3348
+
3349
+ // eslint-disable-next-line camelcase
3350
+ static from_obj_for_encoding(data: Record<string, any>): SimulateRequest {
3351
+ /* eslint-disable dot-notation */
3352
+ if (!Array.isArray(data['txn-groups']))
3353
+ throw new Error(
3354
+ `Response is missing required array field 'txn-groups': ${data}`
3355
+ );
3356
+ return new SimulateRequest({
3357
+ txnGroups: data['txn-groups'].map(
3358
+ SimulateRequestTransactionGroup.from_obj_for_encoding
3359
+ ),
3360
+ allowEmptySignatures: data['allow-empty-signatures'],
3361
+ allowMoreLogging: data['allow-more-logging'],
3362
+ });
3363
+ /* eslint-enable dot-notation */
3364
+ }
3365
+ }
3366
+
3367
+ /**
3368
+ * A transaction group to simulate.
3369
+ */
3370
+ export class SimulateRequestTransactionGroup extends BaseModel {
3371
+ /**
3372
+ * An atomic transaction group.
3373
+ */
3374
+ public txns: EncodedSignedTransaction[];
3375
+
3376
+ /**
3377
+ * Creates a new `SimulateRequestTransactionGroup` object.
3378
+ * @param txns - An atomic transaction group.
3379
+ */
3380
+ constructor({ txns }: { txns: EncodedSignedTransaction[] }) {
3381
+ super();
3382
+ this.txns = txns;
3383
+
3384
+ this.attribute_map = {
3385
+ txns: 'txns',
3386
+ };
3387
+ }
3388
+
3389
+ // eslint-disable-next-line camelcase
3390
+ static from_obj_for_encoding(
3391
+ data: Record<string, any>
3392
+ ): SimulateRequestTransactionGroup {
3393
+ /* eslint-disable dot-notation */
3394
+ if (!Array.isArray(data['txns']))
3395
+ throw new Error(
3396
+ `Response is missing required array field 'txns': ${data}`
3397
+ );
3398
+ return new SimulateRequestTransactionGroup({
3399
+ txns: data['txns'],
3400
+ });
3401
+ /* eslint-enable dot-notation */
3402
+ }
3403
+ }
3404
+
3405
+ /**
3406
+ * Result of a transaction group simulation.
3407
+ */
3408
+ export class SimulateResponse extends BaseModel {
3409
+ /**
3410
+ * The round immediately preceding this simulation. State changes through this
3411
+ * round were used to run this simulation.
3412
+ */
3413
+ public lastRound: number | bigint;
3414
+
3415
+ /**
3416
+ * A result object for each transaction group that was simulated.
3417
+ */
3418
+ public txnGroups: SimulateTransactionGroupResult[];
3419
+
3420
+ /**
3421
+ * The version of this response object.
3422
+ */
3423
+ public version: number | bigint;
3424
+
3425
+ /**
3426
+ * The set of parameters and limits override during simulation. If this set of
3427
+ * parameters is present, then evaluation parameters may differ from standard
3428
+ * evaluation in certain ways.
3429
+ */
3430
+ public evalOverrides?: SimulationEvalOverrides;
3431
+
3432
+ /**
3433
+ * Creates a new `SimulateResponse` object.
3434
+ * @param lastRound - The round immediately preceding this simulation. State changes through this
3435
+ * round were used to run this simulation.
3436
+ * @param txnGroups - A result object for each transaction group that was simulated.
3437
+ * @param version - The version of this response object.
3438
+ * @param evalOverrides - The set of parameters and limits override during simulation. If this set of
3439
+ * parameters is present, then evaluation parameters may differ from standard
3440
+ * evaluation in certain ways.
3441
+ */
3442
+ constructor({
3443
+ lastRound,
3444
+ txnGroups,
3445
+ version,
3446
+ evalOverrides,
3447
+ }: {
3448
+ lastRound: number | bigint;
3449
+ txnGroups: SimulateTransactionGroupResult[];
3450
+ version: number | bigint;
3451
+ evalOverrides?: SimulationEvalOverrides;
3452
+ }) {
3453
+ super();
3454
+ this.lastRound = lastRound;
3455
+ this.txnGroups = txnGroups;
3456
+ this.version = version;
3457
+ this.evalOverrides = evalOverrides;
3458
+
3459
+ this.attribute_map = {
3460
+ lastRound: 'last-round',
3461
+ txnGroups: 'txn-groups',
3462
+ version: 'version',
3463
+ evalOverrides: 'eval-overrides',
3464
+ };
3465
+ }
3466
+
3467
+ // eslint-disable-next-line camelcase
3468
+ static from_obj_for_encoding(data: Record<string, any>): SimulateResponse {
3469
+ /* eslint-disable dot-notation */
3470
+ if (typeof data['last-round'] === 'undefined')
3471
+ throw new Error(
3472
+ `Response is missing required field 'last-round': ${data}`
3473
+ );
3474
+ if (!Array.isArray(data['txn-groups']))
3475
+ throw new Error(
3476
+ `Response is missing required array field 'txn-groups': ${data}`
3477
+ );
3478
+ if (typeof data['version'] === 'undefined')
3479
+ throw new Error(`Response is missing required field 'version': ${data}`);
3480
+ return new SimulateResponse({
3481
+ lastRound: data['last-round'],
3482
+ txnGroups: data['txn-groups'].map(
3483
+ SimulateTransactionGroupResult.from_obj_for_encoding
3484
+ ),
3485
+ version: data['version'],
3486
+ evalOverrides:
3487
+ typeof data['eval-overrides'] !== 'undefined'
3488
+ ? SimulationEvalOverrides.from_obj_for_encoding(
3489
+ data['eval-overrides']
3490
+ )
3491
+ : undefined,
3492
+ });
3493
+ /* eslint-enable dot-notation */
3494
+ }
3495
+ }
3496
+
3497
+ /**
3498
+ * Simulation result for an atomic transaction group
3499
+ */
3500
+ export class SimulateTransactionGroupResult extends BaseModel {
3501
+ /**
3502
+ * Simulation result for individual transactions
3503
+ */
3504
+ public txnResults: SimulateTransactionResult[];
3505
+
3506
+ /**
3507
+ * Total budget added during execution of app calls in the transaction group.
3508
+ */
3509
+ public appBudgetAdded?: number | bigint;
3510
+
3511
+ /**
3512
+ * Total budget consumed during execution of app calls in the transaction group.
3513
+ */
3514
+ public appBudgetConsumed?: number | bigint;
3515
+
3516
+ /**
3517
+ * If present, indicates which transaction in this group caused the failure. This
3518
+ * array represents the path to the failing transaction. Indexes are zero based,
3519
+ * the first element indicates the top-level transaction, and successive elements
3520
+ * indicate deeper inner transactions.
3521
+ */
3522
+ public failedAt?: (number | bigint)[];
3523
+
3524
+ /**
3525
+ * If present, indicates that the transaction group failed and specifies why that
3526
+ * happened
3527
+ */
3528
+ public failureMessage?: string;
3529
+
3530
+ /**
3531
+ * Creates a new `SimulateTransactionGroupResult` object.
3532
+ * @param txnResults - Simulation result for individual transactions
3533
+ * @param appBudgetAdded - Total budget added during execution of app calls in the transaction group.
3534
+ * @param appBudgetConsumed - Total budget consumed during execution of app calls in the transaction group.
3535
+ * @param failedAt - If present, indicates which transaction in this group caused the failure. This
3536
+ * array represents the path to the failing transaction. Indexes are zero based,
3537
+ * the first element indicates the top-level transaction, and successive elements
3538
+ * indicate deeper inner transactions.
3539
+ * @param failureMessage - If present, indicates that the transaction group failed and specifies why that
3540
+ * happened
3541
+ */
3542
+ constructor({
3543
+ txnResults,
3544
+ appBudgetAdded,
3545
+ appBudgetConsumed,
3546
+ failedAt,
3547
+ failureMessage,
3548
+ }: {
3549
+ txnResults: SimulateTransactionResult[];
3550
+ appBudgetAdded?: number | bigint;
3551
+ appBudgetConsumed?: number | bigint;
3552
+ failedAt?: (number | bigint)[];
3553
+ failureMessage?: string;
3554
+ }) {
3555
+ super();
3556
+ this.txnResults = txnResults;
3557
+ this.appBudgetAdded = appBudgetAdded;
3558
+ this.appBudgetConsumed = appBudgetConsumed;
3559
+ this.failedAt = failedAt;
3560
+ this.failureMessage = failureMessage;
3561
+
3562
+ this.attribute_map = {
3563
+ txnResults: 'txn-results',
3564
+ appBudgetAdded: 'app-budget-added',
3565
+ appBudgetConsumed: 'app-budget-consumed',
3566
+ failedAt: 'failed-at',
3567
+ failureMessage: 'failure-message',
3568
+ };
3569
+ }
3570
+
3571
+ // eslint-disable-next-line camelcase
3572
+ static from_obj_for_encoding(
3573
+ data: Record<string, any>
3574
+ ): SimulateTransactionGroupResult {
3575
+ /* eslint-disable dot-notation */
3576
+ if (!Array.isArray(data['txn-results']))
3577
+ throw new Error(
3578
+ `Response is missing required array field 'txn-results': ${data}`
3579
+ );
3580
+ return new SimulateTransactionGroupResult({
3581
+ txnResults: data['txn-results'].map(
3582
+ SimulateTransactionResult.from_obj_for_encoding
3583
+ ),
3584
+ appBudgetAdded: data['app-budget-added'],
3585
+ appBudgetConsumed: data['app-budget-consumed'],
3586
+ failedAt: data['failed-at'],
3587
+ failureMessage: data['failure-message'],
3588
+ });
3589
+ /* eslint-enable dot-notation */
3590
+ }
3591
+ }
3592
+
3593
+ /**
3594
+ * Simulation result for an individual transaction
3595
+ */
3596
+ export class SimulateTransactionResult extends BaseModel {
3597
+ /**
3598
+ * Details about a pending transaction. If the transaction was recently confirmed,
3599
+ * includes confirmation details like the round and reward details.
3600
+ */
3601
+ public txnResult: PendingTransactionResponse;
3602
+
3603
+ /**
3604
+ * Budget used during execution of an app call transaction. This value includes
3605
+ * budged used by inner app calls spawned by this transaction.
3606
+ */
3607
+ public appBudgetConsumed?: number | bigint;
3608
+
3609
+ /**
3610
+ * Budget used during execution of a logic sig transaction.
3611
+ */
3612
+ public logicSigBudgetConsumed?: number | bigint;
3613
+
3614
+ /**
3615
+ * Creates a new `SimulateTransactionResult` object.
3616
+ * @param txnResult - Details about a pending transaction. If the transaction was recently confirmed,
3617
+ * includes confirmation details like the round and reward details.
3618
+ * @param appBudgetConsumed - Budget used during execution of an app call transaction. This value includes
3619
+ * budged used by inner app calls spawned by this transaction.
3620
+ * @param logicSigBudgetConsumed - Budget used during execution of a logic sig transaction.
3621
+ */
3622
+ constructor({
3623
+ txnResult,
3624
+ appBudgetConsumed,
3625
+ logicSigBudgetConsumed,
3626
+ }: {
3627
+ txnResult: PendingTransactionResponse;
3628
+ appBudgetConsumed?: number | bigint;
3629
+ logicSigBudgetConsumed?: number | bigint;
3630
+ }) {
3631
+ super();
3632
+ this.txnResult = txnResult;
3633
+ this.appBudgetConsumed = appBudgetConsumed;
3634
+ this.logicSigBudgetConsumed = logicSigBudgetConsumed;
3635
+
3636
+ this.attribute_map = {
3637
+ txnResult: 'txn-result',
3638
+ appBudgetConsumed: 'app-budget-consumed',
3639
+ logicSigBudgetConsumed: 'logic-sig-budget-consumed',
3640
+ };
3641
+ }
3642
+
3643
+ // eslint-disable-next-line camelcase
3644
+ static from_obj_for_encoding(
3645
+ data: Record<string, any>
3646
+ ): SimulateTransactionResult {
3647
+ /* eslint-disable dot-notation */
3648
+ if (typeof data['txn-result'] === 'undefined')
3649
+ throw new Error(
3650
+ `Response is missing required field 'txn-result': ${data}`
3651
+ );
3652
+ return new SimulateTransactionResult({
3653
+ txnResult: PendingTransactionResponse.from_obj_for_encoding(
3654
+ data['txn-result']
3655
+ ),
3656
+ appBudgetConsumed: data['app-budget-consumed'],
3657
+ logicSigBudgetConsumed: data['logic-sig-budget-consumed'],
3658
+ });
3659
+ /* eslint-enable dot-notation */
3660
+ }
3661
+ }
3662
+
3663
+ /**
3664
+ * The set of parameters and limits override during simulation. If this set of
3665
+ * parameters is present, then evaluation parameters may differ from standard
3666
+ * evaluation in certain ways.
3667
+ */
3668
+ export class SimulationEvalOverrides extends BaseModel {
3669
+ /**
3670
+ * If true, transactions without signatures are allowed and simulated as if they
3671
+ * were properly signed.
3672
+ */
3673
+ public allowEmptySignatures?: boolean;
3674
+
3675
+ /**
3676
+ * The maximum log calls one can make during simulation
3677
+ */
3678
+ public maxLogCalls?: number | bigint;
3679
+
3680
+ /**
3681
+ * The maximum byte number to log during simulation
3682
+ */
3683
+ public maxLogSize?: number | bigint;
3684
+
3685
+ /**
3686
+ * Creates a new `SimulationEvalOverrides` object.
3687
+ * @param allowEmptySignatures - If true, transactions without signatures are allowed and simulated as if they
3688
+ * were properly signed.
3689
+ * @param maxLogCalls - The maximum log calls one can make during simulation
3690
+ * @param maxLogSize - The maximum byte number to log during simulation
3691
+ */
3692
+ constructor({
3693
+ allowEmptySignatures,
3694
+ maxLogCalls,
3695
+ maxLogSize,
3696
+ }: {
3697
+ allowEmptySignatures?: boolean;
3698
+ maxLogCalls?: number | bigint;
3699
+ maxLogSize?: number | bigint;
3700
+ }) {
3701
+ super();
3702
+ this.allowEmptySignatures = allowEmptySignatures;
3703
+ this.maxLogCalls = maxLogCalls;
3704
+ this.maxLogSize = maxLogSize;
3705
+
3706
+ this.attribute_map = {
3707
+ allowEmptySignatures: 'allow-empty-signatures',
3708
+ maxLogCalls: 'max-log-calls',
3709
+ maxLogSize: 'max-log-size',
3710
+ };
3711
+ }
3712
+
3713
+ // eslint-disable-next-line camelcase
3714
+ static from_obj_for_encoding(
3715
+ data: Record<string, any>
3716
+ ): SimulationEvalOverrides {
3717
+ /* eslint-disable dot-notation */
3718
+ return new SimulationEvalOverrides({
3719
+ allowEmptySignatures: data['allow-empty-signatures'],
3720
+ maxLogCalls: data['max-log-calls'],
3721
+ maxLogSize: data['max-log-size'],
3722
+ });
3723
+ /* eslint-enable dot-notation */
3724
+ }
3725
+ }
3726
+
3087
3727
  /**
3088
3728
  * Represents a state proof and its corresponding message
3089
3729
  */