@algorandfoundation/algokit-utils 1.0.0-beta.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +38 -0
  2. package/account.d.ts +41 -36
  3. package/account.d.ts.map +1 -1
  4. package/account.js +59 -44
  5. package/account.js.map +1 -1
  6. package/amount.d.ts +20 -0
  7. package/amount.d.ts.map +1 -0
  8. package/amount.js +36 -0
  9. package/amount.js.map +1 -0
  10. package/app-client.d.ts +14 -0
  11. package/app-client.d.ts.map +1 -0
  12. package/app-client.js +19 -0
  13. package/app-client.js.map +1 -0
  14. package/app-deploy.d.ts +95 -0
  15. package/app-deploy.d.ts.map +1 -0
  16. package/{deploy-app.js → app-deploy.js} +129 -119
  17. package/app-deploy.js.map +1 -0
  18. package/app.d.ts +112 -148
  19. package/app.d.ts.map +1 -1
  20. package/app.js +460 -143
  21. package/app.js.map +1 -1
  22. package/index.d.ts +6 -4
  23. package/index.d.ts.map +1 -1
  24. package/index.js +7 -4
  25. package/index.js.map +1 -1
  26. package/indexer-lookup.d.ts +11 -4
  27. package/indexer-lookup.d.ts.map +1 -1
  28. package/indexer-lookup.js +19 -9
  29. package/indexer-lookup.js.map +1 -1
  30. package/localnet.d.ts +10 -10
  31. package/localnet.d.ts.map +1 -1
  32. package/localnet.js +16 -16
  33. package/localnet.js.map +1 -1
  34. package/network-client.d.ts +15 -24
  35. package/network-client.d.ts.map +1 -1
  36. package/network-client.js +16 -16
  37. package/network-client.js.map +1 -1
  38. package/package.json +2 -2
  39. package/testing/account.d.ts +14 -0
  40. package/testing/account.d.ts.map +1 -0
  41. package/testing/account.js +31 -0
  42. package/testing/account.js.map +1 -0
  43. package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
  44. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  45. package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
  46. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  47. package/testing/fixtures/algorand-fixture.d.ts +24 -0
  48. package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  49. package/testing/fixtures/algorand-fixture.js +60 -0
  50. package/testing/fixtures/algorand-fixture.js.map +1 -0
  51. package/testing/fixtures/index.d.ts +3 -0
  52. package/testing/fixtures/index.d.ts.map +1 -0
  53. package/testing/fixtures/index.js +19 -0
  54. package/testing/fixtures/index.js.map +1 -0
  55. package/testing/index.d.ts +6 -0
  56. package/testing/index.d.ts.map +1 -0
  57. package/testing/index.js +22 -0
  58. package/testing/index.js.map +1 -0
  59. package/testing/indexer.d.ts +12 -0
  60. package/testing/indexer.d.ts.map +1 -0
  61. package/testing/indexer.js +40 -0
  62. package/testing/indexer.js.map +1 -0
  63. package/testing/test-logger.d.ts +41 -0
  64. package/testing/test-logger.d.ts.map +1 -0
  65. package/testing/test-logger.js +71 -0
  66. package/testing/test-logger.js.map +1 -0
  67. package/testing/transaction-logger.d.ts +29 -0
  68. package/testing/transaction-logger.d.ts.map +1 -0
  69. package/testing/transaction-logger.js +71 -0
  70. package/testing/transaction-logger.js.map +1 -0
  71. package/transaction.d.ts +55 -91
  72. package/transaction.d.ts.map +1 -1
  73. package/transaction.js +213 -155
  74. package/transaction.js.map +1 -1
  75. package/transfer.d.ts +14 -16
  76. package/transfer.d.ts.map +1 -1
  77. package/transfer.js +38 -4
  78. package/transfer.js.map +1 -1
  79. package/types/account.d.ts +55 -0
  80. package/types/account.d.ts.map +1 -0
  81. package/types/account.js +91 -0
  82. package/types/account.js.map +1 -0
  83. package/types/algo-http-client-with-retry.d.ts.map +1 -0
  84. package/{algo-http-client-with-retry.js → types/algo-http-client-with-retry.js} +3 -3
  85. package/types/algo-http-client-with-retry.js.map +1 -0
  86. package/types/algod.d.ts +28 -15
  87. package/types/algod.d.ts.map +1 -1
  88. package/{algo-amount.d.ts → types/amount.d.ts} +9 -3
  89. package/types/amount.d.ts.map +1 -0
  90. package/{algo-amount.js → types/amount.js} +13 -3
  91. package/types/amount.js.map +1 -0
  92. package/types/app-client.d.ts +282 -0
  93. package/types/app-client.d.ts.map +1 -0
  94. package/types/app-client.js +529 -0
  95. package/types/app-client.js.map +1 -0
  96. package/types/app-spec.d.ts +141 -0
  97. package/types/app-spec.d.ts.map +1 -0
  98. package/types/{appspec.js → app-spec.js} +5 -7
  99. package/types/app-spec.js.map +1 -0
  100. package/types/app.d.ts +285 -0
  101. package/types/app.d.ts.map +1 -0
  102. package/types/app.js +32 -0
  103. package/types/app.js.map +1 -0
  104. package/types/config.d.ts +32 -0
  105. package/types/config.d.ts.map +1 -0
  106. package/types/config.js +53 -0
  107. package/types/config.js.map +1 -0
  108. package/types/indexer.d.ts +368 -58
  109. package/types/indexer.d.ts.map +1 -1
  110. package/types/indexer.js +9 -0
  111. package/types/indexer.js.map +1 -1
  112. package/{config.d.ts → types/logging.d.ts} +2 -16
  113. package/types/logging.d.ts.map +1 -0
  114. package/{config.js → types/logging.js} +5 -24
  115. package/types/logging.js.map +1 -0
  116. package/types/logic-error.d.ts +37 -0
  117. package/types/logic-error.d.ts.map +1 -0
  118. package/types/logic-error.js +50 -0
  119. package/types/logic-error.js.map +1 -0
  120. package/types/network-client.d.ts +11 -0
  121. package/types/network-client.d.ts.map +1 -0
  122. package/types/network-client.js +3 -0
  123. package/types/network-client.js.map +1 -0
  124. package/types/testing.d.ts +89 -0
  125. package/types/testing.d.ts.map +1 -0
  126. package/types/testing.js +3 -0
  127. package/types/testing.js.map +1 -0
  128. package/types/transaction.d.ts +112 -0
  129. package/types/transaction.d.ts.map +1 -0
  130. package/types/transaction.js +3 -0
  131. package/types/transaction.js.map +1 -0
  132. package/types/transfer.d.ts +32 -0
  133. package/types/transfer.d.ts.map +1 -0
  134. package/types/transfer.js +3 -0
  135. package/types/transfer.js.map +1 -0
  136. package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  137. package/types/urlTokenBaseHTTPClient.js.map +1 -0
  138. package/algo-amount.d.ts.map +0 -1
  139. package/algo-amount.js.map +0 -1
  140. package/algo-http-client-with-retry.d.ts.map +0 -1
  141. package/algo-http-client-with-retry.js.map +0 -1
  142. package/application-client.d.ts +0 -113
  143. package/application-client.d.ts.map +0 -1
  144. package/application-client.js +0 -258
  145. package/application-client.js.map +0 -1
  146. package/config.d.ts.map +0 -1
  147. package/config.js.map +0 -1
  148. package/deploy-app.d.ts +0 -164
  149. package/deploy-app.d.ts.map +0 -1
  150. package/deploy-app.js.map +0 -1
  151. package/types/appspec.d.ts +0 -78
  152. package/types/appspec.d.ts.map +0 -1
  153. package/types/appspec.js.map +0 -1
  154. package/urlTokenBaseHTTPClient.d.ts.map +0 -1
  155. package/urlTokenBaseHTTPClient.js.map +0 -1
  156. /package/{algo-http-client-with-retry.d.ts → types/algo-http-client-with-retry.d.ts} +0 -0
  157. /package/{urlTokenBaseHTTPClient.d.ts → types/urlTokenBaseHTTPClient.d.ts} +0 -0
  158. /package/{urlTokenBaseHTTPClient.js → types/urlTokenBaseHTTPClient.js} +0 -0
