@algorandfoundation/algokit-utils 6.3.0-beta.1 → 7.0.0-beta.10

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 (360) hide show
  1. package/README.md +3 -25
  2. package/account/account.d.ts +8 -9
  3. package/account/account.js +7 -7
  4. package/account/account.js.map +1 -1
  5. package/account/account.mjs +7 -7
  6. package/account/account.mjs.map +1 -1
  7. package/account/get-account-config-from-environment.d.ts +0 -1
  8. package/account/get-account-config-from-environment.js.map +1 -1
  9. package/account/get-account-config-from-environment.mjs.map +1 -1
  10. package/account/get-account.d.ts +2 -3
  11. package/account/get-account.js +1 -1
  12. package/account/get-account.js.map +1 -1
  13. package/account/get-account.mjs +1 -1
  14. package/account/get-account.mjs.map +1 -1
  15. package/account/get-dispenser-account.d.ts +1 -2
  16. package/account/get-dispenser-account.js +1 -1
  17. package/account/get-dispenser-account.js.map +1 -1
  18. package/account/get-dispenser-account.mjs +1 -1
  19. package/account/get-dispenser-account.mjs.map +1 -1
  20. package/account/index.d.ts +0 -1
  21. package/account/mnemonic-account.d.ts +1 -2
  22. package/account/mnemonic-account.js +1 -1
  23. package/account/mnemonic-account.js.map +1 -1
  24. package/account/mnemonic-account.mjs +1 -1
  25. package/account/mnemonic-account.mjs.map +1 -1
  26. package/amount.d.ts +14 -5
  27. package/amount.js +6 -0
  28. package/amount.js.map +1 -1
  29. package/amount.mjs +6 -0
  30. package/amount.mjs.map +1 -1
  31. package/app-client.d.ts +15 -1
  32. package/app-client.js +15 -0
  33. package/app-client.js.map +1 -1
  34. package/app-client.mjs +15 -0
  35. package/app-client.mjs.map +1 -1
  36. package/app-deploy.d.ts +18 -2
  37. package/app-deploy.js +140 -333
  38. package/app-deploy.js.map +1 -1
  39. package/app-deploy.mjs +143 -336
  40. package/app-deploy.mjs.map +1 -1
  41. package/app.d.ts +39 -3
  42. package/app.js +116 -369
  43. package/app.js.map +1 -1
  44. package/app.mjs +117 -370
  45. package/app.mjs.map +1 -1
  46. package/asset.d.ts +5 -6
  47. package/asset.js +5 -8
  48. package/asset.js.map +1 -1
  49. package/asset.mjs +5 -8
  50. package/asset.mjs.map +1 -1
  51. package/config.d.ts +0 -1
  52. package/config.js.map +1 -1
  53. package/config.mjs.map +1 -1
  54. package/debugging/debugging.d.ts +3 -5
  55. package/debugging/debugging.js +4 -128
  56. package/debugging/debugging.js.map +1 -1
  57. package/debugging/debugging.mjs +4 -109
  58. package/debugging/debugging.mjs.map +1 -1
  59. package/debugging/index.d.ts +0 -2
  60. package/dispenser-client.d.ts +0 -1
  61. package/dispenser-client.js.map +1 -1
  62. package/dispenser-client.mjs.map +1 -1
  63. package/index.d.ts +4 -4
  64. package/index.js +31 -26
  65. package/index.js.map +1 -1
  66. package/index.mjs +4 -4
  67. package/indexer-lookup.d.ts +0 -1
  68. package/indexer-lookup.js.map +1 -1
  69. package/indexer-lookup.mjs.map +1 -1
  70. package/localnet/get-kmd-wallet-account.d.ts +1 -2
  71. package/localnet/get-kmd-wallet-account.js +1 -1
  72. package/localnet/get-kmd-wallet-account.js.map +1 -1
  73. package/localnet/get-kmd-wallet-account.mjs +1 -1
  74. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  75. package/localnet/get-localnet-dispenser-account.d.ts +1 -2
  76. package/localnet/get-localnet-dispenser-account.js +1 -1
  77. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  78. package/localnet/get-localnet-dispenser-account.mjs +1 -1
  79. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  80. package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -2
  81. package/localnet/get-or-create-kmd-wallet-account.js +1 -1
  82. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  83. package/localnet/get-or-create-kmd-wallet-account.mjs +1 -1
  84. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  85. package/localnet/index.d.ts +0 -1
  86. package/localnet/is-localnet.d.ts +1 -2
  87. package/localnet/is-localnet.js +1 -1
  88. package/localnet/is-localnet.js.map +1 -1
  89. package/localnet/is-localnet.mjs +1 -1
  90. package/localnet/is-localnet.mjs.map +1 -1
  91. package/network-client.d.ts +2 -3
  92. package/network-client.js +2 -2
  93. package/network-client.js.map +1 -1
  94. package/network-client.mjs +2 -2
  95. package/network-client.mjs.map +1 -1
  96. package/package.json +1 -1
  97. package/testing/_asset.d.ts +0 -1
  98. package/testing/account.d.ts +0 -1
  99. package/testing/account.js.map +1 -1
  100. package/testing/account.mjs.map +1 -1
  101. package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
  102. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  103. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  104. package/testing/fixtures/algorand-fixture.d.ts +0 -1
  105. package/testing/fixtures/algorand-fixture.js +12 -12
  106. package/testing/fixtures/algorand-fixture.js.map +1 -1
  107. package/testing/fixtures/algorand-fixture.mjs +12 -12
  108. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  109. package/testing/fixtures/index.d.ts +0 -1
  110. package/testing/index.d.ts +0 -1
  111. package/testing/indexer.d.ts +0 -1
  112. package/testing/indexer.js.map +1 -1
  113. package/testing/indexer.mjs.map +1 -1
  114. package/testing/test-logger.d.ts +0 -1
  115. package/testing/test-logger.js +1 -3
  116. package/testing/test-logger.js.map +1 -1
  117. package/testing/test-logger.mjs +1 -3
  118. package/testing/test-logger.mjs.map +1 -1
  119. package/testing/transaction-logger.d.ts +0 -1
  120. package/testing/transaction-logger.js.map +1 -1
  121. package/testing/transaction-logger.mjs.map +1 -1
  122. package/transaction/index.d.ts +0 -1
  123. package/transaction/legacy-bridge.d.ts +31 -6
  124. package/transaction/legacy-bridge.js +100 -6
  125. package/transaction/legacy-bridge.js.map +1 -1
  126. package/transaction/legacy-bridge.mjs +99 -8
  127. package/transaction/legacy-bridge.mjs.map +1 -1
  128. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +0 -1
  129. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  130. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  131. package/transaction/transaction.d.ts +41 -6
  132. package/transaction/transaction.js +107 -45
  133. package/transaction/transaction.js.map +1 -1
  134. package/transaction/transaction.mjs +107 -46
  135. package/transaction/transaction.mjs.map +1 -1
  136. package/transfer/index.d.ts +0 -1
  137. package/transfer/transfer-algos.d.ts +1 -2
  138. package/transfer/transfer-algos.js +1 -1
  139. package/transfer/transfer-algos.js.map +1 -1
  140. package/transfer/transfer-algos.mjs +1 -1
  141. package/transfer/transfer-algos.mjs.map +1 -1
  142. package/transfer/transfer.d.ts +1 -2
  143. package/transfer/transfer.js +3 -3
  144. package/transfer/transfer.js.map +1 -1
  145. package/transfer/transfer.mjs +3 -3
  146. package/transfer/transfer.mjs.map +1 -1
  147. package/types/account-manager.d.ts +14 -6
  148. package/types/account-manager.js +18 -4
  149. package/types/account-manager.js.map +1 -1
  150. package/types/account-manager.mjs +18 -4
  151. package/types/account-manager.mjs.map +1 -1
  152. package/types/account.d.ts +0 -1
  153. package/types/account.js.map +1 -1
  154. package/types/account.mjs.map +1 -1
  155. package/types/algo-http-client-with-retry.d.ts +0 -1
  156. package/types/algo-http-client-with-retry.js.map +1 -1
  157. package/types/algo-http-client-with-retry.mjs.map +1 -1
  158. package/types/algorand-client-interface.d.ts +28 -0
  159. package/types/algorand-client-interface.js +3 -0
  160. package/types/algorand-client-interface.js.map +1 -0
  161. package/types/algorand-client-interface.mjs +2 -0
  162. package/types/algorand-client-interface.mjs.map +1 -0
  163. package/types/algorand-client-transaction-creator.d.ts +450 -21
  164. package/types/algorand-client-transaction-creator.js +406 -22
  165. package/types/algorand-client-transaction-creator.js.map +1 -1
  166. package/types/algorand-client-transaction-creator.mjs +406 -22
  167. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  168. package/types/algorand-client-transaction-sender.d.ts +758 -33
  169. package/types/algorand-client-transaction-sender.js +444 -14
  170. package/types/algorand-client-transaction-sender.js.map +1 -1
  171. package/types/algorand-client-transaction-sender.mjs +444 -14
  172. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  173. package/types/algorand-client.d.ts +18 -10
  174. package/types/algorand-client.js +23 -10
  175. package/types/algorand-client.js.map +1 -1
  176. package/types/algorand-client.mjs +23 -10
  177. package/types/algorand-client.mjs.map +1 -1
  178. package/types/amount.d.ts +10 -11
  179. package/types/amount.js +7 -7
  180. package/types/amount.js.map +1 -1
  181. package/types/amount.mjs +7 -7
  182. package/types/amount.mjs.map +1 -1
  183. package/types/app-arc56.d.ts +348 -0
  184. package/types/app-arc56.js +184 -0
  185. package/types/app-arc56.js.map +1 -0
  186. package/types/app-arc56.mjs +175 -0
  187. package/types/app-arc56.mjs.map +1 -0
  188. package/types/app-client.d.ts +1496 -9
  189. package/types/app-client.js +903 -21
  190. package/types/app-client.js.map +1 -1
  191. package/types/app-client.mjs +904 -23
  192. package/types/app-client.mjs.map +1 -1
  193. package/types/app-deployer.d.ts +126 -0
  194. package/types/app-deployer.js +354 -0
  195. package/types/app-deployer.js.map +1 -0
  196. package/types/app-deployer.mjs +352 -0
  197. package/types/app-deployer.mjs.map +1 -0
  198. package/types/app-factory.d.ts +846 -0
  199. package/types/app-factory.js +411 -0
  200. package/types/app-factory.js.map +1 -0
  201. package/types/app-factory.mjs +409 -0
  202. package/types/app-factory.mjs.map +1 -0
  203. package/types/app-manager.d.ts +244 -0
  204. package/types/app-manager.js +334 -0
  205. package/types/app-manager.js.map +1 -0
  206. package/types/app-manager.mjs +332 -0
  207. package/types/app-manager.mjs.map +1 -0
  208. package/types/app-spec.d.ts +2 -1
  209. package/types/app-spec.js +121 -0
  210. package/types/app-spec.js.map +1 -1
  211. package/types/app-spec.mjs +120 -0
  212. package/types/app-spec.mjs.map +1 -1
  213. package/types/app.d.ts +53 -13
  214. package/types/app.js +1 -1
  215. package/types/app.js.map +1 -1
  216. package/types/app.mjs +1 -1
  217. package/types/app.mjs.map +1 -1
  218. package/types/asset-manager.d.ts +4 -4
  219. package/types/asset-manager.js +3 -4
  220. package/types/asset-manager.js.map +1 -1
  221. package/types/asset-manager.mjs +3 -4
  222. package/types/asset-manager.mjs.map +1 -1
  223. package/types/asset.d.ts +0 -1
  224. package/types/async-event-emitter.d.ts +23 -0
  225. package/types/async-event-emitter.js +55 -0
  226. package/types/async-event-emitter.js.map +1 -0
  227. package/types/async-event-emitter.mjs +53 -0
  228. package/types/async-event-emitter.mjs.map +1 -0
  229. package/types/client-manager.d.ts +133 -51
  230. package/types/client-manager.js +147 -23
  231. package/types/client-manager.js.map +1 -1
  232. package/types/client-manager.mjs +148 -24
  233. package/types/client-manager.mjs.map +1 -1
  234. package/types/composer.d.ts +232 -49
  235. package/types/composer.js +307 -65
  236. package/types/composer.js.map +1 -1
  237. package/types/composer.mjs +308 -66
  238. package/types/composer.mjs.map +1 -1
  239. package/types/config.d.ts +3 -6
  240. package/types/config.js +5 -44
  241. package/types/config.js.map +1 -1
  242. package/types/config.mjs +5 -27
  243. package/types/config.mjs.map +1 -1
  244. package/types/debugging.d.ts +29 -101
  245. package/types/debugging.js +16 -109
  246. package/types/debugging.js.map +1 -1
  247. package/types/debugging.mjs +12 -107
  248. package/types/debugging.mjs.map +1 -1
  249. package/types/dispenser-client.d.ts +1 -2
  250. package/types/dispenser-client.js +6 -5
  251. package/types/dispenser-client.js.map +1 -1
  252. package/types/dispenser-client.mjs +6 -5
  253. package/types/dispenser-client.mjs.map +1 -1
  254. package/types/expand.d.ts +7 -0
  255. package/types/expand.js +3 -0
  256. package/types/expand.js.map +1 -0
  257. package/types/expand.mjs +2 -0
  258. package/types/expand.mjs.map +1 -0
  259. package/types/indexer.d.ts +0 -1
  260. package/types/indexer.js.map +1 -1
  261. package/types/indexer.mjs.map +1 -1
  262. package/types/kmd-account-manager.d.ts +0 -1
  263. package/types/kmd-account-manager.js +2 -2
  264. package/types/kmd-account-manager.js.map +1 -1
  265. package/types/kmd-account-manager.mjs +2 -2
  266. package/types/kmd-account-manager.mjs.map +1 -1
  267. package/types/logging.d.ts +0 -1
  268. package/types/logging.js.map +1 -1
  269. package/types/logging.mjs.map +1 -1
  270. package/types/logic-error.d.ts +0 -1
  271. package/types/logic-error.js.map +1 -1
  272. package/types/logic-error.mjs.map +1 -1
  273. package/types/network-client.d.ts +13 -1
  274. package/types/network-client.js.map +1 -1
  275. package/types/network-client.mjs.map +1 -1
  276. package/types/testing.d.ts +3 -4
  277. package/types/transaction.d.ts +17 -4
  278. package/types/transfer.d.ts +0 -1
  279. package/types/urlTokenBaseHTTPClient.d.ts +0 -1
  280. package/types/urlTokenBaseHTTPClient.js +1 -1
  281. package/types/urlTokenBaseHTTPClient.js.map +1 -1
  282. package/types/urlTokenBaseHTTPClient.mjs +1 -1
  283. package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
  284. package/util.d.ts +2 -2
  285. package/util.js +11 -10
  286. package/util.js.map +1 -1
  287. package/util.mjs +11 -10
  288. package/util.mjs.map +1 -1
  289. package/account/account.d.ts.map +0 -1
  290. package/account/get-account-config-from-environment.d.ts.map +0 -1
  291. package/account/get-account.d.ts.map +0 -1
  292. package/account/get-dispenser-account.d.ts.map +0 -1
  293. package/account/index.d.ts.map +0 -1
  294. package/account/mnemonic-account.d.ts.map +0 -1
  295. package/amount.d.ts.map +0 -1
  296. package/app-client.d.ts.map +0 -1
  297. package/app-deploy.d.ts.map +0 -1
  298. package/app.d.ts.map +0 -1
  299. package/asset.d.ts.map +0 -1
  300. package/config.d.ts.map +0 -1
  301. package/debugging/debugging.d.ts.map +0 -1
  302. package/debugging/index.d.ts.map +0 -1
  303. package/debugging/simulate-and-persist-response.d.ts +0 -20
  304. package/debugging/simulate-and-persist-response.d.ts.map +0 -1
  305. package/debugging/simulate-and-persist-response.js +0 -108
  306. package/debugging/simulate-and-persist-response.js.map +0 -1
  307. package/debugging/simulate-and-persist-response.mjs +0 -89
  308. package/debugging/simulate-and-persist-response.mjs.map +0 -1
  309. package/dispenser-client.d.ts.map +0 -1
  310. package/index.d.ts.map +0 -1
  311. package/indexer-lookup.d.ts.map +0 -1
  312. package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
  313. package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
  314. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
  315. package/localnet/index.d.ts.map +0 -1
  316. package/localnet/is-localnet.d.ts.map +0 -1
  317. package/network-client.d.ts.map +0 -1
  318. package/testing/_asset.d.ts.map +0 -1
  319. package/testing/account.d.ts.map +0 -1
  320. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  321. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  322. package/testing/fixtures/index.d.ts.map +0 -1
  323. package/testing/index.d.ts.map +0 -1
  324. package/testing/indexer.d.ts.map +0 -1
  325. package/testing/test-logger.d.ts.map +0 -1
  326. package/testing/transaction-logger.d.ts.map +0 -1
  327. package/transaction/index.d.ts.map +0 -1
  328. package/transaction/legacy-bridge.d.ts.map +0 -1
  329. package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
  330. package/transaction/transaction.d.ts.map +0 -1
  331. package/transfer/index.d.ts.map +0 -1
  332. package/transfer/transfer-algos.d.ts.map +0 -1
  333. package/transfer/transfer.d.ts.map +0 -1
  334. package/types/account-manager.d.ts.map +0 -1
  335. package/types/account.d.ts.map +0 -1
  336. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  337. package/types/algorand-client-transaction-creator.d.ts.map +0 -1
  338. package/types/algorand-client-transaction-sender.d.ts.map +0 -1
  339. package/types/algorand-client.d.ts.map +0 -1
  340. package/types/amount.d.ts.map +0 -1
  341. package/types/app-client.d.ts.map +0 -1
  342. package/types/app-spec.d.ts.map +0 -1
  343. package/types/app.d.ts.map +0 -1
  344. package/types/asset-manager.d.ts.map +0 -1
  345. package/types/asset.d.ts.map +0 -1
  346. package/types/client-manager.d.ts.map +0 -1
  347. package/types/composer.d.ts.map +0 -1
  348. package/types/config.d.ts.map +0 -1
  349. package/types/debugging.d.ts.map +0 -1
  350. package/types/dispenser-client.d.ts.map +0 -1
  351. package/types/indexer.d.ts.map +0 -1
  352. package/types/kmd-account-manager.d.ts.map +0 -1
  353. package/types/logging.d.ts.map +0 -1
  354. package/types/logic-error.d.ts.map +0 -1
  355. package/types/network-client.d.ts.map +0 -1
  356. package/types/testing.d.ts.map +0 -1
  357. package/types/transaction.d.ts.map +0 -1
  358. package/types/transfer.d.ts.map +0 -1
  359. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  360. package/util.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"asset-manager.mjs","sources":["../../src/types/asset-manager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA,IAAO,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;AAmI1C;MACa,YAAY,CAAA;AAIvB;;;;;;;;AAQG;IACH,WAAY,CAAA,KAAsB,EAAE,QAA+B,EAAA;AACjE,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC1B;AAED;;;;;;;;;;AAUG;IACI,MAAM,OAAO,CAAC,OAAe,EAAA;QAClC,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEpG,OAAO;AACL,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvC,YAAA,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;AAC5B,YAAA,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;AACtC,YAA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,OAAO,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAChF,aAAC,CAAC,CAAA;SACH;AAED,QAAA,OAAO,OAAO,CAAA;KACf;AACF;;;;"}
