@algorandfoundation/algokit-utils 1.0.0-beta.3 → 1.0.0-beta.30

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 (180) hide show
  1. package/README.md +1 -1
  2. package/{dist/account.d.ts → account.d.ts} +36 -32
  3. package/account.d.ts.map +1 -0
  4. package/{dist/account.js → account.js} +55 -41
  5. package/account.js.map +1 -0
  6. package/amount.d.ts +8 -0
  7. package/amount.d.ts.map +1 -0
  8. package/amount.js +24 -0
  9. package/amount.js.map +1 -0
  10. package/app.d.ts +118 -0
  11. package/app.d.ts.map +1 -0
  12. package/app.js +533 -0
  13. package/app.js.map +1 -0
  14. package/application-client.d.ts +10 -0
  15. package/application-client.d.ts.map +1 -0
  16. package/application-client.js +15 -0
  17. package/application-client.js.map +1 -0
  18. package/deploy-app.d.ts +96 -0
  19. package/deploy-app.d.ts.map +1 -0
  20. package/{dist/deploy-app.js → deploy-app.js} +139 -114
  21. package/deploy-app.js.map +1 -0
  22. package/index.d.ts +14 -0
  23. package/index.d.ts.map +1 -0
  24. package/{dist/index.js → index.js} +6 -2
  25. package/index.js.map +1 -0
  26. package/{dist/localnet.d.ts → localnet.d.ts} +6 -6
  27. package/localnet.d.ts.map +1 -0
  28. package/{dist/localnet.js → localnet.js} +12 -12
  29. package/localnet.js.map +1 -0
  30. package/{dist/network-client.d.ts → network-client.d.ts} +15 -24
  31. package/network-client.d.ts.map +1 -0
  32. package/{dist/network-client.js → network-client.js} +16 -16
  33. package/{dist/network-client.js.map → network-client.js.map} +1 -1
  34. package/package.json +5 -93
  35. package/testing/account.d.ts +14 -0
  36. package/testing/account.d.ts.map +1 -0
  37. package/testing/account.js +31 -0
  38. package/testing/account.js.map +1 -0
  39. package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
  40. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  41. package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
  42. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  43. package/testing/fixtures/algorand-fixture.d.ts +20 -0
  44. package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  45. package/testing/fixtures/algorand-fixture.js +49 -0
  46. package/testing/fixtures/algorand-fixture.js.map +1 -0
  47. package/testing/fixtures/index.d.ts +3 -0
  48. package/testing/fixtures/index.d.ts.map +1 -0
  49. package/testing/fixtures/index.js +19 -0
  50. package/testing/fixtures/index.js.map +1 -0
  51. package/testing/index.d.ts +6 -0
  52. package/testing/index.d.ts.map +1 -0
  53. package/testing/index.js +22 -0
  54. package/testing/index.js.map +1 -0
  55. package/testing/indexer.d.ts +12 -0
  56. package/testing/indexer.d.ts.map +1 -0
  57. package/testing/indexer.js +39 -0
  58. package/testing/indexer.js.map +1 -0
  59. package/testing/test-logger.d.ts +39 -0
  60. package/testing/test-logger.d.ts.map +1 -0
  61. package/testing/test-logger.js +69 -0
  62. package/testing/test-logger.js.map +1 -0
  63. package/testing/transaction-logger.d.ts +29 -0
  64. package/testing/transaction-logger.d.ts.map +1 -0
  65. package/testing/transaction-logger.js +71 -0
  66. package/testing/transaction-logger.js.map +1 -0
  67. package/transaction.d.ts +120 -0
  68. package/transaction.d.ts.map +1 -0
  69. package/transaction.js +316 -0
  70. package/transaction.js.map +1 -0
  71. package/transfer.d.ts +21 -0
  72. package/transfer.d.ts.map +1 -0
  73. package/transfer.js +65 -0
  74. package/transfer.js.map +1 -0
  75. package/types/account.d.ts +55 -0
  76. package/types/account.d.ts.map +1 -0
  77. package/types/account.js +91 -0
  78. package/types/account.js.map +1 -0
  79. package/types/algo-http-client-with-retry.d.ts.map +1 -0
  80. package/{dist → types}/algo-http-client-with-retry.js +2 -2
  81. package/types/algo-http-client-with-retry.js.map +1 -0
  82. package/{dist/types → types}/algod.d.ts +22 -9
  83. package/types/algod.d.ts.map +1 -0
  84. package/{dist/algo-amount.d.ts → types/amount.d.ts} +3 -1
  85. package/types/amount.d.ts.map +1 -0
  86. package/{dist/algo-amount.js → types/amount.js} +7 -1
  87. package/types/amount.js.map +1 -0
  88. package/types/app.d.ts +285 -0
  89. package/types/app.d.ts.map +1 -0
  90. package/types/app.js +32 -0
  91. package/types/app.js.map +1 -0
  92. package/types/application-client.d.ts +232 -0
  93. package/types/application-client.d.ts.map +1 -0
  94. package/types/application-client.js +470 -0
  95. package/types/application-client.js.map +1 -0
  96. package/types/appspec.d.ts +77 -0
  97. package/types/appspec.d.ts.map +1 -0
  98. package/types/appspec.js +15 -0
  99. package/types/appspec.js.map +1 -0
  100. package/types/config.d.ts +15 -0
  101. package/types/config.d.ts.map +1 -0
  102. package/types/config.js +27 -0
  103. package/types/config.js.map +1 -0
  104. package/{dist/types → types}/indexer.d.ts +8 -9
  105. package/{dist/types → types}/indexer.d.ts.map +1 -1
  106. package/{dist/config.d.ts → types/logging.d.ts} +2 -16
  107. package/types/logging.d.ts.map +1 -0
  108. package/{dist/config.js → types/logging.js} +5 -24
  109. package/types/logging.js.map +1 -0
  110. package/types/logic-error.d.ts +33 -0
  111. package/types/logic-error.d.ts.map +1 -0
  112. package/types/logic-error.js +46 -0
  113. package/types/logic-error.js.map +1 -0
  114. package/types/network-client.d.ts +11 -0
  115. package/types/network-client.d.ts.map +1 -0
  116. package/types/network-client.js +3 -0
  117. package/types/network-client.js.map +1 -0
  118. package/types/testing.d.ts +89 -0
  119. package/types/testing.d.ts.map +1 -0
  120. package/types/testing.js +3 -0
  121. package/types/testing.js.map +1 -0
  122. package/types/transaction.d.ts +85 -0
  123. package/types/transaction.d.ts.map +1 -0
  124. package/types/transaction.js +3 -0
  125. package/types/transaction.js.map +1 -0
  126. package/types/transfer.d.ts +32 -0
  127. package/types/transfer.d.ts.map +1 -0
  128. package/types/transfer.js +3 -0
  129. package/types/transfer.js.map +1 -0
  130. package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  131. package/types/urlTokenBaseHTTPClient.js.map +1 -0
  132. package/LICENSE +0 -21
  133. package/dist/account.d.ts.map +0 -1
  134. package/dist/account.js.map +0 -1
  135. package/dist/algo-amount.d.ts.map +0 -1
  136. package/dist/algo-amount.js.map +0 -1
  137. package/dist/algo-http-client-with-retry.d.ts.map +0 -1
  138. package/dist/algo-http-client-with-retry.js.map +0 -1
  139. package/dist/app.d.ts +0 -150
  140. package/dist/app.d.ts.map +0 -1
  141. package/dist/app.js +0 -156
  142. package/dist/app.js.map +0 -1
  143. package/dist/application-client.d.ts +0 -1
  144. package/dist/application-client.d.ts.map +0 -1
  145. package/dist/application-client.js +0 -69
  146. package/dist/application-client.js.map +0 -1
  147. package/dist/config.d.ts.map +0 -1
  148. package/dist/config.js.map +0 -1
  149. package/dist/deploy-app.d.ts +0 -149
  150. package/dist/deploy-app.d.ts.map +0 -1
  151. package/dist/deploy-app.js.map +0 -1
  152. package/dist/index.d.ts +0 -11
  153. package/dist/index.d.ts.map +0 -1
  154. package/dist/index.js.map +0 -1
  155. package/dist/localnet.d.ts.map +0 -1
  156. package/dist/localnet.js.map +0 -1
  157. package/dist/network-client.d.ts.map +0 -1
  158. package/dist/package.json +0 -20
  159. package/dist/transaction.d.ts +0 -152
  160. package/dist/transaction.d.ts.map +0 -1
  161. package/dist/transaction.js +0 -268
  162. package/dist/transaction.js.map +0 -1
  163. package/dist/transfer.d.ts +0 -24
  164. package/dist/transfer.d.ts.map +0 -1
  165. package/dist/transfer.js +0 -33
  166. package/dist/transfer.js.map +0 -1
  167. package/dist/types/algod.d.ts.map +0 -1
  168. package/dist/urlTokenBaseHTTPClient.d.ts.map +0 -1
  169. package/dist/urlTokenBaseHTTPClient.js.map +0 -1
  170. /package/{dist/indexer-lookup.d.ts → indexer-lookup.d.ts} +0 -0
  171. /package/{dist/indexer-lookup.d.ts.map → indexer-lookup.d.ts.map} +0 -0
  172. /package/{dist/indexer-lookup.js → indexer-lookup.js} +0 -0
  173. /package/{dist/indexer-lookup.js.map → indexer-lookup.js.map} +0 -0
  174. /package/{dist → types}/algo-http-client-with-retry.d.ts +0 -0
  175. /package/{dist/types → types}/algod.js +0 -0
  176. /package/{dist/types → types}/algod.js.map +0 -0
  177. /package/{dist/types → types}/indexer.js +0 -0
  178. /package/{dist/types → types}/indexer.js.map +0 -0
  179. /package/{dist → types}/urlTokenBaseHTTPClient.d.ts +0 -0
  180. /package/{dist → types}/urlTokenBaseHTTPClient.js +0 -0
