@algorandfoundation/algokit-utils 9.2.0 → 9.2.1-beta.2

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