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

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 (463) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -26
  3. package/account/account.d.ts +12 -10
  4. package/account/get-account-config-from-environment.d.ts +0 -1
  5. package/account/get-account.d.ts +2 -3
  6. package/account/get-dispenser-account.d.ts +2 -3
  7. package/account/index.d.ts +0 -1
  8. package/account/mnemonic-account.d.ts +1 -2
  9. package/amount.d.ts +15 -5
  10. package/app-client.d.ts +19 -5
  11. package/app-deploy.d.ts +18 -2
  12. package/app.d.ts +39 -3
  13. package/asset.d.ts +5 -6
  14. package/config.d.ts +0 -1
  15. package/debugging/debugging.d.ts +3 -5
  16. package/debugging/index.d.ts +0 -2
  17. package/dispenser-client.d.ts +0 -1
  18. package/index.d.ts +5 -4
  19. package/index.js +56 -46
  20. package/index.js.map +1 -1
  21. package/index.mjs +26 -25
  22. package/index.mjs.map +1 -1
  23. package/indexer-lookup.d.ts +10 -9
  24. package/localnet/get-kmd-wallet-account.d.ts +1 -2
  25. package/localnet/get-localnet-dispenser-account.d.ts +1 -2
  26. package/localnet/get-or-create-kmd-wallet-account.d.ts +1 -2
  27. package/localnet/index.d.ts +0 -1
  28. package/localnet/is-localnet.d.ts +1 -2
  29. package/network-client.d.ts +3 -10
  30. package/package.json +3 -4
  31. package/{account → src/account}/account.js +21 -18
  32. package/src/account/account.js.map +1 -0
  33. package/{account → src/account}/account.mjs +22 -19
  34. package/src/account/account.mjs.map +1 -0
  35. package/src/account/get-account-config-from-environment.js.map +1 -0
  36. package/src/account/get-account-config-from-environment.mjs.map +1 -0
  37. package/{account → src/account}/get-account.js +3 -3
  38. package/src/account/get-account.js.map +1 -0
  39. package/{account → src/account}/get-account.mjs +3 -3
  40. package/src/account/get-account.mjs.map +1 -0
  41. package/{account → src/account}/get-dispenser-account.js +3 -3
  42. package/src/account/get-dispenser-account.js.map +1 -0
  43. package/{account → src/account}/get-dispenser-account.mjs +3 -3
  44. package/src/account/get-dispenser-account.mjs.map +1 -0
  45. package/{account → src/account}/mnemonic-account.js +1 -1
  46. package/src/account/mnemonic-account.js.map +1 -0
  47. package/{account → src/account}/mnemonic-account.mjs +1 -1
  48. package/src/account/mnemonic-account.mjs.map +1 -0
  49. package/{amount.js → src/amount.js} +10 -3
  50. package/src/amount.js.map +1 -0
  51. package/{amount.mjs → src/amount.mjs} +10 -4
  52. package/src/amount.mjs.map +1 -0
  53. package/{app-client.js → src/app-client.js} +20 -5
  54. package/src/app-client.js.map +1 -0
  55. package/{app-client.mjs → src/app-client.mjs} +20 -5
  56. package/src/app-client.mjs.map +1 -0
  57. package/src/app-deploy.js +285 -0
  58. package/src/app-deploy.js.map +1 -0
  59. package/src/app-deploy.mjs +276 -0
  60. package/src/app-deploy.mjs.map +1 -0
  61. package/src/app.js +349 -0
  62. package/src/app.js.map +1 -0
  63. package/src/app.mjs +329 -0
  64. package/src/app.mjs.map +1 -0
  65. package/{asset.js → src/asset.js} +6 -9
  66. package/src/asset.js.map +1 -0
  67. package/{asset.mjs → src/asset.mjs} +6 -9
  68. package/src/asset.mjs.map +1 -0
  69. package/{config.js → src/config.js} +1 -1
  70. package/src/config.js.map +1 -0
  71. package/{config.mjs → src/config.mjs} +1 -1
  72. package/src/config.mjs.map +1 -0
  73. package/src/debugging/debugging.js +15 -0
  74. package/src/debugging/debugging.js.map +1 -0
  75. package/src/debugging/debugging.mjs +13 -0
  76. package/src/debugging/debugging.mjs.map +1 -0
  77. package/{dispenser-client.js → src/dispenser-client.js} +1 -1
  78. package/src/dispenser-client.js.map +1 -0
  79. package/{dispenser-client.mjs → src/dispenser-client.mjs} +1 -1
  80. package/src/dispenser-client.mjs.map +1 -0
  81. package/{indexer-lookup.js → src/indexer-lookup.js} +14 -10
  82. package/src/indexer-lookup.js.map +1 -0
  83. package/{indexer-lookup.mjs → src/indexer-lookup.mjs} +14 -10
  84. package/src/indexer-lookup.mjs.map +1 -0
  85. package/{localnet → src/localnet}/get-kmd-wallet-account.js +3 -3
  86. package/src/localnet/get-kmd-wallet-account.js.map +1 -0
  87. package/{localnet → src/localnet}/get-kmd-wallet-account.mjs +3 -3
  88. package/src/localnet/get-kmd-wallet-account.mjs.map +1 -0
  89. package/{localnet → src/localnet}/get-localnet-dispenser-account.js +3 -3
  90. package/src/localnet/get-localnet-dispenser-account.js.map +1 -0
  91. package/{localnet → src/localnet}/get-localnet-dispenser-account.mjs +3 -3
  92. package/src/localnet/get-localnet-dispenser-account.mjs.map +1 -0
  93. package/{localnet → src/localnet}/get-or-create-kmd-wallet-account.js +3 -3
  94. package/src/localnet/get-or-create-kmd-wallet-account.js.map +1 -0
  95. package/{localnet → src/localnet}/get-or-create-kmd-wallet-account.mjs +3 -3
  96. package/src/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -0
  97. package/{localnet → src/localnet}/is-localnet.js +2 -2
  98. package/src/localnet/is-localnet.js.map +1 -0
  99. package/{localnet → src/localnet}/is-localnet.mjs +2 -2
  100. package/src/localnet/is-localnet.mjs.map +1 -0
  101. package/{network-client.js → src/network-client.js} +5 -12
  102. package/src/network-client.js.map +1 -0
  103. package/{network-client.mjs → src/network-client.mjs} +5 -12
  104. package/src/network-client.mjs.map +1 -0
  105. package/{testing → src/testing}/account.js +9 -3
  106. package/src/testing/account.js.map +1 -0
  107. package/{testing → src/testing}/account.mjs +10 -4
  108. package/src/testing/account.mjs.map +1 -0
  109. package/src/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  110. package/src/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -0
  111. package/{testing → src/testing}/fixtures/algorand-fixture.js +15 -16
  112. package/src/testing/fixtures/algorand-fixture.js.map +1 -0
  113. package/{testing → src/testing}/fixtures/algorand-fixture.mjs +15 -16
  114. package/src/testing/fixtures/algorand-fixture.mjs.map +1 -0
  115. package/src/testing/indexer.js.map +1 -0
  116. package/src/testing/indexer.mjs.map +1 -0
  117. package/{testing → src/testing}/test-logger.js +7 -3
  118. package/src/testing/test-logger.js.map +1 -0
  119. package/{testing → src/testing}/test-logger.mjs +7 -3
  120. package/src/testing/test-logger.mjs.map +1 -0
  121. package/src/testing/transaction-logger.js.map +1 -0
  122. package/src/testing/transaction-logger.mjs.map +1 -0
  123. package/src/transaction/legacy-bridge.js +129 -0
  124. package/src/transaction/legacy-bridge.js.map +1 -0
  125. package/src/transaction/legacy-bridge.mjs +124 -0
  126. package/src/transaction/legacy-bridge.mjs.map +1 -0
  127. package/{transaction → src/transaction}/perform-atomic-transaction-composer-simulate.js +14 -9
  128. package/src/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -0
  129. package/{transaction → src/transaction}/perform-atomic-transaction-composer-simulate.mjs +15 -10
  130. package/src/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -0
  131. package/{transaction → src/transaction}/transaction.js +217 -137
  132. package/src/transaction/transaction.js.map +1 -0
  133. package/{transaction → src/transaction}/transaction.mjs +218 -138
  134. package/src/transaction/transaction.mjs.map +1 -0
  135. package/{transfer → src/transfer}/transfer-algos.js +1 -1
  136. package/src/transfer/transfer-algos.js.map +1 -0
  137. package/{transfer → src/transfer}/transfer-algos.mjs +1 -1
  138. package/src/transfer/transfer-algos.mjs.map +1 -0
  139. package/{transfer → src/transfer}/transfer.js +8 -6
  140. package/src/transfer/transfer.js.map +1 -0
  141. package/{transfer → src/transfer}/transfer.mjs +8 -6
  142. package/src/transfer/transfer.mjs.map +1 -0
  143. package/{util.js → src/util.js} +11 -10
  144. package/src/util.js.map +1 -0
  145. package/{util.mjs → src/util.mjs} +11 -10
  146. package/src/util.mjs.map +1 -0
  147. package/testing/_asset.d.ts +2 -2
  148. package/testing/account.d.ts +4 -4
  149. package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
  150. package/testing/fixtures/algorand-fixture.d.ts +0 -1
  151. package/testing/fixtures/index.d.ts +0 -1
  152. package/testing/index.d.ts +0 -1
  153. package/testing/index.js +6 -6
  154. package/testing/index.mjs +6 -6
  155. package/testing/indexer.d.ts +0 -1
  156. package/testing/test-logger.d.ts +0 -1
  157. package/testing/transaction-logger.d.ts +0 -1
  158. package/transaction/index.d.ts +0 -1
  159. package/transaction/legacy-bridge.d.ts +31 -6
  160. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +4 -2
  161. package/transaction/transaction.d.ts +38 -19
  162. package/transfer/index.d.ts +0 -1
  163. package/transfer/transfer-algos.d.ts +1 -2
  164. package/transfer/transfer.d.ts +1 -2
  165. package/types/account-manager.d.ts +33 -25
  166. package/types/account-manager.js +56 -33
  167. package/types/account-manager.js.map +1 -1
  168. package/types/account-manager.mjs +58 -35
  169. package/types/account-manager.mjs.map +1 -1
  170. package/types/account.d.ts +17 -9
  171. package/types/account.js +2 -2
  172. package/types/account.js.map +1 -1
  173. package/types/account.mjs +3 -3
  174. package/types/account.mjs.map +1 -1
  175. package/types/algo-http-client-with-retry.d.ts +1 -3
  176. package/types/algo-http-client-with-retry.js +34 -4
  177. package/types/algo-http-client-with-retry.js.map +1 -1
  178. package/types/algo-http-client-with-retry.mjs +33 -3
  179. package/types/algo-http-client-with-retry.mjs.map +1 -1
  180. package/types/algorand-client-interface.d.ts +28 -0
  181. package/types/algorand-client-interface.js +3 -0
  182. package/types/algorand-client-interface.js.map +1 -0
  183. package/types/algorand-client-interface.mjs +2 -0
  184. package/types/algorand-client-interface.mjs.map +1 -0
  185. package/types/algorand-client-transaction-creator.d.ts +452 -23
  186. package/types/algorand-client-transaction-creator.js +407 -23
  187. package/types/algorand-client-transaction-creator.js.map +1 -1
  188. package/types/algorand-client-transaction-creator.mjs +407 -23
  189. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  190. package/types/algorand-client-transaction-sender.d.ts +772 -47
  191. package/types/algorand-client-transaction-sender.js +446 -16
  192. package/types/algorand-client-transaction-sender.js.map +1 -1
  193. package/types/algorand-client-transaction-sender.mjs +446 -16
  194. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  195. package/types/algorand-client.d.ts +24 -17
  196. package/types/algorand-client.js +26 -16
  197. package/types/algorand-client.js.map +1 -1
  198. package/types/algorand-client.mjs +28 -15
  199. package/types/algorand-client.mjs.map +1 -1
  200. package/types/amount.d.ts +10 -11
  201. package/types/amount.js +7 -7
  202. package/types/amount.js.map +1 -1
  203. package/types/amount.mjs +7 -7
  204. package/types/amount.mjs.map +1 -1
  205. package/types/app-arc56.d.ts +359 -0
  206. package/types/app-arc56.js +184 -0
  207. package/types/app-arc56.js.map +1 -0
  208. package/types/app-arc56.mjs +175 -0
  209. package/types/app-arc56.mjs.map +1 -0
  210. package/types/app-client.d.ts +1508 -12
  211. package/types/app-client.js +1023 -34
  212. package/types/app-client.js.map +1 -1
  213. package/types/app-client.mjs +1024 -36
  214. package/types/app-client.mjs.map +1 -1
  215. package/types/app-deployer.d.ts +126 -0
  216. package/types/app-deployer.js +353 -0
  217. package/types/app-deployer.js.map +1 -0
  218. package/types/app-deployer.mjs +351 -0
  219. package/types/app-deployer.mjs.map +1 -0
  220. package/types/app-factory.d.ts +846 -0
  221. package/types/app-factory.js +410 -0
  222. package/types/app-factory.js.map +1 -0
  223. package/types/app-factory.mjs +408 -0
  224. package/types/app-factory.mjs.map +1 -0
  225. package/types/app-manager.d.ts +244 -0
  226. package/types/app-manager.js +423 -0
  227. package/types/app-manager.js.map +1 -0
  228. package/types/app-manager.mjs +421 -0
  229. package/types/app-manager.mjs.map +1 -0
  230. package/types/app-spec.d.ts +2 -1
  231. package/types/app-spec.js +127 -0
  232. package/types/app-spec.js.map +1 -1
  233. package/types/app-spec.mjs +126 -0
  234. package/types/app-spec.mjs.map +1 -1
  235. package/types/app.d.ts +57 -18
  236. package/types/app.js +1 -1
  237. package/types/app.js.map +1 -1
  238. package/types/app.mjs +1 -1
  239. package/types/app.mjs.map +1 -1
  240. package/types/asset-manager.d.ts +10 -10
  241. package/types/asset-manager.js +15 -19
  242. package/types/asset-manager.js.map +1 -1
  243. package/types/asset-manager.mjs +15 -19
  244. package/types/asset-manager.mjs.map +1 -1
  245. package/types/asset.d.ts +0 -1
  246. package/types/async-event-emitter.d.ts +14 -0
  247. package/types/async-event-emitter.js +50 -0
  248. package/types/async-event-emitter.js.map +1 -0
  249. package/types/async-event-emitter.mjs +48 -0
  250. package/types/async-event-emitter.mjs.map +1 -0
  251. package/types/client-manager.d.ts +135 -60
  252. package/types/client-manager.js +158 -44
  253. package/types/client-manager.js.map +1 -1
  254. package/types/client-manager.mjs +159 -45
  255. package/types/client-manager.mjs.map +1 -1
  256. package/types/composer.d.ts +271 -87
  257. package/types/composer.js +406 -126
  258. package/types/composer.js.map +1 -1
  259. package/types/composer.mjs +407 -125
  260. package/types/composer.mjs.map +1 -1
  261. package/types/config.d.ts +3 -6
  262. package/types/config.js +5 -44
  263. package/types/config.js.map +1 -1
  264. package/types/config.mjs +5 -27
  265. package/types/config.mjs.map +1 -1
  266. package/types/debugging.d.ts +29 -101
  267. package/types/debugging.js +16 -109
  268. package/types/debugging.js.map +1 -1
  269. package/types/debugging.mjs +12 -107
  270. package/types/debugging.mjs.map +1 -1
  271. package/types/dispenser-client.d.ts +2 -2
  272. package/types/dispenser-client.js +10 -5
  273. package/types/dispenser-client.js.map +1 -1
  274. package/types/dispenser-client.mjs +10 -5
  275. package/types/dispenser-client.mjs.map +1 -1
  276. package/types/expand.d.ts +7 -0
  277. package/types/expand.js +3 -0
  278. package/types/expand.js.map +1 -0
  279. package/types/expand.mjs +2 -0
  280. package/types/expand.mjs.map +1 -0
  281. package/types/indexer.d.ts +74 -756
  282. package/types/indexer.js.map +1 -1
  283. package/types/indexer.mjs.map +1 -1
  284. package/types/kmd-account-manager.d.ts +2 -3
  285. package/types/kmd-account-manager.js +4 -4
  286. package/types/kmd-account-manager.js.map +1 -1
  287. package/types/kmd-account-manager.mjs +5 -5
  288. package/types/kmd-account-manager.mjs.map +1 -1
  289. package/types/lifecycle-events.d.ts +10 -0
  290. package/types/lifecycle-events.js +8 -0
  291. package/types/lifecycle-events.js.map +1 -0
  292. package/types/lifecycle-events.mjs +8 -0
  293. package/types/lifecycle-events.mjs.map +1 -0
  294. package/types/logging.d.ts +0 -1
  295. package/types/logging.js.map +1 -1
  296. package/types/logging.mjs.map +1 -1
  297. package/types/logic-error.d.ts +2 -4
  298. package/types/logic-error.js +3 -3
  299. package/types/logic-error.js.map +1 -1
  300. package/types/logic-error.mjs +3 -3
  301. package/types/logic-error.mjs.map +1 -1
  302. package/types/network-client.d.ts +14 -2
  303. package/types/network-client.js.map +1 -1
  304. package/types/network-client.mjs.map +1 -1
  305. package/types/testing.d.ts +8 -10
  306. package/types/transaction.d.ts +17 -4
  307. package/types/transfer.d.ts +0 -1
  308. package/util.d.ts +2 -2
  309. package/account/account.d.ts.map +0 -1
  310. package/account/account.js.map +0 -1
  311. package/account/account.mjs.map +0 -1
  312. package/account/get-account-config-from-environment.d.ts.map +0 -1
  313. package/account/get-account-config-from-environment.js.map +0 -1
  314. package/account/get-account-config-from-environment.mjs.map +0 -1
  315. package/account/get-account.d.ts.map +0 -1
  316. package/account/get-account.js.map +0 -1
  317. package/account/get-account.mjs.map +0 -1
  318. package/account/get-dispenser-account.d.ts.map +0 -1
  319. package/account/get-dispenser-account.js.map +0 -1
  320. package/account/get-dispenser-account.mjs.map +0 -1
  321. package/account/index.d.ts.map +0 -1
  322. package/account/mnemonic-account.d.ts.map +0 -1
  323. package/account/mnemonic-account.js.map +0 -1
  324. package/account/mnemonic-account.mjs.map +0 -1
  325. package/amount.d.ts.map +0 -1
  326. package/amount.js.map +0 -1
  327. package/amount.mjs.map +0 -1
  328. package/app-client.d.ts.map +0 -1
  329. package/app-client.js.map +0 -1
  330. package/app-client.mjs.map +0 -1
  331. package/app-deploy.d.ts.map +0 -1
  332. package/app-deploy.js +0 -468
  333. package/app-deploy.js.map +0 -1
  334. package/app-deploy.mjs +0 -459
  335. package/app-deploy.mjs.map +0 -1
  336. package/app.d.ts.map +0 -1
  337. package/app.js +0 -599
  338. package/app.js.map +0 -1
  339. package/app.mjs +0 -579
  340. package/app.mjs.map +0 -1
  341. package/asset.d.ts.map +0 -1
  342. package/asset.js.map +0 -1
  343. package/asset.mjs.map +0 -1
  344. package/config.d.ts.map +0 -1
  345. package/config.js.map +0 -1
  346. package/config.mjs.map +0 -1
  347. package/debugging/debugging.d.ts.map +0 -1
  348. package/debugging/debugging.js +0 -139
  349. package/debugging/debugging.js.map +0 -1
  350. package/debugging/debugging.mjs +0 -118
  351. package/debugging/debugging.mjs.map +0 -1
  352. package/debugging/index.d.ts.map +0 -1
  353. package/debugging/simulate-and-persist-response.d.ts +0 -20
  354. package/debugging/simulate-and-persist-response.d.ts.map +0 -1
  355. package/debugging/simulate-and-persist-response.js +0 -108
  356. package/debugging/simulate-and-persist-response.js.map +0 -1
  357. package/debugging/simulate-and-persist-response.mjs +0 -89
  358. package/debugging/simulate-and-persist-response.mjs.map +0 -1
  359. package/dispenser-client.d.ts.map +0 -1
  360. package/dispenser-client.js.map +0 -1
  361. package/dispenser-client.mjs.map +0 -1
  362. package/index.d.ts.map +0 -1
  363. package/indexer-lookup.d.ts.map +0 -1
  364. package/indexer-lookup.js.map +0 -1
  365. package/indexer-lookup.mjs.map +0 -1
  366. package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
  367. package/localnet/get-kmd-wallet-account.js.map +0 -1
  368. package/localnet/get-kmd-wallet-account.mjs.map +0 -1
  369. package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
  370. package/localnet/get-localnet-dispenser-account.js.map +0 -1
  371. package/localnet/get-localnet-dispenser-account.mjs.map +0 -1
  372. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
  373. package/localnet/get-or-create-kmd-wallet-account.js.map +0 -1
  374. package/localnet/get-or-create-kmd-wallet-account.mjs.map +0 -1
  375. package/localnet/index.d.ts.map +0 -1
  376. package/localnet/is-localnet.d.ts.map +0 -1
  377. package/localnet/is-localnet.js.map +0 -1
  378. package/localnet/is-localnet.mjs.map +0 -1
  379. package/network-client.d.ts.map +0 -1
  380. package/network-client.js.map +0 -1
  381. package/network-client.mjs.map +0 -1
  382. package/testing/_asset.d.ts.map +0 -1
  383. package/testing/account.d.ts.map +0 -1
  384. package/testing/account.js.map +0 -1
  385. package/testing/account.mjs.map +0 -1
  386. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  387. package/testing/fixtures/algokit-log-capture-fixture.js.map +0 -1
  388. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +0 -1
  389. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  390. package/testing/fixtures/algorand-fixture.js.map +0 -1
  391. package/testing/fixtures/algorand-fixture.mjs.map +0 -1
  392. package/testing/fixtures/index.d.ts.map +0 -1
  393. package/testing/index.d.ts.map +0 -1
  394. package/testing/indexer.d.ts.map +0 -1
  395. package/testing/indexer.js.map +0 -1
  396. package/testing/indexer.mjs.map +0 -1
  397. package/testing/test-logger.d.ts.map +0 -1
  398. package/testing/test-logger.js.map +0 -1
  399. package/testing/test-logger.mjs.map +0 -1
  400. package/testing/transaction-logger.d.ts.map +0 -1
  401. package/testing/transaction-logger.js.map +0 -1
  402. package/testing/transaction-logger.mjs.map +0 -1
  403. package/transaction/index.d.ts.map +0 -1
  404. package/transaction/legacy-bridge.d.ts.map +0 -1
  405. package/transaction/legacy-bridge.js +0 -35
  406. package/transaction/legacy-bridge.js.map +0 -1
  407. package/transaction/legacy-bridge.mjs +0 -33
  408. package/transaction/legacy-bridge.mjs.map +0 -1
  409. package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
  410. package/transaction/perform-atomic-transaction-composer-simulate.js.map +0 -1
  411. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +0 -1
  412. package/transaction/transaction.d.ts.map +0 -1
  413. package/transaction/transaction.js.map +0 -1
  414. package/transaction/transaction.mjs.map +0 -1
  415. package/transfer/index.d.ts.map +0 -1
  416. package/transfer/transfer-algos.d.ts.map +0 -1
  417. package/transfer/transfer-algos.js.map +0 -1
  418. package/transfer/transfer-algos.mjs.map +0 -1
  419. package/transfer/transfer.d.ts.map +0 -1
  420. package/transfer/transfer.js.map +0 -1
  421. package/transfer/transfer.mjs.map +0 -1
  422. package/types/account-manager.d.ts.map +0 -1
  423. package/types/account.d.ts.map +0 -1
  424. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  425. package/types/algorand-client-transaction-creator.d.ts.map +0 -1
  426. package/types/algorand-client-transaction-sender.d.ts.map +0 -1
  427. package/types/algorand-client.d.ts.map +0 -1
  428. package/types/amount.d.ts.map +0 -1
  429. package/types/app-client.d.ts.map +0 -1
  430. package/types/app-spec.d.ts.map +0 -1
  431. package/types/app.d.ts.map +0 -1
  432. package/types/asset-manager.d.ts.map +0 -1
  433. package/types/asset.d.ts.map +0 -1
  434. package/types/client-manager.d.ts.map +0 -1
  435. package/types/composer.d.ts.map +0 -1
  436. package/types/config.d.ts.map +0 -1
  437. package/types/debugging.d.ts.map +0 -1
  438. package/types/dispenser-client.d.ts.map +0 -1
  439. package/types/indexer.d.ts.map +0 -1
  440. package/types/kmd-account-manager.d.ts.map +0 -1
  441. package/types/logging.d.ts.map +0 -1
  442. package/types/logic-error.d.ts.map +0 -1
  443. package/types/network-client.d.ts.map +0 -1
  444. package/types/testing.d.ts.map +0 -1
  445. package/types/transaction.d.ts.map +0 -1
  446. package/types/transfer.d.ts.map +0 -1
  447. package/types/urlTokenBaseHTTPClient.d.ts +0 -41
  448. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  449. package/types/urlTokenBaseHTTPClient.js +0 -153
  450. package/types/urlTokenBaseHTTPClient.js.map +0 -1
  451. package/types/urlTokenBaseHTTPClient.mjs +0 -151
  452. package/types/urlTokenBaseHTTPClient.mjs.map +0 -1
  453. package/util.d.ts.map +0 -1
  454. package/util.js.map +0 -1
  455. package/util.mjs.map +0 -1
  456. /package/{account → src/account}/get-account-config-from-environment.js +0 -0
  457. /package/{account → src/account}/get-account-config-from-environment.mjs +0 -0
  458. /package/{testing → src/testing}/fixtures/algokit-log-capture-fixture.js +0 -0
  459. /package/{testing → src/testing}/fixtures/algokit-log-capture-fixture.mjs +0 -0
  460. /package/{testing → src/testing}/indexer.js +0 -0
  461. /package/{testing → src/testing}/indexer.mjs +0 -0
  462. /package/{testing → src/testing}/transaction-logger.js +0 -0
  463. /package/{testing → src/testing}/transaction-logger.mjs +0 -0