@@ -0,0 +1,29 @@
1
+ import { Algodv2, Indexer } from 'algosdk';
2
+ /**
3
+ * Allows you to keep track of Algorand transaction IDs by wrapping an `Algodv2` in a proxy.
4
+ * Useful for automated tests.
5
+ */
6
+ export declare class TransactionLogger {
7
+ private _sentTransactionIds;
8
+ /**
9
+ * The list of transaction IDs that has been logged thus far.
10
+ */
11
+ get sentTransactionIds(): Readonly<string[]>;
12
+ /**
13
+ * Clear all logged IDs.
14
+ */
15
+ clear(): void;
16
+ /**
17
+ * The method that captures raw transactions and stores the transaction IDs.
18
+ */
19
+ logRawTransaction(signedTransactions: Uint8Array | Uint8Array[]): void;
20
+ /** Return a proxy that wraps the given Algodv2 with this transaction logger.
21
+ *
22
+ * @param algod The `Algodv2` to wrap
23
+ * @returns The wrapped `Algodv2`, any transactions sent using this algod instance will be logged by this transaction logger
24
+ */
25
+ capture(algod: Algodv2): Algodv2;
26
+ /** Wait until all logged transactions IDs appear in the given `Indexer`. */
27
+ waitForIndexer(indexer: Indexer): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=transaction-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-logger.d.ts","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,OAAO,EAAE,MAAM,SAAS,CAAA;AAGnE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,mBAAmB,CAAe;IAE1C;;OAEG;IACH,IAAI,kBAAkB,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAE3C;IAED;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,EAAE;IAY/D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC,4EAA4E;IACtE,cAAc,CAAC,OAAO,EAAE,OAAO;CAGtC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransactionLogger = void 0;
4
+ const algosdk_1 = require("algosdk");
5
+ const _1 = require("./");
6
+ /**
7
+ * Allows you to keep track of Algorand transaction IDs by wrapping an `Algodv2` in a proxy.
8
+ * Useful for automated tests.
9
+ */
10
+ class TransactionLogger {
11
+ constructor() {
12
+ this._sentTransactionIds = [];
13
+ }
14
+ /**
15
+ * The list of transaction IDs that has been logged thus far.
16
+ */
17
+ get sentTransactionIds() {
18
+ return this._sentTransactionIds;
19
+ }
20
+ /**
21
+ * Clear all logged IDs.
22
+ */
23
+ clear() {
24
+ this._sentTransactionIds = [];
25
+ }
26
+ /**
27
+ * The method that captures raw transactions and stores the transaction IDs.
28
+ */
29
+ logRawTransaction(signedTransactions) {
30
+ if (Array.isArray(signedTransactions)) {
31
+ for (const stxn of signedTransactions) {
32
+ const decoded = (0, algosdk_1.decodeSignedTransaction)(stxn);
33
+ this._sentTransactionIds.push(decoded.txn.txID());
34
+ }
35
+ }
36
+ else {
37
+ const decoded = (0, algosdk_1.decodeSignedTransaction)(signedTransactions);
38
+ this._sentTransactionIds.push(decoded.txn.txID());
39
+ }
40
+ }
41
+ /** Return a proxy that wraps the given Algodv2 with this transaction logger.
42
+ *
43
+ * @param algod The `Algodv2` to wrap
44
+ * @returns The wrapped `Algodv2`, any transactions sent using this algod instance will be logged by this transaction logger
45
+ */
46
+ capture(algod) {
47
+ return new Proxy(algod, new TransactionLoggingAlgodv2ProxyHandler(this));
48
+ }
49
+ /** Wait until all logged transactions IDs appear in the given `Indexer`. */
50
+ async waitForIndexer(indexer) {
51
+ await Promise.all(this._sentTransactionIds.map((txnId) => (0, _1.runWhenIndexerCaughtUp)(() => indexer.lookupTransactionByID(txnId).do())));
52
+ }
53
+ }
54
+ exports.TransactionLogger = TransactionLogger;
55
+ class TransactionLoggingAlgodv2ProxyHandler {
56
+ constructor(transactionLogger) {
57
+ this.transactionLogger = transactionLogger;
58
+ }
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
+ get(target, property, receiver) {
61
+ if (property === 'sendRawTransaction') {
62
+ return (stxOrStxs) => {
63
+ this.transactionLogger.logRawTransaction(stxOrStxs);
64
+ return target[property].call(receiver, stxOrStxs);
65
+ };
66
+ }
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
+ return target[property];
69
+ }
70
+ }
71
+ //# sourceMappingURL=transaction-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-logger.js","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":";;;AAAA,qCAAmE;AACnE,yBAA2C;AAE3C;;;GAGG;AACH,MAAa,iBAAiB;IAA9B;QACU,wBAAmB,GAAa,EAAE,CAAA;IA4C5C,CAAC;IA1CC;;OAEG;IACH,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAA;IACjC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC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AI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;gBACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;YACnD,CAAC,CAAA;SACF;QACD,8DAA8D;QAC9D,OAAQ,MAAc,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;CACF"}
package/transaction.d.ts CHANGED
@@ -1,52 +1,7 @@
1
- import algosdk, { Account, Algodv2, LogicSigAccount, MultisigMetadata, SuggestedParams, Transaction, TransactionSigner } from 'algosdk';
2
- import { AlgoAmount } from './algo-amount';
1
+ import algosdk, { Algodv2, AtomicTransactionComposer, SuggestedParams, Transaction } from 'algosdk';
3
2
  import { PendingTransactionResponse } from './types/algod';
4
- /** Account wrapper that supports partial or full multisig signing */
5
- export declare class MultisigAccount {
6
- _params: algosdk.MultisigMetadata;
7
- _signingAccounts: (algosdk.Account | SigningAccount)[];
8
- _addr: string;
9
- get params(): Readonly<algosdk.MultisigMetadata>;
10
- get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]>;
11
- get addr(): Readonly<string>;
12
- constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]);
13
- sign(transaction: Transaction | Uint8Array): Uint8Array;
14
- }
15
- /** Account wrapper that supports a rekeyed account */
16
- export declare class SigningAccount implements Account {
17
- private _account;
18
- private _sender;
19
- /**
20
- * Algorand address of the sender
21
- */
22
- get addr(): Readonly<string>;
23
- /**
24
- * Secret key belonging to the signer
25
- */
26
- get sk(): Readonly<Uint8Array>;
27
- /**
28
- * Algorand account of the underlying signing account
29
- */
30
- get signer(): Account;
31
- /**
32
- * Algorand account of the sender address and signer private key
33
- */
34
- get sender(): Account;
35
- constructor(account: Account, sender: string | undefined);
36
- }
37
- /** A wrapper around @see {TransactionSigner} that also has the sender address. */
38
- export interface TransactionSignerAccount {
39
- addr: Readonly<string>;
40
- signer: TransactionSigner;
41
- }
42
- export type TransactionNote = Uint8Array | TransactionNoteData | Arc2TransactionNote;
43
- export type TransactionNoteData = string | null | undefined | number | any[] | Record<string, any>;
44
- /** ARC-0002 compatible transaction note components, @see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md */
45
- export type Arc2TransactionNote = {
46
- dAppName: string;
47
- format: 'm' | 'j' | 'b' | 'u';
48
- data: string;
49
- };
3
+ import { AlgoAmount } from './types/amount';
4
+ import { AtomicTransactionComposerToSend, SendAtomicTransactionComposerResults, SendTransactionFrom, SendTransactionParams, SendTransactionResult, TransactionGroupToSend, TransactionNote } from './types/transaction';
50
5
  /** Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
51
6
  *
52
7
  * @param note The transaction note
@@ -60,56 +15,57 @@ export type Arc2TransactionNote = {
60
15
  * * Else: The object/value converted into a JSON string representation
61
16
  */
