algosdk 3.0.0-beta.2 → 3.1.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 (34) hide show
  1. package/README.md +4 -4
  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/models/types.js +43 -2
  5. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  6. package/dist/cjs/client/v2/indexer/models/types.js +227 -3
  7. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  8. package/dist/cjs/heartbeat.js +119 -0
  9. package/dist/cjs/heartbeat.js.map +1 -0
  10. package/dist/cjs/transaction.js +36 -0
  11. package/dist/cjs/transaction.js.map +1 -1
  12. package/dist/cjs/types/transactions/base.js +6 -1
  13. package/dist/cjs/types/transactions/base.js.map +1 -1
  14. package/dist/esm/client/v2/algod/models/types.js +40 -0
  15. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  16. package/dist/esm/client/v2/indexer/models/types.js +222 -1
  17. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  18. package/dist/esm/heartbeat.js +114 -0
  19. package/dist/esm/heartbeat.js.map +1 -0
  20. package/dist/esm/transaction.js +36 -0
  21. package/dist/esm/transaction.js.map +1 -1
  22. package/dist/esm/types/transactions/base.js +6 -1
  23. package/dist/esm/types/transactions/base.js.map +1 -1
  24. package/dist/types/client/v2/algod/models/types.d.ts +21 -0
  25. package/dist/types/client/v2/indexer/models/types.d.ts +146 -1
  26. package/dist/types/heartbeat.d.ts +39 -0
  27. package/dist/types/transaction.d.ts +9 -0
  28. package/dist/types/types/transactions/base.d.ts +32 -1
  29. package/package.json +1 -1
  30. package/src/client/v2/algod/models/types.ts +52 -0
  31. package/src/client/v2/indexer/models/types.ts +375 -0
  32. package/src/heartbeat.ts +168 -0
  33. package/src/transaction.ts +46 -0
  34. package/src/types/transactions/base.ts +43 -1
@@ -3,8 +3,8 @@
3
3
  * NOTICE: This file was generated. Editing this file manually is not recommended.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TransactionAssetConfig = exports.TransactionApplication = exports.Transaction = exports.TealValue = exports.TealKeyValue = exports.StateSchema = exports.StateProofVerifier = exports.StateProofTracking = exports.StateProofSignature = exports.StateProofSigSlot = exports.StateProofReveal = exports.StateProofParticipant = exports.StateProofFields = exports.ParticipationUpdates = exports.MiniAssetHolding = exports.MerkleArrayProof = exports.IndexerStateProofMessage = exports.HealthCheck = exports.HashFactory = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.BoxesResponse = exports.BoxDescriptor = exports.Box = exports.BlockUpgradeVote = exports.BlockUpgradeState = exports.BlockRewards = exports.Block = exports.AssetsResponse = exports.AssetResponse = exports.AssetParams = exports.AssetHoldingsResponse = exports.AssetHolding = exports.AssetBalancesResponse = exports.Asset = exports.ApplicationsResponse = exports.ApplicationStateSchema = exports.ApplicationResponse = exports.ApplicationParams = exports.ApplicationLogsResponse = exports.ApplicationLogData = exports.ApplicationLocalStatesResponse = exports.ApplicationLocalState = exports.Application = exports.AccountsResponse = exports.AccountStateDelta = exports.AccountResponse = exports.AccountParticipation = exports.Account = void 0;
