@algorandfoundation/algokit-utils 10.0.0-alpha.31 → 10.0.0-alpha.32

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 (318) hide show
  1. package/account-manager.d.ts +448 -0
  2. package/account-manager.js +623 -0
  3. package/account-manager.js.map +1 -0
  4. package/account-manager.mjs +620 -0
  5. package/account-manager.mjs.map +1 -0
  6. package/account.d.ts +156 -0
  7. package/account.js +10 -0
  8. package/account.js.map +1 -0
  9. package/account.mjs +9 -0
  10. package/account.mjs.map +1 -0
  11. package/algorand-client-transaction-creator.d.ts +1103 -0
  12. package/algorand-client-transaction-creator.js +735 -0
  13. package/algorand-client-transaction-creator.js.map +1 -0
  14. package/algorand-client-transaction-creator.mjs +734 -0
  15. package/algorand-client-transaction-creator.mjs.map +1 -0
  16. package/algorand-client-transaction-sender.d.ts +1317 -0
  17. package/algorand-client-transaction-sender.js +933 -0
  18. package/algorand-client-transaction-sender.js.map +1 -0
  19. package/algorand-client-transaction-sender.mjs +932 -0
  20. package/algorand-client-transaction-sender.mjs.map +1 -0
  21. package/algorand-client.d.ts +246 -0
  22. package/algorand-client.js +325 -0
  23. package/algorand-client.js.map +1 -0
  24. package/algorand-client.mjs +325 -0
  25. package/algorand-client.mjs.map +1 -0
  26. package/amount.d.ts +46 -3
  27. package/amount.js +92 -13
  28. package/amount.js.map +1 -1
  29. package/amount.mjs +80 -3
  30. package/amount.mjs.map +1 -1
  31. package/app-client.d.ts +2130 -0
  32. package/app-client.js +909 -0
  33. package/app-client.js.map +1 -0
  34. package/app-client.mjs +908 -0
  35. package/app-client.mjs.map +1 -0
  36. package/app-deployer.d.ts +166 -0
  37. package/app-deployer.js +353 -0
  38. package/app-deployer.js.map +1 -0
  39. package/app-deployer.mjs +353 -0
  40. package/app-deployer.mjs.map +1 -0
  41. package/app-factory.d.ts +965 -0
  42. package/app-factory.js +448 -0
  43. package/app-factory.js.map +1 -0
  44. package/app-factory.mjs +448 -0
  45. package/app-factory.mjs.map +1 -0
  46. package/app-manager.d.ts +323 -0
  47. package/app-manager.js +468 -0
  48. package/app-manager.js.map +1 -0
  49. package/app-manager.mjs +468 -0
  50. package/app-manager.mjs.map +1 -0
  51. package/app-spec.d.ts +203 -0
  52. package/app-spec.js +137 -0
  53. package/app-spec.js.map +1 -0
  54. package/app-spec.mjs +137 -0
  55. package/app-spec.mjs.map +1 -0
  56. package/app.d.ts +257 -0
  57. package/app.js +49 -0
  58. package/app.js.map +1 -0
  59. package/app.mjs +42 -0
  60. package/app.mjs.map +1 -0
  61. package/asset-manager.d.ts +212 -0
  62. package/asset-manager.js +166 -0
  63. package/asset-manager.js.map +1 -0
  64. package/asset-manager.mjs +166 -0
  65. package/asset-manager.mjs.map +1 -0
  66. package/async-event-emitter.d.ts +16 -0
  67. package/async-event-emitter.js +38 -0
  68. package/async-event-emitter.js.map +1 -0
  69. package/async-event-emitter.mjs +37 -0
  70. package/async-event-emitter.mjs.map +1 -0
  71. package/client-manager.d.ts +475 -0
  72. package/client-manager.js +616 -0
  73. package/client-manager.js.map +1 -0
  74. package/client-manager.mjs +616 -0
  75. package/client-manager.mjs.map +1 -0
  76. package/composer.d.ts +947 -0
  77. package/composer.js +1584 -0
  78. package/composer.js.map +1 -0
  79. package/composer.mjs +1583 -0
  80. package/composer.mjs.map +1 -0
  81. package/config.d.ts +1 -1
  82. package/config.js +2 -2
  83. package/config.js.map +1 -1
  84. package/config.mjs +1 -1
  85. package/config.mjs.map +1 -1
  86. package/debugging.d.ts +47 -0
  87. package/debugging.js +20 -0
  88. package/debugging.js.map +1 -0
  89. package/debugging.mjs +15 -0
  90. package/debugging.mjs.map +1 -0
  91. package/dispenser-client.d.ts +90 -0
  92. package/dispenser-client.js +127 -0
  93. package/dispenser-client.js.map +1 -0
  94. package/dispenser-client.mjs +127 -0
  95. package/dispenser-client.mjs.map +1 -0
  96. package/expand.d.ts +2 -0
  97. package/expand.js +0 -0
  98. package/expand.mjs +0 -0
  99. package/index.d.ts +6 -5
  100. package/index.js +4 -3
  101. package/index.mjs +5 -5
  102. package/indexer-client/indexer-lookup.d.ts +1 -1
  103. package/indexer-client/indexer-lookup.js.map +1 -1
  104. package/indexer-client/indexer-lookup.mjs.map +1 -1
  105. package/indexer.d.ts +40 -0
  106. package/indexer.js +38 -0
  107. package/indexer.js.map +1 -0
  108. package/indexer.mjs +35 -0
  109. package/indexer.mjs.map +1 -0
  110. package/instance-of.d.ts +8 -0
  111. package/kmd-account-manager.d.ts +74 -0
  112. package/kmd-account-manager.js +167 -0
  113. package/kmd-account-manager.js.map +1 -0
  114. package/kmd-account-manager.mjs +165 -0
  115. package/kmd-account-manager.mjs.map +1 -0
  116. package/lifecycle-events.d.ts +14 -0
  117. package/lifecycle-events.js +11 -0
  118. package/lifecycle-events.js.map +1 -0
  119. package/lifecycle-events.mjs +10 -0
  120. package/lifecycle-events.mjs.map +1 -0
  121. package/logging.d.ts +13 -0
  122. package/logging.js +47 -0
  123. package/logging.js.map +1 -0
  124. package/logging.mjs +42 -0
  125. package/logging.mjs.map +1 -0
  126. package/logic-error.d.ts +39 -0
  127. package/logic-error.js +54 -0
  128. package/logic-error.js.map +1 -0
  129. package/logic-error.mjs +53 -0
  130. package/logic-error.mjs.map +1 -0
  131. package/network-client.d.ts +43 -0
  132. package/network-client.js +14 -0
  133. package/network-client.js.map +1 -0
  134. package/network-client.mjs +13 -0
  135. package/network-client.mjs.map +1 -0
  136. package/package.json +11 -1
  137. package/testing/account.d.ts +2 -2
  138. package/testing/account.js +1 -1
  139. package/testing/account.js.map +1 -1
  140. package/testing/account.mjs +1 -1
  141. package/testing/account.mjs.map +1 -1
  142. package/testing/fixtures/algokit-log-capture-fixture.d.ts +1 -1
  143. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  144. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  145. package/testing/fixtures/algorand-fixture.d.ts +2 -2
  146. package/testing/fixtures/algorand-fixture.js +2 -2
  147. package/testing/fixtures/algorand-fixture.js.map +1 -1
  148. package/testing/fixtures/algorand-fixture.mjs +2 -2
  149. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  150. package/testing/index.d.ts +2 -1
  151. package/testing/test-logger.d.ts +1 -1
  152. package/testing/test-logger.js.map +1 -1
  153. package/testing/test-logger.mjs.map +1 -1
  154. package/testing/types.d.ts +156 -0
  155. package/transaction/index.d.ts +4 -0
  156. package/transaction/index.js +9 -0
  157. package/transaction/index.mjs +4 -0
  158. package/transaction/perform-transaction-composer-simulate.d.ts +1 -1
  159. package/transaction/perform-transaction-composer-simulate.js.map +1 -1
  160. package/transaction/perform-transaction-composer-simulate.mjs.map +1 -1
  161. package/transaction/transaction.d.ts +2 -2
  162. package/transaction/transaction.js.map +1 -1
  163. package/transaction/transaction.mjs.map +1 -1
  164. package/transaction/types.d.ts +133 -0
  165. package/transactions/app-call.d.ts +1 -1
  166. package/transactions/app-call.js +1 -1
  167. package/transactions/app-call.js.map +1 -1
  168. package/transactions/app-call.mjs +1 -1
  169. package/transactions/app-call.mjs.map +1 -1
  170. package/transactions/common.d.ts +1 -1
  171. package/transactions/common.js.map +1 -1
  172. package/transactions/common.mjs.map +1 -1
  173. package/transactions/method-call.d.ts +1 -1
  174. package/transactions/method-call.js +1 -1
  175. package/transactions/method-call.js.map +1 -1
  176. package/transactions/method-call.mjs +1 -1
  177. package/transactions/method-call.mjs.map +1 -1
  178. package/transactions/payment.d.ts +1 -1
  179. package/transactions/payment.js.map +1 -1
  180. package/transactions/payment.mjs.map +1 -1
  181. package/types/account-manager.d.ts +11 -442
  182. package/types/account-manager.js +5 -616
  183. package/types/account-manager.js.map +1 -1
  184. package/types/account-manager.mjs +5 -614
  185. package/types/account-manager.mjs.map +1 -1
  186. package/types/account.d.ts +8 -150
  187. package/types/account.js +3 -4
  188. package/types/account.js.map +1 -1
  189. package/types/account.mjs +4 -4
  190. package/types/account.mjs.map +1 -1
  191. package/types/algorand-client-transaction-creator.d.ts +5 -1098
  192. package/types/algorand-client-transaction-creator.js +3 -729
  193. package/types/algorand-client-transaction-creator.js.map +1 -1
  194. package/types/algorand-client-transaction-creator.mjs +4 -729
  195. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  196. package/types/algorand-client-transaction-sender.d.ts +5 -1312
  197. package/types/algorand-client-transaction-sender.js +3 -927
  198. package/types/algorand-client-transaction-sender.js.map +1 -1
  199. package/types/algorand-client-transaction-sender.mjs +3 -926
  200. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  201. package/types/algorand-client.d.ts +5 -241
  202. package/types/algorand-client.js +3 -319
  203. package/types/algorand-client.js.map +1 -1
  204. package/types/algorand-client.mjs +3 -319
  205. package/types/algorand-client.mjs.map +1 -1
  206. package/types/amount.d.ts +6 -45
  207. package/types/amount.js +3 -79
  208. package/types/amount.js.map +1 -1
  209. package/types/amount.mjs +4 -79
  210. package/types/amount.mjs.map +1 -1
  211. package/types/app-client.d.ts +75 -2125
  212. package/types/app-client.js +3 -903
  213. package/types/app-client.js.map +1 -1
  214. package/types/app-client.mjs +3 -902
  215. package/types/app-client.mjs.map +1 -1
  216. package/types/app-deployer.d.ts +21 -161
  217. package/types/app-deployer.js +3 -347
  218. package/types/app-deployer.js.map +1 -1
  219. package/types/app-deployer.mjs +3 -347
  220. package/types/app-deployer.mjs.map +1 -1
  221. package/types/app-factory.d.ts +21 -960
  222. package/types/app-factory.js +3 -442
  223. package/types/app-factory.js.map +1 -1
  224. package/types/app-factory.mjs +3 -442
  225. package/types/app-factory.mjs.map +1 -1
  226. package/types/app-manager.d.ts +15 -318
  227. package/types/app-manager.js +3 -462
  228. package/types/app-manager.js.map +1 -1
  229. package/types/app-manager.mjs +3 -462
  230. package/types/app-manager.mjs.map +1 -1
  231. package/types/app-spec.d.ts +39 -198
  232. package/types/app-spec.js +3 -131
  233. package/types/app-spec.js.map +1 -1
  234. package/types/app-spec.mjs +3 -131
  235. package/types/app-spec.mjs.map +1 -1
  236. package/types/app.d.ts +62 -247
  237. package/types/app.js +15 -37
  238. package/types/app.js.map +1 -1
  239. package/types/app.mjs +16 -37
  240. package/types/app.mjs.map +1 -1
  241. package/types/asset-manager.d.ts +9 -207
  242. package/types/asset-manager.js +3 -160
  243. package/types/asset-manager.js.map +1 -1
  244. package/types/asset-manager.mjs +3 -160
  245. package/types/asset-manager.mjs.map +1 -1
  246. package/types/async-event-emitter.d.ts +7 -11
  247. package/types/async-event-emitter.js +3 -32
  248. package/types/async-event-emitter.js.map +1 -1
  249. package/types/async-event-emitter.mjs +4 -32
  250. package/types/async-event-emitter.mjs.map +1 -1
  251. package/types/client-manager.d.ts +27 -470
  252. package/types/client-manager.js +3 -610
  253. package/types/client-manager.js.map +1 -1
  254. package/types/client-manager.mjs +3 -610
  255. package/types/client-manager.mjs.map +1 -1
  256. package/types/composer.d.ts +79 -943
  257. package/types/composer.js +3 -1578
  258. package/types/composer.js.map +1 -1
  259. package/types/composer.mjs +3 -1577
  260. package/types/composer.mjs.map +1 -1
  261. package/types/config.d.ts +7 -52
  262. package/types/config.js +3 -74
  263. package/types/config.js.map +1 -1
  264. package/types/config.mjs +3 -74
  265. package/types/config.mjs.map +1 -1
  266. package/types/debugging.d.ts +12 -37
  267. package/types/debugging.js +11 -10
  268. package/types/debugging.js.map +1 -1
  269. package/types/debugging.mjs +12 -10
  270. package/types/debugging.mjs.map +1 -1
  271. package/types/dispenser-client.d.ts +11 -85
  272. package/types/dispenser-client.js +3 -121
  273. package/types/dispenser-client.js.map +1 -1
  274. package/types/dispenser-client.mjs +3 -121
  275. package/types/dispenser-client.mjs.map +1 -1
  276. package/types/expand.d.ts +8 -2
  277. package/types/indexer.d.ts +16 -36
  278. package/types/indexer.js +7 -30
  279. package/types/indexer.js.map +1 -1
  280. package/types/indexer.mjs +8 -30
  281. package/types/indexer.mjs.map +1 -1
  282. package/types/instance-of.d.ts +4 -4
  283. package/types/kmd-account-manager.d.ts +5 -69
  284. package/types/kmd-account-manager.js +3 -161
  285. package/types/kmd-account-manager.js.map +1 -1
  286. package/types/kmd-account-manager.mjs +3 -159
  287. package/types/kmd-account-manager.mjs.map +1 -1
  288. package/types/lifecycle-events.d.ts +7 -9
  289. package/types/lifecycle-events.js +3 -5
  290. package/types/lifecycle-events.js.map +1 -1
  291. package/types/lifecycle-events.mjs +4 -5
  292. package/types/lifecycle-events.mjs.map +1 -1
  293. package/types/logging.d.ts +14 -9
  294. package/types/logging.js +11 -37
  295. package/types/logging.js.map +1 -1
  296. package/types/logging.mjs +12 -37
  297. package/types/logging.mjs.map +1 -1
  298. package/types/logic-error.d.ts +8 -35
  299. package/types/logic-error.js +3 -48
  300. package/types/logic-error.js.map +1 -1
  301. package/types/logic-error.mjs +4 -48
  302. package/types/logic-error.mjs.map +1 -1
  303. package/types/network-client.d.ts +10 -39
  304. package/types/network-client.js +3 -8
  305. package/types/network-client.js.map +1 -1
  306. package/types/network-client.mjs +4 -8
  307. package/types/network-client.mjs.map +1 -1
  308. package/types/testing.d.ts +13 -151
  309. package/types/transaction.d.ts +33 -128
  310. package/updatable-config.d.ts +57 -0
  311. package/updatable-config.js +80 -0
  312. package/updatable-config.js.map +1 -0
  313. package/updatable-config.mjs +80 -0
  314. package/updatable-config.mjs.map +1 -0
  315. package/util.js +1 -1
  316. package/util.js.map +1 -1
  317. package/util.mjs +1 -1
  318. package/util.mjs.map +1 -1