@@ -1,16 +1,18 @@
1
- import algosdk from 'algosdk';
1
+ import algosdk, { TransactionType, stringifyJSON, Address } from 'algosdk';
2
2
  import { Buffer } from 'buffer';
3
3
  import { Config } from '../config.mjs';
4
- import { simulateAndPersistResponse } from '../debugging/simulate-and-persist-response.mjs';
4
+ import { EventType } from '../../types/lifecycle-events.mjs';
5
5
  import { toNumber } from '../util.mjs';
6
6
  import { performAtomicTransactionComposerSimulate } from './perform-atomic-transaction-composer-simulate.mjs';
7
7
 
8
8
  var AtomicTransactionComposer = algosdk.AtomicTransactionComposer;
9
- var modelsv2 = algosdk.modelsv2;
10
9
  const MAX_TRANSACTION_GROUP_SIZE = 16;
11
10
  const MAX_APP_CALL_FOREIGN_REFERENCES = 8;
12
11
  const MAX_APP_CALL_ACCOUNT_REFERENCES = 4;
13
- /** Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
12
+ /**
13
+ * @deprecated Convert your data to a `string` or `Uint8Array`, if using ARC-2 use `TransactionComposer.arc2Note`.
14
+ *
15
+ * Encodes a transaction note into a byte array ready to be included in an Algorand transaction.
14
16
  *
15
17
  * @param note The transaction note
16
18
  * @returns the transaction note ready for inclusion in a transaction
@@ -76,14 +78,20 @@ function encodeLease(lease) {
76
78
  }
77
79
  }
78
80
  /**
81
+ * @deprecated Use `algorand.client` to interact with accounts, and use `.addr` to get the address
82
+ * and/or move from using `SendTransactionFrom` to `TransactionSignerAccount` and use `.addr` instead.
83
+ *
79
84
  * Returns the public address of the given transaction sender.
80
85
  * @param sender A transaction sender
81
86
  * @returns The public address
82
87
  */
