@algorandfoundation/algokit-utils 1.0.0-beta.8 → 1.0.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 (141) hide show
  1. package/account.d.ts +91 -0
  2. package/account.d.ts.map +1 -0
  3. package/account.js +158 -0
  4. package/account.js.map +1 -0
  5. package/amount.d.ts +8 -0
  6. package/amount.d.ts.map +1 -0
  7. package/amount.js +24 -0
  8. package/amount.js.map +1 -0
  9. package/app.d.ts +108 -0
  10. package/app.d.ts.map +1 -0
  11. package/app.js +423 -0
  12. package/app.js.map +1 -0
  13. package/application-client.d.ts +10 -0
  14. package/application-client.d.ts.map +1 -0
  15. package/application-client.js +15 -0
  16. package/application-client.js.map +1 -0
  17. package/deploy-app.d.ts +93 -0
  18. package/deploy-app.d.ts.map +1 -0
  19. package/deploy-app.js +410 -0
  20. package/deploy-app.js.map +1 -0
  21. package/index.d.ts +14 -0
  22. package/index.d.ts.map +1 -0
  23. package/index.js +5 -2
  24. package/index.js.map +1 -0
  25. package/indexer-lookup.d.ts +31 -0
  26. package/indexer-lookup.d.ts.map +1 -0
  27. package/indexer-lookup.js +96 -0
  28. package/indexer-lookup.js.map +1 -0
  29. package/localnet.d.ts +54 -0
  30. package/localnet.d.ts.map +1 -0
  31. package/localnet.js +121 -0
  32. package/localnet.js.map +1 -0
  33. package/network-client.d.ts +93 -0
  34. package/network-client.d.ts.map +1 -0
  35. package/network-client.js +182 -0
  36. package/network-client.js.map +1 -0
  37. package/package.json +3 -3
  38. package/testing/account.d.ts +14 -0
  39. package/testing/account.d.ts.map +1 -0
  40. package/testing/account.js +31 -0
  41. package/testing/account.js.map +1 -0
  42. package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
  43. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  44. package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
  45. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  46. package/testing/fixtures/algorand-fixture.d.ts +20 -0
  47. package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  48. package/testing/fixtures/algorand-fixture.js +49 -0
  49. package/testing/fixtures/algorand-fixture.js.map +1 -0
  50. package/testing/fixtures/index.d.ts +3 -0
  51. package/testing/fixtures/index.d.ts.map +1 -0
  52. package/testing/fixtures/index.js +19 -0
  53. package/testing/fixtures/index.js.map +1 -0
  54. package/testing/index.d.ts +6 -0
  55. package/testing/index.d.ts.map +1 -0
  56. package/testing/index.js +22 -0
  57. package/testing/index.js.map +1 -0
  58. package/testing/indexer.d.ts +12 -0
  59. package/testing/indexer.d.ts.map +1 -0
  60. package/testing/indexer.js +39 -0
  61. package/testing/indexer.js.map +1 -0
  62. package/testing/test-logger.d.ts +39 -0
  63. package/testing/test-logger.d.ts.map +1 -0
  64. package/testing/test-logger.js +69 -0
  65. package/testing/test-logger.js.map +1 -0
  66. package/testing/transaction-logger.d.ts +29 -0
  67. package/testing/transaction-logger.d.ts.map +1 -0
  68. package/testing/transaction-logger.js +71 -0
  69. package/testing/transaction-logger.js.map +1 -0
  70. package/transaction.d.ts +80 -0
  71. package/transaction.d.ts.map +1 -0
  72. package/transaction.js +256 -0
  73. package/transaction.js.map +1 -0
  74. package/transfer.d.ts +21 -0
  75. package/transfer.d.ts.map +1 -0
  76. package/transfer.js +65 -0
  77. package/transfer.js.map +1 -0
  78. package/types/account.d.ts +52 -0
  79. package/types/account.d.ts.map +1 -0
  80. package/types/account.js +86 -0
  81. package/types/account.js.map +1 -0
  82. package/types/algo-http-client-with-retry.d.ts +14 -0
  83. package/types/algo-http-client-with-retry.d.ts.map +1 -0
  84. package/types/algo-http-client-with-retry.js +62 -0
  85. package/types/algo-http-client-with-retry.js.map +1 -0
  86. package/types/algod.d.ts +137 -0
  87. package/types/algod.d.ts.map +1 -0
  88. package/types/algod.js +3 -0
  89. package/types/algod.js.map +1 -0
  90. package/types/amount.d.ts +20 -0
  91. package/types/amount.d.ts.map +1 -0
  92. package/types/amount.js +37 -0
  93. package/types/amount.js.map +1 -0
  94. package/types/app.d.ts +279 -0
  95. package/types/app.d.ts.map +1 -0
  96. package/types/app.js +32 -0
  97. package/types/app.js.map +1 -0
  98. package/types/application-client.d.ts +229 -0
  99. package/types/application-client.d.ts.map +1 -0
  100. package/types/application-client.js +470 -0
  101. package/types/application-client.js.map +1 -0
  102. package/types/appspec.d.ts +77 -0
  103. package/types/appspec.d.ts.map +1 -0
  104. package/types/appspec.js +15 -0
  105. package/types/appspec.js.map +1 -0
  106. package/types/config.d.ts +15 -0
  107. package/types/config.d.ts.map +1 -0
  108. package/types/config.js +27 -0
  109. package/types/config.js.map +1 -0
  110. package/types/indexer.d.ts +313 -0
  111. package/types/indexer.d.ts.map +1 -0
  112. package/types/indexer.js +25 -0
  113. package/types/indexer.js.map +1 -0
  114. package/types/logging.d.ts +13 -0
  115. package/types/logging.d.ts.map +1 -0
  116. package/types/logging.js +27 -0
  117. package/types/logging.js.map +1 -0
  118. package/types/logic-error.d.ts +33 -0
  119. package/types/logic-error.d.ts.map +1 -0
  120. package/types/logic-error.js +46 -0
  121. package/types/logic-error.js.map +1 -0
  122. package/types/network-client.d.ts +11 -0
  123. package/types/network-client.d.ts.map +1 -0
  124. package/types/network-client.js +3 -0
  125. package/types/network-client.js.map +1 -0
  126. package/types/testing.d.ts +89 -0
  127. package/types/testing.d.ts.map +1 -0
  128. package/types/testing.js +3 -0
  129. package/types/testing.js.map +1 -0
  130. package/types/transaction.d.ts +67 -0
  131. package/types/transaction.d.ts.map +1 -0
  132. package/types/transaction.js +3 -0
  133. package/types/transaction.js.map +1 -0
  134. package/types/transfer.d.ts +32 -0
  135. package/types/transfer.d.ts.map +1 -0
  136. package/types/transfer.js +3 -0
  137. package/types/transfer.js.map +1 -0
  138. package/types/urlTokenBaseHTTPClient.d.ts +41 -0
  139. package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  140. package/types/urlTokenBaseHTTPClient.js +151 -0
  141. package/types/urlTokenBaseHTTPClient.js.map +1 -0