7
- exports.TransactionsResponse = exports.TransactionStateProof = exports.TransactionSignatureMultisigSubsignature = exports.TransactionSignatureMultisig = exports.TransactionSignatureLogicsig = exports.TransactionSignature = exports.TransactionResponse = exports.TransactionPayment = exports.TransactionKeyreg = exports.TransactionAssetTransfer = exports.TransactionAssetFreeze = void 0;
6
+ exports.Transaction = exports.TealValue = exports.TealKeyValue = exports.StateSchema = exports.StateProofVerifier = exports.StateProofTracking = exports.StateProofSignature = exports.StateProofSigSlot = exports.StateProofReveal = exports.StateProofParticipant = exports.StateProofFields = exports.ParticipationUpdates = exports.MiniAssetHolding = exports.MerkleArrayProof = exports.IndexerStateProofMessage = exports.HealthCheck = exports.HbProofFields = exports.HashFactory = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.BoxesResponse = exports.BoxDescriptor = exports.Box = exports.BlockUpgradeVote = exports.BlockUpgradeState = exports.BlockRewards = exports.BlockHeadersResponse = exports.Block = exports.AssetsResponse = exports.AssetResponse = exports.AssetParams = exports.AssetHoldingsResponse = exports.AssetHolding = exports.AssetBalancesResponse = exports.Asset = exports.ApplicationsResponse = exports.ApplicationStateSchema = exports.ApplicationResponse = exports.ApplicationParams = exports.ApplicationLogsResponse = exports.ApplicationLogData = exports.ApplicationLocalStatesResponse = exports.ApplicationLocalState = exports.Application = exports.AccountsResponse = exports.AccountStateDelta = exports.AccountResponse = exports.AccountParticipation = exports.Account = void 0;
7
+ exports.TransactionsResponse = exports.TransactionStateProof = exports.TransactionSignatureMultisigSubsignature = exports.TransactionSignatureMultisig = exports.TransactionSignatureLogicsig = exports.TransactionSignature = exports.TransactionResponse = exports.TransactionPayment = exports.TransactionKeyreg = exports.TransactionHeartbeat = exports.TransactionAssetTransfer = exports.TransactionAssetFreeze = exports.TransactionAssetConfig = exports.TransactionApplication = void 0;
8
8
  /* eslint-disable no-use-before-define */
9
9
  const utils_js_1 = require("../../../../utils/utils.js");
10
10
  const index_js_1 = require("../../../../encoding/schema/index.js");
@@ -2037,6 +2037,64 @@ class Block {
2037
2037
  }
2038
2038
  }
2039
2039
  exports.Block = Block;
2040
+ /**
2041
+ *
2042
+ */
2043
+ class BlockHeadersResponse {
2044
+ static get encodingSchema() {
2045
+ if (!this.encodingSchemaValue) {
2046
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
2047
+ this.encodingSchemaValue.pushEntries({
2048
+ key: 'blocks',
2049
+ valueSchema: new index_js_1.ArraySchema(Block.encodingSchema),
2050
+ omitEmpty: true,
2051
+ }, {
2052
+ key: 'current-round',
2053
+ valueSchema: new index_js_1.Uint64Schema(),
2054
+ omitEmpty: true,
2055
+ }, {
2056
+ key: 'next-token',
2057
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
2058
+ omitEmpty: true,
2059
+ });
2060
+ }
2061
+ return this.encodingSchemaValue;
2062
+ }
2063
+ /**
2064
+ * Creates a new `BlockHeadersResponse` object.
2065
+ * @param blocks -
2066
+ * @param currentRound - Round at which the results were computed.
2067
+ * @param nextToken - Used for pagination, when making another request provide this token with the
2068
+ * next parameter.
2069
+ */
2070
+ constructor({ blocks, currentRound, nextToken, }) {
2071
+ this.blocks = blocks;
2072
+ this.currentRound = (0, utils_js_1.ensureBigInt)(currentRound);
2073
+ this.nextToken = nextToken;
2074
+ }
2075
+ // eslint-disable-next-line class-methods-use-this
2076
+ getEncodingSchema() {
2077
+ return BlockHeadersResponse.encodingSchema;
2078
+ }
2079
+ toEncodingData() {
2080
+ return new Map([
2081
+ ['blocks', this.blocks.map((v) => v.toEncodingData())],
2082
+ ['current-round', this.currentRound],
2083
+ ['next-token', this.nextToken],
2084
+ ]);
2085
+ }
2086
+ static fromEncodingData(data) {
2087
+ if (!(data instanceof Map)) {
2088
+ throw new Error(`Invalid decoded BlockHeadersResponse: ${data}`);
2089
+ }
2090
+ return new BlockHeadersResponse({
2091
+ blocks: (data.get('blocks') ?? []).map((v) => Block.fromEncodingData(v)),
2092
+ currentRound: data.get('current-round'),
2093
+ nextToken: data.get('next-token'),
2094
+ });
2095
+ }
2096
+ }
2097
+ exports.BlockHeadersResponse = BlockHeadersResponse;
2040
2098
  /**
2041
2099
  * Fields relating to rewards,
2042
2100
  */
