algosdk 1.18.1 → 1.20.0-beta.1

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 (160) 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/index.js +5 -1
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/src/abi/abi_type.js +12 -12
  7. package/dist/cjs/src/abi/abi_type.js.map +1 -1
  8. package/dist/cjs/src/abi/contract.js +1 -1
  9. package/dist/cjs/src/abi/contract.js.map +1 -1
  10. package/dist/cjs/src/abi/index.js +5 -1
  11. package/dist/cjs/src/abi/index.js.map +1 -1
  12. package/dist/cjs/src/abi/interface.js +1 -1
  13. package/dist/cjs/src/abi/interface.js.map +1 -1
  14. package/dist/cjs/src/abi/method.js +3 -3
  15. package/dist/cjs/src/abi/method.js.map +1 -1
  16. package/dist/cjs/src/account.js +5 -1
  17. package/dist/cjs/src/account.js.map +1 -1
  18. package/dist/cjs/src/bid.js +5 -1
  19. package/dist/cjs/src/bid.js.map +1 -1
  20. package/dist/cjs/src/client/client.js +7 -3
  21. package/dist/cjs/src/client/client.js.map +1 -1
  22. package/dist/cjs/src/client/kmd.js +5 -1
  23. package/dist/cjs/src/client/kmd.js.map +1 -1
  24. package/dist/cjs/src/client/urlTokenBaseHTTPClient.js +5 -1
  25. package/dist/cjs/src/client/urlTokenBaseHTTPClient.js.map +1 -1
  26. package/dist/cjs/src/client/v2/algod/algod.js +37 -5
  27. package/dist/cjs/src/client/v2/algod/algod.js.map +1 -1
  28. package/dist/cjs/src/client/v2/algod/block.js +5 -1
  29. package/dist/cjs/src/client/v2/algod/block.js.map +1 -1
  30. package/dist/cjs/src/client/v2/algod/compile.js +5 -1
  31. package/dist/cjs/src/client/v2/algod/compile.js.map +1 -1
  32. package/dist/cjs/src/client/v2/algod/dryrun.js +6 -2
  33. package/dist/cjs/src/client/v2/algod/dryrun.js.map +1 -1
  34. package/dist/cjs/src/client/v2/algod/getTransactionProof.js +41 -0
  35. package/dist/cjs/src/client/v2/algod/getTransactionProof.js.map +1 -0
  36. package/dist/cjs/src/client/v2/algod/{proof.js → lightBlockHeaderProof.js} +5 -7
  37. package/dist/cjs/src/client/v2/algod/lightBlockHeaderProof.js.map +1 -0
  38. package/dist/cjs/src/client/v2/algod/models/types.js +117 -30
  39. package/dist/cjs/src/client/v2/algod/models/types.js.map +1 -1
  40. package/dist/cjs/src/client/v2/algod/pendingTransactionInformation.js +5 -1
  41. package/dist/cjs/src/client/v2/algod/pendingTransactionInformation.js.map +1 -1
  42. package/dist/cjs/src/client/v2/algod/pendingTransactions.js +5 -1
  43. package/dist/cjs/src/client/v2/algod/pendingTransactions.js.map +1 -1
  44. package/dist/cjs/src/client/v2/algod/pendingTransactionsByAddress.js +5 -1
  45. package/dist/cjs/src/client/v2/algod/pendingTransactionsByAddress.js.map +1 -1
  46. package/dist/cjs/src/client/v2/algod/sendRawTransaction.js +1 -1
  47. package/dist/cjs/src/client/v2/algod/sendRawTransaction.js.map +1 -1
  48. package/dist/cjs/src/client/v2/algod/stateproof.js +18 -0
  49. package/dist/cjs/src/client/v2/algod/stateproof.js.map +1 -0
  50. package/dist/cjs/src/client/v2/indexer/lookupAccountTransactions.js +1 -1
  51. package/dist/cjs/src/client/v2/indexer/lookupAssetTransactions.js +1 -1
  52. package/dist/cjs/src/client/v2/indexer/lookupAssetTransactions.js.map +1 -1
  53. package/dist/cjs/src/client/v2/indexer/searchForTransactions.js +2 -2
  54. package/dist/cjs/src/client/v2/indexer/searchForTransactions.js.map +1 -1
  55. package/dist/cjs/src/composer.js +9 -9
  56. package/dist/cjs/src/composer.js.map +1 -1
  57. package/dist/cjs/src/dryrun.js +5 -5
  58. package/dist/cjs/src/dryrun.js.map +1 -1
  59. package/dist/cjs/src/encoding/address.js +6 -2
  60. package/dist/cjs/src/encoding/address.js.map +1 -1
  61. package/dist/cjs/src/encoding/encoding.js +5 -1
  62. package/dist/cjs/src/encoding/encoding.js.map +1 -1
  63. package/dist/cjs/src/group.js +5 -1
  64. package/dist/cjs/src/group.js.map +1 -1
  65. package/dist/cjs/src/logic/logic.js +28 -1
  66. package/dist/cjs/src/logic/logic.js.map +1 -1
  67. package/dist/cjs/src/logic/sourcemap.js +67 -0
  68. package/dist/cjs/src/logic/sourcemap.js.map +1 -0
  69. package/dist/cjs/src/logicsig.js +37 -12
  70. package/dist/cjs/src/logicsig.js.map +1 -1
  71. package/dist/cjs/src/main.js +12 -2
  72. package/dist/cjs/src/main.js.map +1 -1
  73. package/dist/cjs/src/makeTxn.js +5 -1
  74. package/dist/cjs/src/makeTxn.js.map +1 -1
  75. package/dist/cjs/src/mnemonic/mnemonic.js +5 -1
  76. package/dist/cjs/src/mnemonic/mnemonic.js.map +1 -1
  77. package/dist/cjs/src/multisig.js +100 -25
  78. package/dist/cjs/src/multisig.js.map +1 -1
  79. package/dist/cjs/src/nacl/naclWrappers.js +5 -1
  80. package/dist/cjs/src/nacl/naclWrappers.js.map +1 -1
  81. package/dist/cjs/src/signer.js +3 -3
  82. package/dist/cjs/src/signer.js.map +1 -1
  83. package/dist/cjs/src/transaction.js +103 -2
  84. package/dist/cjs/src/transaction.js.map +1 -1
  85. package/dist/cjs/src/types/index.js +5 -1
  86. package/dist/cjs/src/types/index.js.map +1 -1
  87. package/dist/cjs/src/types/transactions/base.js +6 -1
  88. package/dist/cjs/src/types/transactions/base.js.map +1 -1
  89. package/dist/cjs/src/types/transactions/index.js +5 -1
  90. package/dist/cjs/src/types/transactions/index.js.map +1 -1
  91. package/dist/cjs/src/types/transactions/stateproof.js +3 -0
  92. package/dist/cjs/src/types/transactions/stateproof.js.map +1 -0
  93. package/dist/cjs/src/utils/utils.js +1 -1
  94. package/dist/cjs/src/utils/utils.js.map +1 -1
  95. package/dist/esm/src/client/client.js +2 -2
  96. package/dist/esm/src/client/client.js.map +1 -1
  97. package/dist/esm/src/client/v2/algod/algod.js +37 -5
  98. package/dist/esm/src/client/v2/algod/algod.js.map +1 -1
  99. package/dist/esm/src/client/v2/algod/compile.js +5 -1
  100. package/dist/esm/src/client/v2/algod/compile.js.map +1 -1
  101. package/dist/esm/src/client/v2/algod/getTransactionProof.js +35 -0
  102. package/dist/esm/src/client/v2/algod/getTransactionProof.js.map +1 -0
  103. package/dist/esm/src/client/v2/algod/lightBlockHeaderProof.js +12 -0
  104. package/dist/esm/src/client/v2/algod/lightBlockHeaderProof.js.map +1 -0
  105. package/dist/esm/src/client/v2/algod/models/types.js +112 -28
  106. package/dist/esm/src/client/v2/algod/models/types.js.map +1 -1
  107. package/dist/esm/src/client/v2/algod/stateproof.js +12 -0
  108. package/dist/esm/src/client/v2/algod/stateproof.js.map +1 -0
  109. package/dist/esm/src/client/v2/indexer/lookupAccountTransactions.js +1 -1
  110. package/dist/esm/src/client/v2/indexer/searchForTransactions.js +1 -1
  111. package/dist/esm/src/logic/logic.js +28 -1
  112. package/dist/esm/src/logic/logic.js.map +1 -1
  113. package/dist/esm/src/logic/sourcemap.js +40 -0
  114. package/dist/esm/src/logic/sourcemap.js.map +1 -0
  115. package/dist/esm/src/logicsig.js +29 -9
  116. package/dist/esm/src/logicsig.js.map +1 -1
  117. package/dist/esm/src/main.js +2 -1
  118. package/dist/esm/src/main.js.map +1 -1
  119. package/dist/esm/src/multisig.js +92 -23
  120. package/dist/esm/src/multisig.js.map +1 -1
  121. package/dist/esm/src/nacl/naclWrappers.js +3 -0
  122. package/dist/esm/src/nacl/naclWrappers.js.map +1 -1
  123. package/dist/esm/src/transaction.js +97 -0
  124. package/dist/esm/src/transaction.js.map +1 -1
  125. package/dist/esm/src/types/transactions/base.js +6 -1
  126. package/dist/esm/src/types/transactions/base.js.map +1 -1
  127. package/dist/esm/src/types/transactions/index.js.map +1 -1
  128. package/dist/esm/src/types/transactions/stateproof.js +2 -0
  129. package/dist/esm/src/types/transactions/stateproof.js.map +1 -0
  130. package/dist/types/src/client/client.d.ts +1 -1
  131. package/dist/types/src/client/v2/algod/algod.d.ts +32 -4
  132. package/dist/types/src/client/v2/algod/compile.d.ts +1 -0
  133. package/dist/types/src/client/v2/algod/getTransactionProof.d.ts +27 -0
  134. package/dist/types/src/client/v2/algod/{proof.d.ts → lightBlockHeaderProof.d.ts} +2 -3
  135. package/dist/types/src/client/v2/algod/models/types.d.ts +119 -30
  136. package/dist/types/src/client/v2/algod/stateproof.d.ts +8 -0
  137. package/dist/types/src/client/v2/indexer/lookupAccountTransactions.d.ts +1 -1
  138. package/dist/types/src/client/v2/indexer/searchForTransactions.d.ts +1 -1
  139. package/dist/types/src/logic/logic.d.ts +19 -0
  140. package/dist/types/src/logic/sourcemap.d.ts +20 -0
  141. package/dist/types/src/logicTemplates/dynamicfee.d.ts +2 -2
  142. package/dist/types/src/logicTemplates/htlc.d.ts +1 -1
  143. package/dist/types/src/logicTemplates/limitorder.d.ts +3 -3
  144. package/dist/types/src/logicTemplates/periodicpayment.d.ts +7 -7
  145. package/dist/types/src/logicTemplates/split.d.ts +2 -2
  146. package/dist/types/src/logicsig.d.ts +9 -3
  147. package/dist/types/src/main.d.ts +2 -1
  148. package/dist/types/src/multisig.d.ts +36 -2
  149. package/dist/types/src/nacl/naclWrappers.d.ts +1 -0
  150. package/dist/types/src/transaction.d.ts +7 -0
  151. package/dist/types/src/types/blockHeader.d.ts +9 -1
  152. package/dist/types/src/types/transactions/base.d.ts +17 -1
  153. package/dist/types/src/types/transactions/encoded.d.ts +12 -0
  154. package/dist/types/src/types/transactions/index.d.ts +3 -1
  155. package/dist/types/src/types/transactions/stateproof.d.ts +8 -0
  156. package/dist/types/src/utils/utils.d.ts +1 -0
  157. package/package.json +14 -10
  158. package/dist/cjs/src/client/v2/algod/proof.js.map +0 -1
  159. package/dist/esm/src/client/v2/algod/proof.js +0 -14
  160. package/dist/esm/src/client/v2/algod/proof.js.map +0 -1
