@algorandfoundation/algokit-utils 9.2.0 → 9.2.1-beta.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 (340) hide show
  1. package/_virtual/_rolldown/runtime.js +33 -0
  2. package/_virtual/_rolldown/runtime.mjs +13 -0
  3. package/account/account.d.ts +25 -30
  4. package/account/account.js +151 -146
  5. package/account/account.js.map +1 -1
  6. package/account/account.mjs +149 -144
  7. package/account/account.mjs.map +1 -1
  8. package/account/get-account-config-from-environment.d.ts +7 -2
  9. package/account/get-account-config-from-environment.js +19 -21
  10. package/account/get-account-config-from-environment.js.map +1 -1
  11. package/account/get-account-config-from-environment.mjs +19 -19
  12. package/account/get-account-config-from-environment.mjs.map +1 -1
  13. package/account/get-account.d.ts +14 -12
  14. package/account/get-account.js +56 -59
  15. package/account/get-account.js.map +1 -1
  16. package/account/get-account.mjs +56 -57
  17. package/account/get-account.mjs.map +1 -1
  18. package/account/get-dispenser-account.d.ts +9 -5
  19. package/account/get-dispenser-account.js +20 -18
  20. package/account/get-dispenser-account.js.map +1 -1
  21. package/account/get-dispenser-account.mjs +20 -16
  22. package/account/get-dispenser-account.mjs.map +1 -1
  23. package/account/mnemonic-account.d.ts +7 -3
  24. package/account/mnemonic-account.js +17 -17
  25. package/account/mnemonic-account.js.map +1 -1
  26. package/account/mnemonic-account.mjs +15 -15
  27. package/account/mnemonic-account.mjs.map +1 -1
  28. package/amount.d.ts +40 -35
  29. package/amount.js +33 -34
  30. package/amount.js.map +1 -1
  31. package/amount.mjs +33 -32
  32. package/amount.mjs.map +1 -1
  33. package/app-client.d.ts +10 -6
  34. package/app-client.js +91 -86
  35. package/app-client.js.map +1 -1
  36. package/app-client.mjs +91 -84
  37. package/app-client.mjs.map +1 -1
  38. package/app-deploy.d.ts +26 -24
  39. package/app-deploy.js +235 -253
  40. package/app-deploy.js.map +1 -1
  41. package/app-deploy.mjs +233 -251
  42. package/app-deploy.mjs.map +1 -1
  43. package/app.d.ts +45 -46
  44. package/app.js +253 -271
  45. package/app.js.map +1 -1
  46. package/app.mjs +249 -267
  47. package/app.mjs.map +1 -1
  48. package/asset.d.ts +16 -12
  49. package/asset.js +116 -122
  50. package/asset.js.map +1 -1
  51. package/asset.mjs +116 -120
  52. package/asset.mjs.map +1 -1
  53. package/config.d.ts +7 -2
  54. package/config.js +5 -7
  55. package/config.js.map +1 -1
  56. package/config.mjs +5 -4
  57. package/config.mjs.map +1 -1
  58. package/debugging/debugging.d.ts +5 -1
  59. package/debugging/debugging.js +11 -11
  60. package/debugging/debugging.js.map +1 -1
  61. package/debugging/debugging.mjs +11 -9
  62. package/debugging/debugging.mjs.map +1 -1
  63. package/dispenser-client.d.ts +7 -2
  64. package/dispenser-client.js +23 -24
  65. package/dispenser-client.js.map +1 -1
  66. package/dispenser-client.mjs +23 -22
  67. package/dispenser-client.mjs.map +1 -1
  68. package/index.d.ts +27 -18
  69. package/index.js +140 -143
  70. package/index.mjs +27 -29
  71. package/indexer-lookup.d.ts +18 -11
  72. package/indexer-lookup.js +112 -120
  73. package/indexer-lookup.js.map +1 -1
  74. package/indexer-lookup.mjs +105 -118
  75. package/indexer-lookup.mjs.map +1 -1
  76. package/localnet/get-kmd-wallet-account.d.ts +9 -7
  77. package/localnet/get-kmd-wallet-account.js +28 -26
  78. package/localnet/get-kmd-wallet-account.js.map +1 -1
  79. package/localnet/get-kmd-wallet-account.mjs +28 -24
  80. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  81. package/localnet/get-localnet-dispenser-account.d.ts +7 -5
  82. package/localnet/get-localnet-dispenser-account.js +17 -15
  83. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  84. package/localnet/get-localnet-dispenser-account.mjs +17 -13
  85. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  86. package/localnet/get-or-create-kmd-wallet-account.d.ts +10 -8
  87. package/localnet/get-or-create-kmd-wallet-account.js +28 -26
  88. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  89. package/localnet/get-or-create-kmd-wallet-account.mjs +28 -24
  90. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  91. package/localnet/is-localnet.d.ts +7 -3
  92. package/localnet/is-localnet.js +9 -10
  93. package/localnet/is-localnet.js.map +1 -1
  94. package/localnet/is-localnet.mjs +9 -8
  95. package/localnet/is-localnet.mjs.map +1 -1
  96. package/network-client.d.ts +17 -15
  97. package/network-client.js +115 -116
  98. package/network-client.js.map +1 -1
  99. package/network-client.mjs +115 -114
  100. package/network-client.mjs.map +1 -1
  101. package/package.json +12 -3
  102. package/testing/account.d.ts +11 -9
  103. package/testing/account.js +31 -33
  104. package/testing/account.js.map +1 -1
  105. package/testing/account.mjs +29 -31
  106. package/testing/account.mjs.map +1 -1
  107. package/testing/fixtures/algokit-log-capture-fixture.d.ts +7 -2
  108. package/testing/fixtures/algokit-log-capture-fixture.js +36 -41
  109. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  110. package/testing/fixtures/algokit-log-capture-fixture.mjs +36 -39
  111. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  112. package/testing/fixtures/algorand-fixture.d.ts +9 -4
  113. package/testing/fixtures/algorand-fixture.js +67 -62
  114. package/testing/fixtures/algorand-fixture.js.map +1 -1
  115. package/testing/fixtures/algorand-fixture.mjs +66 -59
  116. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  117. package/testing/index.d.ts +7 -5
  118. package/testing/index.js +13 -18
  119. package/testing/index.mjs +7 -7
  120. package/testing/indexer.d.ts +5 -1
  121. package/testing/indexer.js +28 -37
  122. package/testing/indexer.js.map +1 -1
  123. package/testing/indexer.mjs +28 -35
  124. package/testing/indexer.mjs.map +1 -1
  125. package/testing/test-logger.d.ts +41 -36
  126. package/testing/test-logger.js +71 -76
  127. package/testing/test-logger.js.map +1 -1
  128. package/testing/test-logger.mjs +71 -74
  129. package/testing/test-logger.mjs.map +1 -1
  130. package/testing/transaction-logger.d.ts +30 -27
  131. package/testing/transaction-logger.js +77 -93
  132. package/testing/transaction-logger.js.map +1 -1
  133. package/testing/transaction-logger.mjs +74 -90
  134. package/testing/transaction-logger.mjs.map +1 -1
  135. package/transaction/legacy-bridge.js +100 -111
  136. package/transaction/legacy-bridge.js.map +1 -1
  137. package/transaction/legacy-bridge.mjs +97 -108
  138. package/transaction/legacy-bridge.mjs.map +1 -1
  139. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +7 -5
  140. package/transaction/perform-atomic-transaction-composer-simulate.js +31 -36
  141. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  142. package/transaction/perform-atomic-transaction-composer-simulate.mjs +28 -33
  143. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  144. package/transaction/transaction.d.ts +34 -35
  145. package/transaction/transaction.js +716 -914
  146. package/transaction/transaction.js.map +1 -1
  147. package/transaction/transaction.mjs +713 -911
  148. package/transaction/transaction.mjs.map +1 -1
  149. package/transfer/transfer-algos.d.ts +9 -5
  150. package/transfer/transfer-algos.js +26 -27
  151. package/transfer/transfer-algos.js.map +1 -1
  152. package/transfer/transfer-algos.mjs +26 -25
  153. package/transfer/transfer-algos.mjs.map +1 -1
  154. package/transfer/transfer.d.ts +11 -8
  155. package/transfer/transfer.js +94 -100
  156. package/transfer/transfer.js.map +1 -1
  157. package/transfer/transfer.mjs +94 -98
  158. package/transfer/transfer.mjs.map +1 -1
  159. package/types/account-manager.d.ts +432 -429
  160. package/types/account-manager.js +591 -602
  161. package/types/account-manager.js.map +1 -1
  162. package/types/account-manager.mjs +587 -599
  163. package/types/account-manager.mjs.map +1 -1
  164. package/types/account.d.ts +192 -202
  165. package/types/account.js +91 -88
  166. package/types/account.js.map +1 -1
  167. package/types/account.mjs +88 -86
  168. package/types/account.mjs.map +1 -1
  169. package/types/algo-http-client-with-retry.d.ts +15 -10
  170. package/types/algo-http-client-with-retry.js +70 -92
  171. package/types/algo-http-client-with-retry.js.map +1 -1
  172. package/types/algo-http-client-with-retry.mjs +69 -90
  173. package/types/algo-http-client-with-retry.mjs.map +1 -1
  174. package/types/algorand-client-transaction-creator.d.ts +778 -771
  175. package/types/algorand-client-transaction-creator.js +733 -732
  176. package/types/algorand-client-transaction-creator.js.map +1 -1
  177. package/types/algorand-client-transaction-creator.mjs +732 -730
  178. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  179. package/types/algorand-client-transaction-sender.d.ts +1090 -1360
  180. package/types/algorand-client-transaction-sender.js +930 -961
  181. package/types/algorand-client-transaction-sender.js.map +1 -1
  182. package/types/algorand-client-transaction-sender.mjs +927 -959
  183. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  184. package/types/algorand-client.d.ts +239 -236
  185. package/types/algorand-client.js +322 -320
  186. package/types/algorand-client.js.map +1 -1
  187. package/types/algorand-client.mjs +321 -318
  188. package/types/algorand-client.mjs.map +1 -1
  189. package/types/amount.d.ts +47 -43
  190. package/types/amount.js +66 -70
  191. package/types/amount.js.map +1 -1
  192. package/types/amount.mjs +63 -68
  193. package/types/amount.mjs.map +1 -1
  194. package/types/app-arc56.d.ts +235 -272
  195. package/types/app-arc56.js +124 -170
  196. package/types/app-arc56.js.map +1 -1
  197. package/types/app-arc56.mjs +121 -168
  198. package/types/app-arc56.mjs.map +1 -1
  199. package/types/app-client.d.ts +1128 -2009
  200. package/types/app-client.js +1633 -1791
  201. package/types/app-client.js.map +1 -1
  202. package/types/app-client.mjs +1624 -1783
  203. package/types/app-client.mjs.map +1 -1
  204. package/types/app-deployer.d.ts +139 -141
  205. package/types/app-deployer.js +344 -384
  206. package/types/app-deployer.js.map +1 -1
  207. package/types/app-deployer.mjs +341 -382
  208. package/types/app-deployer.mjs.map +1 -1
  209. package/types/app-factory.d.ts +762 -932
  210. package/types/app-factory.js +496 -488
  211. package/types/app-factory.js.map +1 -1
  212. package/types/app-factory.mjs +491 -484
  213. package/types/app-factory.mjs.map +1 -1
  214. package/types/app-manager.d.ts +304 -310
  215. package/types/app-manager.js +422 -475
  216. package/types/app-manager.js.map +1 -1
  217. package/types/app-manager.mjs +419 -473
  218. package/types/app-manager.mjs.map +1 -1
  219. package/types/app-spec.d.ts +118 -117
  220. package/types/app-spec.js +125 -135
  221. package/types/app-spec.js.map +1 -1
  222. package/types/app-spec.mjs +121 -132
  223. package/types/app-spec.mjs.map +1 -1
  224. package/types/app.d.ts +229 -241
  225. package/types/app.js +36 -28
  226. package/types/app.js.map +1 -1
  227. package/types/app.mjs +33 -26
  228. package/types/app.mjs.map +1 -1
  229. package/types/asset-manager.d.ts +204 -199
  230. package/types/asset-manager.js +165 -174
  231. package/types/asset-manager.js.map +1 -1
  232. package/types/asset-manager.mjs +164 -172
  233. package/types/asset-manager.mjs.map +1 -1
  234. package/types/asset.d.ts +95 -91
  235. package/types/asset.js +0 -3
  236. package/types/asset.mjs +0 -2
  237. package/types/async-event-emitter.d.ts +18 -13
  238. package/types/async-event-emitter.js +37 -49
  239. package/types/async-event-emitter.js.map +1 -1
  240. package/types/async-event-emitter.mjs +36 -47
  241. package/types/async-event-emitter.mjs.map +1 -1
  242. package/types/client-manager.d.ts +453 -451
  243. package/types/client-manager.js +602 -598
  244. package/types/client-manager.js.map +1 -1
  245. package/types/client-manager.mjs +597 -594
  246. package/types/client-manager.mjs.map +1 -1
  247. package/types/composer.d.ts +1211 -1258
  248. package/types/composer.js +1436 -1498
  249. package/types/composer.js.map +1 -1
  250. package/types/composer.mjs +1430 -1493
  251. package/types/composer.mjs.map +1 -1
  252. package/types/config.d.ts +53 -48
  253. package/types/config.js +78 -77
  254. package/types/config.js.map +1 -1
  255. package/types/config.mjs +77 -75
  256. package/types/config.mjs.map +1 -1
  257. package/types/debugging.d.ts +25 -23
  258. package/types/debugging.js +9 -11
  259. package/types/debugging.js.map +1 -1
  260. package/types/debugging.mjs +8 -9
  261. package/types/debugging.mjs.map +1 -1
  262. package/types/dispenser-client.d.ts +57 -52
  263. package/types/dispenser-client.js +120 -141
  264. package/types/dispenser-client.js.map +1 -1
  265. package/types/dispenser-client.mjs +119 -139
  266. package/types/dispenser-client.mjs.map +1 -1
  267. package/types/expand.d.ts +5 -3
  268. package/types/expand.js +0 -3
  269. package/types/expand.mjs +0 -2
  270. package/types/indexer.d.ts +104 -100
  271. package/types/indexer.js +36 -31
  272. package/types/indexer.js.map +1 -1
  273. package/types/indexer.mjs +32 -30
  274. package/types/indexer.mjs.map +1 -1
  275. package/types/instance-of.d.ts +5 -3
  276. package/types/instance-of.js +0 -3
  277. package/types/instance-of.mjs +0 -2
  278. package/types/kmd-account-manager.d.ts +75 -70
  279. package/types/kmd-account-manager.js +150 -184
  280. package/types/kmd-account-manager.js.map +1 -1
  281. package/types/kmd-account-manager.mjs +147 -182
  282. package/types/kmd-account-manager.mjs.map +1 -1
  283. package/types/lifecycle-events.d.ts +13 -8
  284. package/types/lifecycle-events.js +10 -7
  285. package/types/lifecycle-events.js.map +1 -1
  286. package/types/lifecycle-events.mjs +9 -7
  287. package/types/lifecycle-events.mjs.map +1 -1
  288. package/types/logging.d.ts +15 -11
  289. package/types/logging.js +30 -31
  290. package/types/logging.js.map +1 -1
  291. package/types/logging.mjs +29 -29
  292. package/types/logging.mjs.map +1 -1
  293. package/types/logic-error.d.ts +33 -29
  294. package/types/logic-error.js +50 -49
  295. package/types/logic-error.js.map +1 -1
  296. package/types/logic-error.mjs +49 -47
  297. package/types/logic-error.mjs.map +1 -1
  298. package/types/network-client.d.ts +32 -27
  299. package/types/network-client.js +10 -9
  300. package/types/network-client.js.map +1 -1
  301. package/types/network-client.mjs +9 -7
  302. package/types/network-client.mjs.map +1 -1
  303. package/types/testing.d.ts +131 -132
  304. package/types/testing.js +0 -3
  305. package/types/testing.mjs +0 -2
  306. package/types/transaction.d.ts +110 -110
  307. package/types/transaction.js +0 -3
  308. package/types/transaction.mjs +0 -2
  309. package/types/transfer.d.ts +70 -66
  310. package/types/transfer.js +0 -3
  311. package/types/transfer.mjs +0 -2
  312. package/util.js +73 -118
  313. package/util.js.map +1 -1
  314. package/util.mjs +73 -116
  315. package/util.mjs.map +1 -1
  316. package/account/index.d.ts +0 -5
  317. package/debugging/index.d.ts +0 -1
  318. package/index.js.map +0 -1
  319. package/index.mjs.map +0 -1
  320. package/localnet/index.d.ts +0 -4
  321. package/testing/_asset.d.ts +0 -3
  322. package/testing/fixtures/index.d.ts +0 -2
  323. package/testing/index.js.map +0 -1
  324. package/testing/index.mjs.map +0 -1
  325. package/transaction/index.d.ts +0 -2
  326. package/transaction/legacy-bridge.d.ts +0 -35
  327. package/transfer/index.d.ts +0 -2
  328. package/types/asset.js.map +0 -1
  329. package/types/asset.mjs.map +0 -1
  330. package/types/expand.js.map +0 -1
  331. package/types/expand.mjs.map +0 -1
  332. package/types/instance-of.js.map +0 -1
  333. package/types/instance-of.mjs.map +0 -1
  334. package/types/testing.js.map +0 -1
  335. package/types/testing.mjs.map +0 -1
  336. package/types/transaction.js.map +0 -1
  337. package/types/transaction.mjs.map +0 -1
  338. package/types/transfer.js.map +0 -1
  339. package/types/transfer.mjs.map +0 -1
  340. package/util.d.ts +0 -48
