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