@@ -6,22 +6,24 @@ import AccountApplicationInformation from './accountApplicationInformation';
6
6
  import Block from './block';
7
7
  import Compile from './compile';
8
8
  import Dryrun from './dryrun';
9
+ import Genesis from './genesis';
9
10
  import GetAssetByID from './getAssetByID';
10
11
  import GetApplicationByID from './getApplicationByID';
11
12
  import HealthCheck from './healthCheck';
12
13
  import PendingTransactionInformation from './pendingTransactionInformation';
13
14
  import PendingTransactions from './pendingTransactions';
14
15
  import PendingTransactionsByAddress from './pendingTransactionsByAddress';
16
+ import GetTransactionProof from './getTransactionProof';
15
17
  import SendRawTransaction from './sendRawTransaction';
16
18
  import Status from './status';
17
19
  import StatusAfterBlock from './statusAfterBlock';
18
20
  import SuggestedParams from './suggestedParams';
19
21
  import Supply from './supply';
20
22
  import Versions from './versions';
21
- import Genesis from './genesis';
22
- import Proof from './proof';
23
23
  import { BaseHTTPClient } from '../../baseHTTPClient';
24
24
  import { AlgodTokenHeader, CustomTokenHeader } from '../../urlTokenBaseHTTPClient';
25
+ import LightBlockHeaderProof from './lightBlockHeaderProof';
26
+ import StateProof from './stateproof';
25
27
  /**
26
28
  * Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
27
29
  *
@@ -368,7 +370,7 @@ export default class AlgodClient extends ServiceClient {
368
370
  * ```typescript
369
371
  * const round = 18038133;
370
372
  * const txId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
371
- * const proof = await algodClient.getProof(round, txId).do();
373
+ * const proof = await algodClient.getTransactionProof(round, txId).do();
372
374
  * ```
373
375
  *
374
376
  * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2blocksroundtransactionstxidproof)
@@ -376,5 +378,31 @@ export default class AlgodClient extends ServiceClient {
376
378
  * @param txID - The transaction ID for which to generate a proof.
377
379
  * @category GET
378
380
  */