package/app.mjs CHANGED
@@ -1,329 +1,311 @@
1
- import algosdk from 'algosdk';
2
- import { legacySendAppTransactionBridge, _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge.mjs';
3
- import { getSenderAddress, encodeLease } from './transaction/transaction.mjs';
4
- import { AppManager } from './types/app-manager.mjs';
5
- import { toNumber } from './util.mjs';
6
-
1
+ import { toNumber } from "./util.mjs";
2
+ import { encodeLease, getSenderAddress } from "./transaction/transaction.mjs";
3
+ import { AppManager } from "./types/app-manager.mjs";
4
+ import { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from "./transaction/legacy-bridge.mjs";
5
+ import algosdk from "algosdk";
6
+ //#region src/app.ts
7
7
  var ABIMethod = algosdk.ABIMethod;
8
8
  var OnApplicationComplete = algosdk.OnApplicationComplete;
9
9
  /**
10
- * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`
11
- * / `algorand.createTransaction.appCreateMethodCall()` instead
12
- *
13
- * Creates a smart contract app, returns the details of the created app.
14
- * @param create The parameters to create the app with
15
- * @param algod An algod client
16
- * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result
17
- */
10
+ * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`
11
+ * / `algorand.createTransaction.appCreateMethodCall()` instead
12
+ *
13
+ * Creates a smart contract app, returns the details of the created app.
14
+ * @param create The parameters to create the app with
15
+ * @param algod An algod client
16
+ * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result
17
+ */
18
18
  async function createApp(create, algod) {
19
- const onComplete = getAppOnCompleteAction(create.onCompleteAction);
20
- if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {
21
- throw new Error('Cannot create an app with on-complete action of ClearState');
22
- }
23
- const result = create.args?.method
24
- ? await legacySendAppTransactionBridge(algod, create.from, create.args, create, {
25
- sender: getSenderAddress(create.from),
26
- onComplete,
27
- approvalProgram: create.approvalProgram,
28
- clearStateProgram: create.clearStateProgram,
29
- method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),
30
- extraProgramPages: create.schema.extraPages,
31
- schema: create.schema,
32
- }, (c) => c.appCreateMethodCall, (c) => c.appCreateMethodCall)
33
- : await legacySendAppTransactionBridge(algod, create.from, create.args, create, {
34
- sender: getSenderAddress(create.from),
35
- onComplete,
36
- approvalProgram: create.approvalProgram,
37
- clearStateProgram: create.clearStateProgram,
38
- extraProgramPages: create.schema.extraPages,
39
- schema: create.schema,
40
- }, (c) => c.appCreate, (c) => c.appCreate);
41
- return {
42
- ...result,
43
- appId: 'appId' in result ? Number(result.appId) : 0,
44
- appAddress: 'appAddress' in result ? result.appAddress.toString() : '',
45
- };
19
+ const onComplete = getAppOnCompleteAction(create.onCompleteAction);
20
+ if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) throw new Error("Cannot create an app with on-complete action of ClearState");
21
+ const result = create.args?.method ? await legacySendAppTransactionBridge(algod, create.from, create.args, create, {
22
+ sender: getSenderAddress(create.from),
23
+ onComplete,
24
+ approvalProgram: create.approvalProgram,
25
+ clearStateProgram: create.clearStateProgram,
26
+ method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),
27
+ extraProgramPages: create.schema.extraPages,
28
+ schema: create.schema
29
+ }, (c) => c.appCreateMethodCall, (c) => c.appCreateMethodCall) : await legacySendAppTransactionBridge(algod, create.from, create.args, create, {
30
+ sender: getSenderAddress(create.from),
31
+ onComplete,
32
+ approvalProgram: create.approvalProgram,
33
+ clearStateProgram: create.clearStateProgram,
34
+ extraProgramPages: create.schema.extraPages,
35
+ schema: create.schema
36
+ }, (c) => c.appCreate, (c) => c.appCreate);
37
+ return {
38
+ ...result,
39
+ appId: "appId" in result ? Number(result.appId) : 0,
40
+ appAddress: "appAddress" in result ? result.appAddress.toString() : ""
41
+ };
46
42
  }
47
43
  /**
48
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
49
- * / `algorand.createTransaction.appUpdateMethodCall()` instead
50
- *
51
- * Updates a smart contract app.
52
- * @param update The parameters to update the app with
53
- * @param algod An algod client
54
- * @returns The transaction send result and the compilation result
55
- */
44
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
45
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
46
+ *
47
+ * Updates a smart contract app.
48
+ * @param update The parameters to update the app with
49
+ * @param algod An algod client
50
+ * @returns The transaction send result and the compilation result
51
+ */
56
52
  async function updateApp(update, algod) {
57
- return update.args?.method
58
- ? await legacySendAppTransactionBridge(algod, update.from, update.args, update, {
59
- appId: BigInt(update.appId),
60
- sender: getSenderAddress(update.from),
61
- onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
62
- approvalProgram: update.approvalProgram,
63
- clearStateProgram: update.clearStateProgram,
64
- method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),
65
- }, (c) => c.appUpdateMethodCall, (c) => c.appUpdateMethodCall)
66
- : await legacySendAppTransactionBridge(algod, update.from, update.args, update, {
67
- appId: BigInt(update.appId),
68
- sender: getSenderAddress(update.from),
69
- onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
70
- approvalProgram: update.approvalProgram,
71
- clearStateProgram: update.clearStateProgram,
72
- }, (c) => c.appUpdate, (c) => c.appUpdate);
53
+ return update.args?.method ? await legacySendAppTransactionBridge(algod, update.from, update.args, update, {
54
+ appId: BigInt(update.appId),
55
+ sender: getSenderAddress(update.from),
56
+ onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
57
+ approvalProgram: update.approvalProgram,
58
+ clearStateProgram: update.clearStateProgram,
59
+ method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method)
60
+ }, (c) => c.appUpdateMethodCall, (c) => c.appUpdateMethodCall) : await legacySendAppTransactionBridge(algod, update.from, update.args, update, {
61
+ appId: BigInt(update.appId),
62
+ sender: getSenderAddress(update.from),
63
+ onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,
64
+ approvalProgram: update.approvalProgram,
65
+ clearStateProgram: update.clearStateProgram
66
+ }, (c) => c.appUpdate, (c) => c.appUpdate);
73
67
  }
74
68
  /**
75
- * @deprecated Use `algosdk.OnApplicationComplete` directly instead.
76
- *
77
- * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.
78
- *
79
- * If given `undefined` will return `OnApplicationComplete.NoOpOC`.
80
- *
81
- * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.
82
- *
83
- * @param onCompletionAction The on completion action
84
- * @returns The `algosdk.OnApplicationComplete`
85
- */
69
+ * @deprecated Use `algosdk.OnApplicationComplete` directly instead.
70
+ *
71
+ * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.
72
+ *
73
+ * If given `undefined` will return `OnApplicationComplete.NoOpOC`.
74
+ *
75
+ * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.
76
+ *
77
+ * @param onCompletionAction The on completion action
78
+ * @returns The `algosdk.OnApplicationComplete`
79
+ */
86
80
  function getAppOnCompleteAction(onCompletionAction) {
87
- switch (onCompletionAction) {
88
- case undefined:
89
- case 'no_op':
90
- case OnApplicationComplete.NoOpOC:
91
- return OnApplicationComplete.NoOpOC;
92
- case 'opt_in':
93
- case OnApplicationComplete.OptInOC:
94
- return OnApplicationComplete.OptInOC;
95
- case 'close_out':
96
- case OnApplicationComplete.CloseOutOC:
97
- return OnApplicationComplete.CloseOutOC;
98
- case 'clear_state':
99
- case OnApplicationComplete.ClearStateOC:
100
- return OnApplicationComplete.ClearStateOC;
101
- case 'update_application':
102
- case OnApplicationComplete.UpdateApplicationOC:
103
- return OnApplicationComplete.UpdateApplicationOC;
104
- case 'delete_application':
105
- case OnApplicationComplete.DeleteApplicationOC:
106
- return OnApplicationComplete.DeleteApplicationOC;
107
- }
81
+ switch (onCompletionAction) {
82
+ case void 0:
83
+ case "no_op":
84
+ case OnApplicationComplete.NoOpOC: return OnApplicationComplete.NoOpOC;
85
+ case "opt_in":
86
+ case OnApplicationComplete.OptInOC: return OnApplicationComplete.OptInOC;
87
+ case "close_out":
88
+ case OnApplicationComplete.CloseOutOC: return OnApplicationComplete.CloseOutOC;
89
+ case "clear_state":
90
+ case OnApplicationComplete.ClearStateOC: return OnApplicationComplete.ClearStateOC;
91
+ case "update_application":
92
+ case OnApplicationComplete.UpdateApplicationOC: return OnApplicationComplete.UpdateApplicationOC;
93
+ case "delete_application":
94
+ case OnApplicationComplete.DeleteApplicationOC: return OnApplicationComplete.DeleteApplicationOC;
95
+ }
108
96
  }
109
97
  /**
110
- * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
111
- * / `algorand.createTransaction.appUpdateMethodCall()` instead
112
- *
113
- * Issues a call to a given app.
114
- * @param call The call details.
115
- * @param algod An algod client
116
- * @returns The result of the call
117
- */
98
+ * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
99
+ * / `algorand.createTransaction.appUpdateMethodCall()` instead
100
+ *
101
+ * Issues a call to a given app.
102
+ * @param call The call details.
103
+ * @param algod An algod client
104
+ * @returns The result of the call
105
+ */
118
106
  async function callApp(call, algod) {
119
- const onComplete = getAppOnCompleteAction(call.callType);
120
- if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {
121
- throw new Error('Cannot execute an app call with on-complete action of Update');
122
- }
123
- if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {
124
- throw new Error('Cannot execute an ABI method call with on-complete action of ClearState');
125
- }
126
- return call.args?.method
127
- ? await legacySendAppTransactionBridge(algod, call.from, call.args, call, {
128
- appId: BigInt(call.appId),
129
- sender: getSenderAddress(call.from),
130
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
131
- onComplete: onComplete,
132
- method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),
133
- }, (c) => c.appCallMethodCall, (c) => c.appCallMethodCall)
134
- : await legacySendAppTransactionBridge(algod, call.from, call.args, call, {
135
- appId: BigInt(call.appId),
136
- sender: getSenderAddress(call.from),
137
- onComplete,
138
- }, (c) => c.appCall, (c) => c.appCall);
107
+ const onComplete = getAppOnCompleteAction(call.callType);
108
+ if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) throw new Error("Cannot execute an app call with on-complete action of Update");
109
+ if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) throw new Error("Cannot execute an ABI method call with on-complete action of ClearState");
110
+ return call.args?.method ? await legacySendAppTransactionBridge(algod, call.from, call.args, call, {
111
+ appId: BigInt(call.appId),
112
+ sender: getSenderAddress(call.from),
113
+ onComplete,
114
+ method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method)
115
+ }, (c) => c.appCallMethodCall, (c) => c.appCallMethodCall) : await legacySendAppTransactionBridge(algod, call.from, call.args, call, {
116
+ appId: BigInt(call.appId),
117
+ sender: getSenderAddress(call.from),
118
+ onComplete
119
+ }, (c) => c.appCall, (c) => c.appCall);
139
120
  }
140
121
  /**
141
- * @deprecated Use `AppManager.getABIReturn` instead.
142
- *
143
- * Returns any ABI return values for the given app call arguments and transaction confirmation.
144
- * @param args The arguments that were used for the call
145
- * @param confirmation The transaction confirmation from algod
146
- * @returns The return value for the method call
147
- */
122
+ * @deprecated Use `AppManager.getABIReturn` instead.
123
+ *
124
+ * Returns any ABI return values for the given app call arguments and transaction confirmation.
125
+ * @param args The arguments that were used for the call
126
+ * @param confirmation The transaction confirmation from algod
127
+ * @returns The return value for the method call
128
+ */
148
129
  function getABIReturn(args, confirmation) {
149
- if (!args || !args.method) {
150
- return undefined;
151
- }
152
- const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method);
153
- return AppManager.getABIReturn(confirmation, method);
130
+ if (!args || !args.method) return;
131
+ const method = "txnCount" in args.method ? args.method : new ABIMethod(args.method);
132
+ return AppManager.getABIReturn(confirmation, method);
154
133
  }
155
134
  /**
156
- * @deprecated Use `algorand.app.getGlobalState` instead.
157
- *
158
- * Returns the current global state values for the given app ID
159
- * @param appId The ID of the app return global state for
160
- * @param algod An algod client instance
161
- * @returns The current global state
162
- */
135
+ * @deprecated Use `algorand.app.getGlobalState` instead.
136
+ *
137
+ * Returns the current global state values for the given app ID
138
+ * @param appId The ID of the app return global state for
139
+ * @param algod An algod client instance
140
+ * @returns The current global state
141
+ */
163
142
  async function getAppGlobalState(appId, algod) {
164
- return await new AppManager(algod).getGlobalState(BigInt(appId));
143
+ return await new AppManager(algod).getGlobalState(BigInt(appId));
165
144
  }
166
145
  /**
167
- * @deprecated Use `algorand.app.getLocalState` instead.
168
- *
169
- * Returns the current global state values for the given app ID and account
170
- * @param appId The ID of the app return global state for
171
- * @param account Either the string address of an account or an account object for the account to get local state for the given app
172
- * @param algod An algod client instance
173
- * @returns The current local state for the given (app, account) combination
174
- */
146
+ * @deprecated Use `algorand.app.getLocalState` instead.
147
+ *
148
+ * Returns the current global state values for the given app ID and account
149
+ * @param appId The ID of the app return global state for
150
+ * @param account Either the string address of an account or an account object for the account to get local state for the given app
151
+ * @param algod An algod client instance
152
+ * @returns The current local state for the given (app, account) combination
153
+ */
175
154
  async function getAppLocalState(appId, account, algod) {
176
- return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account));
155
+ return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account));
177
156
  }
178
157
  /**
179
- * @deprecated Use `algorand.app.getBoxNames` instead.
180
- * Returns the names of the boxes for the given app.
181
- * @param appId The ID of the app return box names for
182
- * @param algod An algod client instance
183
- * @returns The current box names
184
- */
158
+ * @deprecated Use `algorand.app.getBoxNames` instead.
159
+ * Returns the names of the boxes for the given app.
160
+ * @param appId The ID of the app return box names for
161
+ * @param algod An algod client instance
162
+ * @returns The current box names
163
+ */
185
164
  async function getAppBoxNames(appId, algod) {
186
- return new AppManager(algod).getBoxNames(BigInt(appId));
165
+ return new AppManager(algod).getBoxNames(BigInt(appId));
187
166
  }
188
167
  /**
189
- * @deprecated Use `algorand.app.getBoxValue` instead.
190
- * Returns the value of the given box name for the given app.
191
- * @param appId The ID of the app return box names for
192
- * @param boxName The name of the box to return either as a string, binary array or `BoxName`
193
- * @param algod An algod client instance
194
- * @returns The current box value as a byte array
195
- */
168
+ * @deprecated Use `algorand.app.getBoxValue` instead.
169
+ * Returns the value of the given box name for the given app.
170
+ * @param appId The ID of the app return box names for
171
+ * @param boxName The name of the box to return either as a string, binary array or `BoxName`
172
+ * @param algod An algod client instance
173
+ * @returns The current box value as a byte array
174
+ */
196
175
  async function getAppBoxValue(appId, boxName, algod) {
197
- return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName);
176
+ return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== "string" && "name" in boxName ? boxName.nameRaw : boxName);
198
177
  }
199
178
  /**
200
- * @deprecated Use `algorand.app.getBoxValues` instead.
201
- * Returns the value of the given box names for the given app.
202
- * @param appId The ID of the app return box names for
203
- * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`
204
- * @param algod An algod client instance
205
- * @returns The current box values as a byte array in the same order as the passed in box names
206
- */
179
+ * @deprecated Use `algorand.app.getBoxValues` instead.
180
+ * Returns the value of the given box names for the given app.
181
+ * @param appId The ID of the app return box names for
182
+ * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`
183
+ * @param algod An algod client instance
184
+ * @returns The current box values as a byte array in the same order as the passed in box names
185
+ */
207
186
  async function getAppBoxValues(appId, boxNames, algod) {
208
- return new AppManager(algod).getBoxValues(BigInt(appId), boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)));
187
+ return new AppManager(algod).getBoxValues(BigInt(appId), boxNames.map((b) => typeof b !== "string" && "name" in b ? b.nameRaw : b));
209
188
  }
210
189
  /**
211
- * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.
212
- * Returns the value of the given box name for the given app decoded based on the given ABI type.
213
- * @param request The parameters for the box value request
214
- * @param algod An algod client instance
215
- * @returns The current box value as an ABI value
216
- */
190
+ * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.
191
+ * Returns the value of the given box name for the given app decoded based on the given ABI type.
192
+ * @param request The parameters for the box value request
193
+ * @param algod An algod client instance
194
+ * @returns The current box value as an ABI value
195
+ */
217
196
  async function getAppBoxValueFromABIType(request, algod) {
218
- return new AppManager(algod).getBoxValueFromABIType({
219
- appId: BigInt(request.appId),
220
- boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,
221
- type: request.type,
222
- });
197
+ return new AppManager(algod).getBoxValueFromABIType({
198
+ appId: BigInt(request.appId),
199
+ boxName: typeof request.boxName !== "string" && "name" in request.boxName ? request.boxName.nameRaw : request.boxName,
200
+ type: request.type
201
+ });
223
202
  }
224
203
  /**
225
- * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.
226
- * Returns the value of the given box names for the given app decoded based on the given ABI type.
227
- * @param request The parameters for the box value request
228
- * @param algod An algod client instance
229
- * @returns The current box values as an ABI value in the same order as the passed in box names
230
- */
204
+ * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.
205
+ * Returns the value of the given box names for the given app decoded based on the given ABI type.
206
+ * @param request The parameters for the box value request
207
+ * @param algod An algod client instance
208
+ * @returns The current box values as an ABI value in the same order as the passed in box names
209
+ */
231
210
  async function getAppBoxValuesFromABIType(request, algod) {
232
- return new AppManager(algod).getBoxValuesFromABIType({
233
- appId: BigInt(request.appId),
234
- boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),
235
- type: request.type,
236
- });
211
+ return new AppManager(algod).getBoxValuesFromABIType({
212
+ appId: BigInt(request.appId),
213
+ boxNames: request.boxNames.map((b) => typeof b !== "string" && "name" in b ? b.nameRaw : b),
214
+ type: request.type
215
+ });
237
216
  }
238
217
  /**
239
- * @deprecated Use `AppManager.decodeAppState` instead.
240
- *
241
- * Converts an array of global/local state values from the algod api to a more friendly
242
- * generic object keyed by the UTF-8 value of the key.
243
- * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`
244
- * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values
245
- */
218
+ * @deprecated Use `AppManager.decodeAppState` instead.
219
+ *
220
+ * Converts an array of global/local state values from the algod api to a more friendly
221
+ * generic object keyed by the UTF-8 value of the key.
222
+ * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`
223
+ * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values
224
+ */
246
225
  function decodeAppState(state) {
247
- return AppManager.decodeAppState(state.map(({ key, value }) => ({ key: Buffer.from(key, 'utf-8'), value })));
226
+ return AppManager.decodeAppState(state.map(({ key, value }) => ({
227
+ key: Buffer.from(key, "utf-8"),
228
+ value
229
+ })));
248
230
  }
249
231
  /**
250
- * @deprecated Use `TransactionComposer` methods to construct transactions instead.
251
- *
252
- * Returns the app args ready to load onto an app `Transaction` object
253
- * @param args The app call args
254
- * @returns The args ready to load into a `Transaction`
255
- */
232
+ * @deprecated Use `TransactionComposer` methods to construct transactions instead.
233
+ *
234
+ * Returns the app args ready to load onto an app `Transaction` object
235
+ * @param args The app call args
236
+ * @returns The args ready to load into a `Transaction`
237
+ */
256
238
  function getAppArgsForTransaction(args) {
257
- if (!args)
258
- return undefined;
259
- const encoder = new TextEncoder();
260
- return {
261
- accounts: args?.accounts?.map(_getAccountAddress),
262
- appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),
263
- boxes: args.boxes?.map(getBoxReference),
264
- foreignApps: args?.apps,
265
- foreignAssets: args?.assets,
266
- lease: encodeLease(args?.lease),
267
- };
239
+ if (!args) return void 0;
240
+ const encoder = new TextEncoder();
241
+ return {
242
+ accounts: args?.accounts?.map(_getAccountAddress),
243
+ appArgs: args?.appArgs?.map((a) => typeof a === "string" ? encoder.encode(a) : a),
244
+ boxes: args.boxes?.map(getBoxReference),
245
+ foreignApps: args?.apps,
246
+ foreignAssets: args?.assets,
247
+ lease: encodeLease(args?.lease)
248
+ };
268
249
  }
269
250
  /**
270
- * @deprecated Use `TransactionComposer` methods to construct transactions instead.
271
- *
272
- * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
273
- * @param args The ABI app call args
274
- * @param from The transaction signer
275
- * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer
276
- */
251
+ * @deprecated Use `TransactionComposer` methods to construct transactions instead.
252
+ *
253
+ * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
254
+ * @param args The ABI app call args
255
+ * @param from The transaction signer
256
+ * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer
257
+ */
277
258
  async function getAppArgsForABICall(args, from) {
278
- return _getAppArgsForABICall(args, from);
259
+ return _getAppArgsForABICall(args, from);
279
260
  }
280
261
  /**
281
- * @deprecated Use `AppManager.getBoxReference()` instead.
282
- *
283
- * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.
284
- * @param box The box to return a reference for
285
- * @returns The box reference ready to pass into a `Transaction`
286
- */
262
+ * @deprecated Use `AppManager.getBoxReference()` instead.
263
+ *
264
+ * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.
265
+ * @param box The box to return a reference for
266
+ * @returns The box reference ready to pass into a `Transaction`
267
+ */
287
268
  function getBoxReference(box) {
288
- return _getBoxReference(box);
269
+ return _getBoxReference(box);
289
270
  }
290
271
  function _getAccountAddress(account) {
291
- return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey);
272
+ return typeof account === "string" ? account : algosdk.encodeAddress(account.publicKey);
292
273
  }
293
274
  /**
294
- * @deprecated Use `algorand.app.getById` instead.
295
- *
296
- * Gets the current data for the given app from algod.
297
- *
298
- * @param appId The id of the app
299
- * @param algod An algod client
300
- * @returns The data about the app
301
- */
275
+ * @deprecated Use `algorand.app.getById` instead.
276
+ *
277
+ * Gets the current data for the given app from algod.
278
+ *
279
+ * @param appId The id of the app
280
+ * @param algod An algod client
281
+ * @returns The data about the app
282
+ */
302
283
  async function getAppById(appId, algod) {
303
- return await algod.getApplicationByID(toNumber(appId)).do();
284
+ return await algod.getApplicationByID(toNumber(appId)).do();
304
285
  }
305
286
  /**
306
- * @deprecated Use `algorand.app.compileTeal` instead.
307
- *
308
- * Compiles the given TEAL using algod and returns the result, including source map.
309
- *
310
- * @param algod An algod client
311
- * @param tealCode The TEAL code
312
- * @returns The information about the compiled file
313
- */
287
+ * @deprecated Use `algorand.app.compileTeal` instead.
288
+ *
289
+ * Compiles the given TEAL using algod and returns the result, including source map.
290
+ *
291
+ * @param algod An algod client
292
+ * @param tealCode The TEAL code
293
+ * @returns The information about the compiled file
294
+ */
314
295
  async function compileTeal(tealCode, algod) {
315
- return await new AppManager(algod).compileTeal(tealCode);
296
+ return await new AppManager(algod).compileTeal(tealCode);
316
297
  }
317
298
  /**
318
- * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.
319
- *
320
- * Returns the encoded ABI spec for a given ABI Method
321
- * @param method The method to return a signature for
322
- * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`
323
- */
299
+ * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.
300
+ *
301
+ * Returns the encoded ABI spec for a given ABI Method
302
+ * @param method The method to return a signature for
303
+ * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`
304
+ */
324
305
  const getABIMethodSignature = (method) => {
325
- return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature();
306
+ return "getSignature" in method ? method.getSignature() : new ABIMethod(method).getSignature();
326
307
  };
327
-
308
+ //#endregion
328
309
  export { callApp, compileTeal, createApp, decodeAppState, getABIMethodSignature, getABIReturn, getAppArgsForABICall, getAppArgsForTransaction, getAppBoxNames, getAppBoxValue, getAppBoxValueFromABIType, getAppBoxValues, getAppBoxValuesFromABIType, getAppById, getAppGlobalState, getAppLocalState, getAppOnCompleteAction, getBoxReference, updateApp };
329
- //# sourceMappingURL=app.mjs.map
310
+
311
+ //# sourceMappingURL=app.mjs.map