algosdk 3.7.0-beta.1 → 3.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.
Files changed (116) 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/getPeers.js +20 -0
  7. package/dist/cjs/client/v2/algod/getPeers.js.map +1 -0
  8. package/dist/cjs/client/v2/algod/models/types.js +153 -5
  9. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  10. package/dist/cjs/client/v2/indexer/models/types.js +163 -12
  11. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  12. package/dist/cjs/composer.js +4 -6
  13. package/dist/cjs/composer.js.map +1 -1
  14. package/dist/cjs/ed25519-signer.js +18 -0
  15. package/dist/cjs/ed25519-signer.js.map +1 -1
  16. package/dist/cjs/encoding/address.js +9 -0
  17. package/dist/cjs/encoding/address.js.map +1 -1
  18. package/dist/cjs/falcon-signer.js +16 -0
  19. package/dist/cjs/falcon-signer.js.map +1 -1
  20. package/dist/cjs/heartbeat.js +7 -0
  21. package/dist/cjs/heartbeat.js.map +1 -1
  22. package/dist/cjs/logicsig.js +86 -6
  23. package/dist/cjs/logicsig.js.map +1 -1
  24. package/dist/cjs/makeTxn.js +11 -2
  25. package/dist/cjs/makeTxn.js.map +1 -1
  26. package/dist/cjs/mnemonic/mnemonic.js +2 -0
  27. package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
  28. package/dist/cjs/pq-signer.js +51 -0
  29. package/dist/cjs/pq-signer.js.map +1 -1
  30. package/dist/cjs/signer.js.map +1 -1
  31. package/dist/cjs/signing.js +22 -0
  32. package/dist/cjs/signing.js.map +1 -1
  33. package/dist/cjs/transaction.js +8 -0
  34. package/dist/cjs/transaction.js.map +1 -1
  35. package/dist/cjs/types/block.js +28 -0
  36. package/dist/cjs/types/block.js.map +1 -1
  37. package/dist/cjs/types/statedelta.js +17 -0
  38. package/dist/cjs/types/statedelta.js.map +1 -1
  39. package/dist/cjs/utils/utils.js +14 -1
  40. package/dist/cjs/utils/utils.js.map +1 -1
  41. package/dist/esm/appAccess.js +4 -0
  42. package/dist/esm/appAccess.js.map +1 -1
  43. package/dist/esm/client/v2/algod/getPeers.js +14 -0
  44. package/dist/esm/client/v2/algod/getPeers.js.map +1 -0
  45. package/dist/esm/client/v2/algod/models/types.js +149 -3
  46. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  47. package/dist/esm/client/v2/indexer/models/types.js +161 -11
  48. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  49. package/dist/esm/composer.js +4 -6
  50. package/dist/esm/composer.js.map +1 -1
  51. package/dist/esm/ed25519-signer.js +18 -0
  52. package/dist/esm/ed25519-signer.js.map +1 -1
  53. package/dist/esm/encoding/address.js +9 -0
  54. package/dist/esm/encoding/address.js.map +1 -1
  55. package/dist/esm/falcon-signer.js +16 -0
  56. package/dist/esm/falcon-signer.js.map +1 -1
  57. package/dist/esm/heartbeat.js +8 -1
  58. package/dist/esm/heartbeat.js.map +1 -1
  59. package/dist/esm/logicsig.js +86 -6
  60. package/dist/esm/logicsig.js.map +1 -1
  61. package/dist/esm/makeTxn.js +11 -2
  62. package/dist/esm/makeTxn.js.map +1 -1
  63. package/dist/esm/mnemonic/mnemonic.js +2 -0
  64. package/dist/esm/mnemonic/mnemonic.js.map +1 -1
  65. package/dist/esm/pq-signer.js +51 -0
  66. package/dist/esm/pq-signer.js.map +1 -1
  67. package/dist/esm/signer.js.map +1 -1
  68. package/dist/esm/signing.js +22 -0
  69. package/dist/esm/signing.js.map +1 -1
  70. package/dist/esm/transaction.js +8 -0
  71. package/dist/esm/transaction.js.map +1 -1
  72. package/dist/esm/types/block.js +28 -0
  73. package/dist/esm/types/block.js.map +1 -1
  74. package/dist/esm/types/statedelta.js +17 -0
  75. package/dist/esm/types/statedelta.js.map +1 -1
  76. package/dist/esm/utils/utils.js +12 -0
  77. package/dist/esm/utils/utils.js.map +1 -1
  78. package/dist/types/client/v2/algod/getPeers.d.ts +7 -0
  79. package/dist/types/client/v2/algod/models/types.d.ts +90 -3
  80. package/dist/types/client/v2/indexer/models/types.d.ts +114 -7
  81. package/dist/types/composer.d.ts +3 -3
  82. package/dist/types/ed25519-signer.d.ts +29 -0
  83. package/dist/types/encoding/address.d.ts +9 -0
  84. package/dist/types/falcon-signer.d.ts +29 -2
  85. package/dist/types/heartbeat.d.ts +2 -0
  86. package/dist/types/logicsig.d.ts +91 -6
  87. package/dist/types/makeTxn.d.ts +8 -2
  88. package/dist/types/mnemonic/mnemonic.d.ts +2 -0
  89. package/dist/types/pq-signer.d.ts +39 -2
  90. package/dist/types/signer.d.ts +76 -5
  91. package/dist/types/signing.d.ts +22 -0
  92. package/dist/types/transaction.d.ts +1 -0
  93. package/dist/types/types/block.d.ts +22 -0
  94. package/dist/types/types/statedelta.d.ts +18 -0
  95. package/dist/types/types/transactions/base.d.ts +10 -0
  96. package/dist/types/utils/utils.d.ts +1 -0
  97. package/package.json +2 -2
  98. package/src/appAccess.ts +5 -0
  99. package/src/client/v2/algod/models/types.ts +234 -0
  100. package/src/client/v2/indexer/models/types.ts +280 -8
  101. package/src/composer.ts +7 -11
  102. package/src/ed25519-signer.ts +29 -0
  103. package/src/encoding/address.ts +9 -0
  104. package/src/falcon-signer.ts +31 -1
  105. package/src/heartbeat.ts +11 -0
  106. package/src/logicsig.ts +93 -6
  107. package/src/makeTxn.ts +13 -4
  108. package/src/mnemonic/mnemonic.ts +2 -0
  109. package/src/pq-signer.ts +71 -1
  110. package/src/signer.ts +77 -5
  111. package/src/signing.ts +22 -0
  112. package/src/transaction.ts +10 -0
  113. package/src/types/block.ts +54 -0
  114. package/src/types/statedelta.ts +34 -0
  115. package/src/types/transactions/base.ts +11 -0
  116. package/src/utils/utils.ts +13 -0
