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