83
88
  const getSenderAddress = function (sender) {
84
- return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr : sender.address();
89
+ return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr.toString() : sender.address().toString();
85
90
  };
86
91
  /**
92
+ * @deprecated Use `AlgorandClient` / `TransactionComposer` to construct transactions instead or
93
+ * construct an `algosdk.TransactionWithSigner` manually instead.
94
+ *
87
95
  * Given a transaction in a variety of supported formats, returns a TransactionWithSigner object ready to be passed to an
88
96
  * AtomicTransactionComposer's addTransaction method.
89
97
  * @param transaction One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the
@@ -122,6 +130,9 @@ const memoize = (fn) => {
122
130
  return cached;
123
131
  };
124
132
  /**
133
+ * @deprecated Use `TransactionSignerAccount` instead of `SendTransactionFrom` or use
134
+ * `algosdk.makeBasicAccountTransactionSigner` / `algosdk.makeLogicSigAccountTransactionSigner`.
135
+ *
125
136
  * Returns a `TransactionSigner` for the given transaction sender.
126
137
  * This function has memoization, so will return the same transaction signer for a given sender.
127
138
  * @param sender A transaction sender
@@ -135,6 +146,10 @@ const getSenderTransactionSigner = memoize(function (sender) {
135
146
  : algosdk.makeBasicAccountTransactionSigner(sender);
136
147
  });
137
148
  /**
149
+ * @deprecated Use `AlgorandClient` / `TransactionComposer` to sign transactions
150
+ * or use the relevant underlying `account.signTxn` / `algosdk.signLogicSigTransactionObject`
151
+ * / `multiSigAccount.sign` / `TransactionSigner` methods directly.
152
+ *
138
153
  * Signs a single transaction by the given signer.
139
154
  * @param transaction The transaction to sign
140
155
  * @param signer The signer to sign
@@ -149,7 +164,10 @@ const signTransaction = async (transaction, signer) => {
149
164
  ? signer.sign(transaction)
150
165
  : (await signer.signer([transaction], [0]))[0];
151
166
  };
152
- /** Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
167
+ /**
168
+ * @deprecated Use `AlgorandClient` / `TransactionComposer` to send transactions.
169
+ *
170
+ * Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.
153
171
  *
154
172
  * @param send The details for the transaction to prepare/send, including:
155
173
  * * `transaction`: The unsigned transaction
@@ -197,29 +215,18 @@ const sendTransaction = async function (send, algod) {
197
215
  * @returns The unnamed resources accessed by the group and by each transaction in the group
198
216
  */
