@algorandfoundation/algokit-utils 7.0.0-beta.2 → 7.0.0-beta.20

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 (352) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -25
  3. package/account/account.d.ts +1 -2
  4. package/account/account.js +6 -4
  5. package/account/account.js.map +1 -1
  6. package/account/account.mjs +6 -4
  7. package/account/account.mjs.map +1 -1
  8. package/account/get-account-config-from-environment.d.ts +0 -1
  9. package/account/get-account-config-from-environment.js.map +1 -1
  10. package/account/get-account-config-from-environment.mjs.map +1 -1
  11. package/account/get-account.d.ts +0 -1
  12. package/account/get-account.js.map +1 -1
  13. package/account/get-account.mjs.map +1 -1
  14. package/account/get-dispenser-account.d.ts +0 -1
  15. package/account/get-dispenser-account.js.map +1 -1
  16. package/account/get-dispenser-account.mjs.map +1 -1
  17. package/account/index.d.ts +0 -1
  18. package/account/mnemonic-account.d.ts +0 -1
  19. package/account/mnemonic-account.js.map +1 -1
  20. package/account/mnemonic-account.mjs.map +1 -1
  21. package/amount.d.ts +14 -5
  22. package/amount.js +6 -0
  23. package/amount.js.map +1 -1
  24. package/amount.mjs +6 -0
  25. package/amount.mjs.map +1 -1
  26. package/app-client.d.ts +15 -1
  27. package/app-client.js +15 -0
  28. package/app-client.js.map +1 -1
  29. package/app-client.mjs +15 -0
  30. package/app-client.mjs.map +1 -1
  31. package/app-deploy.d.ts +0 -1
  32. package/app-deploy.js +4 -6
  33. package/app-deploy.js.map +1 -1
  34. package/app-deploy.mjs +7 -9
  35. package/app-deploy.mjs.map +1 -1
  36. package/app.d.ts +10 -11
  37. package/app.js +15 -11
  38. package/app.js.map +1 -1
  39. package/app.mjs +15 -11
  40. package/app.mjs.map +1 -1
  41. package/asset.d.ts +3 -4
  42. package/asset.js +3 -6
  43. package/asset.js.map +1 -1
  44. package/asset.mjs +3 -6
  45. package/asset.mjs.map +1 -1
  46. package/config.d.ts +0 -1
  47. package/config.js.map +1 -1
  48. package/config.mjs.map +1 -1
  49. package/debugging/debugging.d.ts +3 -5
  50. package/debugging/debugging.js +4 -128
  51. package/debugging/debugging.js.map +1 -1
  52. package/debugging/debugging.mjs +4 -109
  53. package/debugging/debugging.mjs.map +1 -1
  54. package/debugging/index.d.ts +0 -2
  55. package/dispenser-client.d.ts +0 -1
  56. package/dispenser-client.js.map +1 -1
  57. package/dispenser-client.mjs.map +1 -1
  58. package/index.d.ts +6 -5
  59. package/index.js +48 -38
  60. package/index.js.map +1 -1
  61. package/index.mjs +6 -5
  62. package/index.mjs.map +1 -1
  63. package/indexer-lookup.d.ts +0 -1
  64. package/indexer-lookup.js.map +1 -1
  65. package/indexer-lookup.mjs.map +1 -1
  66. package/localnet/get-kmd-wallet-account.d.ts +0 -1
  67. package/localnet/get-kmd-wallet-account.js.map +1 -1
  68. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  69. package/localnet/get-localnet-dispenser-account.d.ts +0 -1
  70. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  71. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  72. package/localnet/get-or-create-kmd-wallet-account.d.ts +0 -1
  73. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  74. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  75. package/localnet/index.d.ts +0 -1
  76. package/localnet/is-localnet.d.ts +0 -1
  77. package/localnet/is-localnet.js.map +1 -1
  78. package/localnet/is-localnet.mjs.map +1 -1
  79. package/network-client.d.ts +0 -1
  80. package/network-client.js.map +1 -1
  81. package/network-client.mjs.map +1 -1
  82. package/package.json +2 -2
  83. package/testing/_asset.d.ts +0 -1
  84. package/testing/account.d.ts +0 -1
  85. package/testing/account.js.map +1 -1
  86. package/testing/account.mjs.map +1 -1
  87. package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
  88. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  89. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  90. package/testing/fixtures/algorand-fixture.d.ts +0 -1
  91. package/testing/fixtures/algorand-fixture.js +1 -1
  92. package/testing/fixtures/algorand-fixture.js.map +1 -1
  93. package/testing/fixtures/algorand-fixture.mjs +1 -1
  94. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  95. package/testing/fixtures/index.d.ts +0 -1
  96. package/testing/index.d.ts +0 -1
  97. package/testing/indexer.d.ts +0 -1
  98. package/testing/indexer.js.map +1 -1
  99. package/testing/indexer.mjs.map +1 -1
  100. package/testing/test-logger.d.ts +0 -1
  101. package/testing/test-logger.js +1 -3
  102. package/testing/test-logger.js.map +1 -1
  103. package/testing/test-logger.mjs +1 -3
  104. package/testing/test-logger.mjs.map +1 -1
  105. package/testing/transaction-logger.d.ts +0 -1
  106. package/testing/transaction-logger.js.map +1 -1
  107. package/testing/transaction-logger.mjs.map +1 -1
  108. package/transaction/index.d.ts +0 -1
  109. package/transaction/legacy-bridge.d.ts +5 -6
  110. package/transaction/legacy-bridge.js +1 -1
  111. package/transaction/legacy-bridge.js.map +1 -1
  112. package/transaction/legacy-bridge.mjs +4 -4
  113. package/transaction/legacy-bridge.mjs.map +1 -1
  114. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +0 -1
  115. package/transaction/perform-atomic-transaction-composer-simulate.js +1 -0
  116. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  117. package/transaction/perform-atomic-transaction-composer-simulate.mjs +1 -0
  118. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  119. package/transaction/transaction.d.ts +41 -6
  120. package/transaction/transaction.js +113 -61
  121. package/transaction/transaction.js.map +1 -1
  122. package/transaction/transaction.mjs +113 -62
  123. package/transaction/transaction.mjs.map +1 -1
  124. package/transfer/index.d.ts +0 -1
  125. package/transfer/transfer-algos.d.ts +1 -2
  126. package/transfer/transfer-algos.js +1 -1
  127. package/transfer/transfer-algos.js.map +1 -1
  128. package/transfer/transfer-algos.mjs +1 -1
  129. package/transfer/transfer-algos.mjs.map +1 -1
  130. package/transfer/transfer.d.ts +1 -2
  131. package/transfer/transfer.js +3 -3
  132. package/transfer/transfer.js.map +1 -1
  133. package/transfer/transfer.mjs +3 -3
  134. package/transfer/transfer.mjs.map +1 -1
  135. package/types/account-manager.d.ts +15 -7
  136. package/types/account-manager.js +27 -11
  137. package/types/account-manager.js.map +1 -1
  138. package/types/account-manager.mjs +29 -13
  139. package/types/account-manager.mjs.map +1 -1
  140. package/types/account.d.ts +9 -1
  141. package/types/account.js.map +1 -1
  142. package/types/account.mjs.map +1 -1
  143. package/types/algo-http-client-with-retry.d.ts +0 -1
  144. package/types/algo-http-client-with-retry.js.map +1 -1
  145. package/types/algo-http-client-with-retry.mjs.map +1 -1
  146. package/types/algorand-client-interface.d.ts +28 -0
  147. package/types/algorand-client-interface.js +3 -0
  148. package/types/algorand-client-interface.js.map +1 -0
  149. package/types/algorand-client-interface.mjs +2 -0
  150. package/types/algorand-client-interface.mjs.map +1 -0
  151. package/types/algorand-client-transaction-creator.d.ts +33 -34
  152. package/types/algorand-client-transaction-creator.js +31 -31
  153. package/types/algorand-client-transaction-creator.js.map +1 -1
  154. package/types/algorand-client-transaction-creator.mjs +31 -31
  155. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  156. package/types/algorand-client-transaction-sender.d.ts +31 -32
  157. package/types/algorand-client-transaction-sender.js +25 -9
  158. package/types/algorand-client-transaction-sender.js.map +1 -1
  159. package/types/algorand-client-transaction-sender.mjs +25 -9
  160. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  161. package/types/algorand-client.d.ts +13 -13
  162. package/types/algorand-client.js +10 -10
  163. package/types/algorand-client.js.map +1 -1
  164. package/types/algorand-client.mjs +12 -12
  165. package/types/algorand-client.mjs.map +1 -1
  166. package/types/amount.d.ts +10 -11
  167. package/types/amount.js +7 -7
  168. package/types/amount.js.map +1 -1
  169. package/types/amount.mjs +7 -7
  170. package/types/amount.mjs.map +1 -1
  171. package/types/app-arc56.d.ts +358 -0
  172. package/types/app-arc56.js +184 -0
  173. package/types/app-arc56.js.map +1 -0
  174. package/types/app-arc56.mjs +175 -0
  175. package/types/app-arc56.mjs.map +1 -0
  176. package/types/app-client.d.ts +1488 -8
  177. package/types/app-client.js +1000 -19
  178. package/types/app-client.js.map +1 -1
  179. package/types/app-client.mjs +1000 -20
  180. package/types/app-client.mjs.map +1 -1
  181. package/types/app-deployer.d.ts +19 -14
  182. package/types/app-deployer.js +25 -25
  183. package/types/app-deployer.js.map +1 -1
  184. package/types/app-deployer.mjs +27 -27
  185. package/types/app-deployer.mjs.map +1 -1
  186. package/types/app-factory.d.ts +846 -0
  187. package/types/app-factory.js +411 -0
  188. package/types/app-factory.js.map +1 -0
  189. package/types/app-factory.mjs +409 -0
  190. package/types/app-factory.mjs.map +1 -0
  191. package/types/app-manager.d.ts +12 -3
  192. package/types/app-manager.js +13 -15
  193. package/types/app-manager.js.map +1 -1
  194. package/types/app-manager.mjs +13 -15
  195. package/types/app-manager.mjs.map +1 -1
  196. package/types/app-spec.d.ts +2 -1
  197. package/types/app-spec.js +121 -0
  198. package/types/app-spec.js.map +1 -1
  199. package/types/app-spec.mjs +120 -0
  200. package/types/app-spec.mjs.map +1 -1
  201. package/types/app.d.ts +14 -9
  202. package/types/app.js.map +1 -1
  203. package/types/app.mjs.map +1 -1
  204. package/types/asset-manager.d.ts +7 -7
  205. package/types/asset-manager.js +5 -6
  206. package/types/asset-manager.js.map +1 -1
  207. package/types/asset-manager.mjs +5 -6
  208. package/types/asset-manager.mjs.map +1 -1
  209. package/types/asset.d.ts +0 -1
  210. package/types/async-event-emitter.d.ts +14 -0
  211. package/types/async-event-emitter.js +50 -0
  212. package/types/async-event-emitter.js.map +1 -0
  213. package/types/async-event-emitter.mjs +48 -0
  214. package/types/async-event-emitter.mjs.map +1 -0
  215. package/types/client-manager.d.ts +131 -51
  216. package/types/client-manager.js +143 -23
  217. package/types/client-manager.js.map +1 -1
  218. package/types/client-manager.mjs +144 -24
  219. package/types/client-manager.mjs.map +1 -1
  220. package/types/composer.d.ts +110 -37
  221. package/types/composer.js +139 -26
  222. package/types/composer.js.map +1 -1
  223. package/types/composer.mjs +140 -27
  224. package/types/composer.mjs.map +1 -1
  225. package/types/config.d.ts +3 -6
  226. package/types/config.js +5 -44
  227. package/types/config.js.map +1 -1
  228. package/types/config.mjs +5 -27
  229. package/types/config.mjs.map +1 -1
  230. package/types/debugging.d.ts +29 -101
  231. package/types/debugging.js +16 -109
  232. package/types/debugging.js.map +1 -1
  233. package/types/debugging.mjs +12 -107
  234. package/types/debugging.mjs.map +1 -1
  235. package/types/dispenser-client.d.ts +1 -2
  236. package/types/dispenser-client.js +6 -5
  237. package/types/dispenser-client.js.map +1 -1
  238. package/types/dispenser-client.mjs +6 -5
  239. package/types/dispenser-client.mjs.map +1 -1
  240. package/types/expand.d.ts +0 -1
  241. package/types/indexer.d.ts +0 -1
  242. package/types/indexer.js.map +1 -1
  243. package/types/indexer.mjs.map +1 -1
  244. package/types/kmd-account-manager.d.ts +0 -1
  245. package/types/kmd-account-manager.js +2 -2
  246. package/types/kmd-account-manager.js.map +1 -1
  247. package/types/kmd-account-manager.mjs +4 -4
  248. package/types/kmd-account-manager.mjs.map +1 -1
  249. package/types/lifecycle-events.d.ts +10 -0
  250. package/types/lifecycle-events.js +8 -0
  251. package/types/lifecycle-events.js.map +1 -0
  252. package/types/lifecycle-events.mjs +8 -0
  253. package/types/lifecycle-events.mjs.map +1 -0
  254. package/types/logging.d.ts +0 -1
  255. package/types/logging.js.map +1 -1
  256. package/types/logging.mjs.map +1 -1
  257. package/types/logic-error.d.ts +2 -4
  258. package/types/logic-error.js +3 -3
  259. package/types/logic-error.js.map +1 -1
  260. package/types/logic-error.mjs +3 -3
  261. package/types/logic-error.mjs.map +1 -1
  262. package/types/network-client.d.ts +13 -1
  263. package/types/network-client.js.map +1 -1
  264. package/types/network-client.mjs.map +1 -1
  265. package/types/testing.d.ts +3 -4
  266. package/types/transaction.d.ts +14 -4
  267. package/types/transfer.d.ts +0 -1
  268. package/types/urlTokenBaseHTTPClient.d.ts +0 -1
  269. package/types/urlTokenBaseHTTPClient.js +1 -1
  270. package/types/urlTokenBaseHTTPClient.js.map +1 -1
  271. package/types/urlTokenBaseHTTPClient.mjs +1 -1
  272. package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
  273. package/util.d.ts +2 -2
  274. package/util.js +11 -10
  275. package/util.js.map +1 -1
  276. package/util.mjs +11 -10
  277. package/util.mjs.map +1 -1
  278. package/account/account.d.ts.map +0 -1
  279. package/account/get-account-config-from-environment.d.ts.map +0 -1
  280. package/account/get-account.d.ts.map +0 -1
  281. package/account/get-dispenser-account.d.ts.map +0 -1
  282. package/account/index.d.ts.map +0 -1
  283. package/account/mnemonic-account.d.ts.map +0 -1
  284. package/amount.d.ts.map +0 -1
  285. package/app-client.d.ts.map +0 -1
  286. package/app-deploy.d.ts.map +0 -1
  287. package/app.d.ts.map +0 -1
  288. package/asset.d.ts.map +0 -1
  289. package/config.d.ts.map +0 -1
  290. package/debugging/debugging.d.ts.map +0 -1
  291. package/debugging/index.d.ts.map +0 -1
  292. package/debugging/simulate-and-persist-response.d.ts +0 -20
  293. package/debugging/simulate-and-persist-response.d.ts.map +0 -1
  294. package/debugging/simulate-and-persist-response.js +0 -108
  295. package/debugging/simulate-and-persist-response.js.map +0 -1
  296. package/debugging/simulate-and-persist-response.mjs +0 -89
  297. package/debugging/simulate-and-persist-response.mjs.map +0 -1
  298. package/dispenser-client.d.ts.map +0 -1
  299. package/index.d.ts.map +0 -1
  300. package/indexer-lookup.d.ts.map +0 -1
  301. package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
  302. package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
  303. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
  304. package/localnet/index.d.ts.map +0 -1
  305. package/localnet/is-localnet.d.ts.map +0 -1
  306. package/network-client.d.ts.map +0 -1
  307. package/testing/_asset.d.ts.map +0 -1
  308. package/testing/account.d.ts.map +0 -1
  309. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  310. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  311. package/testing/fixtures/index.d.ts.map +0 -1
  312. package/testing/index.d.ts.map +0 -1
  313. package/testing/indexer.d.ts.map +0 -1
  314. package/testing/test-logger.d.ts.map +0 -1
  315. package/testing/transaction-logger.d.ts.map +0 -1
  316. package/transaction/index.d.ts.map +0 -1
  317. package/transaction/legacy-bridge.d.ts.map +0 -1
  318. package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
  319. package/transaction/transaction.d.ts.map +0 -1
  320. package/transfer/index.d.ts.map +0 -1
  321. package/transfer/transfer-algos.d.ts.map +0 -1
  322. package/transfer/transfer.d.ts.map +0 -1
  323. package/types/account-manager.d.ts.map +0 -1
  324. package/types/account.d.ts.map +0 -1
  325. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  326. package/types/algorand-client-transaction-creator.d.ts.map +0 -1
  327. package/types/algorand-client-transaction-sender.d.ts.map +0 -1
  328. package/types/algorand-client.d.ts.map +0 -1
  329. package/types/amount.d.ts.map +0 -1
  330. package/types/app-client.d.ts.map +0 -1
  331. package/types/app-deployer.d.ts.map +0 -1
  332. package/types/app-manager.d.ts.map +0 -1
  333. package/types/app-spec.d.ts.map +0 -1
  334. package/types/app.d.ts.map +0 -1
  335. package/types/asset-manager.d.ts.map +0 -1
  336. package/types/asset.d.ts.map +0 -1
  337. package/types/client-manager.d.ts.map +0 -1
  338. package/types/composer.d.ts.map +0 -1
  339. package/types/config.d.ts.map +0 -1
  340. package/types/debugging.d.ts.map +0 -1
  341. package/types/dispenser-client.d.ts.map +0 -1
  342. package/types/expand.d.ts.map +0 -1
  343. package/types/indexer.d.ts.map +0 -1
  344. package/types/kmd-account-manager.d.ts.map +0 -1
  345. package/types/logging.d.ts.map +0 -1
  346. package/types/logic-error.d.ts.map +0 -1
  347. package/types/network-client.d.ts.map +0 -1
  348. package/types/testing.d.ts.map +0 -1
  349. package/types/transaction.d.ts.map +0 -1
  350. package/types/transfer.d.ts.map +0 -1
  351. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  352. package/util.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../src/types/config.ts"],"sourcesContent":[null],"names":["nullLogger","consoleLogger","isNode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA;MACa,eAAe,CAAA;AAG1B,IAAA,IAAI,wBAAwB,GAAA;AAC1B,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAA;KAC5C;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;KAC1B;AAED,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;KACzB;AAED,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;KAC/B;AAED,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA;KAC5B;AAED,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAA;KACrC;AAED,IAAA,IAAI,cAAc,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAA;KAClC;AAED;;;;AAIG;AACH,IAAA,SAAS,CAAC,gBAA0B,EAAA;QAClC,IAAI,gBAAgB,EAAE;AACpB,YAAA,OAAOA,wBAAU,CAAA;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAA;KACnB;AAED;;;AAGG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;AAC7B,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;AAClC,QAAA,IAAI;AACF,YAAA,I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AW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;SACxC;KACF;AAED;;;AAGG;AACH,IAAA,SAAS,CAAC,SAA0B,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;KAC/C;AACF;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../src/types/config.ts"],"sourcesContent":["import { AsyncEventEmitter } from './async-event-emitter'\nimport { Logger, consoleLogger, nullLogger } from './logging'\n\n/** The AlgoKit configuration type */\nexport interface Config {\n /** Logger */\n logger: Logger\n /** Whether or not debug mode is enabled */\n debug: boolean\n /** The path to the project root directory */\n projectRoot: string | null\n /** Indicates whether to trace all operations */\n traceAll: boolean\n /** The size of the trace buffer in megabytes */\n traceBufferSizeMb: number\n /** The maximum depth to search for a specific file */\n maxSearchDepth: number\n /**\n * **WARNING**: This is not production-ready due incompatability with rekeyed\n * accounts and simulate. This will eventually be enabled by default once\n * [this issue](https://github.com/algorand/go-algorand/issues/5914) is closed.\n *\n * Whether to enable populateAppCallResources in sendParams by default.\n * Default value is false.\n */\n populateAppCallResources: boolean\n\n events: AsyncEventEmitter\n}\n\n/** Updatable AlgoKit config */\nexport class UpdatableConfig implements Readonly<Config> {\n private config: Config\n\n get populateAppCallResources() {\n return this.config.populateAppCallResources\n }\n\n get logger() {\n return this.config.logger\n }\n\n get debug() {\n return this.config.debug\n }\n\n get projectRoot() {\n return this.config.projectRoot\n }\n\n get traceAll() {\n return this.config.traceAll\n }\n\n get traceBufferSizeMb() {\n return this.config.traceBufferSizeMb\n }\n\n get maxSearchDepth() {\n return this.config.maxSearchDepth\n }\n\n get events() {\n return this.config.events\n }\n\n /**\n * Returns the current logger, or the null logger if true is passed in to `returnNullLogger`\n * @param returnNullLogger Whether or not to return the null logger\n * @returns The requested logger\n */\n getLogger(returnNullLogger?: boolean) {\n if (returnNullLogger) {\n return nullLogger\n }\n\n return this.logger\n }\n\n /**\n * Temporarily run with debug set to true.\n * @param lambda A lambda expression with code to run with debug config set to true\n */\n withDebug(lambda: () => unknown) {\n const original = this.config.debug\n try {\n this.config.debug = true\n lambda()\n } finally {\n this.config.debug = original\n }\n }\n\n constructor() {\n this.config = {\n logger: consoleLogger,\n debug: false,\n projectRoot: null,\n traceAll: false,\n traceBufferSizeMb: 256,\n maxSearchDepth: 10,\n populateAppCallResources: false,\n events: new AsyncEventEmitter(),\n }\n }\n\n /**\n * Update the AlgoKit configuration with your own configuration settings\n * @param newConfig Partial or complete config to replace\n */\n configure(newConfig: Partial<Config>) {\n this.config = { ...this.config, ...newConfig }\n }\n}\n"],"names":["nullLogger","consoleLogger","AsyncEventEmitter"],"mappings":";;;;;AA8BA;MACa,eAAe,CAAA;AAG1B,IAAA,IAAI,wBAAwB,GAAA;AAC1B,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAA;KAC5C;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;KAC1B;AAED,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;KACzB;AAED,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;KAC/B;AAED,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA;KAC5B;AAED,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAA;KACrC;AAED,IAAA,IAAI,cAAc,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAA;KAClC;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;KAC1B;AAED;;;;AAIG;AACH,IAAA,SAAS,CAAC,gBAA0B,EAAA;QAClC,IAAI,gBAAgB,EAAE;AACpB,YAAA,OAAOA,wBAAU,CAAA;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAA;KACnB;AAED;;;AAGG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;AAC7B,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;AAClC,QAAA,IAAI;AACF,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;AACxB,YAAA,MAAM,EAAE,CAAA;SACT;gBAAS;AACR,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAA;SAC7B;KACF;AAED,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,MAAM,GAAG;AACZ,YAAA,MAAM,EAAEC,2BAAa;AACrB,YAAA,KAAK,EAAE,KAAK;AACZ,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,iBAAiB,EAAE,GAAG;AACtB,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,IAAIC,yCAAiB,EAAE;SAChC,CAAA;KACF;AAED;;;AAGG;AACH,IAAA,SAAS,CAAC,SAA0B,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;KAC/C;AACF;;;;"}