379
- getProof(round: number, txID: string): Proof;
381
+ getTransactionProof(round: number, txID: string): GetTransactionProof;
382
+ /**
383
+ * Gets a proof for a given light block header inside a state proof commitment.
384
+ *
385
+ * #### Example
386
+ * ```typescript
387
+ * const round = 11111111;
388
+ * const lightBlockHeaderProof = await algodClient.getLightBlockHeaderProof(round).do();
389
+ * ```
390
+ *
391
+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2#get-v2blocksroundlightheaderproof)
392
+ * @param round
393
+ */
394
+ getLightBlockHeaderProof(round: number): LightBlockHeaderProof;
395
+ /**
396
+ * Gets a state proof that covers a given round.
397
+ *
398
+ * #### Example
399
+ * ```typescript
400
+ * const round = 11111111;
401
+ * const stateProof = await algodClient.getStateProof(round).do();
402
+ * ```
403
+ *
404
+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2#get-v2stateproofsround)
405
+ * @param round
406
+ */
407
+ getStateProof(round: number): StateProof;
380
408
  }
@@ -12,6 +12,7 @@ export default class Compile extends JSONRequest {
12
12
  private source;
13
13
  constructor(c: HTTPClient, source: string | Uint8Array);
14
14
  path(): string;
15
+ sourcemap(map?: boolean): this;
15
16
  /**
16
17
  * Executes compile
17
18
  * @param headers - A headers object
@@ -0,0 +1,27 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ import HTTPClient from '../../client';
3
+ import IntDecoding from '../../../types/intDecoding';
4
+ export default class GetTransactionProof extends JSONRequest {
5
+ private round;
6
+ private txID;
7
+ constructor(c: HTTPClient, intDecoding: IntDecoding, round: number, txID: string);
8
+ path(): string;
9
+ /**
10
+ * Exclude assets and application data from results
11
+ * The type of hash function used to create the proof, must be one of: "sha512_256", "sha256"
12
+ *
13
+ * #### Example
14
+ * ```typescript
15
+ * const hashType = "sha256";
16
+ * const round = 123456;
17
+ * const txId = "abc123;
18
+ * const txProof = await algodClient.getTransactionProof(round, txId)
19
+ * .hashType(hashType)
20
+ * .do();
21
+ * ```
22
+ *
23
+ * @param hashType
24
+ * @category query
25
+ */
26
+ hashType(hashType: string): this;
27
+ }
@@ -1,9 +1,8 @@
1
1
  import JSONRequest from '../jsonrequest';
