algosdk 3.7.0-beta.1 → 3.7.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 (73) 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/appAccess.js +4 -0
  5. package/dist/cjs/appAccess.js.map +1 -1
  6. package/dist/cjs/client/v2/algod/models/types.js +153 -5
  7. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  8. package/dist/cjs/client/v2/indexer/models/types.js +163 -12
  9. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  10. package/dist/cjs/composer.js +4 -6
  11. package/dist/cjs/composer.js.map +1 -1
  12. package/dist/cjs/falcon-signer.js.map +1 -1
  13. package/dist/cjs/heartbeat.js +7 -0
  14. package/dist/cjs/heartbeat.js.map +1 -1
  15. package/dist/cjs/makeTxn.js +11 -2
  16. package/dist/cjs/makeTxn.js.map +1 -1
  17. package/dist/cjs/pq-signer.js +26 -0
  18. package/dist/cjs/pq-signer.js.map +1 -1
  19. package/dist/cjs/signer.js.map +1 -1
  20. package/dist/cjs/transaction.js +8 -0
  21. package/dist/cjs/transaction.js.map +1 -1
  22. package/dist/cjs/types/statedelta.js +17 -0
  23. package/dist/cjs/types/statedelta.js.map +1 -1
  24. package/dist/cjs/utils/utils.js +14 -1
  25. package/dist/cjs/utils/utils.js.map +1 -1
  26. package/dist/esm/appAccess.js +4 -0
  27. package/dist/esm/appAccess.js.map +1 -1
  28. package/dist/esm/client/v2/algod/models/types.js +149 -3
  29. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  30. package/dist/esm/client/v2/indexer/models/types.js +161 -11
  31. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  32. package/dist/esm/composer.js +4 -6
  33. package/dist/esm/composer.js.map +1 -1
  34. package/dist/esm/falcon-signer.js.map +1 -1
  35. package/dist/esm/heartbeat.js +8 -1
  36. package/dist/esm/heartbeat.js.map +1 -1
  37. package/dist/esm/makeTxn.js +11 -2
  38. package/dist/esm/makeTxn.js.map +1 -1
  39. package/dist/esm/pq-signer.js +26 -0
  40. package/dist/esm/pq-signer.js.map +1 -1
  41. package/dist/esm/signer.js.map +1 -1
  42. package/dist/esm/transaction.js +8 -0
  43. package/dist/esm/transaction.js.map +1 -1
  44. package/dist/esm/types/statedelta.js +17 -0
  45. package/dist/esm/types/statedelta.js.map +1 -1
  46. package/dist/esm/utils/utils.js +12 -0
  47. package/dist/esm/utils/utils.js.map +1 -1
  48. package/dist/types/client/v2/algod/models/types.d.ts +90 -3
  49. package/dist/types/client/v2/indexer/models/types.d.ts +114 -7
  50. package/dist/types/composer.d.ts +3 -3
  51. package/dist/types/falcon-signer.d.ts +2 -2
  52. package/dist/types/heartbeat.d.ts +2 -0
  53. package/dist/types/makeTxn.d.ts +8 -2
  54. package/dist/types/pq-signer.d.ts +2 -2
  55. package/dist/types/signer.d.ts +8 -0
  56. package/dist/types/transaction.d.ts +1 -0
  57. package/dist/types/types/statedelta.d.ts +18 -0
  58. package/dist/types/types/transactions/base.d.ts +10 -0
  59. package/dist/types/utils/utils.d.ts +1 -0
  60. package/package.json +2 -2
  61. package/src/appAccess.ts +5 -0
  62. package/src/client/v2/algod/models/types.ts +234 -0
  63. package/src/client/v2/indexer/models/types.ts +280 -8
  64. package/src/composer.ts +7 -11
  65. package/src/falcon-signer.ts +4 -1
  66. package/src/heartbeat.ts +11 -0
  67. package/src/makeTxn.ts +13 -4
  68. package/src/pq-signer.ts +34 -1
  69. package/src/signer.ts +9 -0
  70. package/src/transaction.ts +10 -0
  71. package/src/types/statedelta.ts +34 -0
  72. package/src/types/transactions/base.ts +11 -0
  73. package/src/utils/utils.ts +13 -0
