@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
@@ -0,0 +1,850 @@
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { Buffer } from 'buffer';
3
+ import { Config } from '../src/config.mjs';
4
+ import { AppManager } from './app-manager.mjs';
5
+
6
+ const getMethodCallForLog = ({ method, args }) => {
7
+ return `${method.name}(${(args ?? []).map((a) => (a instanceof Address ? a.toString() : typeof a === 'object' ? JSON.stringify(a, (_, v) => (typeof v === 'bigint' ? Number(v) : v instanceof Address ? v.toString() : v instanceof Uint8Array ? Buffer.from(v).toString('base64') : v)) : a))})`;
8
+ };
9
+ /** Orchestrates sending transactions for `AlgorandClient`. */
10
+ class AlgorandClientTransactionSender {
11
+ /**
12
+ * Creates a new `AlgorandClientSender`
13
+ * @param newGroup A lambda that starts a new `TransactionComposer` transaction group
14
+ * @param assetManager An `AssetManager` instance
15
+ */
16
+ constructor(newGroup, assetManager, appManager) {
17
+ /**
18
+ * Send a payment transaction to transfer Algo between accounts.
19
+ * @param params The parameters for the payment transaction
20
+ * @example Basic example
21
+ * ```typescript
22
+ * const result = await algorand.send.payment({
23
+ * sender: 'SENDERADDRESS',
24
+ * receiver: 'RECEIVERADDRESS',
25
+ * amount: (4).algo(),
26
+ * })
27
+ * ```
28
+ * @example Advanced example
29
+ * ```typescript
30
+ * const result = await algorand.send.payment({
31
+ * amount: (4).algo(),
32
+ * receiver: 'RECEIVERADDRESS',
33
+ * sender: 'SENDERADDRESS',
34
+ * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',
35
+ * lease: 'lease',
36
+ * note: 'note',
37
+ * // Use this with caution, it's generally better to use algorand.account.rekeyAccount
38
+ * rekeyTo: 'REKEYTOADDRESS',
39
+ * // You wouldn't normally set this field
40
+ * firstValidRound: 1000n,
41
+ * validityWindow: 10,
42
+ * extraFee: (1000).microAlgo(),
43
+ * staticFee: (1000).microAlgo(),
44
+ * // Max fee doesn't make sense with extraFee AND staticFee
45
+ * // already specified, but here for completeness
46
+ * maxFee: (3000).microAlgo(),
47
+ * // Signer only needed if you want to provide one,
48
+ * // generally you'd register it with AlgorandClient
49
+ * // against the sender and not need to pass it in
50
+ * signer: transactionSigner,
51
+ * maxRoundsToWaitForConfirmation: 5,
52
+ * suppressLog: true,
53
+ * })
54
+ * ```
55
+ *
56
+ * @returns The result of the transaction and the transaction that was sent
57
+ */
58
+ this.payment = this._send((c) => c.addPayment, {
59
+ preLog: (params, transaction) => `Sending ${params.amount.microAlgo} µALGO from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
60
+ });
61
+ /**
62
+ * Create a new Algorand Standard Asset.
63
+ *
64
+ * The account that sends this transaction will automatically be
65
+ * opted in to the asset and will hold all units after creation.
66
+ *
67
+ * @param params The parameters for the asset creation transaction
68
+ *
69
+ * @example Basic example
70
+ * ```typescript
71
+ * await algorand.send.assetCreate({sender: "CREATORADDRESS", total: 100n})
72
+ * ```
73
+ * @example Advanced example
74
+ * ```typescript
75
+ * await algorand.send.assetCreate({
76
+ * sender: 'CREATORADDRESS',
77
+ * total: 100n,
78
+ * decimals: 2,
79
+ * assetName: 'asset',
80
+ * unitName: 'unit',
81
+ * url: 'url',
82
+ * metadataHash: 'metadataHash',
83
+ * defaultFrozen: false,
84
+ * manager: 'MANAGERADDRESS',
85
+ * reserve: 'RESERVEADDRESS',
86
+ * freeze: 'FREEZEADDRESS',
87
+ * clawback: 'CLAWBACKADDRESS',
88
+ * lease: 'lease',
89
+ * note: 'note',
90
+ * // You wouldn't normally set this field
91
+ * firstValidRound: 1000n,
92
+ * validityWindow: 10,
93
+ * extraFee: (1000).microAlgo(),
94
+ * staticFee: (1000).microAlgo(),
95
+ * // Max fee doesn't make sense with extraFee AND staticFee
96
+ * // already specified, but here for completeness
97
+ * maxFee: (3000).microAlgo(),
98
+ * // Signer only needed if you want to provide one,
99
+ * // generally you'd register it with AlgorandClient
100
+ * // against the sender and not need to pass it in
101
+ * signer: transactionSigner,
102
+ * maxRoundsToWaitForConfirmation: 5,
103
+ * suppressLog: true,
104
+ * })
105
+ * ```
106
+ * @returns The result of the transaction and the transaction that was sent
107
+ */
108
+ this.assetCreate = async (params) => {
109
+ const result = await this._send((c) => c.addAssetCreate, {
110
+ postLog: (params, result) => `Created asset${params.assetName ? ` ${params.assetName}` : ''}${params.unitName ? ` (${params.unitName})` : ''} with ${params.total} units and ${params.decimals ?? 0} decimals created by ${params.sender} with ID ${result.confirmation.assetIndex} via transaction ${result.txIds.at(-1)}`,
111
+ })(params);
112
+ return { ...result, assetId: BigInt(result.confirmation.assetIndex ?? 0) };
113
+ };
114
+ /**
115
+ * Configure an existing Algorand Standard Asset.
116
+ *
117
+ * **Note:** The manager, reserve, freeze, and clawback addresses
118
+ * are immutably empty if they are not set. If manager is not set then
119
+ * all fields are immutable from that point forward.
120
+ *
121
+ * @param params The parameters for the asset config transaction
122
+ *
123
+ * @example Basic example
124
+ * ```typescript
125
+ * await algorand.send.assetConfig({sender: "MANAGERADDRESS", assetId: 123456n, manager: "MANAGERADDRESS" })
126
+ * ```
127
+ * @example Advanced example
128
+ * ```typescript
129
+ * await algorand.send.assetConfig({
130
+ * sender: 'MANAGERADDRESS',
131
+ * assetId: 123456n,
132
+ * manager: 'MANAGERADDRESS',
133
+ * reserve: 'RESERVEADDRESS',
134
+ * freeze: 'FREEZEADDRESS',
135
+ * clawback: 'CLAWBACKADDRESS',
136
+ * lease: 'lease',
137
+ * note: 'note',
138
+ * // You wouldn't normally set this field
139
+ * firstValidRound: 1000n,
140
+ * validityWindow: 10,
141
+ * extraFee: (1000).microAlgo(),
142
+ * staticFee: (1000).microAlgo(),
143
+ * // Max fee doesn't make sense with extraFee AND staticFee
144
+ * // already specified, but here for completeness
145
+ * maxFee: (3000).microAlgo(),
146
+ * // Signer only needed if you want to provide one,
147
+ * // generally you'd register it with AlgorandClient
148
+ * // against the sender and not need to pass it in
149
+ * signer: transactionSigner,
150
+ * maxRoundsToWaitForConfirmation: 5,
151
+ * suppressLog: true,
152
+ * })
153
+ * ```
154
+ * @returns The result of the transaction and the transaction that was sent
155
+ */
156
+ this.assetConfig = this._send((c) => c.addAssetConfig, {
157
+ preLog: (params, transaction) => `Configuring asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
158
+ });
159
+ /**
160
+ * Freeze or unfreeze an Algorand Standard Asset for an account.
161
+ *
162
+ * @param params The parameters for the asset freeze transaction
163
+ *
164
+ * @example Basic example
165
+ * ```typescript
166
+ * await algorand.send.assetFreeze({sender: "MANAGERADDRESS", assetId: 123456n, account: "ACCOUNTADDRESS", frozen: true })
167
+ * ```
168
+ * @example Advanced example
169
+ * ```typescript
170
+ * await algorand.send.assetFreeze({
171
+ * sender: 'MANAGERADDRESS',
172
+ * assetId: 123456n,
173
+ * account: 'ACCOUNTADDRESS',
174
+ * frozen: true,
175
+ * lease: 'lease',
176
+ * note: 'note',
177
+ * // You wouldn't normally set this field
178
+ * firstValidRound: 1000n,
179
+ * validityWindow: 10,
180
+ * extraFee: (1000).microAlgo(),
181
+ * staticFee: (1000).microAlgo(),
182
+ * // Max fee doesn't make sense with extraFee AND staticFee
183
+ * // already specified, but here for completeness
184
+ * maxFee: (3000).microAlgo(),
185
+ * // Signer only needed if you want to provide one,
186
+ * // generally you'd register it with AlgorandClient
187
+ * // against the sender and not need to pass it in
188
+ * signer: transactionSigner,
189
+ * maxRoundsToWaitForConfirmation: 5,
190
+ * suppressLog: true,
191
+ * })
192
+ * ```
193
+ * @returns The result of the transaction and the transaction that was sent
194
+ */
195
+ this.assetFreeze = this._send((c) => c.addAssetFreeze, {
196
+ preLog: (params, transaction) => `Freezing asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
197
+ });
198
+ /**
199
+ * Destroys an Algorand Standard Asset.
200
+ *
201
+ * Created assets can be destroyed only by the asset manager account.
202
+ * All of the assets must be owned by the creator of the asset before
203
+ * the asset can be deleted.
204
+ *
205
+ * @param params The parameters for the asset destroy transaction
206
+ *
207
+ * @example Basic example
208
+ * ```typescript
209
+ * await algorand.send.assetDestroy({sender: "MANAGERADDRESS", assetId: 123456n })
210
+ * ```
211
+ * @example Advanced example
212
+ * ```typescript
213
+ * await algorand.send.assetDestroy({
214
+ * sender: 'MANAGERADDRESS',
215
+ * assetId: 123456n,
216
+ * lease: 'lease',
217
+ * note: 'note',
218
+ * // You wouldn't normally set this field
219
+ * firstValidRound: 1000n,
220
+ * validityWindow: 10,
221
+ * extraFee: (1000).microAlgo(),
222
+ * staticFee: (1000).microAlgo(),
223
+ * // Max fee doesn't make sense with extraFee AND staticFee
224
+ * // already specified, but here for completeness
225
+ * maxFee: (3000).microAlgo(),
226
+ * // Signer only needed if you want to provide one,
227
+ * // generally you'd register it with AlgorandClient
228
+ * // against the sender and not need to pass it in
229
+ * signer: transactionSigner,
230
+ * maxRoundsToWaitForConfirmation: 5,
231
+ * suppressLog: true,
232
+ * })
233
+ * ```
234
+ * @returns The result of the transaction and the transaction that was sent
235
+ */
236
+ this.assetDestroy = this._send((c) => c.addAssetDestroy, {
237
+ preLog: (params, transaction) => `Destroying asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
238
+ });
239
+ /**
240
+ * Transfer an Algorand Standard Asset.
241
+ *
242
+ * @param params The parameters for the asset transfer transaction
243
+ *
244
+ * @example Basic example
245
+ * ```typescript
246
+ * await algorand.send.assetTransfer({sender: "HOLDERADDRESS", assetId: 123456n, amount: 1n, receiver: "RECEIVERADDRESS" })
247
+ * ```
248
+ * @example Advanced example (with clawback)
249
+ * ```typescript
250
+ * await algorand.send.assetTransfer({
251
+ * sender: 'CLAWBACKADDRESS',
252
+ * assetId: 123456n,
253
+ * amount: 1n,
254
+ * receiver: 'RECEIVERADDRESS',
255
+ * clawbackTarget: 'HOLDERADDRESS',
256
+ * // This field needs to be used with caution
257
+ * closeAssetTo: 'ADDRESSTOCLOSETO'
258
+ * lease: 'lease',
259
+ * note: 'note',
260
+ * // You wouldn't normally set this field
261
+ * firstValidRound: 1000n,
262
+ * validityWindow: 10,
263
+ * extraFee: (1000).microAlgo(),
264
+ * staticFee: (1000).microAlgo(),
265
+ * // Max fee doesn't make sense with extraFee AND staticFee
266
+ * // already specified, but here for completeness
267
+ * maxFee: (3000).microAlgo(),
268
+ * // Signer only needed if you want to provide one,
269
+ * // generally you'd register it with AlgorandClient
270
+ * // against the sender and not need to pass it in
271
+ * signer: transactionSigner,
272
+ * maxRoundsToWaitForConfirmation: 5,
273
+ * suppressLog: true,
274
+ * })
275
+ * ```
276
+ * @returns The result of the transaction and the transaction that was sent
277
+ */
278
+ this.assetTransfer = this._send((c) => c.addAssetTransfer, {
279
+ preLog: (params, transaction) => `Transferring ${params.amount} units of asset with ID ${params.assetId} from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
280
+ });
281
+ /**
282
+ * Opt an account into an Algorand Standard Asset.
283
+ *
284
+ * @param params The parameters for the asset opt-in transaction
285
+ *
286
+ * @example Basic example
287
+ * ```typescript
288
+ * await algorand.send.assetOptIn({sender: "SENDERADDRESS", assetId: 123456n })
289
+ * ```
290
+ * @example Advanced example
291
+ * ```typescript
292
+ * await algorand.send.assetOptIn({
293
+ * sender: 'SENDERADDRESS',
294
+ * assetId: 123456n,
295
+ * lease: 'lease',
296
+ * note: 'note',
297
+ * // You wouldn't normally set this field
298
+ * firstValidRound: 1000n,
299
+ * validityWindow: 10,
300
+ * extraFee: (1000).microAlgo(),
301
+ * staticFee: (1000).microAlgo(),
302
+ * // Max fee doesn't make sense with extraFee AND staticFee
303
+ * // already specified, but here for completeness
304
+ * maxFee: (3000).microAlgo(),
305
+ * // Signer only needed if you want to provide one,
306
+ * // generally you'd register it with AlgorandClient
307
+ * // against the sender and not need to pass it in
308
+ * signer: transactionSigner,
309
+ * maxRoundsToWaitForConfirmation: 5,
310
+ * suppressLog: true,
311
+ * })
312
+ * ```
313
+ * @returns The result of the transaction and the transaction that was sent
314
+ */
315
+ this.assetOptIn = this._send((c) => c.addAssetOptIn, {
316
+ preLog: (params, transaction) => `Opting in ${params.sender} to asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
317
+ });
318
+ /**
319
+ * Opt an account out of an Algorand Standard Asset.
320
+ *
321
+ * *Note:* If the account has a balance of the asset,
322
+ * it will not be able to opt-out unless `ensureZeroBalance`
323
+ * is set to `false` (but then the account will lose the assets).
324
+ *
325
+ * @param params The parameters for the asset opt-out transaction
326
+ *
327
+ * @example Basic example (without creator, will be retrieved from algod)
328
+ * ```typescript
329
+ * await algorand.send.assetOptOut({sender: "SENDERADDRESS", assetId: 123456n, ensureZeroBalance: true })
330
+ * ```
331
+ * @example Basic example (with creator)
332
+ * ```typescript
333
+ * await algorand.send.assetOptOut({sender: "SENDERADDRESS", creator: "CREATORADDRESS", assetId: 123456n, ensureZeroBalance: true })
334
+ * ```
335
+ * @example Advanced example
336
+ * ```typescript
337
+ * await algorand.send.assetOptOut({
338
+ * sender: 'SENDERADDRESS',
339
+ * assetId: 123456n,
340
+ * creator: 'CREATORADDRESS',
341
+ * ensureZeroBalance: true,
342
+ * lease: 'lease',
343
+ * note: 'note',
344
+ * // You wouldn't normally set this field
345
+ * firstValidRound: 1000n,
346
+ * validityWindow: 10,
347
+ * extraFee: (1000).microAlgo(),
348
+ * staticFee: (1000).microAlgo(),
349
+ * // Max fee doesn't make sense with extraFee AND staticFee
350
+ * // already specified, but here for completeness
351
+ * maxFee: (3000).microAlgo(),
352
+ * // Signer only needed if you want to provide one,
353
+ * // generally you'd register it with AlgorandClient
354
+ * // against the sender and not need to pass it in
355
+ * signer: transactionSigner,
356
+ * maxRoundsToWaitForConfirmation: 5,
357
+ * suppressLog: true,
358
+ * })
359
+ * ```
360
+ * @returns The result of the transaction and the transaction that was sent
361
+ */
362
+ this.assetOptOut = async (params) => {
363
+ if (params.ensureZeroBalance) {
364
+ let balance = 0n;
365
+ try {
366
+ const accountAssetInfo = await this._assetManager.getAccountInformation(params.sender, params.assetId);
367
+ balance = accountAssetInfo.balance;
368
+ }
369
+ catch {
370
+ throw new Error(`Account ${params.sender} is not opted-in to Asset ${params.assetId}; can't opt-out.`);
371
+ }
372
+ if (balance !== 0n) {
373
+ throw new Error(`Account ${params.sender} does not have a zero balance for Asset ${params.assetId}; can't opt-out.`);
374
+ }
375
+ }
376
+ params.creator = params.creator ?? (await this._assetManager.getById(params.assetId)).creator;
377
+ return await this._send((c) => c.addAssetOptOut, {
378
+ preLog: (params, transaction) => `Opting ${params.sender} out of asset with ID ${params.assetId} to creator ${params.creator} via transaction ${transaction.txID()}`,
379
+ })(params);
380
+ };
381
+ /**
382
+ * Create a smart contract.
383
+ *
384
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
385
+ *
386
+ * @param params The parameters for the app creation transaction
387
+ * @example Basic example
388
+ * ```typescript
389
+ * const result = await algorand.send.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
390
+ * const createdAppId = result.appId
391
+ * ```
392
+ * @example Advanced example
393
+ * ```typescript
394
+ * await algorand.send.appCreate({
395
+ * sender: 'CREATORADDRESS',
396
+ * approvalProgram: "TEALCODE",
397
+ * clearStateProgram: "TEALCODE",
398
+ * schema: {
399
+ * globalInts: 1,
400
+ * globalByteSlices: 2,
401
+ * localInts: 3,
402
+ * localByteSlices: 4
403
+ * },
404
+ * extraProgramPages: 1,
405
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
406
+ * args: [new Uint8Array(1, 2, 3, 4)]
407
+ * accountReferences: ["ACCOUNT_1"]
408
+ * appReferences: [123n, 1234n]
409
+ * assetReferences: [12345n]
410
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
411
+ * lease: 'lease',
412
+ * note: 'note',
413
+ * // You wouldn't normally set this field
414
+ * firstValidRound: 1000n,
415
+ * validityWindow: 10,
416
+ * extraFee: (1000).microAlgo(),
417
+ * staticFee: (1000).microAlgo(),
418
+ * // Max fee doesn't make sense with extraFee AND staticFee
419
+ * // already specified, but here for completeness
420
+ * maxFee: (3000).microAlgo(),
421
+ * // Signer only needed if you want to provide one,
422
+ * // generally you'd register it with AlgorandClient
423
+ * // against the sender and not need to pass it in
424
+ * signer: transactionSigner,
425
+ * maxRoundsToWaitForConfirmation: 5,
426
+ * suppressLog: true,
427
+ *})
428
+ * ```
429
+ */
430
+ this.appCreate = this._sendAppCreateCall((c) => c.addAppCreate, {
431
+ postLog: (params, result) => `App created by ${params.sender} with ID ${result.confirmation.applicationIndex} via transaction ${result.txIds.at(-1)}`,
432
+ });
433
+ /**
434
+ * Update a smart contract.
435
+ *
436
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
437
+ *
438
+ * @param params The parameters for the app update transaction
439
+ * @example Basic example
440
+ * ```typescript
441
+ * await algorand.send.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })
442
+ * ```
443
+ * @example Advanced example
444
+ * ```typescript
445
+ * await algorand.send.appUpdate({
446
+ * sender: 'CREATORADDRESS',
447
+ * approvalProgram: "TEALCODE",
448
+ * clearStateProgram: "TEALCODE",
449
+ * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
450
+ * args: [new Uint8Array(1, 2, 3, 4)]
451
+ * accountReferences: ["ACCOUNT_1"]
452
+ * appReferences: [123n, 1234n]
453
+ * assetReferences: [12345n]
454
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
455
+ * lease: 'lease',
456
+ * note: 'note',
457
+ * // You wouldn't normally set this field
458
+ * firstValidRound: 1000n,
459
+ * validityWindow: 10,
460
+ * extraFee: (1000).microAlgo(),
461
+ * staticFee: (1000).microAlgo(),
462
+ * // Max fee doesn't make sense with extraFee AND staticFee
463
+ * // already specified, but here for completeness
464
+ * maxFee: (3000).microAlgo(),
465
+ * // Signer only needed if you want to provide one,
466
+ * // generally you'd register it with AlgorandClient
467
+ * // against the sender and not need to pass it in
468
+ * signer: transactionSigner,
469
+ * maxRoundsToWaitForConfirmation: 5,
470
+ * suppressLog: true,
471
+ *})
472
+ * ```
473
+ */
474
+ this.appUpdate = this._sendAppUpdateCall((c) => c.addAppUpdate, {
475
+ postLog: (params, result) => `App ${params.appId} updated ${params.args ? ` with ${params.args.map((a) => Buffer.from(a).toString('base64'))}` : ''} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
476
+ });
477
+ /**
478
+ * Delete a smart contract.
479
+ *
480
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
481
+ *
482
+ * @param params The parameters for the app deletion transaction
483
+ * @example Basic example
484
+ * ```typescript
485
+ * await algorand.send.appDelete({ sender: 'CREATORADDRESS' })
486
+ * ```
487
+ * @example Advanced example
488
+ * ```typescript
489
+ * await algorand.send.appDelete({
490
+ * sender: 'CREATORADDRESS',
491
+ * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,
492
+ * args: [new Uint8Array(1, 2, 3, 4)]
493
+ * accountReferences: ["ACCOUNT_1"]
494
+ * appReferences: [123n, 1234n]
495
+ * assetReferences: [12345n]
496
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
497
+ * lease: 'lease',
498
+ * note: 'note',
499
+ * // You wouldn't normally set this field
500
+ * firstValidRound: 1000n,
501
+ * validityWindow: 10,
502
+ * extraFee: (1000).microAlgo(),
503
+ * staticFee: (1000).microAlgo(),
504
+ * // Max fee doesn't make sense with extraFee AND staticFee
505
+ * // already specified, but here for completeness
506
+ * maxFee: (3000).microAlgo(),
507
+ * // Signer only needed if you want to provide one,
508
+ * // generally you'd register it with AlgorandClient
509
+ * // against the sender and not need to pass it in
510
+ * signer: transactionSigner,
511
+ * maxRoundsToWaitForConfirmation: 5,
512
+ * suppressLog: true,
513
+ *})
514
+ * ```
515
+ */
516
+ this.appDelete = this._sendAppCall((c) => c.addAppDelete, {
517
+ postLog: (params, result) => `App ${params.appId} deleted ${params.args ? ` with ${params.args.map((a) => Buffer.from(a).toString('base64'))}` : ''} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
518
+ });
519
+ /**
520
+ * Call a smart contract.
521
+ *
522
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
523
+ *
524
+ * @param params The parameters for the app call transaction
525
+ * @example Basic example
526
+ * ```typescript
527
+ * await algorand.send.appCall({ sender: 'CREATORADDRESS' })
528
+ * ```
529
+ * @example Advanced example
530
+ * ```typescript
531
+ * await algorand.send.appCall({
532
+ * sender: 'CREATORADDRESS',
533
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
534
+ * args: [new Uint8Array(1, 2, 3, 4)]
535
+ * accountReferences: ["ACCOUNT_1"]
536
+ * appReferences: [123n, 1234n]
537
+ * assetReferences: [12345n]
538
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
539
+ * lease: 'lease',
540
+ * note: 'note',
541
+ * // You wouldn't normally set this field
542
+ * firstValidRound: 1000n,
543
+ * validityWindow: 10,
544
+ * extraFee: (1000).microAlgo(),
545
+ * staticFee: (1000).microAlgo(),
546
+ * // Max fee doesn't make sense with extraFee AND staticFee
547
+ * // already specified, but here for completeness
548
+ * maxFee: (3000).microAlgo(),
549
+ * // Signer only needed if you want to provide one,
550
+ * // generally you'd register it with AlgorandClient
551
+ * // against the sender and not need to pass it in
552
+ * signer: transactionSigner,
553
+ * maxRoundsToWaitForConfirmation: 5,
554
+ * suppressLog: true,
555
+ *})
556
+ * ```
557
+ */
558
+ this.appCall = this._sendAppCall((c) => c.addAppCall, {
559
+ postLog: (params, result) => `App ${params.appId} called ${params.args ? ` with ${params.args.map((a) => Buffer.from(a).toString('base64'))}` : ''} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
560
+ });
561
+ /**
562
+ * Create a smart contract via an ABI method.
563
+ *
564
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
565
+ *
566
+ * @param params The parameters for the app creation transaction
567
+ * @example Basic example
568
+ * ```typescript
569
+ * const method = new ABIMethod({
570
+ * name: 'method',
571
+ * args: [{ name: 'arg1', type: 'string' }],
572
+ * returns: { type: 'string' },
573
+ * })
574
+ * const result = await algorand.send.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
575
+ * const createdAppId = result.appId
576
+ * ```
577
+ * @example Advanced example
578
+ * ```typescript
579
+ * const method = new ABIMethod({
580
+ * name: 'method',
581
+ * args: [{ name: 'arg1', type: 'string' }],
582
+ * returns: { type: 'string' },
583
+ * })
584
+ * await algorand.send.appCreate({
585
+ * sender: 'CREATORADDRESS',
586
+ * method: method,
587
+ * args: ["arg1_value"],
588
+ * approvalProgram: "TEALCODE",
589
+ * clearStateProgram: "TEALCODE",
590
+ * schema: {
591
+ * globalInts: 1,
592
+ * globalByteSlices: 2,
593
+ * localInts: 3,
594
+ * localByteSlices: 4
595
+ * },
596
+ * extraProgramPages: 1,
597
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
598
+ * args: [new Uint8Array(1, 2, 3, 4)]
599
+ * accountReferences: ["ACCOUNT_1"]
600
+ * appReferences: [123n, 1234n]
601
+ * assetReferences: [12345n]
602
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
603
+ * lease: 'lease',
604
+ * note: 'note',
605
+ * // You wouldn't normally set this field
606
+ * firstValidRound: 1000n,
607
+ * validityWindow: 10,
608
+ * extraFee: (1000).microAlgo(),
609
+ * staticFee: (1000).microAlgo(),
610
+ * // Max fee doesn't make sense with extraFee AND staticFee
611
+ * // already specified, but here for completeness
612
+ * maxFee: (3000).microAlgo(),
613
+ * // Signer only needed if you want to provide one,
614
+ * // generally you'd register it with AlgorandClient
615
+ * // against the sender and not need to pass it in
616
+ * signer: transactionSigner,
617
+ * maxRoundsToWaitForConfirmation: 5,
618
+ * suppressLog: true,
619
+ *})
620
+ * ```
621
+ */
622
+ this.appCreateMethodCall = this._sendAppCreateCall((c) => c.addAppCreateMethodCall, {
623
+ postLog: (params, result) => `App created by ${params.sender} with ID ${result.confirmation.applicationIndex} via transaction ${result.txIds.at(-1)}`,
624
+ });
625
+ /**
626
+ * Update a smart contract via an ABI method.
627
+ *
628
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
629
+ *
630
+ * @param params The parameters for the app update transaction
631
+ * @example Basic example
632
+ * ```typescript
633
+ * const method = new ABIMethod({
634
+ * name: 'method',
635
+ * args: [{ name: 'arg1', type: 'string' }],
636
+ * returns: { type: 'string' },
637
+ * })
638
+ * await algorand.send.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: ["arg1_value"] })
639
+ * ```
640
+ * @example Advanced example
641
+ * ```typescript
642
+ * const method = new ABIMethod({
643
+ * name: 'method',
644
+ * args: [{ name: 'arg1', type: 'string' }],
645
+ * returns: { type: 'string' },
646
+ * })
647
+ * await algorand.send.appUpdateMethodCall({
648
+ * sender: 'CREATORADDRESS',
649
+ * method: method,
650
+ * args: ["arg1_value"],
651
+ * approvalProgram: "TEALCODE",
652
+ * clearStateProgram: "TEALCODE",
653
+ * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
654
+ * args: [new Uint8Array(1, 2, 3, 4)]
655
+ * accountReferences: ["ACCOUNT_1"]
656
+ * appReferences: [123n, 1234n]
657
+ * assetReferences: [12345n]
658
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
659
+ * lease: 'lease',
660
+ * note: 'note',
661
+ * // You wouldn't normally set this field
662
+ * firstValidRound: 1000n,
663
+ * validityWindow: 10,
664
+ * extraFee: (1000).microAlgo(),
665
+ * staticFee: (1000).microAlgo(),
666
+ * // Max fee doesn't make sense with extraFee AND staticFee
667
+ * // already specified, but here for completeness
668
+ * maxFee: (3000).microAlgo(),
669
+ * // Signer only needed if you want to provide one,
670
+ * // generally you'd register it with AlgorandClient
671
+ * // against the sender and not need to pass it in
672
+ * signer: transactionSigner,
673
+ * maxRoundsToWaitForConfirmation: 5,
674
+ * suppressLog: true,
675
+ *})
676
+ * ```
677
+ */
678
+ this.appUpdateMethodCall = this._sendAppUpdateCall((c) => c.addAppUpdateMethodCall, {
679
+ postLog: (params, result) => `App ${params.appId} updated with ${getMethodCallForLog(params)} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
680
+ });
681
+ /**
682
+ * Delete a smart contract via an ABI method.
683
+ *
684
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
685
+ *
686
+ * @param params The parameters for the app deletion transaction
687
+ * @example Basic example
688
+ * ```typescript
689
+ * const method = new ABIMethod({
690
+ * name: 'method',
691
+ * args: [{ name: 'arg1', type: 'string' }],
692
+ * returns: { type: 'string' },
693
+ * })
694
+ * await algorand.send.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
695
+ * ```
696
+ * @example Advanced example
697
+ * ```typescript
698
+ * const method = new ABIMethod({
699
+ * name: 'method',
700
+ * args: [{ name: 'arg1', type: 'string' }],
701
+ * returns: { type: 'string' },
702
+ * })
703
+ * await algorand.send.appDeleteMethodCall({
704
+ * sender: 'CREATORADDRESS',
705
+ * method: method,
706
+ * args: ["arg1_value"],
707
+ * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,
708
+ * args: [new Uint8Array(1, 2, 3, 4)]
709
+ * accountReferences: ["ACCOUNT_1"]
710
+ * appReferences: [123n, 1234n]
711
+ * assetReferences: [12345n]
712
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
713
+ * lease: 'lease',
714
+ * note: 'note',
715
+ * // You wouldn't normally set this field
716
+ * firstValidRound: 1000n,
717
+ * validityWindow: 10,
718
+ * extraFee: (1000).microAlgo(),
719
+ * staticFee: (1000).microAlgo(),
720
+ * // Max fee doesn't make sense with extraFee AND staticFee
721
+ * // already specified, but here for completeness
722
+ * maxFee: (3000).microAlgo(),
723
+ * // Signer only needed if you want to provide one,
724
+ * // generally you'd register it with AlgorandClient
725
+ * // against the sender and not need to pass it in
726
+ * signer: transactionSigner,
727
+ * maxRoundsToWaitForConfirmation: 5,
728
+ * suppressLog: true,
729
+ *})
730
+ * ```
731
+ */
732
+ this.appDeleteMethodCall = this._sendAppCall((c) => c.addAppDeleteMethodCall, {
733
+ postLog: (params, result) => `App ${params.appId} deleted with ${getMethodCallForLog(params)} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
734
+ });
735
+ /**
736
+ * Call a smart contract via an ABI method.
737
+ *
738
+ * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.
739
+ *
740
+ * @param params The parameters for the app call transaction
741
+ * @example Basic example
742
+ * ```typescript
743
+ * const method = new ABIMethod({
744
+ * name: 'method',
745
+ * args: [{ name: 'arg1', type: 'string' }],
746
+ * returns: { type: 'string' },
747
+ * })
748
+ * await algorand.send.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: ["arg1_value"] })
749
+ * ```
750
+ * @example Advanced example
751
+ * ```typescript
752
+ * const method = new ABIMethod({
753
+ * name: 'method',
754
+ * args: [{ name: 'arg1', type: 'string' }],
755
+ * returns: { type: 'string' },
756
+ * })
757
+ * await algorand.send.appCallMethodCall({
758
+ * sender: 'CREATORADDRESS',
759
+ * method: method,
760
+ * args: ["arg1_value"],
761
+ * onComplete: algosdk.OnApplicationComplete.OptInOC,
762
+ * args: [new Uint8Array(1, 2, 3, 4)]
763
+ * accountReferences: ["ACCOUNT_1"]
764
+ * appReferences: [123n, 1234n]
765
+ * assetReferences: [12345n]
766
+ * boxReferences: ["box1", {appId: 1234n, name: "box2"}]
767
+ * lease: 'lease',
768
+ * note: 'note',
769
+ * // You wouldn't normally set this field
770
+ * firstValidRound: 1000n,
771
+ * validityWindow: 10,
772
+ * extraFee: (1000).microAlgo(),
773
+ * staticFee: (1000).microAlgo(),
774
+ * // Max fee doesn't make sense with extraFee AND staticFee
775
+ * // already specified, but here for completeness
776
+ * maxFee: (3000).microAlgo(),
777
+ * // Signer only needed if you want to provide one,
778
+ * // generally you'd register it with AlgorandClient
779
+ * // against the sender and not need to pass it in
780
+ * signer: transactionSigner,
781
+ * maxRoundsToWaitForConfirmation: 5,
782
+ * suppressLog: true,
783
+ *})
784
+ * ```
785
+ */
786
+ this.appCallMethodCall = this._sendAppCall((c) => c.addAppCallMethodCall, {
787
+ postLog: (params, result) => `App ${params.appId} called with ${getMethodCallForLog(params)} by ${params.sender} via transaction ${result.txIds.at(-1)}`,
788
+ });
789
+ /** Register an online key. */
790
+ this.onlineKeyRegistration = this._send((c) => c.addOnlineKeyRegistration, {
791
+ preLog: (params, transaction) => `Registering online key for ${params.sender} via transaction ${transaction.txID()}`,
792
+ });
793
+ this._newGroup = newGroup;
794
+ this._assetManager = assetManager;
795
+ this._appManager = appManager;
796
+ }
797
+ newGroup() {
798
+ return this._newGroup();
799
+ }
800
+ _send(c, log) {
801
+ return async (params) => {
802
+ const composer = this._newGroup();
803
+ // Ensure `this` is properly populated
804
+ c(composer).apply(composer, [params]);
805
+ if (log?.preLog) {
806
+ const transaction = (await composer.build()).transactions.at(-1).txn;
807
+ Config.getLogger(params?.suppressLog).debug(log.preLog(params, transaction));
808
+ }
809
+ const rawResult = await composer.send(params);
810
+ const result = {
811
+ // Last item covers when a group is created by an app call with ABI transaction parameters
812
+ transaction: rawResult.transactions.at(-1),
813
+ confirmation: rawResult.confirmations.at(-1),
814
+ txId: rawResult.txIds.at(-1),
815
+ ...rawResult,
816
+ };
817
+ if (log?.postLog) {
818
+ Config.getLogger(params?.suppressLog).debug(log.postLog(params, result));
819
+ }
820
+ return result;
821
+ };
822
+ }
823
+ _sendAppCall(c, log) {
824
+ return async (params) => {
825
+ const result = await this._send(c, log)(params);
826
+ return { ...result, return: AppManager.getABIReturn(result.confirmation, 'method' in params ? params.method : undefined) };
827
+ };
828
+ }
829
+ _sendAppUpdateCall(c, log) {
830
+ return async (params) => {
831
+ const result = await this._sendAppCall(c, log)(params);
832
+ const compiledApproval = typeof params.approvalProgram === 'string' ? this._appManager.getCompilationResult(params.approvalProgram) : undefined;
833
+ const compiledClear = typeof params.clearStateProgram === 'string' ? this._appManager.getCompilationResult(params.clearStateProgram) : undefined;
834
+ return { ...result, compiledApproval, compiledClear };
835
+ };
836
+ }
837
+ _sendAppCreateCall(c, log) {
838
+ return async (params) => {
839
+ const result = await this._sendAppUpdateCall(c, log)(params);
840
+ return {
841
+ ...result,
842
+ appId: BigInt(result.confirmation.applicationIndex),
843
+ appAddress: algosdk.getApplicationAddress(result.confirmation.applicationIndex),
844
+ };
845
+ };
846
+ }
847
+ }
848
+
849
+ export { AlgorandClientTransactionSender };
850
+ //# sourceMappingURL=algorand-client-transaction-sender.mjs.map