199
217
  async function getUnnamedAppCallResourcesAccessed(atc, algod) {
200
- const simReq = new algosdk.modelsv2.SimulateRequest({
218
+ const simulateRequest = new algosdk.modelsv2.SimulateRequest({
201
219
  txnGroups: [],
202
220
  allowUnnamedResources: true,
203
221
  allowEmptySignatures: true,
222
+ fixSigners: true,
204
223
  });
205
- const signerWithFixedSgnr = async (txns, indexes) => {
206
- const stxns = await algosdk.makeEmptyTransactionSigner()(txns, indexes);
207
- return Promise.all(stxns.map(async (stxn) => {
208
- const decodedStxn = algosdk.decodeSignedTransaction(stxn);
209
- const sender = algosdk.encodeAddress(decodedStxn.txn.from.publicKey);
210
- const authAddr = (await algod.accountInformation(sender).do())['auth-addr'];
211
- const stxnObj = { txn: decodedStxn.txn.get_obj_for_encoding() };
212
- if (authAddr !== undefined) {
213
- stxnObj.sgnr = Buffer.from(algosdk.decodeAddress(authAddr).publicKey);
214
- }
215
- return algosdk.encodeObj(stxnObj);
216
- }));
217
- };
224
+ const nullSigner = algosdk.makeEmptyTransactionSigner();
218
225
  const emptySignerAtc = atc.clone();
219
226
  emptySignerAtc['transactions'].forEach((t) => {
220
- t.signer = signerWithFixedSgnr;
227
+ t.signer = nullSigner;
221
228
  });
222
- const result = await emptySignerAtc.simulate(algod, simReq);
229
+ const result = await emptySignerAtc.simulate(algod, simulateRequest);
223
230
  const groupResponse = result.simulateResponse.txnGroups[0];
224
231
  if (groupResponse.failureMessage) {
225
232
  throw Error(`Error during resource population simulation in transaction ${groupResponse.failedAt}: ${groupResponse.failureMessage}`);
@@ -252,7 +259,7 @@ async function populateAppCallResources(atc, algod) {
252
259
  const unnamedResourcesAccessed = await getUnnamedAppCallResourcesAccessed(atc, algod);
253
260
  const group = atc.buildGroup();
254
261
  unnamedResourcesAccessed.txns.forEach((r, i) => {
255
- if (r === undefined)
262
+ if (r === undefined || group[i].txn.type !== TransactionType.appl)
256
263
  return;
257
264
  if (r.boxes || r.extraBoxRefs)
258
265
  throw Error('Unexpected boxes at the transaction level');
@@ -260,22 +267,19 @@ async function populateAppCallResources(atc, algod) {
260
267
  throw Error('Unexpected app local at the transaction level');
261
268
  if (r.assetHoldings)
262
269
  throw Error('Unexpected asset holding at the transaction level');
263
- // Do accounts first because the account limit is 4
264
- r.accounts?.forEach((a) => {
265
- group[i].txn.appAccounts = [...(group[i].txn.appAccounts ?? []), algosdk.decodeAddress(a)];
266
- });
267
- r.apps?.forEach((a) => {
268
- group[i].txn.appForeignApps = [...(group[i].txn.appForeignApps ?? []), Number(a)];
269
- });
270
- r.assets?.forEach((a) => {
271
- group[i].txn.appForeignAssets = [...(group[i].txn.appForeignAssets ?? []), Number(a)];
272
- });
273
- const accounts = group[i].txn.appAccounts?.length || 0;
270
+ group[i].txn['applicationCall'] = {
271
+ ...group[i].txn.applicationCall,
272
+ accounts: [...(group[i].txn?.applicationCall?.accounts ?? []), ...(r.accounts ?? [])],
273
+ foreignApps: [...(group[i].txn?.applicationCall?.foreignApps ?? []), ...(r.apps ?? [])],
274
+ foreignAssets: [...(group[i].txn?.applicationCall?.foreignAssets ?? []), ...(r.assets ?? [])],
275
+ boxes: [...(group[i].txn?.applicationCall?.boxes ?? []), ...(r.boxes ?? [])],
276
+ };
277
+ const accounts = group[i].txn.applicationCall?.accounts?.length ?? 0;
274
278
  if (accounts > MAX_APP_CALL_ACCOUNT_REFERENCES)
275
279
  throw Error(`Account reference limit of ${MAX_APP_CALL_ACCOUNT_REFERENCES} exceeded in transaction ${i}`);
276
- const assets = group[i].txn.appForeignAssets?.length || 0;
277
- const apps = group[i].txn.appForeignApps?.length || 0;
278
- const boxes = group[i].txn.boxes?.length || 0;
280
+ const assets = group[i].txn.applicationCall?.foreignAssets?.length ?? 0;
281
+ const apps = group[i].txn.applicationCall?.foreignApps?.length ?? 0;
282
+ const boxes = group[i].txn.applicationCall?.boxes?.length ?? 0;
279
283
  if (accounts + assets + apps + boxes > MAX_APP_CALL_FOREIGN_REFERENCES) {
280
284
  throw Error(`Resource reference limit of ${MAX_APP_CALL_FOREIGN_REFERENCES} exceeded in transaction ${i}`);
281
285
  }
@@ -284,10 +288,10 @@ async function populateAppCallResources(atc, algod) {
284
288
  const isApplBelowLimit = (t) => {
285
289
  if (t.txn.type !== algosdk.TransactionType.appl)
286
290
  return false;
287
- const accounts = t.txn.appAccounts?.length || 0;
288
- const assets = t.txn.appForeignAssets?.length || 0;
289
- const apps = t.txn.appForeignApps?.length || 0;
290
- const boxes = t.txn.boxes?.length || 0;
291
+ const accounts = t.txn.applicationCall?.accounts?.length ?? 0;
292
+ const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0;
293
+ const apps = t.txn.applicationCall?.foreignApps?.length ?? 0;
294
+ const boxes = t.txn.applicationCall?.boxes?.length ?? 0;
291
295
  return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES;
292
296
  };
293
297
  // If this is a asset holding or app local, first try to find a transaction that already has the account available
@@ -298,22 +302,26 @@ async function populateAppCallResources(atc, algod) {
298
302
  return false;
299
303
  return (
300
304
  // account is in the foreign accounts array
301
- t.txn.appAccounts?.map((a) => algosdk.encodeAddress(a.publicKey)).includes(account) ||
305
+ t.txn.applicationCall?.accounts?.map((a) => a.toString()).includes(account.toString()) ||
302
306
  // account is available as an app account
303
- t.txn.appForeignApps?.map((a) => algosdk.getApplicationAddress(a)).includes(account) ||
307
+ t.txn.applicationCall?.foreignApps?.map((a) => algosdk.getApplicationAddress(a).toString()).includes(account.toString()) ||
304
308
  // account is available since it's in one of the fields
305
- Object.values(t.txn)
306
- .map((f) => JSON.stringify(f))
307
- .includes(JSON.stringify(algosdk.decodeAddress(account))));
309
+ Object.values(t.txn).some((f) => stringifyJSON(f, (_, v) => (v instanceof Address ? v.toString() : v))?.includes(account.toString())));
308
310
  });
309
311
  if (txnIndex > -1) {
310
312
  if (type === 'assetHolding') {
311
313
  const { asset } = reference;
312
- txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(asset)];
314
+ txns[txnIndex].txn['applicationCall'] = {
315
+ ...txns[txnIndex].txn.applicationCall,
316
+ foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],
317
+ };
313
318
  }
314
319
  else {
315
320
  const { app } = reference;
316
- txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)];
321
+ txns[txnIndex].txn['applicationCall'] = {
322
+ ...txns[txnIndex].txn.applicationCall,
323
+ foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],
324
+ };
317
325
  }
318
326
  return;
319
327
  }
@@ -322,20 +330,23 @@ async function populateAppCallResources(atc, algod) {
322
330
  if (!isApplBelowLimit(t))
323
331
  return false;
324
332
  // check if there is space in the accounts array
325
- if ((t.txn.appAccounts?.length || 0) >= MAX_APP_CALL_ACCOUNT_REFERENCES)
333
+ if ((t.txn.applicationCall?.accounts?.length ?? 0) >= MAX_APP_CALL_ACCOUNT_REFERENCES)
326
334
  return false;
327
335
  if (type === 'assetHolding') {
328
336
  const { asset } = reference;
329
- return t.txn.appForeignAssets?.includes(Number(asset));
337
+ return t.txn.applicationCall?.foreignAssets?.includes(asset);
330
338
  }
331
339
  else {
332
340
  const { app } = reference;
333
- return t.txn.appForeignApps?.includes(Number(app)) || t.txn.appIndex === Number(app);
341
+ return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app;
334
342
  }
335
343
  });
336
344
  if (txnIndex > -1) {
337
345
  const { account } = reference;
338
- txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)];
346
+ txns[txnIndex].txn['applicationCall'] = {
347
+ ...txns[txnIndex].txn.applicationCall,
348
+ accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],
349
+ };
339
350
  return;