1
+ {"version":3,"file":"asset-manager.mjs","sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation, TransactionSignerAccount } from './account'\nimport AlgoKitComposer, { CommonTransactionParams, MAX_TRANSACTION_GROUP_SIZE } from './composer'\nimport { SendParams } from './transaction'\nimport AssetModel = algosdk.modelsv2.Asset\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set the field is permanently empty.\n */\n reserve?: string\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * The clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: algosdk.Algodv2\n private _newGroup: () => AlgoKitComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `AlgoKitComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new AlgoKitComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: algosdk.Algodv2, newGroup: () => AlgoKitComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = AssetModel.from_obj_for_encoding(await this._algod.getAssetByID(Number(assetId)).do())\n\n return {\n assetId: BigInt(asset.index),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\n /**\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345n;\n * const accountInfo = await algorand.asset.getAccountInformation(address, assetId);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | TransactionSignerAccount, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(typeof sender === 'string' ? sender : sender.addr, Number(assetId)).do()\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info['asset-holding']['amount']),\n frozen: info['asset-holding']['is-frozen'] === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * algorand.asset.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * algorand.asset.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | TransactionSignerAccount,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & SendParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: typeof account === 'string' ? account : account.addr,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * algorand.asset.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * algorand.asset.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | TransactionSignerAccount,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n SendParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n const sender = typeof account === 'string' ? account : account.addr\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(sender, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${sender}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.send(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n}\n"],"names":[],"mappings":";;;;;AAMA,IAAO,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;AAmI1C;MACa,YAAY,CAAA;AAIvB;;;;;;;;AAQG;IACH,WAAY,CAAA,KAAsB,EAAE,QAA+B,EAAA;AACjE,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC1B;AAED;;;;;;;;;;AAUG;IACI,MAAM,OAAO,CAAC,OAAe,EAAA;QAClC,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEpG,OAAO;AACL,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvC,YAAA,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;AAC5B,YAAA,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;AACtC,YAAA,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;AAC/B,YAAA,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;AACzC,YAAA,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;AACrB,YAAA,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;AAC/B,YAAA,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;AAC7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AED,YAAA,KAAK,MAAM,OAAO,IAAI,UAAU,EAAE;gBAChC,QAAQ,CAAC,cAAc,CAAC;AACtB,oBAAA,GAAG,OAAO;AACV,oBAAA,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO;oBACtD,MAAM;AACN,oBAAA,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;AACzB,iBAAA,CAAC,CAAA;aACH;YAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAE3C,YAAA,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,IAAI,CACzC,CAAsB,mBAAA,EAAA,OAAO,CAAkB,eAAA,EAAA,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,CAAA;AACpH,gBAAA,CAAA,kBAAA,EAAqB,MAAM,CAAC,OAAO,CAAA,UAAA,EAAa,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,EAAE,cAAc,CAAA,CAAA,CAAG,CAC/F,CAAA;YAED,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,KAAI;gBACpC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAChF,aAAC,CAAC,CAAA;SACH;AAED,QAAA,OAAO,OAAO,CAAA;KACf;AACF;;;;"}
package/types/asset.d.ts CHANGED
@@ -97,4 +97,3 @@ export interface AssetBulkOptInOutParams {
97
97
  /** Whether to suppress log messages from transaction send, default: do not suppress */
98
98
  suppressLog?: boolean;
99
99
  }