package/transaction.js ADDED
@@ -0,0 +1,316 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getAtomicTransactionComposerTransactions = exports.getTransactionParams = exports.controlFees = exports.capTransactionFee = exports.waitForConfirmation = exports.sendGroupOfTransactions = exports.sendAtomicTransactionComposer = exports.sendTransaction = exports.getSenderTransactionSigner = exports.getSenderAddress = exports.encodeTransactionNote = void 0;
27
+ const algosdk_1 = __importStar(require("algosdk"));
28
+ const buffer_1 = require("buffer");
29
+ const _1 = require("./");
30
+ /** Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
31
+ *
32
+ * @param note The transaction note
33
+ * @returns the transaction note ready for inclusion in a transaction
34
+ *
35
+ * Case on the value of `data` this either either be:
36
+ * * `null` | `undefined`: `undefined`
37
+ * * `string`: The string value
38
+ * * Uint8Array: passthrough
39
+ * * Arc2TransactionNote object: ARC-0002 compatible transaction note
40
+ * * Else: The object/value converted into a JSON string representation
41
+ */
42
+ function encodeTransactionNote(note) {
43
+ if (note == null || typeof note === 'undefined') {
44
+ return undefined;
45
+ }
46
+ else if (typeof note === 'object' && note.constructor === Uint8Array) {
47
+ return note;
48
+ }
49
+ else if (typeof note === 'object' && 'dAppName' in note) {
50
+ const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : JSON.stringify(note.data)}`;
51
+ const encoder = new TextEncoder();
52
+ return encoder.encode(arc2Payload);
53
+ }
54
+ else {
55
+ const n = typeof note === 'string' ? note : JSON.stringify(note);
56
+ const encoder = new TextEncoder();
57
+ return encoder.encode(n);
58
+ }
59
+ }
60
+ exports.encodeTransactionNote = encodeTransactionNote;
61
+ /**
62
+ * Returns the public address of the given transaction sender.
63
+ * @param sender A transaction sender
64
+ * @returns The public address
65
+ */
66
+ const getSenderAddress = function (sender) {
67
+ return 'addr' in sender ? sender.addr : sender.address();
68
+ };
69
+ exports.getSenderAddress = getSenderAddress;
70
+ const memoize = (fn) => {
71
+ const cache = new Map();
72
+ const cached = function (val) {
73
+ return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val);
74
+ };
75
+ cached.cache = cache;
76
+ return cached;
77
+ };
78
+ /**
79
+ * Returns a @see TransactionSigner for the given transaction sender.
80
+ * This function has memoization, so will return the same transaction signer for a given sender.
81
+ * @param sender A transaction sender
82
+ * @returns A transaction signer
83
+ */
84
+ exports.getSenderTransactionSigner = memoize(function (sender) {
85
+ return 'signer' in sender
86
+ ? sender.signer
87
+ : 'lsig' in sender
88
+ ? algosdk_1.default.makeLogicSigAccountTransactionSigner(sender)
89
+ : algosdk_1.default.makeBasicAccountTransactionSigner(sender);
90
+ });
91
+ /** Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
92
+ *
93
+ * @param send The details for the transaction to prepare/send, including:
94
+ * * `transaction`: The unsigned transaction
95
+ * * `from`: The account to sign the transaction with: either an account with private key loaded or a logic signature account
96
+ * * `config`: The sending configuration for this transaction
97
+ * @param algod An algod client
98
+ *
99
+ * @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or `undefined`) confirmation (`confirmation`)
100
+ */
101
+ const sendTransaction = async function (send, algod) {
102
+ const { transaction, from, sendParams } = send;
103
+ const { skipSending, skipWaiting, fee, maxFee, suppressLog, maxRoundsToWaitForConfirmation, atc } = sendParams ?? {};
104
+ controlFees(transaction, { fee, maxFee });
105
+ if (atc) {
106
+ atc.addTransaction({ txn: transaction, signer: (0, exports.getSenderTransactionSigner)(from) });
107
+ return { transaction };
108
+ }
109
+ if (skipSending) {
110
+ return { transaction };
111
+ }
112
+ const signedTransaction = 'sk' in from
113
+ ? transaction.signTxn(from.sk)
114
+ : 'lsig' in from
115
+ ? algosdk_1.default.signLogicSigTransactionObject(transaction, from).blob
116
+ : 'sign' in from
117
+ ? from.sign(transaction)
118
+ : (await from.signer([transaction], [0]))[0];
119
+ await algod.sendRawTransaction(signedTransaction).do();
120
+ _1.Config.getLogger(suppressLog).info(`Sent transaction ID ${transaction.txID()} ${transaction.type} from ${(0, exports.getSenderAddress)(from)}`);
121
+ let confirmation = undefined;
122
+ if (!skipWaiting) {
123
+ confirmation = await (0, exports.waitForConfirmation)(transaction.txID(), maxRoundsToWaitForConfirmation ?? 5, algod);
124
+ }
125
+ return { transaction, confirmation };
126
+ };
127
+ exports.sendTransaction = sendTransaction;
128
+ /**
129
+ * Signs and sends transactions that have been collected by an @see AtomicTransactionComposer.
130
+ * @param atcSend The parameters controlling the send, including:
131
+ * * `atc` The @see AtomicTransactionComposer
132
+ * * `sendParams` The parameters to control the send behaviour
133
+ * @param algod An algod client
134
+ * @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`)
135
+ */
136
+ const sendAtomicTransactionComposer = async function (atcSend, algod) {
137
+ const { atc, sendParams } = atcSend;
138
+ const transactionsWithSigner = atc.buildGroup();
139
+ const transactionsToSend = transactionsWithSigner.map((t) => {
140
+ return t.txn;
141
+ });
142
+ let groupId = undefined;
143
+ if (transactionsToSend.length === 1) {
144
+ _1.Config.getLogger(sendParams?.suppressLog).info(`Sending transaction ${transactionsToSend[0].txID()}`);
145
+ }
146
+ else {
147
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
148
+ groupId = transactionsToSend[0].group ? buffer_1.Buffer.from(transactionsToSend[0].group).toString('base64') : '';
149
+ _1.Config.getLogger(sendParams?.suppressLog).info(`Sending group of ${transactionsToSend.length} transactions (${groupId})`, {
150
+ transactionsToSend,
151
+ });
152
+ _1.Config.getLogger(sendParams?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionsToSend.map((t) => t.txID()));
153
+ }
154
+ const result = await atc.execute(algod, sendParams?.maxRoundsToWaitForConfirmation ?? 5);
155
+ _1.Config.getLogger(sendParams?.suppressLog).info(`Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`);
156
+ let confirmations = undefined;
157
+ if (!sendParams?.skipWaiting) {
158
+ confirmations = await Promise.all(transactionsToSend.map(async (t) => (await algod.pendingTransactionInformation(t.txID()).do())));
159
+ }
160
+ return {
161
+ groupId,
162
+ confirmations,
163
+ txIds: transactionsToSend.map((t) => t.txID()),
164
+ transactions: transactionsToSend,
165
+ returns: result.methodResults.map((r) => ({
166
+ decodeError: r.decodeError,
167
+ returnValue: r.returnValue,
168
+ rawReturnValue: r.rawReturnValue,
169
+ })),
170
+ };
171
+ };
172
+ exports.sendAtomicTransactionComposer = sendAtomicTransactionComposer;
173
+ /**
174
+ * Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
175
+ *
176
+ * @param groupSend The group details to send, with:
177
+ * * `transactions`: The array of transactions to send along with their signing account
178
+ * * `sendParams`: The parameters to dictate how the group is sent
179
+ * @param algod An algod client
180
+ * @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`)
181
+ */
182
+ const sendGroupOfTransactions = async function (groupSend, algod) {
183
+ const { transactions, signer, sendParams } = groupSend;
184
+ const defaultTransactionSigner = signer ? (0, exports.getSenderTransactionSigner)(signer) : undefined;
185
+ const transactionsWithSigner = await Promise.all(transactions.map(async (t) => {
186
+ if ('signer' in t)
187
+ return {
188
+ txn: t.transaction,
189
+ signer: (0, exports.getSenderTransactionSigner)(t.signer),
190
+ sender: t.signer,
191
+ };
192
+ const txn = 'then' in t ? (await t).transaction : t;
193
+ if (!signer) {
194
+ throw new Error(`Attempt to send transaction ${txn.txID()} as part of a group transaction, but no signer parameter was provided.`);
195
+ }
196
+ return {
197
+ txn,
198
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
199
+ signer: defaultTransactionSigner,
200
+ sender: signer,
201
+ };
202
+ }));
203
+ const atc = new algosdk_1.AtomicTransactionComposer();
204
+ transactionsWithSigner.forEach((txn) => atc.addTransaction(txn));
205
+ return await (0, exports.sendAtomicTransactionComposer)({ atc, sendParams }, algod);
206
+ };
207
+ exports.sendGroupOfTransactions = sendGroupOfTransactions;
208
+ /**
209
+ * Wait until the transaction is confirmed or rejected, or until `timeout`
210
+ * number of rounds have passed.
211
+ *
212
+ * @param algod An algod client
213
+ * @param transactionId The transaction ID to wait for
214
+ * @param maxRoundsToWait Maximum number of rounds to wait
215
+ *
216
+ * @return Pending transaction information
217
+ * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds
218
+ */
219
+ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algod) {
220
+ if (maxRoundsToWait < 0) {
221
+ throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
222
+ }
223
+ // Get current round
224
+ const status = await algod.status().do();
225
+ if (status === undefined) {
226
+ throw new Error('Unable to get node status');
227
+ }
228
+ // Loop for up to `timeout` rounds looking for a confirmed transaction
229
+ const startRound = status['last-round'] + 1;
230
+ let currentRound = startRound;
231
+ while (currentRound < startRound + maxRoundsToWait) {
232
+ const pendingInfo = (await algod.pendingTransactionInformation(transactionId).do());
233
+ if (pendingInfo !== undefined) {
234
+ const confirmedRound = pendingInfo['confirmed-round'];
235
+ if (confirmedRound && confirmedRound > 0) {
236
+ return pendingInfo;
237
+ }
238
+ else {
239
+ const poolError = pendingInfo['pool-error'];
240
+ if (poolError != null && poolError.length > 0) {
241
+ // If there was a pool error, then the transaction has been rejected!
242
+ throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`);
243
+ }
244
+ }
245
+ }
246
+ await algod.statusAfterBlock(currentRound).do();
247
+ currentRound++;
248
+ }
249
+ throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`);
250
+ };
251
+ exports.waitForConfirmation = waitForConfirmation;
252
+ /**
253
+ * Limit the acceptable fee to a defined amount of µALGOs.
254
+ * This also sets the transaction to be flatFee to ensure the transaction only succeeds at
255
+ * the estimated rate.
256
+ * @param transaction The transaction to cap or suggested params object about to be used to create a transaction
257
+ * @param maxAcceptableFee The maximum acceptable fee to pay
258
+ */
259
+ function capTransactionFee(transaction, maxAcceptableFee) {
260
+ // If a flat fee hasn't already been defined
261
+ if (!transaction.flatFee) {
262
+ // Once a transaction has been constructed by algosdk, transaction.fee indicates what the total transaction fee
263
+ // Will be based on the current suggested fee-per-byte value.
264
+ if (transaction.fee > maxAcceptableFee.microAlgos) {
265
+ throw new Error(`Cancelled transaction due to high network congestion fees. Algorand suggested fees would cause this transaction to cost ${transaction.fee} µALGOs. Cap for this transaction is ${maxAcceptableFee.microAlgos} µALGOs.`);
266
+ }
267
+ else if (transaction.fee > algosdk_1.default.ALGORAND_MIN_TX_FEE) {
268
+ _1.Config.logger.warn(`Algorand network congestion fees are in effect. This transaction will incur a fee of ${transaction.fee} µALGOs.`);
269
+ }
270
+ // Now set the flat on the transaction. Otherwise the network may increase the fee above our cap and perform the transaction.
271
+ transaction.flatFee = true;
272
+ }
273
+ }
274
+ exports.capTransactionFee = capTransactionFee;
275
+ /**
276
+ * Allows for control of fees on a @see Transaction or @see SuggestedParams object
277
+ * @param transaction The transaction or suggested params
278
+ * @param feeControl The fee control parameters
279
+ */
280
+ function controlFees(transaction, feeControl) {
281
+ const { fee, maxFee } = feeControl;
282
+ if (fee) {
283
+ transaction.fee = fee.microAlgos;
284
+ transaction.flatFee = true;
285
+ }
286
+ if (maxFee !== undefined) {
287
+ capTransactionFee(transaction, maxFee);
288
+ }
289
+ return transaction;
290
+ }
291
+ exports.controlFees = controlFees;
292
+ /**
293
+ * Returns suggested transaction parameters from algod unless some are already provided.
294
+ * @param params Optionally provide parameters to use
295
+ * @param algod Algod algod
296
+ * @returns The suggested transaction parameters
297
+ */
298
+ async function getTransactionParams(params, algod) {
299
+ return params ? { ...params } : await algod.getTransactionParams().do();
300
+ }
301
+ exports.getTransactionParams = getTransactionParams;
302
+ /**
303
+ * Returns the array of transactions currently present in the given @see AtomicTransactionComposer
304
+ * @param atc The atomic transaction composer
305
+ * @returns The array of transactions with signers
306
+ */
307
+ function getAtomicTransactionComposerTransactions(atc) {
308
+ try {
309
+ return atc.clone().buildGroup();
310
+ }
311
+ catch {
312
+ return [];
313
+ }
314
+ }
315
+ exports.getAtomicTransactionComposerTransactions = getAtomicTransactionComposerTransactions;
316
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAsH;AACtH,mCAA+B;AAC/B,yBAA2B;AAa3B;;;;;;;;;;;GAWG;AACH,SAAgB,qBAAqB,CAAC,IAAsB;IAC1D,IAAI,IAAI,IAAI,I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W,CAAC,GAAG,UAAU,CAAC,CAAA;SACtI;QAED,6HAA6H;QAC7H,WAAW,CAAC,OAAO,GAAG,IAAI,CAAA;KAC3B;AACH,CAAC;AAhBD,8CAgBC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CACzB,WAAc,EACd,UAAqD;IAErD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IAClC,IAAI,GAAG,EAAE;QACP,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC,UAAU,CAAA;QAChC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAA;KAC3B;IAED,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;KACvC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC;AAfD,kCAeC;AAED;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CAAC,MAAmC,EAAE,KAAc;IAC5F,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;AACzE,CAAC;AAFD,oDAEC;AAED;;;;GAIG;AACH,SAAgB,wCAAwC,CAAC,GAA8B;IACrF,IAAI;QACF,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,CAAA;KAChC;IAAC,MAAM;QACN,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAND,4FAMC"}
package/transfer.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { Algodv2 } from 'algosdk';
2
+ import { SendTransactionResult } from './types/transaction';
3
+ import { AlgoTransferParams, EnsureFundedParams } from './types/transfer';
4
+ /**
5
+ * Transfer ALGOs between two accounts.
6
+ * @param transfer The transfer definition
7
+ * @param algod An algod client
8
+ * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)
9
+ */
10
+ export declare function transferAlgos(transfer: AlgoTransferParams, algod: Algodv2): Promise<SendTransactionResult>;
11
+ /**
12
+ * Funds a given account using a funding source such that it has a certain amount of algos free to spend (accounting for ALGOs locked in minimum balance requirement).
13
+ *
14
+ * @see https://developer.algorand.org/docs/get-details/accounts/#minimum-balance
15
+ *
16
+ * @param funding The funding configuration
17
+ * @param algod An algod client
18
+ * @returns undefined if nothing was needed or the transaction send result
19
+ */
20
+ export declare function ensureFunded(funding: EnsureFundedParams, algod: Algodv2): Promise<SendTransactionResult | undefined>;
21
+ //# sourceMappingURL=transfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../src/transfer.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAG1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAEzE;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAkBhH;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAgC1H"}
package/transfer.js ADDED
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ensureFunded = exports.transferAlgos = void 0;
7
+ const algosdk_1 = __importDefault(require("algosdk"));
8
+ const _1 = require("./");
9
+ const transaction_1 = require("./transaction");
10
+ /**
11
+ * Transfer ALGOs between two accounts.
12
+ * @param transfer The transfer definition
13
+ * @param algod An algod client
14
+ * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)
15
+ */
16
+ async function transferAlgos(transfer, algod) {
17
+ const { from, to, amount, note, transactionParams, ...sendParams } = transfer;
18
+ const transaction = algosdk_1.default.makePaymentTxnWithSuggestedParamsFromObject({
19
+ from: (0, transaction_1.getSenderAddress)(from),
20
+ to: to,
21
+ amount: amount.microAlgos,
22
+ note: (0, transaction_1.encodeTransactionNote)(note),
23
+ suggestedParams: await (0, transaction_1.getTransactionParams)(transactionParams, algod),
24
+ closeRemainderTo: undefined,
25
+ rekeyTo: undefined,
26
+ });
27
+ if (!sendParams.skipSending) {
28
+ _1.Config.getLogger(sendParams.suppressLog).debug(`Transferring ${amount.microAlgos}µALGOs from ${(0, transaction_1.getSenderAddress)(from)} to ${to}`);
29
+ }
30
+ return (0, transaction_1.sendTransaction)({ transaction, from, sendParams }, algod);
31
+ }
32
+ exports.transferAlgos = transferAlgos;
33
+ /**
34
+ * Funds a given account using a funding source such that it has a certain amount of algos free to spend (accounting for ALGOs locked in minimum balance requirement).
35
+ *
36
+ * @see https://developer.algorand.org/docs/get-details/accounts/#minimum-balance
37
+ *
38
+ * @param funding The funding configuration
39
+ * @param algod An algod client
40
+ * @returns undefined if nothing was needed or the transaction send result
41
+ */
42
+ async function ensureFunded(funding, algod) {
43
+ const { accountToFund, fundingSource, minSpendingBalance, minFundingIncrement, transactionParams, note, ...sendParams } = funding;
44
+ const addressToFund = typeof accountToFund === 'string' ? accountToFund : (0, transaction_1.getSenderAddress)(accountToFund);
45
+ const accountInfo = await algod.accountInformation(addressToFund).do();
46
+ const balance = Number(accountInfo.amount);
47
+ const minimumBalanceRequirement = (0, _1.microAlgos)(Number(accountInfo['min-balance']));
48
+ const currentSpendingBalance = (0, _1.microAlgos)(balance - +minimumBalanceRequirement);
49
+ if (minSpendingBalance > currentSpendingBalance) {
50
+ const minFundAmount = (0, _1.microAlgos)(+minSpendingBalance - +currentSpendingBalance);
51
+ const fundAmount = (0, _1.microAlgos)(Math.max(+minFundAmount, minFundingIncrement?.microAlgos ?? 0));
52
+ _1.Config.getLogger(sendParams.suppressLog).info(`Funding ${addressToFund} ${fundAmount} from ${(0, transaction_1.getSenderAddress)(fundingSource)} to reach minimum spend amount of ${minSpendingBalance} (balance = ${balance}, min_balance_req = ${minimumBalanceRequirement})`);
53
+ return await transferAlgos({
54
+ from: fundingSource,
55
+ to: addressToFund,
56
+ note: note ?? 'Funding account to meet minimum requirement',
57
+ amount: fundAmount,
58
+ transactionParams,
59
+ ...sendParams,
60
+ }, algod);
61
+ }
62
+ return undefined;
63
+ }
64
+ exports.ensureFunded = ensureFunded;
65
+ //# sourceMappingURL=transfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.js","sourceRoot":"","sources":["../src/transfer.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA0C;AAC1C,yBAAuC;AACvC,+CAA8G;AAI9G;;;;;GAKG;AACI,KAAK,UAAU,aAAa,CAAC,QAA4B,EAAE,KAAc;IAC9E,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,UAAU,EAAE,GAAG,QAAQ,CAAA;IAE7E,MAAM,WAAW,GAAG,iBAAO,CAAC,2CAA2C,CAAC;QACtE,IAAI,EAAE,IAAA,8BAAgB,EAAC,IAAI,CAAC;QAC5B,EAAE,EAAE,EAAE;QACN,MAAM,EAAE,MAAM,CAAC,UAAU;QACzB,IAAI,EAAE,IAAA,mCAAqB,EAAC,IAAI,CAAC;QACjC,eAAe,EAAE,MAAM,IAAA,kCAAoB,EAAC,iBAAiB,EAAE,KAAK,CAAC;QACrE,gBAAgB,EAAE,SAAS;QAC3B,OAAO,EAAE,SAAS;KACnB,CAAC,CAAA;IAEF,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE;QAC3B,SAAM,CAAC,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,UAAU,eAAe,IA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,SAAS,IAAA,8BAAgB,EAC7D,aAAa,CACd,qCAAqC,kBAAkB,eAAe,OAAO,uBAAuB,yBAAyB,GAAG,CAClI,CAAA;QACD,OAAO,MAAM,aAAa,CACxB;YACE,IAAI,EAAE,aAAa;YACnB,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,IAAI,IAAI,6CAA6C;YAC3D,MAAM,EAAE,UAAU;YAClB,iBAAiB;YACjB,GAAG,UAAU;SACd,EACD,KAAK,CACN,CAAA;KACF;IAED,OAAO,SAAS,CAAA;AAClB,CAAC;AAhCD,oCAgCC"}
@@ -0,0 +1,55 @@
1
+ import algosdk, { Account, MultisigMetadata, Transaction, TransactionSigner } from 'algosdk';
2
+ /**
3
+ * The account name identifier used for fund dispensing in test environments
4
+ */
5
+ export declare const DISPENSER_ACCOUNT = "DISPENSER";
6
+ /** Account wrapper that supports partial or full multisig signing. */
7
+ export declare class MultisigAccount {
8
+ _params: algosdk.MultisigMetadata;
9
+ _signingAccounts: (algosdk.Account | SigningAccount)[];
10
+ _addr: string;
11
+ _signer: TransactionSigner;
12
+ /** The parameters for the multisig account */
13
+ get params(): Readonly<algosdk.MultisigMetadata>;
14
+ /** The list of accounts that are present to sign */
15
+ get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]>;
16
+ /** The address of the multisig account */
17
+ get addr(): Readonly<string>;
18
+ get signer(): TransactionSigner;
19
+ constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]);
20
+ /**
21
+ * Sign the given transaction
22
+ * @param transaction Either a transaction object or a raw, partially signed transaction
23
+ * @returns The transaction signed by the present signers
24
+ */
25
+ sign(transaction: Transaction | Uint8Array): Uint8Array;
26
+ }
27
+ /** Account wrapper that supports a rekeyed account */
28
+ export declare class SigningAccount implements Account {
29
+ private _account;
30
+ private _signer;
31
+ private _sender;
32
+ /**
33
+ * Algorand address of the sender
34
+ */
35
+ get addr(): Readonly<string>;
36
+ /**
37
+ * Secret key belonging to the signer
38
+ */
39
+ get sk(): Readonly<Uint8Array>;
40
+ /**
41
+ * Transaction signer for the underlying signing account
42
+ */
43
+ get signer(): TransactionSigner;
44
+ /**
45
+ * Algorand account of the sender address and signer private key
46
+ */
47
+ get sender(): Account;
48
+ constructor(account: Account, sender: string | undefined);
49
+ }
50
+ /** A wrapper around @see {TransactionSigner} that also has the sender address. */
51
+ export interface TransactionSignerAccount {
52
+ addr: Readonly<string>;
53
+ signer: TransactionSigner;
54
+ }
55
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE5F;;GAEG;AACH,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAE5C,sEAAsE;AACtE,qBAAa,eAAe;IAC1B,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAA;IACjC,gBAAgB,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,CAAA;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,iBAAiB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAE/C;IAED,oDAAoD;IACpD,IAAI,eAAe,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,CAAC,CAEpE;IAED,0CAA0C;IAC1C,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED,IAAI,MAAM,IAAI,iBAAiB,CAE9B;gBAEW,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE;IAU3F;;;;OAIG;IACI,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU;CAY/D;AAED,sDAAsD;AACtD,qBAAa,cAAe,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAQ;IAEvB;;OAEG;IACH,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED;;OAEG;IACH,IAAI,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,CAE7B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAKpB;gBAEW,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS;CAKzD;AAED,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtB,MAAM,EAAE,iBAAiB,CAAA;CAC1B"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SigningAccount = exports.MultisigAccount = exports.DISPENSER_ACCOUNT = void 0;
7
+ const algosdk_1 = __importDefault(require("algosdk"));
8
+ /**
9
+ * The account name identifier used for fund dispensing in test environments
10
+ */
11
+ exports.DISPENSER_ACCOUNT = 'DISPENSER';
12
+ /** Account wrapper that supports partial or full multisig signing. */
13
+ class MultisigAccount {
14
+ /** The parameters for the multisig account */
15
+ get params() {
16
+ return this._params;
17
+ }
18
+ /** The list of accounts that are present to sign */
19
+ get signingAccounts() {
20
+ return this._signingAccounts;
21
+ }
22
+ /** The address of the multisig account */
23
+ get addr() {
24
+ return this._addr;
25
+ }
26
+ get signer() {
27
+ return this._signer;
28
+ }
29
+ constructor(multisigParams, signingAccounts) {
30
+ this._params = multisigParams;
31
+ this._signingAccounts = signingAccounts;
32
+ this._addr = algosdk_1.default.multisigAddress(multisigParams);
33
+ this._signer = algosdk_1.default.makeMultiSigAccountTransactionSigner(multisigParams, signingAccounts.map((a) => a.sk));
34
+ }
35
+ /**
36
+ * Sign the given transaction
37
+ * @param transaction Either a transaction object or a raw, partially signed transaction
38
+ * @returns The transaction signed by the present signers
39
+ */
40
+ sign(transaction) {
41
+ let signedTxn = 'from' in transaction ? undefined : transaction;
42
+ for (const signer of this._signingAccounts) {
43
+ if (signedTxn) {
44
+ signedTxn = algosdk_1.default.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob;
45
+ }
46
+ else {
47
+ signedTxn = algosdk_1.default.signMultisigTransaction(transaction, this._params, signer.sk).blob;
48
+ }
49
+ }
50
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
+ return signedTxn;
52
+ }
53
+ }
54
+ exports.MultisigAccount = MultisigAccount;
55
+ /** Account wrapper that supports a rekeyed account */
56
+ class SigningAccount {
57
+ /**
58
+ * Algorand address of the sender
59
+ */
60
+ get addr() {
61
+ return this._sender;
62
+ }
63
+ /**
64
+ * Secret key belonging to the signer
65
+ */
66
+ get sk() {
67
+ return this._account.sk;
68
+ }
69
+ /**
70
+ * Transaction signer for the underlying signing account
71
+ */
72
+ get signer() {
73
+ return this._signer;
74
+ }
75
+ /**
76
+ * Algorand account of the sender address and signer private key
77
+ */
78
+ get sender() {
79
+ return {
80
+ addr: this._sender,
81
+ sk: this._account.sk,
82
+ };
83
+ }
84
+ constructor(account, sender) {
85
+ this._account = account;
86
+ this._sender = sender ?? account.addr;
87
+ this._signer = algosdk_1.default.makeBasicAccountTransactionSigner(account);
88
+ }
89
+ }
90
+ exports.SigningAccount = SigningAccount;
91
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA4F;AAE5F;;GAEG;AACU,QAAA,iBAAiB,GAAG,WAAW,CAAA;AA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IACnB,CAAC;CACF;AApDD,0CAoDC;AAED,sDAAsD;AACtD,MAAa,cAAc;IAKzB;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,OAAO;YAClB,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;SACrB,CAAA;IACH,CAAC;IAED,YAAY,OAAgB,EAAE,MAA0B;QACtD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,iBAAO,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;IACnE,CAAC;CACF;AAzCD,wCAyCC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo-http-client-with-retry.d.ts","sourceRoot":"","sources":["../../src/types/algo-http-client-with-retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAA;AAExF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,yEAAyE;AACzE,qBAAa,uBAAwB,SAAQ,sBAAsB;IACjE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAI;IACrC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAQ;IAI9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAsC;IAChF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAUxC;YAEa,aAAa;IA6BrB,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI9H,IAAI,CACR,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC1C,OAAO,CAAC,sBAAsB,CAAC;IAI5B,MAAM,CACV,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC1C,OAAO,CAAC,sBAAsB,CAAC;CAGnC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AlgoHttpClientWithRetry = void 0;
4
- const config_1 = require("./config");
4
+ const __1 = require("../");
5
5
  const urlTokenBaseHTTPClient_1 = require("./urlTokenBaseHTTPClient");
