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