@@ -2587,6 +2645,84 @@ class HashFactory {
2587
2645
  }
2588
2646
  }
2589
2647
  exports.HashFactory = HashFactory;
2648
+ /**
2649
+ * (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
2650
+ * it is online.
2651
+ */
2652
+ class HbProofFields {
2653
+ static get encodingSchema() {
2654
+ if (!this.encodingSchemaValue) {
2655
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
2656
+ this.encodingSchemaValue.pushEntries({
2657
+ key: 'hb-pk',
2658
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
2659
+ omitEmpty: true,
2660
+ }, {
2661
+ key: 'hb-pk1sig',
2662
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
2663
+ omitEmpty: true,
2664
+ }, {
2665
+ key: 'hb-pk2',
2666
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
2667
+ omitEmpty: true,
2668
+ }, {
2669
+ key: 'hb-pk2sig',
2670
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
2671
+ omitEmpty: true,
2672
+ }, {
2673
+ key: 'hb-sig',
2674
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
2675
+ omitEmpty: true,
2676
+ });
2677
+ }
2678
+ return this.encodingSchemaValue;
2679
+ }
2680
+ /**
2681
+ * Creates a new `HbProofFields` object.
2682
+ * @param hbPk - (p) Public key of the heartbeat message.
2683
+ * @param hbPk1sig - (p1s) Signature of OneTimeSignatureSubkeyOffsetID(PK, Batch, Offset) under the
2684
+ * key PK2.
2685
+ * @param hbPk2 - (p2) Key for new-style two-level ephemeral signature.
2686
+ * @param hbPk2sig - (p2s) Signature of OneTimeSignatureSubkeyBatchID(PK2, Batch) under the master
2687
+ * key (OneTimeSignatureVerifier).
2688
+ * @param hbSig - (s) Signature of the heartbeat message.
2689
+ */
2690
+ constructor({ hbPk, hbPk1sig, hbPk2, hbPk2sig, hbSig, }) {
2691
+ this.hbPk = typeof hbPk === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbPk) : hbPk;
2692
+ this.hbPk1sig =
2693
+ typeof hbPk1sig === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbPk1sig) : hbPk1sig;
2694
+ this.hbPk2 = typeof hbPk2 === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbPk2) : hbPk2;
2695
+ this.hbPk2sig =
2696
+ typeof hbPk2sig === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbPk2sig) : hbPk2sig;
2697
+ this.hbSig = typeof hbSig === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbSig) : hbSig;
2698
+ }
2699
+ // eslint-disable-next-line class-methods-use-this
2700
+ getEncodingSchema() {
2701
+ return HbProofFields.encodingSchema;
2702
+ }
2703
+ toEncodingData() {
2704
+ return new Map([
2705
+ ['hb-pk', this.hbPk],
2706
+ ['hb-pk1sig', this.hbPk1sig],
2707
+ ['hb-pk2', this.hbPk2],
2708
+ ['hb-pk2sig', this.hbPk2sig],
2709
+ ['hb-sig', this.hbSig],
2710
+ ]);
2711
+ }
2712
+ static fromEncodingData(data) {
2713
+ if (!(data instanceof Map)) {
2714
+ throw new Error(`Invalid decoded HbProofFields: ${data}`);
2715
+ }
2716
+ return new HbProofFields({
2717
+ hbPk: data.get('hb-pk'),
2718
+ hbPk1sig: data.get('hb-pk1sig'),
2719
+ hbPk2: data.get('hb-pk2'),
2720
+ hbPk2sig: data.get('hb-pk2sig'),
2721
+ hbSig: data.get('hb-sig'),
2722
+ });
2723
+ }
2724
+ }
2725
+ exports.HbProofFields = HbProofFields;
2590
2726
  /**
2591
2727
  * A health check response.
2592
2728
  */