6
6
  /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
7
7
  class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient_1.URLTokenBaseHTTPClient {
@@ -26,7 +26,7 @@ class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient_1.URLTokenBaseHTTPC
26
26
  if (delayTimeMs > 0) {
27
27
  await new Promise((r) => setTimeout(r, delayTimeMs));
28
28
  }
29
- config_1.AlgoKitConfig.logger.warn(`algosdk request failed ${numTries} times. Retrying in ${delayTimeMs}ms: ${err}`);
29
+ __1.Config.logger.warn(`algosdk request failed ${numTries} times. Retrying in ${delayTimeMs}ms: ${err}`);
30
30
  }
31
31
  } while (!response && ++numTries <= AlgoHttpClientWithRetry.MAX_TRIES);
32
32
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algo-http-client-with-retry.js","sourceRoot":"","sources":["../../src/types/algo-http-client-with-retry.ts"],"names":[],"mappings":";;;AACA,2BAA4B;AAC5B,qEAAiE;AAEjE,yEAAyE;AACzE,MAAa,uBAAwB,SAAQ,+CAAsB;IAmBzD,KAAK,CAAC,aAAa,CAAC,IAA2C;QACrE,IAAI,QAA4C,CAAA;QAChD,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,GAAG;YACD,IAAI;gBACF,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAA;gBACvB,8DAA8D;aAC/D;YAAC,OAAO,GAAQ,EAAE;gBACjB,IAAI,QAAQ,IAAI,uBAAuB,CAAC,SAAS,EAAE;oBACjD,MAAM,GAAG,CAAA;iBACV;gBACD,iDAAiD;gBACjD,IACE,CAAC,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,uBAAuB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAClI;oBACA,MAAM,GAAG,CAAA;iBACV;gBACD,gEAAgE;gBAChE,MAAM,WAAW,GAAG,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC,cAAc,CAAC,CAAA;gBAC1H,IAAI,WAAW,GAAG,CAAC,EAAE;oBACnB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAA;iBACrD;gBACD,UAAM,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,QAAQ,uBAAuB,WAAW,OAAO,GAAG,EAAE,CAAC,CA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