62
17
  export declare function encodeTransactionNote(note?: TransactionNote): Uint8Array | undefined;
63
- /** The sending configuration for a transaction */
64
- export interface SendTransactionParams {
65
- /** Whether to skip signing and sending the transaction to the chain (default: transaction signed and sent to chain)
66
- * (and instead just return the raw transaction, e.g. so you can add it to a group of transactions) */
67
- skipSending?: boolean;
68
- /** Whether to skip waiting for the submitted transaction (only relevant if `skipSending` is `false` or unset) */
69
- skipWaiting?: boolean;
70
- /** Whether to suppress log messages from transaction send, default: do not suppress */
71
- suppressLog?: boolean;
72
- /** The maximum fee that you are happy to pay (default: unbounded) - if this is set it's possible the transaction could get rejected during network congestion */
73
- maxFee?: AlgoAmount;
74
- /** The maximum number of rounds to wait for confirmation, only applies if `skipWaiting` is `undefined` or `false`, default: wait up to 5 rounds */
75
- maxRoundsToWaitForConfirmation?: number;
76
- }
77
- /** The result of sending a transaction */
78
- export interface SendTransactionResult {
79
- /** The transaction */
80
- transaction: Transaction;
81
- /** The response if the transaction was sent and waited for */
82
- confirmation?: PendingTransactionResponse;
83
- }
84
- export type SendTransactionFrom = Account | SigningAccount | LogicSigAccount | MultisigAccount | TransactionSignerAccount;
85
18
  /**
86
19
  * Returns the public address of the given transaction sender.
87
20
  * @param sender A transaction sender
88
21
  * @returns The public address
89
22
  */