@@ -3655,6 +3791,10 @@ class Transaction {
3655
3791
  key: 'group',
3656
3792
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
3657
3793
  omitEmpty: true,
3794
+ }, {
3795
+ key: 'heartbeat-transaction',
3796
+ valueSchema: new index_js_1.OptionalSchema(TransactionHeartbeat.encodingSchema),
3797
+ omitEmpty: true,
3658
3798
  }, {
3659
3799
  key: 'id',
3660
3800
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
@@ -3759,6 +3899,9 @@ class Transaction {
3759
3899
  * @param group - (grp) Base64 encoded byte array of a sha512/256 digest. When present indicates
3760
3900
  * that this transaction is part of a transaction group and the value is the
3761
3901
  * sha512/256 hash of the transactions in that group.
3902
+ * @param heartbeatTransaction - Fields for a heartbeat transaction.
3903
+ * Definition:
3904
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
3762
3905
  * @param id - Transaction ID
3763
3906
  * @param innerTxns - Inner transactions produced by application execution.
3764
3907
  * @param intraRoundOffset - Offset into the round where this transaction was confirmed.
@@ -3798,8 +3941,9 @@ class Transaction {
3798
3941
  * * (afrz) asset-freeze-transaction
3799
3942
  * * (appl) application-transaction
3800
3943
  * * (stpf) state-proof-transaction
3944
+ * * (hb) heartbeat-transaction
3801
3945
  */
3802
- constructor({ fee, firstValid, lastValid, sender, applicationTransaction, assetConfigTransaction, assetFreezeTransaction, assetTransferTransaction, authAddr, closeRewards, closingAmount, confirmedRound, createdApplicationIndex, createdAssetIndex, genesisHash, genesisId, globalStateDelta, group, id, innerTxns, intraRoundOffset, keyregTransaction, lease, localStateDelta, logs, note, paymentTransaction, receiverRewards, rekeyTo, roundTime, senderRewards, signature, stateProofTransaction, txType, }) {
3946
+ constructor({ fee, firstValid, lastValid, sender, applicationTransaction, assetConfigTransaction, assetFreezeTransaction, assetTransferTransaction, authAddr, closeRewards, closingAmount, confirmedRound, createdApplicationIndex, createdAssetIndex, genesisHash, genesisId, globalStateDelta, group, heartbeatTransaction, id, innerTxns, intraRoundOffset, keyregTransaction, lease, localStateDelta, logs, note, paymentTransaction, receiverRewards, rekeyTo, roundTime, senderRewards, signature, stateProofTransaction, txType, }) {
3803
3947
  this.fee = (0, utils_js_1.ensureBigInt)(fee);
3804
3948
  this.firstValid = (0, utils_js_1.ensureBigInt)(firstValid);
3805
3949
  this.lastValid = (0, utils_js_1.ensureBigInt)(lastValid);
@@ -3837,6 +3981,7 @@ class Transaction {
3837
3981
  this.genesisId = genesisId;
3838
3982
  this.globalStateDelta = globalStateDelta;
3839
3983
  this.group = typeof group === 'string' ? (0, binarydata_js_1.base64ToBytes)(group) : group;
3984
+ this.heartbeatTransaction = heartbeatTransaction;
3840
3985
  this.id = id;
3841
3986
  this.innerTxns = innerTxns;
3842
3987
  this.intraRoundOffset =
@@ -3921,6 +4066,12 @@ class Transaction {
3921
4066
  : undefined,
3922
4067
  ],
3923
4068
  ['group', this.group],
4069
+ [
4070
+ 'heartbeat-transaction',
4071
+ typeof this.heartbeatTransaction !== 'undefined'
4072
+ ? this.heartbeatTransaction.toEncodingData()
4073
+ : undefined,
4074
+ ],
3924
4075
  ['id', this.id],
3925
4076
  [
3926
4077
  'inner-txns',
@@ -4009,6 +4160,9 @@ class Transaction {
4009
4160
  .map((v) => EvalDeltaKeyValue.fromEncodingData(v))
4010
4161
  : undefined,
4011
4162
  group: data.get('group'),
4163
+ heartbeatTransaction: typeof data.get('heartbeat-transaction') !== 'undefined'
4164
+ ? TransactionHeartbeat.fromEncodingData(data.get('heartbeat-transaction'))
4165
+ : undefined,
4012
4166
  id: data.get('id'),
4013
4167
  innerTxns: typeof data.get('inner-txns') !== 'undefined'
4014
4168
  ? data
@@ -4424,6 +4578,76 @@ class TransactionAssetTransfer {
4424
4578
  }
4425
4579
  }
4426
4580
  exports.TransactionAssetTransfer = TransactionAssetTransfer;
4581
+ /**
4582
+ * Fields for a heartbeat transaction.
4583
+ * Definition:
4584
+ * data/transactions/heartbeat.go : HeartbeatTxnFields
4585
+ */
4586
+ class TransactionHeartbeat {
4587
+ static get encodingSchema() {
4588
+ if (!this.encodingSchemaValue) {
4589
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
4590
+ this.encodingSchemaValue.pushEntries({ key: 'hb-address', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, {
4591
+ key: 'hb-key-dilution',
4592
+ valueSchema: new index_js_1.Uint64Schema(),
4593
+ omitEmpty: true,
4594
+ }, {
4595
+ key: 'hb-proof',
4596
+ valueSchema: HbProofFields.encodingSchema,
4597
+ omitEmpty: true,
4598
+ }, { key: 'hb-seed', valueSchema: new index_js_1.ByteArraySchema(), omitEmpty: true }, {
4599
+ key: 'hb-vote-id',
4600
+ valueSchema: new index_js_1.ByteArraySchema(),
4601
+ omitEmpty: true,
4602
+ });
4603
+ }
4604
+ return this.encodingSchemaValue;
4605
+ }
4606
+ /**
4607
+ * Creates a new `TransactionHeartbeat` object.
4608
+ * @param hbAddress - (hbad) HbAddress is the account this txn is proving onlineness for.
4609
+ * @param hbKeyDilution - (hbkd) HbKeyDilution must match HbAddress account's current KeyDilution.
4610
+ * @param hbProof - (hbprf) HbProof is a signature using HeartbeatAddress's partkey, thereby showing
4611
+ * it is online.
4612
+ * @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
4613
+ * block.
4614
+ * @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
4615
+ */
4616
+ constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, }) {
4617
+ this.hbAddress = hbAddress;
4618
+ this.hbKeyDilution = (0, utils_js_1.ensureBigInt)(hbKeyDilution);
4619
+ this.hbProof = hbProof;
4620
+ this.hbSeed = typeof hbSeed === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbSeed) : hbSeed;
4621
+ this.hbVoteId =
4622
+ typeof hbVoteId === 'string' ? (0, binarydata_js_1.base64ToBytes)(hbVoteId) : hbVoteId;
4623
+ }
4624
+ // eslint-disable-next-line class-methods-use-this
4625
+ getEncodingSchema() {
4626
+ return TransactionHeartbeat.encodingSchema;
4627
+ }
4628
+ toEncodingData() {
4629
+ return new Map([
4630
+ ['hb-address', this.hbAddress],
4631
+ ['hb-key-dilution', this.hbKeyDilution],
4632
+ ['hb-proof', this.hbProof.toEncodingData()],
4633
+ ['hb-seed', this.hbSeed],
4634
+ ['hb-vote-id', this.hbVoteId],
4635
+ ]);
4636
+ }
4637
+ static fromEncodingData(data) {
4638
+ if (!(data instanceof Map)) {
4639
+ throw new Error(`Invalid decoded TransactionHeartbeat: ${data}`);
4640
+ }
4641
+ return new TransactionHeartbeat({
4642
+ hbAddress: data.get('hb-address'),
4643
+ hbKeyDilution: data.get('hb-key-dilution'),
4644
+ hbProof: HbProofFields.fromEncodingData(data.get('hb-proof') ?? new Map()),
4645
+ hbSeed: data.get('hb-seed'),
4646
+ hbVoteId: data.get('hb-vote-id'),
4647
+ });
4648
+ }
4649
+ }
4650
+ exports.TransactionHeartbeat = TransactionHeartbeat;
4427
4651
  /**
4428
4652
  * Fields for a keyreg transaction.
4429
4653
  * Definition: