@algorandfoundation/algokit-utils 7.0.0-beta.2 → 7.0.0-beta.20

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 (352) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -25
  3. package/account/account.d.ts +1 -2
  4. package/account/account.js +6 -4
  5. package/account/account.js.map +1 -1
  6. package/account/account.mjs +6 -4
  7. package/account/account.mjs.map +1 -1
  8. package/account/get-account-config-from-environment.d.ts +0 -1
  9. package/account/get-account-config-from-environment.js.map +1 -1
  10. package/account/get-account-config-from-environment.mjs.map +1 -1
  11. package/account/get-account.d.ts +0 -1
  12. package/account/get-account.js.map +1 -1
  13. package/account/get-account.mjs.map +1 -1
  14. package/account/get-dispenser-account.d.ts +0 -1
  15. package/account/get-dispenser-account.js.map +1 -1
  16. package/account/get-dispenser-account.mjs.map +1 -1
  17. package/account/index.d.ts +0 -1
  18. package/account/mnemonic-account.d.ts +0 -1
  19. package/account/mnemonic-account.js.map +1 -1
  20. package/account/mnemonic-account.mjs.map +1 -1
  21. package/amount.d.ts +14 -5
  22. package/amount.js +6 -0
  23. package/amount.js.map +1 -1
  24. package/amount.mjs +6 -0
  25. package/amount.mjs.map +1 -1
  26. package/app-client.d.ts +15 -1
  27. package/app-client.js +15 -0
  28. package/app-client.js.map +1 -1
  29. package/app-client.mjs +15 -0
  30. package/app-client.mjs.map +1 -1
  31. package/app-deploy.d.ts +0 -1
  32. package/app-deploy.js +4 -6
  33. package/app-deploy.js.map +1 -1
  34. package/app-deploy.mjs +7 -9
  35. package/app-deploy.mjs.map +1 -1
  36. package/app.d.ts +10 -11
  37. package/app.js +15 -11
  38. package/app.js.map +1 -1
  39. package/app.mjs +15 -11
  40. package/app.mjs.map +1 -1
  41. package/asset.d.ts +3 -4
  42. package/asset.js +3 -6
  43. package/asset.js.map +1 -1
  44. package/asset.mjs +3 -6
  45. package/asset.mjs.map +1 -1
  46. package/config.d.ts +0 -1
  47. package/config.js.map +1 -1
  48. package/config.mjs.map +1 -1
  49. package/debugging/debugging.d.ts +3 -5
  50. package/debugging/debugging.js +4 -128
  51. package/debugging/debugging.js.map +1 -1
  52. package/debugging/debugging.mjs +4 -109
  53. package/debugging/debugging.mjs.map +1 -1
  54. package/debugging/index.d.ts +0 -2
  55. package/dispenser-client.d.ts +0 -1
  56. package/dispenser-client.js.map +1 -1
  57. package/dispenser-client.mjs.map +1 -1
  58. package/index.d.ts +6 -5
  59. package/index.js +48 -38
  60. package/index.js.map +1 -1
  61. package/index.mjs +6 -5
  62. package/index.mjs.map +1 -1
  63. package/indexer-lookup.d.ts +0 -1
  64. package/indexer-lookup.js.map +1 -1
  65. package/indexer-lookup.mjs.map +1 -1
  66. package/localnet/get-kmd-wallet-account.d.ts +0 -1
  67. package/localnet/get-kmd-wallet-account.js.map +1 -1
  68. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  69. package/localnet/get-localnet-dispenser-account.d.ts +0 -1
  70. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  71. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  72. package/localnet/get-or-create-kmd-wallet-account.d.ts +0 -1
  73. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  74. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  75. package/localnet/index.d.ts +0 -1
  76. package/localnet/is-localnet.d.ts +0 -1
  77. package/localnet/is-localnet.js.map +1 -1
  78. package/localnet/is-localnet.mjs.map +1 -1
  79. package/network-client.d.ts +0 -1
  80. package/network-client.js.map +1 -1
  81. package/network-client.mjs.map +1 -1
  82. package/package.json +2 -2
  83. package/testing/_asset.d.ts +0 -1
  84. package/testing/account.d.ts +0 -1
  85. package/testing/account.js.map +1 -1
  86. package/testing/account.mjs.map +1 -1
  87. package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
  88. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  89. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  90. package/testing/fixtures/algorand-fixture.d.ts +0 -1
  91. package/testing/fixtures/algorand-fixture.js +1 -1
  92. package/testing/fixtures/algorand-fixture.js.map +1 -1
  93. package/testing/fixtures/algorand-fixture.mjs +1 -1
  94. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  95. package/testing/fixtures/index.d.ts +0 -1
  96. package/testing/index.d.ts +0 -1
  97. package/testing/indexer.d.ts +0 -1
  98. package/testing/indexer.js.map +1 -1
  99. package/testing/indexer.mjs.map +1 -1
  100. package/testing/test-logger.d.ts +0 -1
  101. package/testing/test-logger.js +1 -3
  102. package/testing/test-logger.js.map +1 -1
  103. package/testing/test-logger.mjs +1 -3
  104. package/testing/test-logger.mjs.map +1 -1
  105. package/testing/transaction-logger.d.ts +0 -1
  106. package/testing/transaction-logger.js.map +1 -1
  107. package/testing/transaction-logger.mjs.map +1 -1
  108. package/transaction/index.d.ts +0 -1
  109. package/transaction/legacy-bridge.d.ts +5 -6
  110. package/transaction/legacy-bridge.js +1 -1
  111. package/transaction/legacy-bridge.js.map +1 -1
  112. package/transaction/legacy-bridge.mjs +4 -4
  113. package/transaction/legacy-bridge.mjs.map +1 -1
  114. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +0 -1
  115. package/transaction/perform-atomic-transaction-composer-simulate.js +1 -0
  116. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  117. package/transaction/perform-atomic-transaction-composer-simulate.mjs +1 -0
  118. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  119. package/transaction/transaction.d.ts +41 -6
  120. package/transaction/transaction.js +113 -61
  121. package/transaction/transaction.js.map +1 -1
  122. package/transaction/transaction.mjs +113 -62
  123. package/transaction/transaction.mjs.map +1 -1
  124. package/transfer/index.d.ts +0 -1
  125. package/transfer/transfer-algos.d.ts +1 -2
  126. package/transfer/transfer-algos.js +1 -1
  127. package/transfer/transfer-algos.js.map +1 -1
  128. package/transfer/transfer-algos.mjs +1 -1
  129. package/transfer/transfer-algos.mjs.map +1 -1
  130. package/transfer/transfer.d.ts +1 -2
  131. package/transfer/transfer.js +3 -3
  132. package/transfer/transfer.js.map +1 -1
  133. package/transfer/transfer.mjs +3 -3
  134. package/transfer/transfer.mjs.map +1 -1
  135. package/types/account-manager.d.ts +15 -7
  136. package/types/account-manager.js +27 -11
  137. package/types/account-manager.js.map +1 -1
  138. package/types/account-manager.mjs +29 -13
  139. package/types/account-manager.mjs.map +1 -1
  140. package/types/account.d.ts +9 -1
  141. package/types/account.js.map +1 -1
  142. package/types/account.mjs.map +1 -1
  143. package/types/algo-http-client-with-retry.d.ts +0 -1
  144. package/types/algo-http-client-with-retry.js.map +1 -1
  145. package/types/algo-http-client-with-retry.mjs.map +1 -1
  146. package/types/algorand-client-interface.d.ts +28 -0
  147. package/types/algorand-client-interface.js +3 -0
  148. package/types/algorand-client-interface.js.map +1 -0
  149. package/types/algorand-client-interface.mjs +2 -0
  150. package/types/algorand-client-interface.mjs.map +1 -0
  151. package/types/algorand-client-transaction-creator.d.ts +33 -34
  152. package/types/algorand-client-transaction-creator.js +31 -31
  153. package/types/algorand-client-transaction-creator.js.map +1 -1
  154. package/types/algorand-client-transaction-creator.mjs +31 -31
  155. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  156. package/types/algorand-client-transaction-sender.d.ts +31 -32
  157. package/types/algorand-client-transaction-sender.js +25 -9
  158. package/types/algorand-client-transaction-sender.js.map +1 -1
  159. package/types/algorand-client-transaction-sender.mjs +25 -9
  160. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  161. package/types/algorand-client.d.ts +13 -13
  162. package/types/algorand-client.js +10 -10
  163. package/types/algorand-client.js.map +1 -1
  164. package/types/algorand-client.mjs +12 -12
  165. package/types/algorand-client.mjs.map +1 -1
  166. package/types/amount.d.ts +10 -11
  167. package/types/amount.js +7 -7
  168. package/types/amount.js.map +1 -1
  169. package/types/amount.mjs +7 -7
  170. package/types/amount.mjs.map +1 -1
  171. package/types/app-arc56.d.ts +358 -0
  172. package/types/app-arc56.js +184 -0
  173. package/types/app-arc56.js.map +1 -0
  174. package/types/app-arc56.mjs +175 -0
  175. package/types/app-arc56.mjs.map +1 -0
  176. package/types/app-client.d.ts +1488 -8
  177. package/types/app-client.js +1000 -19
  178. package/types/app-client.js.map +1 -1
  179. package/types/app-client.mjs +1000 -20
  180. package/types/app-client.mjs.map +1 -1
  181. package/types/app-deployer.d.ts +19 -14
  182. package/types/app-deployer.js +25 -25
  183. package/types/app-deployer.js.map +1 -1
  184. package/types/app-deployer.mjs +27 -27
  185. package/types/app-deployer.mjs.map +1 -1
  186. package/types/app-factory.d.ts +846 -0
  187. package/types/app-factory.js +411 -0
  188. package/types/app-factory.js.map +1 -0
  189. package/types/app-factory.mjs +409 -0
  190. package/types/app-factory.mjs.map +1 -0
  191. package/types/app-manager.d.ts +12 -3
  192. package/types/app-manager.js +13 -15
  193. package/types/app-manager.js.map +1 -1
  194. package/types/app-manager.mjs +13 -15
  195. package/types/app-manager.mjs.map +1 -1
  196. package/types/app-spec.d.ts +2 -1
  197. package/types/app-spec.js +121 -0
  198. package/types/app-spec.js.map +1 -1
  199. package/types/app-spec.mjs +120 -0
  200. package/types/app-spec.mjs.map +1 -1
  201. package/types/app.d.ts +14 -9
  202. package/types/app.js.map +1 -1
  203. package/types/app.mjs.map +1 -1
  204. package/types/asset-manager.d.ts +7 -7
  205. package/types/asset-manager.js +5 -6
  206. package/types/asset-manager.js.map +1 -1
  207. package/types/asset-manager.mjs +5 -6
  208. package/types/asset-manager.mjs.map +1 -1
  209. package/types/asset.d.ts +0 -1
  210. package/types/async-event-emitter.d.ts +14 -0
  211. package/types/async-event-emitter.js +50 -0
  212. package/types/async-event-emitter.js.map +1 -0
  213. package/types/async-event-emitter.mjs +48 -0
  214. package/types/async-event-emitter.mjs.map +1 -0
  215. package/types/client-manager.d.ts +131 -51
  216. package/types/client-manager.js +143 -23
  217. package/types/client-manager.js.map +1 -1
  218. package/types/client-manager.mjs +144 -24
  219. package/types/client-manager.mjs.map +1 -1
  220. package/types/composer.d.ts +110 -37
  221. package/types/composer.js +139 -26
  222. package/types/composer.js.map +1 -1
  223. package/types/composer.mjs +140 -27
  224. package/types/composer.mjs.map +1 -1
  225. package/types/config.d.ts +3 -6
  226. package/types/config.js +5 -44
  227. package/types/config.js.map +1 -1
  228. package/types/config.mjs +5 -27
  229. package/types/config.mjs.map +1 -1
  230. package/types/debugging.d.ts +29 -101
  231. package/types/debugging.js +16 -109
  232. package/types/debugging.js.map +1 -1
  233. package/types/debugging.mjs +12 -107
  234. package/types/debugging.mjs.map +1 -1
  235. package/types/dispenser-client.d.ts +1 -2
  236. package/types/dispenser-client.js +6 -5
  237. package/types/dispenser-client.js.map +1 -1
  238. package/types/dispenser-client.mjs +6 -5
  239. package/types/dispenser-client.mjs.map +1 -1
  240. package/types/expand.d.ts +0 -1
  241. package/types/indexer.d.ts +0 -1
  242. package/types/indexer.js.map +1 -1
  243. package/types/indexer.mjs.map +1 -1
  244. package/types/kmd-account-manager.d.ts +0 -1
  245. package/types/kmd-account-manager.js +2 -2
  246. package/types/kmd-account-manager.js.map +1 -1
  247. package/types/kmd-account-manager.mjs +4 -4
  248. package/types/kmd-account-manager.mjs.map +1 -1
  249. package/types/lifecycle-events.d.ts +10 -0
  250. package/types/lifecycle-events.js +8 -0
  251. package/types/lifecycle-events.js.map +1 -0
  252. package/types/lifecycle-events.mjs +8 -0
  253. package/types/lifecycle-events.mjs.map +1 -0
  254. package/types/logging.d.ts +0 -1
  255. package/types/logging.js.map +1 -1
  256. package/types/logging.mjs.map +1 -1
  257. package/types/logic-error.d.ts +2 -4
  258. package/types/logic-error.js +3 -3
  259. package/types/logic-error.js.map +1 -1
  260. package/types/logic-error.mjs +3 -3
  261. package/types/logic-error.mjs.map +1 -1
  262. package/types/network-client.d.ts +13 -1
  263. package/types/network-client.js.map +1 -1
  264. package/types/network-client.mjs.map +1 -1
  265. package/types/testing.d.ts +3 -4
  266. package/types/transaction.d.ts +14 -4
  267. package/types/transfer.d.ts +0 -1
  268. package/types/urlTokenBaseHTTPClient.d.ts +0 -1
  269. package/types/urlTokenBaseHTTPClient.js +1 -1
  270. package/types/urlTokenBaseHTTPClient.js.map +1 -1
  271. package/types/urlTokenBaseHTTPClient.mjs +1 -1
  272. package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
  273. package/util.d.ts +2 -2
  274. package/util.js +11 -10
  275. package/util.js.map +1 -1
  276. package/util.mjs +11 -10
  277. package/util.mjs.map +1 -1
  278. package/account/account.d.ts.map +0 -1
  279. package/account/get-account-config-from-environment.d.ts.map +0 -1
  280. package/account/get-account.d.ts.map +0 -1
  281. package/account/get-dispenser-account.d.ts.map +0 -1
  282. package/account/index.d.ts.map +0 -1
  283. package/account/mnemonic-account.d.ts.map +0 -1
  284. package/amount.d.ts.map +0 -1
  285. package/app-client.d.ts.map +0 -1
  286. package/app-deploy.d.ts.map +0 -1
  287. package/app.d.ts.map +0 -1
  288. package/asset.d.ts.map +0 -1
  289. package/config.d.ts.map +0 -1
  290. package/debugging/debugging.d.ts.map +0 -1
  291. package/debugging/index.d.ts.map +0 -1
  292. package/debugging/simulate-and-persist-response.d.ts +0 -20
  293. package/debugging/simulate-and-persist-response.d.ts.map +0 -1
  294. package/debugging/simulate-and-persist-response.js +0 -108
  295. package/debugging/simulate-and-persist-response.js.map +0 -1
  296. package/debugging/simulate-and-persist-response.mjs +0 -89
  297. package/debugging/simulate-and-persist-response.mjs.map +0 -1
  298. package/dispenser-client.d.ts.map +0 -1
  299. package/index.d.ts.map +0 -1
  300. package/indexer-lookup.d.ts.map +0 -1
  301. package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
  302. package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
  303. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
  304. package/localnet/index.d.ts.map +0 -1
  305. package/localnet/is-localnet.d.ts.map +0 -1
  306. package/network-client.d.ts.map +0 -1
  307. package/testing/_asset.d.ts.map +0 -1
  308. package/testing/account.d.ts.map +0 -1
  309. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  310. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  311. package/testing/fixtures/index.d.ts.map +0 -1
  312. package/testing/index.d.ts.map +0 -1
  313. package/testing/indexer.d.ts.map +0 -1
  314. package/testing/test-logger.d.ts.map +0 -1
  315. package/testing/transaction-logger.d.ts.map +0 -1
  316. package/transaction/index.d.ts.map +0 -1
  317. package/transaction/legacy-bridge.d.ts.map +0 -1
  318. package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
  319. package/transaction/transaction.d.ts.map +0 -1
  320. package/transfer/index.d.ts.map +0 -1
  321. package/transfer/transfer-algos.d.ts.map +0 -1
  322. package/transfer/transfer.d.ts.map +0 -1
  323. package/types/account-manager.d.ts.map +0 -1
  324. package/types/account.d.ts.map +0 -1
  325. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  326. package/types/algorand-client-transaction-creator.d.ts.map +0 -1
  327. package/types/algorand-client-transaction-sender.d.ts.map +0 -1
  328. package/types/algorand-client.d.ts.map +0 -1
  329. package/types/amount.d.ts.map +0 -1
  330. package/types/app-client.d.ts.map +0 -1
  331. package/types/app-deployer.d.ts.map +0 -1
  332. package/types/app-manager.d.ts.map +0 -1
  333. package/types/app-spec.d.ts.map +0 -1
  334. package/types/app.d.ts.map +0 -1
  335. package/types/asset-manager.d.ts.map +0 -1
  336. package/types/asset.d.ts.map +0 -1
  337. package/types/client-manager.d.ts.map +0 -1
  338. package/types/composer.d.ts.map +0 -1
  339. package/types/config.d.ts.map +0 -1
  340. package/types/debugging.d.ts.map +0 -1
  341. package/types/dispenser-client.d.ts.map +0 -1
  342. package/types/expand.d.ts.map +0 -1
  343. package/types/indexer.d.ts.map +0 -1
  344. package/types/kmd-account-manager.d.ts.map +0 -1
  345. package/types/logging.d.ts.map +0 -1
  346. package/types/logic-error.d.ts.map +0 -1
  347. package/types/network-client.d.ts.map +0 -1
  348. package/types/testing.d.ts.map +0 -1
  349. package/types/transaction.d.ts.map +0 -1
  350. package/types/transfer.d.ts.map +0 -1
  351. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  352. package/util.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import algosdk from 'algosdk';
2
2
  import { AlgoHttpClientWithRetry } from './algo-http-client-with-retry.mjs';
3
- import { ApplicationClient } from './app-client.mjs';
3
+ import { AppClient } from './app-client.mjs';
4
+ import { AppFactory } from './app-factory.mjs';
4
5
  import { TestNetDispenserApiClient } from './dispenser-client.mjs';
5
6
  import { genesisIdIsLocalNet } from './network-client.mjs';
6
7
 
@@ -29,7 +30,7 @@ class ClientManager {
29
30
  * const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })
30
31
  * ```
31
32
  */
32
- constructor(clientsOrConfig) {
33
+ constructor(clientsOrConfig, algorandClient) {
33
34
  const _clients = 'algod' in clientsOrConfig
34
35
  ? clientsOrConfig
35
36
  : {
@@ -40,6 +41,7 @@ class ClientManager {
40
41
  this._algod = _clients.algod;
41
42
  this._indexer = _clients.indexer;
42
43
  this._kmd = _clients.kmd;
44
+ this._algorand = algorandClient;
43
45
  }
44
46
  /** Returns an algosdk Algod API client. */
45
47
  get algod() {
@@ -150,32 +152,105 @@ class ClientManager {
150
152
  return new TestNetDispenserApiClient(params ? { ...params, authToken: '' } : undefined);
151
153
  }
152
154
  /**
153
- * Returns a new `ApplicationClient` client, resolving the app by creator address and name.
154
- * @param details The details to resolve the app by creator address and name
155
- * @param cachedAppLookup A cached app lookup that matches a name to on-chain details; either this is needed or indexer is required to be passed in to this manager on construction.
156
- * @returns The `ApplicationClient`
155
+ * Returns a new `AppFactory` client
156
+ * @example Basic example
157
+ * ```typescript
158
+ * const factory = algorand.client.getAppFactory({
159
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\/}',
160
+ * })
161
+ * ```
162
+ * @example Advanced example
163
+ * ```typescript
164
+ * const factory = algorand.client.getAppFactory({
165
+ * appSpec: parsedAppSpec_AppSpec_or_Arc56Contract,
166
+ * defaultSender: "SENDERADDRESS",
167
+ * appName: "OverriddenAppName",
168
+ * version: "2.0.0",
169
+ * updatable: true,
170
+ * deletable: false,
171
+ * deployTimeParams: { ONE: 1, TWO: 'value' }
172
+ * })
173
+ * ```
157
174
  */
158
- getAppClientByCreatorAndName(details, cachedAppLookup) {
159
- return new ApplicationClient({ ...details, resolveBy: 'creatorAndName', findExistingUsing: cachedAppLookup ?? this.indexer }, this._algod);
175
+ getAppFactory(params) {
176
+ if (!this._algorand) {
177
+ throw new Error('Attempt to get app factory from a ClientManager without an Algorand client');
178
+ }
179
+ return new AppFactory({ ...params, algorand: this._algorand });
160
180
  }
161
181
  /**
162
- * Returns a new `ApplicationClient` client, resolving the app by app ID.
163
- * @param details The details to resolve the app by ID
164
- * @returns The `ApplicationClient`
182
+ * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
183
+ * This method resolves the app ID by looking up the creator address and name
184
+ * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
185
+ * @param params The parameters to create the app client
186
+ * @example Basic
187
+ * ```typescript
188
+ * const appClient = algorand.client.getAppClientByCreatorAndName({
189
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
190
+ * // appId resolved by looking for app ID of named app by this creator
191
+ * creatorAddress: 'CREATORADDRESS',
192
+ * })
193
+ * ```
194
+ * @returns The `AppClient`
195
+ */
196
+ getAppClientByCreatorAndName(params) {
197
+ if (!this._algorand) {
198
+ throw new Error('Attempt to get app client from a ClientManager without an Algorand client');
199
+ }
200
+ return AppClient.fromCreatorAndName({
201
+ ...params,
202
+ algorand: this._algorand,
203
+ });
204
+ }
205
+ /**
206
+ * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
207
+ * @param params The parameters to create the app client
208
+ * @example Basic
209
+ * ```typescript
210
+ * const appClient = algorand.client.getAppClientById({
211
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
212
+ * appId: 12345n,
213
+ * })
214
+ * ```
215
+ * @returns The `AppClient`
216
+ */
217
+ getAppClientById(params) {
218
+ if (!this._algorand) {
219
+ throw new Error('Attempt to get app client from a ClientManager without an Algorand client');
220
+ }
221
+ return new AppClient({ ...params, algorand: this._algorand });
222
+ }
223
+ /**
224
+ * Returns a new `AppClient` client for managing calls and state for an ARC-56 app.
225
+ * This method resolves the app ID for the current network based on
226
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
227
+ *
228
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
229
+ * @param params The parameters to create the app client
230
+ * @example Basic
231
+ * ```typescript
232
+ * const appClient = algorand.client.getAppClientByNetwork({
233
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
234
+ * // appId resolved by using ARC-56 spec to find app ID for current network
235
+ * })
236
+ * ```
237
+ * @returns The `AppClient`
165
238
  */
166
- getAppClientById(details) {
167
- return new ApplicationClient({ ...details, resolveBy: 'id' }, this._algod);
239
+ async getAppClientByNetwork(params) {
240
+ if (!this._algorand) {
241
+ throw new Error('Attempt to get app client from a ClientManager without an Algorand client');
242
+ }
243
+ return AppClient.fromNetwork({ ...params, algorand: this._algorand });
168
244
  }
169
245
  /**
170
246
  * Returns a new typed client, resolving the app by creator address and name.
171
247
  * @param typedClient The typed client type to use
172
- * @param details The details to resolve the app by creator address and name
173
- * @param cachedAppLookup A cached app lookup that matches a name to on-chain details; either this is needed or indexer is required to be passed in to this manager on construction.
174
- * @example Use name in ARC-32 app spec
248
+ * @param params The params to resolve the app by creator address and name
249
+ * @example Use name in ARC-32 / ARC-56 app spec
175
250
  * ```typescript
176
251
  * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {
177
252
  * creatorAddress: "CREATORADDRESS",
178
- * sender: alice,
253
+ * defaultSender: alice,
179
254
  * })
180
255
  * ```
181
256
  * @example Specify name
@@ -183,29 +258,74 @@ class ClientManager {
183
258
  * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {
184
259
  * creatorAddress: "CREATORADDRESS",
185
260
  * name: "contract-name",
186
- * sender: alice,
261
+ * defaultSender: alice,
187
262
  * })
188
263
  * ```
189
264
  * @returns The typed client instance
190
265
  */
191
- getTypedAppClientByCreatorAndName(typedClient, details, cachedAppLookup) {
192
- return new typedClient({ ...details, resolveBy: 'creatorAndName', findExistingUsing: cachedAppLookup ?? this.indexer }, this._algod);
266
+ async getTypedAppClientByCreatorAndName(typedClient, params) {
267
+ if (!this._algorand) {
268
+ throw new Error('Attempt to get app client from a ClientManager without an Algorand client');
269
+ }
270
+ return typedClient.fromCreatorAndName({ ...params, algorand: this._algorand });
193
271
  }
194
272
  /**
195
273
  * Returns a new typed client, resolving the app by app ID.
196
274
  * @param typedClient The typed client type to use
197
- * @param details The details to resolve the app by ID
275
+ * @param params The params to resolve the app by ID
198
276
  * @example
199
277
  * ```typescript
200
278
  * const appClient = algorand.client.getTypedAppClientById(MyContractClient, {
201
- * id: 12345,
279
+ * appId: 12345n,
280
+ * defaultSender: alice,
281
+ * })
282
+ * ```
283
+ * @returns The typed client instance
284
+ */
285
+ getTypedAppClientById(typedClient, params) {
286
+ if (!this._algorand) {
287
+ throw new Error('Attempt to get app client from a ClientManager without an Algorand client');
288
+ }
289
+ return new typedClient({ ...params, algorand: this._algorand });
290
+ }
291
+ /**
292
+ * Returns a new typed client, resolves the app ID for the current network based on
293
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
294
+ *
295
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
296
+ * @param typedClient The typed client type to use
297
+ * @param params The params to resolve the app by network
298
+ * @example
299
+ * ```typescript
300
+ * const appClient = algorand.client.getTypedAppClientByNetwork(MyContractClient, {
301
+ * defaultSender: alice,
302
+ * })
303
+ * ```
304
+ * @returns The typed client instance
305
+ */
306
+ getTypedAppClientByNetwork(typedClient, params) {
307
+ if (!this._algorand) {
308
+ throw new Error('Attempt to get app client from a ClientManager without an Algorand client');
309
+ }
310
+ return typedClient.fromNetwork({ ...params, algorand: this._algorand });
311
+ }
312
+ /**
313
+ * Returns a new typed app factory.
314
+ * @param typedFactory The typed factory type to use
315
+ * @param params The params to resolve the factory by
316
+ * @example
317
+ * ```typescript
318
+ * const appFactory = algorand.client.getTypedAppFactory(MyContractClient, {
202
319
  * sender: alice,
203
320
  * })
204
321
  * ```
205
322
  * @returns The typed client instance
206
323
  */
207
- getTypedAppClientById(typedClient, details) {
208
- return new typedClient({ ...details, resolveBy: 'id' }, this._algod);
324
+ getTypedAppFactory(typedFactory, params) {
325
+ if (!this._algorand) {
326
+ throw new Error('Attempt to get app factory from a ClientManager without an Algorand client');
327
+ }
328
+ return new typedFactory({ ...params, algorand: this._algorand });
209
329
  }
210
330
  /**
211
331
  * Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)
@@ -1 +1 @@
1
- {"version":3,"file":"client-manager.mjs","sources":["../../src/types/client-manager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAcA,IAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AACxB,IAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAEhC,IAAO,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;AA0BxC;MACa,aAAa,CAAA;AAKxB;;;;;;;;;;;;;;;;;;;AAmBG;AACH,IAAA,WAAA,CAAY,eAA4C,EAAA;AACtD,QAAA,MAAM,QAAQ,GACZ,OAAO,IAAI,eAAe;AACxB,cAAE,eAAe;AACjB,cAAE;gBACE,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,eAAe,CAAC,WAAW,CAAC;AAChE,gBAAA,OAAO,EAAE,eAAe,CAAC,aAAa,GAAG,aAAa,CAAC,gBAAgB,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG,SAAS;AAClH,gBAAA,GAAG,EAAE,eAAe,CAAC,SAAS,GAAG,aAAa,CAAC,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,SAAS;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AAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;QACtC,MAAM,WAAW,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,EAAE,CAAA;QAC9F,MAAM,mBAAmB,GAAG,IAAI,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;AAClF,QAAA,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAA;;QAEhD,OAAO,CAAC,cAAc,CAAC,mBAAmB,IAAI,WAAW,CAAC,KAAK,CAAC,CAAA;AAChE,QAAA,OAAO,OAAO,CAAA;KACf;AAED;;;;;;;;;;;AAWG;IACI,OAAO,+BAA+B,CAAC,mBAAiC,EAAA;QAC7E,OAAO,aAAa,CAAC,gBAAgB,CAAC,aAAa,CAAC,+BAA+B,EAAE,EAAE,mBAAmB,CAAC,CAAA;KAC5G;AAED;;;;;;;;;;AAUG;IACI,OAAO,YAAY,CAAC,MAAwB,EAAA;QACjD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;QACtC,OAAO,IAAI,GAAG,CAAC,KAAe,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;KAC9C;AAED;;;;;;;;AAQG;AACI,IAAA,OAAO,2BAA2B,GAAA;;;QAGvC,OAAO,aAAa,CAAC,YAAY,CAAC,EAAE,GAAG,aAAa,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAA;KAChI;AACF;;;;"}
1
+ {"version":3,"file":"client-manager.mjs","sources":["../../src/types/client-manager.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { SuggestedParamsWithMinFee } from 'algosdk/dist/types/types/transactions/base'\nimport { AlgoHttpClientWithRetry } from './algo-http-client-with-retry'\nimport { AlgorandClientInterface } from './algorand-client-interface'\nimport { AppClient, AppClientParams, ResolveAppClientByCreatorAndName } from './app-client'\nimport { AppFactory, AppFactoryParams } from './app-factory'\nimport { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from './dispenser-client'\nimport { Expand } from './expand'\nimport { AlgoClientConfig, AlgoConfig, NetworkDetails, genesisIdIsLocalNet } from './network-client'\nimport Kmd = algosdk.Kmd\nimport Indexer = algosdk.Indexer\nimport Algodv2 = algosdk.Algodv2\nimport IntDecoding = algosdk.IntDecoding\n\n/** Clients from algosdk that interact with the official Algorand APIs */\nexport interface AlgoSdkClients {\n /** Algod client, see https://developer.algorand.org/docs/rest-apis/algod/ */\n algod: algosdk.Algodv2\n /** Optional indexer client, see https://developer.algorand.org/docs/rest-apis/indexer/ */\n indexer?: algosdk.Indexer\n /** Optional KMD client, see https://developer.algorand.org/docs/rest-apis/kmd/ */\n kmd?: algosdk.Kmd\n}\n\n/** Params to get an app factory from `ClientManager`. */\nexport type ClientAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand'>>\n\n/** Params to get an app client by creator address and name from `ClientManager`. */\nexport type ClientResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand'>>\n\n/** Params to get an app client by ID from `ClientManager`. */\nexport type ClientAppClientParams = Expand<Omit<AppClientParams, 'algorand'>>\n\n/** Params to get an app client by network from `ClientManager`. */\nexport type ClientAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appId'>>\n\n/** Params to get a typed app client by creator address and name from `ClientManager`. */\nexport type ClientTypedAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>\n\n/** Params to get a typed app client by ID from `ClientManager`. */\nexport type ClientTypedAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>\n\n/** Params to get a typed app client by network from `ClientManager`. */\nexport type ClientTypedAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec' | 'appId'>>\n\n/** Params to get a typed app factory from `ClientManager`. */\nexport type ClientTypedAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand' | 'appSpec'>>\n\n/** Exposes access to various API clients. */\nexport class ClientManager {\n private _algod: algosdk.Algodv2\n private _indexer?: algosdk.Indexer\n private _kmd?: algosdk.Kmd\n private _algorand?: AlgorandClientInterface\n\n /**\n * algosdk clients or config for interacting with the official Algorand APIs.\n * @param clientsOrConfig The clients or config to use\n * @example Algod client only\n * ```typescript\n * const clientManager = new ClientManager({ algod: algodClient })\n * ```\n * @example All clients\n * ```typescript\n * const clientManager = new ClientManager({ algod: algodClient, indexer: indexerClient, kmd: kmdClient })\n * ```\n * @example Algod config only\n * ```typescript\n * const clientManager = new ClientManager({ algodConfig })\n * ```\n * @example All client configs\n * ```typescript\n * const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })\n * ```\n */\n constructor(clientsOrConfig: AlgoConfig | AlgoSdkClients, algorandClient?: AlgorandClientInterface) {\n const _clients =\n 'algod' in clientsOrConfig\n ? clientsOrConfig\n : {\n algod: ClientManager.getAlgodClient(clientsOrConfig.algodConfig),\n indexer: clientsOrConfig.indexerConfig ? ClientManager.getIndexerClient(clientsOrConfig.indexerConfig) : undefined,\n kmd: clientsOrConfig.kmdConfig ? ClientManager.getKmdClient(clientsOrConfig.kmdConfig) : undefined,\n }\n this._algod = _clients.algod\n this._indexer = _clients.indexer\n this._kmd = _clients.kmd\n this._algorand = algorandClient\n }\n\n /** Returns an algosdk Algod API client. */\n public get algod(): algosdk.Algodv2 {\n return this._algod\n }\n\n /** Returns an algosdk Indexer API client or throws an error if it's not been provided. */\n public get indexer(): algosdk.Indexer {\n if (!this._indexer) throw new Error('Attempt to use Indexer client in AlgoKit instance with no Indexer configured')\n return this._indexer\n }\n\n /** Returns an algosdk Indexer API client or `undefined` if it's not been provided. */\n public get indexerIfPresent(): algosdk.Indexer | undefined {\n return this._indexer\n }\n\n /** Returns an algosdk KMD API client or throws an error if it's not been provided. */\n public get kmd(): algosdk.Kmd {\n if (!this._kmd) throw new Error('Attempt to use Kmd client in AlgoKit instance with no Kmd configured')\n return this._kmd\n }\n\n private _getNetworkPromise: Promise<SuggestedParamsWithMinFee> | undefined\n /**\n * Get details about the current network.\n * @example Getting genesis ID\n * ```typescript\n * const network = await networkClient.network()\n * const genesisId = network.genesisId\n * ```\n * @returns The current network details\n */\n public async network(): Promise<NetworkDetails> {\n if (!this._getNetworkPromise) {\n this._getNetworkPromise = this._algod.getTransactionParams().do()\n }\n\n const params = await this._getNetworkPromise\n return {\n isTestNet: ['testnet-v1.0', 'testnet-v1', 'testnet'].includes(params.genesisID),\n isMainNet: ['mainnet-v1.0', 'mainnet-v1', 'mainnet'].includes(params.genesisID),\n isLocalNet: ClientManager.genesisIdIsLocalNet(params.genesisID),\n genesisId: params.genesisID,\n genesisHash: params.genesisHash,\n }\n }\n\n /**\n * Returns true if the given network genesisId is associated with a LocalNet network.\n * @param genesisId The network genesis ID\n * @returns Whether the given genesis ID is associated with a LocalNet network\n */\n public static genesisIdIsLocalNet(genesisId: string) {\n return genesisIdIsLocalNet(genesisId)\n }\n\n /**\n * Returns true if the current network is LocalNet.\n * @returns True if the current network is LocalNet.\n */\n public async isLocalNet() {\n return (await this.network()).isLocalNet\n }\n\n /**\n * Returns true if the current network is TestNet.\n * @returns True if the current network is TestNet.\n */\n public async isTestNet() {\n return (await this.network()).isTestNet\n }\n\n /**\n * Returns true if the current network is MainNet.\n * @returns True if the current network is MainNet.\n */\n public async isMainNet() {\n return (await this.network()).isMainNet\n }\n\n /**\n * Returns a TestNet Dispenser API client.\n *\n * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.\n *\n * @param params An object containing parameters for the TestNetDispenserApiClient class.\n * @example\n * const client = clientManager.getTestNetDispenser(\n * {\n * authToken: 'your_auth_token',\n * requestTimeout: 15,\n * }\n * )\n *\n * @returns An instance of the TestNetDispenserApiClient class.\n */\n public getTestNetDispenser(params: TestNetDispenserApiClientParams) {\n return new TestNetDispenserApiClient(params)\n }\n\n /**\n * Returns a TestNet Dispenser API client, loading the auth token from `process.env.ALGOKIT_DISPENSER_ACCESS_TOKEN`.\n *\n * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.\n *\n * @param params An object containing parameters for the TestNetDispenserApiClient class.\n * @example\n * const client = clientManager.getTestNetDispenserFromEnvironment(\n * {\n * requestTimeout: 15,\n * }\n * )\n *\n * @returns An instance of the TestNetDispenserApiClient class.\n */\n public getTestNetDispenserFromEnvironment(params?: Omit<TestNetDispenserApiClientParams, 'authToken'>) {\n return new TestNetDispenserApiClient(params ? { ...params, authToken: '' } : undefined)\n }\n\n /**\n * Returns a new `AppFactory` client\n * @example Basic example\n * ```typescript\n * const factory = algorand.client.getAppFactory({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\/}',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * const factory = algorand.client.getAppFactory({\n * appSpec: parsedAppSpec_AppSpec_or_Arc56Contract,\n * defaultSender: \"SENDERADDRESS\",\n * appName: \"OverriddenAppName\",\n * version: \"2.0.0\",\n * updatable: true,\n * deletable: false,\n * deployTimeParams: { ONE: 1, TWO: 'value' }\n * })\n * ```\n */\n public getAppFactory(params: ClientAppFactoryParams) {\n if (!this._algorand) {\n throw new Error('Attempt to get app factory from a ClientManager without an Algorand client')\n }\n\n return new AppFactory({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.\n * This method resolves the app ID by looking up the creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n * @param params The parameters to create the app client\n * @example Basic\n * ```typescript\n * const appClient = algorand.client.getAppClientByCreatorAndName({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\}',\n * // appId resolved by looking for app ID of named app by this creator\n * creatorAddress: 'CREATORADDRESS',\n * })\n * ```\n * @returns The `AppClient`\n */\n public getAppClientByCreatorAndName(params: ClientResolveAppClientByCreatorAndNameParams) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return AppClient.fromCreatorAndName({\n ...params,\n algorand: this._algorand,\n })\n }\n\n /**\n * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.\n * @param params The parameters to create the app client\n * @example Basic\n * ```typescript\n * const appClient = algorand.client.getAppClientById({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\}',\n * appId: 12345n,\n * })\n * ```\n * @returns The `AppClient`\n */\n public getAppClientById(params: ClientAppClientParams) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n return new AppClient({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new `AppClient` client for managing calls and state for an ARC-56 app.\n * This method resolves the app ID for the current network based on\n * pre-determined network-specific app IDs specified in the ARC-56 app spec.\n *\n * If no IDs are in the app spec or the network isn't recognised, an error is thrown.\n * @param params The parameters to create the app client\n * @example Basic\n * ```typescript\n * const appClient = algorand.client.getAppClientByNetwork({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\}',\n * // appId resolved by using ARC-56 spec to find app ID for current network\n * })\n * ```\n * @returns The `AppClient`\n */\n public async getAppClientByNetwork(params: ClientAppClientByNetworkParams) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n return AppClient.fromNetwork({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed client, resolving the app by creator address and name.\n * @param typedClient The typed client type to use\n * @param params The params to resolve the app by creator address and name\n * @example Use name in ARC-32 / ARC-56 app spec\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {\n * creatorAddress: \"CREATORADDRESS\",\n * defaultSender: alice,\n * })\n * ```\n * @example Specify name\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {\n * creatorAddress: \"CREATORADDRESS\",\n * name: \"contract-name\",\n * defaultSender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public async getTypedAppClientByCreatorAndName<TClient extends TypedAppClient<InstanceType<TClient>>>(\n typedClient: TClient,\n params: ClientTypedAppClientByCreatorAndNameParams,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return typedClient.fromCreatorAndName({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed client, resolving the app by app ID.\n * @param typedClient The typed client type to use\n * @param params The params to resolve the app by ID\n * @example\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientById(MyContractClient, {\n * appId: 12345n,\n * defaultSender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public getTypedAppClientById<TClient extends TypedAppClient<InstanceType<TClient>>>(\n typedClient: TClient,\n params: ClientTypedAppClientParams,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return new typedClient({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed client, resolves the app ID for the current network based on\n * pre-determined network-specific app IDs specified in the ARC-56 app spec.\n *\n * If no IDs are in the app spec or the network isn't recognised, an error is thrown.\n * @param typedClient The typed client type to use\n * @param params The params to resolve the app by network\n * @example\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientByNetwork(MyContractClient, {\n * defaultSender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public getTypedAppClientByNetwork<TClient extends TypedAppClient<InstanceType<TClient>>>(\n typedClient: TClient,\n params?: ClientTypedAppClientByNetworkParams,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return typedClient.fromNetwork({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed app factory.\n * @param typedFactory The typed factory type to use\n * @param params The params to resolve the factory by\n * @example\n * ```typescript\n * const appFactory = algorand.client.getTypedAppFactory(MyContractClient, {\n * sender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public getTypedAppFactory<TClient>(typedFactory: TypedAppFactory<TClient>, params?: ClientTypedAppFactoryParams) {\n if (!this._algorand) {\n throw new Error('Attempt to get app factory from a ClientManager without an Algorand client')\n }\n\n return new typedFactory({ ...params, algorand: this._algorand })\n }\n\n /**\n * Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)\n *\n * If both `process.env.INDEXER_SERVER` and `process.env.ALGOD_SERVER` is defined it will use both along with optional `process.env.ALGOD_PORT`, `process.env.ALGOD_TOKEN`, `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.\n *\n * If only `process.env.ALGOD_SERVER` is defined it will use this along with optional `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN` and leave indexer as `undefined`.\n *\n * If only `process.env.INDEXER_SERVER` is defined it will use the default (LocalNet) configuration for both algod and indexer.\n *\n * It will return a KMD configuration that uses `process.env.KMD_PORT` (or port 4002) if `process.env.ALGOD_SERVER` is defined,\n * otherwise it will use the default LocalNet config unless it detects testnet or mainnet.\n * @example\n * ```typescript\n * const config = ClientManager.getConfigFromEnvironmentOrLocalNet()\n * ```\n * @returns The config for algod, indexer and kmd\n */\n public static getConfigFromEnvironmentOrLocalNet(): AlgoConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get default client configuration from a non Node.js context; supply the config instead')\n }\n const [algodConfig, indexerConfig, kmdConfig] = process.env.ALGOD_SERVER\n ? [\n ClientManager.getAlgodConfigFromEnvironment(),\n process.env.INDEXER_SERVER ? ClientManager.getIndexerConfigFromEnvironment() : undefined,\n !process.env.ALGOD_SERVER.includes('mainnet') && !process.env.ALGOD_SERVER.includes('testnet')\n ? { ...ClientManager.getAlgodConfigFromEnvironment(), port: process?.env?.KMD_PORT ?? '4002' }\n : undefined,\n ]\n : [\n ClientManager.getDefaultLocalNetConfig('algod'),\n ClientManager.getDefaultLocalNetConfig('indexer'),\n ClientManager.getDefaultLocalNetConfig('kmd'),\n ]\n\n return {\n algodConfig,\n indexerConfig,\n kmdConfig,\n }\n }\n\n /** Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment)\n *\n * Expects `process.env.ALGOD_SERVER` to be defined, and you can also specify `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN`.\n */\n public static getAlgodConfigFromEnvironment(): AlgoClientConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get default algod configuration from a non Node.js context; supply the config instead')\n }\n\n if (!process.env.ALGOD_SERVER) {\n throw new Error('Attempt to get default algod configuration without specifying ALGOD_SERVER in the environment variables')\n }\n\n return {\n server: process.env.ALGOD_SERVER,\n port: process.env.ALGOD_PORT,\n token: process.env.ALGOD_TOKEN,\n }\n }\n\n /**\n * Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment).\n *\n * Expects `process.env.INDEXER_SERVER` to be defined, and you can also specify `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.\n */\n public static getIndexerConfigFromEnvironment(): AlgoClientConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get default indexer configuration from a non Node.js context; supply the config instead')\n }\n\n if (!process.env.INDEXER_SERVER) {\n throw new Error('Attempt to get default indexer configuration without specifying INDEXER_SERVER in the environment variables')\n }\n\n return {\n server: process.env.INDEXER_SERVER,\n port: process.env.INDEXER_PORT,\n token: process.env.INDEXER_TOKEN,\n }\n }\n\n /** Returns the Algorand configuration to point to the free tier of the AlgoNode service.\n *\n * @param network Which network to connect to - TestNet or MainNet\n * @param config Which algod config to return - Algod or Indexer\n */\n public static getAlgoNodeConfig(network: 'testnet' | 'mainnet', config: 'algod' | 'indexer'): AlgoClientConfig {\n return {\n server: `https://${network}-${config === 'algod' ? 'api' : 'idx'}.algonode.cloud/`,\n port: 443,\n }\n }\n\n /** Returns the Algorand configuration to point to the default LocalNet.\n *\n * @param configOrPort Which algod config to return - algod, kmd, or indexer OR a port number\n */\n public static getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexer' | 'kmd' | number): AlgoClientConfig {\n return {\n server: `http://localhost`,\n port: configOrPort === 'algod' ? 4001 : configOrPort === 'indexer' ? 8980 : configOrPort === 'kmd' ? 4002 : configOrPort,\n token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',\n }\n }\n\n /**\n * Returns an algod SDK client that automatically retries on idempotent calls.\n *\n * @param config The config of the client\n * @example AlgoNode (testnet)\n * ```typescript\n * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('testnet', 'algod'))\n * await algod.healthCheck().do()\n * ```\n * @example AlgoNode (mainnet)\n * ```typescript\n * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('mainnet', 'algod'))\n * await algod.healthCheck().do()\n * ```\n * @example Custom (e.g. default LocalNet)\n * ```typescript\n * const algod = ClientManager.getAlgodClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})\n * await algod.healthCheck().do()\n * ```\n */\n public static getAlgodClient(config: AlgoClientConfig): Algodv2 {\n const { token, server, port } = config\n const tokenHeader = typeof token === 'string' ? { 'X-Algo-API-Token': token } : token ?? {}\n const httpClientWithRetry = new AlgoHttpClientWithRetry(tokenHeader, server, port)\n return new algosdk.Algodv2(httpClientWithRetry, server)\n }\n\n /**\n * Returns an algod SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).\n *\n * @example\n * ```typescript\n * // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN\n * const algod = ClientManager.getAlgodClientFromEnvironment()\n * await algod.healthCheck().do()\n * ```\n */\n public static getAlgodClientFromEnvironment(): Algodv2 {\n return ClientManager.getAlgodClient(ClientManager.getAlgodConfigFromEnvironment())\n }\n\n /**\n * Returns an indexer SDK client that automatically retries on idempotent calls\n *\n * @param config The config of the client\n * @param overrideIntDecoding Override the default int decoding for responses, uses MIXED by default to avoid lost precision for big integers\n * @example AlgoNode (testnet)\n * ```typescript\n * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('testnet', 'indexer'))\n * await indexer.makeHealthCheck().do()\n * ```\n * @example AlgoNode (mainnet)\n * ```typescript\n * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('mainnet', 'indexer'))\n * await indexer.makeHealthCheck().do()\n * ```\n * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)\n * ```typescript\n * const indexer = ClientManager.getIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})\n * await indexer.makeHealthCheck().do()\n * ```\n * @example Override int decoding for responses\n * ```typescript\n * const indexer = ClientManager.getIndexerClient(config, IntDecoding.BIGINT)\n * ```\n */\n public static getIndexerClient(config: AlgoClientConfig, overrideIntDecoding?: IntDecoding): Indexer {\n const { token, server, port } = config\n const tokenHeader = typeof token === 'string' ? { 'X-Indexer-API-Token': token } : token ?? {}\n const httpClientWithRetry = new AlgoHttpClientWithRetry(tokenHeader, server, port)\n const indexer = new Indexer(httpClientWithRetry)\n // Use mixed int decoding by default so bigints don't have lost precision\n indexer.setIntEncoding(overrideIntDecoding ?? IntDecoding.MIXED)\n return indexer\n }\n\n /**\n * Returns an indexer SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).\n *\n * @param overrideIntDecoding Override the default int decoding for responses, uses MIXED by default to avoid lost precision for big integers\n * @example\n *\n * ```typescript\n * // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN\n * const indexer = ClientManager.getIndexerClientFromEnvironment()\n * await indexer.makeHealthCheck().do()\n * ```\n */\n public static getIndexerClientFromEnvironment(overrideIntDecoding?: IntDecoding): Indexer {\n return ClientManager.getIndexerClient(ClientManager.getIndexerConfigFromEnvironment(), overrideIntDecoding)\n }\n\n /**\n * Returns a KMD SDK client.\n *\n * KMD client allows you to export private keys, which is useful to (for instance) get the default account in a LocalNet network.\n *\n * @param config The config for the client\n * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)\n * ```typescript\n * const kmd = ClientManager.getKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})\n * ```\n */\n public static getKmdClient(config: AlgoClientConfig): Kmd {\n const { token, server, port } = config\n return new Kmd(token as string, server, port)\n }\n\n /**\n * Returns a KMD SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).\n *\n * @example\n * ```typescript\n * // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN\n * const kmd = ClientManager.getKmdClientFromEnvironment()\n * ```\n */\n public static getKmdClientFromEnvironment(): Kmd {\n // We can only use Kmd on the LocalNet otherwise it's not exposed so this makes some assumptions\n // (e.g. same token and server as algod and port 4002 by default)\n return ClientManager.getKmdClient({ ...ClientManager.getAlgodConfigFromEnvironment(), port: process?.env?.KMD_PORT ?? '4002' })\n }\n}\n\n/**\n * Interface to identify a typed client that can be used to interact with an application.\n */\nexport interface TypedAppClient<TClient> {\n new (params: Omit<AppClientParams, 'appSpec'>): TClient\n fromNetwork(params: Omit<AppClientParams, 'appId' | 'appSpec'>): Promise<TClient>\n fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<TClient>\n}\n\n/**\n * Interface to identify a typed factory that can be used to create and deploy an application.\n */\nexport interface TypedAppFactory<TClient> {\n new (params: Omit<AppFactoryParams, 'appSpec'>): TClient\n}\n"],"names":[],"mappings":";;;;;;;AASA,IAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AACxB,IAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAEhC,IAAO,W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I,WAAW,CAAC,KAAK,CAAC,CAAA;AAChE,QAAA,OAAO,OAAO,CAAA;KACf;AAED;;;;;;;;;;;AAWG;IACI,OAAO,+BAA+B,CAAC,mBAAiC,EAAA;QAC7E,OAAO,aAAa,CAAC,gBAAgB,CAAC,aAAa,CAAC,+BAA+B,EAAE,EAAE,mBAAmB,CAAC,CAAA;KAC5G;AAED;;;;;;;;;;AAUG;IACI,OAAO,YAAY,CAAC,MAAwB,EAAA;QACjD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;QACtC,OAAO,IAAI,GAAG,CAAC,KAAe,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;KAC9C;AAED;;;;;;;;AAQG;AACI,IAAA,OAAO,2BAA2B,GAAA;;;QAGvC,OAAO,aAAa,CAAC,YAAY,CAAC,EAAE,GAAG,aAAa,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAA;KAChI;AACF;;;;"}
@@ -3,10 +3,18 @@ import { TransactionSignerAccount } from './account';
3
3
  import { AlgoAmount } from './amount';
4
4
  import { AppManager, BoxIdentifier, BoxReference } from './app-manager';
5
5
  import { Expand } from './expand';
6
- import { Arc2TransactionNote, SendAtomicTransactionComposerResults } from './transaction';
6
+ import { Arc2TransactionNote, SendAtomicTransactionComposerResults, SendParams } from './transaction';
7
7
  import Transaction = algosdk.Transaction;
8
+ import TransactionSigner = algosdk.TransactionSigner;
8
9
  import TransactionWithSigner = algosdk.TransactionWithSigner;
10
+ import SimulateResponse = algosdk.modelsv2.SimulateResponse;
11
+ import modelsv2 = algosdk.modelsv2;
9
12
  export declare const MAX_TRANSACTION_GROUP_SIZE = 16;
13
+ /** Options to control a simulate request */
14
+ export type SimulateOptions = Expand<Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>> & {
15
+ /** Whether or not to skip signatures for all built transactions and use an empty signer instead. */
16
+ skipSignatures?: boolean;
17
+ };
10
18
  /** Common parameters for defining a transaction. */
11
19
  export type CommonTransactionParams = {
12
20
  /** The address of the account sending the transaction. */
@@ -283,7 +291,7 @@ export type OnlineKeyRegistrationParams = CommonTransactionParams & {
283
291
  export type CommonAppCallParams = CommonTransactionParams & {
284
292
  /** ID of the application; 0 if the application is being created. */
285
293
  appId: bigint;
286
- /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call. */
294
+ /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call; defaults to no-op. */
287
295
  onComplete?: algosdk.OnApplicationComplete;
288
296
  /** Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). */
289
297
  args?: Uint8Array[];
@@ -300,6 +308,7 @@ export type CommonAppCallParams = CommonTransactionParams & {
300
308
  */
301
309
  boxReferences?: (BoxReference | BoxIdentifier)[];
302
310
  };
311
+ /** Parameters to define an app create transaction */
303
312
  export type AppCreateParams = Expand<Omit<CommonAppCallParams, 'appId'> & {
304
313
  onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.ClearStateOC>;
305
314
  /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */
@@ -317,9 +326,12 @@ export type AppCreateParams = Expand<Omit<CommonAppCallParams, 'appId'> & {
317
326
  /** The number of byte slices saved in local state. */
318
327
  localByteSlices: number;
319
328
  };
320
- /** Number of extra pages required for the programs. This is immutable once the app is created. */
329
+ /** Number of extra pages required for the programs.
330
+ * Defaults to the number needed for the programs in this call if not specified.
331
+ * This is immutable once the app is created. */
321
332
  extraProgramPages?: number;
322
333
  }>;
334
+ /** Parameters to define an app update transaction */
323
335
  export type AppUpdateParams = Expand<CommonAppCallParams & {
324
336
  onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC;
325
337
  /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */
@@ -331,14 +343,25 @@ export type AppUpdateParams = Expand<CommonAppCallParams & {
331
343
  export type AppCallParams = CommonAppCallParams & {
332
344
  onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.UpdateApplicationOC>;
333
345
  };
346
+ /** Common parameters to define an ABI method call transaction. */
347
+ export type AppMethodCallParams = CommonAppCallParams & {
348
+ onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.ClearStateOC>;
349
+ };
334
350
  /** Parameters to define an application delete call transaction. */
335
351
  export type AppDeleteParams = CommonAppCallParams & {
336
352
  onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC;
337
353
  };
354
+ /** Parameters to define an ABI method call create transaction. */
338
355
  export type AppCreateMethodCall = AppMethodCall<AppCreateParams>;
356
+ /** Parameters to define an ABI method call update transaction. */
339
357
  export type AppUpdateMethodCall = AppMethodCall<AppUpdateParams>;
358
+ /** Parameters to define an ABI method call delete transaction. */
340
359
  export type AppDeleteMethodCall = AppMethodCall<AppDeleteParams>;
341
- export type AppCallMethodCall = AppMethodCall<AppCallParams>;
360
+ /** Parameters to define an ABI method call transaction. */
361
+ export type AppCallMethodCall = AppMethodCall<AppMethodCallParams>;
362
+ /** Types that can be used to define a transaction argument for an ABI call transaction. */
363
+ export type AppMethodCallTransactionArgument = TransactionWithSigner | Transaction | Promise<Transaction> | AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppMethodCallParams>;
364
+ /** Parameters to define an ABI method call. */
342
365
  export type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {
343
366
  /** The ABI method to call */
344
367
  method: algosdk.ABIMethod;
@@ -346,22 +369,42 @@ export type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {
346
369
  * * An ABI value
347
370
  * * A transaction with explicit signer
348
371
  * * A transaction (where the signer will be automatically assigned)
349
- * * An unawaited transaction (e.g. from algorand.transactions.transactionType())
372
+ * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())
350
373
  * * Another method call (via method call params object)
374
+ * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)
351
375
  */
352
- args?: (algosdk.ABIValue | TransactionWithSigner | Transaction | Promise<Transaction> | AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppCallParams>)[];
376
+ args?: (algosdk.ABIValue | TransactionWithSigner | Transaction | Promise<Transaction> | AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppMethodCallParams> | undefined)[];
353
377
  };
354
- /** Parameters to configure transaction execution. */
355
- export interface ExecuteParams {
356
- /** The number of rounds to wait for confirmation. By default until the latest lastValid has past. */
357
- maxRoundsToWaitForConfirmation?: number;
358
- /** Whether to suppress log messages from transaction send, default: do not suppress. */
359
- suppressLog?: boolean;
360
- /** Whether to use simulate to automatically populate app call resources in the txn objects. Defaults to `Config.populateAppCallResources`. */
361
- populateAppCallResources?: boolean;
362
- }
363
- /** Parameters to create an `AlgoKitComposer`. */
364
- export type AlgoKitComposerParams = {
378
+ export type Txn = (PaymentParams & {
379
+ type: 'pay';
380
+ }) | (AssetCreateParams & {
381
+ type: 'assetCreate';
382
+ }) | (AssetConfigParams & {
383
+ type: 'assetConfig';
384
+ }) | (AssetFreezeParams & {
385
+ type: 'assetFreeze';
386
+ }) | (AssetDestroyParams & {
387
+ type: 'assetDestroy';
388
+ }) | (AssetTransferParams & {
389
+ type: 'assetTransfer';
390
+ }) | (AssetOptInParams & {
391
+ type: 'assetOptIn';
392
+ }) | (AssetOptOutParams & {
393
+ type: 'assetOptOut';
394
+ }) | ((AppCallParams | AppCreateParams | AppUpdateParams) & {
395
+ type: 'appCall';
396
+ }) | (OnlineKeyRegistrationParams & {
397
+ type: 'keyReg';
398
+ }) | (algosdk.TransactionWithSigner & {
399
+ type: 'txnWithSigner';
400
+ }) | {
401
+ atc: algosdk.AtomicTransactionComposer;
402
+ type: 'atc';
403
+ } | ((AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall) & {
404
+ type: 'methodCall';
405
+ });
406
+ /** Parameters to create an `TransactionComposer`. */
407
+ export type TransactionComposerParams = {
365
408
  /** The algod client to use to get suggestedParams and send the transaction group */
366
409
  algod: algosdk.Algodv2;
367
410
  /** The function used to get the TransactionSigner for a given address */
@@ -378,7 +421,7 @@ export type AlgoKitComposerParams = {
378
421
  */
379
422
  appManager?: AppManager;
380
423
  };
381
- /** Set of transactions built by `AlgoKitComposer`. */
424
+ /** Set of transactions built by `TransactionComposer`. */
382
425
  export interface BuiltTransactions {
383
426
  /** The built transactions */
384
427
  transactions: algosdk.Transaction[];
@@ -388,7 +431,7 @@ export interface BuiltTransactions {
388
431
  signers: Map<number, algosdk.TransactionSigner>;
389
432
  }
390
433
  /** AlgoKit Composer helps you compose and execute transactions as a transaction group. */
391
- export default class AlgoKitComposer {
434
+ export default class TransactionComposer {
392
435
  /** Signer used to represent a lack of signer */
393
436
  private static NULL_SIGNER;
394
437
  /** The ATC used to compose the group */
@@ -409,58 +452,65 @@ export default class AlgoKitComposer {
409
452
  private defaultValidityWindowIsExplicit;
410
453
  private appManager;
411
454
  /**
412
- * Create an `AlgoKitComposer`.
455
+ * Create an `TransactionComposer`.
413
456
  * @param params The configuration for this composer
414
457
  */
415
- constructor(params: AlgoKitComposerParams);
458
+ constructor(params: TransactionComposerParams);
459
+ /**
460
+ * Add a pre-built transaction to the transaction group.
461
+ * @param transaction The pre-built transaction
462
+ * @param signer Optional signer override for the transaction
463
+ * @returns The composer so you can chain method calls
464
+ */
465
+ addTransaction(transaction: Transaction, signer?: TransactionSigner): TransactionComposer;
416
466
  /**
417
467
  * Add a payment transaction to the transaction group.
418
468
  * @param params The payment transaction parameters
419
469
  * @returns The composer so you can chain method calls
420
470
  */
421
- addPayment(params: PaymentParams): AlgoKitComposer;
471
+ addPayment(params: PaymentParams): TransactionComposer;
422
472
  /**
423
473
  * Add an asset create transaction to the transaction group.
424
474
  * @param params The asset create transaction parameters
425
475
  * @returns The composer so you can chain method calls
426
476
  */
427
- addAssetCreate(params: AssetCreateParams): AlgoKitComposer;
477
+ addAssetCreate(params: AssetCreateParams): TransactionComposer;
428
478
  /**
429
479
  * Add an asset config transaction to the transaction group.
430
480
  * @param params The asset config transaction parameters
431
481
  * @returns The composer so you can chain method calls
432
482
  */
433
- addAssetConfig(params: AssetConfigParams): AlgoKitComposer;
483
+ addAssetConfig(params: AssetConfigParams): TransactionComposer;
434
484
  /**
435
485
  * Add an asset freeze transaction to the transaction group.
436
486
  * @param params The asset freeze transaction parameters
437
487
  * @returns The composer so you can chain method calls
438
488
  */
439
- addAssetFreeze(params: AssetFreezeParams): AlgoKitComposer;
489
+ addAssetFreeze(params: AssetFreezeParams): TransactionComposer;
440
490
  /**
441
491
  * Add an asset destroy transaction to the transaction group.
442
492
  * @param params The asset destroy transaction parameters
443
493
  * @returns The composer so you can chain method calls
444
494
  */
445
- addAssetDestroy(params: AssetDestroyParams): AlgoKitComposer;
495
+ addAssetDestroy(params: AssetDestroyParams): TransactionComposer;
446
496
  /**
447
497
  * Add an asset transfer transaction to the transaction group.
448
498
  * @param params The asset transfer transaction parameters
449
499
  * @returns The composer so you can chain method calls
450
500
  */
451
- addAssetTransfer(params: AssetTransferParams): AlgoKitComposer;
501
+ addAssetTransfer(params: AssetTransferParams): TransactionComposer;
452
502
  /**
453
503
  * Add an asset opt-in transaction to the transaction group.
454
504
  * @param params The asset opt-in transaction parameters
455
505
  * @returns The composer so you can chain method calls
456
506
  */
457
- addAssetOptIn(params: AssetOptInParams): AlgoKitComposer;
507
+ addAssetOptIn(params: AssetOptInParams): TransactionComposer;
458
508
  /**
459
509
  * Add an asset opt-out transaction to the transaction group.
460
510
  * @param params The asset opt-out transaction parameters
461
511
  * @returns The composer so you can chain method calls
462
512
  */
463
- addAssetOptOut(params: AssetOptOutParams): AlgoKitComposer;
513
+ addAssetOptOut(params: AssetOptOutParams): TransactionComposer;
464
514
  /**
465
515
  * Add an application create transaction to the transaction group.
466
516
  *
@@ -468,7 +518,7 @@ export default class AlgoKitComposer {
468
518
  * @param params The application create transaction parameters
469
519
  * @returns The composer so you can chain method calls
470
520
  */
471
- addAppCreate(params: AppCreateParams): AlgoKitComposer;
521
+ addAppCreate(params: AppCreateParams): TransactionComposer;
472
522
  /**
473
523
  * Add an application update transaction to the transaction group.
474
524
  *
@@ -476,7 +526,7 @@ export default class AlgoKitComposer {
476
526
  * @param params The application update transaction parameters
477
527
  * @returns The composer so you can chain method calls
478
528
  */
479
- addAppUpdate(params: AppUpdateParams): AlgoKitComposer;
529
+ addAppUpdate(params: AppUpdateParams): TransactionComposer;
480
530
  /**
481
531
  * Add an application delete transaction to the transaction group.
482
532
  *
@@ -484,7 +534,7 @@ export default class AlgoKitComposer {
484
534
  * @param params The application delete transaction parameters
485
535
  * @returns The composer so you can chain method calls
486
536
  */
487
- addAppDelete(params: AppDeleteParams): AlgoKitComposer;
537
+ addAppDelete(params: AppDeleteParams): TransactionComposer;
488
538
  /**
489
539
  * Add an application call transaction to the transaction group.
490
540
  *
@@ -494,7 +544,7 @@ export default class AlgoKitComposer {
494
544
  * @param params The application call transaction parameters
495
545
  * @returns The composer so you can chain method calls
496
546
  */
497
- addAppCall(params: AppCallParams): AlgoKitComposer;
547
+ addAppCall(params: AppCallParams): TransactionComposer;
498
548
  /**
499
549
  * Add an ABI method create application call transaction to the transaction group.
500
550
  *
@@ -532,13 +582,13 @@ export default class AlgoKitComposer {
532
582
  * @param params The online key registration transaction parameters
533
583
  * @returns The composer so you can chain method calls
534
584
  */
535
- addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): AlgoKitComposer;
585
+ addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): TransactionComposer;
536
586
  /**
537
587
  * Add the transactions within an `AtomicTransactionComposer` to the transaction group.
538
588
  * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group
539
589
  * @returns The composer so you can chain method calls
540
590
  */
541
- addAtc(atc: algosdk.AtomicTransactionComposer): AlgoKitComposer;
591
+ addAtc(atc: algosdk.AtomicTransactionComposer): TransactionComposer;
542
592
  /** Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing */
543
593
  private buildAtc;
544
594
  private commonTxnBuildStep;
@@ -594,11 +644,34 @@ export default class AlgoKitComposer {
594
644
  methodCalls: any;
595
645
  }>;
596
646
  /**
647
+ * Compose the atomic transaction group and send it to the network.
648
+ * @param params The parameters to control execution with
649
+ * @returns The execution result
650
+ */
651
+ send(params?: SendParams): Promise<SendAtomicTransactionComposerResults>;
652
+ /**
653
+ * @deprecated Use `send` instead.
654
+ *
597
655
  * Compose the atomic transaction group and send it to the network
656
+ *
657
+ * An alias for `composer.send(params)`.
598
658
  * @param params The parameters to control execution with
599
659
  * @returns The execution result
600
660
  */
601
- execute(params?: ExecuteParams): Promise<SendAtomicTransactionComposerResults>;
661
+ execute(params?: SendParams): Promise<SendAtomicTransactionComposerResults>;
662
+ /**
663
+ * Compose the atomic transaction group and simulate sending it to the network
664
+ * @returns The simulation result
665
+ */
666
+ simulate(options?: SimulateOptions): Promise<SendAtomicTransactionComposerResults & {
667
+ simulateResponse: SimulateResponse;
668
+ }>;
669
+ /**
670
+ * Create an encoded transaction note that follows the ARC-2 spec.
671
+ *
672
+ * https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md
673
+ * @param note The ARC-2 transaction note data
674
+ * @returns The binary encoded transaction note
675
+ */
602
676
  static arc2Note(note: Arc2TransactionNote): Uint8Array;
603
677
  }
604
- //# sourceMappingURL=composer.d.ts.map