90
23
  export declare const getSenderAddress: (sender: SendTransactionFrom) => string;
91
- /** Signs and sends the given transaction to the chain
24
+ /**
25
+ * Returns a `TransactionSigner` for the given transaction sender.
26
+ * This function has memoization, so will return the same transaction signer for a given sender.
27
+ * @param sender A transaction sender
28
+ * @returns A transaction signer
29
+ */
30
+ export declare const getSenderTransactionSigner: (val: SendTransactionFrom) => algosdk.TransactionSigner;
31
+ /**
32
+ * Signs a single transaction by the given signer.
33
+ * @param transaction The transaction to sign
34
+ * @param signer The signer to sign
35
+ * @returns The signed transaction as a `Uint8Array`
36
+ */
37
+ export declare const signTransaction: (transaction: Transaction, signer: SendTransactionFrom) => Promise<Uint8Array>;
38
+ /** Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
92
39
  *
93
- * @param send The details for the transaction to send, including:
40
+ * @param send The details for the transaction to prepare/send, including:
94
41
  * * `transaction`: The unsigned transaction
95
42
  * * `from`: The account to sign the transaction with: either an account with private key loaded or a logic signature account
96
43
  * * `config`: The sending configuration for this transaction
97
44
  * @param algod An algod client
98
45
  *
99
- * @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
46
+ * @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or `undefined`) confirmation (`confirmation`)
100
47
  */