@@ -154,6 +154,7 @@ export declare class Account implements Encodable {
154
154
  * * sig
155
155
  * * msig
156
156
  * * lsig
157
+ * * pqsig
157
158
  * * or null if unknown
158
159
  */
159
160
  sigType?: string;
@@ -213,6 +214,7 @@ export declare class Account implements Encodable {
213
214
  * * sig
214
215
  * * msig
215
216
  * * lsig
217
+ * * pqsig
216
218
  * * or null if unknown
217
219
  */
218
220
  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, }: {
@@ -1145,10 +1147,21 @@ export declare class Block implements Encodable {
1145
1147
  * the potential bonus payout for this block.
1146
1148
  */
1147
1149
  bonus?: number;
1150
+ /**
1151
+ * the fee required, beyond the minimum fee, for "normal" transactions in this
1152
+ * block.
1153
+ */
1154
+ congestionTax?: number;
1148
1155
  /**
1149
1156
  * the sum of all fees paid by transactions in this block.
1150
1157
  */
1151
1158
  feesCollected?: number;
1159
+ /**
1160
+ * the degree to which this block is full, based on the number of bytes in the
1161
+ * final block compared to the maximum allowed. Expressed as a fixed-point integer
1162
+ * with 6 digits of precision, so 1,000,000 is a completely full block.
1163
+ */
1164
+ load?: number;
1152
1165
  /**
1153
1166
  * Participation account data that needs to be checked/acted on by the network.
1154
1167
  */
@@ -1218,7 +1231,12 @@ export declare class Block implements Encodable {
1218
1231
  * the default SHA512_256. This commitment can be used on environments where only
1219
1232
  * the SHA256 function exists.
1220
1233
  * @param bonus - the potential bonus payout for this block.
1234
+ * @param congestionTax - the fee required, beyond the minimum fee, for "normal" transactions in this
1235
+ * block.
1221
1236
  * @param feesCollected - the sum of all fees paid by transactions in this block.
1237
+ * @param load - the degree to which this block is full, based on the number of bytes in the
1238
+ * final block compared to the maximum allowed. Expressed as a fixed-point integer
1239
+ * with 6 digits of precision, so 1,000,000 is a completely full block.
1222
1240
  * @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
1223
1241
  * @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
1224
1242
  * @param proposer - the proposer of this block.
@@ -1237,7 +1255,7 @@ export declare class Block implements Encodable {
1237
1255
  * @param upgradeState - Fields relating to a protocol upgrade.
1238
1256
  * @param upgradeVote - Fields relating to voting for a protocol upgrade.
1239
1257
  */
1240
- constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, feesCollected, participationUpdates, previousBlockHash512, proposer, proposerPayout, rewards, stateProofTracking, transactions, transactionsRootSha512, txnCounter, upgradeState, upgradeVote, }: {
1258
+ constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, congestionTax, feesCollected, load, participationUpdates, previousBlockHash512, proposer, proposerPayout, rewards, stateProofTracking, transactions, transactionsRootSha512, txnCounter, upgradeState, upgradeVote, }: {
1241
1259
  genesisHash: string | Uint8Array;
1242
1260
  genesisId: string;
1243
1261
  previousBlockHash: string | Uint8Array;
@@ -1247,7 +1265,9 @@ export declare class Block implements Encodable {
1247
1265
  transactionsRoot: string | Uint8Array;
1248
1266
  transactionsRootSha256: string | Uint8Array;
1249
1267
  bonus?: number | bigint;
1268
+ congestionTax?: number | bigint;
1250
1269
  feesCollected?: number | bigint;
1270
+ load?: number | bigint;
1251
1271
  participationUpdates?: ParticipationUpdates;
1252
1272
  previousBlockHash512?: string | Uint8Array;
1253
1273
  proposer?: Address | string;
@@ -1471,7 +1491,7 @@ export declare class Box implements Encodable {
1471
1491
  static fromEncodingData(data: unknown): Box;
1472
1492
  }
1473
1493
  /**
1474
- * Box descriptor describes an app box without a value.
1494
+ * Box descriptor describes an app box.
1475
1495
  */
1476
1496
  export declare class BoxDescriptor implements Encodable {
1477
1497
  private static encodingSchemaValue;
@@ -1480,12 +1500,20 @@ export declare class BoxDescriptor implements Encodable {
1480
1500
  * Base64 encoded box name
1481
1501
  */
1482
1502
  name: Uint8Array;
1503
+ /**
1504
+ * Base64 encoded box value. Present only when the `values` query parameter is set
1505
+ * to true.
1506
+ */
1507
+ value?: Uint8Array;
1483
1508
  /**
1484
1509
  * Creates a new `BoxDescriptor` object.
1485
1510
  * @param name - Base64 encoded box name
1511
+ * @param value - Base64 encoded box value. Present only when the `values` query parameter is set
1512
+ * to true.
1486
1513
  */
1487
- constructor({ name }: {
1514
+ constructor({ name, value, }: {
1488
1515
  name: string | Uint8Array;
1516
+ value?: string | Uint8Array;
1489
1517
  });
1490
1518
  getEncodingSchema(): Schema;
1491
1519
  toEncodingData(): Map<string, unknown>;
@@ -1536,17 +1564,23 @@ export declare class BoxesResponse implements Encodable {
1536
1564
  * next parameter.
1537
1565
  */
1538
1566
  nextToken?: string;
1567
+ /**
1568
+ * The round for which this information is relevant.
1569
+ */
1570
+ round?: number;
1539
1571
  /**
1540
1572
  * Creates a new `BoxesResponse` object.
1541
1573
  * @param applicationId - (appidx) application index.
1542
1574
  * @param boxes -
1543
1575
  * @param nextToken - Used for pagination, when making another request provide this token with the
1544
1576
  * next parameter.
1577
+ * @param round - The round for which this information is relevant.
1545
1578
  */
1546
- constructor({ applicationId, boxes, nextToken, }: {
1579
+ constructor({ applicationId, boxes, nextToken, round, }: {
1547
1580
  applicationId: number | bigint;
1548
1581
  boxes: BoxDescriptor[];
1549
1582
  nextToken?: string;
1583
+ round?: number | bigint;
1550
1584
  });
1551
1585
  getEncodingSchema(): Schema;
1552
1586
  toEncodingData(): Map<string, unknown>;
@@ -2943,6 +2977,12 @@ export declare class TransactionHeartbeat implements Encodable {
2943
2977
  * (hbvid) HbVoteID must match the HbAddress account's current VoteID.
2944
2978
  */
2945
2979
  hbVoteId: Uint8Array;
2980
+ /**
2981
+ * (hbc) HbChallengeDiscount requests the challenge fee discount, reducing the
2982
+ * required fee by one min fee. It is a request, not an assertion: it is granted
2983
+ * only if HbAddress is actually under challenge.
2984
+ */
2985
+ hbChallengeDiscount?: boolean;
2946
2986
  /**
2947
2987
  * Creates a new `TransactionHeartbeat` object.
2948
2988
  * @param hbAddress - (hbad) HbAddress is the account this txn is proving onlineness for.
@@ -2952,13 +2992,17 @@ export declare class TransactionHeartbeat implements Encodable {
2952
2992
  * @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
2953
2993
  * block.
2954
2994
  * @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
2995
+ * @param hbChallengeDiscount - (hbc) HbChallengeDiscount requests the challenge fee discount, reducing the
2996
+ * required fee by one min fee. It is a request, not an assertion: it is granted
2997
+ * only if HbAddress is actually under challenge.
2955
2998
  */
2956
- constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, }: {
2999
+ constructor({ hbAddress, hbKeyDilution, hbProof, hbSeed, hbVoteId, hbChallengeDiscount, }: {
2957
3000
  hbAddress: string;
2958
3001
  hbKeyDilution: number | bigint;
2959
3002
  hbProof: HbProofFields;
2960
3003
  hbSeed: string | Uint8Array;
2961
3004
  hbVoteId: string | Uint8Array;
3005
+ hbChallengeDiscount?: boolean;
2962
3006
  });
2963
3007
  getEncodingSchema(): Schema;
2964
3008
  toEncodingData(): Map<string, unknown>;
@@ -3124,6 +3168,12 @@ export declare class TransactionSignature implements Encodable {
3124
3168
  * crypto/multisig.go : MultisigSig
3125
3169
  */
3126
3170
  multisig?: TransactionSignatureMultisig;
3171
+ /**
3172
+ * structure holding a post-quantum signature.
3173
+ * Definition:
3174
+ * data/transactions/pqsig.go : PQSig
3175
+ */
3176
+ pqsig?: TransactionSignaturePQsig;
3127
3177
  /**
3128
3178
  * (sig) Standard ed25519 signature.
3129
3179
  */
@@ -3136,11 +3186,15 @@ export declare class TransactionSignature implements Encodable {
3136
3186
  * @param multisig - structure holding multiple subsignatures.
3137
3187
  * Definition:
3138
3188
  * crypto/multisig.go : MultisigSig
3189
+ * @param pqsig - structure holding a post-quantum signature.
3190
+ * Definition:
3191
+ * data/transactions/pqsig.go : PQSig
3139
3192
  * @param sig - (sig) Standard ed25519 signature.
3140
3193
  */
3141
- constructor({ logicsig, multisig, sig, }: {
3194
+ constructor({ logicsig, multisig, pqsig, sig, }: {
3142
3195
  logicsig?: TransactionSignatureLogicsig;
3143
3196
  multisig?: TransactionSignatureMultisig;
3197
+ pqsig?: TransactionSignaturePQsig;
3144
3198
  sig?: string | Uint8Array;
3145
3199
  });
3146
3200
  getEncodingSchema(): Schema;
@@ -3176,6 +3230,12 @@ export declare class TransactionSignatureLogicsig implements Encodable {
3176
3230
  * crypto/multisig.go : MultisigSig
3177
3231
  */
3178
3232
  multisigSignature?: TransactionSignatureMultisig;
3233
+ /**
3234
+ * structure holding a post-quantum signature.
3235
+ * Definition:
3236
+ * data/transactions/pqsig.go : PQSig
3237
+ */
3238
+ pqsig?: TransactionSignaturePQsig;
3179
3239
  /**
3180
3240
  * (sig) ed25519 signature.
3181
3241
  */
@@ -3191,13 +3251,17 @@ export declare class TransactionSignatureLogicsig implements Encodable {
3191
3251
  * @param multisigSignature - structure holding multiple subsignatures.
3192
3252
  * Definition:
3193
3253
  * crypto/multisig.go : MultisigSig
3254
+ * @param pqsig - structure holding a post-quantum signature.
3255
+ * Definition:
3256
+ * data/transactions/pqsig.go : PQSig
3194
3257
  * @param signature - (sig) ed25519 signature.
3195
3258
  */
3196
- constructor({ logic, args, logicMultisigSignature, multisigSignature, signature, }: {
3259
+ constructor({ logic, args, logicMultisigSignature, multisigSignature, pqsig, signature, }: {
3197
3260
  logic: string | Uint8Array;
3198
3261
  args?: Uint8Array[];
3199
3262
  logicMultisigSignature?: TransactionSignatureMultisig;
3200
3263
  multisigSignature?: TransactionSignatureMultisig;
3264
+ pqsig?: TransactionSignaturePQsig;
3201
3265
  signature?: string | Uint8Array;
3202
3266
  });
3203
3267
  getEncodingSchema(): Schema;
@@ -3263,6 +3327,49 @@ export declare class TransactionSignatureMultisigSubsignature implements Encodab
3263
3327
  toEncodingData(): Map<string, unknown>;
3264
3328
  static fromEncodingData(data: unknown): TransactionSignatureMultisigSubsignature;
3265
3329
  }
3330
+ /**
3331
+ * structure holding a post-quantum signature.
3332
+ * Definition:
3333
+ * data/transactions/pqsig.go : PQSig
3334
+ */
3335
+ export declare class TransactionSignaturePQsig implements Encodable {
3336
+ private static encodingSchemaValue;
3337
+ static get encodingSchema(): Schema;
3338
+ /**
3339
+ * (pk)
3340
+ */
3341
+ publicKey: Uint8Array;
3342
+ /**
3343
+ * (sch) identifies the internal signature scheme.
3344
+ */
3345
+ scheme: string;
3346
+ /**
3347
+ * (sig)
3348
+ */
3349
+ signature: Uint8Array;
3350
+ /**
3351
+ * (slt) a single byte, added to ensure the hashed address is not an Ed25519 curve
3352
+ * point
3353
+ */
3354
+ salt?: number;
3355
+ /**
3356
+ * Creates a new `TransactionSignaturePQsig` object.
3357
+ * @param publicKey - (pk)
3358
+ * @param scheme - (sch) identifies the internal signature scheme.
3359
+ * @param signature - (sig)
3360
+ * @param salt - (slt) a single byte, added to ensure the hashed address is not an Ed25519 curve
3361
+ * point
3362
+ */
3363
+ constructor({ publicKey, scheme, signature, salt, }: {
3364
+ publicKey: string | Uint8Array;
3365
+ scheme: string;
3366
+ signature: string | Uint8Array;
3367
+ salt?: number | bigint;
3368
+ });
3369
+ getEncodingSchema(): Schema;
3370
+ toEncodingData(): Map<string, unknown>;
3371
+ static fromEncodingData(data: unknown): TransactionSignaturePQsig;
3372
+ }
3266
3373
  /**
3267
3374
  * Fields for a state proof transaction.
3268
3375
  * Definition:
@@ -93,15 +93,15 @@ export declare class AtomicTransactionComposer {
93
93
  approvalProgram?: Uint8Array;
94
94
  /** The clear program for this application call. Only set this if this is an application creation call, or if onComplete is OnApplicationComplete.UpdateApplicationOC */
95
95
  clearProgram?: Uint8Array;
96
- /** The global integer schema size. Only set this if this is an application creation call. */
96
+ /** The global integer schema size. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. */
97
97
  numGlobalInts?: number;
98
- /** The global byte slice schema size. Only set this if this is an application creation call. */
98
+ /** The global byte slice schema size. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. */
99
99
  numGlobalByteSlices?: number;
100
100
  /** The local integer schema size. Only set this if this is an application creation call. */
101
101
  numLocalInts?: number;
102
102
  /** The local byte slice schema size. Only set this if this is an application creation call. */
103
103
  numLocalByteSlices?: number;
104
- /** The number of extra pages to allocate for the application's programs. Only set this if this is an application creation call. If omitted, defaults to 0. */
104
+ /** The number of extra pages to allocate for the application's programs. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. If omitted, defaults to 0. */
105
105
  extraPages?: number;
106
106
  /** Array of Address strings that represent external accounts supplied to this application. If accounts are provided here, the accounts specified in the method args will appear after these. */
107
107
  appAccounts?: Array<string | Address>;
@@ -1,7 +1,36 @@
1
1
  import { Address } from './encoding/address.js';
2
2
  import { AddressWithDelegatedLsigSigner, AddressWithMxBytesSigner, AddressWithProgramDataSigner, AddressWithTransactionSigner } from './signer.js';
3
+ /**
4
+ * An ed25519 public key paired with a function that signs raw bytes with the
5
+ * corresponding secret key.
6
+ *
7
+ * @remarks
8
+ * `ed25519Signer` receives the exact bytes to sign, with every
9
+ * domain-separation prefix already applied, so it can be backed by a key that
10
+ * never leaves a wallet, HSM or hardware device.
11
+ */
3
12
  export interface Ed25519SigningKey {
13
+ /** The 32-byte ed25519 public key. */
4
14
  ed25519PublicKey: Uint8Array;
15
+ /** Signs the given bytes verbatim with the corresponding secret key. */
5
16
  ed25519Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
6
17
  }
18
+ /**
19
+ * Build the full set of signers for an ed25519 key from a function that signs
20
+ * raw bytes with it.
21
+ *
22
+ * @remarks
23
+ * Each returned signer applies the domain separation its use requires
24
+ * ("Program", "MsigProgram", "ProgData", or the transaction prefix) before
25
+ * calling `ed25519Signer`, so a caller only has to supply the raw signing
26
+ * operation once.
27
+ *
28
+ * @param ed25519SigningKey - The public key and raw signing function to build the signers from
29
+ * @param sendingAddress - The address transactions are sent from. Defaults to
30
+ * the address of `ed25519PublicKey`; supply it when that key is the auth
31
+ * address of a rekeyed account, in which case the produced transactions carry
32
+ * the key's address in their `sgnr` field.
33
+ * @returns An address bundled with transaction, delegated LogicSig, arbitrary
34
+ * bytes and program data signers
35
+ */
7
36
  export declare function addressWithSignersFromRawEd25519Signer(ed25519SigningKey: Ed25519SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithMxBytesSigner & AddressWithProgramDataSigner;
@@ -78,9 +78,16 @@ export declare function getApplicationAddress(appID: number | bigint): Address;
78
78
  * Derive a post-quantum (PQ) account address together with the canonical salt
79
79
  * used to derive it.
80
80
  *
81
+ * @remarks
82
+ * The salt is found by rejection sampling: it is the lowest value whose
83
+ * preimage hashes to something that could not also be an Ed25519 public key, so
84
+ * that a PQ account can never collide with an Ed25519 one.
85
+ *
81
86
  * @param schemeBytes - The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024).
82
87
  * @param key - The scheme's canonical public key.
83
88
  * @returns The derived Address and the canonical 1-byte salt.
89
+ * @throws If `schemeBytes` is not exactly {@link PQ_SCHEME_SIZE} bytes, or in
90
+ * the ~2^-256 case where no salt in range yields a valid address.
84
91
  */
85
92
  export declare function addressFromPQKey(schemeBytes: Uint8Array, key: Uint8Array): {
86
93
  address: Address;
@@ -99,5 +106,7 @@ export declare function addressFromPQKey(schemeBytes: Uint8Array, key: Uint8Arra
99
106
  *
100
107
  * @param pqsig - The post-quantum signature to derive the address from.
101
108
  * @returns The address of the account the signature authorizes.
109
+ * @throws If the signature's scheme is malformed, or if its salt is not the
110
+ * canonical one for its scheme and public key.
102
111
  */
103
112
  export declare function addressFromPQSig(pqsig: EncodedPQSig): Address;
@@ -1,11 +1,38 @@
1
1
  import { Address } from './encoding/address.js';
2
- import { AddressWithDelegatedLsigSigner, AddressWithTransactionSigner } from './signer.js';
2
+ import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
3
3
  /**
4
4
  * The 2-byte ASCII identifier of the Falcon-1024 post-quantum signature scheme.
5
5
  */
6
6
  export declare const FALCON_1024_SCHEME: Uint8Array;
7
+ /**
8
+ * A Falcon-1024 public key paired with a function that signs raw bytes with the
9
+ * corresponding secret key.
10
+ *
11
+ * @remarks
12
+ * `falcon1024Signer` receives the exact bytes to sign, with every
13
+ * domain-separation prefix already applied, so it can be backed by a key that
14
+ * never leaves a wallet, HSM or hardware device.
15
+ */
7
16
  export interface Falcon1024SigningKey {
17
+ /** The Falcon-1024 public key. */
8
18
  falcon1024PublicKey: Uint8Array;
19
+ /** Signs the given bytes verbatim with the corresponding secret key. */
9
20
  falcon1024Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
10
21
  }
11
- export declare function addressWithSignersFromRawFalcon1024Signer(falconSigningKey: Falcon1024SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner;
22
+ /**
23
+ * Build the full set of signers for a Falcon-1024 key from a function that
24
+ * signs raw bytes with it.
25
+ *
26
+ * @remarks
27
+ * A thin wrapper around {@link addressWithSignersFromRawPQSigner} that supplies
28
+ * the {@link FALCON_1024_SCHEME} identifier, so see that function for the
29
+ * details and limitations of post-quantum signing.
30
+ *
31
+ * @param falconSigningKey - The public key and raw signing function to build the signers from
32
+ * @param sendingAddress - The address transactions are sent from. Defaults to
33
+ * the derived Falcon-1024 address; supply it when this key is the auth
34
+ * address of a rekeyed account.
35
+ * @returns An address bundled with transaction, empty transaction and delegated
36
+ * LogicSig signers
37
+ */
38
+ export declare function addressWithSignersFromRawFalcon1024Signer(falconSigningKey: Falcon1024SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;
@@ -26,12 +26,14 @@ export declare class Heartbeat implements Encodable {
26
26
  seed: Uint8Array;
27
27
  voteID: Uint8Array;
28
28
  keyDilution: bigint;
29
+ challengeDiscount: boolean;
29
30
  constructor(params: {
30
31
  address: Address;
31
32
  proof: HeartbeatProof;
32
33
  seed: Uint8Array;
33
34
  voteID: Uint8Array;
34
35
  keyDilution: bigint;
36
+ challengeDiscount?: boolean;
35
37
  });
36
38
  getEncodingSchema(): Schema;
37
39
  toEncodingData(): Map<string, unknown>;
@@ -10,8 +10,20 @@ import type { DelegatedLsigSigner, ProgramDataSigner } from './signer.js';
10
10
  * @param program - Program bytes to check
11
11
  */
12
12
  export declare function sanityCheckProgram(program: Uint8Array): void;
13
+ /**
14
+ * The domain-separation prefix prepended to a program before it is hashed into
15
+ * an escrow address, or signed for delegation by a single ed25519 account.
16
+ */
13
17
  export declare const PROGRAM_TAG: Uint8Array;
18
+ /**
19
+ * The domain-separation prefix prepended to a post-quantum delegating account's
20
+ * address and a program before the program is signed for delegation.
21
+ */
14
22
  export declare const PQ_PROGRAM_TAG: Uint8Array;
23
+ /**
24
+ * The domain-separation prefix prepended to a delegating multisig account's
25
+ * address and a program before the program is signed for delegation.
26
+ */
15
27
  export declare const MSIG_PROGRAM_TAG: Uint8Array;
16
28
  /**
17
29
  LogicSig implementation
@@ -25,6 +37,11 @@ export declare class LogicSig implements encoding.Encodable {
25
37
  sig?: Uint8Array;
26
38
  msig?: EncodedMultisig;
27
39
  lmsig?: EncodedMultisig;
40
+ /**
41
+ * The post-quantum delegation signature, if the delegating account is a
42
+ * post-quantum account. At most one of `sig`, `msig`, `lmsig` and `pqsig` may
43
+ * be set.
44
+ */
28
45
  pqsig?: EncodedPQSig;
29
46
  constructor(program: Uint8Array, programArgs?: Array<Uint8Array> | null);
30
47
  getEncodingSchema(): encoding.Schema;
@@ -54,6 +71,11 @@ export declare class LogicSig implements encoding.Encodable {
54
71
  /**
55
72
  * Signs this LogicSig for delegation using the given signer.
56
73
  *
74
+ * @remarks
75
+ * Re-signing an already-signed LogicSig is allowed, and replaces the previous
76
+ * delegation signature. At most one of `sig`, `msig`, `lmsig` and `pqsig` may
77
+ * be set, so any signature left over from an earlier call is cleared.
78
+ *
57
79
  * @param signer - The signer to delegate to
58
80
  * @param msig - Optional multisig account the signer is a subsigner of
59
81
  * @returns The address the signer signed as. When `msig` is omitted this is
@@ -61,10 +83,9 @@ export declare class LogicSig implements encoding.Encodable {
61
83
  * subsigner, not the multisig, so the delegating account is
62
84
  * `multisigAddress(msig)`. Either way it is an authorizing address, which
63
85
  * is not necessarily the address a signer sends transactions from.
64
- *
65
- * Re-signing an already-signed LogicSig is allowed, and replaces the previous
66
- * delegation signature. At most one of `sig`, `msig`, `lmsig` and `pqsig` may
67
- * be set, so any signature left over from an earlier call is cleared.
86
+ * @throws If the signer returns a signature of the wrong kind for the
87
+ * requested delegation, or an `lmsig` whose version, threshold or public
88
+ * keys do not match `msig`
68
89
  */
69
90
  signWithSigner(signer: DelegatedLsigSigner, msig?: MultisigMetadata): Promise<Address>;
70
91
  /**
@@ -79,6 +100,24 @@ export declare class LogicSig implements encoding.Encodable {
79
100
  * @param secretKey - Secret key to sign with
80
101
  */
81
102
  appendToMultisig(secretKey: Uint8Array): void;
103
+ /**
104
+ * Appends an additional subsignature to this LogicSig's existing multisig
105
+ * delegation.
106
+ *
107
+ * @remarks
108
+ * The multisig preimage is taken from the `lmsig` already on this LogicSig,
109
+ * so {@link signWithSigner} must have been called with an `msig` argument
110
+ * first. The signer must hold a key belonging to that multisig.
111
+ *
112
+ * A signature already collected from another member is never silently
113
+ * replaced: if the signer returns a different signature for a subsig that is
114
+ * already filled in, this throws instead.
115
+ *
116
+ * @param signer - The signer to append a subsignature from
117
+ * @throws If there is no multisig on this LogicSig, if the signer returns no
118
+ * signature, a signature for a key outside the multisig, or one that
119
+ * conflicts with a signature already collected
120
+ */
82
121
  appendToMultisigWithSigner(signer: DelegatedLsigSigner): Promise<void>;
83
122
  /**
84
123
  * @deprecated Use `signWithSigner` followed by `.sig` instead
@@ -98,8 +137,15 @@ export declare class LogicSig implements encoding.Encodable {
98
137
  * Signs arbitrary data for use with the `ed25519verify` opcode from within
99
138
  * this LogicSig's program.
100
139
  *
140
+ * @remarks
141
+ * This does not modify the LogicSig or delegate it; the LogicSig is only used
142
+ * for the address that domain-separates the signature. The program is
143
+ * responsible for verifying the returned signature against the signer's
144
+ * public key.
145
+ *
101
146
  * @param signer - The signer to sign the data with
102
147
  * @param data - The data to sign
148
+ * @returns A promise which resolves to the raw signature over the data
103
149
  */
104
150
  signDataWithSigner(signer: ProgramDataSigner, data: Uint8Array): Promise<Uint8Array>;
105
151
  }
@@ -172,6 +218,22 @@ export declare class LogicSigAccount implements encoding.Encodable {
172
218
  * from other members.
173
219
  */
174
220
  signMultisig(msig: MultisigMetadata, secretKey: Uint8Array): void;
221
+ /**
222
+ * Turns this LogicSigAccount into a delegated LogicSig, signed by one member
223
+ * of a delegating multisig account.
224
+ *
225
+ * @remarks
226
+ * This produces a LogicSig with a single subsignature filled in. Unless the
227
+ * multisig's threshold is 1, call {@link LogicSigAccount.appendToMultisigWithSigner}
228
+ * with the remaining members' signers before the LogicSig can authorize
229
+ * transactions.
230
+ *
231
+ * If the delegating account is not a multisig, use
232
+ * {@link LogicSigAccount.signWithSigner} instead.
233
+ *
234
+ * @param msig - The multisig delegating to this LogicSig
235
+ * @param signer - The signer of one member of `msig`
236
+ */
175
237
  signMultisigWithSigner(msig: MultisigMetadata, signer: DelegatedLsigSigner): Promise<void>;
176
238
  /**
177
239
  * @deprecated Use appendToMultisigWithSigner
@@ -183,6 +245,16 @@ export declare class LogicSigAccount implements encoding.Encodable {
183
245
  * multisig account.
184
246
  */
185
247
  appendToMultisig(secretKey: Uint8Array): void;
248
+ /**
249
+ * Adds an additional signature from a member of the delegating multisig
250
+ * account.
251
+ *
252
+ * @remarks
253
+ * {@link LogicSigAccount.signMultisigWithSigner} must have been called first
254
+ * to establish the multisig this signature belongs to.
255
+ *
256
+ * @param signer - The signer of another member of the delegating multisig account
257
+ */
186
258
  appendToMultisigWithSigner(signer: DelegatedLsigSigner): Promise<void>;
187
259
  /**
188
260
  * @deprecated Use `signWithSigner` instead
@@ -197,8 +269,17 @@ export declare class LogicSigAccount implements encoding.Encodable {
197
269
  sign(secretKey: Uint8Array): void;
198
270
  /**
199
271
  * Turns this LogicSigAccount into a delegated LogicSig, signed by the given
200
- * signer. If the delegating account is a multisig account, use
201
- * `signMultisigWithSigner` instead.
272
+ * signer. This type of LogicSig has the authority to sign transactions on
273
+ * behalf of another account, called the delegating account.
274
+ *
275
+ * @remarks
276
+ * If the delegating account is a multisig account, use
277
+ * {@link LogicSigAccount.signMultisigWithSigner} instead.
278
+ *
279
+ * The delegating account is taken to be the address the signer reports having
280
+ * signed as, not any sending address the signer advertises: for a rekeyed
281
+ * account the latter is the address it sends transactions from, which is not
282
+ * the account authorizing this delegation.
202
283
  *
203
284
  * @param signer - The signer of the delegating account.
204
285
  */
@@ -209,6 +290,10 @@ export declare class LogicSigAccount implements encoding.Encodable {
209
290
  * returning the result
210
291
  */
211
292
  export declare function logicSigFromByte(encoded: Uint8Array): LogicSig;
293
+ /**
294
+ * The domain-separation prefix prepended, along with the program's address, to
295
+ * data signed for verification by the `ed25519verify` opcode.
296
+ */
212
297
  export declare const SIGN_PROGRAM_DATA_PREFIX: Uint8Array;
213
298
  /**
214
299
  * tealSign creates a signature compatible with ed25519verify opcode from program hash
@@ -128,11 +128,17 @@ export declare function makeApplicationCallTxnFromObject({ sender, appIndex, onC
128
128
  */
129
129
  export declare function makeApplicationCreateTxnFromObject({ sender, onComplete, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, numLocalInts, numLocalByteSlices, numGlobalInts, numGlobalByteSlices, extraPages, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'appIndex' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
130
130
  /**
131
- * Make a transaction that changes an application's approval and clear programs
131
+ * Make a transaction that changes an application's approval and clear programs.
132
+ *
133
+ * The application's global state schema and extra program pages may also be changed during an
134
+ * update by providing numGlobalInts, numGlobalByteSlices, and/or extraPages. The local state schema
135
+ * cannot be changed after application creation. If the pages or global schema increases in size, the entire
136
+ * MBR for the application will move to the sender of the update and that account will become the `sizeSponsor`
137
+ * in the application's parameters. A decrease in schema or pages does not affect MBR or `sizeSponsor`.
132
138
  *
133
139
  * @param options - Application update transaction parameters
134
140
  */
135
- export declare function makeApplicationUpdateTxnFromObject({ sender, appIndex, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'onComplete' | 'numLocalInts' | 'numLocalByteSlices' | 'numGlobalInts' | 'numGlobalByteSlices' | 'extraPages' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
141
+ export declare function makeApplicationUpdateTxnFromObject({ sender, appIndex, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, extraPages, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'onComplete' | 'numLocalInts' | 'numLocalByteSlices' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
136
142
  /**
137
143
  * Make a transaction that deletes an application
138
144
  *
@@ -52,5 +52,7 @@ export declare function masterDerivationKeyToMnemonic(mdk: Uint8Array): string;
52
52
  * @param mn - A 25-word Algorand mnemonic
53
53
  * @param scheme - The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024)
54
54
  * @returns The 32-byte seed to hand to the scheme's key generator
55
+ * @throws If `mn` is not a valid 25-word mnemonic, or if `scheme` is not
56
+ * exactly {@link PQ_SCHEME_SIZE} bytes
55
57
  */
56
58
  export declare function pq25WordMnemonicToSeed(mn: string, scheme: Uint8Array): Uint8Array;
@@ -1,8 +1,45 @@
1
1
  import { Address } from './encoding/address.js';
2
- import { AddressWithDelegatedLsigSigner, AddressWithTransactionSigner } from './signer.js';
2
+ import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
3
+ /**
4
+ * A post-quantum public key, its scheme identifier, and a function that signs
5
+ * raw bytes with the corresponding secret key.
6
+ *
7
+ * @remarks
8
+ * `pqSigner` receives the exact bytes to sign, with every domain-separation
9
+ * prefix already applied, so it can be backed by a key that never leaves a
10
+ * wallet, HSM or hardware device.
11
+ */
3
12
  export interface PQSigningKey {
13
+ /** The 2-byte ASCII PQ scheme identifier (e.g. "f1" for Falcon-1024). */
4
14
  pqScheme: Uint8Array;
15
+ /** The scheme's canonical public key. */
5
16
  pqPublicKey: Uint8Array;
17
+ /** Signs the given bytes verbatim with the corresponding secret key. */
6
18
  pqSigner: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
7
19
  }
8
- export declare function addressWithSignersFromRawPQSigner(signingKey: PQSigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner;
20
+ /**
21
+ * Build the full set of signers for a post-quantum key from a function that
22
+ * signs raw bytes with it.
23
+ *
24
+ * @remarks
25
+ * The account address is derived from the scheme and public key via
26
+ * {@link addressFromPQKey}, so it does not have to be supplied. Every signature
27
+ * produced carries the scheme, canonical salt and public key alongside the
28
+ * signature bytes, which is what lets the network recover the authorizing
29
+ * address from the signature alone.
30
+ *
31
+ * PQ schemes cannot participate in multisig, so `delegatedLsigSigner` throws if
32
+ * given an `msig` argument, and no `mxBytesSigner` or `programDataSigner` is
33
+ * returned — signing arbitrary bytes and program data are ed25519-only
34
+ * operations.
35
+ *
36
+ * @param signingKey - The scheme, public key and raw signing function to build the signers from
37
+ * @param sendingAddress - The address transactions are sent from. Defaults to
38
+ * the derived PQ address; supply it when the PQ key is the auth address of a
39
+ * rekeyed account, in which case the produced transactions carry the derived
40
+ * address in their `sgnr` field.
41
+ * @returns An address bundled with transaction, empty transaction and delegated
42
+ * LogicSig signers
43
+ * @throws If `pqScheme` is not exactly 2 bytes
44
+ */
45
+ export declare function addressWithSignersFromRawPQSigner(signingKey: PQSigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;