algosdk 1.10.1 → 1.13.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 (107) hide show
  1. package/README.md +17 -6
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/src/abi/abi_type.js +665 -0
  5. package/dist/cjs/src/abi/abi_type.js.map +1 -0
  6. package/dist/cjs/src/abi/contract.js +25 -0
  7. package/dist/cjs/src/abi/contract.js.map +1 -0
  8. package/dist/cjs/src/abi/index.js +17 -0
  9. package/dist/cjs/src/abi/index.js.map +1 -0
  10. package/dist/cjs/src/abi/interface.js +21 -0
  11. package/dist/cjs/src/abi/interface.js.map +1 -0
  12. package/dist/cjs/src/abi/method.js +117 -0
  13. package/dist/cjs/src/abi/method.js.map +1 -0
  14. package/dist/cjs/src/client/v2/algod/models/types.js +18 -12
  15. package/dist/cjs/src/client/v2/algod/models/types.js.map +1 -1
  16. package/dist/cjs/src/client/v2/indexer/indexer.js +8 -0
  17. package/dist/cjs/src/client/v2/indexer/indexer.js.map +1 -1
  18. package/dist/cjs/src/client/v2/indexer/lookupApplicationLogs.js +48 -0
  19. package/dist/cjs/src/client/v2/indexer/lookupApplicationLogs.js.map +1 -0
  20. package/dist/cjs/src/composer.js +319 -0
  21. package/dist/cjs/src/composer.js.map +1 -0
  22. package/dist/cjs/src/encoding/address.js +14 -1
  23. package/dist/cjs/src/encoding/address.js.map +1 -1
  24. package/dist/cjs/src/encoding/bigint.js +38 -0
  25. package/dist/cjs/src/encoding/bigint.js.map +1 -0
  26. package/dist/cjs/src/logic/langspec.json +392 -77
  27. package/dist/cjs/src/logic/logic.js.map +1 -1
  28. package/dist/cjs/src/logicsig.js +207 -49
  29. package/dist/cjs/src/logicsig.js.map +1 -1
  30. package/dist/cjs/src/main.js +18 -99
  31. package/dist/cjs/src/main.js.map +1 -1
  32. package/dist/cjs/src/makeTxn.js +29 -1
  33. package/dist/cjs/src/makeTxn.js.map +1 -1
  34. package/dist/cjs/src/multisig.js +115 -21
  35. package/dist/cjs/src/multisig.js.map +1 -1
  36. package/dist/cjs/src/signer.js +66 -0
  37. package/dist/cjs/src/signer.js.map +1 -0
  38. package/dist/cjs/src/transaction.js +49 -8
  39. package/dist/cjs/src/transaction.js.map +1 -1
  40. package/dist/cjs/src/types/intDecoding.js +0 -2
  41. package/dist/cjs/src/types/intDecoding.js.map +1 -1
  42. package/dist/cjs/src/types/transactions/base.js +0 -1
  43. package/dist/cjs/src/types/transactions/base.js.map +1 -1
  44. package/dist/cjs/src/wait.js +40 -0
  45. package/dist/cjs/src/wait.js.map +1 -0
  46. package/dist/esm/src/abi/abi_type.js +652 -0
  47. package/dist/esm/src/abi/abi_type.js.map +1 -0
  48. package/dist/esm/src/abi/contract.js +21 -0
  49. package/dist/esm/src/abi/contract.js.map +1 -0
  50. package/dist/esm/src/abi/index.js +5 -0
  51. package/dist/esm/src/abi/index.js.map +1 -0
  52. package/dist/esm/src/abi/interface.js +17 -0
  53. package/dist/esm/src/abi/interface.js.map +1 -0
  54. package/dist/esm/src/abi/method.js +112 -0
  55. package/dist/esm/src/abi/method.js.map +1 -0
  56. package/dist/esm/src/client/v2/algod/models/types.js +18 -12
  57. package/dist/esm/src/client/v2/algod/models/types.js.map +1 -1
  58. package/dist/esm/src/client/v2/indexer/indexer.js +8 -0
  59. package/dist/esm/src/client/v2/indexer/indexer.js.map +1 -1
  60. package/dist/esm/src/client/v2/indexer/lookupApplicationLogs.js +42 -0
  61. package/dist/esm/src/client/v2/indexer/lookupApplicationLogs.js.map +1 -0
  62. package/dist/esm/src/composer.js +315 -0
  63. package/dist/esm/src/composer.js.map +1 -0
  64. package/dist/esm/src/encoding/address.js +12 -0
  65. package/dist/esm/src/encoding/address.js.map +1 -1
  66. package/dist/esm/src/encoding/bigint.js +33 -0
  67. package/dist/esm/src/encoding/bigint.js.map +1 -0
  68. package/dist/esm/src/logic/langspec.json +392 -77
  69. package/dist/esm/src/logic/logic.js.map +1 -1
  70. package/dist/esm/src/logicsig.js +205 -48
  71. package/dist/esm/src/logicsig.js.map +1 -1
  72. package/dist/esm/src/main.js +8 -94
  73. package/dist/esm/src/main.js.map +1 -1
  74. package/dist/esm/src/makeTxn.js +27 -0
  75. package/dist/esm/src/makeTxn.js.map +1 -1
  76. package/dist/esm/src/multisig.js +111 -20
  77. package/dist/esm/src/multisig.js.map +1 -1
  78. package/dist/esm/src/signer.js +59 -0
  79. package/dist/esm/src/signer.js.map +1 -0
  80. package/dist/esm/src/transaction.js +49 -8
  81. package/dist/esm/src/transaction.js.map +1 -1
  82. package/dist/esm/src/types/intDecoding.js +0 -2
  83. package/dist/esm/src/types/intDecoding.js.map +1 -1
  84. package/dist/esm/src/types/transactions/base.js +0 -1
  85. package/dist/esm/src/types/transactions/base.js.map +1 -1
  86. package/dist/esm/src/wait.js +36 -0
  87. package/dist/esm/src/wait.js.map +1 -0
  88. package/dist/types/src/abi/abi_type.d.ts +102 -0
  89. package/dist/types/src/abi/contract.d.ts +13 -0
  90. package/dist/types/src/abi/index.d.ts +4 -0
  91. package/dist/types/src/abi/interface.d.ts +11 -0
  92. package/dist/types/src/abi/method.d.ts +37 -0
  93. package/dist/types/src/client/v2/algod/models/types.d.ts +29 -14
  94. package/dist/types/src/client/v2/indexer/indexer.d.ts +6 -0
  95. package/dist/types/src/client/v2/indexer/lookupApplicationLogs.d.ts +20 -0
  96. package/dist/types/src/composer.d.ts +146 -0
  97. package/dist/types/src/encoding/address.d.ts +6 -0
  98. package/dist/types/src/encoding/bigint.d.ts +14 -0
  99. package/dist/types/src/logic/logic.d.ts +1 -1
  100. package/dist/types/src/logicsig.d.ts +100 -14
  101. package/dist/types/src/main.d.ts +8 -49
  102. package/dist/types/src/makeTxn.d.ts +18 -1
  103. package/dist/types/src/multisig.d.ts +40 -1
  104. package/dist/types/src/signer.d.ts +40 -0
  105. package/dist/types/src/types/transactions/encoded.d.ts +12 -0
  106. package/dist/types/src/wait.d.ts +11 -0
  107. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import * as txnBuilder from './transaction';