101
48
  export declare const sendTransaction: (send: {
102
49
  transaction: Transaction;
103
50
  from: SendTransactionFrom;
104
51
  sendParams?: SendTransactionParams;
105
52
  }, algod: Algodv2) => Promise<SendTransactionResult>;
106
- /** Defines an unsigned transaction that will appear in a group of transactions along with its signing information */
107
- export interface TransactionToSign {
108
- /** The unsigned transaction to sign and send */
109
- transaction: Transaction;
110
- /** The account to use to sign the transaction, either an account (with private key loaded) or a logic signature account */
111
- signer: SendTransactionFrom;
112
- }
53
+ /**
54
+ * Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
55
+ * @param atcSend The parameters controlling the send, including:
56
+ * * `atc` The `AtomicTransactionComposer`
57
+ * * `sendParams` The parameters to control the send behaviour
58
+ * @param algod An algod client
59
+ * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
60
+ */
61
+ export declare const sendAtomicTransactionComposer: (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) => Promise<SendAtomicTransactionComposerResults>;
62
+ /**
63
+ * Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`
64
+ * @param atc The AtomicTransactionComposer` with transaction(s) loaded
65
+ * @param algod An Algod client
66
+ * @returns The dryrun result
67
+ */
68
+ export declare function performAtomicTransactionComposerDryrun(atc: AtomicTransactionComposer, algod: Algodv2): Promise<algosdk.DryrunResult>;
113
69
  /**
114
70
  * Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
115
71
  *
@@ -117,16 +73,9 @@ export interface TransactionToSign {
117
73
  * * `transactions`: The array of transactions to send along with their signing account
118
74
  * * `sendParams`: The parameters to dictate how the group is sent
119
75
  * @param algod An algod client
120
- * @returns An object with group transaction ID (`groupTransactionId`) and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
76
+ * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
121
77
  */
