algosdk 2.6.0 → 2.8.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.
@@ -45,7 +45,7 @@ export declare function makePaymentTxnWithSuggestedParamsFromObject(o: Expand<Pi
45
45
  * @param stateProofKey - state proof key. for key deregistration, leave undefined
46
46
  */
47
47
  export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegistrationTxn['from'], note: KeyRegistrationTxn['note'], voteKey: KeyRegistrationTxn['voteKey'], selectionKey: KeyRegistrationTxn['selectionKey'], voteFirst: KeyRegistrationTxn['voteFirst'], voteLast: KeyRegistrationTxn['voteLast'], voteKeyDilution: KeyRegistrationTxn['voteKeyDilution'], suggestedParams: MustHaveSuggestedParams<KeyRegistrationTxn>['suggestedParams'], rekeyTo?: KeyRegistrationTxn['reKeyTo'], nonParticipation?: false, stateProofKey?: KeyRegistrationTxn['stateProofKey']): txnBuilder.Transaction;
48
- export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegistrationTxn['from'], note: KeyRegistrationTxn['note'], voteKey: undefined, selectionKey: undefined, voteFirst: undefined, voteLast: undefined, voteKeyDilution: undefined, suggestedParams: MustHaveSuggestedParams<KeyRegistrationTxn>['suggestedParams'], rekeyTo?: KeyRegistrationTxn['reKeyTo'], nonParticipation?: true, stateProofKey?: undefined): txnBuilder.Transaction;
48
+ export declare function makeKeyRegistrationTxnWithSuggestedParams(from: KeyRegistrationTxn['from'], note: KeyRegistrationTxn['note'], voteKey: undefined, selectionKey: undefined, voteFirst: undefined, voteLast: undefined, voteKeyDilution: undefined, suggestedParams: MustHaveSuggestedParams<KeyRegistrationTxn>['suggestedParams'], rekeyTo?: KeyRegistrationTxn['reKeyTo'], nonParticipation?: boolean, stateProofKey?: undefined): txnBuilder.Transaction;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -23,7 +23,6 @@
23
23
  "dependencies": {
24
24
  "algo-msgpack-with-bigint": "^2.1.1",
25
25
  "buffer": "^6.0.3",
26
- "cross-fetch": "^4.0.0",
27
26
  "hi-base32": "^0.5.1",
28
27
  "js-sha256": "^0.9.0",
29
28
  "js-sha3": "^0.8.0",
@@ -38,7 +37,7 @@
38
37
  "@typescript-eslint/eslint-plugin": "^4.26.1",
39
38
  "@typescript-eslint/parser": "^4.26.1",
40
39
  "assert": "^2.0.0",
41
- "chromedriver": "^116.0.0",
40
+ "chromedriver": "^122.0.3",
42
41
  "concurrently": "^6.2.0",
43
42
  "cucumber": "^5.1.0",
44
43
  "es-abstract": "^1.18.3",
@@ -1,5 +1,4 @@
1
1
  import { Buffer } from 'buffer';
2
- import { fetch, Response, Headers } from 'cross-fetch';
3
2
  import {
4
3
  BaseHTTPClient,
5
4
  BaseHTTPClientResponse,
@@ -127,6 +127,23 @@ export class Account extends BaseModel {
127
127
  */
128
128
  public createdAssets?: Asset[];
129
129
 
130
+ /**
131
+ * Whether or not the account can receive block incentives if its balance is in
132
+ * range at proposal time.
133
+ */
134
+ public incentiveEligible?: boolean;
135
+
136
+ /**
137
+ * The round in which this account last went online, or explicitly renewed their
138
+ * online status.
139
+ */
140
+ public lastHeartbeat?: number | bigint;
141
+
142
+ /**
143
+ * The round in which this account last proposed the block.
144
+ */
145
+ public lastProposed?: number | bigint;
146
+
130
147
  /**
131
148
  * AccountParticipation describes the parameters used by this account in consensus
132
149
  * protocol.
@@ -197,6 +214,11 @@ export class Account extends BaseModel {
197
214
  * Note: the raw account uses `map[int] -> AppParams` for this type.
198
215
  * @param createdAssets - (apar) parameters of assets created by this account.
199
216
  * Note: the raw account uses `map[int] -> Asset` for this type.
217
+ * @param incentiveEligible - Whether or not the account can receive block incentives if its balance is in
218
+ * range at proposal time.
219
+ * @param lastHeartbeat - The round in which this account last went online, or explicitly renewed their
220
+ * online status.
221
+ * @param lastProposed - The round in which this account last proposed the block.
200
222
  * @param participation - AccountParticipation describes the parameters used by this account in consensus
201
223
  * protocol.
202
224
  * @param rewardBase - (ebase) used as part of the rewards computation. Only applicable to accounts
@@ -229,6 +251,9 @@ export class Account extends BaseModel {
229
251
  authAddr,
230
252
  createdApps,
231
253
  createdAssets,
254
+ incentiveEligible,
255
+ lastHeartbeat,
256
+ lastProposed,
232
257
  participation,
233
258
  rewardBase,
234
259
  sigType,
@@ -254,6 +279,9 @@ export class Account extends BaseModel {
254
279
  authAddr?: string;
255
280
  createdApps?: Application[];
256
281
  createdAssets?: Asset[];
282
+ incentiveEligible?: boolean;
283
+ lastHeartbeat?: number | bigint;
284
+ lastProposed?: number | bigint;
257
285
  participation?: AccountParticipation;
258
286
  rewardBase?: number | bigint;
259
287
  sigType?: string;
@@ -280,6 +308,9 @@ export class Account extends BaseModel {
280
308
  this.authAddr = authAddr;
281
309
  this.createdApps = createdApps;
282
310
  this.createdAssets = createdAssets;
311
+ this.incentiveEligible = incentiveEligible;
312
+ this.lastHeartbeat = lastHeartbeat;
313
+ this.lastProposed = lastProposed;
283
314
  this.participation = participation;
284
315
  this.rewardBase = rewardBase;
285
316
  this.sigType = sigType;
@@ -306,6 +337,9 @@ export class Account extends BaseModel {
306
337
  authAddr: 'auth-addr',
307
338
  createdApps: 'created-apps',
308
339
  createdAssets: 'created-assets',
340
+ incentiveEligible: 'incentive-eligible',
341
+ lastHeartbeat: 'last-heartbeat',
342
+ lastProposed: 'last-proposed',
309
343
  participation: 'participation',
310
344
  rewardBase: 'reward-base',
311
345
  sigType: 'sig-type',
@@ -394,6 +428,9 @@ export class Account extends BaseModel {
394
428
  typeof data['created-assets'] !== 'undefined'
395
429
  ? data['created-assets'].map(Asset.from_obj_for_encoding)
396
430
  : undefined,
431
+ incentiveEligible: data['incentive-eligible'],
432
+ lastHeartbeat: data['last-heartbeat'],
433
+ lastProposed: data['last-proposed'],
397
434
  participation:
398
435
  typeof data['participation'] !== 'undefined'
399
436
  ? AccountParticipation.from_obj_for_encoding(data['participation'])
@@ -484,6 +521,65 @@ export class AccountApplicationResponse extends BaseModel {
484
521
  }
485
522
  }
486
523
 
524
+ /**
525
+ * AccountAssetHolding describes the account's asset holding and asset parameters
526
+ * (if either exist) for a specific asset ID.
527
+ */
528
+ export class AccountAssetHolding extends BaseModel {
529
+ /**
530
+ * (asset) Details about the asset held by this account.
531
+ * The raw account uses `AssetHolding` for this type.
532
+ */
533
+ public assetHolding: AssetHolding;
534
+
535
+ /**
536
+ * (apar) parameters of the asset held by this account.
537
+ * The raw account uses `AssetParams` for this type.
538
+ */
539
+ public assetParams?: AssetParams;
540
+
541
+ /**
542
+ * Creates a new `AccountAssetHolding` object.
543
+ * @param assetHolding - (asset) Details about the asset held by this account.
544
+ * The raw account uses `AssetHolding` for this type.
545
+ * @param assetParams - (apar) parameters of the asset held by this account.
546
+ * The raw account uses `AssetParams` for this type.
547
+ */
548
+ constructor({
549
+ assetHolding,
550
+ assetParams,
551
+ }: {
552
+ assetHolding: AssetHolding;
553
+ assetParams?: AssetParams;
554
+ }) {
555
+ super();
556
+ this.assetHolding = assetHolding;
557
+ this.assetParams = assetParams;
558
+
559
+ this.attribute_map = {
560
+ assetHolding: 'asset-holding',
561
+ assetParams: 'asset-params',
562
+ };
563
+ }
564
+
565
+ // eslint-disable-next-line camelcase
566
+ static from_obj_for_encoding(data: Record<string, any>): AccountAssetHolding {
567
+ /* eslint-disable dot-notation */
568
+ if (typeof data['asset-holding'] === 'undefined')
569
+ throw new Error(
570
+ `Response is missing required field 'asset-holding': ${data}`
571
+ );
572
+ return new AccountAssetHolding({
573
+ assetHolding: AssetHolding.from_obj_for_encoding(data['asset-holding']),
574
+ assetParams:
575
+ typeof data['asset-params'] !== 'undefined'
576
+ ? AssetParams.from_obj_for_encoding(data['asset-params'])
577
+ : undefined,
578
+ });
579
+ /* eslint-enable dot-notation */
580
+ }
581
+ }
582
+
487
583
  /**
488
584
  * AccountAssetResponse describes the account's asset holding and asset parameters
489
585
  * (if either exist) for a specific asset ID. Asset parameters will only be
@@ -558,6 +654,72 @@ export class AccountAssetResponse extends BaseModel {
558
654
  }
559
655
  }
560
656
 
657
+ /**
658
+ * AccountAssetsInformationResponse contains a list of assets held by an account.
659
+ */
660
+ export class AccountAssetsInformationResponse extends BaseModel {
661
+ /**
662
+ * The round for which this information is relevant.
663
+ */
664
+ public round: number | bigint;
665
+
666
+ public assetHoldings?: AccountAssetHolding[];
667
+
668
+ /**
669
+ * Used for pagination, when making another request provide this token with the
670
+ * next parameter.
671
+ */
672
+ public nextToken?: string;
673
+
674
+ /**
675
+ * Creates a new `AccountAssetsInformationResponse` object.
676
+ * @param round - The round for which this information is relevant.
677
+ * @param assetHoldings -
678
+ * @param nextToken - Used for pagination, when making another request provide this token with the
679
+ * next parameter.
680
+ */
681
+ constructor({
682
+ round,
683
+ assetHoldings,
684
+ nextToken,
685
+ }: {
686
+ round: number | bigint;
687
+ assetHoldings?: AccountAssetHolding[];
688
+ nextToken?: string;
689
+ }) {
690
+ super();
691
+ this.round = round;
692
+ this.assetHoldings = assetHoldings;
693
+ this.nextToken = nextToken;
694
+
695
+ this.attribute_map = {
696
+ round: 'round',
697
+ assetHoldings: 'asset-holdings',
698
+ nextToken: 'next-token',
699
+ };
700
+ }
701
+
702
+ // eslint-disable-next-line camelcase
703
+ static from_obj_for_encoding(
704
+ data: Record<string, any>
705
+ ): AccountAssetsInformationResponse {
706
+ /* eslint-disable dot-notation */
707
+ if (typeof data['round'] === 'undefined')
708
+ throw new Error(`Response is missing required field 'round': ${data}`);
709
+ return new AccountAssetsInformationResponse({
710
+ round: data['round'],
711
+ assetHoldings:
712
+ typeof data['asset-holdings'] !== 'undefined'
713
+ ? data['asset-holdings'].map(
714
+ AccountAssetHolding.from_obj_for_encoding
715
+ )
716
+ : undefined,
717
+ nextToken: data['next-token'],
718
+ });
719
+ /* eslint-enable dot-notation */
720
+ }
721
+ }
722
+
561
723
  /**
562
724
  * AccountParticipation describes the parameters used by this account in consensus
563
725
  * protocol.
@@ -733,6 +895,75 @@ export class AccountStateDelta extends BaseModel {
733
895
  }
734
896
  }
735
897
 
898
+ /**
899
+ * The logged messages from an app call along with the app ID and outer transaction
900
+ * ID. Logs appear in the same order that they were emitted.
901
+ */
902
+ export class AppCallLogs extends BaseModel {
903
+ /**
904
+ * The application from which the logs were generated
905
+ */
906
+ public applicationIndex: number | bigint;
907
+
908
+ /**
909
+ * An array of logs
910
+ */
911
+ public logs: Uint8Array[];
912
+
913
+ /**
914
+ * The transaction ID of the outer app call that lead to these logs
915
+ */
916
+ public txid: string;
917
+
918
+ /**
919
+ * Creates a new `AppCallLogs` object.
920
+ * @param applicationIndex - The application from which the logs were generated
921
+ * @param logs - An array of logs
922
+ * @param txid - The transaction ID of the outer app call that lead to these logs
923
+ */
924
+ constructor({
925
+ applicationIndex,
926
+ logs,
927
+ txid,
928
+ }: {
929
+ applicationIndex: number | bigint;
930
+ logs: Uint8Array[];
931
+ txid: string;
932
+ }) {
933
+ super();
934
+ this.applicationIndex = applicationIndex;
935
+ this.logs = logs;
936
+ this.txid = txid;
937
+
938
+ this.attribute_map = {
939
+ applicationIndex: 'application-index',
940
+ logs: 'logs',
941
+ txid: 'txId',
942
+ };
943
+ }
944
+
945
+ // eslint-disable-next-line camelcase
946
+ static from_obj_for_encoding(data: Record<string, any>): AppCallLogs {
947
+ /* eslint-disable dot-notation */
948
+ if (typeof data['application-index'] === 'undefined')
949
+ throw new Error(
950
+ `Response is missing required field 'application-index': ${data}`
951
+ );
952
+ if (!Array.isArray(data['logs']))
953
+ throw new Error(
954
+ `Response is missing required array field 'logs': ${data}`
955
+ );
956
+ if (typeof data['txId'] === 'undefined')
957
+ throw new Error(`Response is missing required field 'txId': ${data}`);
958
+ return new AppCallLogs({
959
+ applicationIndex: data['application-index'],
960
+ logs: data['logs'],
961
+ txid: data['txId'],
962
+ });
963
+ /* eslint-enable dot-notation */
964
+ }
965
+ }
966
+
736
967
  /**
737
968
  * Application index and its parameters
738
969
  */
@@ -1867,6 +2098,45 @@ export class BlockHashResponse extends BaseModel {
1867
2098
  }
1868
2099
  }
1869
2100
 
2101
+ /**
2102
+ * All logs emitted in the given round. Each app call, whether top-level or inner,
2103
+ * that contains logs results in a separate AppCallLogs object. Therefore there may
2104
+ * be multiple AppCallLogs with the same application ID and outer transaction ID in
2105
+ * the event of multiple inner app calls to the same app. App calls with no logs
2106
+ * are not included in the response. AppCallLogs are returned in the same order
2107
+ * that their corresponding app call appeared in the block (pre-order traversal of
2108
+ * inner app calls)
2109
+ */
2110
+ export class BlockLogsResponse extends BaseModel {
2111
+ public logs: AppCallLogs[];
2112
+
2113
+ /**
2114
+ * Creates a new `BlockLogsResponse` object.
2115
+ * @param logs -
2116
+ */
2117
+ constructor({ logs }: { logs: AppCallLogs[] }) {
2118
+ super();
2119
+ this.logs = logs;
2120
+
2121
+ this.attribute_map = {
2122
+ logs: 'logs',
2123
+ };
2124
+ }
2125
+
2126
+ // eslint-disable-next-line camelcase
2127
+ static from_obj_for_encoding(data: Record<string, any>): BlockLogsResponse {
2128
+ /* eslint-disable dot-notation */
2129
+ if (!Array.isArray(data['logs']))
2130
+ throw new Error(
2131
+ `Response is missing required array field 'logs': ${data}`
2132
+ );
2133
+ return new BlockLogsResponse({
2134
+ logs: data['logs'].map(AppCallLogs.from_obj_for_encoding),
2135
+ });
2136
+ /* eslint-enable dot-notation */
2137
+ }
2138
+ }
2139
+
1870
2140
  /**
1871
2141
  * Encoded block object.
1872
2142
  */
@@ -4931,6 +5201,19 @@ export class SimulationTransactionExecTrace extends BaseModel {
4931
5201
  */
4932
5202
  public clearStateProgramTrace?: SimulationOpcodeTraceUnit[];
4933
5203
 
5204
+ /**
5205
+ * If true, indicates that the clear state program failed and any persistent state
5206
+ * changes it produced should be reverted once the program exits.
5207
+ */
5208
+ public clearStateRollback?: boolean;
5209
+
5210
+ /**
5211
+ * The error message explaining why the clear state program failed. This field will
5212
+ * only be populated if clear-state-rollback is true and the failure was due to an
5213
+ * execution error.
5214
+ */
5215
+ public clearStateRollbackError?: string;
5216
+
4934
5217
  /**
4935
5218
  * An array of SimulationTransactionExecTrace representing the execution trace of
4936
5219
  * any inner transactions executed.
@@ -4953,6 +5236,11 @@ export class SimulationTransactionExecTrace extends BaseModel {
4953
5236
  * @param approvalProgramTrace - Program trace that contains a trace of opcode effects in an approval program.
4954
5237
  * @param clearStateProgramHash - SHA512_256 hash digest of the clear state program executed in transaction.
4955
5238
  * @param clearStateProgramTrace - Program trace that contains a trace of opcode effects in a clear state program.
5239
+ * @param clearStateRollback - If true, indicates that the clear state program failed and any persistent state
5240
+ * changes it produced should be reverted once the program exits.
5241
+ * @param clearStateRollbackError - The error message explaining why the clear state program failed. This field will
5242
+ * only be populated if clear-state-rollback is true and the failure was due to an
5243
+ * execution error.
4956
5244
  * @param innerTrace - An array of SimulationTransactionExecTrace representing the execution trace of
4957
5245
  * any inner transactions executed.
4958
5246
  * @param logicSigHash - SHA512_256 hash digest of the logic sig executed in transaction.
@@ -4963,6 +5251,8 @@ export class SimulationTransactionExecTrace extends BaseModel {
4963
5251
  approvalProgramTrace,
4964
5252
  clearStateProgramHash,
4965
5253
  clearStateProgramTrace,
5254
+ clearStateRollback,
5255
+ clearStateRollbackError,
4966
5256
  innerTrace,
4967
5257
  logicSigHash,
4968
5258
  logicSigTrace,
@@ -4971,6 +5261,8 @@ export class SimulationTransactionExecTrace extends BaseModel {
4971
5261
  approvalProgramTrace?: SimulationOpcodeTraceUnit[];
4972
5262
  clearStateProgramHash?: string | Uint8Array;
4973
5263
  clearStateProgramTrace?: SimulationOpcodeTraceUnit[];
5264
+ clearStateRollback?: boolean;
5265
+ clearStateRollbackError?: string;
4974
5266
  innerTrace?: SimulationTransactionExecTrace[];
4975
5267
  logicSigHash?: string | Uint8Array;
4976
5268
  logicSigTrace?: SimulationOpcodeTraceUnit[];
@@ -4986,6 +5278,8 @@ export class SimulationTransactionExecTrace extends BaseModel {
4986
5278
  ? new Uint8Array(Buffer.from(clearStateProgramHash, 'base64'))
4987
5279
  : clearStateProgramHash;
4988
5280
  this.clearStateProgramTrace = clearStateProgramTrace;
5281
+ this.clearStateRollback = clearStateRollback;
5282
+ this.clearStateRollbackError = clearStateRollbackError;
4989
5283
  this.innerTrace = innerTrace;
4990
5284
  this.logicSigHash =
4991
5285
  typeof logicSigHash === 'string'
@@ -4998,6 +5292,8 @@ export class SimulationTransactionExecTrace extends BaseModel {
4998
5292
  approvalProgramTrace: 'approval-program-trace',
4999
5293
  clearStateProgramHash: 'clear-state-program-hash',
5000
5294
  clearStateProgramTrace: 'clear-state-program-trace',
5295
+ clearStateRollback: 'clear-state-rollback',
5296
+ clearStateRollbackError: 'clear-state-rollback-error',
5001
5297
  innerTrace: 'inner-trace',
5002
5298
  logicSigHash: 'logic-sig-hash',
5003
5299
  logicSigTrace: 'logic-sig-trace',
@@ -5024,6 +5320,8 @@ export class SimulationTransactionExecTrace extends BaseModel {
5024
5320
  SimulationOpcodeTraceUnit.from_obj_for_encoding
5025
5321
  )
5026
5322
  : undefined,
5323
+ clearStateRollback: data['clear-state-rollback'],
5324
+ clearStateRollbackError: data['clear-state-rollback-error'],
5027
5325
  innerTrace:
5028
5326
  typeof data['inner-trace'] !== 'undefined'
5029
5327
  ? data['inner-trace'].map(