3
- import { EncodedLogicSig, EncodedMultisig } from './types/transactions/encoded';
3
+ import { EncodedLogicSig, EncodedLogicSigAccount, EncodedMultisig } from './types/transactions/encoded';
4
4
  import { MultisigMetadata } from './types/multisig';
5
5
  interface LogicSigStorageStructure {
6
6
  logic: Uint8Array;
@@ -17,7 +17,7 @@ export declare class LogicSig implements LogicSigStorageStructure {
17
17
  args: Uint8Array[];
18
18
  sig?: Uint8Array;
19
19
  msig?: EncodedMultisig;
20
- constructor(program: Uint8Array, bufferOrUint8ArrArgs: Array<Uint8Array | Buffer> | undefined);
20
+ constructor(program: Uint8Array, programArgs?: Array<Uint8Array | Buffer> | null);
21
21
  get_obj_for_encoding(): EncodedLogicSig;
22
22
  static from_obj_for_encoding(encoded: EncodedLogicSig): LogicSig;
23
23
  /**
@@ -35,7 +35,7 @@ export declare class LogicSig implements LogicSigStorageStructure {
35
35
  * @param secretKey - Secret key to sign with
36
36
  * @param msig - Multisig account as \{version, threshold, addrs\}
37
37
  */
38
- sign(secretKey: Uint8Array, msig: MultisigMetadata): void;
38
+ sign(secretKey: Uint8Array, msig?: MultisigMetadata): void;
39
39
  /**
40
40
  * Appends a signature to multi signature
41
41
  * @param secretKey - Secret key to sign with
@@ -46,34 +46,120 @@ export declare class LogicSig implements LogicSigStorageStructure {
46
46
  toByte(): Uint8Array;
47
47
  static fromByte(encoded: ArrayLike<any>): LogicSig;
48
48
  }
49
+ /**
50
+ * Represents an account that can sign with a LogicSig program.
51
+ */
52
+ export declare class LogicSigAccount {
53
+ lsig: LogicSig;
54
+ sigkey?: Uint8Array;
55
+ /**
56
+ * Create a new LogicSigAccount. By default this will create an escrow
57
+ * LogicSig account. Call `sign` or `signMultisig` on the newly created
58
+ * LogicSigAccount to make it a delegated account.
59
+ *
60
+ * @param program - The compiled TEAL program which contains the logic for
61
+ * this LogicSig.
62
+ * @param args - An optional array of arguments for the program.
63
+ */
64
+ constructor(program: Uint8Array, args?: Array<Uint8Array | Buffer> | null);
65
+ get_obj_for_encoding(): EncodedLogicSigAccount;
66
+ static from_obj_for_encoding(encoded: EncodedLogicSigAccount): LogicSigAccount;
67
+ /**
68
+ * Encode this object into msgpack.
69
+ */
70
+ toByte(): Uint8Array;
71
+ /**
72
+ * Decode a msgpack object into a LogicSigAccount.
73
+ * @param encoded - The encoded LogicSigAccount.
74
+ */
75
+ static fromByte(encoded: ArrayLike<any>): LogicSigAccount;
76
+ /**
77
+ * Check if this LogicSigAccount has been delegated to another account with a
78
+ * signature.
79
+ *
80
+ * Note this function only checks for the presence of a delegation signature.
81
+ * To verify the delegation signature, use `verify`.
82
+ */
83
+ isDelegated(): boolean;
84
+ /**
85
+ * Verifies this LogicSig's program and signatures.
86
+ * @returns true if and only if the LogicSig program and signatures are valid.
87
+ */
88
+ verify(): boolean;
89
+ /**
90
+ * Get the address of this LogicSigAccount.
91
+ *
92
+ * If the LogicSig is delegated to another account, this will return the
93
+ * address of that account.
94
+ *
95
+ * If the LogicSig is not delegated to another account, this will return an
96
+ * escrow address that is the hash of the LogicSig's program code.
97
+ */
98
+ address(): string;
99
+ /**
100
+ * Turns this LogicSigAccount into a delegated LogicSig. This type of LogicSig
101
+ * has the authority to sign transactions on behalf of another account, called
102
+ * the delegating account. Use this function if the delegating account is a
103
+ * multisig account.
104
+ *
105
+ * @param msig - The multisig delegating account
106
+ * @param secretKey - The secret key of one of the members of the delegating
107
+ * multisig account. Use `appendToMultisig` to add additional signatures
108
+ * from other members.
109
+ */
110
+ signMultisig(msig: MultisigMetadata, secretKey: Uint8Array): void;
111
+ /**
112
+ * Adds an additional signature from a member of the delegating multisig
113
+ * account.
114
+ *
115
+ * @param secretKey - The secret key of one of the members of the delegating
116
+ * multisig account.
117
+ */
118
+ appendToMultisig(secretKey: Uint8Array): void;
119
+ /**
120
+ * Turns this LogicSigAccount into a delegated LogicSig. This type of LogicSig
121
+ * has the authority to sign transactions on behalf of another account, called
122
+ * the delegating account. If the delegating account is a multisig account,
123
+ * use `signMultisig` instead.
124
+ *
125
+ * @param secretKey - The secret key of the delegating account.
126
+ */
127
+ sign(secretKey: Uint8Array): void;
128
+ }
49
129
  /**
50
130
  * makeLogicSig creates LogicSig object from program and arguments
51
131
  *
132
+ * @deprecated Use new LogicSigAccount(...) instead
133
+ *
52
134
  * @param program - Program to make LogicSig from
53
135
  * @param args - Arguments as array of Uint8Array
54
136
  * @returns LogicSig object
55
137
  */
56
138
  export declare function makeLogicSig(program: Uint8Array, args?: Uint8Array[]): LogicSig;
57
139
  /**
58
- * signLogicSigTransactionObject takes transaction.Transaction and a LogicSig object and returns a logicsig
59
- * transaction which is a blob representing a transaction and logicsig object.
60
- * @param txn - transaction.Transaction
61
- * @param lsig - logicsig object
140
+ * signLogicSigTransactionObject takes a transaction and a LogicSig object and
141
+ * returns a signed transaction.
142
+ *
143
+ * @param txn - The transaction to sign.
144
+ * @param lsigObject - The LogicSig object that will sign the transaction.
145
+ *
62
146
  * @returns Object containing txID and blob representing signed transaction.
63
147
  */
64
- export declare function signLogicSigTransactionObject(txn: txnBuilder.Transaction, lsig: LogicSig): {
148
+ export declare function signLogicSigTransactionObject(txn: txnBuilder.Transaction, lsigObject: LogicSig | LogicSigAccount): {
65
149
  txID: string;
66
150
  blob: Uint8Array;
67
151
  };
68
152
  /**
69
- * signLogicSigTransaction takes a raw transaction and a LogicSig object and returns a logicsig
70
- * transaction which is a blob representing a transaction and logicsig object.
71
- * @param txn - containing constructor arguments for a transaction
72
- * @param lsig - logicsig object
153
+ * signLogicSigTransaction takes a transaction and a LogicSig object and returns
154
+ * a signed transaction.
155
+ *
156
+ * @param txn - The transaction to sign.
157
+ * @param lsigObject - The LogicSig object that will sign the transaction.
158
+ *
73
159
  * @returns Object containing txID and blob representing signed transaction.
74
160
  * @throws error on failure
75
161
  */
76
- export declare function signLogicSigTransaction(txn: txnBuilder.TransactionLike, lsig: LogicSig): {
162
+ export declare function signLogicSigTransaction(txn: txnBuilder.TransactionLike, lsigObject: LogicSig | LogicSigAccount): {
77
163
  txID: string;
78
164
  blob: Uint8Array;
79
165
  };
@@ -96,4 +182,4 @@ export declare function tealSign(sk: Uint8Array, data: Uint8Array | Buffer, cont
96
182
  * @param program - buffer with teal program
97
183
  */
98
184
  export declare function tealSignFromProgram(sk: Uint8Array, data: Uint8Array | Buffer, program: Uint8Array): Uint8Array;
99
- export default LogicSig;
185
+ export {};
@@ -1,6 +1,5 @@
1
1
  import * as txnBuilder from './transaction';
2
2
  import { BidOptions } from './bid';
3
- import { MultisigMetadata } from './types/multisig';
4
3
  export declare const MULTISIG_BAD_SENDER_ERROR_MSG = "The transaction sender address and multisig preimage do not match.";
5
4
  /**
6
5
  * signTransaction takes an object with either payment or key registration fields and
@@ -46,50 +45,6 @@ export declare function signBytes(bytes: Uint8Array, sk: Uint8Array): Uint8Array
46
45
  * @returns bool
47
46
  */
48
47
  export declare function verifyBytes(bytes: Uint8Array, signature: Uint8Array, addr: string): boolean;
49
- /**
50
- * signMultisigTransaction takes a raw transaction (see signTransaction), a multisig preimage, a secret key, and returns
51
- * a multisig transaction, which is a blob representing a transaction and multisignature account preimage. The returned
52
- * multisig txn can accumulate additional signatures through mergeMultisigTransactions or appendMultisigTransaction.
53
- * @param txn - object with either payment or key registration fields
54
- * @param version - multisig version
55
- * @param threshold - multisig threshold
56
- * @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
57
- * @param sk - Algorand secret key. The corresponding pk should be in the pre image.
58
- * @returns object containing txID, and blob of partially signed multisig transaction (with multisig preimage information)
59
- * If the final calculated fee is lower than the protocol minimum fee, the fee will be increased to match the minimum.
60
- */
61
- export declare function signMultisigTransaction(txn: txnBuilder.TransactionLike, { version, threshold, addrs }: MultisigMetadata, sk: Uint8Array): {
62
- txID: string;
63
- blob: Uint8Array;
64
- };
65
- /**
66
- * mergeMultisigTransactions takes a list of multisig transaction blobs, and merges them.
67
- * @param multisigTxnBlobs - a list of blobs representing encoded multisig txns
68
- * @returns blob representing encoded multisig txn
69
- */
70
- export declare function mergeMultisigTransactions(multisigTxnBlobs: Uint8Array[]): Uint8Array;
71
- /**
72
- * appendSignMultisigTransaction takes a multisig transaction blob, and appends our signature to it.
73
- * While we could derive public key preimagery from the partially-signed multisig transaction,
74
- * we ask the caller to pass it back in, to ensure they know what they are signing.
75
- * @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
76
- * @param version - multisig version
77
- * @param threshold - multisig threshold
78
- * @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
79
- * @param sk - Algorand secret key
80
- * @returns object containing txID, and blob representing encoded multisig txn
81
- */
82
- export declare function appendSignMultisigTransaction(multisigTxnBlob: Uint8Array, { version, threshold, addrs }: MultisigMetadata, sk: Uint8Array): {
83
- txID: string;
84
- blob: Uint8Array;
85
- };
86
- /**
87
- * multisigAddress takes multisig metadata (preimage) and returns the corresponding human readable Algorand address.
88
- * @param version - mutlisig version
89
- * @param threshold - multisig threshold
90
- * @param addrs - list of Algorand addresses
91
- */
92
- export declare function multisigAddress({ version, threshold, addrs, }: MultisigMetadata): string;
93
48
  /**
94
49
  * encodeObj takes a javascript object and returns its msgpack encoding
95
50
  * Note that the encoding sorts the fields alphabetically
@@ -111,16 +66,20 @@ export { default as Kmd } from './client/kmd';
111
66
  export { default as IntDecoding } from './types/intDecoding';
112
67
  export { default as Account } from './types/account';
113
68
  export { default as Indexer } from './client/v2/indexer/indexer';
114
- export { isValidAddress, encodeAddress, decodeAddress, } from './encoding/address';
69
+ export { waitForConfirmation } from './wait';
70
+ export { isValidAddress, encodeAddress, decodeAddress, getApplicationAddress, } from './encoding/address';
115
71
  export { encodeUint64, decodeUint64 } from './encoding/uint64';
116
72
  export { default as generateAccount } from './account';
117
- export { secretKeyToMnemonic, mnemonicToSecretKey } from './mnemonic/mnemonic';
118
73
  export * as modelsv2 from './client/v2/algod/models/types';
119
- export { mnemonicToMasterDerivationKey, masterDerivationKeyToMnemonic, } from './mnemonic/mnemonic';
74
+ export { mnemonicToMasterDerivationKey, masterDerivationKeyToMnemonic, secretKeyToMnemonic, mnemonicToSecretKey, seedFromMnemonic, mnemonicFromSeed, } from './mnemonic/mnemonic';
120
75
  export { microalgosToAlgos, algosToMicroalgos, INVALID_MICROALGOS_ERROR_MSG, } from './convert';
121
76
  export { computeGroupID, assignGroupID } from './group';
122
- export { makeLogicSig, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, } from './logicsig';
77
+ export { LogicSigAccount, makeLogicSig, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, } from './logicsig';
78
+ export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, multisigAddress, } from './multisig';
123
79
  export declare const LogicTemplates: any;
124
80
  export * from './makeTxn';
125
81
  export * from './transaction';
82
+ export * from './signer';
83
+ export * from './composer';
126
84
  export * from './types';
85
+ export * from './abi';
@@ -455,7 +455,7 @@ export declare function makeApplicationDeleteTxnFromObject(o: Pick<RenamePropert
455
455
  * @param lease - Lease a transaction
456
456
  * @param rekeyTo - String representation of the Algorand address that will be used to authorize all future transactions
457
457
  */
458
- export declare function makeApplicationOptInTxn(from: AppOptInTxn['from'], suggestedParams: MustHaveSuggestedParams<AppOptInTxn>['suggestedParams'], appIndex: AppOptInTxn['appIndex'], appArgs?: AppOptInTxn['appArgs'], accounts?: AppOptInTxn['appAccounts'], foreignApps?: AppOptInTxn['appForeignApps'], foreignAssets?: AppOptInTxn['appForeignApps'], note?: AppOptInTxn['note'], lease?: AppOptInTxn['lease'], rekeyTo?: AppOptInTxn['reKeyTo']): txnBuilder.Transaction;
458
+ export declare function makeApplicationOptInTxn(from: AppOptInTxn['from'], suggestedParams: MustHaveSuggestedParams<AppOptInTxn>['suggestedParams'], appIndex: AppOptInTxn['appIndex'], appArgs?: AppOptInTxn['appArgs'], accounts?: AppOptInTxn['appAccounts'], foreignApps?: AppOptInTxn['appForeignApps'], foreignAssets?: AppOptInTxn['appForeignAssets'], note?: AppOptInTxn['note'], lease?: AppOptInTxn['lease'], rekeyTo?: AppOptInTxn['reKeyTo']): txnBuilder.Transaction;
459
459
  export declare function makeApplicationOptInTxnFromObject(o: Pick<RenameProperties<MustHaveSuggestedParams<AppOptInTxn>, {
460
460
  appAccounts: 'accounts';
461
461
  appForeignApps: 'foreignApps';
@@ -544,3 +544,20 @@ export declare function makeApplicationNoOpTxnFromObject(o: Pick<RenamePropertie
544
544
  reKeyTo: 'rekeyTo';
545
545
  }>, 'from' | 'suggestedParams' | 'appIndex' | 'appArgs' | 'accounts' | 'foreignApps' | 'foreignAssets' | 'note' | 'lease' | 'rekeyTo'>): txnBuilder.Transaction;
546
546
  export { OnApplicationComplete } from './types/transactions/base';
547
+ /**
548
+ * Generic function for creating any application call transaction.
549
+ */
550
+ export declare function makeApplicationCallTxnFromObject(options: Pick<RenameProperties<MustHaveSuggestedParams<AppCreateTxn>, {
551
+ appOnComplete: 'onComplete';
552
+ appAccounts: 'accounts';
553
+ appForeignApps: 'foreignApps';
554
+ appForeignAssets: 'foreignAssets';
555
+ reKeyTo: 'rekeyTo';
556
+ }>, 'from' | 'suggestedParams' | 'appIndex' | 'onComplete' | 'appArgs' | 'accounts' | 'foreignApps' | 'foreignAssets' | 'note' | 'lease' | 'rekeyTo' | 'extraPages'> & Partial<Pick<RenameProperties<MustHaveSuggestedParams<AppCreateTxn>, {
557
+ appApprovalProgram: 'approvalProgram';
558
+ appClearProgram: 'clearProgram';
559
+ appLocalInts: 'numLocalInts';
560
+ appLocalByteSlices: 'numLocalByteSlices';
561
+ appGlobalInts: 'numGlobalInts';
562
+ appGlobalByteSlices: 'numGlobalByteSlices';
563
+ }>, 'approvalProgram' | 'clearProgram' | 'numLocalInts' | 'numLocalByteSlices' | 'numGlobalInts' | 'numGlobalByteSlices'>>): txnBuilder.Transaction;
@@ -7,6 +7,7 @@ import { EncodedMultisig } from './types/transactions/encoded';
7
7
  */
8
8
  export declare const MULTISIG_MERGE_LESSTHANTWO_ERROR_MSG = "Not enough multisig transactions to merge. Need at least two";
9
9
  export declare const MULTISIG_MERGE_MISMATCH_ERROR_MSG = "Cannot merge txs. txIDs differ";
10
+ export declare const MULTISIG_MERGE_MISMATCH_AUTH_ADDR_MSG = "Cannot merge txs. Auth addrs differ";
10
11
  export declare const MULTISIG_MERGE_WRONG_PREIMAGE_ERROR_MSG = "Cannot merge txs. Multisig preimages differ";
11
12
  export declare const MULTISIG_MERGE_SIG_MISMATCH_ERROR_MSG = "Cannot merge txs. subsigs are mismatched.";
12
13
  export declare const MULTISIG_NO_MUTATE_ERROR_MSG = "Cannot mutate a multisig field as it would invalidate all existing signatures.";
@@ -49,4 +50,42 @@ export declare class MultisigTransaction extends txnBuilder.Transaction {
49
50
  */
50
51
  export declare function mergeMultisigTransactions(multisigTxnBlobs: Uint8Array[]): Uint8Array;
51
52
  export declare function verifyMultisig(toBeVerified: Uint8Array, msig: EncodedMultisig, publicKey: Uint8Array): boolean;
52
- export default MultisigTransaction;
53
+ /**
54
+ * signMultisigTransaction takes a raw transaction (see signTransaction), a multisig preimage, a secret key, and returns
55
+ * 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.
57
+ * @param txn - object with either payment or key registration fields
58
+ * @param version - multisig version
59
+ * @param threshold - multisig threshold
60
+ * @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
61
+ * @param sk - Algorand secret key. The corresponding pk should be in the pre image.
62
+ * @returns object containing txID, and blob of partially signed multisig transaction (with multisig preimage information)
63
+ * If the final calculated fee is lower than the protocol minimum fee, the fee will be increased to match the minimum.
64
+ */
65
+ export declare function signMultisigTransaction(txn: txnBuilder.TransactionLike, { version, threshold, addrs }: MultisigMetadata, sk: Uint8Array): {
66
+ txID: string;
67
+ blob: Uint8Array;
68
+ };
69
+ /**
70
+ * appendSignMultisigTransaction takes a multisig transaction blob, and appends our signature to it.
71
+ * While we could derive public key preimagery from the partially-signed multisig transaction,
72
+ * we ask the caller to pass it back in, to ensure they know what they are signing.
73
+ * @param multisigTxnBlob - an encoded multisig txn. Supports non-payment txn types.
74
+ * @param version - multisig version
75
+ * @param threshold - multisig threshold
76
+ * @param addrs - a list of Algorand addresses representing possible signers for this multisig. Order is important.
77
+ * @param sk - Algorand secret key
78
+ * @returns object containing txID, and blob representing encoded multisig txn
79
+ */
80
+ export declare function appendSignMultisigTransaction(multisigTxnBlob: Uint8Array, { version, threshold, addrs }: MultisigMetadata, sk: Uint8Array): {
81
+ txID: string;
82
+ blob: Uint8Array;
83
+ };
84
+ /**
85
+ * multisigAddress takes multisig metadata (preimage) and returns the corresponding human readable Algorand address.
86
+ * @param version - mutlisig version
87
+ * @param threshold - multisig threshold
88
+ * @param addrs - list of Algorand addresses
89
+ */
90
+ export declare function multisigAddress({ version, threshold, addrs, }: MultisigMetadata): string;
91
+ export {};
@@ -0,0 +1,40 @@
1
+ import { Transaction } from './transaction';
2
+ import Account from './types/account';
3
+ import { LogicSigAccount } from './logicsig';
4
+ import { MultisigMetadata } from './types/multisig';
5
+ /**
6
+ * This type represents a function which can sign transactions from an atomic transaction group.
7
+ * @param txnGroup - The atomic group containing transactions to be signed
8
+ * @param indexesToSign - An array of indexes in the atomic transaction group that should be signed
9
+ * @returns A promise which resolves an array of encoded signed transactions. The length of the
10
+ * array will be the same as the length of indexesToSign, and each index i in the array
11
+ * corresponds to the signed transaction from txnGroup[indexesToSign[i]]
12
+ */
13
+ export declare type TransactionSigner = (txnGroup: Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
14
+ /**
15
+ * Create a TransactionSigner that can sign transactions for the provided basic Account.
16
+ */
17
+ export declare function makeBasicAccountTransactionSigner(account: Account): TransactionSigner;
18
+ /**
19
+ * Create a TransactionSigner that can sign transactions for the provided LogicSigAccount.
20
+ */
21
+ export declare function makeLogicSigAccountTransactionSigner(account: LogicSigAccount): TransactionSigner;
22
+ /**
23
+ * Create a TransactionSigner that can sign transactions for the provided Multisig account.
24
+ * @param msig - The Multisig account metadata
25
+ * @param sks - An array of private keys belonging to the msig which should sign the transactions.
26
+ */
27
+ export declare function makeMultiSigAccountTransactionSigner(msig: MultisigMetadata, sks: Uint8Array[]): TransactionSigner;
28
+ /** Represents an unsigned transactions and a signer that can authorize that transaction. */
29
+ export interface TransactionWithSigner {
30
+ /** An unsigned transaction */
31
+ txn: Transaction;
32
+ /** A transaction signer that can authorize txn */
33
+ signer: TransactionSigner;
34
+ }
35
+ /**
36
+ * Check if a value conforms to the TransactionWithSigner structure.
37
+ * @param value - The value to check.
38
+ * @returns True if an only if the value has the structure of a TransactionWithSigner.
39
+ */
40
+ export declare function isTransactionWithSigner(value: any): value is TransactionWithSigner;
@@ -238,7 +238,13 @@ export interface EncodedTransaction {
238
238
  apep?: number;
239
239
  }
240
240
  export interface EncodedSubsig {
241
+ /**
242
+ * The public key
243
+ */
241
244
  pk: Uint8Array;
245
+ /**
246
+ * The signature provided by the public key, if any
247
+ */
242
248
  s?: Uint8Array;
243
249
  }
244
250
  /**
@@ -261,6 +267,8 @@ export interface EncodedMultisig {
261
267
  }
262
268
  /**
263
269
  * An encoded multisig blob that contains the encoded multisig as well as a copy of the encoded transaction
270
+ *
271
+ * @deprecated Use EncodedSignedTransaction instead.
264
272
  */
265
273
  export interface EncodedMultisigBlob {
266
274
  /**
@@ -278,6 +286,10 @@ export interface EncodedLogicSig {
278
286
  sig?: Uint8Array;
279
287
  msig?: EncodedMultisig;
280
288
  }
289
+ export interface EncodedLogicSigAccount {
290
+ lsig: EncodedLogicSig;
291
+ sigkey?: Uint8Array;
292
+ }
281
293
  /**
282
294
  * A structure for an encoded signed transaction object
283
295
  */
@@ -0,0 +1,11 @@
1
+ import Algodv2 from './client/v2/algod/algod';
2
+ /**
3
+ * Wait until a transaction has been confirmed or rejected by the network, or
4
+ * until 'waitRounds' number of rounds have passed.
5
+ * @param client - An Algodv2 client
6
+ * @param txid - The ID of the transaction to wait for.
7
+ * @param waitRounds - The maximum number of rounds to wait for.
8
+ * @returns A promise that, upon success, will resolve to the output of the
9
+ * `pendingTransactionInformation` call for the confirmed transaction.
10
+ */
11
+ export declare function waitForConfirmation(client: Algodv2, txid: string, waitRounds: number): Promise<Record<string, any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "1.10.1",
3
+ "version": "1.13.0-beta.1",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -36,7 +36,7 @@
36
36
  "@typescript-eslint/eslint-plugin": "^4.26.1",
37
37
  "@typescript-eslint/parser": "^4.26.1",
38
38
  "assert": "^2.0.0",
39
- "chromedriver": "^91.0.0",
39
+ "chromedriver": "^95.0.0",
40
40
  "concurrently": "^6.2.0",
41
41
  "coveralls": "^3.1.0",
42
42
  "cucumber": "^5.1.0",