2
2
  import HTTPClient from '../../client';
3
3
  import IntDecoding from '../../../types/intDecoding';
4
- export default class Proof extends JSONRequest {
4
+ export default class LightBlockHeaderProof extends JSONRequest {
5
5
  private round;
6
- private txID;
7
- constructor(c: HTTPClient, intDecoding: IntDecoding, round: number, txID: string);
6
+ constructor(c: HTTPClient, intDecoding: IntDecoding, round: number);
8
7
  path(): string;
9
8
  }
@@ -970,6 +970,32 @@ export declare class EvalDeltaKeyValue extends BaseModel {
970
970
  */
971
971
  constructor(key: string, value: EvalDelta);
972
972
  }
973
+ /**
974
+ * Proof of membership and position of a light block header.
975
+ */
976
+ export declare class LightBlockHeaderProof extends BaseModel {
977
+ /**
978
+ * The index of the light block header in the vector commitment tree
979
+ */
980
+ index: number | bigint;
981
+ /**
982
+ * The encoded proof.
983
+ */
984
+ proof: Uint8Array;
985
+ /**
986
+ * Represents the depth of the tree that is being proven, i.e. the number of edges
987
+ * from a leaf to the root.
988
+ */
989
+ treedepth: number | bigint;
990
+ /**
991
+ * Creates a new `LightBlockHeaderProof` object.
992
+ * @param index - The index of the light block header in the vector commitment tree
993
+ * @param proof - The encoded proof.
994
+ * @param treedepth - Represents the depth of the tree that is being proven, i.e. the number of edges
995
+ * from a leaf to the root.
996
+ */
997
+ constructor(index: number | bigint, proof: string | Uint8Array, treedepth: number | bigint);
998
+ }
973
999
  /**
974
1000
  *
975
1001
  */
@@ -1223,49 +1249,66 @@ export declare class PostTransactionsResponse extends BaseModel {
1223
1249
  constructor(txid: string);
1224
1250
  }
1225
1251
  /**
1226
- * Proof of transaction in a block.
1252
+ * Represents a state proof and its corresponding message
1227
1253
  */
1228
- export declare class ProofResponse extends BaseModel {
1254
+ export declare class StateProof extends BaseModel {
1229
1255
  /**
1230
- * Index of the transaction in the block's payset.
1256
+ * Represents the message that the state proofs are attesting to.
1231
1257
  */
1232
- idx: number | bigint;
1258
+ message: StateProofMessage;
1233
1259
  /**
1234
- * Merkle proof of transaction membership.
1260
+ * The encoded StateProof for the message.
1235
1261
  */
1236
- proof: Uint8Array;
1262
+ stateproof: Uint8Array;
1237
1263
  /**
1238
- * Hash of SignedTxnInBlock for verifying proof.
1264
+ * Creates a new `StateProof` object.
1265
+ * @param message - Represents the message that the state proofs are attesting to.
1266
+ * @param stateproof - The encoded StateProof for the message.
1239
1267
  */
1240
- stibhash: Uint8Array;
1268
+ constructor(message: StateProofMessage, stateproof: string | Uint8Array);
1269
+ }
1270
+ /**
1271
+ * Represents the message that the state proofs are attesting to.
1272
+ */
1273
+ export declare class StateProofMessage extends BaseModel {
1241
1274
  /**
1242
- * Represents the depth of the tree that is being proven, i.e. the number of edges
1243
- * from a leaf to the root.
1275
+ * The vector commitment root on all light block headers within a state proof
1276
+ * interval.
1244
1277
  */
1245
- treedepth: number | bigint;
1278
+ blockheaderscommitment: Uint8Array;
1246
1279
  /**
1247
- * The type of hash function used to create the proof, must be one of:
1248
- * * sha512_256
1249
- * * sha256
1280
+ * The first round the message attests to.
1250
1281
  */
1251
- hashtype?: string;
1282
+ firstattestedround: number | bigint;
1252
1283
  /**
1253
- * Creates a new `ProofResponse` object.
1254
- * @param idx - Index of the transaction in the block's payset.
1255
- * @param proof - Merkle proof of transaction membership.
1256
- * @param stibhash - Hash of SignedTxnInBlock for verifying proof.
1257
- * @param treedepth - Represents the depth of the tree that is being proven, i.e. the number of edges
1258
- * from a leaf to the root.
1259
- * @param hashtype - The type of hash function used to create the proof, must be one of:
1260
- * * sha512_256
1261
- * * sha256
1284
+ * The last round the message attests to.
1262
1285
  */
1263
- constructor({ idx, proof, stibhash, treedepth, hashtype, }: {
1264
- idx: number | bigint;
1265
- proof: string | Uint8Array;
1266
- stibhash: string | Uint8Array;
1267
- treedepth: number | bigint;
1268
- hashtype?: string;
1286
+ lastattestedround: number | bigint;
1287
+ /**
1288
+ * An integer value representing the natural log of the proven weight with 16 bits
1289
+ * of precision. This value would be used to verify the next state proof.
1290
+ */
1291
+ lnprovenweight: number | bigint;
1292
+ /**
1293
+ * The vector commitment root of the top N accounts to sign the next StateProof.
1294
+ */
1295
+ voterscommitment: Uint8Array;
1296
+ /**
1297
+ * Creates a new `StateProofMessage` object.
1298
+ * @param blockheaderscommitment - The vector commitment root on all light block headers within a state proof
1299
+ * interval.
1300
+ * @param firstattestedround - The first round the message attests to.
1301
+ * @param lastattestedround - The last round the message attests to.
1302
+ * @param lnprovenweight - An integer value representing the natural log of the proven weight with 16 bits
1303
+ * of precision. This value would be used to verify the next state proof.
1304
+ * @param voterscommitment - The vector commitment root of the top N accounts to sign the next StateProof.
1305
+ */
1306
+ constructor({ blockheaderscommitment, firstattestedround, lastattestedround, lnprovenweight, voterscommitment, }: {
1307
+ blockheaderscommitment: string | Uint8Array;
1308
+ firstattestedround: number | bigint;
1309
+ lastattestedround: number | bigint;
1310
+ lnprovenweight: number | bigint;
1311
+ voterscommitment: string | Uint8Array;
1269
1312
  });
1270
1313
  }
1271
1314
  /**
@@ -1389,6 +1432,52 @@ export declare class TransactionParametersResponse extends BaseModel {
1389
1432
  minFee: number | bigint;
1390
1433
  });
1391
1434
  }
1435
+ /**
1436
+ * Proof of transaction in a block.
1437
+ */
1438
+ export declare class TransactionProofResponse extends BaseModel {
1439
+ /**
1440
+ * Index of the transaction in the block's payset.
1441
+ */
1442
+ idx: number | bigint;
1443
+ /**
1444
+ * Proof of transaction membership.
1445
+ */
1446
+ proof: Uint8Array;
1447
+ /**
1448
+ * Hash of SignedTxnInBlock for verifying proof.
1449
+ */
1450
+ stibhash: Uint8Array;
1451
+ /**
1452
+ * Represents the depth of the tree that is being proven, i.e. the number of edges
1453
+ * from a leaf to the root.
1454
+ */
1455
+ treedepth: number | bigint;
1456
+ /**
1457
+ * The type of hash function used to create the proof, must be one of:
1458
+ * * sha512_256
1459
+ * * sha256
1460
+ */
1461
+ hashtype?: string;
1462
+ /**
1463
+ * Creates a new `TransactionProofResponse` object.
1464
+ * @param idx - Index of the transaction in the block's payset.
1465
+ * @param proof - Proof of transaction membership.
1466
+ * @param stibhash - Hash of SignedTxnInBlock for verifying proof.
1467
+ * @param treedepth - Represents the depth of the tree that is being proven, i.e. the number of edges
1468
+ * from a leaf to the root.
1469
+ * @param hashtype - The type of hash function used to create the proof, must be one of:
1470
+ * * sha512_256
1471
+ * * sha256
1472
+ */
1473
+ constructor({ idx, proof, stibhash, treedepth, hashtype, }: {
1474
+ idx: number | bigint;
1475
+ proof: string | Uint8Array;
1476
+ stibhash: string | Uint8Array;
1477
+ treedepth: number | bigint;
1478
+ hashtype?: string;
1479
+ });
1480
+ }
1392
1481
  /**
1393
1482
  * algod version information.
1394
1483
  */
@@ -0,0 +1,8 @@
1
+ import JSONRequest from '../jsonrequest';
2
+ import HTTPClient from '../../client';
3
+ import IntDecoding from '../../../types/intDecoding';
4
+ export default class StateProof extends JSONRequest {
5
+ private round;
6
+ constructor(c: HTTPClient, intDecoding: IntDecoding, round: number);
7
+ path(): string;
8
+ }
@@ -55,7 +55,7 @@ export default class LookupAccountTransactions extends JSONRequest {
55
55
  * .do();
56
56
  * ```
57
57
  *
58
- * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl`
58
+ * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl`, `stpf`
59
59
  * @category query
60
60
  */
61
61
  txType(type: string): this;
@@ -42,7 +42,7 @@ export default class SearchForTransactions extends JSONRequest {
42
42
  * .do();
43
43
  * ```
44
44
  *
45
- * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl`
45
+ * @param type - one of `pay`, `keyreg`, `acfg`, `axfer`, `afrz`, `appl`, `stpf`
46
46
  * @category query
47
47
  */
48
48
  txType(type: string): this;
@@ -1,9 +1,16 @@
1
1
  /**
2
2
  * Utilities for working with program bytes.
3
3
  */
4
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
4
5
  export declare function parseUvarint(array: Uint8Array): [numberFound: number, size: number];
5
6
  /** readProgram validates program for length and running cost,
6
7
  * and additionally provides the found int variables and byte blocks
8
+ *
9
+ * @deprecated Validation relies on metadata (`langspec.json`) that
10
+ * does not accurately represent opcode behavior across program versions.
11
+ * The behavior of `readProgram` relies on `langspec.json`.
12
+ * Thus, this method is being deprecated.
13
+ *
7
14
  * @param program - Program to check
8
15
  * @param args - Program arguments as array of Uint8Array arrays
9
16
  * @throws
@@ -12,15 +19,27 @@ export declare function parseUvarint(array: Uint8Array): [numberFound: number, s
12
19
  export declare function readProgram(program: Uint8Array, args?: Uint8Array[]): [ints: number[], byteArrays: Uint8Array[], valid: boolean];
13
20
  /**
14
21
  * checkProgram validates program for length and running cost
22
+ *
23
+ * @deprecated Validation relies on metadata (`langspec.json`) that
24
+ * does not accurately represent opcode behavior across program versions.
25
+ * The behavior of `checkProgram` relies on `langspec.json`.
26
+ * Thus, this method is being deprecated.
27
+ *
15
28
  * @param program - Program to check
16
29
  * @param args - Program arguments as array of Uint8Array arrays
17
30
  * @throws
18
31
  * @returns true if success
19
32
  */
20
33
  export declare function checkProgram(program: Uint8Array, args?: Uint8Array[]): boolean;
34
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
21
35
  export declare function checkIntConstBlock(program: Uint8Array, pc: number): number;
36
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
22
37
  export declare function checkByteConstBlock(program: Uint8Array, pc: number): number;
38
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
23
39
  export declare function checkPushIntOp(program: Uint8Array, pc: number): number;
40
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
24
41
  export declare function checkPushByteOp(program: Uint8Array, pc: number): number;
42
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
25
43
  export declare const langspecEvalMaxVersion: number;
44
+ /** @deprecated for langspec.json is deprecated aross all SDKs */
26
45
  export declare const langspecLogicSigVersion: number;
@@ -0,0 +1,20 @@
1
+ export declare class SourceMap {
2
+ version: number;
3
+ sources: string[];
4
+ names: string[];
5
+ mappings: string;
6
+ pcToLine: {
7
+ [key: number]: number;
8
+ };
9
+ lineToPc: {
10
+ [key: number]: number[];
11
+ };
12
+ constructor({ version, sources, names, mappings, }: {
13
+ version: number;
14
+ sources: string[];
15
+ names: string[];
16
+ mappings: string;
17
+ });
18
+ getLineForPc(pc: number): number | undefined;
19
+ getPcsForLine(line: number): number[] | undefined;
20
+ }
@@ -15,7 +15,7 @@ export class DynamicFee {
15
15
  * @param {string} lease: leave undefined to generate a random lease, or supply a lease as base64
16
16
  * @returns {DynamicFee}
17
17
  */
18
- constructor(receiver: string, amount: any, firstValid: any, lastValid: any, closeRemainder: string, lease: string);
18
+ constructor(receiver: string, amount: int, firstValid: int, lastValid: int, closeRemainder: string, lease: string);
19
19
  programBytes: any;
20
20
  address: string;
21
21
  /**
@@ -44,7 +44,7 @@ export class DynamicFee {
44
44
  *
45
45
  * @throws on invalid lsig
46
46
  */
47
- export function getDynamicFeeTransactions(txn: any, lsig: any, privateKey: Uint8Array, fee: any): Uint8Array;
47
+ export function getDynamicFeeTransactions(txn: dict, lsig: LogicSig, privateKey: Uint8Array, fee: int): Uint8Array;
48
48
  /**
49
49
  * signDynamicFee returns the main transaction and signed logic needed to complete the transfer.
50
50
  * These should be sent to the fee payer, who can use GetDynamicFeeTransactions
@@ -22,7 +22,7 @@ export class HTLC {
22
22
  * @param {int} maxFee: the maximum fee that can be paid to the network by the account
23
23
  * @returns {HTLC}
24
24
  */
25
- constructor(owner: string, receiver: string, hashFunction: string, hashImage: string, expiryRound: any, maxFee: any);
25
+ constructor(owner: string, receiver: string, hashFunction: string, hashImage: string, expiryRound: int, maxFee: int);
26
26
  programBytes: any;
27
27
  address: string;
28
28
  /**
@@ -32,11 +32,11 @@ export class LimitOrder {
32
32
  * @param {int} maxFee: maximum fee used by the limit order transaction
33
33
  * @returns {LimitOrder}
34
34
  */
35
- constructor(owner: string, assetid: any, ratn: any, ratd: any, expiryRound: any, minTrade: any, maxFee: any);
35
+ constructor(owner: string, assetid: int, ratn: int, ratd: int, expiryRound: int, minTrade: int, maxFee: int);
36
36
  programBytes: any;
37
37
  address: string;
38
38
  owner: string;
39
- assetid: any;
39
+ assetid: int;
40
40
  /**
41
41
  * returns the program bytes
42
42
  * @returns {Uint8Array}
@@ -67,4 +67,4 @@ export class LimitOrder {
67
67
  * these transactions will be rejected if they do not meet the restrictions set by the contract
68
68
  * @throws error if arguments fail contract validation
69
69
  */
70
- export function getSwapAssetsTransaction(contract: Uint8Array, assetAmount: any, microAlgoAmount: any, secretKey: Uint8Array, fee: any, firstRound: any, lastRound: any, genesisHash: string): Uint8Array;
70
+ export function getSwapAssetsTransaction(contract: Uint8Array, assetAmount: int, microAlgoAmount: int, secretKey: Uint8Array, fee: int, firstRound: int, lastRound: int, genesisHash: string): Uint8Array;
@@ -22,13 +22,13 @@ export class PeriodicPayment {
22
22
  * @param {string} lease: b64 representation of lease to use, or leave undefined to generate one
23
23
  * @returns {PeriodicPayment}
24
24
  */
25
- constructor(receiver: string, amount: any, withdrawalWindow: any, period: any, expiryRound: any, maxFee: any, lease: string);
25
+ constructor(receiver: string, amount: int, withdrawalWindow: int, period: int, expiryRound: int, maxFee: int, lease: string);
26
26
  receiver: string;
27
- amount: any;
28
- withdrawalWindow: any;
29
- period: any;
30
- expiryRound: any;
31
- maxFee: any;
27
+ amount: int;
28
+ withdrawalWindow: int;
29
+ period: int;
30
+ expiryRound: int;
31
+ maxFee: int;
32
32
  lease: string;
33
33
  programBytes: Uint8Array;
34
34
  address: string;
@@ -55,4 +55,4 @@ export class PeriodicPayment {
55
55
  * @returns {Object} Object containing txID and blob representing signed transaction
56
56
  * @throws error on failure
57
57
  */
58
- export function getPeriodicPaymentWithdrawalTransaction(contract: Uint8Array, fee: any, firstValid: any, genesisHash: string): any;
58
+ export function getPeriodicPaymentWithdrawalTransaction(contract: Uint8Array, fee: int, firstValid: int, genesisHash: string): any;
@@ -27,7 +27,7 @@ export class Split {
27
27
  * @param {int} maxFee: half of the maximum fee used by each split forwarding group transaction
28
28
  * @returns {Split}
29
29
  */
30
- constructor(owner: string, receiverOne: string, receiverTwo: string, rat1: any, rat2: any, expiryRound: any, minPay: any, maxFee: any);
30
+ constructor(owner: string, receiverOne: string, receiverTwo: string, rat1: int, rat2: int, expiryRound: int, minPay: int, maxFee: int);
31
31
  programBytes: any;
32
32
  address: string;
33
33
  /**
@@ -54,4 +54,4 @@ export class Split {
54
54
  * @param {string} genesisHash: the b64-encoded genesis hash indicating the network for this transaction
55
55
  * @returns {Uint8Array}
56
56
  */
57
- export function getSplitFundsTransaction(contract: Uint8Array, amount: any, firstRound: any, lastRound: any, fee: any, genesisHash: string): Uint8Array;
57
+ export function getSplitFundsTransaction(contract: Uint8Array, amount: int, firstRound: int, lastRound: int, fee: int, genesisHash: string): Uint8Array;
@@ -8,6 +8,12 @@ interface LogicSigStorageStructure {
8
8
  sig?: Uint8Array;
9
9
  msig?: EncodedMultisig;
10
10
  }
11
+ /** sanityCheckProgram performs heuristic program validation:
12
+ * check if passed in bytes are Algorand address or is B64 encoded, rather than Teal bytes
13
+ *
14
+ * @param program - Program bytes to check
15
+ */
16
+ export declare function sanityCheckProgram(program: Uint8Array): void;
11
17
  /**
12
18
  LogicSig implementation
13
19
  */
@@ -169,12 +175,12 @@ export declare function signLogicSigTransaction(txn: txnBuilder.TransactionLike,
169
175
  */
170
176
  export declare function logicSigFromByte(encoded: Uint8Array): LogicSig;
171
177
  /**
172
- * tealSign creates a signature compatible with ed25519verify opcode from contract address
178
+ * tealSign creates a signature compatible with ed25519verify opcode from program hash
173
179
  * @param sk - uint8array with secret key
174
180
  * @param data - buffer with data to sign
175
- * @param contractAddress - string representation of teal contract address (program hash)
181
+ * @param programHash - string representation of teal program hash (= contract address for LogicSigs)
176
182
  */
177
- export declare function tealSign(sk: Uint8Array, data: Uint8Array | Buffer, contractAddress: string): Uint8Array;
183
+ export declare function tealSign(sk: Uint8Array, data: Uint8Array | Buffer, programHash: string): Uint8Array;
178
184
  /**
179
185
  * tealSignFromProgram creates a signature compatible with ed25519verify opcode from raw program bytes
180
186
  * @param sk - uint8array with secret key
@@ -77,7 +77,8 @@ export { mnemonicToMasterDerivationKey, masterDerivationKeyToMnemonic, secretKey
77
77
  export { microalgosToAlgos, algosToMicroalgos, INVALID_MICROALGOS_ERROR_MSG, } from './convert';
78
78
  export { computeGroupID, assignGroupID } from './group';
79
79
  export { LogicSigAccount, makeLogicSig, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, } from './logicsig';
80
- export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, multisigAddress, } from './multisig';
80
+ export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, createMultisigTransaction, appendSignRawMultisigSignature, verifyMultisig, multisigAddress, } from './multisig';
81
+ export { SourceMap } from './logic/sourcemap';
81
82
  export declare const LogicTemplates: any;
82
83
  export * from './dryrun';
83
84
  export * from './makeTxn';
@@ -12,9 +12,19 @@ export declare const MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG = "Cannot merge txs
12
12
  export declare const MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG = "Cannot merge txs. subsigs are mismatched.";
13
13
  export declare const MULTISIG_NO_MUTATE_ERROR_MSG = "Cannot mutate a multisig field as it would invalidate all existing signatures.";
14
14
  export declare const MULTISIG_USE_PARTIAL_SIGN_ERROR_MSG = "Cannot sign a multisig transaction using `signTxn`. Use `partialSignTxn` instead.";
15
+ export declare const MULTISIG_SIGNATURE_LENGTH_ERROR_MSG = "Cannot add multisig signature. Signature is not of the correct length.";
15
16
  interface MultisigMetadataWithPks extends Omit<MultisigMetadata, 'addrs'> {
16
17
  pks: Uint8Array[];
17
18
  }
19
+ /**
20
+ * createRawMultisigTransaction creates a raw, unsigned multisig transaction blob.
21
+ * @param txn - the actual transaction.
22
+ * @param version - multisig version
23
+ * @param threshold - multisig threshold
24
+ * @param pks - ordered list of public keys in this multisig
25
+ * @returns encoded multisig blob
26
+ */
27
+ export declare function createMultisigTransaction(txn: txnBuilder.Transaction, { version, threshold, addrs }: MultisigMetadata): Uint8Array;
18
28
  /**
19
29
  * MultisigTransaction is a Transaction that also supports creating partially-signed multisig transactions.
20
30
  */
@@ -41,6 +51,15 @@ export declare class MultisigTransaction extends txnBuilder.Transaction {
41
51
  * @returns an encoded, partially signed multisig transaction.
42
52
  */
43
53
  partialSignTxn({ version, threshold, pks }: MultisigMetadataWithPks, sk: Uint8Array): Uint8Array;
54
+ /**
55
+ * partialSignWithMultisigSignature partially signs this transaction with an external raw multisig signature and returns
56
+ * a partially-signed multisig transaction, encoded with msgpack as a typed array.
57
+ * @param metadata - multisig metadata
58
+ * @param signerAddr - address of the signer
59
+ * @param signature - raw multisig signature
60
+ * @returns an encoded, partially signed multisig transaction.
61
+ */
62
+ partialSignWithMultisigSignature(metadata: MultisigMetadataWithPks, signerAddr: string, signature: Uint8Array): Uint8Array;
44
63
  static from_obj_for_encoding(txnForEnc: EncodedTransaction): MultisigTransaction;
45
64
  }
46
65
  /**
@@ -53,7 +72,7 @@ export declare function verifyMultisig(toBeVerified: Uint8Array, msig: EncodedMu
53
72
  /**
54
73
  * signMultisigTransaction takes a raw transaction (see signTransaction), a multisig preimage, a secret key, and returns
55
74
  * a multisig transaction, which is a blob representing a transaction and multisignature account preimage. The returned
56
- * multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendMultisigTransaction.
75
+ * multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendSignMultisigTransaction.
57
76
  * @param txn - object with either payment or key registration fields
58
77
  * @param version - multisig version
59
78
  * @param threshold - multisig threshold
@@ -81,9 +100,24 @@ export declare function appendSignMultisigTransaction(multisigTxnBlob: Uint8Arra
81
100
  txID: string;
82
101
  blob: Uint8Array;
83
102
  };
103
+ /**
104
+ * appendMultisigTransactionSignature takes a multisig transaction blob, and appends a given raw signature to it.
105
+ * This makes it possible to compile a multisig signature using only raw signatures from external methods.
106
+ * @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
107
+ * @param version - multisig version
108
+ * @param threshold - multisig threshold
109
+ * @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
110
+ * @param signerAddr - address of the signer
111
+ * @param signature - raw multisig signature
112
+ * @returns object containing txID, and blob representing encoded multisig txn
113
+ */
114
+ export declare function appendSignRawMultisigSignature(multisigTxnBlob: Uint8Array, { version, threshold, addrs }: MultisigMetadata, signerAddr: string, signature: Uint8Array): {
115
+ txID: string;
116
+ blob: Uint8Array;
117
+ };
84
118
  /**
85
119
  * multisigAddress takes multisig metadata (preimage) and returns the corresponding human readable Algorand address.
86
- * @param version - mutlisig version
120
+ * @param version - multisig version
87
121
  * @param threshold - multisig threshold
88
122
  * @param addrs - list of Algorand addresses
89
123
  */
@@ -4,6 +4,7 @@ export declare function genericHash(arr: sha512.Message): number[];
4
4
  export declare function randomBytes(length: number): Uint8Array;
5
5
  export declare function keyPairFromSeed(seed: Uint8Array): nacl.SignKeyPair;
6
6
  export declare function keyPair(): nacl.SignKeyPair;
7
+ export declare function isValidSignatureLength(len: number): boolean;
7
8
  export declare function keyPairFromSecretKey(sk: Uint8Array): nacl.SignKeyPair;
8
9
  export declare function sign(msg: Uint8Array, secretKey: Uint8Array): Uint8Array;
9
10
  export declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
@@ -58,6 +58,9 @@ interface TransactionStorageStructure extends Omit<TransactionParams, 'from' | '
58
58
  nonParticipation?: boolean;
59
59
  group?: Buffer;
60
60
  extraPages?: number;
61
+ stateProofType?: number | bigint;
62
+ stateProof?: Uint8Array;
63
+ stateProofMessage?: Uint8Array;
61
64
  }
62
65
  /**
63
66
  * Transaction enables construction of Algorand transactions
@@ -115,6 +118,9 @@ export declare class Transaction implements TransactionStorageStructure {
115
118
  nonParticipation?: boolean;
116
119
  group?: Buffer;
117
120
  extraPages?: number;
121
+ stateProofType?: number | bigint;
122
+ stateProof?: Uint8Array;
123
+ stateProofMessage?: Uint8Array;
118
124
  constructor({ ...transaction }: AnyTransaction);
119
125
  get_obj_for_encoding(): EncodedTransaction;
120
126
  static from_obj_for_encoding(txnForEnc: EncodedTransaction): Transaction;
@@ -123,6 +129,7 @@ export declare class Transaction implements TransactionStorageStructure {
123
129
  toByte(): Uint8Array;
124
130
  rawSignTxn(sk: Uint8Array): Buffer;
125
131
  signTxn(sk: Uint8Array): Uint8Array;
132
+ attachSignature(signerAddr: string, signature: Uint8Array): Uint8Array;
126
133
  rawTxID(): Buffer;
127
134
  txID(): string;
128
135
  addLease(lease: Uint8Array, feePerByte?: number): void;