@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,471 +1,473 @@
1
- import algosdk from 'algosdk';
2
- import { type AlgorandClient } from './algorand-client';
3
- import { AppClient, AppClientParams, ResolveAppClientByCreatorAndName } from './app-client';
4
- import { AppFactory, AppFactoryParams } from './app-factory';
5
- import { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from './dispenser-client';
6
- import { Expand } from './expand';
7
- import { AlgoClientConfig, AlgoConfig, NetworkDetails } from './network-client';
8
- import Kmd = algosdk.Kmd;
9
- import Indexer = algosdk.Indexer;
10
- import Algodv2 = algosdk.Algodv2;
1
+ import { Expand } from "./expand.js";
2
+ import { AppFactory, AppFactoryParams } from "./app-factory.js";
3
+ import { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from "./dispenser-client.js";
4
+ import { AlgoClientConfig, AlgoConfig, NetworkDetails } from "./network-client.js";
5
+ import { AlgorandClient } from "./algorand-client.js";
6
+ import { AppClient, AppClientParams, ResolveAppClientByCreatorAndName } from "./app-client.js";
7
+ import algosdk from "algosdk";
8
+
9
+ //#region src/types/client-manager.d.ts
11
10
  /** Clients from algosdk that interact with the official Algorand APIs */
12
- export interface AlgoSdkClients {
13
- /** Algod client, see https://dev.algorand.co/reference/rest-apis/algod/ */
14
- algod: algosdk.Algodv2;
15
- /** Optional indexer client, see https://dev.algorand.co/reference/rest-apis/indexer */
16
- indexer?: algosdk.Indexer;
17
- /** Optional KMD client, see https://dev.algorand.co/reference/rest-apis/kmd/ */
18
- kmd?: algosdk.Kmd;
11
+ interface AlgoSdkClients {
12
+ /** Algod client, see https://dev.algorand.co/reference/rest-api/algod/ */
13
+ algod: algosdk.Algodv2;
14
+ /** Optional indexer client, see https://dev.algorand.co/reference/rest-api/indexer */
15
+ indexer?: algosdk.Indexer;
16
+ /** Optional KMD client, see https://dev.algorand.co/reference/rest-api/kmd/ */
17
+ kmd?: algosdk.Kmd;
19
18
  }
20
19
  /** Params to get an app factory from `ClientManager`. */
21
- export type ClientAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand'>>;
20
+ type ClientAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand'>>;
22
21
  /** Params to get an app client by creator address and name from `ClientManager`. */
23
- export type ClientResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand'>>;
22
+ type ClientResolveAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand'>>;
24
23
  /** Params to get an app client by ID from `ClientManager`. */
25
- export type ClientAppClientParams = Expand<Omit<AppClientParams, 'algorand'>>;
24
+ type ClientAppClientParams = Expand<Omit<AppClientParams, 'algorand'>>;
26
25
  /** Params to get an app client by network from `ClientManager`. */
27
- export type ClientAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appId'>>;
26
+ type ClientAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appId'>>;
28
27
  /** Params to get a typed app client by creator address and name from `ClientManager`. */
29
- export type ClientTypedAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>;
28
+ type ClientTypedAppClientByCreatorAndNameParams = Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>;
30
29
  /** Params to get a typed app client by ID from `ClientManager`. */
31
- export type ClientTypedAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>;
30
+ type ClientTypedAppClientParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>;
32
31
  /** Params to get a typed app client by network from `ClientManager`. */
33
- export type ClientTypedAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec' | 'appId'>>;
32
+ type ClientTypedAppClientByNetworkParams = Expand<Omit<AppClientParams, 'algorand' | 'appSpec' | 'appId'>>;
34
33
  /** Params to get a typed app factory from `ClientManager`. */
35
- export type ClientTypedAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand' | 'appSpec'>>;
34
+ type ClientTypedAppFactoryParams = Expand<Omit<AppFactoryParams, 'algorand' | 'appSpec'>>;
36
35
  /** Exposes access to various API clients. */
37
- export declare class ClientManager {
38
- private _algod;
39
- private _indexer?;
40
- private _kmd?;
41
- private _algorand?;
42
- /**
43
- * algosdk clients or config for interacting with the official Algorand APIs.
44
- * @param clientsOrConfig The clients or config to use
45
- * @example Algod client only
46
- * ```typescript
47
- * const clientManager = new ClientManager({ algod: algodClient })
48
- * ```
49
- * @example All clients
50
- * ```typescript
51
- * const clientManager = new ClientManager({ algod: algodClient, indexer: indexerClient, kmd: kmdClient })
52
- * ```
53
- * @example Algod config only
54
- * ```typescript
55
- * const clientManager = new ClientManager({ algodConfig })
56
- * ```
57
- * @example All client configs
58
- * ```typescript
59
- * const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })
60
- * ```
61
- */
62
- constructor(clientsOrConfig: AlgoConfig | AlgoSdkClients, algorandClient?: AlgorandClient);
63
- /**
64
- * Returns an algosdk Algod API client.
65
- * @returns The Algod client
66
- */
67
- get algod(): algosdk.Algodv2;
68
- /**
69
- * Returns an algosdk Indexer API client or throws an error if it's not been provided.
70
- * @returns The Indexer client
71
- * @throws Error if no Indexer client is configured
72
- */
73
- get indexer(): algosdk.Indexer;
74
- /**
75
- * Returns an algosdk Indexer API client or `undefined` if it's not been provided.
76
- * @returns The Indexer client or `undefined`
77
- */
78
- get indexerIfPresent(): algosdk.Indexer | undefined;
79
- /**
80
- * Returns an algosdk KMD API client or throws an error if it's not been provided.
81
- * @returns The KMD client
82
- * @throws Error if no KMD client is configured
83
- */
84
- get kmd(): algosdk.Kmd;
85
- private _getNetworkPromise;
86
- /**
87
- * Get details about the current network.
88
- * @example Getting genesis ID
89
- * ```typescript
90
- * const network = await networkClient.network()
91
- * const genesisId = network.genesisId
92
- * ```
93
- * @returns The current network details
94
- */
95
- network(): Promise<NetworkDetails>;
96
- /**
97
- * Returns true if the given network genesisId is associated with a LocalNet network.
98
- * @param genesisId The network genesis ID
99
- * @returns Whether the given genesis ID is associated with a LocalNet network
100
- * @example
101
- * ```typescript
102
- * const isLocalNet = ClientManager.genesisIdIsLocalNet('testnet-v1.0')
103
- * ```
104
- */
105
- static genesisIdIsLocalNet(genesisId: string): boolean;
106
- /**
107
- * Returns true if the current network is LocalNet.
108
- * @returns True if the current network is LocalNet.
109
- * @example
110
- * ```typescript
111
- * const isLocalNet = await clientManager.isLocalNet()
112
- * ```
113
- */
114
- isLocalNet(): Promise<boolean>;
115
- /**
116
- * Returns true if the current network is TestNet.
117
- * @returns True if the current network is TestNet.
118
- * @example
119
- * ```typescript
120
- * const isTestNet = await clientManager.isTestNet()
121
- * ```
122
- */
123
- isTestNet(): Promise<boolean>;
124
- /**
125
- * Returns true if the current network is MainNet.
126
- * @returns True if the current network is MainNet.
127
- * @example
128
- * ```typescript
129
- * const isMainNet = await clientManager.isMainNet()
130
- * ```
131
- */
132
- isMainNet(): Promise<boolean>;
133
- /**
134
- * Returns a TestNet Dispenser API client.
135
- *
136
- * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
137
- *
138
- * @param params An object containing parameters for the TestNetDispenserApiClient class.
139
- * @example
140
- * const client = clientManager.getTestNetDispenser(
141
- * {
142
- * authToken: 'your_auth_token',
143
- * requestTimeout: 15,
144
- * }
145
- * )
146
- *
147
- * @returns An instance of the TestNetDispenserApiClient class.
148
- */
149
- getTestNetDispenser(params: TestNetDispenserApiClientParams): TestNetDispenserApiClient;
150
- /**
151
- * Returns a TestNet Dispenser API client, loading the auth token from `process.env.ALGOKIT_DISPENSER_ACCESS_TOKEN`.
152
- *
153
- * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
154
- *
155
- * @param params An object containing parameters for the TestNetDispenserApiClient class.
156
- * @example
157
- * const client = clientManager.getTestNetDispenserFromEnvironment(
158
- * {
159
- * requestTimeout: 15,
160
- * }
161
- * )
162
- *
163
- * @returns An instance of the TestNetDispenserApiClient class.
164
- */
165
- getTestNetDispenserFromEnvironment(params?: Omit<TestNetDispenserApiClientParams, 'authToken'>): TestNetDispenserApiClient;
166
- /**
167
- * Returns a new `AppFactory` client
168
- * @param params The parameters to create the app factory
169
- * @example Basic example
170
- * ```typescript
171
- * const factory = clientManager.getAppFactory({
172
- * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\/}',
173
- * })
174
- * ```
175
- * @example Advanced example
176
- * ```typescript
177
- * const factory = clientManager.getAppFactory({
178
- * appSpec: parsedAppSpec_AppSpec_or_Arc56Contract,
179
- * defaultSender: "SENDERADDRESS",
180
- * appName: "OverriddenAppName",
181
- * version: "2.0.0",
182
- * updatable: true,
183
- * deletable: false,
184
- * deployTimeParams: { ONE: 1, TWO: 'value' }
185
- * })
186
- * ```
187
- * @returns The `AppFactory` instance
188
- */
189
- getAppFactory(params: ClientAppFactoryParams): AppFactory;
190
- /**
191
- * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
192
- * This method resolves the app ID by looking up the creator address and name
193
- * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
194
- * @param params The parameters to create the app client
195
- * @example Basic
196
- * ```typescript
197
- * const appClient = clientManager.getAppClientByCreatorAndName({
198
- * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
199
- * // appId resolved by looking for app ID of named app by this creator
200
- * creatorAddress: 'CREATORADDRESS',
201
- * })
202
- * ```
203
- * @returns The `AppClient` instance
204
- */
205
- getAppClientByCreatorAndName(params: ClientResolveAppClientByCreatorAndNameParams): Promise<AppClient>;
206
- /**
207
- * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
208
- * @param params The parameters to create the app client
209
- * @example Basic
210
- * ```typescript
211
- * const appClient = clientManager.getAppClientById({
212
- * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
213
- * appId: 12345n,
214
- * })
215
- * ```
216
- * @returns The `AppClient` instance
217
- */
218
- getAppClientById(params: ClientAppClientParams): AppClient;
219
- /**
220
- * Returns a new `AppClient` client for managing calls and state for an ARC-56 app.
221
- * This method resolves the app ID for the current network based on
222
- * pre-determined network-specific app IDs specified in the ARC-56 app spec.
223
- *
224
- * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
225
- * @param params The parameters to create the app client
226
- * @example Basic
227
- * ```typescript
228
- * const appClient = clientManager.getAppClientByNetwork({
229
- * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
230
- * // appId resolved by using ARC-56 spec to find app ID for current network
231
- * })
232
- * ```
233
- * @returns The `AppClient` instance
234
- */
235
- getAppClientByNetwork(params: ClientAppClientByNetworkParams): Promise<AppClient>;
236
- /**
237
- * Returns a new typed client, resolving the app by creator address and name.
238
- * @param typedClient The typed client type to use
239
- * @param params The params to resolve the app by creator address and name
240
- * @example Use name in ARC-32 / ARC-56 app spec
241
- * ```typescript
242
- * const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, {
243
- * creatorAddress: "CREATORADDRESS",
244
- * defaultSender: alice,
245
- * })
246
- * ```
247
- * @example Specify name
248
- * ```typescript
249
- * const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, {
250
- * creatorAddress: "CREATORADDRESS",
251
- * name: "contract-name",
252
- * defaultSender: alice,
253
- * })
254
- * ```
255
- * @returns The typed client instance
256
- */
257
- getTypedAppClientByCreatorAndName<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params: ClientTypedAppClientByCreatorAndNameParams): Promise<InstanceType<TClient>>;
258
- /**
259
- * Returns a new typed client, resolving the app by app ID.
260
- * @param typedClient The typed client type to use
261
- * @param params The params to resolve the app by ID
262
- * @example
263
- * ```typescript
264
- * const appClient = clientManager.getTypedAppClientById(MyContractClient, {
265
- * appId: 12345n,
266
- * defaultSender: alice,
267
- * })
268
- * ```
269
- * @returns The typed client instance
270
- */
271
- getTypedAppClientById<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params: ClientTypedAppClientParams): InstanceType<TClient>;
272
- /**
273
- * Returns a new typed client, resolves the app ID for the current network based on
274
- * pre-determined network-specific app IDs specified in the ARC-56 app spec.
275
- *
276
- * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
277
- * @param typedClient The typed client type to use
278
- * @param params The params to resolve the app by network
279
- * @example
280
- * ```typescript
281
- * const appClient = clientManager.getTypedAppClientByNetwork(MyContractClient, {
282
- * defaultSender: alice,
283
- * })
284
- * ```
285
- * @returns The typed client instance
286
- */
287
- getTypedAppClientByNetwork<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params?: ClientTypedAppClientByNetworkParams): Promise<InstanceType<TClient>>;
288
- /**
289
- * Returns a new typed app factory.
290
- * @param typedFactory The typed factory type to use
291
- * @param params The params to resolve the factory by
292
- * @example
293
- * ```typescript
294
- * const appFactory = clientManager.getTypedAppFactory(MyContractClient, {
295
- * sender: alice,
296
- * })
297
- * ```
298
- * @returns The typed client instance
299
- */
300
- getTypedAppFactory<TClient>(typedFactory: TypedAppFactory<TClient>, params?: ClientTypedAppFactoryParams): TClient;
301
- /**
302
- * Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)
303
- *
304
- * 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`.
305
- *
306
- * 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`.
307
- *
308
- * If only `process.env.INDEXER_SERVER` is defined it will use the default (LocalNet) configuration for both algod and indexer.
309
- *
310
- * It will return a KMD configuration that uses `process.env.KMD_PORT` (or port 4002) if `process.env.ALGOD_SERVER` is defined,
311
- * otherwise it will use the default LocalNet config unless it detects testnet or mainnet.
312
- * @example
313
- * ```typescript
314
- * const config = ClientManager.getConfigFromEnvironmentOrLocalNet()
315
- * ```
316
- * @returns The config for algod, indexer and kmd
317
- */
318
- static getConfigFromEnvironmentOrLocalNet(): AlgoConfig;
319
- /**
320
- * Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment)
321
- *
322
- * Expects `process.env.ALGOD_SERVER` to be defined, and you can also specify `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN`.
323
- * @returns The Algod client configuration
324
- * @throws Error if `process.env.ALGOD_SERVER` is not defined
325
- * @example
326
- * ```typescript
327
- * const config = ClientManager.getAlgodConfigFromEnvironment()
328
- * ```
329
- */
330
- static getAlgodConfigFromEnvironment(): AlgoClientConfig;
331
- /**
332
- * Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment).
333
- *
334
- * Expects `process.env.INDEXER_SERVER` to be defined, and you can also specify `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.
335
- * @returns The Indexer client configuration
336
- * @throws Error if `process.env.INDEXER_SERVER` is not defined
337
- * @example
338
- * ```typescript
339
- * const config = ClientManager.getIndexerConfigFromEnvironment()
340
- * ```
341
- */
342
- static getIndexerConfigFromEnvironment(): AlgoClientConfig;
343
- /** Returns the Algorand configuration to point to the free tier of the AlgoNode service.
344
- *
345
- * @param network Which network to connect to - TestNet or MainNet
346
- * @param config Which algod config to return - Algod or Indexer
347
- * @returns The AlgoNode client configuration
348
- * @example
349
- * ```typescript
350
- * const config = ClientManager.getAlgoNodeConfig('testnet', 'algod')
351
- * ```
352
- */
353
- static getAlgoNodeConfig(network: 'testnet' | 'mainnet', config: 'algod' | 'indexer'): AlgoClientConfig;
354
- /** Returns the Algorand configuration to point to the default LocalNet.
355
- *
356
- * @param configOrPort Which algod config to return - algod, kmd, or indexer OR a port number
357
- * @returns The LocalNet client configuration
358
- * @example
359
- * ```typescript
360
- * const config = ClientManager.getDefaultLocalNetConfig('algod')
361
- * ```
362
- */
363
- static getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexer' | 'kmd' | number): AlgoClientConfig;
364
- /**
365
- * Returns an algod SDK client that automatically retries on idempotent calls.
366
- *
367
- * @param config The config of the client
368
- * @returns The Algod client
369
- * @example AlgoNode (testnet)
370
- * ```typescript
371
- * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('testnet', 'algod'))
372
- * await algod.healthCheck().do()
373
- * ```
374
- * @example AlgoNode (mainnet)
375
- * ```typescript
376
- * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('mainnet', 'algod'))
377
- * await algod.healthCheck().do()
378
- * ```
379
- * @example Custom (e.g. default LocalNet)
380
- * ```typescript
381
- * const algod = ClientManager.getAlgodClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
382
- * await algod.healthCheck().do()
383
- * ```
384
- */
385
- static getAlgodClient(config: AlgoClientConfig): Algodv2;
386
- /**
387
- * Returns an algod SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
388
- *
389
- * @returns The Algod client
390
- * @example
391
- * ```typescript
392
- * // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN
393
- * const algod = ClientManager.getAlgodClientFromEnvironment()
394
- * await algod.healthCheck().do()
395
- * ```
396
- */
397
- static getAlgodClientFromEnvironment(): Algodv2;
398
- /**
399
- * Returns an indexer SDK client that automatically retries on idempotent calls
400
- *
401
- * @param config The config of the client
402
- * @returns The Indexer client
403
- * @example AlgoNode (testnet)
404
- * ```typescript
405
- * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('testnet', 'indexer'))
406
- * await indexer.makeHealthCheck().do()
407
- * ```
408
- * @example AlgoNode (mainnet)
409
- * ```typescript
410
- * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('mainnet', 'indexer'))
411
- * await indexer.makeHealthCheck().do()
412
- * ```
413
- * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
414
- * ```typescript
415
- * const indexer = ClientManager.getIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
416
- * await indexer.makeHealthCheck().do()
417
- * ```
418
- */
419
- static getIndexerClient(config: AlgoClientConfig): Indexer;
420
- /**
421
- * Returns an indexer SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
422
- *
423
- * @returns The Indexer client
424
- * @example
425
- *
426
- * ```typescript
427
- * // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN
428
- * const indexer = ClientManager.getIndexerClientFromEnvironment()
429
- * await indexer.makeHealthCheck().do()
430
- * ```
431
- */
432
- static getIndexerClientFromEnvironment(): Indexer;
433
- /**
434
- * Returns a KMD SDK client.
435
- *
436
- * KMD client allows you to export private keys, which is useful to (for instance) get the default account in a LocalNet network.
437
- *
438
- * @param config The config for the client
439
- * @returns The KMD client
440
- * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
441
- * ```typescript
442
- * const kmd = ClientManager.getKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
443
- * ```
444
- */
445
- static getKmdClient(config: AlgoClientConfig): Kmd;
446
- /**
447
- * Returns a KMD SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
448
- *
449
- * @returns The KMD client
450
- * @example
451
- * ```typescript
452
- * // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN
453
- * const kmd = ClientManager.getKmdClientFromEnvironment()
454
- * ```
455
- */
456
- static getKmdClientFromEnvironment(): Kmd;
36
+ declare class ClientManager {
37
+ private _algod;
38
+ private _indexer?;
39
+ private _kmd?;
40
+ private _algorand?;
41
+ /**
42
+ * algosdk clients or config for interacting with the official Algorand APIs.
43
+ * @param clientsOrConfig The clients or config to use
44
+ * @example Algod client only
45
+ * ```typescript
46
+ * const clientManager = new ClientManager({ algod: algodClient })
47
+ * ```
48
+ * @example All clients
49
+ * ```typescript
50
+ * const clientManager = new ClientManager({ algod: algodClient, indexer: indexerClient, kmd: kmdClient })
51
+ * ```
52
+ * @example Algod config only
53
+ * ```typescript
54
+ * const clientManager = new ClientManager({ algodConfig })
55
+ * ```
56
+ * @example All client configs
57
+ * ```typescript
58
+ * const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })
59
+ * ```
60
+ */
61
+ constructor(clientsOrConfig: AlgoConfig | AlgoSdkClients, algorandClient?: AlgorandClient);
62
+ /**
63
+ * Returns an algosdk Algod API client.
64
+ * @returns The Algod client
65
+ */
66
+ get algod(): algosdk.Algodv2;
67
+ /**
68
+ * Returns an algosdk Indexer API client or throws an error if it's not been provided.
69
+ * @returns The Indexer client
70
+ * @throws Error if no Indexer client is configured
71
+ */
72
+ get indexer(): algosdk.Indexer;
73
+ /**
74
+ * Returns an algosdk Indexer API client or `undefined` if it's not been provided.
75
+ * @returns The Indexer client or `undefined`
76
+ */
77
+ get indexerIfPresent(): algosdk.Indexer | undefined;
78
+ /**
79
+ * Returns an algosdk KMD API client or throws an error if it's not been provided.
80
+ * @returns The KMD client
81
+ * @throws Error if no KMD client is configured
82
+ */
83
+ get kmd(): algosdk.Kmd;
84
+ private _getNetworkPromise;
85
+ /**
86
+ * Get details about the current network.
87
+ * @example Getting genesis ID
88
+ * ```typescript
89
+ * const network = await networkClient.network()
90
+ * const genesisId = network.genesisId
91
+ * ```
92
+ * @returns The current network details
93
+ */
94
+ network(): Promise<NetworkDetails>;
95
+ /**
96
+ * Returns true if the given network genesisId is associated with a LocalNet network.
97
+ * @param genesisId The network genesis ID
98
+ * @returns Whether the given genesis ID is associated with a LocalNet network
99
+ * @example
100
+ * ```typescript
101
+ * const isLocalNet = ClientManager.genesisIdIsLocalNet('testnet-v1.0')
102
+ * ```
103
+ */
104
+ static genesisIdIsLocalNet(genesisId: string): genesisId is "devnet-v1" | "sandnet-v1" | "dockernet-v1";
105
+ /**
106
+ * Returns true if the current network is LocalNet.
107
+ * @returns True if the current network is LocalNet.
108
+ * @example
109
+ * ```typescript
110
+ * const isLocalNet = await clientManager.isLocalNet()
111
+ * ```
112
+ */
113
+ isLocalNet(): Promise<boolean>;
114
+ /**
115
+ * Returns true if the current network is TestNet.
116
+ * @returns True if the current network is TestNet.
117
+ * @example
118
+ * ```typescript
119
+ * const isTestNet = await clientManager.isTestNet()
120
+ * ```
121
+ */
122
+ isTestNet(): Promise<boolean>;
123
+ /**
124
+ * Returns true if the current network is MainNet.
125
+ * @returns True if the current network is MainNet.
126
+ * @example
127
+ * ```typescript
128
+ * const isMainNet = await clientManager.isMainNet()
129
+ * ```
130
+ */
131
+ isMainNet(): Promise<boolean>;
132
+ /**
133
+ * Returns a TestNet Dispenser API client.
134
+ *
135
+ * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
136
+ *
137
+ * @param params An object containing parameters for the TestNetDispenserApiClient class.
138
+ * @example
139
+ * const client = clientManager.getTestNetDispenser(
140
+ * {
141
+ * authToken: 'your_auth_token',
142
+ * requestTimeout: 15,
143
+ * }
144
+ * )
145
+ *
146
+ * @returns An instance of the TestNetDispenserApiClient class.
147
+ */
148
+ getTestNetDispenser(params: TestNetDispenserApiClientParams): TestNetDispenserApiClient;
149
+ /**
150
+ * Returns a TestNet Dispenser API client, loading the auth token from `process.env.ALGOKIT_DISPENSER_ACCESS_TOKEN`.
151
+ *
152
+ * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
153
+ *
154
+ * @param params An object containing parameters for the TestNetDispenserApiClient class.
155
+ * @example
156
+ * const client = clientManager.getTestNetDispenserFromEnvironment(
157
+ * {
158
+ * requestTimeout: 15,
159
+ * }
160
+ * )
161
+ *
162
+ * @returns An instance of the TestNetDispenserApiClient class.
163
+ */
164
+ getTestNetDispenserFromEnvironment(params?: Omit<TestNetDispenserApiClientParams, 'authToken'>): TestNetDispenserApiClient;
165
+ /**
166
+ * Returns a new `AppFactory` client
167
+ * @param params The parameters to create the app factory
168
+ * @example Basic example
169
+ * ```typescript
170
+ * const factory = clientManager.getAppFactory({
171
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\/}',
172
+ * })
173
+ * ```
174
+ * @example Advanced example
175
+ * ```typescript
176
+ * const factory = clientManager.getAppFactory({
177
+ * appSpec: parsedAppSpec_AppSpec_or_Arc56Contract,
178
+ * defaultSender: "SENDERADDRESS",
179
+ * appName: "OverriddenAppName",
180
+ * version: "2.0.0",
181
+ * updatable: true,
182
+ * deletable: false,
183
+ * deployTimeParams: { ONE: 1, TWO: 'value' }
184
+ * })
185
+ * ```
186
+ * @returns The `AppFactory` instance
187
+ */
188
+ getAppFactory(params: ClientAppFactoryParams): AppFactory;
189
+ /**
190
+ * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.
191
+ * This method resolves the app ID by looking up the creator address and name
192
+ * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).
193
+ * @param params The parameters to create the app client
194
+ * @example Basic
195
+ * ```typescript
196
+ * const appClient = clientManager.getAppClientByCreatorAndName({
197
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
198
+ * // appId resolved by looking for app ID of named app by this creator
199
+ * creatorAddress: 'CREATORADDRESS',
200
+ * })
201
+ * ```
202
+ * @returns The `AppClient` instance
203
+ */
204
+ getAppClientByCreatorAndName(params: ClientResolveAppClientByCreatorAndNameParams): Promise<AppClient>;
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 = clientManager.getAppClientById({
211
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
212
+ * appId: 12345n,
213
+ * })
214
+ * ```
215
+ * @returns The `AppClient` instance
216
+ */
217
+ getAppClientById(params: ClientAppClientParams): AppClient;
218
+ /**
219
+ * Returns a new `AppClient` client for managing calls and state for an ARC-56 app.
220
+ * This method resolves the app ID for the current network based on
221
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
222
+ *
223
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
224
+ * @param params The parameters to create the app client
225
+ * @example Basic
226
+ * ```typescript
227
+ * const appClient = clientManager.getAppClientByNetwork({
228
+ * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\}',
229
+ * // appId resolved by using ARC-56 spec to find app ID for current network
230
+ * })
231
+ * ```
232
+ * @returns The `AppClient` instance
233
+ */
234
+ getAppClientByNetwork(params: ClientAppClientByNetworkParams): Promise<AppClient>;
235
+ /**
236
+ * Returns a new typed client, resolving the app by creator address and name.
237
+ * @param typedClient The typed client type to use
238
+ * @param params The params to resolve the app by creator address and name
239
+ * @example Use name in ARC-32 / ARC-56 app spec
240
+ * ```typescript
241
+ * const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, {
242
+ * creatorAddress: "CREATORADDRESS",
243
+ * defaultSender: alice,
244
+ * })
245
+ * ```
246
+ * @example Specify name
247
+ * ```typescript
248
+ * const appClient = clientManager.getTypedAppClientByCreatorAndName(MyContractClient, {
249
+ * creatorAddress: "CREATORADDRESS",
250
+ * name: "contract-name",
251
+ * defaultSender: alice,
252
+ * })
253
+ * ```
254
+ * @returns The typed client instance
255
+ */
256
+ getTypedAppClientByCreatorAndName<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params: ClientTypedAppClientByCreatorAndNameParams): Promise<InstanceType<TClient>>;
257
+ /**
258
+ * Returns a new typed client, resolving the app by app ID.
259
+ * @param typedClient The typed client type to use
260
+ * @param params The params to resolve the app by ID
261
+ * @example
262
+ * ```typescript
263
+ * const appClient = clientManager.getTypedAppClientById(MyContractClient, {
264
+ * appId: 12345n,
265
+ * defaultSender: alice,
266
+ * })
267
+ * ```
268
+ * @returns The typed client instance
269
+ */
270
+ getTypedAppClientById<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params: ClientTypedAppClientParams): InstanceType<TClient>;
271
+ /**
272
+ * Returns a new typed client, resolves the app ID for the current network based on
273
+ * pre-determined network-specific app IDs specified in the ARC-56 app spec.
274
+ *
275
+ * If no IDs are in the app spec or the network isn't recognised, an error is thrown.
276
+ * @param typedClient The typed client type to use
277
+ * @param params The params to resolve the app by network
278
+ * @example
279
+ * ```typescript
280
+ * const appClient = clientManager.getTypedAppClientByNetwork(MyContractClient, {
281
+ * defaultSender: alice,
282
+ * })
283
+ * ```
284
+ * @returns The typed client instance
285
+ */
286
+ getTypedAppClientByNetwork<TClient extends TypedAppClient<InstanceType<TClient>>>(typedClient: TClient, params?: ClientTypedAppClientByNetworkParams): Promise<InstanceType<TClient>>;
287
+ /**
288
+ * Returns a new typed app factory.
289
+ * @param typedFactory The typed factory type to use
290
+ * @param params The params to resolve the factory by
291
+ * @example
292
+ * ```typescript
293
+ * const appFactory = clientManager.getTypedAppFactory(MyContractClient, {
294
+ * sender: alice,
295
+ * })
296
+ * ```
297
+ * @returns The typed client instance
298
+ */
299
+ getTypedAppFactory<TClient>(typedFactory: TypedAppFactory<TClient>, params?: ClientTypedAppFactoryParams): TClient;
300
+ /**
301
+ * Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)
302
+ *
303
+ * 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`.
304
+ *
305
+ * 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`.
306
+ *
307
+ * If only `process.env.INDEXER_SERVER` is defined it will use the default (LocalNet) configuration for both algod and indexer.
308
+ *
309
+ * It will return a KMD configuration that uses `process.env.KMD_PORT` (or port 4002) if `process.env.ALGOD_SERVER` is defined,
310
+ * otherwise it will use the default LocalNet config unless it detects testnet or mainnet.
311
+ * @example
312
+ * ```typescript
313
+ * const config = ClientManager.getConfigFromEnvironmentOrLocalNet()
314
+ * ```
315
+ * @returns The config for algod, indexer and kmd
316
+ */
317
+ static getConfigFromEnvironmentOrLocalNet(): AlgoConfig;
318
+ /**
319
+ * Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment)
320
+ *
321
+ * Expects `process.env.ALGOD_SERVER` to be defined, and you can also specify `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN`.
322
+ * @returns The Algod client configuration
323
+ * @throws Error if `process.env.ALGOD_SERVER` is not defined
324
+ * @example
325
+ * ```typescript
326
+ * const config = ClientManager.getAlgodConfigFromEnvironment()
327
+ * ```
328
+ */
329
+ static getAlgodConfigFromEnvironment(): AlgoClientConfig;
330
+ /**
331
+ * Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment).
332
+ *
333
+ * Expects `process.env.INDEXER_SERVER` to be defined, and you can also specify `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.
334
+ * @returns The Indexer client configuration
335
+ * @throws Error if `process.env.INDEXER_SERVER` is not defined
336
+ * @example
337
+ * ```typescript
338
+ * const config = ClientManager.getIndexerConfigFromEnvironment()
339
+ * ```
340
+ */
341
+ static getIndexerConfigFromEnvironment(): AlgoClientConfig;
342
+ /** Returns the Algorand configuration to point to the free tier of the AlgoNode service.
343
+ *
344
+ * @param network Which network to connect to - TestNet or MainNet
345
+ * @param config Which algod config to return - Algod or Indexer
346
+ * @returns The AlgoNode client configuration
347
+ * @example
348
+ * ```typescript
349
+ * const config = ClientManager.getAlgoNodeConfig('testnet', 'algod')
350
+ * ```
351
+ */
352
+ static getAlgoNodeConfig(network: 'testnet' | 'mainnet', config: 'algod' | 'indexer'): AlgoClientConfig;
353
+ /** Returns the Algorand configuration to point to the default LocalNet.
354
+ *
355
+ * @param configOrPort Which algod config to return - algod, kmd, or indexer OR a port number
356
+ * @returns The LocalNet client configuration
357
+ * @example
358
+ * ```typescript
359
+ * const config = ClientManager.getDefaultLocalNetConfig('algod')
360
+ * ```
361
+ */
362
+ static getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexer' | 'kmd' | number): AlgoClientConfig;
363
+ /**
364
+ * Returns an algod SDK client that automatically retries on idempotent calls.
365
+ *
366
+ * @param config The config of the client
367
+ * @returns The Algod client
368
+ * @example AlgoNode (testnet)
369
+ * ```typescript
370
+ * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('testnet', 'algod'))
371
+ * await algod.healthCheck().do()
372
+ * ```
373
+ * @example AlgoNode (mainnet)
374
+ * ```typescript
375
+ * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('mainnet', 'algod'))
376
+ * await algod.healthCheck().do()
377
+ * ```
378
+ * @example Custom (e.g. default LocalNet)
379
+ * ```typescript
380
+ * const algod = ClientManager.getAlgodClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
381
+ * await algod.healthCheck().do()
382
+ * ```
383
+ */
384
+ static getAlgodClient(config: AlgoClientConfig): Algodv2;
385
+ /**
386
+ * Returns an algod SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
387
+ *
388
+ * @returns The Algod client
389
+ * @example
390
+ * ```typescript
391
+ * // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN
392
+ * const algod = ClientManager.getAlgodClientFromEnvironment()
393
+ * await algod.healthCheck().do()
394
+ * ```
395
+ */
396
+ static getAlgodClientFromEnvironment(): Algodv2;
397
+ /**
398
+ * Returns an indexer SDK client that automatically retries on idempotent calls
399
+ *
400
+ * @param config The config of the client
401
+ * @returns The Indexer client
402
+ * @example AlgoNode (testnet)
403
+ * ```typescript
404
+ * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('testnet', 'indexer'))
405
+ * await indexer.makeHealthCheck().do()
406
+ * ```
407
+ * @example AlgoNode (mainnet)
408
+ * ```typescript
409
+ * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('mainnet', 'indexer'))
410
+ * await indexer.makeHealthCheck().do()
411
+ * ```
412
+ * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
413
+ * ```typescript
414
+ * const indexer = ClientManager.getIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
415
+ * await indexer.makeHealthCheck().do()
416
+ * ```
417
+ */
418
+ static getIndexerClient(config: AlgoClientConfig): Indexer;
419
+ /**
420
+ * Returns an indexer SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
421
+ *
422
+ * @returns The Indexer client
423
+ * @example
424
+ *
425
+ * ```typescript
426
+ * // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN
427
+ * const indexer = ClientManager.getIndexerClientFromEnvironment()
428
+ * await indexer.makeHealthCheck().do()
429
+ * ```
430
+ */
431
+ static getIndexerClientFromEnvironment(): Indexer;
432
+ /**
433
+ * Returns a KMD SDK client.
434
+ *
435
+ * KMD client allows you to export private keys, which is useful to (for instance) get the default account in a LocalNet network.
436
+ *
437
+ * @param config The config for the client
438
+ * @returns The KMD client
439
+ * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
440
+ * ```typescript
441
+ * const kmd = ClientManager.getKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
442
+ * ```
443
+ */
444
+ static getKmdClient(config: AlgoClientConfig): Kmd;
445
+ /**
446
+ * Returns a KMD SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).
447
+ *
448
+ * @returns The KMD client
449
+ * @example
450
+ * ```typescript
451
+ * // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN
452
+ * const kmd = ClientManager.getKmdClientFromEnvironment()
453
+ * ```
454
+ */
455
+ static getKmdClientFromEnvironment(): Kmd;
457
456
  }