package/types/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { isNode } from '../util.mjs';
1
+ import { AsyncEventEmitter } from './async-event-emitter.mjs';
2
2
  import { nullLogger, consoleLogger } from './logging.mjs';
3
3
 
4
4
  /** Updatable AlgoKit config */
@@ -24,6 +24,9 @@ class UpdatableConfig {
24
24
  get maxSearchDepth() {
25
25
  return this.config.maxSearchDepth;
26
26
  }
27
+ get events() {
28
+ return this.config.events;
29
+ }
27
30
  /**
28
31
  * Returns the current logger, or the null logger if true is passed in to `returnNullLogger`
29
32
  * @param returnNullLogger Whether or not to return the null logger
@@ -58,33 +61,8 @@ class UpdatableConfig {
58
61
  traceBufferSizeMb: 256,
59
62
  maxSearchDepth: 10,
60
63
  populateAppCallResources: false,
64
+ events: new AsyncEventEmitter(),
61
65
  };
62
- if (isNode()) {
63
- this.configureProjectRoot();
64
- }
65
- }
66
- /**
67
- * Configures the project root by searching for a specific file within a depth limit.
68
- * This is only supported in a Node environment.
69
- */
70
- async configureProjectRoot() {
71
- if (!isNode()) {
72
- throw new Error('`configureProjectRoot` can only be called in Node.js environment.');
73
- }
74
- const fs = await import('fs');
75
- const path = await import('path');
76
- const _dirname = await import('path').then(async (path) => path.dirname(await import('url').then((url) => url.fileURLToPath(import.meta.url))));
77
- if (!_dirname) {
78
- return;
79
- }
80
- let currentPath = path.resolve(_dirname);
81
- for (let i = 0; i < this.config.maxSearchDepth; i++) {
82
- if (fs.existsSync(`${currentPath}/.algokit.toml`)) {
83
- this.config.projectRoot = currentPath;
84
- break;
85
- }
86
- currentPath = path.dirname(currentPath);
87
- }
88
66
  }
89
67
  /**
90
68
  * Update the AlgoKit configuration with your own configuration settings
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../src/types/config.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AA4BA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;MACa,eAAe,CAAA,CAAA;AAG1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,wBAAwB,CAAA,CAAA,CAAA,CAAA;AAC1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,OAAO,CAAI,CAAA,CAAA,CAAA,CAAC,CAAM,CAAA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0B,CAAA,CAAA,CAAA;AAClC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,CAAE,CAAA,CAAA,CAAA,CAAG,CAAI,CAAA,CAAA,CAAA,CAAC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,EAAE,CAAA;CAC/C,CAAA,CAAA,CAAA,CAAA;AACF,CAAA;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../src/types/config.ts"],"sourcesContent":["import { AsyncEventEmitter } from './async-event-emitter'\nimport { Logger, consoleLogger, nullLogger } from './logging'\n\n/** The AlgoKit configuration type */\nexport interface Config {\n /** Logger */\n logger: Logger\n /** Whether or not debug mode is enabled */\n debug: boolean\n /** The path to the project root directory */\n projectRoot: string | null\n /** Indicates whether to trace all operations */\n traceAll: boolean\n /** The size of the trace buffer in megabytes */\n traceBufferSizeMb: number\n /** The maximum depth to search for a specific file */\n maxSearchDepth: number\n /**\n * **WARNING**: This is not production-ready due incompatability with rekeyed\n * accounts and simulate. This will eventually be enabled by default once\n * [this issue](https://github.com/algorand/go-algorand/issues/5914) is closed.\n *\n * Whether to enable populateAppCallResources in sendParams by default.\n * Default value is false.\n */\n populateAppCallResources: boolean\n\n events: AsyncEventEmitter\n}\n\n/** Updatable AlgoKit config */\nexport class UpdatableConfig implements Readonly<Config> {\n private config: Config\n\n get populateAppCallResources() {\n return this.config.populateAppCallResources\n }\n\n get logger() {\n return this.config.logger\n }\n\n get debug() {\n return this.config.debug\n }\n\n get projectRoot() {\n return this.config.projectRoot\n }\n\n get traceAll() {\n return this.config.traceAll\n }\n\n get traceBufferSizeMb() {\n return this.config.traceBufferSizeMb\n }\n\n get maxSearchDepth() {\n return this.config.maxSearchDepth\n }\n\n get events() {\n return this.config.events\n }\n\n /**\n * Returns the current logger, or the null logger if true is passed in to `returnNullLogger`\n * @param returnNullLogger Whether or not to return the null logger\n * @returns The requested logger\n */\n getLogger(returnNullLogger?: boolean) {\n if (returnNullLogger) {\n return nullLogger\n }\n\n return this.logger\n }\n\n /**\n * Temporarily run with debug set to true.\n * @param lambda A lambda expression with code to run with debug config set to true\n */\n withDebug(lambda: () => unknown) {\n const original = this.config.debug\n try {\n this.config.debug = true\n lambda()\n } finally {\n this.config.debug = original\n }\n }\n\n constructor() {\n this.config = {\n logger: consoleLogger,\n debug: false,\n projectRoot: null,\n traceAll: false,\n traceBufferSizeMb: 256,\n maxSearchDepth: 10,\n populateAppCallResources: false,\n events: new AsyncEventEmitter(),\n }\n }\n\n /**\n * Update the AlgoKit configuration with your own configuration settings\n * @param newConfig Partial or complete config to replace\n */\n configure(newConfig: Partial<Config>) {\n this.config = { ...this.config, ...newConfig }\n }\n}\n"],"names":[],"mappings":";;;AA8BA;MACa,eAAe,CAAA;AAG1B,IAAA,IAAI,wBAAwB,GAAA;AAC1B,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAA;KAC5C;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;KAC1B;AAED,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;KACzB;AAED,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAA;KAC/B;AAED,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA;KAC5B;AAED,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAA;KACrC;AAED,IAAA,IAAI,cAAc,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAA;KAClC;AAED,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;KAC1B;AAED;;;;AAIG;AACH,IAAA,SAAS,CAAC,gBAA0B,EAAA;QAClC,IAAI,gBAAgB,EAAE;AACpB,YAAA,OAAO,UAAU,CAAA;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAA;KACnB;AAED;;;AAGG;AACH,IAAA,SAAS,CAAC,MAAqB,EAAA;AAC7B,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;AAClC,QAAA,IAAI;AACF,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;AACxB,YAAA,MAAM,EAAE,CAAA;SACT;gBAAS;AACR,YAAA,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAA;SAC7B;KACF;AAED,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,MAAM,GAAG;AACZ,YAAA,MAAM,EAAE,aAAa;AACrB,YAAA,KAAK,EAAE,KAAK;AACZ,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,iBAAiB,EAAE,GAAG;AACtB,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,wBAAwB,EAAE,KAAK;YAC/B,MAAM,EAAE,IAAI,iBAAiB,EAAE;SAChC,CAAA;KACF;AAED;;;AAGG;AACH,IAAA,SAAS,CAAC,SAA0B,EAAA;AAClC,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;KAC/C;AACF;;;;"}
@@ -1,112 +1,40 @@
1
- import algosdk from 'algosdk';
2
- import { CompiledTeal } from './app';
3
- /**
4
- * AVM debugger source map format.
5
- */
6
- export interface AVMDebuggerSourceMapDict {
7
- 'txn-group-sources': Array<{
8
- 'sourcemap-location': string;
9
- hash: string;
10
- }>;
11
- }
12
1
  /**
13
- * AVM debugger source map entry class.
2
+ * An asynchronous event listener
14
3
  */
15
- export declare class AVMDebuggerSourceMapEntry {
16
- location: string;
17
- programHash: string;
18
- /**
19
- * Create an AVM debugger source map entry.
20
- * @param location The location of the file the source map is for.
21
- * @param programHash The hash of the TEAL binary.
22
- */
23
- constructor(location: string, programHash: string);
24
- equals(other: AVMDebuggerSourceMapEntry): boolean;
25
- toString(): string;
26
- }
4
+ import algosdk from 'algosdk';
5
+ import { CompiledTeal } from './app';
6
+ /** The directory name for AlgoKit project related files */
7
+ export declare const ALGOKIT_DIR = ".algokit";
8
+ /** The directory name for debug source files */
9
+ export declare const SOURCES_DIR = "sources";
10
+ /** The file extension for TEAL files */
11
+ export declare const TEAL_FILE_EXT = ".teal";
12
+ /** The file extension for TEAL source map files */
13
+ export declare const TEAL_SOURCEMAP_EXT = ".teal.map";
14
+ /** The default maximum search depth for file operations */
15
+ export declare const DEFAULT_MAX_SEARCH_DEPTH = 10;
27
16
  /**
28
- * AVM debugger source map class.
17
+ * Represents the data for a single TEAL source
29
18
  */
30
- export declare class AVMDebuggerSourceMap {
31
- txnGroupSources: AVMDebuggerSourceMapEntry[];
32
- /**
33
- *
34
- * @param txnGroupSources
35
- */
36
- constructor(txnGroupSources: AVMDebuggerSourceMapEntry[]);
37
- /**
38
- * Creates a source map from a dictionary of source map data.
39
- * @param data The data
40
- * @returns The source map
41
- */
42
- static fromDict(data: AVMDebuggerSourceMapDict): AVMDebuggerSourceMap;
43
- /**
44
- * Converts the source map to a dictionary that can be passed around and then parsed back using `AVMDebuggerSourceMap.fromDict`.
45
- * @returns The dictionary
46
- */
47
- toDict(): AVMDebuggerSourceMapDict;
19
+ export interface TealSourceDebugEventData {
20
+ /** The name of the application */
21
+ appName: string;
22
+ /** The name of the file */
23
+ fileName: string;
24
+ /** The compiled TEAL code */
25
+ compiledTeal: CompiledTeal;
48
26
  }
49
27
  /**
50
- * Class representing a debugger source maps input for persistence.
51
- *
52
- * Note: rawTeal and compiledTeal are mutually exclusive. Only one of them should be provided.
28
+ * Represents the data for multiple TEAL sources debug events emitted whenever an app is compiled as part of a deploy in debug mode
53
29
  */
54
- export declare class PersistSourceMapInput {
55
- appName: string;
56
- compiledTeal?: CompiledTeal;
57
- private _fileName;
58
- private _rawTeal?;
59
- private constructor();
60
- /**
61
- * Returns debugger source maps input from raw TEAL code.
62
- * @param rawTeal The raw TEAL code
63
- * @param appName The name of the app
64
- * @param fileName The name of the file to persist to
65
- * @returns The persist source map input
66
- */
67
- static fromRawTeal(rawTeal: string, appName: string, fileName: string): PersistSourceMapInput;
68
- /**
69
- * Returns debugger source maps input from compiled TEAL code.
70
- * @param compiledTeal The compiled TEAL code
71
- * @param appName The name of the app
72
- * @param fileName The name of the file to persist to
73
- * @returns The persist source map input
74
- */
75
- static fromCompiledTeal(compiledTeal: CompiledTeal, appName: string, fileName: string): PersistSourceMapInput;
76
- /** Get the underlying raw teal */
77
- get rawTeal(): string;
78
- /** Get the file name */
79
- get fileName(): string;
80
- /**
81
- * Strips the '.teal' extension from a filename, if present.
82
- *
83
- * @param fileName - The filename to strip the extension from.
84
- * @returns The filename without the '.teal' extension.
85
- */
86
- private stripTealExtension;
87
- }
88
- /** Parameters to a call that persists source maps */
89
- export interface PersistSourceMapsParams {
90
- /** An array of PersistSourceMapInput objects. Each object can either contain rawTeal, in which case the function will execute a compile to obtain byte code, or it can accept an object of type CompiledTeal provided by algokit, which is used for source codes that have already been compiled and contain the traces. */
91
- sources: PersistSourceMapInput[];
92
- /** The root directory of the project. */
93
- projectRoot: string;
94
- /** An Algodv2 client to perform the compilation. */
95
- client: algosdk.Algodv2;
96
- /** A boolean indicating whether to include the source files in the output. */
97
- withSources?: boolean;
30
+ export interface TealSourcesDebugEventData {
31
+ /** An array of TEAL source debug event data */
32
+ sources: TealSourceDebugEventData[];
98
33
  }
99
34
  /**
100
- * Parameters to a call that simulates a transaction and persists the response.
35
+ * Represents the data for AVM traces debug events emitted whenever a transaction is simulated in debug mode
101
36
  */
102
- export interface SimulateAndPersistResponseParams {
103
- /** algod An Algodv2 client to perform the simulation. */
104
- algod: algosdk.Algodv2;
105
- /** The AtomicTransactionComposer with transaction(s) loaded. */
106
- atc: algosdk.AtomicTransactionComposer;
107
- /** projectRoot The root directory of the project. */
108
- projectRoot: string;
109
- /** bufferSizeMb The buffer size in megabytes. */
110
- bufferSizeMb: number;
37
+ export interface AVMTracesEventData {
38
+ /** The simulation response from Algod */
39
+ simulateResponse: algosdk.modelsv2.SimulateResponse;
111
40
  }
112
- //# sourceMappingURL=debugging.d.ts.map
@@ -1,115 +1,22 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * AVM debugger source map entry class.
4
+ * An asynchronous event listener
5
5
  */
6
- class AVMDebuggerSourceMapEntry {
7
- /**
8
- * Create an AVM debugger source map entry.
9
- * @param location The location of the file the source map is for.
10
- * @param programHash The hash of the TEAL binary.
11
- */
12
- constructor(location, programHash) {
13
- this.location = location;
14
- this.programHash = programHash;
15
- }
16
- equals(other) {
17
- return this.location === other.location && this.programHash === other.programHash;
18
- }
19
- toString() {
20
- return JSON.stringify({ 'sourcemap-location': this.location, hash: this.programHash });
21
- }
22
- }
23
- /**
24
- * AVM debugger source map class.
25
- */
26
- class AVMDebuggerSourceMap {
27
- /**
28
- *
29
- * @param txnGroupSources
30
- */
31
- constructor(txnGroupSources) {
32
- this.txnGroupSources = txnGroupSources;
33
- }
34
- /**
35
- * Creates a source map from a dictionary of source map data.
36
- * @param data The data
37
- * @returns The source map
38
- */
39
- static fromDict(data) {
40
- return new AVMDebuggerSourceMap(data['txn-group-sources'].map((item) => new AVMDebuggerSourceMapEntry(item['sourcemap-location'], item['hash'])));
41
- }
42
- /**
43
- * Converts the source map to a dictionary that can be passed around and then parsed back using `AVMDebuggerSourceMap.fromDict`.
44
- * @returns The dictionary
45
- */
46
- toDict() {
47
- return { 'txn-group-sources': this.txnGroupSources.map((item) => JSON.parse(item.toString())) };
48
- }
49
- }
50
- /**
51
- * Class representing a debugger source maps input for persistence.
52
- *
53
- * Note: rawTeal and compiledTeal are mutually exclusive. Only one of them should be provided.
54
- */
55
- class PersistSourceMapInput {
56
- constructor(appName, fileName, rawTeal, compiledTeal) {
57
- this.compiledTeal = compiledTeal;
58
- this.appName = appName;
59
- this._rawTeal = rawTeal;
60
- this._fileName = this.stripTealExtension(fileName);
61
- }
62
- /**
63
- * Returns debugger source maps input from raw TEAL code.
64
- * @param rawTeal The raw TEAL code
65
- * @param appName The name of the app
66
- * @param fileName The name of the file to persist to
67
- * @returns The persist source map input
68
- */
69
- static fromRawTeal(rawTeal, appName, fileName) {
70
- return new PersistSourceMapInput(appName, fileName, rawTeal);
71
- }
72
- /**
73
- * Returns debugger source maps input from compiled TEAL code.
74
- * @param compiledTeal The compiled TEAL code
75
- * @param appName The name of the app
76
- * @param fileName The name of the file to persist to
77
- * @returns The persist source map input
78
- */
79
- static fromCompiledTeal(compiledTeal, appName, fileName) {
80
- return new PersistSourceMapInput(appName, fileName, undefined, compiledTeal);
81
- }
82
- /** Get the underlying raw teal */
83
- get rawTeal() {
84
- if (this._rawTeal) {
85
- return this._rawTeal;
86
- }
87
- else if (this.compiledTeal) {
88
- return this.compiledTeal.teal;
89
- }
90
- else {
91
- throw new Error('No teal content found');
92
- }
93
- }
94
- /** Get the file name */
95
- get fileName() {
96
- return this._fileName;
97
- }
98
- /**
99
- * Strips the '.teal' extension from a filename, if present.
100
- *
101
- * @param fileName - The filename to strip the extension from.
102
- * @returns The filename without the '.teal' extension.
103
- */
104
- stripTealExtension(fileName) {
105
- if (fileName.endsWith('.teal')) {
106
- return fileName.slice(0, -5);
107
- }
108
- return fileName;
109
- }
110
- }
6
+ /** The directory name for AlgoKit project related files */
7
+ const ALGOKIT_DIR = '.algokit';
8
+ /** The directory name for debug source files */
9
+ const SOURCES_DIR = 'sources';
10
+ /** The file extension for TEAL files */
11
+ const TEAL_FILE_EXT = '.teal';
12
+ /** The file extension for TEAL source map files */
13
+ const TEAL_SOURCEMAP_EXT = '.teal.map';
14
+ /** The default maximum search depth for file operations */
15
+ const DEFAULT_MAX_SEARCH_DEPTH = 10;
111
16
 
112
- exports.AVMDebuggerSourceMap = AVMDebuggerSourceMap;
113
- exports.AVMDebuggerSourceMapEntry = AVMDebuggerSourceMapEntry;
114
- exports.PersistSourceMapInput = PersistSourceMapInput;
17
+ exports.ALGOKIT_DIR = ALGOKIT_DIR;
18
+ exports.DEFAULT_MAX_SEARCH_DEPTH = DEFAULT_MAX_SEARCH_DEPTH;
19
+ exports.SOURCES_DIR = SOURCES_DIR;
20
+ exports.TEAL_FILE_EXT = TEAL_FILE_EXT;
21
+ exports.TEAL_SOURCEMAP_EXT = TEAL_SOURCEMAP_EXT;
115
22
  //# sourceMappingURL=debugging.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debugging.js","sources":["../../src/types/debugging.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAaA;;AAEG;MACU,yBAAyB,CAAA;AACpC;;;;AAIG;IACH,WACS,CAAA,QAAgB,EAChB,WAAmB,EAAA;QADnB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;QAChB,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;KACxB;AAEJ,IAAA,MAAM,CAAC,KAAgC,EAAA;AACrC,QAAA,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,CAAA;KAClF;IAED,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,oBAAoB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;KACvF;AACF,CAAA;AAED;;AAEG;MACU,oBAAoB,CAAA;AAG/B;;;AAGG;AACH,IAAA,WAAA,CAAY,eAA4C,EAAA;AACtD,QAAA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ChB,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAA;SACrB;AAAM,aAAA,IAAI,IAAI,CAAC,YAAY,EAAE;AAC5B,YAAA,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAA;SAC9B;aAAM;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;SACzC;KACF;;AAGD,IAAA,IAAW,QAAQ,GAAA;QACjB,OAAO,IAAI,CAAC,SAAS,CAAA;KACtB;AAED;;;;;AAKG;AACK,IAAA,kBAAkB,CAAC,QAAgB,EAAA;AACzC,QAAA,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC9B,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;SAC7B;AACD,QAAA,OAAO,QAAQ,CAAA;KAChB;AACF;;;;;;"}
1
+ {"version":3,"file":"debugging.js","sources":["../../src/types/debugging.ts"],"sourcesContent":["/**\n * An asynchronous event listener\n */\n\nimport algosdk from 'algosdk'\nimport { CompiledTeal } from './app'\n\n/** The directory name for AlgoKit project related files */\nexport const ALGOKIT_DIR = '.algokit'\n\n/** The directory name for debug source files */\nexport const SOURCES_DIR = 'sources'\n\n/** The file extension for TEAL files */\nexport const TEAL_FILE_EXT = '.teal'\n\n/** The file extension for TEAL source map files */\nexport const TEAL_SOURCEMAP_EXT = '.teal.map'\n\n/** The default maximum search depth for file operations */\nexport const DEFAULT_MAX_SEARCH_DEPTH = 10\n\n/**\n * Represents the data for a single TEAL source\n */\nexport interface TealSourceDebugEventData {\n /** The name of the application */\n appName: string\n /** The name of the file */\n fileName: string\n /** The compiled TEAL code */\n compiledTeal: CompiledTeal\n}\n\n/**\n * Represents the data for multiple TEAL sources debug events emitted whenever an app is compiled as part of a deploy in debug mode\n */\nexport interface TealSourcesDebugEventData {\n /** An array of TEAL source debug event data */\n sources: TealSourceDebugEventData[]\n}\n\n/**\n * Represents the data for AVM traces debug events emitted whenever a transaction is simulated in debug mode\n */\nexport interface AVMTracesEventData {\n /** The simulation response from Algod */\n simulateResponse: algosdk.modelsv2.SimulateResponse\n}\n"],"names":[],"mappings":";;AAAA;;AAEG;AAKH;AACO,MAAM,WAAW,GAAG,WAAU;AAErC;AACO,MAAM,WAAW,GAAG,UAAS;AAEpC;AACO,MAAM,aAAa,GAAG,QAAO;AAEpC;AACO,MAAM,kBAAkB,GAAG,YAAW;AAE7C;AACO,MAAM,wBAAwB,GAAG;;;;;;;;"}
@@ -1,111 +1,16 @@
1
1
  /**
2
- * AVM debugger source map entry class.
2
+ * An asynchronous event listener
3
3
  */
4
- class AVMDebuggerSourceMapEntry {
5
- /**
6
- * Create an AVM debugger source map entry.
7
- * @param location The location of the file the source map is for.
8
- * @param programHash The hash of the TEAL binary.
9
- */
10
- constructor(location, programHash) {
11
- this.location = location;
12
- this.programHash = programHash;
13
- }
14
- equals(other) {
15
- return this.location === other.location && this.programHash === other.programHash;
16
- }
17
- toString() {
18
- return JSON.stringify({ 'sourcemap-location': this.location, hash: this.programHash });
19
- }
20
- }
21
- /**
22
- * AVM debugger source map class.
23
- */
24
- class AVMDebuggerSourceMap {
25
- /**
26
- *
27
- * @param txnGroupSources
28
- */
29
- constructor(txnGroupSources) {
30
- this.txnGroupSources = txnGroupSources;
31
- }
32
- /**
33
- * Creates a source map from a dictionary of source map data.
34
- * @param data The data
35
- * @returns The source map
36
- */
37
- static fromDict(data) {
38
- return new AVMDebuggerSourceMap(data['txn-group-sources'].map((item) => new AVMDebuggerSourceMapEntry(item['sourcemap-location'], item['hash'])));
39
- }
40
- /**
41
- * Converts the source map to a dictionary that can be passed around and then parsed back using `AVMDebuggerSourceMap.fromDict`.
42
- * @returns The dictionary
43
- */
44
- toDict() {
45
- return { 'txn-group-sources': this.txnGroupSources.map((item) => JSON.parse(item.toString())) };
46
- }
47
- }
48
- /**
49
- * Class representing a debugger source maps input for persistence.
50
- *
51
- * Note: rawTeal and compiledTeal are mutually exclusive. Only one of them should be provided.
52
- */
53
- class PersistSourceMapInput {
54
- constructor(appName, fileName, rawTeal, compiledTeal) {
55
- this.compiledTeal = compiledTeal;
56
- this.appName = appName;
57
- this._rawTeal = rawTeal;
58
- this._fileName = this.stripTealExtension(fileName);
59
- }
60
- /**
61
- * Returns debugger source maps input from raw TEAL code.
62
- * @param rawTeal The raw TEAL code
63
- * @param appName The name of the app
64
- * @param fileName The name of the file to persist to
65
- * @returns The persist source map input
66
- */
67
- static fromRawTeal(rawTeal, appName, fileName) {
68
- return new PersistSourceMapInput(appName, fileName, rawTeal);
69
- }
70
- /**
71
- * Returns debugger source maps input from compiled TEAL code.
72
- * @param compiledTeal The compiled TEAL code
73
- * @param appName The name of the app
74
- * @param fileName The name of the file to persist to
75
- * @returns The persist source map input
76
- */
77
- static fromCompiledTeal(compiledTeal, appName, fileName) {
78
- return new PersistSourceMapInput(appName, fileName, undefined, compiledTeal);
79
- }
80
- /** Get the underlying raw teal */
81
- get rawTeal() {
82
- if (this._rawTeal) {
83
- return this._rawTeal;
84
- }
85
- else if (this.compiledTeal) {
86
- return this.compiledTeal.teal;
87
- }
88
- else {
89
- throw new Error('No teal content found');
90
- }
91
- }
92
- /** Get the file name */
93
- get fileName() {
94
- return this._fileName;
95
- }
96
- /**
97
- * Strips the '.teal' extension from a filename, if present.
98
- *
99
- * @param fileName - The filename to strip the extension from.
100
- * @returns The filename without the '.teal' extension.
101
- */
102
- stripTealExtension(fileName) {
103
- if (fileName.endsWith('.teal')) {
104
- return fileName.slice(0, -5);
105
- }
106
- return fileName;
107
- }
108
- }
4
+ /** The directory name for AlgoKit project related files */
5
+ const ALGOKIT_DIR = '.algokit';
6
+ /** The directory name for debug source files */
7
+ const SOURCES_DIR = 'sources';
8
+ /** The file extension for TEAL files */
9
+ const TEAL_FILE_EXT = '.teal';
10
+ /** The file extension for TEAL source map files */
11
+ const TEAL_SOURCEMAP_EXT = '.teal.map';
12
+ /** The default maximum search depth for file operations */
13
+ const DEFAULT_MAX_SEARCH_DEPTH = 10;
109
14
 
110
- export { AVMDebuggerSourceMap, AVMDebuggerSourceMapEntry, PersistSourceMapInput };
15
+ export { ALGOKIT_DIR, DEFAULT_MAX_SEARCH_DEPTH, SOURCES_DIR, TEAL_FILE_EXT, TEAL_SOURCEMAP_EXT };
111
16
  //# sourceMappingURL=debugging.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"debugging.mjs","sources":["../../src/types/debugging.ts"],"sourcesContent":[null],"names":[],"mappings":"AAaA;;AAEG;MACU,yBAAyB,CAAA;AACpC;;;;AAIG;IACH,WACS,CAAA,QAAgB,EAChB,WAAmB,EAAA;QADnB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAQ;QAChB,IAAW,CAAA,WAAA,GAAX,WAAW,CAAQ;KACxB;AAEJ,IAAA,MAAM,CAAC,KAAgC,EAAA;AACrC,QAAA,OAAO,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,CAAA;KAClF;IAED,QAAQ,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,oBAAoB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;KACvF;AACF,CAAA;AAED;;AAEG;MACU,oBAAoB,CAAA;AAG/B;;;AAGG;AACH,IAAA,WAAA,CAAY,eAA4C,EAAA;AACtD,QAAA,IAAI,CAAC,eAAe,GAAG,eAAe,CAAA;KACvC;AAED;;;;AAIG;IACI,OAAO,QAAQ,CAAC,IAA8B,EAAA;AACnD,QAAA,OAAO,IAAI,oBAAoB,CAC7B,IAAI,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,yBAAyB,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CACjH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A;QACjB,OAAO,IAAI,CAAC,SAAS,CAAA;KACtB;AAED;;;;;AAKG;AACK,IAAA,kBAAkB,CAAC,QAAgB,EAAA;AACzC,QAAA,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC9B,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;SAC7B;AACD,QAAA,OAAO,QAAQ,CAAA;KAChB;AACF;;;;"}
1
+ {"version":3,"file":"debugging.mjs","sources":["../../src/types/debugging.ts"],"sourcesContent":["/**\n * An asynchronous event listener\n */\n\nimport algosdk from 'algosdk'\nimport { CompiledTeal } from './app'\n\n/** The directory name for AlgoKit project related files */\nexport const ALGOKIT_DIR = '.algokit'\n\n/** The directory name for debug source files */\nexport const SOURCES_DIR = 'sources'\n\n/** The file extension for TEAL files */\nexport const TEAL_FILE_EXT = '.teal'\n\n/** The file extension for TEAL source map files */\nexport const TEAL_SOURCEMAP_EXT = '.teal.map'\n\n/** The default maximum search depth for file operations */\nexport const DEFAULT_MAX_SEARCH_DEPTH = 10\n\n/**\n * Represents the data for a single TEAL source\n */\nexport interface TealSourceDebugEventData {\n /** The name of the application */\n appName: string\n /** The name of the file */\n fileName: string\n /** The compiled TEAL code */\n compiledTeal: CompiledTeal\n}\n\n/**\n * Represents the data for multiple TEAL sources debug events emitted whenever an app is compiled as part of a deploy in debug mode\n */\nexport interface TealSourcesDebugEventData {\n /** An array of TEAL source debug event data */\n sources: TealSourceDebugEventData[]\n}\n\n/**\n * Represents the data for AVM traces debug events emitted whenever a transaction is simulated in debug mode\n */\nexport interface AVMTracesEventData {\n /** The simulation response from Algod */\n simulateResponse: algosdk.modelsv2.SimulateResponse\n}\n"],"names":[],"mappings":"AAAA;;AAEG;AAKH;AACO,MAAM,WAAW,GAAG,WAAU;AAErC;AACO,MAAM,WAAW,GAAG,UAAS;AAEpC;AACO,MAAM,aAAa,GAAG,QAAO;AAEpC;AACO,MAAM,kBAAkB,GAAG,YAAW;AAE7C;AACO,MAAM,wBAAwB,GAAG;;;;"}
@@ -68,7 +68,7 @@ export declare class TestNetDispenserApiClient {
68
68
  *
69
69
  * @returns DispenserFundResponse: An object containing the transaction ID and funded amount.
70
70
  */
71
- fund(address: string, amount: number): Promise<DispenserFundResponse>;
71
+ fund(address: string, amount: number | bigint): Promise<DispenserFundResponse>;
72
72
  /**
73
73
  * Sends a refund request to the dispenser API for the specified refundTxnId.
74
74
  *
@@ -82,4 +82,3 @@ export declare class TestNetDispenserApiClient {
82
82
  */
83
83
  getLimit(): Promise<DispenserLimitResponse>;
84
84
  }
85
- //# sourceMappingURL=dispenser-client.d.ts.map
@@ -87,14 +87,15 @@ class TestNetDispenserApiClient {
87
87
  try {
88
88
  error_response = await response.json();
89
89
  }
90
- catch (err) {
90
+ catch {
91
91
  // suppress exception
92
92
  }
93
93
  if (error_response && error_response.code) {
94
94
  error_message = error_response.code;
95
95
  }
96
96
  else if (response.status === 400) {
97
- error_message = (await response.json()).message;
97
+ const errorResponse = (await response.json());
98
+ error_message = errorResponse.message;
98
99
  }
99
100
  throw new Error(error_message);
100
101
  }
@@ -109,8 +110,8 @@ class TestNetDispenserApiClient {
109
110
  * @returns DispenserFundResponse: An object containing the transaction ID and funded amount.
110
111
  */
111
112
  async fund(address, amount) {
112
- const response = await this.processDispenserRequest(this.authToken, `fund/${dispenserAssets[DispenserAssetName.Algo].assetId}`, { receiver: address, amount: amount, assetID: dispenserAssets[DispenserAssetName.Algo].assetId }, 'POST');
113
- const content = await response.json();
113
+ const response = await this.processDispenserRequest(this.authToken, `fund/${dispenserAssets[DispenserAssetName.Algo].assetId}`, { receiver: address, amount: Number(amount), assetID: dispenserAssets[DispenserAssetName.Algo].assetId }, 'POST');
114
+ const content = (await response.json());
114
115
  return { txId: content.txID, amount: content.amount };
115
116
  }
116
117
  /**
@@ -128,7 +129,7 @@ class TestNetDispenserApiClient {
128
129
  */
129
130
  async getLimit() {
130
131
  const response = await this.processDispenserRequest(this.authToken, `fund/${dispenserAssets[DispenserAssetName.Algo].assetId}/limit`, null, 'GET');
131
- const content = await response.json();
132
+ const content = (await response.json());
132
133
  return { amount: content.amount };
133
134
  }
134
135
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dispenser-client.js","sources":["../../src/types/dispenser-client.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA,MAAM,kBAAkB,GAAG,gDAAgD,CAAA;AAC3E,MAAM,iCAAiC,GAAG,EAAE,CAAA;AAC5C,MAAM,0BAA0B,GAAG,gCAAgC,CAAA;AAEnE,IAAK,kBAEJ,CAAA;AAFD,CAAA,UAAK,kBAAkB,EAAA;AACrB,IAAA,kBAAA,CAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ,CAAA;AACV,CAAC,EAFI,kBAAkB,KAAlB,kBAAkB,GAEtB,EAAA,CAAA,CAAA,CAAA;AAED,MAAM,eAAe,GAAG;AACtB,IAAA,CAAC,kBAAkB,CAAC,IAAI,GAAG;AACzB,QAAA,OAAO,EAAE,CAAC;AACV,QAAA,QAAQ,EAAE,CAAC;AACX,QAAA,WAAW,EAAE,MAAM;AACpB,KAAA;CACF,CAAA;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;MACU,yBAAyB,CAAA;AAIpC,IAAA,WAAA,CAAY,MAAwC,EAAA;QAClD,MAAM,gBAAgB,GAAG,OAAO,EAAE,GAAG,GAAG,0BAA0B,CAAC,CAAA;AAEnE,QAAA,IAAI,MAAM,EAAE,SAAS,EAAE;AACrB,YAAA,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,CAAA;SACnC;aAAM,IAAI,gBAAgB,EAAE;AAC3B,YAAA,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAA;SACnC;aAAM;AACL,YAAA,MAAM,IAAI,KAAK,CACb,wFAAwF,0BAA0B,CAAA,gCAAA,CAAkC,CACrJ,CAAA;SACF;QAED,IAAI,CAAC,eAAe,GAAG,MA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AAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;AAErC,QAAA,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;KAClC;AACF;;;;"}
1
+ {"version":3,"file":"dispenser-client.js","sources":["../../src/types/dispenser-client.ts"],"sourcesContent":["const DISPENSER_BASE_URL = 'https://api.dispenser.algorandfoundation.tools'\nconst DEFAULT_DISPENSER_REQUEST_TIMEOUT = 15\nconst DISPENSER_ACCESS_TOKEN_KEY = 'ALGOKIT_DISPENSER_ACCESS_TOKEN'\n\ninterface ErrorResponse {\n code?: string\n}\n\nenum DispenserAssetName {\n Algo = 0,\n}\n\nconst dispenserAssets = {\n [DispenserAssetName.Algo]: {\n assetId: 0,\n decimals: 6,\n description: 'Algo',\n },\n}\n\n/** The TestNet Dispenser API response when funding. */\nexport interface DispenserFundResponse {\n /** The ID of the transaction that was issued to fund the account. */\n txId: string\n /** The number of µAlgo that was funded. */\n amount: number\n}\n\n/** The TestNet Dispenser API response when getting the current limit. */\nexport interface DispenserLimitResponse {\n /** The limit, in µAlgo, that you can currently fund. */\n amount: number\n}\n\n/** The parameters to construct a TestNet Dispenser API client. */\nexport interface TestNetDispenserApiClientParams {\n /** The API auth token */\n authToken: string\n /** The request timeout in seconds */\n requestTimeout?: number\n}\n\n/**\n * `TestNetDispenserApiClient` is a class that provides methods to interact with the [Algorand TestNet Dispenser API](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md).\n * It allows you to fund an address with Algo, refund a transaction, and get the funding limit for the Algo asset.\n *\n * The class requires an authentication token and a request timeout to be initialized. The authentication token can be provided\n * either directly as a parameter or through an `ALGOKIT_DISPENSER_ACCESS_TOKEN` environment variable. If neither is provided, an error is thrown.\n *\n * The request timeout can be provided as a parameter. If not provided, a default value is used.\n *\n * @property {string} authToken - The authentication token used for API requests.\n * @property {number} requestTimeout - The timeout for API requests, in seconds.\n *\n * @method fund - Sends a funding request to the dispenser API to fund the specified address with the given amount of Algo.\n * @method refund - Sends a refund request to the dispenser API for the specified refundTxnId.\n * @method limit - Sends a request to the dispenser API to get the funding limit for the Algo asset.\n *\n * @example\n * ```typescript\n * const client = new TestNetDispenserApiClient({ authToken: 'your_auth_token', requestTimeout: 30 });\n * const fundResponse = await client.fund('your_address', 100);\n * const limitResponse = await client.getLimit();\n * await client.refund('your_transaction_id');\n * ```\n *\n * @throws {Error} If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the authToken parameter were provided.\n */\nexport class TestNetDispenserApiClient {\n private _authToken: string\n private _requestTimeout: number\n\n constructor(params?: TestNetDispenserApiClientParams) {\n const authTokenFromEnv = process?.env?.[DISPENSER_ACCESS_TOKEN_KEY]\n\n if (params?.authToken) {\n this._authToken = params.authToken\n } else if (authTokenFromEnv) {\n this._authToken = authTokenFromEnv\n } else {\n throw new Error(\n `Can't init AlgoKit TestNet Dispenser API client because neither environment variable ${DISPENSER_ACCESS_TOKEN_KEY} or the authToken were provided.`,\n )\n }\n\n this._requestTimeout = params?.requestTimeout || DEFAULT_DISPENSER_REQUEST_TIMEOUT\n }\n\n get authToken(): string {\n return this._authToken\n }\n\n get requestTimeout(): number {\n return this._requestTimeout\n }\n\n /**\n * Processes a dispenser API request.\n *\n * @param authToken - The authentication token.\n * @param urlSuffix - The URL suffix for the API request.\n * @param body - The request body.\n * @param method - The HTTP method.\n *\n * @returns The API response.\n */\n private async processDispenserRequest(\n authToken: string,\n urlSuffix: string,\n body: Record<string, string | number> | null = null,\n method = 'POST',\n ): Promise<Response> {\n const headers = { Authorization: `Bearer ${authToken}` }\n\n const requestArgs: RequestInit = {\n method: method,\n headers: headers,\n signal: AbortSignal.timeout(this.requestTimeout * 1000),\n }\n\n if (body) {\n requestArgs.body = JSON.stringify(body)\n }\n\n const response = await fetch(`${DISPENSER_BASE_URL}/${urlSuffix}`, requestArgs)\n if (!response.ok) {\n let error_message = `Error processing dispenser API request: ${response.status}`\n let error_response = null\n try {\n error_response = await response.json()\n } catch {\n // suppress exception\n }\n\n if (error_response && (error_response as ErrorResponse).code) {\n error_message = (error_response as ErrorResponse).code!\n } else if (response.status === 400) {\n const errorResponse = (await response.json()) as { message: string }\n error_message = errorResponse.message\n }\n\n throw new Error(error_message)\n }\n return response\n }\n\n /**\n * Sends a funding request to the dispenser API to fund the specified address with the given amount of Algo.\n *\n * @param address - The address to fund.\n * @param amount - The amount of µAlgo to fund.\n *\n * @returns DispenserFundResponse: An object containing the transaction ID and funded amount.\n */\n async fund(address: string, amount: number | bigint): Promise<DispenserFundResponse> {\n const response = await this.processDispenserRequest(\n this.authToken,\n `fund/${dispenserAssets[DispenserAssetName.Algo].assetId}`,\n { receiver: address, amount: Number(amount), assetID: dispenserAssets[DispenserAssetName.Algo].assetId },\n 'POST',\n )\n\n const content = (await response.json()) as { txID: string; amount: number }\n return { txId: content.txID, amount: content.amount }\n }\n\n /**\n * Sends a refund request to the dispenser API for the specified refundTxnId.\n *\n * @param refundTxnId - The transaction ID to refund.\n */\n async refund(refundTxnId: string): Promise<void> {\n await this.processDispenserRequest(this.authToken, 'refund', { refundTransactionID: refundTxnId }, 'POST')\n }\n\n /**\n * Sends a request to the dispenser API to get the funding limit for the Algo asset.\n *\n * @returns DispenserLimitResponse: An object containing the funding limit amount.\n */\n async getLimit(): Promise<DispenserLimitResponse> {\n const response = await this.processDispenserRequest(\n this.authToken,\n `fund/${dispenserAssets[DispenserAssetName.Algo].assetId}/limit`,\n null,\n 'GET',\n )\n const content = (await response.json()) as { amount: number }\n\n return { amount: content.amount }\n }\n}\n"],"names":[],"mappings":";;AAAA,MAAM,kBAAkB,GAAG,gDAAgD,CAAA;AAC3E,MAAM,iCAAiC,GAAG,EAAE,CAAA;AAC5C,MAAM,0BAA0B,GAAG,gCAAgC,CAAA;AAMnE,IAAK,kBAEJ,CAAA;AAFD,CAAA,UAAK,kBAAkB,EAAA;AACrB,IAAA,kBAAA,CAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,M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