340
351
  }
341
352
  }
@@ -346,10 +357,13 @@ async function populateAppCallResources(atc, algod) {
346
357
  if (!isApplBelowLimit(t))
347
358
  return false;
348
359
  // If the app is in the foreign array OR the app being called, then we know it's available
349
- return t.txn.appForeignApps?.includes(Number(app)) || t.txn.appIndex === Number(app);
360
+ return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app;
350
361
  });
351
362
  if (txnIndex > -1) {
352
- txns[txnIndex].txn.boxes = [...(txns[txnIndex].txn.boxes ?? []), { appIndex: Number(app), name }];
363
+ txns[txnIndex].txn['applicationCall'] = {
364
+ ...txns[txnIndex].txn.applicationCall,
365
+ boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name }]],
366
+ };
353
367
  return;
354
368
  }
355
369
  }
@@ -357,12 +371,12 @@ async function populateAppCallResources(atc, algod) {
357
371
  const txnIndex = txns.findIndex((t) => {
358
372
  if (t.txn.type !== algosdk.TransactionType.appl)
359
373
  return false;
360
- const accounts = t.txn.appAccounts?.length || 0;
374
+ const accounts = t.txn.applicationCall?.accounts?.length ?? 0;
361
375
  if (type === 'account')
362
376
  return accounts < MAX_APP_CALL_ACCOUNT_REFERENCES;
363
- const assets = t.txn.appForeignAssets?.length || 0;
364
- const apps = t.txn.appForeignApps?.length || 0;
365
- const boxes = t.txn.boxes?.length || 0;
377
+ const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0;
378
+ const apps = t.txn.applicationCall?.foreignApps?.length ?? 0;
379
+ const boxes = t.txn.applicationCall?.boxes?.length ?? 0;
366
380
  // If we're adding local state or asset holding, we need space for the acocunt and the other reference
367
381
  if (type === 'assetHolding' || type === 'appLocal') {
368
382
  return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES - 1 && accounts < MAX_APP_CALL_ACCOUNT_REFERENCES;
@@ -377,30 +391,57 @@ async function populateAppCallResources(atc, algod) {
377
391
  throw Error('No more transactions below reference limit. Add another app call to the group.');
378
392
  }
379
393
  if (type === 'account') {
380
- txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(reference)];
394
+ txns[txnIndex].txn['applicationCall'] = {
395
+ ...txns[txnIndex].txn.applicationCall,
396
+ accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[reference]],
397
+ };
381
398
  }
382
399
  else if (type === 'app') {
383
- txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(reference)];
400
+ txns[txnIndex].txn['applicationCall'] = {
401
+ ...txns[txnIndex].txn.applicationCall,
402
+ foreignApps: [
403
+ ...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []),
404
+ ...[typeof reference === 'bigint' ? reference : BigInt(reference)],
405
+ ],
406
+ };
384
407
  }
