@algorandfoundation/algokit-utils 2.3.3-beta.3 → 2.3.3-beta.5

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 (340) hide show
  1. package/cjs/account.d.ts.map +1 -0
  2. package/cjs/account.js.map +1 -0
  3. package/cjs/amount.d.ts.map +1 -0
  4. package/cjs/amount.js.map +1 -0
  5. package/cjs/app-client.d.ts.map +1 -0
  6. package/cjs/app-client.js.map +1 -0
  7. package/cjs/app-deploy.d.ts.map +1 -0
  8. package/cjs/app-deploy.js.map +1 -0
  9. package/cjs/app.d.ts.map +1 -0
  10. package/cjs/app.js.map +1 -0
  11. package/cjs/index.d.ts.map +1 -0
  12. package/cjs/index.js.map +1 -0
  13. package/cjs/indexer-lookup.d.ts.map +1 -0
  14. package/cjs/indexer-lookup.js.map +1 -0
  15. package/cjs/localnet.d.ts.map +1 -0
  16. package/{localnet.js → cjs/localnet.js} +1 -1
  17. package/cjs/localnet.js.map +1 -0
  18. package/cjs/network-client.d.ts.map +1 -0
  19. package/cjs/network-client.js.map +1 -0
  20. package/cjs/testing/account.d.ts.map +1 -0
  21. package/cjs/testing/account.js.map +1 -0
  22. package/cjs/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  23. package/cjs/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  24. package/cjs/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  25. package/cjs/testing/fixtures/algorand-fixture.js.map +1 -0
  26. package/cjs/testing/fixtures/index.d.ts.map +1 -0
  27. package/cjs/testing/fixtures/index.js.map +1 -0
  28. package/cjs/testing/index.d.ts.map +1 -0
  29. package/cjs/testing/index.js.map +1 -0
  30. package/cjs/testing/indexer.d.ts.map +1 -0
  31. package/cjs/testing/indexer.js.map +1 -0
  32. package/cjs/testing/test-logger.d.ts.map +1 -0
  33. package/{testing → cjs/testing}/test-logger.js +2 -0
  34. package/cjs/testing/test-logger.js.map +1 -0
  35. package/cjs/testing/transaction-logger.d.ts.map +1 -0
  36. package/{testing → cjs/testing}/transaction-logger.js +2 -3
  37. package/cjs/testing/transaction-logger.js.map +1 -0
  38. package/cjs/transaction.d.ts.map +1 -0
  39. package/cjs/transaction.js.map +1 -0
  40. package/cjs/transfer.d.ts.map +1 -0
  41. package/cjs/transfer.js.map +1 -0
  42. package/cjs/types/account.d.ts +66 -0
  43. package/cjs/types/account.d.ts.map +1 -0
  44. package/{types → cjs/types}/account.js +7 -0
  45. package/cjs/types/account.js.map +1 -0
  46. package/cjs/types/algo-http-client-with-retry.d.ts.map +1 -0
  47. package/{types → cjs/types}/algo-http-client-with-retry.js +16 -16
  48. package/cjs/types/algo-http-client-with-retry.js.map +1 -0
  49. package/cjs/types/amount.d.ts +24 -0
  50. package/cjs/types/amount.d.ts.map +1 -0
  51. package/{types → cjs/types}/amount.js +1 -0
  52. package/cjs/types/amount.js.map +1 -0
  53. package/cjs/types/app-client.d.ts +408 -0
  54. package/cjs/types/app-client.d.ts.map +1 -0
  55. package/{types → cjs/types}/app-client.js +13 -0
  56. package/cjs/types/app-client.js.map +1 -0
  57. package/cjs/types/app-spec.d.ts.map +1 -0
  58. package/{types → cjs/types}/app-spec.js.map +1 -1
  59. package/cjs/types/app.d.ts +308 -0
  60. package/cjs/types/app.d.ts.map +1 -0
  61. package/cjs/types/app.js.map +1 -0
  62. package/cjs/types/config.d.ts.map +1 -0
  63. package/{types → cjs/types}/config.js +1 -0
  64. package/cjs/types/config.js.map +1 -0
  65. package/cjs/types/indexer.d.ts.map +1 -0
  66. package/cjs/types/indexer.js.map +1 -0
  67. package/cjs/types/logging.d.ts.map +1 -0
  68. package/cjs/types/logging.js.map +1 -0
  69. package/cjs/types/logic-error.d.ts.map +1 -0
  70. package/{types → cjs/types}/logic-error.js +5 -2
  71. package/cjs/types/logic-error.js.map +1 -0
  72. package/cjs/types/network-client.d.ts +20 -0
  73. package/cjs/types/network-client.d.ts.map +1 -0
  74. package/cjs/types/network-client.js.map +1 -0
  75. package/cjs/types/testing.d.ts.map +1 -0
  76. package/{types → cjs/types}/testing.js.map +1 -1
  77. package/cjs/types/transaction.d.ts +111 -0
  78. package/cjs/types/transaction.d.ts.map +1 -0
  79. package/{types → cjs/types}/transaction.js.map +1 -1
  80. package/cjs/types/transfer.d.ts +32 -0
  81. package/cjs/types/transfer.d.ts.map +1 -0
  82. package/{types → cjs/types}/transfer.js.map +1 -1
  83. package/cjs/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  84. package/{types → cjs/types}/urlTokenBaseHTTPClient.js +4 -0
  85. package/cjs/types/urlTokenBaseHTTPClient.js.map +1 -0
  86. package/cjs/util.d.ts.map +1 -0
  87. package/cjs/util.js.map +1 -0
  88. package/esm/account.js +170 -0
  89. package/esm/account.js.map +1 -0
  90. package/esm/amount.js +27 -0
  91. package/esm/amount.js.map +1 -0
  92. package/esm/app-client.js +76 -0
  93. package/esm/app-client.js.map +1 -0
  94. package/esm/app-deploy.js +446 -0
  95. package/esm/app-deploy.js.map +1 -0
  96. package/esm/app.js +572 -0
  97. package/esm/app.js.map +1 -0
  98. package/esm/index.js +14 -0
  99. package/esm/index.js.map +1 -0
  100. package/esm/indexer-lookup.js +98 -0
  101. package/esm/indexer-lookup.js.map +1 -0
  102. package/esm/localnet.js +111 -0
  103. package/esm/localnet.js.map +1 -0
  104. package/esm/network-client.js +179 -0
  105. package/esm/network-client.js.map +1 -0
  106. package/esm/testing/account.js +24 -0
  107. package/esm/testing/account.js.map +1 -0
  108. package/esm/testing/fixtures/algokit-log-capture-fixture.js +39 -0
  109. package/esm/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  110. package/esm/testing/fixtures/algorand-fixture.js +53 -0
  111. package/esm/testing/fixtures/algorand-fixture.js.map +1 -0
  112. package/esm/testing/fixtures/index.js +3 -0
  113. package/esm/testing/fixtures/index.js.map +1 -0
  114. package/esm/testing/index.js +6 -0
  115. package/esm/testing/index.js.map +1 -0
  116. package/esm/testing/indexer.js +36 -0
  117. package/esm/testing/indexer.js.map +1 -0
  118. package/esm/testing/test-logger.js +69 -0
  119. package/esm/testing/test-logger.js.map +1 -0
  120. package/esm/testing/transaction-logger.js +66 -0
  121. package/esm/testing/transaction-logger.js.map +1 -0
  122. package/esm/transaction.js +365 -0
  123. package/esm/transaction.js.map +1 -0
  124. package/esm/transfer.js +59 -0
  125. package/esm/transfer.js.map +1 -0
  126. package/esm/types/account.js +90 -0
  127. package/esm/types/account.js.map +1 -0
  128. package/esm/types/algo-http-client-with-retry.js +58 -0
  129. package/esm/types/algo-http-client-with-retry.js.map +1 -0
  130. package/esm/types/amount.js +35 -0
  131. package/esm/types/amount.js.map +1 -0
  132. package/esm/types/app-client.js +624 -0
  133. package/esm/types/app-client.js.map +1 -0
  134. package/esm/types/app-spec.js +2 -0
  135. package/esm/types/app-spec.js.map +1 -0
  136. package/esm/types/app.js +33 -0
  137. package/esm/types/app.js.map +1 -0
  138. package/esm/types/config.js +50 -0
  139. package/esm/types/config.js.map +1 -0
  140. package/esm/types/indexer.js +31 -0
  141. package/esm/types/indexer.js.map +1 -0
  142. package/esm/types/logging.js +24 -0
  143. package/esm/types/logging.js.map +1 -0
  144. package/esm/types/logic-error.js +49 -0
  145. package/esm/types/logic-error.js.map +1 -0
  146. package/esm/types/network-client.js +2 -0
  147. package/esm/types/network-client.js.map +1 -0
  148. package/esm/types/testing.js +2 -0
  149. package/esm/types/testing.js.map +1 -0
  150. package/esm/types/transaction.js +2 -0
  151. package/esm/types/transaction.js.map +1 -0
  152. package/esm/types/transfer.js +2 -0
  153. package/esm/types/transfer.js.map +1 -0
  154. package/esm/types/urlTokenBaseHTTPClient.js +151 -0
  155. package/esm/types/urlTokenBaseHTTPClient.js.map +1 -0
  156. package/esm/util.js +20 -0
  157. package/esm/util.js.map +1 -0
  158. package/package.json +42 -6
  159. package/types/account.d.ts +125 -63
  160. package/types/account.d.ts.map +1 -1
  161. package/types/amount.d.ts +18 -22
  162. package/types/amount.d.ts.map +1 -1
  163. package/types/app-client.d.ts +70 -407
  164. package/types/app-client.d.ts.map +1 -1
  165. package/types/app-deploy.d.ts +101 -0
  166. package/types/app-deploy.d.ts.map +1 -0
  167. package/types/app.d.ts +145 -290
  168. package/types/app.d.ts.map +1 -1
  169. package/types/index.d.ts +14 -0
  170. package/types/index.d.ts.map +1 -0
  171. package/types/indexer-lookup.d.ts +38 -0
  172. package/types/indexer-lookup.d.ts.map +1 -0
  173. package/types/localnet.d.ts +54 -0
  174. package/types/localnet.d.ts.map +1 -0
  175. package/types/network-client.d.ts +96 -19
  176. package/types/network-client.d.ts.map +1 -1
  177. package/types/testing/account.d.ts +14 -0
  178. package/types/testing/account.d.ts.map +1 -0
  179. package/types/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
  180. package/types/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  181. package/types/testing/fixtures/algorand-fixture.d.ts +48 -0
  182. package/types/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  183. package/types/testing/fixtures/index.d.ts +3 -0
  184. package/types/testing/fixtures/index.d.ts.map +1 -0
  185. package/types/testing/index.d.ts +6 -0
  186. package/types/testing/index.d.ts.map +1 -0
  187. package/types/testing/indexer.d.ts +12 -0
  188. package/types/testing/indexer.d.ts.map +1 -0
  189. package/types/testing/test-logger.d.ts +41 -0
  190. package/types/testing/test-logger.d.ts.map +1 -0
  191. package/types/testing/transaction-logger.d.ts +29 -0
  192. package/types/testing/transaction-logger.d.ts.map +1 -0
  193. package/types/transaction.d.ts +133 -106
  194. package/types/transaction.d.ts.map +1 -1
  195. package/types/transfer.d.ts +21 -31
  196. package/types/transfer.d.ts.map +1 -1
  197. package/types/types/account.d.ts +66 -0
  198. package/types/types/account.d.ts.map +1 -0
  199. package/types/types/algo-http-client-with-retry.d.ts +14 -0
  200. package/types/types/algo-http-client-with-retry.d.ts.map +1 -0
  201. package/types/types/amount.d.ts +24 -0
  202. package/types/types/amount.d.ts.map +1 -0
  203. package/types/types/app-client.d.ts +408 -0
  204. package/types/types/app-client.d.ts.map +1 -0
  205. package/types/types/app-spec.d.ts +154 -0
  206. package/types/types/app-spec.d.ts.map +1 -0
  207. package/types/types/app.d.ts +308 -0
  208. package/types/types/app.d.ts.map +1 -0
  209. package/types/types/config.d.ts +32 -0
  210. package/types/types/config.d.ts.map +1 -0
  211. package/types/types/indexer.d.ts +623 -0
  212. package/types/types/indexer.d.ts.map +1 -0
  213. package/types/types/logging.d.ts +13 -0
  214. package/types/types/logging.d.ts.map +1 -0
  215. package/types/types/logic-error.d.ts +37 -0
  216. package/types/types/logic-error.d.ts.map +1 -0
  217. package/types/types/network-client.d.ts +20 -0
  218. package/types/types/network-client.d.ts.map +1 -0
  219. package/types/types/testing.d.ts +89 -0
  220. package/types/types/testing.d.ts.map +1 -0
  221. package/types/types/transaction.d.ts +111 -0
  222. package/types/types/transaction.d.ts.map +1 -0
  223. package/types/types/transfer.d.ts +32 -0
  224. package/types/types/transfer.d.ts.map +1 -0
  225. package/types/types/urlTokenBaseHTTPClient.d.ts +41 -0
  226. package/types/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  227. package/types/util.d.ts +10 -0
  228. package/types/util.d.ts.map +1 -0
  229. package/account.d.ts.map +0 -1
  230. package/account.js.map +0 -1
  231. package/amount.d.ts.map +0 -1
  232. package/amount.js.map +0 -1
  233. package/app-client.d.ts.map +0 -1
  234. package/app-client.js.map +0 -1
  235. package/app-deploy.d.ts.map +0 -1
  236. package/app-deploy.js.map +0 -1
  237. package/app.d.ts.map +0 -1
  238. package/app.js.map +0 -1
  239. package/index.d.ts.map +0 -1
  240. package/index.js.map +0 -1
  241. package/indexer-lookup.d.ts.map +0 -1
  242. package/indexer-lookup.js.map +0 -1
  243. package/localnet.d.ts.map +0 -1
  244. package/localnet.js.map +0 -1
  245. package/network-client.d.ts.map +0 -1
  246. package/network-client.js.map +0 -1
  247. package/testing/account.d.ts.map +0 -1
  248. package/testing/account.js.map +0 -1
  249. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  250. package/testing/fixtures/algokit-log-capture-fixture.js.map +0 -1
  251. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  252. package/testing/fixtures/algorand-fixture.js.map +0 -1
  253. package/testing/fixtures/index.d.ts.map +0 -1
  254. package/testing/fixtures/index.js.map +0 -1
  255. package/testing/index.d.ts.map +0 -1
  256. package/testing/index.js.map +0 -1
  257. package/testing/indexer.d.ts.map +0 -1
  258. package/testing/indexer.js.map +0 -1
  259. package/testing/test-logger.d.ts.map +0 -1
  260. package/testing/test-logger.js.map +0 -1
  261. package/testing/transaction-logger.d.ts.map +0 -1
  262. package/testing/transaction-logger.js.map +0 -1
  263. package/transaction.d.ts.map +0 -1
  264. package/transaction.js.map +0 -1
  265. package/transfer.d.ts.map +0 -1
  266. package/transfer.js.map +0 -1
  267. package/types/account.js.map +0 -1
  268. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  269. package/types/algo-http-client-with-retry.js.map +0 -1
  270. package/types/amount.js.map +0 -1
  271. package/types/app-client.js.map +0 -1
  272. package/types/app-spec.d.ts.map +0 -1
  273. package/types/app.js.map +0 -1
  274. package/types/config.d.ts.map +0 -1
  275. package/types/config.js.map +0 -1
  276. package/types/indexer.d.ts.map +0 -1
  277. package/types/indexer.js.map +0 -1
  278. package/types/logging.d.ts.map +0 -1
  279. package/types/logging.js.map +0 -1
  280. package/types/logic-error.d.ts.map +0 -1
  281. package/types/logic-error.js.map +0 -1
  282. package/types/network-client.js.map +0 -1
  283. package/types/testing.d.ts.map +0 -1
  284. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  285. package/types/urlTokenBaseHTTPClient.js.map +0 -1
  286. package/util.d.ts.map +0 -1
  287. package/util.js.map +0 -1
  288. /package/{account.d.ts → cjs/account.d.ts} +0 -0
  289. /package/{account.js → cjs/account.js} +0 -0
  290. /package/{amount.d.ts → cjs/amount.d.ts} +0 -0
  291. /package/{amount.js → cjs/amount.js} +0 -0
  292. /package/{app-client.d.ts → cjs/app-client.d.ts} +0 -0
  293. /package/{app-client.js → cjs/app-client.js} +0 -0
  294. /package/{app-deploy.d.ts → cjs/app-deploy.d.ts} +0 -0
  295. /package/{app-deploy.js → cjs/app-deploy.js} +0 -0
  296. /package/{app.d.ts → cjs/app.d.ts} +0 -0
  297. /package/{app.js → cjs/app.js} +0 -0
  298. /package/{index.d.ts → cjs/index.d.ts} +0 -0
  299. /package/{index.js → cjs/index.js} +0 -0
  300. /package/{indexer-lookup.d.ts → cjs/indexer-lookup.d.ts} +0 -0
  301. /package/{indexer-lookup.js → cjs/indexer-lookup.js} +0 -0
  302. /package/{localnet.d.ts → cjs/localnet.d.ts} +0 -0
  303. /package/{network-client.d.ts → cjs/network-client.d.ts} +0 -0
  304. /package/{network-client.js → cjs/network-client.js} +0 -0
  305. /package/{testing → cjs/testing}/account.d.ts +0 -0
  306. /package/{testing → cjs/testing}/account.js +0 -0
  307. /package/{testing → cjs/testing}/fixtures/algokit-log-capture-fixture.d.ts +0 -0
  308. /package/{testing → cjs/testing}/fixtures/algokit-log-capture-fixture.js +0 -0
  309. /package/{testing → cjs/testing}/fixtures/algorand-fixture.d.ts +0 -0
  310. /package/{testing → cjs/testing}/fixtures/algorand-fixture.js +0 -0
  311. /package/{testing → cjs/testing}/fixtures/index.d.ts +0 -0
  312. /package/{testing → cjs/testing}/fixtures/index.js +0 -0
  313. /package/{testing → cjs/testing}/index.d.ts +0 -0
  314. /package/{testing → cjs/testing}/index.js +0 -0
  315. /package/{testing → cjs/testing}/indexer.d.ts +0 -0
  316. /package/{testing → cjs/testing}/indexer.js +0 -0
  317. /package/{testing → cjs/testing}/test-logger.d.ts +0 -0
  318. /package/{testing → cjs/testing}/transaction-logger.d.ts +0 -0
  319. /package/{transaction.d.ts → cjs/transaction.d.ts} +0 -0
  320. /package/{transaction.js → cjs/transaction.js} +0 -0
  321. /package/{transfer.d.ts → cjs/transfer.d.ts} +0 -0
  322. /package/{transfer.js → cjs/transfer.js} +0 -0
  323. /package/{types → cjs/types}/algo-http-client-with-retry.d.ts +0 -0
  324. /package/{types → cjs/types}/app-spec.d.ts +0 -0
  325. /package/{types → cjs/types}/app-spec.js +0 -0
  326. /package/{types → cjs/types}/app.js +0 -0
  327. /package/{types → cjs/types}/config.d.ts +0 -0
  328. /package/{types → cjs/types}/indexer.d.ts +0 -0
  329. /package/{types → cjs/types}/indexer.js +0 -0
  330. /package/{types → cjs/types}/logging.d.ts +0 -0
  331. /package/{types → cjs/types}/logging.js +0 -0
  332. /package/{types → cjs/types}/logic-error.d.ts +0 -0
  333. /package/{types → cjs/types}/network-client.js +0 -0
  334. /package/{types → cjs/types}/testing.d.ts +0 -0
  335. /package/{types → cjs/types}/testing.js +0 -0
  336. /package/{types → cjs/types}/transaction.js +0 -0
  337. /package/{types → cjs/types}/transfer.js +0 -0
  338. /package/{types → cjs/types}/urlTokenBaseHTTPClient.d.ts +0 -0
  339. /package/{util.d.ts → cjs/util.d.ts} +0 -0
  340. /package/{util.js → cjs/util.js} +0 -0