100
- //# sourceMappingURL=asset.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging';
2
+ export declare enum EventType {
3
+ TxnGroupSimulated = "TxnGroupSimulated",
4
+ AppCompiled = "AppCompiled"
5
+ }
6
+ export type EventDataMap = {
7
+ [EventType.TxnGroupSimulated]: AVMTracesEventData;
8
+ [EventType.AppCompiled]: TealSourcesDebugEventData;
9
+ [key: string]: unknown;
10
+ };
11
+ export type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void;
12
+ export declare class AsyncEventEmitter {
13
+ private listenerWrapperMap;
14
+ private listenerMap;
15
+ emitAsync<K extends EventType>(eventName: K, event: EventDataMap[K]): Promise<void>;
16
+ emitAsync(eventName: string | symbol, event: unknown): Promise<void>;
17
+ on<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter;
18
+ on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter;
19
+ once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter;
20
+ once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter;
21
+ removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter;
22
+ off: (eventName: string | symbol, listener: AsyncEventListener) => AsyncEventEmitter;
23
+ }
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ exports.EventType = void 0;
4
+ (function (EventType) {
5
+ EventType["TxnGroupSimulated"] = "TxnGroupSimulated";
6
+ EventType["AppCompiled"] = "AppCompiled";
7
+ })(exports.EventType || (exports.EventType = {}));
8
+ class AsyncEventEmitter {
9
+ constructor() {
10
+ this.listenerWrapperMap = new WeakMap();
11
+ this.listenerMap = {};
12
+ this.off = this.removeListener;
13
+ }
14
+ async emitAsync(eventName, event) {
15
+ for (const listener of this.listenerMap[eventName] ?? []) {
16
+ await listener(event, eventName);
17
+ }
18
+ }
19
+ on(eventName, listener) {
20
+ if (!this.listenerMap[eventName])
21
+ this.listenerMap[eventName] = [];
22
+ this.listenerMap[eventName].push(listener);
23
+ return this;
24
+ }
25
+ once(eventName, listener) {
26
+ const wrappedListener = async (event, eventName) => {
27
+ try {
28
+ return await listener(event, eventName);
29
+ }
30
+ finally {
31
+ this.removeListener(eventName, wrappedListener);
32
+ }
33
+ };
34
+ this.listenerWrapperMap.set(listener, wrappedListener);
35
+ return this.on(eventName, wrappedListener);
36
+ }
37
+ removeListener(eventName, listener) {
38
+ const wrappedListener = this.listenerWrapperMap.get(listener);
39
+ if (wrappedListener) {
40
+ this.listenerWrapperMap.delete(listener);
41
+ if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {
42
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1);
43
+ }
44
+ }
45
+ else {
46
+ if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {
47
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1);
48
+ }
49
+ }
50
+ return this;
51
+ }
52
+ }
53
+
54
+ exports.AsyncEventEmitter = AsyncEventEmitter;
55
+ //# sourceMappingURL=async-event-emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-event-emitter.js","sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging'\n\nexport enum EventType {\n TxnGroupSimulated = 'TxnGroupSimulated',\n AppCompiled = 'AppCompiled',\n}\n\nexport type EventDataMap = {\n [EventType.TxnGroupSimulated]: AVMTracesEventData\n [EventType.AppCompiled]: TealSourcesDebugEventData\n [key: string]: unknown\n}\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends EventType>(eventName: K, event: EventDataMap[K]): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void> {\n for (const listener of this.listenerMap[eventName] ?? []) {\n await listener(event, eventName)\n }\n }\n\n on<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n on(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n if (!this.listenerMap[eventName]) this.listenerMap[eventName] = []\n this.listenerMap[eventName].push(listener as AsyncEventListener)\n return this\n }\n\n once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n once(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener: AsyncEventListener = async (event, eventName) => {\n try {\n return await listener(event, eventName)\n } finally {\n this.removeListener(eventName, wrappedListener)\n }\n }\n this.listenerWrapperMap.set(listener, wrappedListener)\n return this.on(eventName, wrappedListener)\n }\n\n removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener = this.listenerWrapperMap.get(listener)\n if (wrappedListener) {\n this.listenerWrapperMap.delete(listener)\n if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1)\n }\n } else {\n if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1)\n }\n }\n\n return this\n }\n\n off = this.removeListener\n}\n"],"names":["EventType"],"mappings":";;AAEYA,2BAGX;AAHD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AACvC,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B,CAAA;AAC7B,CAAC,EAHWA,iBAAS,KAATA,iBAAS,GAGpB,EAAA,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AAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QAC7D,IAAI,eAAe,EAAE;AACnB,YAAA,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACxC,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;aAC5F;SACF;aAAM;AACL,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;gBACzD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;aACrF;SACF;AAED,QAAA,OAAO,IAAI,CAAA;KACZ;AAGF;;;;"}
@@ -0,0 +1,53 @@
1
+ var EventType;
2
+ (function (EventType) {
3
+ EventType["TxnGroupSimulated"] = "TxnGroupSimulated";
4
+ EventType["AppCompiled"] = "AppCompiled";
5
+ })(EventType || (EventType = {}));
6
+ class AsyncEventEmitter {
7
+ constructor() {
8
+ this.listenerWrapperMap = new WeakMap();
9
+ this.listenerMap = {};
10
+ this.off = this.removeListener;
11
+ }
12
+ async emitAsync(eventName, event) {
13
+ for (const listener of this.listenerMap[eventName] ?? []) {
14
+ await listener(event, eventName);
15
+ }
16
+ }
17
+ on(eventName, listener) {
18
+ if (!this.listenerMap[eventName])
19
+ this.listenerMap[eventName] = [];
20
+ this.listenerMap[eventName].push(listener);
21
+ return this;
22
+ }
23
+ once(eventName, listener) {
24
+ const wrappedListener = async (event, eventName) => {
25
+ try {
26
+ return await listener(event, eventName);
27
+ }
28
+ finally {
29
+ this.removeListener(eventName, wrappedListener);
30
+ }
31
+ };
32
+ this.listenerWrapperMap.set(listener, wrappedListener);
33
+ return this.on(eventName, wrappedListener);
34
+ }
35
+ removeListener(eventName, listener) {
36
+ const wrappedListener = this.listenerWrapperMap.get(listener);
37
+ if (wrappedListener) {
38
+ this.listenerWrapperMap.delete(listener);
39
+ if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {
40
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1);
41
+ }
42
+ }
43
+ else {
44
+ if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {
45
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1);
46
+ }
47
+ }
48
+ return this;
49
+ }
50
+ }
51
+
52
+ export { AsyncEventEmitter, EventType };
53
+ //# sourceMappingURL=async-event-emitter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-event-emitter.mjs","sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging'\n\nexport enum EventType {\n TxnGroupSimulated = 'TxnGroupSimulated',\n AppCompiled = 'AppCompiled',\n}\n\nexport type EventDataMap = {\n [EventType.TxnGroupSimulated]: AVMTracesEventData\n [EventType.AppCompiled]: TealSourcesDebugEventData\n [key: string]: unknown\n}\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends EventType>(eventName: K, event: EventDataMap[K]): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void> {\n for (const listener of this.listenerMap[eventName] ?? []) {\n await listener(event, eventName)\n }\n }\n\n on<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n on(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n if (!this.listenerMap[eventName]) this.listenerMap[eventName] = []\n this.listenerMap[eventName].push(listener as AsyncEventListener)\n return this\n }\n\n once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n once(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener: AsyncEventListener = async (event, eventName) => {\n try {\n return await listener(event, eventName)\n } finally {\n this.removeListener(eventName, wrappedListener)\n }\n }\n this.listenerWrapperMap.set(listener, wrappedListener)\n return this.on(eventName, wrappedListener)\n }\n\n removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener = this.listenerWrapperMap.get(listener)\n if (wrappedListener) {\n this.listenerWrapperMap.delete(listener)\n if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1)\n }\n } else {\n if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1)\n }\n }\n\n return this\n }\n\n off = this.removeListener\n}\n"],"names":[],"mappings":"IAEY,UAGX;AAHD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AACvC,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA,CAAA;MAUY,iBAAiB,CAAA;AAA9B,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,C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IAAI,eAAe,EAAE;AACnB,YAAA,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACxC,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;aAC5F;SACF;aAAM;AACL,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;gBACzD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;aACrF;SACF;AAED,QAAA,OAAO,IAAI,CAAA;KACZ;AAGF;;;;"}
@@ -1,8 +1,10 @@
1
1
  import algosdk from 'algosdk';