122
- export declare const sendGroupOfTransactions: (groupSend: {
123
- transactions: TransactionToSign[];
124
- sendParams?: Omit<Omit<SendTransactionParams, 'maxFee'>, 'skipSending'>;
125
- }, algod: Algodv2) => Promise<{
126
- groupId: string;
127
- confirmations: PendingTransactionResponse[] | undefined;
128
- txIds: string[];
129
- }>;
78
+ export declare const sendGroupOfTransactions: (groupSend: TransactionGroupToSend, algod: Algodv2) => Promise<Omit<SendAtomicTransactionComposerResults, "returns">>;
130
79
  /**
131
80
  * Wait until the transaction is confirmed or rejected, or until `timeout`
132
81
  * number of rounds have passed.
@@ -143,10 +92,19 @@ export declare const waitForConfirmation: (transactionId: string, maxRoundsToWai
143
92
  * Limit the acceptable fee to a defined amount of µALGOs.
144
93
  * This also sets the transaction to be flatFee to ensure the transaction only succeeds at
145
94
  * the estimated rate.
146
- * @param transaction The transaction to cap
95
+ * @param transaction The transaction to cap or suggested params object about to be used to create a transaction
147
96
  * @param maxAcceptableFee The maximum acceptable fee to pay
148
97
  */
149
- export declare function capTransactionFee(transaction: algosdk.Transaction, maxAcceptableFee: AlgoAmount): void;
98
+ export declare function capTransactionFee(transaction: algosdk.Transaction | SuggestedParams, maxAcceptableFee: AlgoAmount): void;
99
+ /**
100
+ * Allows for control of fees on a `Transaction` or `SuggestedParams` object
101
+ * @param transaction The transaction or suggested params
102
+ * @param feeControl The fee control parameters
103
+ */
104
+ export declare function controlFees<T extends SuggestedParams | Transaction>(transaction: T, feeControl: {
105
+ fee?: AlgoAmount;
106
+ maxFee?: AlgoAmount;
107
+ }): T;
150
108
  /**
151
109
  * Returns suggested transaction parameters from algod unless some are already provided.
152
110
  * @param params Optionally provide parameters to use
@@ -154,4 +112,10 @@ export declare function capTransactionFee(transaction: algosdk.Transaction, maxA
154
112
  * @returns The suggested transaction parameters
155
113
  */
156
114
  export declare function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<algosdk.SuggestedParams>;
115
+ /**
116
+ * Returns the array of transactions currently present in the given `AtomicTransactionComposer`
117
+ * @param atc The atomic transaction composer
118
+ * @returns The array of transactions with signers
119
+ */
120
+ export declare function getAtomicTransactionComposerTransactions(atc: AtomicTransactionComposer): algosdk.TransactionWithSigner[];
157
121
  //# sourceMappingURL=transaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,WAA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