@@ -1,66 +1,128 @@
1
- import algosdk, { Account, MultisigMetadata, Transaction, TransactionSigner } from 'algosdk';
1
+ import algosdk, { Account, Algodv2, Kmd, MultisigMetadata, TransactionSigner } from 'algosdk';
2
+ import { AccountConfig, MultisigAccount, SigningAccount, TransactionSignerAccount } from './types/account';
3
+ import { AlgoAmount } from './types/amount';
4
+ import { SendTransactionFrom } from './types/transaction';
2
5
  /**
3
- * The account name identifier used for fund dispensing in test environments
6
+ * Returns an account wrapper that supports partial or full multisig signing.
7
+ * @param multisigParams The parameters that define the multisig account
8
+ * @param signingAccounts The signers that are currently present
9
+ * @returns A multisig account wrapper
4
10
  */
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 `TransactionSigner` that also has the sender address. */
51
- export interface TransactionSignerAccount {
52
- addr: Readonly<string>;
53
- signer: TransactionSigner;
54
- }
55
- /** Config for an account config */
56
- export interface AccountConfig {
57
- /** Mnemonic for an account */
58
- accountMnemonic: string;
59
- /** Address of a rekeyed account */
60
- senderAddress?: string;
61
- /** Account name used to retrieve config */
62
- accountName: string;
63
- /** @deprecated Renamed to senderAddress in 2.3.1 */
64
- senderMnemonic?: string;
65
- }
11
+ export declare function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]): MultisigAccount;
12
+ /**
13
+ * Returns an account wrapper that supports a rekeyed account.
14
+ * @param signer The account, with private key loaded, that is signing
15
+ * @param sender The address of the rekeyed account that will act as a sender
16
+ * @returns The SigningAccount wrapper
17
+ */
18
+ export declare function rekeyedAccount(signer: Account, sender: string): SigningAccount;
19
+ /**
20
+ * Returns an account wrapper that supports a transaction signer with associated sender address.
21
+ * @param signer The transaction signer
22
+ * @param sender The address of sender account
23
+ * @returns The SigningAccount wrapper
24
+ */
25
+ export declare function transactionSignerAccount(signer: TransactionSigner, sender: string): TransactionSignerAccount;
26
+ /** Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
27
+ *
28
+ * This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.
29
+ *
30
+ * @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
31
+ * never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
32
+ */
33
+ export declare function mnemonicAccount(mnemonicSecret: string): Account;
34
+ /** Returns a new, random Algorand account with secret key loaded.
35
+ *
36
+ * This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.
37
+ *
38
+ */
39
+ export declare function randomAccount(): Account;
40
+ /** @deprecated use getAccount(account: { config: AccountConfig; fundWith?: AlgoAmount }, algod: Algodv2, kmdClient?: Kmd) instead
41
+ *
42
+ * Returns an Algorand account with private key loaded by convention based on the given name identifier.
43
+ *
44
+ * Note: This function expects to run in a Node.js environment.
45
+ *
46
+ * ## Convention:
47
+ * * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
48
+ * never commit it into source control and ideally load it via a secret storage service rather than the file system.
49
+ * If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
50
+ * * **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
51
+ *
52
+ * 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).
53
+ *
54
+ * @example Default
55
+ *
56
+ * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
57
+ * ```typescript
58
+ * const account = await getAccount('ACCOUNT', algod)
59
+ * ```
60
+ *
61
+ * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGOs from the default LocalNet dispenser.
62
+ *
63
+ * @param account The details of the account to get, either the name identifier (string) or an object with:
64
+ * * `name`: The name identifier of the account
65
+ * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 Algos will be funded from the dispenser account
66
+ * @param algod An algod client
67
+ * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
68
+ * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
69
+ */
70
+ export declare function getAccount(account: {
71
+ name: string;
72
+ fundWith?: AlgoAmount;
73
+ } | string, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
74
+ /**
75
+ * Returns an Algorand account with private key loaded by convention based on the given name identifier.
76
+ *
77
+ * Note: This function expects to run in a Node.js environment.
78
+ *
79
+ * @example Default
80
+ *
81
+ * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
82
+ * ```typescript
83
+ * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)
84
+ * ```
85
+ *
86
+ * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGOs from the default LocalNet dispenser.
87
+ *
88
+ * @param account The details of the account to get, an object with:
89
+ * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)
90
+ * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 Algos will be funded from the dispenser account
91
+ * @param algod An algod client
92
+ * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
93
+ * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
94
+ */
95
+ export declare function getAccount(account: {
96
+ config: AccountConfig;
97
+ fundWith?: AlgoAmount;
98
+ }, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
99
+ /** Returns an account's address as a byte array
100
+ *
101
+ * @param account Either an account (with private key loaded) or the string address of an account
102
+ */
103
+ export declare function getAccountAddressAsUint8Array(account: SendTransactionFrom | string): Uint8Array;
104
+ /** Returns the string address of an Algorand account from a base64 encoded version of the underlying byte array of the address public key
105
+ *
106
+ * @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key
107
+ */
108
+ export declare function getAccountAddressAsString(addressEncodedInB64: string): string;
109
+ /** Returns an account (with private key loaded) that can act as a dispenser
110
+ *
111
+ * If running on LocalNet then it will return the default dispenser account automatically,
112
+ * otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC
113
+ *
114
+ * @param algod An algod client
115
+ * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
116
+ */
117
+ export declare function getDispenserAccount(algod: Algodv2, kmd?: Kmd): Promise<algosdk.Account | SigningAccount>;
118
+ /** Returns the Account configuration from environment variables
119
+ *
120
+ * @param accountName account name
121
+ *
122
+ * @example environment variables
123
+ * {accountName}_MNEMONIC
124
+ * {accountName}_SENDER
125
+ *
126
+ */
127
+ export declare function getAccountConfigFromEnvironment(accountName: string): AccountConfig;
66
128
  //# sourceMappingURL=account.d.ts.map
@@ -1 +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,EA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AAU,CAC9B,OAAO,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;CAAE,EACzD,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,CAAA;AA6EpC;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,cAElF;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,6CAIlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAUlF"}
package/types/amount.d.ts CHANGED
@@ -1,24 +1,20 @@
1
- /** Wrapper class to ensure safe, explicit conversion between µAlgos, Algos and numbers */
2
- export declare class AlgoAmount {
3
- private amountInMicroAlgos;
4
- /** Return the amount as a number in µAlgos */
5
- get microAlgos(): number;
6
- /** Return the amount as a number in Algos */
7
- get algos(): number;
8
- constructor(amount: {
9
- algos: number;
10
- } | {
11
- microAlgos: number;
12
- });
13
- toString(): string;
14
- /** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
15
- * but it's not recommended to use this to convert to a number, it's much safer to explicitly call
16
- * the algos or microAlgos properties
17
- */
18
- valueOf(): number;
19
- /** Create a `AlgoAmount` object representing the given number of Algos */
20
- static Algos(amount: number): AlgoAmount;
21
- /** Create a `AlgoAmount` object representing the given number of µAlgos */
22
- static MicroAlgos(amount: number): AlgoAmount;
1
+ import { AlgoAmount } from './types/amount';
2
+ declare global {
3
+ interface Number {
4
+ microAlgos(this: number): AlgoAmount;
5
+ algos(this: number): AlgoAmount;
6
+ }
23
7
  }
8
+ /** Returns an amount of Algos using AlgoAmount
9
+ * @param algos The amount in Algos
10
+ */
11
+ export declare const algos: (algos: number) => AlgoAmount;
12
+ /** Returns an amount of µAlgos using AlgoAmount
13
+ * @param microAlgos The amount in µAlgos
14
+ */
15
+ export declare const microAlgos: (microAlgos: number) => AlgoAmount;
16
+ /** Returns an amount of µAlgos to cover standard fees for the given number of transactions using AlgoAmount
17
+ * @param numberOfTransactions The of standard transaction fees to return the amount of ALGOs
18
+ */
19
+ export declare const transactionFees: (numberOfTransactions: number) => AlgoAmount;
24
20
  //# sourceMappingURL=amount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,qBAAa,UAAU;IACrB,OAAO,CAAC,kBAAkB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,UAAU,WAEb;IAED,6CAA6C;IAC7C,IAAI,KAAK,WAER;gBAEW,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;IAI9D,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM;IAI3B,2EAA2E;IAC3E,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;CAGjC"}
1
+ {"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/amount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;QACpC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAA;KAChC;CACF;AAUD;;GAEG;AACH,eAAO,MAAM,KAAK,UAAW,MAAM,eAElC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,eAAgB,MAAM,eAE5C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,yBAA0B,MAAM,eAE3D,CAAA"}