458
457
  /**
459
458
  * Interface to identify a typed client that can be used to interact with an application.
460
459
  */
461
- export interface TypedAppClient<TClient> {
462
- new (params: Omit<AppClientParams, 'appSpec'>): TClient;
463
- fromNetwork(params: Omit<AppClientParams, 'appId' | 'appSpec'>): Promise<TClient>;
464
- fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<TClient>;
460
+ interface TypedAppClient<TClient> {
461
+ new (params: Omit<AppClientParams, 'appSpec'>): TClient;
462
+ fromNetwork(params: Omit<AppClientParams, 'appId' | 'appSpec'>): Promise<TClient>;
463
+ fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<TClient>;
465
464
  }
466
465
  /**
467
466
  * Interface to identify a typed factory that can be used to create and deploy an application.
468
467
  */
469
- export interface TypedAppFactory<TClient> {
470
- new (params: Omit<AppFactoryParams, 'appSpec'>): TClient;
468
+ interface TypedAppFactory<TClient> {
469
+ new (params: Omit<AppFactoryParams, 'appSpec'>): TClient;
471
470
  }
471
+ //#endregion
472
+ export { AlgoSdkClients, ClientAppClientByNetworkParams, ClientAppClientParams, ClientAppFactoryParams, ClientManager, ClientResolveAppClientByCreatorAndNameParams, ClientTypedAppClientByCreatorAndNameParams, ClientTypedAppClientByNetworkParams, ClientTypedAppClientParams, ClientTypedAppFactoryParams, TypedAppClient, TypedAppFactory };
473
+ //# sourceMappingURL=client-manager.d.ts.map