2
- import { AppLookup } from './app';
3
- import { AppDetails, AppDetailsBase, AppSpecAppDetailsBase, ApplicationClient, ResolveAppByCreatorAndNameBase, ResolveAppByIdBase } from './app-client';
2
+ import { AlgorandClientInterface } from './algorand-client-interface';
3
+ import { AppClient, AppClientParams, ResolveAppClientByCreatorAndName } from './app-client';
4
+ import { AppFactory, AppFactoryParams } from './app-factory';
4
5
  import { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from './dispenser-client';
5
- import { AlgoClientConfig, AlgoConfig } from './network-client';
6
+ import { Expand } from './expand';
7
+ import { AlgoClientConfig, AlgoConfig, NetworkDetails } from './network-client';
6
8
  import Kmd = algosdk.Kmd;
7
9
  import Indexer = algosdk.Indexer;
8
10
  import Algodv2 = algosdk.Algodv2;
@@ -16,24 +18,28 @@ export interface AlgoSdkClients {
16
18
  /** Optional KMD client, see https://developer.algorand.org/docs/rest-apis/kmd/ */
17
19
  kmd?: algosdk.Kmd;
18
20
  }
19
- /** Details of the current network. */
20
- export interface NetworkDetails {
21
- /** Whether or not the network is TestNet. */
22
- isTestNet: boolean;
23
- /** Whether or not the network is MainNet. */
24
- isMainNet: boolean;
25
- /** Whether or not the network is LocalNet. */
26
- isLocalNet: boolean;
27
- /** The genesis ID of the current network. */
28
- genesisId: string;
29
- /** The base64 genesis hash of the current network. */
30
- genesisHash: string;
31
- }
21
+ /** Params to get an app factory from `ClientManager`. */
22
+ export type ClientAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand'>>;
23
+ /** Params to get an app client by creator address and name from `ClientManager`. */
24
+ export type ClientResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand'>>;
25
+ /** Params to get an app client by ID from `ClientManager`. */
26
+ export type ClientAppClientParams = Expand<Omit<AppClientParams, 'algorand'>>;
27
+ /** Params to get an app client by network from `ClientManager`. */
28
+ export type ClientAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appId'>>;
29
+ /** Params to get a typed app client by creator address and name from `ClientManager`. */
30
+ export type ClientTypedAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>;
31
+ /** Params to get a typed app client by ID from `ClientManager`. */
32
+ export type ClientTypedAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>;
33
+ /** Params to get a typed app client by network from `ClientManager`. */
34
+ export type ClientTypedAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec' | 'appId'>>;
35
+ /** Params to get a typed app factory from `ClientManager`. */
36
+ export type ClientTypedAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand' | 'appSpec'>>;
32
37
  /** Exposes access to various API clients. */
33
38
  export declare class ClientManager {
34
39
  private _algod;
35
40
  private _indexer?;
36
41
  private _kmd?;
42
+ private _algorand?;
37
43
  /**
38
44
  * algosdk clients or config for interacting with the official Algorand APIs.
39
45
  * @param clientsOrConfig The clients or config to use
@@ -54,11 +60,13 @@ export declare class ClientManager {
54
60
  * const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })
55
61
  * ```
56
62
  */
57
- constructor(clientsOrConfig: AlgoConfig | AlgoSdkClients);
63
+ constructor(clientsOrConfig: AlgoConfig | AlgoSdkClients, algorandClient?: AlgorandClientInterface);
58
64
  /** Returns an algosdk Algod API client. */
59
65
  get algod(): algosdk.Algodv2;
60
66
  /** Returns an algosdk Indexer API client or throws an error if it's not been provided. */
61
67
  get indexer(): algosdk.Indexer;
68
+ /** Returns an algosdk Indexer API client or `undefined` if it's not been provided. */
69
+ get indexerIfPresent(): algosdk.Indexer | undefined;
62
70
  /** Returns an algosdk KMD API client or throws an error if it's not been provided. */
63
71
  get kmd(): algosdk.Kmd;
64
72
  private _getNetworkPromise;
@@ -127,28 +135,82 @@ export declare class ClientManager {
127
135
  */
128
136
  getTestNetDispenserFromEnvironment(params?: Omit<TestNetDispenserApiClientParams, 'authToken'>): TestNetDispenserApiClient;
129
137
  /**
130
- * Returns a new `ApplicationClient` client, resolving the app by creator address and name.
131
- * @param details The details to resolve the app by creator address and name
132
- * @param cachedAppLookup A cached app lookup that matches a name to on-chain details; either this is needed or indexer is required to be passed in to this manager on construction.
133
- * @returns The `ApplicationClient`
138
+ * Returns a new `AppFactory` client
139
+ * @example Basic example
140
+ * ```typescript
141
+ * const factory = algorand.client.getAppFactory({
142
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\/}',
143
+ * })
144
+ * ```
145
+ * @example Advanced example
146
+ * ```typescript
147
+ * const factory = algorand.client.getAppFactory({
148
+ * appSpec: parsedAppSpec_AppSpec_or_Arc56Contract,
149
+ * defaultSender: "SENDERADDRESS",
150
+ * appName: "OverriddenAppName",
151
+ * version: "2.0.0",
152
+ * updatable: true,
153
+ * deletable: false,
154
+ * deployTimeParams: { ONE: 1, TWO: 'value' }
155
+ * })
156
+ * ```
134
157
  */
135
- getAppClientByCreatorAndName(details: AppClientByCreatorAndNameDetails, cachedAppLookup?: AppLookup): ApplicationClient;
158
+ getAppFactory(params: ClientAppFactoryParams): AppFactory;
136
159
  /**
137
- * Returns a new `ApplicationClient` client, resolving the app by app ID.
138
- * @param details The details to resolve the app by ID
139
- * @returns The `ApplicationClient`
160
+ * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
161
+ * This method resolves the app ID by looking up the creator address and name
162
+ * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
163
+ * @param params The parameters to create the app client
164
+ * @example Basic
165
+ * ```typescript
166
+ * const appClient = algorand.client.getAppClientByCreatorAndName({
167
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
168
+ * // appId resolved by looking for app ID of named app by this creator
169
+ * creatorAddress: 'CREATORADDRESS',
170
+ * })
171
+ * ```
172
+ * @returns The `AppClient`
140
173
  */
141
- getAppClientById(details: AppClientByIdDetails): ApplicationClient;
174
+ getAppClientByCreatorAndName(params: ClientResolveAppClientByCreatorAndNameParams): Promise<AppClient>;
175
+ /**
176
+ * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
177
+ * @param params The parameters to create the app client
178
+ * @example Basic
179
+ * ```typescript
180
+ * const appClient = algorand.client.getAppClientById({
181
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
182
+ * appId: 12345n,
183
+ * })
184
+ * ```
185
+ * @returns The `AppClient`
186
+ */
187
+ getAppClientById(params: ClientAppClientParams): AppClient;
188
+ /**
189
+ * Returns a new `AppClient` client for managing calls and state for an ARC-56 app.
190
+ * This method resolves the app ID for the current network based on
191
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
192
+ *
193
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
194
+ * @param params The parameters to create the app client
195
+ * @example Basic
196
+ * ```typescript
197
+ * const appClient = algorand.client.getAppClientByNetwork({
198
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
199
+ * // appId resolved by using ARC-56 spec to find app ID for current network
200
+ * })
201
+ * ```
202
+ * @returns The `AppClient`
203
+ */
204
+ getAppClientByNetwork(params: ClientAppClientByNetworkParams): Promise<AppClient>;
142
205
  /**
143
206
  * Returns a new typed client, resolving the app by creator address and name.
144
207
  * @param typedClient The typed client type to use
145
- * @param details The details to resolve the app by creator address and name
146
- * @param cachedAppLookup A cached app lookup that matches a name to on-chain details; either this is needed or indexer is required to be passed in to this manager on construction.
147
- * @example Use name in ARC-32 app spec
208
+ * @param params The params to resolve the app by creator address and name
209
+ * @example Use name in ARC-32 / ARC-56 app spec
148
210
  * ```typescript
149
211
  * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {
150
212
  * creatorAddress: "CREATORADDRESS",
151
- * sender: alice,
213
+ * defaultSender: alice,
152
214
  * })
153
215
  * ```
154
216
  * @example Specify name
@@ -156,26 +218,55 @@ export declare class ClientManager {
156
218
  * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {
157
219
  * creatorAddress: "CREATORADDRESS",
158
220
  * name: "contract-name",
159
- * sender: alice,
221
+ * defaultSender: alice,
160
222
  * })
161
223
  * ```
162
224
  * @returns The typed client instance
163
225
  */
164
- getTypedAppClientByCreatorAndName<TClient>(typedClient: TypedAppClient<TClient>, details: TypedAppClientByCreatorAndNameDetails, cachedAppLookup?: AppLookup): TClient;
226
+ getTypedAppClientByCreatorAndName<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params: ClientTypedAppClientByCreatorAndNameParams): Promise<InstanceType<TClient>>;
165
227
  /**
166
228
  * Returns a new typed client, resolving the app by app ID.
167
229
  * @param typedClient The typed client type to use
168
- * @param details The details to resolve the app by ID
230
+ * @param params The params to resolve the app by ID
169
231
  * @example
170
232
  * ```typescript
171
233
  * const appClient = algorand.client.getTypedAppClientById(MyContractClient, {
172
- * id: 12345,
234
+ * appId: 12345n,
235
+ * defaultSender: alice,
236
+ * })
237
+ * ```
238
+ * @returns The typed client instance
239
+ */
240
+ getTypedAppClientById<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params: ClientTypedAppClientParams): InstanceType<TClient>;
241
+ /**
242
+ * Returns a new typed client, resolves the app ID for the current network based on
243
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
244
+ *
245
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
246
+ * @param typedClient The typed client type to use
247
+ * @param params The params to resolve the app by network
248
+ * @example
249
+ * ```typescript
250
+ * const appClient = algorand.client.getTypedAppClientByNetwork(MyContractClient, {
251
+ * defaultSender: alice,
252
+ * })
253
+ * ```
254
+ * @returns The typed client instance
255
+ */
256
+ getTypedAppClientByNetwork<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params?: ClientTypedAppClientByNetworkParams): Promise<InstanceType<TClient>>;
257
+ /**
258
+ * Returns a new typed app factory.
259
+ * @param typedFactory The typed factory type to use
260
+ * @param params The params to resolve the factory by
261
+ * @example
262
+ * ```typescript
263
+ * const appFactory = algorand.client.getTypedAppFactory(MyContractClient, {
173
264
  * sender: alice,
174
265
  * })
175
266
  * ```
176
267
  * @returns The typed client instance
177
268
  */