@@ -176,6 +176,7 @@ export class Account {
176
176
  * * sig
177
177
  * * msig
178
178
  * * lsig
179
+ * * pqsig
179
180
  * * or null if unknown
180
181
  */
181
182
  constructor({ address, amount, amountWithoutPendingRewards, minBalance, pendingRewards, rewards, round, status, totalAppsOptedIn, totalAssetsOptedIn, totalBoxBytes, totalBoxes, totalCreatedApps, totalCreatedAssets, appsLocalState, appsTotalExtraPages, appsTotalSchema, assets, authAddr, closedAtRound, createdApps, createdAssets, createdAtRound, deleted, incentiveEligible, lastHeartbeat, lastProposed, participation, rewardBase, sigType, }) {
@@ -1793,10 +1794,18 @@ export class Block {
1793
1794
  key: 'bonus',
1794
1795
  valueSchema: new OptionalSchema(new Uint64Schema()),
1795
1796
  omitEmpty: true,
1797
+ }, {
1798
+ key: 'congestion-tax',
1799
+ valueSchema: new OptionalSchema(new Uint64Schema()),
1800
+ omitEmpty: true,
1796
1801
  }, {
1797
1802
  key: 'fees-collected',
1798
1803
  valueSchema: new OptionalSchema(new Uint64Schema()),
1799
1804
  omitEmpty: true,
1805
+ }, {
1806
+ key: 'load',
1807
+ valueSchema: new OptionalSchema(new Uint64Schema()),
1808
+ omitEmpty: true,
1800
1809
  }, {
1801
1810
  key: 'participation-updates',
1802
1811
  valueSchema: new OptionalSchema(ParticipationUpdates.encodingSchema),
@@ -1864,7 +1873,12 @@ export class Block {
1864
1873
  * the default SHA512_256. This commitment can be used on environments where only
1865
1874
  * the SHA256 function exists.
1866
1875
  * @param bonus - the potential bonus payout for this block.
1876
+ * @param congestionTax - the fee required, beyond the minimum fee, for "normal" transactions in this
1877
+ * block.
1867
1878
  * @param feesCollected - the sum of all fees paid by transactions in this block.
1879
+ * @param load - the degree to which this block is full, based on the number of bytes in the
1880
+ * final block compared to the maximum allowed. Expressed as a fixed-point integer
1881
+ * with 6 digits of precision, so 1,000,000 is a completely full block.
1868
1882
  * @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
1869
1883
  * @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
1870
1884
  * @param proposer - the proposer of this block.
@@ -1883,7 +1897,7 @@ export class Block {
1883
1897
  * @param upgradeState - Fields relating to a protocol upgrade.
1884
1898
  * @param upgradeVote - Fields relating to voting for a protocol upgrade.
1885
1899
  */
1886
- constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, feesCollected, participationUpdates, previousBlockHash512, proposer, proposerPayout, rewards, stateProofTracking, transactions, transactionsRootSha512, txnCounter, upgradeState, upgradeVote, }) {
1900
+ constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, congestionTax, feesCollected, load, participationUpdates, previousBlockHash512, proposer, proposerPayout, rewards, stateProofTracking, transactions, transactionsRootSha512, txnCounter, upgradeState, upgradeVote, }) {
1887
1901
  this.genesisHash =
1888
1902
  typeof genesisHash === 'string'
1889
1903
  ? base64ToBytes(genesisHash)
@@ -1906,10 +1920,16 @@ export class Block {
1906
1920
  : transactionsRootSha256;
1907
1921
  this.bonus =
1908
1922
  typeof bonus === 'undefined' ? undefined : ensureSafeInteger(bonus);
1923
+ this.congestionTax =
1924
+ typeof congestionTax === 'undefined'
1925
+ ? undefined
1926
+ : ensureSafeInteger(congestionTax);
1909
1927
  this.feesCollected =
1910
1928
  typeof feesCollected === 'undefined'
1911
1929
  ? undefined
1912
1930
  : ensureSafeInteger(feesCollected);
1931
+ this.load =
1932
+ typeof load === 'undefined' ? undefined : ensureSafeInteger(load);
1913
1933
  this.participationUpdates = participationUpdates;
1914
1934
  this.previousBlockHash512 =
1915
1935
  typeof previousBlockHash512 === 'string'
@@ -1950,7 +1970,9 @@ export class Block {
1950
1970
  ['transactions-root', this.transactionsRoot],
1951
1971
  ['transactions-root-sha256', this.transactionsRootSha256],
1952
1972
  ['bonus', this.bonus],
1973
+ ['congestion-tax', this.congestionTax],
1953
1974
  ['fees-collected', this.feesCollected],
1975
+ ['load', this.load],
1954
1976
  [
1955
1977
  'participation-updates',
1956
1978
  typeof this.participationUpdates !== 'undefined'
@@ -2013,7 +2035,9 @@ export class Block {
2013
2035
  transactionsRoot: data.get('transactions-root'),
2014
2036
  transactionsRootSha256: data.get('transactions-root-sha256'),
2015
2037
  bonus: data.get('bonus'),
2038
+ congestionTax: data.get('congestion-tax'),
2016
2039
  feesCollected: data.get('fees-collected'),
2040
+ load: data.get('load'),
2017
2041
  participationUpdates: typeof data.get('participation-updates') !== 'undefined'
2018
2042
  ? ParticipationUpdates.fromEncodingData(data.get('participation-updates'))
2019
2043
  : undefined,
@@ -2368,15 +2392,15 @@ export class Box {
2368
2392
  }
2369
2393
  }
2370
2394
  /**
2371
- * Box descriptor describes an app box without a value.
2395
+ * Box descriptor describes an app box.
2372
2396
  */
2373
2397
  export class BoxDescriptor {
2374
2398
  static get encodingSchema() {
2375
2399
  if (!this.encodingSchemaValue) {
2376
2400
  this.encodingSchemaValue = new NamedMapSchema([]);
2377
- this.encodingSchemaValue.pushEntries({
2378
- key: 'name',
2379
- valueSchema: new ByteArraySchema(),
2401
+ this.encodingSchemaValue.pushEntries({ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }, {
2402
+ key: 'value',
2403
+ valueSchema: new OptionalSchema(new ByteArraySchema()),
2380
2404
  omitEmpty: true,
2381
2405
  });
2382
2406
  }
@@ -2385,16 +2409,22 @@ export class BoxDescriptor {
2385
2409
  /**
2386
2410
  * Creates a new `BoxDescriptor` object.
2387
2411
  * @param name - Base64 encoded box name
2412
+ * @param value - Base64 encoded box value. Present only when the `values` query parameter is set
2413
+ * to true.
2388
2414
  */
2389
- constructor({ name }) {
2415
+ constructor({ name, value, }) {
2390
2416
  this.name = typeof name === 'string' ? base64ToBytes(name) : name;
2417
+ this.value = typeof value === 'string' ? base64ToBytes(value) : value;
2391
2418
  }
2392
2419
  // eslint-disable-next-line class-methods-use-this
2393
2420
  getEncodingSchema() {
2394
2421
  return BoxDescriptor.encodingSchema;
2395
2422
  }
2396
2423
  toEncodingData() {
2397
- return new Map([['name', this.name]]);
2424
+ return new Map([
2425
+ ['name', this.name],
2426
+ ['value', this.value],
2427
+ ]);
2398
2428
  }
2399
2429
  static fromEncodingData(data) {
2400
2430
  if (!(data instanceof Map)) {
@@ -2402,6 +2432,7 @@ export class BoxDescriptor {
2402
2432
  }
2403
2433
  return new BoxDescriptor({
2404
2434
  name: data.get('name'),
2435
+ value: data.get('value'),
2405
2436
  });
2406
2437
  }
2407
2438
  }
@@ -2465,6 +2496,10 @@ export class BoxesResponse {
2465
2496
  key: 'next-token',
2466
2497
  valueSchema: new OptionalSchema(new StringSchema()),
2467
2498
  omitEmpty: true,
2499
+ }, {
2500
+ key: 'round',
2501
+ valueSchema: new OptionalSchema(new Uint64Schema()),
2502
+ omitEmpty: true,
2468
2503
  });
2469
2504
  }
2470
2505
  return this.encodingSchemaValue;
@@ -2475,11 +2510,14 @@ export class BoxesResponse {
2475
2510
  * @param boxes -
2476
2511
  * @param nextToken - Used for pagination, when making another request provide this token with the
2477
2512
  * next parameter.
2513
+ * @param round - The round for which this information is relevant.
2478
2514
  */
2479
- constructor({ applicationId, boxes, nextToken, }) {
2515
+ constructor({ applicationId, boxes, nextToken, round, }) {
2480
2516
  this.applicationId = ensureBigInt(applicationId);
2481
2517
  this.boxes = boxes;
2482
2518
  this.nextToken = nextToken;
2519
+ this.round =
2520
+ typeof round === 'undefined' ? undefined : ensureSafeInteger(round);
2483
2521
  }
2484
2522
  // eslint-disable-next-line class-methods-use-this
2485
2523
  getEncodingSchema() {
@@ -2490,6 +2528,7 @@ export class BoxesResponse {
2490
2528
  ['application-id', this.applicationId],
2491
2529
  ['boxes', this.boxes.map((v) => v.toEncodingData())],
2492
2530
  ['next-token', this.nextToken],
2531
+ ['round', this.round],
2493
2532
  ]);
2494
2533
  }
2495
2534
  static fromEncodingData(data) {
@@ -2500,6 +2539,7 @@ export class BoxesResponse {
2500
2539
  applicationId: data.get('application-id'),
2501
2540
  boxes: (data.get('boxes') ?? []).map((v) => BoxDescriptor.fromEncodingData(v)),
2502
2541
  nextToken: data.get('next-token'),
2542
+ round: data.get('round'),
2503
2543
  });
2504
2544
  }
2505
2545
  }
@@ -4859,6 +4899,10 @@ export class TransactionHeartbeat {
4859
4899
  key: 'hb-vote-id',
4860
4900
  valueSchema: new ByteArraySchema(),
4861
4901
  omitEmpty: true,
4902
+ }, {
4903
+ key: 'hb-challenge-discount',
4904
+ valueSchema: new OptionalSchema(new BooleanSchema()),
4905
+ omitEmpty: true,
4862
4906
  });
4863
4907
  }
4864
4908
  return this.encodingSchemaValue;
@@ -4872,14 +4916,18 @@ export class TransactionHeartbeat {
4872
4916
  * @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
4873
4917
  * block.
4874
4918
  * @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
4919
+ * @param hbChallengeDiscount - (hbc) HbChallengeDiscount requests the challenge fee discount, reducing the
4920
+ * required fee by one min fee. It is a request, not an assertion: it is granted
4921
+ * only if HbAddress is actually under challenge.
4875
4922
  */
4876
- constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, }) {
4923
+ constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, hbChallengeDiscount, }) {
4877
4924
  this.hbAddress = hbAddress;
4878
4925
  this.hbKeyDilution = ensureBigInt(hbKeyDilution);
4879
4926
  this.hbProof = hbProof;
4880
4927
  this.hbSeed = typeof hbSeed === 'string' ? base64ToBytes(hbSeed) : hbSeed;
4881
4928
  this.hbVoteId =
4882
4929
  typeof hbVoteId === 'string' ? base64ToBytes(hbVoteId) : hbVoteId;
4930
+ this.hbChallengeDiscount = hbChallengeDiscount;
4883
4931
  }
4884
4932
  // eslint-disable-next-line class-methods-use-this
4885
4933
  getEncodingSchema() {
@@ -4892,6 +4940,7 @@ export class TransactionHeartbeat {
4892
4940
  ['hb-proof', this.hbProof.toEncodingData()],
4893
4941
  ['hb-seed', this.hbSeed],
4894
4942
  ['hb-vote-id', this.hbVoteId],
4943
+ ['hb-challenge-discount', this.hbChallengeDiscount],
4895
4944
  ]);
4896
4945
  }
4897
4946
  static fromEncodingData(data) {
@@ -4904,6 +4953,7 @@ export class TransactionHeartbeat {
4904
4953
  hbProof: HbProofFields.fromEncodingData(data.get('hb-proof') ?? new Map()),
4905
4954
  hbSeed: data.get('hb-seed'),
4906
4955
  hbVoteId: data.get('hb-vote-id'),
4956
+ hbChallengeDiscount: data.get('hb-challenge-discount'),
4907
4957
  });
4908
4958
  }
4909
4959
  }
@@ -5147,6 +5197,10 @@ export class TransactionSignature {
5147
5197
  key: 'multisig',
5148
5198
  valueSchema: new OptionalSchema(TransactionSignatureMultisig.encodingSchema),
5149
5199
  omitEmpty: true,
5200
+ }, {
5201
+ key: 'pqsig',
5202
+ valueSchema: new OptionalSchema(TransactionSignaturePQsig.encodingSchema),
5203
+ omitEmpty: true,
5150
5204
  }, {
5151
5205
  key: 'sig',
5152
5206
  valueSchema: new OptionalSchema(new ByteArraySchema()),
@@ -5163,11 +5217,15 @@ export class TransactionSignature {
5163
5217
  * @param multisig - structure holding multiple subsignatures.
5164
5218
  * Definition:
5165
5219
  * crypto/multisig.go : MultisigSig
5220
+ * @param pqsig - structure holding a post-quantum signature.
5221
+ * Definition:
5222
+ * data/transactions/pqsig.go : PQSig
5166
5223
  * @param sig - (sig) Standard ed25519 signature.
5167
5224
  */
5168
- constructor({ logicsig, multisig, sig, }) {
5225
+ constructor({ logicsig, multisig, pqsig, sig, }) {
5169
5226
  this.logicsig = logicsig;
5170
5227
  this.multisig = multisig;
5228
+ this.pqsig = pqsig;
5171
5229
  this.sig = typeof sig === 'string' ? base64ToBytes(sig) : sig;
5172
5230
  }
5173
5231
  // eslint-disable-next-line class-methods-use-this
@@ -5188,6 +5246,12 @@ export class TransactionSignature {
5188
5246
  ? this.multisig.toEncodingData()
5189
5247
  : undefined,
5190
5248
  ],
5249
+ [
5250
+ 'pqsig',
5251
+ typeof this.pqsig !== 'undefined'
5252
+ ? this.pqsig.toEncodingData()
5253
+ : undefined,
5254
+ ],
5191
5255
  ['sig', this.sig],
5192
5256
  ]);
5193
5257
  }
@@ -5202,6 +5266,9 @@ export class TransactionSignature {
5202
5266
  multisig: typeof data.get('multisig') !== 'undefined'
5203
5267
  ? TransactionSignatureMultisig.fromEncodingData(data.get('multisig'))
5204
5268
  : undefined,
5269
+ pqsig: typeof data.get('pqsig') !== 'undefined'
5270
+ ? TransactionSignaturePQsig.fromEncodingData(data.get('pqsig'))
5271
+ : undefined,
5205
5272
  sig: data.get('sig'),
5206
5273
  });
5207
5274
  }