package/transaction.js ADDED
@@ -0,0 +1,256 @@
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.getTransactionParams = exports.capTransactionFee = exports.waitForConfirmation = exports.sendGroupOfTransactions = exports.sendTransaction = exports.getSenderAddress = exports.encodeTransactionNote = void 0;
7
+ const algosdk_1 = __importDefault(require("algosdk"));
8
+ const buffer_1 = require("buffer");
9
+ const _1 = require("./");
10
+ /** Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
11
+ *
12
+ * @param note The transaction note
13
+ * @returns the transaction note ready for inclusion in a transaction
14
+ *
15
+ * Case on the value of `data` this either either be:
16
+ * * `null` | `undefined`: `undefined`
17
+ * * `string`: The string value
18
+ * * Uint8Array: passthrough
19
+ * * Arc2TransactionNote object: ARC-0002 compatible transaction note
20
+ * * Else: The object/value converted into a JSON string representation
21
+ */
22
+ function encodeTransactionNote(note) {
23
+ if (note == null || typeof note === 'undefined') {
24
+ return undefined;
25
+ }
26
+ else if (typeof note === 'object' && note.constructor === Uint8Array) {
27
+ return note;
28
+ }
29
+ else if (typeof note === 'object' && 'dAppName' in note) {
30
+ const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : JSON.stringify(note.data)}`;
31
+ const encoder = new TextEncoder();
32
+ return encoder.encode(arc2Payload);
33
+ }
34
+ else {
35
+ const n = typeof note === 'string' ? note : JSON.stringify(note);
36
+ const encoder = new TextEncoder();
37
+ return encoder.encode(n);
38
+ }
39
+ }
40
+ exports.encodeTransactionNote = encodeTransactionNote;
41
+ /**
42
+ * Returns the public address of the given transaction sender.
43
+ * @param sender A transaction sender
44
+ * @returns The public address
45
+ */
46
+ const getSenderAddress = function (sender) {
47
+ return 'addr' in sender ? sender.addr : sender.address();
48
+ };
49
+ exports.getSenderAddress = getSenderAddress;
50
+ /** Signs and sends the given transaction to the chain
51
+ *
52
+ * @param send The details for the transaction to send, including:
53
+ * * `transaction`: The unsigned transaction
54
+ * * `from`: The account to sign the transaction with: either an account with private key loaded or a logic signature account
55
+ * * `config`: The sending configuration for this transaction
56
+ * @param algod An algod client
57
+ *
58
+ * @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
59
+ */
60
+ const sendTransaction = async function (send, algod) {
61
+ const { transaction, from, sendParams } = send;
62
+ const { skipSending, skipWaiting, fee, maxFee, suppressLog, maxRoundsToWaitForConfirmation } = sendParams ?? {};
63
+ if (fee) {
64
+ transaction.fee = fee.microAlgos;
65
+ transaction.flatFee = true;
66
+ }
67
+ if (maxFee !== undefined) {
68
+ capTransactionFee(transaction, maxFee);
69
+ }
70
+ if (skipSending) {
71
+ return { transaction };
72
+ }
73
+ const signedTransaction = 'sk' in from
74
+ ? transaction.signTxn(from.sk)
75
+ : 'lsig' in from
76
+ ? algosdk_1.default.signLogicSigTransactionObject(transaction, from).blob
77
+ : 'signer' in from
78
+ ? (await from.signer([transaction], [0]))[0]
79
+ : from.sign(transaction);
80
+ await algod.sendRawTransaction(signedTransaction).do();
81
+ _1.Config.getLogger(suppressLog).info(`Sent transaction ID ${transaction.txID()} ${transaction.type} from ${(0, exports.getSenderAddress)(from)}`);
82
+ let confirmation = undefined;
83
+ if (!skipWaiting) {
84
+ confirmation = await (0, exports.waitForConfirmation)(transaction.txID(), maxRoundsToWaitForConfirmation ?? 5, algod);
85
+ }
86
+ return { transaction, confirmation };
87
+ };
88
+ exports.sendTransaction = sendTransaction;
89
+ const groupBy = (array, predicate) => array.reduce((acc, value, id, array) => {
90
+ var _a;
91
+ ;
92
+ (acc[_a = predicate(value, id, array)] || (acc[_a] = [])).push(value);
93
+ return acc;
94
+ }, {});
95
+ /**
96
+ * Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
97
+ *
98
+ * @param groupSend The group details to send, with:
99
+ * * `transactions`: The array of transactions to send along with their signing account
100
+ * * `sendParams`: The parameters to dictate how the group is sent
101
+ * @param algod An algod client
102
+ * @returns An object with group transaction ID (`groupTransactionId`) and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
103
+ */
104
+ const sendGroupOfTransactions = async function (groupSend, algod) {
105
+ const { transactions, signer, sendParams } = groupSend;
106
+ const transactionsWithSigner = await Promise.all(transactions.map(async (t) => {
107
+ if ('signer' in t)
108
+ return t;
109
+ const txn = 'then' in t ? (await t).transaction : t;
110
+ if (!signer) {
111
+ throw new Error(`Attempt to send transaction ${txn.txID()} as part of a group transaction, but no signer was provided.`);
112
+ }
113
+ return {
114
+ transaction: txn,
115
+ signer: signer,
116
+ };
117
+ }));
118
+ const transactionsToSend = transactionsWithSigner.map((t) => {
119
+ return t.transaction;
120
+ });
121
+ const group = algosdk_1.default.assignGroupID(transactionsToSend);
122
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
123
+ const groupId = buffer_1.Buffer.from(group[0].group).toString('base64');
124
+ _1.Config.getLogger(sendParams?.suppressLog).info(`Sending group of transactions (${groupId})`, { transactionsToSend });
125
+ // Sign transactions either using TransactionSigners, or not
126
+ let signedTransactions;
127
+ if (transactionsWithSigner.find((t) => 'signer' in t.signer)) {
128
+ // Validate all or nothing for transaction signers
129
+ if (transactionsWithSigner.find((t) => !('signer' in t.signer))) {
130
+ throw new Error("When issuing a group transaction the signers should either all be TransactionSignerAccount's or all not. " +
131
+ 'Received at least one TransactionSignerAccount, but not all of them so failing the send.');
132
+ }
133
+ // Group transaction signers by signer
134
+ const groupedBySigner = groupBy(transactionsWithSigner.map((t, i) => ({
135
+ signer: t.signer,
136
+ id: i,
137
+ })), (t) => t.signer.addr);
138
+ // Perform the signature, grouped by signer
139
+ const signed = (await Promise.all(Object.values(groupedBySigner).map(async (signature) => {
140
+ const indexes = signature.map((s) => s.id);
141
+ const signed = await signature[0].signer.signer(group, indexes);
142
+ return signed.map((txn, i) => ({
143
+ txn,
144
+ id: indexes[i],
145
+ }));
146
+ }))).flatMap((a) => a);
147
+ // Extract the signed transactions in order
148
+ signedTransactions = signed.sort((s1, s2) => s1.id - s2.id).map((s) => s.txn);
149
+ }
150
+ else {
151
+ signedTransactions = group.map((groupedTransaction, id) => {
152
+ const signer = transactionsWithSigner[id].signer;
153
+ return 'sk' in signer
154
+ ? groupedTransaction.signTxn(signer.sk)
155
+ : 'lsig' in signer
156
+ ? algosdk_1.default.signLogicSigTransactionObject(groupedTransaction, signer).blob
157
+ : 'sign' in signer
158
+ ? signer.sign(groupedTransaction)
159
+ : // This bit will never happen because above if statement
160
+ new Uint8Array();
161
+ });
162
+ }
163
+ _1.Config.getLogger(sendParams?.suppressLog).debug(`Signer IDs (${groupId})`, transactionsWithSigner.map((t) => (0, exports.getSenderAddress)(t.signer)));
164
+ _1.Config.getLogger(sendParams?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionsToSend.map((t) => t.txID()));
165
+ // https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactions
166
+ await algod.sendRawTransaction(signedTransactions).do();
167
+ _1.Config.getLogger(sendParams?.suppressLog).info(`Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`);
168
+ let confirmations = undefined;
169
+ if (!sendParams?.skipWaiting) {
170
+ confirmations = await Promise.all(transactionsToSend.map(async (t) => await (0, exports.waitForConfirmation)(t.txID(), sendParams?.maxRoundsToWaitForConfirmation ?? 5, algod)));
171
+ }
172
+ return {
173
+ groupId,
174
+ confirmations,
175
+ txIds: transactionsToSend.map((t) => t.txID()),
176
+ };
177
+ };
178
+ exports.sendGroupOfTransactions = sendGroupOfTransactions;
179
+ /**
180
+ * Wait until the transaction is confirmed or rejected, or until `timeout`
181
+ * number of rounds have passed.
182
+ *
183
+ * @param algod An algod client
184
+ * @param transactionId The transaction ID to wait for
185
+ * @param maxRoundsToWait Maximum number of rounds to wait
186
+ *
187
+ * @return Pending transaction information
188
+ * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds
189
+ */
190
+ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algod) {
191
+ if (maxRoundsToWait < 0) {
192
+ throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
193
+ }
194
+ // Get current round
195
+ const status = await algod.status().do();
196
+ if (status === undefined) {
197
+ throw new Error('Unable to get node status');
198
+ }
199
+ // Loop for up to `timeout` rounds looking for a confirmed transaction
200
+ const startRound = status['last-round'] + 1;
201
+ let currentRound = startRound;
202
+ while (currentRound < startRound + maxRoundsToWait) {
203
+ const pendingInfo = (await algod.pendingTransactionInformation(transactionId).do());
204
+ if (pendingInfo !== undefined) {
205
+ const confirmedRound = pendingInfo['confirmed-round'];
206
+ if (confirmedRound && confirmedRound > 0) {
207
+ return pendingInfo;
208
+ }
209
+ else {
210
+ const poolError = pendingInfo['pool-error'];
211
+ if (poolError != null && poolError.length > 0) {
212
+ // If there was a pool error, then the transaction has been rejected!
213
+ throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`);
214
+ }
215
+ }
216
+ }
217
+ await algod.statusAfterBlock(currentRound).do();
218
+ currentRound++;
219
+ }
220
+ throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`);
221
+ };
222
+ exports.waitForConfirmation = waitForConfirmation;
223
+ /**
224
+ * Limit the acceptable fee to a defined amount of µALGOs.
225
+ * This also sets the transaction to be flatFee to ensure the transaction only succeeds at
226
+ * the estimated rate.
227
+ * @param transaction The transaction to cap
228
+ * @param maxAcceptableFee The maximum acceptable fee to pay
229
+ */
230
+ function capTransactionFee(transaction, maxAcceptableFee) {
231
+ // If a flat fee hasn't already been defined
232
+ if (!transaction.flatFee) {
233
+ // Once a transaction has been constructed by algosdk, transaction.fee indicates what the total transaction fee
234
+ // Will be based on the current suggested fee-per-byte value.
235
+ if (transaction.fee > maxAcceptableFee.microAlgos) {
236
+ 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.`);
237
+ }
238
+ else if (transaction.fee > algosdk_1.default.ALGORAND_MIN_TX_FEE) {
239
+ _1.Config.logger.warn(`Algorand network congestion fees are in effect. This transaction will incur a fee of ${transaction.fee} µALGOs.`);
240
+ }
241
+ // Now set the flat on the transaction. Otherwise the network may increase the fee above our cap and perform the transaction.
242
+ transaction.flatFee = true;
243
+ }
244
+ }
245
+ exports.capTransactionFee = capTransactionFee;
246
+ /**
247
+ * Returns suggested transaction parameters from algod unless some are already provided.
248
+ * @param params Optionally provide parameters to use
249
+ * @param algod Algod algod
250
+ * @returns The suggested transaction parameters
251
+ */
252
+ async function getTransactionParams(params, algod) {
253
+ return params ?? (await algod.getTransactionParams().do());
254
+ }
255
+ exports.getTransactionParams = getTransactionParams;
256
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwE;AACxE,mCAA+B;AAC/B,yBAA2B;AAY3B;;;;;;;;;;;GAWG;AACH,SAAgB,qBAAqB,CAAC,IAAsB;IAC1D,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAC/C,OAAO,SAAS,CAAA;KACjB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE;QACtE,OAAO,IAAI,CAAA;KACZ;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,UAAU,IAAI,IAAI,EAAE;QACzD,MAAM,WAAW,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;Q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I,CAAC,wFAAwF,WAAW,CAAC,GAAG,UAAU,CAAC,CAAA;SACtI;QAED,6HAA6H;QAC7H,WAAW,CAAC,OAAO,GAAG,IAAI,CAAA;KAC3B;AACH,CAAC;AAhBD,8CAgBC;AAED;;;;;GAKG;AACI,KAAK,UAAU,oBAAoB,CAAC,MAAmC,EAAE,KAAc;IAC5F,OAAO,MAAM,IAAI,CAAC,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAC5D,CAAC;AAFD,oDAEC"}
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,QA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C,CAAC,EAAE,EAAE,CAAA;IACtE,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAC1C,MAAM,yBAAyB,GAAG,IAAA,aAAU,EAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IAChF,MAAM,sBAAsB,GAAG,IAAA,aAAU,EAAC,OAAO,GAAG,CAAC,yBAAyB,CAAC,CAAA;IAE/E,IAAI,kBAAkB,GAAG,sBAAsB,EAAE;QAC/C,MAAM,aAAa,GAAG,IAAA,aAAU,EAAC,CAAC,kBAAkB,GAAG,CAAC,sBAAsB,CAAC,CAAA;QAC/E,MAAM,UAAU,GAAG,IAAA,aAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,mBAAmB,EAAE,UAAU,IAAI,CAAC,CAAC,CAAC,CAAA;QAC7F,SAAM,CAAC,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAC3C,WAAW,aAAa,IAAI,UAAU,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,52 @@
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
+ /** The parameters for the multisig account */
12
+ get params(): Readonly<algosdk.MultisigMetadata>;
13
+ /** The list of accounts that are present to sign */
14
+ get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]>;
15
+ /** The address of the multisig account */
16
+ get addr(): Readonly<string>;
17
+ constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]);
18
+ /**
19
+ * Sign the given transaction
20
+ * @param transaction Either a transaction object or a raw, partially signed transaction
21
+ * @returns The transaction signed by the present signers
22
+ */
23
+ sign(transaction: Transaction | Uint8Array): Uint8Array;
24
+ }
25
+ /** Account wrapper that supports a rekeyed account */
26
+ export declare class SigningAccount implements Account {
27
+ private _account;
28
+ private _sender;
29
+ /**
30
+ * Algorand address of the sender
31
+ */
32
+ get addr(): Readonly<string>;
33
+ /**
34
+ * Secret key belonging to the signer
35
+ */
36
+ get sk(): Readonly<Uint8Array>;
37
+ /**
38
+ * Algorand account of the underlying signing account
39
+ */
40
+ get signer(): Account;
41
+ /**
42
+ * Algorand account of the sender address and signer private key
43
+ */
44
+ get sender(): Account;
45
+ constructor(account: Account, sender: string | undefined);
46
+ }
47
+ /** A wrapper around @see {TransactionSigner} that also has the sender address. */
48
+ export interface TransactionSignerAccount {
49
+ addr: Readonly<string>;
50
+ signer: TransactionSigner;
51
+ }
52
+ //# 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;IAEb,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;gBAEW,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE;IAM3F;;;;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,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,OAAO,CAEpB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAKpB;gBAEW,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS;CAIzD;AAED,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtB,MAAM,EAAE,iBAAiB,CAAA;CAC1B"}
@@ -0,0 +1,86 @@
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
+ constructor(multisigParams, signingAccounts) {
27
+ this._params = multisigParams;
28
+ this._signingAccounts = signingAccounts;
29
+ this._addr = algosdk_1.default.multisigAddress(multisigParams);
30
+ }
31
+ /**
32
+ * Sign the given transaction
33
+ * @param transaction Either a transaction object or a raw, partially signed transaction
34
+ * @returns The transaction signed by the present signers
35
+ */
36
+ sign(transaction) {
37
+ let signedTxn = 'from' in transaction ? undefined : transaction;
38
+ for (const signer of this._signingAccounts) {
39
+ if (signedTxn) {
40
+ signedTxn = algosdk_1.default.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob;
41
+ }
42
+ else {
43
+ signedTxn = algosdk_1.default.signMultisigTransaction(transaction, this._params, signer.sk).blob;
44
+ }
45
+ }
46
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
47
+ return signedTxn;
48
+ }
49
+ }
50
+ exports.MultisigAccount = MultisigAccount;
51
+ /** Account wrapper that supports a rekeyed account */
52
+ class SigningAccount {
53
+ /**
54
+ * Algorand address of the sender
55
+ */
56
+ get addr() {
57
+ return this._sender;
58
+ }
59
+ /**
60
+ * Secret key belonging to the signer
61
+ */
62
+ get sk() {
63
+ return this._account.sk;
64
+ }
65
+ /**
66
+ * Algorand account of the underlying signing account
67
+ */
68
+ get signer() {
69
+ return this._account;
70
+ }
71
+ /**
72
+ * Algorand account of the sender address and signer private key
73
+ */
74
+ get sender() {
75
+ return {
76
+ addr: this._sender,
77
+ sk: this._account.sk,
78
+ };
79
+ }
80
+ constructor(account, sender) {
81
+ this._account = account;
82
+ this._sender = sender ?? account.addr;
83
+ }
84
+ }
85
+ exports.SigningAccount = SigningAccount;
86
+ //# 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;AAE5C,sEAAsE;AACtE,MAAa,eAAe;IAK1B,8CAA8C;IAC9C,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,oDAAoD;IACpD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAC9B,CAAC;IAED,0CAA0C;IAC1C,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,YAAY,cAAgC,EAAE,eAA6C;QACzF,IAAI,CAAC,OAAO,GAAG,cAAc,CAAA;QAC7B,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;QACvC,IAAI,CAAC,KAAK,GAAG,iBAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAA;IACtD,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,WAAqC;QAC/C,IAAI,SAAS,GAAG,MAAM,IAAI,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAA;QAC/D,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;YAC1C,IAAI,SAAS,EAAE;gBACb,SAAS,GAAG,iBAAO,CAAC,6BAA6B,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAA;aAC3F;iBAAM;gBACL,SAAS,GAAG,iBAAO,CAAC,uBAAuB,CAAC,WAA0B,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAA;aACtG;SACF;QACD,oEAAoE;QACpE,OAAO,SAAU,CAAA;IACnB,CAAC;CACF;AA3CD,0CA2CC;AAED,sDAAsD;AACtD,MAAa,cAAc;IAIzB;;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,QAAQ,CAAA;IACtB,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;IACvC,CAAC;CACF;AAvCD,wCAuCC"}
@@ -0,0 +1,14 @@
1
+ import { BaseHTTPClientResponse, Query } from 'algosdk/dist/types/client/baseHTTPClient';
2
+ import { URLTokenBaseHTTPClient } from './urlTokenBaseHTTPClient';
3
+ /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
4
+ export declare class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {
5
+ private static readonly MAX_TRIES;
6
+ private static readonly MAX_BACKOFF_MS;
7
+ private static readonly RETRY_STATUS_CODES;
8
+ private static readonly RETRY_ERROR_CODES;
9
+ private callWithRetry;
10
+ get(relativePath: string, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
11
+ post(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
12
+ delete(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
13
+ }
14
+ //# sourceMappingURL=algo-http-client-with-retry.d.ts.map
@@ -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"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AlgoHttpClientWithRetry = void 0;
4
+ const __1 = require("../");
5
+ const urlTokenBaseHTTPClient_1 = require("./urlTokenBaseHTTPClient");
6
+ /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
7
+ class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient_1.URLTokenBaseHTTPClient {
8
+ async callWithRetry(func) {
9
+ let response;
10
+ let numTries = 1;
11
+ do {
12
+ try {
13
+ response = await func();
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ }
16
+ catch (err) {
17
+ if (numTries >= AlgoHttpClientWithRetry.MAX_TRIES) {
18
+ throw err;
19
+ }
20
+ // Only retry for one of the hardcoded conditions
21
+ if (!(AlgoHttpClientWithRetry.RETRY_ERROR_CODES.includes(err.code) || AlgoHttpClientWithRetry.RETRY_STATUS_CODES.includes(err.status))) {
22
+ throw err;
23
+ }
24
+ // Retry immediately the first time, then exponentially backoff.
25
+ const delayTimeMs = numTries == 1 ? 0 : Math.min(1000 * Math.pow(2, numTries - 1), AlgoHttpClientWithRetry.MAX_BACKOFF_MS);
26
+ if (delayTimeMs > 0) {
27
+ await new Promise((r) => setTimeout(r, delayTimeMs));
28
+ }
29
+ __1.Config.logger.warn(`algosdk request failed ${numTries} times. Retrying in ${delayTimeMs}ms: ${err}`);
30
+ }
31
+ } while (!response && ++numTries <= AlgoHttpClientWithRetry.MAX_TRIES);
32
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
33
+ return response;
34
+ }
35
+ async get(relativePath, query, requestHeaders = {}) {
36
+ return await this.callWithRetry(() => super.get(relativePath, query, requestHeaders));
37
+ }
38
+ async post(relativePath, data, query, requestHeaders = {}) {
39
+ return await this.callWithRetry(() => super.post(relativePath, data, query, requestHeaders));
40
+ }
41
+ async delete(relativePath, data, query, requestHeaders = {}) {
42
+ return await this.callWithRetry(() => super.delete(relativePath, data, query, requestHeaders));
43
+ }
44
+ }
45
+ exports.AlgoHttpClientWithRetry = AlgoHttpClientWithRetry;
46
+ AlgoHttpClientWithRetry.MAX_TRIES = 5;
47
+ AlgoHttpClientWithRetry.MAX_BACKOFF_MS = 10000;
48
+ // These lists come from https://visionmedia.github.io/superagent/#retrying-requests
49
+ // which is the underlying library used by algosdk - but the CloudFlare specific 52X status codes have been removed
50
+ AlgoHttpClientWithRetry.RETRY_STATUS_CODES = [408, 413, 429, 500, 502, 503, 504];
51
+ AlgoHttpClientWithRetry.RETRY_ERROR_CODES = [
52
+ 'ETIMEDOUT',
53
+ 'ECONNRESET',
54
+ 'EADDRINUSE',
55
+ 'ECONNREFUSED',
56
+ 'EPIPE',
57
+ 'ENOTFOUND',
58
+ 'ENETUNREACH',
59
+ 'EAI_AGAIN',
60
+ 'EPROTO', // We get this intermittently with AlgoNode API
61
+ ];
62
+ //# sourceMappingURL=algo-http-client-with-retry.js.map
@@ -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,CAA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