385
408
  else if (type === 'box') {
386
409
  const { app, name } = reference;
387
- txns[txnIndex].txn.boxes = [...(txns[txnIndex].txn.boxes ?? []), { appIndex: Number(app), name }];
410
+ txns[txnIndex].txn['applicationCall'] = {
411
+ ...txns[txnIndex].txn.applicationCall,
412
+ boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name }]],
413
+ };
388
414
  if (app.toString() !== '0') {
389
- txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)];
415
+ txns[txnIndex].txn['applicationCall'] = {
416
+ ...txns[txnIndex].txn.applicationCall,
417
+ foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],
418
+ };
390
419
  }
391
420
  }
392
421
  else if (type === 'assetHolding') {
393
422
  const { asset, account } = reference;
394
- txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(asset)];
395
- txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)];
423
+ txns[txnIndex].txn['applicationCall'] = {
424
+ ...txns[txnIndex].txn.applicationCall,
425
+ foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],
426
+ accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],
427
+ };
396
428
  }
397
429
  else if (type === 'appLocal') {
398
430
  const { app, account } = reference;
399
- txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)];
400
- txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)];
431
+ txns[txnIndex].txn['applicationCall'] = {
432
+ ...txns[txnIndex].txn.applicationCall,
433
+ foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],
434
+ accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],
435
+ };
401
436
  }
402
437
  else if (type === 'asset') {
403
- txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(reference)];
438
+ txns[txnIndex].txn['applicationCall'] = {
439
+ ...txns[txnIndex].txn.applicationCall,
440
+ foreignAssets: [
441
+ ...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []),
442
+ ...[typeof reference === 'bigint' ? reference : BigInt(reference)],
443
+ ],
444
+ };
404
445
  }
405
446
  };
406
447
  const g = unnamedResourcesAccessed.group;
@@ -452,98 +493,87 @@ async function populateAppCallResources(atc, algod) {
452
493
  }
453
494
  /**
454
495
  * Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
455
- * @param atcSend The parameters controlling the send, including:
456
- * * `atc` The `AtomicTransactionComposer`
457
- * * `sendParams` The parameters to control the send behaviour
496
+ * @param atcSend The parameters controlling the send, including `atc` The `AtomicTransactionComposer` and params to control send behaviour
458
497
  * @param algod An algod client
459
498
  * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)
460
499
  */