@@ -5227,6 +5294,10 @@ export class TransactionSignatureLogicsig {
5227
5294
  key: 'multisig-signature',
5228
5295
  valueSchema: new OptionalSchema(TransactionSignatureMultisig.encodingSchema),
5229
5296
  omitEmpty: true,
5297
+ }, {
5298
+ key: 'pqsig',
5299
+ valueSchema: new OptionalSchema(TransactionSignaturePQsig.encodingSchema),
5300
+ omitEmpty: true,
5230
5301
  }, {
5231
5302
  key: 'signature',
5232
5303
  valueSchema: new OptionalSchema(new ByteArraySchema()),
@@ -5246,13 +5317,17 @@ export class TransactionSignatureLogicsig {
5246
5317
  * @param multisigSignature - structure holding multiple subsignatures.
5247
5318
  * Definition:
5248
5319
  * crypto/multisig.go : MultisigSig
5320
+ * @param pqsig - structure holding a post-quantum signature.
5321
+ * Definition:
5322
+ * data/transactions/pqsig.go : PQSig
5249
5323
  * @param signature - (sig) ed25519 signature.
5250
5324
  */
5251
- constructor({ logic, args, logicMultisigSignature, multisigSignature, signature, }) {
5325
+ constructor({ logic, args, logicMultisigSignature, multisigSignature, pqsig, signature, }) {
5252
5326
  this.logic = typeof logic === 'string' ? base64ToBytes(logic) : logic;
5253
5327
  this.args = args;
5254
5328
  this.logicMultisigSignature = logicMultisigSignature;
5255
5329
  this.multisigSignature = multisigSignature;
5330
+ this.pqsig = pqsig;
5256
5331
  this.signature =
5257
5332
  typeof signature === 'string' ? base64ToBytes(signature) : signature;
5258
5333
  }
@@ -5276,6 +5351,12 @@ export class TransactionSignatureLogicsig {
5276
5351
  ? this.multisigSignature.toEncodingData()
5277
5352
  : undefined,
5278
5353
  ],
5354
+ [
5355
+ 'pqsig',
5356
+ typeof this.pqsig !== 'undefined'
5357
+ ? this.pqsig.toEncodingData()
5358
+ : undefined,
5359
+ ],
5279
5360
  ['signature', this.signature],
5280
5361
  ]);
5281
5362
  }