@@ -0,0 +1,448 @@
1
+ import { Address, ReadableAddress } from "./packages/common/src/address.js";
2
+ import { MultisigAccount, MultisigMetadata } from "./packages/transact/src/multisig.js";
3
+ import { DelegatedLsigSigner, LogicSigAccount, ProgramDataSigner } from "./packages/transact/src/logicsig.js";
4
+ import { AddressWithSigners, AddressWithTransactionSigner, MxBytesSigner, TransactionSigner } from "./packages/transact/src/signer.js";
5
+ import { AlgoAmount } from "./amount.js";
6
+ import { AccountInformation } from "./account.js";
7
+ import { SendParams, SendSingleTransactionResult } from "./transaction/types.js";
8
+ import { CommonTransactionParams } from "./transactions/common.js";
9
+ import { TestNetDispenserApiClient } from "./dispenser-client.js";
10
+ import { ClientManager } from "./client-manager.js";
11
+ import { KmdAccountManager } from "./kmd-account-manager.js";
12
+
13
+ //#region src/account-manager.d.ts
14
+ /** Result from performing an ensureFunded call. */
15
+ interface EnsureFundedResult {
16
+ /** The transaction ID of the transaction that funded the account. */
17
+ transactionId: string;
18
+ /** The amount that was sent to the account. */
19
+ amountFunded: AlgoAmount;
20
+ }
21
+ /**
22
+ * Returns a `TransactionSigner` for the given account that can sign a transaction.
23
+ * This function has memoization, so will return the same transaction signer for a given account.
24
+ * @param account An account that can sign a transaction
25
+ * @returns A transaction signer
26
+ * @example
27
+ * ```typescript
28
+ * const signer = getAccountTransactionSigner(account)
29
+ * ```
30
+ */
31
+ declare const getAccountTransactionSigner: (val: AddressWithTransactionSigner | LogicSigAccount | MultisigAccount) => TransactionSigner;
32
+ /** Creates and keeps track of signing accounts that can sign transactions for a sending address. */
33
+ declare class AccountManager {
34
+ private _clientManager;
35
+ private _kmdAccountManager;
36
+ private _accounts;
37
+ private _defaultSigner?;
38
+ /**
39
+ * Create a new account manager.
40
+ * @param clientManager The ClientManager client to use for algod and kmd clients
41
+ * @example Create a new account manager
42
+ * ```typescript
43
+ * const accountManager = new AccountManager(clientManager)
44
+ * ```
45
+ */
46
+ constructor(clientManager: ClientManager);
47
+ private _getComposer;
48
+ /**
49
+ * KMD account manager that allows you to easily get and create accounts using KMD.
50
+ * @returns The `KmdAccountManager` instance.
51
+ * @example
52
+ * ```typescript
53
+ * const kmdManager = accountManager.kmd;
54
+ * ```
55
+ */
56
+ get kmd(): KmdAccountManager;
57
+ /**
58
+ * Sets the default signer to use if no other signer is specified.
59
+ *
60
+ * If this isn't set an a transaction needs signing for a given sender
61
+ * then an error will be thrown from `getSigner` / `getAccount`.
62
+ * @param signer The signer to use, either a `TransactionSigner` or a `AddressWithSigner`
63
+ * @example
64
+ * ```typescript
65
+ * const signer = accountManager.random() // Can be anything that returns a `TransactionSigner` or `AddressWithSigner`
66
+ * accountManager.setDefaultSigner(signer)
67
+ *
68
+ * // When signing a transaction, if there is no signer registered for the sender then the default signer will be used
69
+ * const signer = accountManager.getSigner("SENDERADDRESS")
70
+ * ```
71
+ * @returns The `AccountManager` so method calls can be chained
72
+ */
73
+ setDefaultSigner(signer: TransactionSigner | AddressWithTransactionSigner): AccountManager;
74
+ /**
75
+ * Records the given account (that can sign) against the address of the provided account for later
76
+ * retrieval and returns a `AddressWithTransactionSigner` along with the original account in an `account` property.
77
+ */
78
+ private signerAccount;
79
+ /**
80
+ * Tracks the given account for later signing.
81
+ *
82
+ * Note: If you are generating accounts via the various methods on `AccountManager`
83
+ * (like `random`, `fromMnemonic`, `logicsig`, etc.) then they automatically get tracked.
84
+ * @param account The account to register, which can be a `AddressWithSigner` or
85
+ * a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount`
86
+ * @example
87
+ * ```typescript
88
+ * const accountManager = new AccountManager(clientManager)
89
+ * .setSignerFromAccount(algosdk.generateAccount())
90
+ * .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
91
+ * .setSignerFromAccount(new SigningAccount(mnemonic, sender))
92
+ * .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
93
+ * .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
94
+ * ```
95
+ * @returns The `AccountManager` instance for method chaining
96
+ */
97
+ setSignerFromAccount(account: AddressWithTransactionSigner | LogicSigAccount | MultisigAccount): this;
98
+ /**
99
+ * Tracks the given `TransactionSigner` against the given sender address for later signing.
100
+ * @param sender The sender address to use this signer for
101
+ * @param signer The `TransactionSigner` to sign transactions with for the given sender
102
+ * @example
103
+ * ```typescript
104
+ * const accountManager = new AccountManager(clientManager)
105
+ * .setSigner("SENDERADDRESS", transactionSigner)
106
+ * ```
107
+ * @returns The `AccountManager` instance for method chaining
108
+ */
109
+ setSigner(sender: string | Address, signer: TransactionSigner): this;
110
+ /**
111
+ * Takes all registered signers from the given `AccountManager` and adds them to this `AccountManager`.
112
+ *
113
+ * This is useful for situations where you have multiple contexts you are building accounts in such as unit tests.
114
+ * @param anotherAccountManager Another account manager with signers registered
115
+ * @param overwriteExisting Whether or not to overwrite any signers that have the same sender address with the ones in the other account manager or not (default: true)
116
+ * @returns The `AccountManager` instance for method chaining
117
+ * @example
118
+ * ```typescript
119
+ * accountManager2.setSigners(accountManager1);
120
+ * ```
121
+ */
122
+ setSigners(anotherAccountManager: AccountManager, overwriteExisting?: boolean): this;
123
+ /**
124
+ * Returns the `TransactionSigner` for the given sender address, ready to sign a transaction for that sender.
125
+ *
126
+ * If no signer has been registered for that address then the default signer is used if registered and
127
+ * if not then an error is thrown.
128
+ *
129
+ * @param sender The sender address
130
+ * @example
131
+ * ```typescript
132
+ * const signer = accountManager.getSigner("SENDERADDRESS")
133
+ * ```
134
+ * @returns The `TransactionSigner` or throws an error if not found and no default signer is set
135
+ */
136
+ getSigner(sender: ReadableAddress): TransactionSigner;
137
+ /**
138
+ * Returns the `AddressWithSigner` for the given sender address.
139
+ *
140
+ * If no signer has been registered for that address then an error is thrown.
141
+ * @param sender The sender address
142
+ * @example
143
+ * ```typescript
144
+ * const sender = accountManager.random()
145
+ * // ...
146
+ * // Returns the `AddressWithSigner` for `sender` that has previously been registered
147
+ * const account = accountManager.getAccount(sender)
148
+ * ```
149
+ * @returns The `AddressWithSigner` or throws an error if not found
150
+ */
151
+ getAccount(sender: ReadableAddress): AddressWithTransactionSigner;
152
+ /**
153
+ * Returns the given sender account's current status, balance and spendable amounts.
154
+ *
155
+ * [Response data schema details](https://dev.algorand.co/reference/rest-apis/algod/#accountinformation)
156
+ * @example
157
+ * ```typescript
158
+ * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
159
+ * const accountInfo = await accountManager.getInformation(address);
160
+ * ```
161
+ *
162
+ * @param sender The account / address to look up
163
+ * @returns The account information
164
+ */
165
+ getInformation(sender: ReadableAddress): Promise<AccountInformation>;
166
+ /**
167
+ * Tracks and returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const account = accountManager.fromMnemonic("mnemonic secret ...")
172
+ * const rekeyedAccount = accountManager.fromMnemonic("mnemonic secret ...", "SENDERADDRESS...")
173
+ * ```
174
+ * @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
175
+ * never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
176
+ * @param sender The optional sender address to use this signer for (aka a rekeyed account)
177
+ * @returns The account
178
+ */
179
+ fromMnemonic(mnemonicSecret: string, sender?: string | Address): AddressWithTransactionSigner;
180
+ /**
181
+ * Tracks and returns an Algorand account that is a rekeyed version of the given account to a new sender.
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * const account = accountManager.fromMnemonic("mnemonic secret ...")
186
+ * const rekeyedAccount = accountManager.rekeyed(account, "SENDERADDRESS...")
187
+ * ```
188
+ * @param account The account to use as the signer for this new rekeyed account
189
+ * @param sender The sender address to use as the new sender
190
+ * @returns The account
191
+ */
192
+ rekeyed(sender: string | Address, account: AddressWithTransactionSigner): Address & AddressWithTransactionSigner & {
193
+ account: {
194
+ addr: Address;
195
+ signer: TransactionSigner;
196
+ };
197
+ };
198
+ /**
199
+ * Tracks and returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
200
+ *
201
+ * Note: This function expects to run in a Node.js environment.
202
+ *
203
+ * ## Convention:
204
+ * * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
205
+ * never commit it into source control and ideally load it via a secret storage service rather than the file system.
206
+ * If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
207
+ * * **LocalNet:** will load the account from a KMD wallet called \{NAME\} and if that wallet doesn't exist it will create it and fund the account for you
208
+ *
209
+ * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).
210
+ *
211
+ * @example Default
212
+ *
213
+ * If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
214
+ * ```typescript
215
+ * const account = await accountManager.fromEnvironment('MY_ACCOUNT')
216
+ * ```
217
+ *
218
+ * If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
219
+ * If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.
220
+ *
221
+ * @param name The name identifier of the account
222
+ * @param fundWith The optional amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
223
+ * @returns The account
224
+ */
225
+ fromEnvironment(name: string, fundWith?: AlgoAmount): Promise<AddressWithTransactionSigner>;
226
+ /**
227
+ * Tracks and returns an Algorand account with private key loaded from the given KMD wallet (identified by name).
228
+ *
229
+ * @param name The name of the wallet to retrieve an account from
230
+ * @param predicate An optional filter to use to find the account (otherwise it will return a random account from the wallet)
231
+ * @param sender The optional sender address to use this signer for (aka a rekeyed account)
232
+ * @example Get default funded account in a LocalNet
233
+ *
234
+ * ```typescript
235
+ * const defaultDispenserAccount = await accountManager.fromKmd('unencrypted-default-wallet',
236
+ * a => a.status !== 'Offline' && a.amount > 1_000_000_000
237
+ * )
238
+ * ```
239
+ * @returns The account
240
+ */
241
+ fromKmd(name: string, predicate?: (account: Record<string, any>) => boolean, sender?: string | Address): Promise<Address & AddressWithTransactionSigner & {
242
+ account: AddressWithTransactionSigner;
243
+ }>;
244
+ /**
245
+ * Tracks and returns an account that supports partial or full multisig signing.
246
+ *
247
+ * @example
248
+ * ```typescript
249
+ * const account = accountManager.multisig({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]},
250
+ * [(await accountManager.fromEnvironment('ACCOUNT1')).account])
251
+ * ```
252
+ * @param multisigParams The parameters that define the multisig account
253
+ * @param subSigners The signers that are currently present
254
+ * @returns A multisig account wrapper
255
+ */
256
+ multisig(multisigParams: MultisigMetadata, subSigners: AddressWithSigners[]): Address & AddressWithTransactionSigner & {
257
+ account: MultisigAccount;
258
+ };
259
+ /**
260
+ * Tracks and returns an account that represents a logic signature.
261
+ *
262
+ * @example
263
+ * ```typescript
264
+ * const account = accountManager.logicsig(program, [new Uint8Array(3, ...)])
265
+ * ```
266
+ * @param program The bytes that make up the compiled logic signature
267
+ * @param args The (binary) arguments to pass into the logic signature
268
+ * @returns A logic signature account wrapper
269
+ */
270
+ logicsig(program: Uint8Array, args?: Array<Uint8Array>): Address & AddressWithTransactionSigner & {
271
+ account: LogicSigAccount;
272
+ };
273
+ /**
274
+ * Tracks and returns a new, random Algorand account with secret key loaded.
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * const account = accountManager.random()
279
+ * ```
280
+ * @returns The account
281
+ */
282
+ random(): Address & {
283
+ addr: Readonly<Address>;
284
+ signer: TransactionSigner;
285
+ lsigSigner: DelegatedLsigSigner;
286
+ programDataSigner: ProgramDataSigner;
287
+ mxBytesSigner: MxBytesSigner;
288
+ };
289
+ /**
290
+ * Returns an account (with private key loaded) that can act as a dispenser from
291
+ * environment variables, or against default LocalNet if no environment variables present.
292
+ *
293
+ * Note: requires a Node.js environment to execute.
294
+ *
295
+ * If present, it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC and optionally
296
+ * process.env.DISPENSER_SENDER if it's a rekeyed account.
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * const account = await accountManager.dispenserFromEnvironment()
301
+ * ```
302
+ *
303
+ * @returns The account
304
+ */
305
+ dispenserFromEnvironment(): Promise<AddressWithTransactionSigner>;
306
+ /**
307
+ * Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * const account = await accountManager.localNetDispenser()
312
+ * ```
313
+ * @returns The account
314
+ */
315
+ localNetDispenser(): Promise<Address & AddressWithTransactionSigner & {
316
+ account: AddressWithTransactionSigner;
317
+ }>;
318
+ /**
319
+ * Rekey an account to a new address.
320
+ *
321
+ * **Note:** Please be careful with this function and be sure to read the [official rekey guidance](https://dev.algorand.co/concepts/accounts/rekeying).
322
+ *
323
+ * @param account The account to rekey
324
+ * @param rekeyTo The account address or signing account of the account that will be used to authorise transactions for the rekeyed account going forward.
325
+ * If a signing account is provided that will now be tracked as the signer for `account` in this `AccountManager`
326
+ * @param options Any parameters to control the transaction or execution of the transaction
327
+ *
328
+ * @example Basic example (with string addresses)
329
+ * ```typescript
330
+ * await accountManager.rekeyAccount({account: "ACCOUNTADDRESS", rekeyTo: "NEWADDRESS"})
331
+ * ```
332
+ * @example Basic example (with signer accounts)
333
+ * ```typescript
334
+ * await accountManager.rekeyAccount({account: account1, rekeyTo: newSignerAccount})
335
+ * ```
336
+ * @example Advanced example
337
+ * ```typescript
338
+ * await accountManager.rekeyAccount({
339
+ * account: "ACCOUNTADDRESS",
340
+ * rekeyTo: "NEWADDRESS",
341
+ * lease: 'lease',
342
+ * note: 'note',
343
+ * firstValidRound: 1000n,
344
+ * validityWindow: 10,
345
+ * extraFee: (1000).microAlgo(),
346
+ * staticFee: (1000).microAlgo(),
347
+ * // Max fee doesn't make sense with extraFee AND staticFee
348
+ * // already specified, but here for completeness
349
+ * maxFee: (3000).microAlgo(),
350
+ * maxRoundsToWaitForConfirmation: 5,
351
+ * suppressLog: true,
352
+ * })
353
+ * ```
354
+ * @returns The result of the transaction and the transaction that was sent
355
+ */
356
+ rekeyAccount(account: string | Address, rekeyTo: string | Address | AddressWithTransactionSigner, options?: Omit<CommonTransactionParams, 'sender'> & SendParams): Promise<SendSingleTransactionResult>;
357
+ private _getEnsureFundedAmount;
358
+ /**
359
+ * Funds a given account using a dispenser account as a funding source such that
360
+ * the given account has a certain amount of Algo free to spend (accounting for
361
+ * Algo locked in minimum balance requirement).
362
+ *
363
+ * https://dev.algorand.co/concepts/smart-contracts/costs-constraints#mbr
364
+ *
365
+ * @param accountToFund The account to fund
366
+ * @param dispenserAccount The account to use as a dispenser funding source
367
+ * @param minSpendingBalance The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement)
368
+ * @param options Optional parameters to control the funding increment, transaction or execution of the transaction
369
+ * @example Example using AlgorandClient
370
+ * ```typescript
371
+ * // Basic example
372
+ * await accountManager.ensureFunded("ACCOUNTADDRESS", "DISPENSERADDRESS", algokit.algo(1))
373
+ * // With configuration
374
+ * await accountManager.ensureFunded("ACCOUNTADDRESS", "DISPENSERADDRESS", algokit.algo(1),
375
+ * { minFundingIncrement: algokit.algo(2), fee: (1000).microAlgo(), suppressLog: true }
376
+ * )
377
+ * ```
378
+ * @returns
379
+ * - The result of executing the dispensing transaction and the `amountFunded` if funds were needed.
380
+ * - `undefined` if no funds were needed.
381
+ */
382
+ ensureFunded(accountToFund: string | Address, dispenserAccount: string | Address, minSpendingBalance: AlgoAmount, options?: {
383
+ minFundingIncrement?: AlgoAmount;
384
+ } & SendParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
385
+ /**
386
+ * Funds a given account using a dispenser account retrieved from the environment,
387
+ * per the `dispenserFromEnvironment` method, as a funding source such that
388
+ * the given account has a certain amount of Algo free to spend (accounting for
389
+ * Algo locked in minimum balance requirement).
390
+ *
391
+ * **Note:** requires a Node.js environment to execute.
392
+ *
393
+ * The dispenser account is retrieved from the account mnemonic stored in
394
+ * process.env.DISPENSER_MNEMONIC and optionally process.env.DISPENSER_SENDER
395
+ * if it's a rekeyed account, or against default LocalNet if no environment variables present.
396
+ *
397
+ * https://dev.algorand.co/concepts/smart-contracts/costs-constraints#mbr
398
+ *
399
+ * @param accountToFund The account to fund
400
+ * @param minSpendingBalance The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement)
401
+ * @param options Optional parameters to control the funding increment, transaction or execution of the transaction
402
+ * @example Example using AlgorandClient
403
+ * ```typescript
404
+ * // Basic example
405
+ * await accountManager.ensureFundedFromEnvironment("ACCOUNTADDRESS", algokit.algo(1))
406
+ * // With configuration
407
+ * await accountManager.ensureFundedFromEnvironment("ACCOUNTADDRESS", algokit.algo(1),
408
+ * { minFundingIncrement: algokit.algo(2), fee: (1000).microAlgo(), suppressLog: true }
409
+ * )
410
+ * ```
411
+ * @returns
412
+ * - The result of executing the dispensing transaction and the `amountFunded` if funds were needed.
413
+ * - `undefined` if no funds were needed.
414
+ */
415
+ ensureFundedFromEnvironment(accountToFund: string | Address, minSpendingBalance: AlgoAmount, options?: {
416
+ minFundingIncrement?: AlgoAmount;
417
+ } & SendParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
418
+ /**
419
+ * Funds a given account using the TestNet Dispenser API as a funding source such that
420
+ * the account has a certain amount of Algo free to spend (accounting for Algo locked
421
+ * in minimum balance requirement).
422
+ *
423
+ * https://dev.algorand.co/concepts/smart-contracts/costs-constraints#mbr
424
+ *
425
+ * @param accountToFund The account to fund
426
+ * @param dispenserClient The TestNet dispenser funding client
427
+ * @param minSpendingBalance The minimum balance of Algo that the account should have available to spend (i.e. on top of minimum balance requirement)
428
+ * @param options Optional parameters to control the funding increment, transaction or execution of the transaction
429
+ * @example Example using AlgorandClient
430
+ * ```typescript
431
+ * // Basic example
432
+ * await accountManager.ensureFundedFromTestNetDispenserApi("ACCOUNTADDRESS", algorand.client.getTestNetDispenserFromEnvironment(), algokit.algo(1))
433
+ * // With configuration
434
+ * await accountManager.ensureFundedFromTestNetDispenserApi("ACCOUNTADDRESS", algorand.client.getTestNetDispenserFromEnvironment(), algokit.algo(1),
435
+ * { minFundingIncrement: algokit.algo(2) }
436
+ * )
437
+ * ```
438
+ * @returns
439
+ * - The result of executing the dispensing transaction and the `amountFunded` if funds were needed.
440
+ * - `undefined` if no funds were needed.
441
+ */
442
+ ensureFundedFromTestNetDispenserApi(accountToFund: string | Address, dispenserClient: TestNetDispenserApiClient, minSpendingBalance: AlgoAmount, options?: {
443
+ minFundingIncrement?: AlgoAmount;
444
+ }): Promise<EnsureFundedResult | undefined>;
445
+ }
446
+ //#endregion
447
+ export { AccountManager, EnsureFundedResult, getAccountTransactionSigner };
448
+ //# sourceMappingURL=account-manager.d.ts.map