461
500
  const sendAtomicTransactionComposer = async function (atcSend, algod) {
462
- const { atc: givenAtc, sendParams } = atcSend;
501
+ const { atc: givenAtc, sendParams, ...executeParams } = atcSend;
463
502
  let atc;
464
- // const hasAppCalls = () =>
465
- // givenAtc
466
- // .buildGroup()
467
- // .map((t) => t.txn.type)
468
- // .includes(algosdk.TransactionType.appl)
469
503
  atc = givenAtc;
470
504
  try {
505
+ const transactionsWithSigner = atc.buildGroup();
471
506
  // If populateAppCallResources is true OR if populateAppCallResources is undefined and there are app calls, then populate resources
472
- // NOTE: Temporary false by default until this algod bug is fixed: https://github.com/algorand/go-algorand/issues/5914
473
- const populateResources = sendParams?.populateAppCallResources ?? Config.populateAppCallResources;
474
- if (populateResources) {
507
+ const populateResources = executeParams?.populateAppCallResources ?? sendParams?.populateAppCallResources ?? Config.populateAppCallResources;
508
+ if (populateResources && transactionsWithSigner.map((t) => t.txn.type).includes(algosdk.TransactionType.appl)) {
475
509
  atc = await populateAppCallResources(givenAtc, algod);
476
510
  }
477
- const transactionsWithSigner = atc.buildGroup();
478
511
  const transactionsToSend = transactionsWithSigner.map((t) => {
479
512
  return t.txn;
480
513
  });
481
514
  let groupId = undefined;
482
515
  if (transactionsToSend.length > 1) {
483
516
  groupId = transactionsToSend[0].group ? Buffer.from(transactionsToSend[0].group).toString('base64') : '';
484
- Config.getLogger(sendParams?.suppressLog).verbose(`Sending group of ${transactionsToSend.length} transactions (${groupId})`, {
517
+ Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(`Sending group of ${transactionsToSend.length} transactions (${groupId})`, {
485
518
  transactionsToSend,
486
519
  });
487
- Config.getLogger(sendParams?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionsToSend.map((t) => t.txID()));
520
+ Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).debug(`Transaction IDs (${groupId})`, transactionsToSend.map((t) => t.txID()));
488
521
  }
489
- if (Config.debug && Config.projectRoot && Config.traceAll) {
522
+ if (Config.debug && Config.traceAll) {
490
523
  // Dump the traces to a file for use with AlgoKit AVM debugger
491
- await simulateAndPersistResponse({
492
- atc,
493
- projectRoot: Config.projectRoot,
494
- algod,
495
- bufferSizeMb: Config.traceBufferSizeMb,
524
+ const simulateResponse = await performAtomicTransactionComposerSimulate(atc, algod);
525
+ await Config.events.emitAsync(EventType.TxnGroupSimulated, {
526
+ simulateResponse,
496
527
  });
497
528
  }
498
- const result = await atc.execute(algod, sendParams?.maxRoundsToWaitForConfirmation ?? 5);
529
+ const result = await atc.execute(algod, executeParams?.maxRoundsToWaitForConfirmation ?? sendParams?.maxRoundsToWaitForConfirmation ?? 5);
499
530
  if (transactionsToSend.length > 1) {
500
- Config.getLogger(sendParams?.suppressLog).verbose(`Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`);
531
+ Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(`Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`);
501
532
  }
502
533
  else {
503
- Config.getLogger(sendParams?.suppressLog).verbose(`Sent transaction ID ${transactionsToSend[0].txID()} ${transactionsToSend[0].type} from ${algosdk.encodeAddress(transactionsToSend[0].from.publicKey)}`);
534
+ Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(`Sent transaction ID ${transactionsToSend[0].txID()} ${transactionsToSend[0].type} from ${transactionsToSend[0].sender.toString()}`);
504
535
  }
505
536
  let confirmations = undefined;
506
537
  if (!sendParams?.skipWaiting) {
507
- confirmations = await Promise.all(transactionsToSend.map(async (t) => modelsv2.PendingTransactionResponse.from_obj_for_encoding(await algod.pendingTransactionInformation(t.txID()).do())));
538
+ confirmations = await Promise.all(transactionsToSend.map(async (t) => await algod.pendingTransactionInformation(t.txID()).do()));
508
539
  }
509
540
  return {
510
541
  groupId,
511
542
  confirmations,
512
543
  txIds: transactionsToSend.map((t) => t.txID()),
513
544
  transactions: transactionsToSend,
514
- returns: result.methodResults.map((r) => ({
515
- decodeError: r.decodeError,
516
- returnValue: r.returnValue,
517
- rawReturnValue: r.rawReturnValue,
518
- })),
545
+ returns: result.methodResults.map(getABIReturnValue),
519
546
  };
520
547
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
521
548
  }
522
549
  catch (e) {
523
- // Remove headers as it doesn't have anything useful.
524
- delete e.response?.headers;
550
+ // Create a new error object so the stack trace is correct (algosdk throws an error with a more limited stack trace)
551
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
552
+ const err = new Error(typeof e === 'object' ? e?.message : 'Received error executing Atomic Transaction Composer');
553
+ err.cause = e;
554
+ if (typeof e === 'object') {
555
+ // Remove headers as it doesn't have anything useful.
556
+ delete e.response?.headers;
557
+ err.response = e.response;
558
+ // body property very noisy
559
+ if (e.response && 'body' in e.response)
560
+ delete err.response.body;
561
+ err.name = e.name;
562
+ }
525
563
  if (Config.debug && typeof e === 'object') {
526
- e.traces = [];
527
- Config.logger.error('Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information', e);
528
- let simulate = undefined;
529
- if (Config.debug && Config.projectRoot && !Config.traceAll) {
530
- // Dump the traces to a file for use with AlgoKit AVM debugger
531
- // Checks for false on traceAll because it should have been already
532
- // executed above
533
- simulate = await simulateAndPersistResponse({
534
- atc,
535
- projectRoot: Config.projectRoot,
536
- algod,
537
- bufferSizeMb: Config.traceBufferSizeMb,
564
+ err.traces = [];
565
+ Config.logger.error('Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information', err);
566
+ const simulate = await performAtomicTransactionComposerSimulate(atc, algod);
567
+ if (Config.debug && !Config.traceAll) {
568
+ // Emit the event only if traceAll: false, as it should have already been emitted above
569
+ await Config.events.emitAsync(EventType.TxnGroupSimulated, {
570
+ simulateResponse: simulate,
538
571
  });
539
572
  }
540
- else {
541
- simulate = await performAtomicTransactionComposerSimulate(atc, algod);
542
- }
543
573
  if (simulate && simulate.txnGroups[0].failedAt) {
544
574
  for (const txn of simulate.txnGroups[0].txnResults) {
545
- e.traces.push({
546
- trace: txn.execTrace?.get_obj_for_encoding(),
575
+ err.traces.push({
576
+ trace: txn.execTrace?.toEncodingData(),
547
577
  appBudget: txn.appBudgetConsumed,
548
578
  logicSigBudget: txn.logicSigBudgetConsumed,
549
579
  logs: txn.txnResult.logs,
@@ -553,26 +583,53 @@ const sendAtomicTransactionComposer = async function (atcSend, algod) {
553
583
  }
554
584
  }
555
585
  else {
556
- Config.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', e);
586
+ Config.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', err);
557
587
  }
558
- throw e;
588
+ throw err;
589
+ }
590
+ };
591
+ const convertABIDecodedBigIntToNumber = (value, type) => {
592
+ if (typeof value === 'bigint') {
593
+ if (type instanceof algosdk.ABIUintType) {
594
+ return type.bitSize < 53 ? Number(value) : value;
595
+ }
596
+ else {
597
+ return value;
598
+ }
599
+ }
600
+ else if (Array.isArray(value) && (type instanceof algosdk.ABIArrayStaticType || type instanceof algosdk.ABIArrayDynamicType)) {
601
+ return value.map((v) => convertABIDecodedBigIntToNumber(v, type.childType));
602
+ }
603
+ else if (Array.isArray(value) && type instanceof algosdk.ABITupleType) {
604
+ return value.map((v, i) => convertABIDecodedBigIntToNumber(v, type.childTypes[i]));
605
+ }
606
+ else {
607
+ return value;
559
608
  }
560
609
  };
561
610
  /**
562
- * Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`
563
- * @param atc The AtomicTransactionComposer` with transaction(s) loaded
564
- * @param algod An Algod client
565
- * @returns The dryrun result
611
+ * Takes an algosdk `ABIResult` and converts it to an `ABIReturn`.
612
+ * Converts `bigint`'s for Uint's < 64 to `number` for easier use.
613
+ * @param result The `ABIReturn`
566
614
  */
567
- async function performAtomicTransactionComposerDryrun(atc, algod) {
568
- const signedTransactions = await atc.gatherSignatures();
569
- const txns = signedTransactions.map((t) => {
570
- return algosdk.decodeSignedTransaction(t);
571
- });
572
- const dryrun = await algosdk.createDryrun({ client: algod, txns });
573
- return new algosdk.DryrunResult(await algod.dryrun(dryrun).do());
615
+ function getABIReturnValue(result) {
616
+ if (result.decodeError) {
617
+ return {
618
+ decodeError: result.decodeError,
619
+ };
620
+ }
621
+ return {
622
+ method: result.method,
623
+ rawReturnValue: result.rawReturnValue,
624
+ decodeError: undefined,
625
+ returnValue: result.returnValue !== undefined && result.method.returns.type !== 'void'
626
+ ? convertABIDecodedBigIntToNumber(result.returnValue, result.method.returns.type)
627
+ : result.returnValue,
628
+ };
574
629
  }
575
630
  /**
631
+ * @deprecated Use `TransactionComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.
632
+ *
576
633
  * Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#create-transactions) transactions to the chain
577
634
  *
578
635
  * @param groupSend The group details to send, with:
@@ -622,7 +679,7 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
622
679
  throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`);
623
680
  }
624
681
  // Get current round
625
- const status = modelsv2.NodeStatusResponse.from_obj_for_encoding(await algod.status().do());
682
+ const status = await algod.status().do();
626
683
  if (status === undefined) {
627
684
  throw new Error('Unable to get node status');
628
685
  }
@@ -631,7 +688,7 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
631
688
  let currentRound = startRound;
632
689
  while (currentRound < startRound + BigInt(maxRoundsToWait)) {
633
690
  try {
634
- const pendingInfo = modelsv2.PendingTransactionResponse.from_obj_for_encoding(await algod.pendingTransactionInformation(transactionId).do());
691
+ const pendingInfo = await algod.pendingTransactionInformation(transactionId).do();
635
692
  if (pendingInfo !== undefined) {
636
693
  const confirmedRound = pendingInfo.confirmedRound;
637
694
  if (confirmedRound && confirmedRound > 0) {
@@ -659,6 +716,8 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
659
716
  throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`);
660
717
  };
661
718
  /**
719
+ * @deprecated Use `TransactionComposer` and the `maxFee` field in the transaction params instead.
720
+ *
662
721
  * Limit the acceptable fee to a defined amount of µAlgo.
663
722
  * This also sets the transaction to be flatFee to ensure the transaction only succeeds at
664
723
  * the estimated rate.
@@ -667,20 +726,24 @@ const waitForConfirmation = async function (transactionId, maxRoundsToWait, algo
667
726
  */
668
727
  function capTransactionFee(transaction, maxAcceptableFee) {
669
728
  // If a flat fee hasn't already been defined
670
- if (!transaction.flatFee) {
729
+ if (!('flatFee' in transaction) || !transaction.flatFee) {
671
730
  // Once a transaction has been constructed by algosdk, transaction.fee indicates what the total transaction fee
672
731
  // Will be based on the current suggested fee-per-byte value.
673
732
  if (transaction.fee > maxAcceptableFee.microAlgo) {
674
733
  throw new Error(`Cancelled transaction due to high network congestion fees. Algorand suggested fees would cause this transaction to cost ${transaction.fee} µALGO. Cap for this transaction is ${maxAcceptableFee.microAlgo} µALGO.`);
675
734
  }
676
- else if (transaction.fee > algosdk.ALGORAND_MIN_TX_FEE) {
735
+ else if (transaction.fee > 1000000) {
677
736
  Config.logger.warn(`Algorand network congestion fees are in effect. This transaction will incur a fee of ${transaction.fee} µALGO.`);
678
737
  }
679
738
  // Now set the flat on the transaction. Otherwise the network may increase the fee above our cap and perform the transaction.
680
- transaction.flatFee = true;
739
+ if ('flatFee' in transaction) {
740
+ transaction.flatFee = true;
741
+ }
681
742
  }
682
743
  }
683
744
  /**
745
+ * @deprecated Use `TransactionComposer` and the `maxFee` and `staticFee` fields in the transaction params instead.
746
+ *
684
747
  * Allows for control of fees on a `Transaction` or `SuggestedParams` object
685
748
  * @param transaction The transaction or suggested params
686
749
  * @param feeControl The fee control parameters
@@ -688,8 +751,10 @@ function capTransactionFee(transaction, maxAcceptableFee) {
688
751
  function controlFees(transaction, feeControl) {
689
752
  const { fee, maxFee } = feeControl;
690
753
  if (fee) {
691
- transaction.fee = fee.microAlgo;
692
- transaction.flatFee = true;
754
+ transaction.fee = Number(fee.microAlgo);
755
+ if ('flatFee' in transaction) {
756
+ transaction.flatFee = true;
757
+ }
693
758
  }
694
759
  if (maxFee !== undefined) {
695
760
  capTransactionFee(transaction, maxFee);
@@ -697,15 +762,30 @@ function controlFees(transaction, feeControl) {
697
762
  return transaction;
698
763
  }
699
764
  /**
765
+ * @deprecated Use `suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()` instead
766
+ *
700
767
  * Returns suggested transaction parameters from algod unless some are already provided.
701
768
  * @param params Optionally provide parameters to use
702
769
  * @param algod Algod algod
703
770
  * @returns The suggested transaction parameters
704
771
  */
705
772
  async function getTransactionParams(params, algod) {
706
- return params ? { ...params } : await algod.getTransactionParams().do();
773
+ if (params) {
774
+ return { ...params };
775
+ }
776
+ const p = await algod.getTransactionParams().do();
777
+ return {
778
+ fee: p.fee,
779
+ firstValid: p.firstValid,
780
+ lastValid: p.lastValid,
781
+ genesisID: p.genesisID,
782
+ genesisHash: p.genesisHash,
783
+ minFee: p.minFee,
784
+ };
707
785
  }
708
786
  /**
787
+ * @deprecated Use `atc.clone().buildGroup()` instead.
788
+ *
709
789
  * Returns the array of transactions currently present in the given `AtomicTransactionComposer`
710
790
  * @param atc The atomic transaction composer
711
791
  * @returns The array of transactions with signers
@@ -719,5 +799,5 @@ function getAtomicTransactionComposerTransactions(atc) {
719
799
  }
720
800
  }
721
801
 
722
- export { MAX_APP_CALL_ACCOUNT_REFERENCES, MAX_APP_CALL_FOREIGN_REFERENCES, MAX_TRANSACTION_GROUP_SIZE, capTransactionFee, controlFees, encodeLease, encodeTransactionNote, getAtomicTransactionComposerTransactions, getSenderAddress, getSenderTransactionSigner, getTransactionParams, getTransactionWithSigner, performAtomicTransactionComposerDryrun, populateAppCallResources, sendAtomicTransactionComposer, sendGroupOfTransactions, sendTransaction, signTransaction, waitForConfirmation };
802
+ export { MAX_APP_CALL_ACCOUNT_REFERENCES, MAX_APP_CALL_FOREIGN_REFERENCES, MAX_TRANSACTION_GROUP_SIZE, capTransactionFee, controlFees, encodeLease, encodeTransactionNote, getABIReturnValue, getAtomicTransactionComposerTransactions, getSenderAddress, getSenderTransactionSigner, getTransactionParams, getTransactionWithSigner, populateAppCallResources, sendAtomicTransactionComposer, sendGroupOfTransactions, sendTransaction, signTransaction, waitForConfirmation };
723
803
  //# sourceMappingURL=transaction.mjs.map