178
- getTypedAppClientById<TClient>(typedClient: TypedAppClient<TClient>, details: TypedAppClientByIdDetails): TClient;
269
+ getTypedAppFactory<TClient>(typedFactory: TypedAppFactory<TClient>, params?: ClientTypedAppFactoryParams): TClient;
179
270
  /**
180
271
  * Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)
181
272
  *
@@ -314,22 +405,13 @@ export declare class ClientManager {
314
405
  * Interface to identify a typed client that can be used to interact with an application.
315
406
  */
316
407
  export interface TypedAppClient<TClient> {
317
- new (details: AppDetails, algod: algosdk.Algodv2): TClient;
408
+ new (params: Omit<AppClientParams, 'appSpec'>): TClient;
409
+ fromNetwork(params: Omit<AppClientParams, 'appId' | 'appSpec'>): Promise<TClient>;
410
+ fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<TClient>;
318
411
  }
319
412
  /**
320
- * Details to resolve an app client by creator address and name.
321
- */
322
- export type AppClientByCreatorAndNameDetails = AppSpecAppDetailsBase & AppDetailsBase & Omit<ResolveAppByCreatorAndNameBase, 'findExistingUsing'>;
323
- /**
324
- * Details to resolve a typed app creator address and name.
413
+ * Interface to identify a typed factory that can be used to create and deploy an application.
325
414
  */
326
- export type TypedAppClientByCreatorAndNameDetails = AppDetailsBase & Omit<ResolveAppByCreatorAndNameBase, 'findExistingUsing'>;
327
- /**
328
- * Details to resolve an app client by app ID.
329
- */
330
- export type AppClientByIdDetails = AppSpecAppDetailsBase & AppDetailsBase & ResolveAppByIdBase;
331
- /**
332
- * Details to resolve a typed app by app ID.
333
- */
334
- export type TypedAppClientByIdDetails = AppDetailsBase & ResolveAppByIdBase;
335
- //# sourceMappingURL=client-manager.d.ts.map
415
+ export interface TypedAppFactory<TClient> {
416
+ new (params: Omit<AppFactoryParams, 'appSpec'>): TClient;
417
+ }