@@ -5292,6 +5373,9 @@ export class TransactionSignatureLogicsig {
5292
5373
  multisigSignature: typeof data.get('multisig-signature') !== 'undefined'
5293
5374
  ? TransactionSignatureMultisig.fromEncodingData(data.get('multisig-signature'))
5294
5375
  : undefined,
5376
+ pqsig: typeof data.get('pqsig') !== 'undefined'
5377
+ ? TransactionSignaturePQsig.fromEncodingData(data.get('pqsig'))
5378
+ : undefined,
5295
5379
  signature: data.get('signature'),
5296
5380
  });
5297
5381
  }
@@ -5414,6 +5498,72 @@ export class TransactionSignatureMultisigSubsignature {
5414
5498
  });
5415
5499
  }
5416
5500
  }
5501
+ /**
5502
+ * structure holding a post-quantum signature.
5503
+ * Definition:
5504
+ * data/transactions/pqsig.go : PQSig
5505
+ */
5506
+ export class TransactionSignaturePQsig {
5507
+ static get encodingSchema() {
5508
+ if (!this.encodingSchemaValue) {
5509
+ this.encodingSchemaValue = new NamedMapSchema([]);
5510
+ this.encodingSchemaValue.pushEntries({
5511
+ key: 'public-key',
5512
+ valueSchema: new ByteArraySchema(),
5513
+ omitEmpty: true,
5514
+ }, { key: 'scheme', valueSchema: new StringSchema(), omitEmpty: true }, {
5515
+ key: 'signature',
5516
+ valueSchema: new ByteArraySchema(),
5517
+ omitEmpty: true,
5518
+ }, {
5519
+ key: 'salt',
5520
+ valueSchema: new OptionalSchema(new Uint64Schema()),
5521
+ omitEmpty: true,
5522
+ });
5523
+ }
5524
+ return this.encodingSchemaValue;
5525
+ }
5526
+ /**
5527
+ * Creates a new `TransactionSignaturePQsig` object.
5528
+ * @param publicKey - (pk)
5529
+ * @param scheme - (sch) identifies the internal signature scheme.
5530
+ * @param signature - (sig)
5531
+ * @param salt - (slt) a single byte, added to ensure the hashed address is not an Ed25519 curve
5532
+ * point
5533
+ */
5534
+ constructor({ publicKey, scheme, signature, salt, }) {
5535
+ this.publicKey =
5536
+ typeof publicKey === 'string' ? base64ToBytes(publicKey) : publicKey;
5537
+ this.scheme = scheme;
5538
+ this.signature =
5539
+ typeof signature === 'string' ? base64ToBytes(signature) : signature;
5540
+ this.salt =
5541
+ typeof salt === 'undefined' ? undefined : ensureSafeInteger(salt);
5542
+ }
5543
+ // eslint-disable-next-line class-methods-use-this
5544
+ getEncodingSchema() {
5545
+ return TransactionSignaturePQsig.encodingSchema;
5546
+ }
5547
+ toEncodingData() {
5548
+ return new Map([
5549
+ ['public-key', this.publicKey],
5550
+ ['scheme', this.scheme],
5551
+ ['signature', this.signature],
5552
+ ['salt', this.salt],
5553
+ ]);
5554
+ }
5555
+ static fromEncodingData(data) {
5556
+ if (!(data instanceof Map)) {
5557
+ throw new Error(`Invalid decoded TransactionSignaturePQsig: ${data}`);
5558
+ }
5559
+ return new TransactionSignaturePQsig({
5560
+ publicKey: data.get('public-key'),
5561
+ scheme: data.get('scheme'),
5562
+ signature: data.get('signature'),
5563
+ salt: data.get('salt'),
5564
+ });
5565
+ }
5566
+ }
5417
5567
  /**
5418
5568
  * Fields for a state proof transaction.
5419
5569
  * Definition: