@algorandfoundation/algokit-utils 9.2.1-beta.3 → 9.2.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/account/account.d.ts +28 -23
  2. package/account/get-account-config-from-environment.d.ts +2 -7
  3. package/account/get-account.d.ts +12 -14
  4. package/account/get-dispenser-account.d.ts +5 -9
  5. package/account/index.d.ts +5 -0
  6. package/account/mnemonic-account.d.ts +3 -7
  7. package/amount.d.ts +35 -40
  8. package/app-client.d.ts +6 -10
  9. package/app-deploy.d.ts +23 -25
  10. package/app.d.ts +46 -45
  11. package/asset.d.ts +12 -16
  12. package/config.d.ts +2 -7
  13. package/debugging/debugging.d.ts +1 -5
  14. package/debugging/index.d.ts +1 -0
  15. package/dispenser-client.d.ts +2 -7
  16. package/index.d.ts +18 -27
  17. package/indexer-lookup.d.ts +11 -18
  18. package/localnet/get-kmd-wallet-account.d.ts +7 -9
  19. package/localnet/get-localnet-dispenser-account.d.ts +5 -7
  20. package/localnet/get-or-create-kmd-wallet-account.d.ts +8 -10
  21. package/localnet/index.d.ts +4 -0
  22. package/localnet/is-localnet.d.ts +3 -7
  23. package/network-client.d.ts +15 -17
  24. package/package.json +1 -1
  25. package/testing/_asset.d.ts +3 -0
  26. package/testing/account.d.ts +9 -11
  27. package/testing/fixtures/algokit-log-capture-fixture.d.ts +2 -7
  28. package/testing/fixtures/algorand-fixture.d.ts +4 -9
  29. package/testing/fixtures/index.d.ts +2 -0
  30. package/testing/index.d.ts +5 -7
  31. package/testing/indexer.d.ts +1 -5
  32. package/testing/test-logger.d.ts +36 -41
  33. package/testing/transaction-logger.d.ts +27 -30
  34. package/transaction/index.d.ts +2 -0
  35. package/transaction/legacy-bridge.d.ts +35 -0
  36. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +5 -7
  37. package/transaction/resolve-signed-transactions.d.ts +16 -0
  38. package/transaction/transaction.d.ts +35 -34
  39. package/transfer/index.d.ts +2 -0
  40. package/transfer/transfer-algos.d.ts +5 -9
  41. package/transfer/transfer.d.ts +8 -11
  42. package/types/account-manager.d.ts +429 -432
  43. package/types/account.d.ts +202 -192
  44. package/types/algo-http-client-with-retry.d.ts +10 -15
  45. package/types/algorand-client-transaction-creator.d.ts +771 -778
  46. package/types/algorand-client-transaction-sender.d.ts +1085 -1090
  47. package/types/algorand-client.d.ts +236 -239
  48. package/types/amount.d.ts +43 -47
  49. package/types/app-arc56.d.ts +272 -235
  50. package/types/app-client.d.ts +1151 -1128
  51. package/types/app-deployer.d.ts +141 -139
  52. package/types/app-factory.d.ts +783 -762
  53. package/types/app-manager.d.ts +310 -304
  54. package/types/app-spec.d.ts +117 -118
  55. package/types/app.d.ts +241 -229
  56. package/types/asset-manager.d.ts +199 -204
  57. package/types/asset.d.ts +91 -95
  58. package/types/async-event-emitter.d.ts +13 -18
  59. package/types/client-manager.d.ts +451 -453
  60. package/types/composer.d.ts +1257 -1210
  61. package/types/config.d.ts +48 -53
  62. package/types/debugging.d.ts +23 -25
  63. package/types/dispenser-client.d.ts +52 -57
  64. package/types/expand.d.ts +3 -5
  65. package/types/indexer.d.ts +66 -70
  66. package/types/instance-of.d.ts +3 -5
  67. package/types/kmd-account-manager.d.ts +70 -75
  68. package/types/lifecycle-events.d.ts +8 -13
  69. package/types/logging.d.ts +11 -15
  70. package/types/logic-error.d.ts +29 -33
  71. package/types/network-client.d.ts +27 -32
  72. package/types/testing.d.ts +132 -131
  73. package/types/transaction.d.ts +110 -110
  74. package/types/transfer.d.ts +66 -70
  75. package/util.d.ts +48 -0
@@ -1,243 +1,240 @@
1
- import { MultisigAccount, SigningAccount, TransactionSignerAccount } from "./account.js";
2
- import { AppManager } from "./app-manager.js";
3
- import { ErrorTransformer, TransactionComposer } from "./composer.js";
4
- import { AssetManager } from "./asset-manager.js";
5
- import { AlgorandClientTransactionSender } from "./algorand-client-transaction-sender.js";
6
- import { AppDeployer } from "./app-deployer.js";
7
- import { AlgoConfig } from "./network-client.js";
8
- import { AlgoSdkClients, ClientManager } from "./client-manager.js";
9
- import { AccountManager } from "./account-manager.js";
10
- import { AlgorandClientTransactionCreator } from "./algorand-client-transaction-creator.js";
11
- import algosdk, { Address } from "algosdk";
12
-
13
- //#region src/types/algorand-client.d.ts
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './account';
3
+ import { AccountManager } from './account-manager';
4
+ import { AlgorandClientTransactionCreator } from './algorand-client-transaction-creator';
5
+ import { AlgorandClientTransactionSender } from './algorand-client-transaction-sender';
6
+ import { AppDeployer } from './app-deployer';
7
+ import { AppManager } from './app-manager';
8
+ import { AssetManager } from './asset-manager';
9
+ import { AlgoSdkClients, ClientManager } from './client-manager';
10
+ import { ErrorTransformer, TransactionComposer } from './composer';
11
+ import { AlgoConfig } from './network-client';
12
+ import Account = algosdk.Account;
13
+ import LogicSigAccount = algosdk.LogicSigAccount;
14
14
  /**
15
15
  * A client that brokers easy access to Algorand functionality.
16
16
  */
17
- declare class AlgorandClient {
18
- private _clientManager;
19
- private _accountManager;
20
- private _appManager;
21
- private _appDeployer;
22
- private _assetManager;
23
- private _transactionSender;
24
- private _transactionCreator;
25
- private _cachedSuggestedParams?;
26
- private _cachedSuggestedParamsExpiry?;
27
- private _cachedSuggestedParamsTimeout;
28
- private _defaultValidityWindow;
29
- /**
30
- * A set of error transformers to use when an error is caught in simulate or execute
31
- * `registerErrorTransformer` and `unregisterErrorTransformer` can be used to add and remove
32
- * error transformers from the set.
33
- */
34
- private _errorTransformers;
35
- private constructor();
36
- /**
37
- * Sets the default validity window for transactions.
38
- * @param validityWindow The number of rounds between the first and last valid rounds
39
- * @returns The `AlgorandClient` so method calls can be chained
40
- * @example
41
- * ```typescript
42
- * const algorand = AlgorandClient.mainNet().setDefaultValidityWindow(1000);
43
- * ```
44
- */
45
- setDefaultValidityWindow(validityWindow: number | bigint): this;
46
- /**
47
- * Sets the default signer to use if no other signer is specified.
48
- * @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
49
- * @returns The `AlgorandClient` so method calls can be chained
50
- * @example
51
- * ```typescript
52
- * const signer = new SigningAccount(account, account.addr)
53
- * const algorand = AlgorandClient.mainNet().setDefaultSigner(signer)
54
- * ```
55
- */
56
- setDefaultSigner(signer: algosdk.TransactionSigner | TransactionSignerAccount): AlgorandClient;
57
- /**
58
- * Tracks the given account (object that encapsulates an address and a signer) for later signing.
59
- * @param account The account to register, which can be a `TransactionSignerAccount` or
60
- * a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount`
61
- * @example
62
- * ```typescript
63
- * const accountManager = AlgorandClient.mainNet()
64
- * .setSignerFromAccount(algosdk.generateAccount())
65
- * .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
66
- * .setSignerFromAccount(new SigningAccount(account, sender))
67
- * .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
68
- * .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
69
- * ```
70
- * @returns The `AlgorandClient` so method calls can be chained
71
- */
72
- setSignerFromAccount(account: TransactionSignerAccount | Account | LogicSigAccount | SigningAccount | MultisigAccount): this;
73
- /**
74
- * Tracks the given signer against the given sender for later signing.
75
- * @param sender The sender address to use this signer for
76
- * @param signer The signer to sign transactions with for the given sender
77
- * @returns The `AlgorandClient` so method calls can be chained
78
- * @example
79
- * ```typescript
80
- * const signer = new SigningAccount(account, account.addr)
81
- * const algorand = AlgorandClient.mainNet().setSigner(signer.addr, signer.signer)
82
- * ```
83
- */
84
- setSigner(sender: string | Address, signer: algosdk.TransactionSigner): this;
85
- /**
86
- * Sets a cache value to use for suggested transaction params.
87
- * @param suggestedParams The suggested params to use
88
- * @param until A date until which to cache, or if not specified then the timeout is used
89
- * @returns The `AlgorandClient` so method calls can be chained
90
- * @example
91
- * ```typescript
92
- * const algorand = AlgorandClient.mainNet().setSuggestedParamsCache(suggestedParams, new Date(+new Date() + 3_600_000))
93
- * ```
94
- */
95
- setSuggestedParamsCache(suggestedParams: algosdk.SuggestedParams, until?: Date): this;
96
- /**
97
- * Sets the timeout for caching suggested params.
98
- * @param timeout The timeout in milliseconds
99
- * @returns The `AlgorandClient` so method calls can be chained
100
- * @example
101
- * ```typescript
102
- * const algorand = AlgorandClient.mainNet().setSuggestedParamsCacheTimeout(10_000)
103
- * ```
104
- */
105
- setSuggestedParamsCacheTimeout(timeout: number): this;
106
- /**
107
- * Get suggested params for a transaction (either cached or from algod if the cache is stale or empty)
108
- * @returns The suggested transaction parameters.
109
- * @example
110
- * const params = await AlgorandClient.mainNet().getSuggestedParams();
111
- */
112
- getSuggestedParams(): Promise<algosdk.SuggestedParams>;
113
- /**
114
- * Get clients, including algosdk clients and app clients.
115
- * @returns The `ClientManager` instance.
116
- * @example
117
- * const clientManager = AlgorandClient.mainNet().client;
118
- */
119
- get client(): ClientManager;
120
- /**
121
- * Get or create accounts that can sign transactions.
122
- * @returns The `AccountManager` instance.
123
- * @example
124
- * const accountManager = AlgorandClient.mainNet().account;
125
- */
126
- get account(): AccountManager;
127
- /**
128
- * Methods for interacting with assets.
129
- * @returns The `AssetManager` instance.
130
- * @example
131
- * const assetManager = AlgorandClient.mainNet().asset;
132
- */
133
- get asset(): AssetManager;
134
- /**
135
- * Methods for interacting with apps.
136
- * @returns The `AppManager` instance.
137
- * @example
138
- * const appManager = AlgorandClient.mainNet().app;
139
- */
140
- get app(): AppManager;
141
- /**
142
- * Methods for deploying apps and managing app deployment metadata.
143
- * @returns The `AppDeployer` instance.
144
- * @example
145
- * const deployer = AlgorandClient.mainNet().appDeployer;
146
- */
147
- get appDeployer(): AppDeployer;
148
- /**
149
- * Register a function that will be used to transform an error caught when simulating or executing
150
- * composed transaction groups made from `newGroup`
151
- */
152
- registerErrorTransformer(transformer: ErrorTransformer): void;
153
- unregisterErrorTransformer(transformer: ErrorTransformer): void;
154
- /** Start a new `TransactionComposer` transaction group
155
- * @returns A new instance of `TransactionComposer`.
156
- * @example
157
- * const composer = AlgorandClient.mainNet().newGroup();
158
- * const result = await composer.addTransaction(payment).send()
159
- */
160
- newGroup(): TransactionComposer;
161
- /**
162
- * Methods for sending a transaction.
163
- * @returns The `AlgorandClientTransactionSender` instance.
164
- * @example
165
- * const result = await AlgorandClient.mainNet().send.payment({
166
- * sender: "SENDERADDRESS",
167
- * receiver: "RECEIVERADDRESS",
168
- * amount: algo(1)
169
- * })
170
- */
171
- get send(): AlgorandClientTransactionSender;
172
- /**
173
- * Methods for creating a transaction.
174
- * @returns The `AlgorandClientTransactionCreator` instance.
175
- * @example
176
- * const payment = await AlgorandClient.mainNet().createTransaction.payment({
177
- * sender: "SENDERADDRESS",
178
- * receiver: "RECEIVERADDRESS",
179
- * amount: algo(1)
180
- * })
181
- */
182
- get createTransaction(): AlgorandClientTransactionCreator;
183
- /**
184
- * Creates an `AlgorandClient` pointing at default LocalNet ports and API token.
185
- * @returns An instance of the `AlgorandClient`.
186
- * @example
187
- * const algorand = AlgorandClient.defaultLocalNet();
188
- */
189
- static defaultLocalNet(): AlgorandClient;
190
- /**
191
- * Creates an `AlgorandClient` pointing at TestNet using AlgoNode.
192
- * @returns An instance of the `AlgorandClient`.
193
- * @example
194
- * const algorand = AlgorandClient.testNet();
195
- */
196
- static testNet(): AlgorandClient;
197
- /**
198
- * Creates an `AlgorandClient` pointing at MainNet using AlgoNode.
199
- * @returns An instance of the `AlgorandClient`.
200
- * @example
201
- * const algorand = AlgorandClient.mainNet();
202
- */
203
- static mainNet(): AlgorandClient;
204
- /**
205
- * Creates an `AlgorandClient` pointing to the given client(s).
206
- * @param clients The clients to use.
207
- * @returns An instance of the `AlgorandClient`.
208
- * @example
209
- * const algorand = AlgorandClient.fromClients({ algod, indexer, kmd });
210
- */
211
- static fromClients(clients: AlgoSdkClients): AlgorandClient;
212
- /**
213
- * Creates an `AlgorandClient` loading the configuration from environment variables.
214
- *
215
- * Retrieve configurations from environment variables when defined or get default LocalNet configuration if they aren't defined.
216
- *
217
- * Expects to be called from a Node.js environment.
218
- *
219
- * If `process.env.ALGOD_SERVER` is defined it will use that along with optional `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN`.
220
- *
221
- * If `process.env.INDEXER_SERVER` is defined it will use that along with optional `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.
222
- *
223
- * If either aren't defined it will use the default LocalNet config.
224
- *
225
- * It will return a KMD configuration that uses `process.env.KMD_PORT` (or port 4002) if `process.env.ALGOD_SERVER` is defined,
226
- * otherwise it will use the default LocalNet config unless it detects testnet or mainnet.
227
- * @returns An instance of the `AlgorandClient`.
228
- * @example
229
- * const client = AlgorandClient.fromEnvironment();
230
- */
231
- static fromEnvironment(): AlgorandClient;
232
- /**
233
- * Creates an `AlgorandClient` from the given config.
234
- * @param config The config to use.
235
- * @returns An instance of the `AlgorandClient`.
236
- * @example
237
- * const client = AlgorandClient.fromConfig({ algodConfig, indexerConfig, kmdConfig });
238
- */
239
- static fromConfig(config: AlgoConfig): AlgorandClient;
17
+ export declare class AlgorandClient {
18
+ private _clientManager;
19
+ private _accountManager;
20
+ private _appManager;
21
+ private _appDeployer;
22
+ private _assetManager;
23
+ private _transactionSender;
24
+ private _transactionCreator;
25
+ private _cachedSuggestedParams?;
26
+ private _cachedSuggestedParamsExpiry?;
27
+ private _cachedSuggestedParamsTimeout;
28
+ private _defaultValidityWindow;
29
+ /**
30
+ * A set of error transformers to use when an error is caught in simulate or execute
31
+ * `registerErrorTransformer` and `unregisterErrorTransformer` can be used to add and remove
32
+ * error transformers from the set.
33
+ */
34
+ private _errorTransformers;
35
+ private constructor();
36
+ /**
37
+ * Sets the default validity window for transactions.
38
+ * @param validityWindow The number of rounds between the first and last valid rounds
39
+ * @returns The `AlgorandClient` so method calls can be chained
40
+ * @example
41
+ * ```typescript
42
+ * const algorand = AlgorandClient.mainNet().setDefaultValidityWindow(1000);
43
+ * ```
44
+ */
45
+ setDefaultValidityWindow(validityWindow: number | bigint): this;
46
+ /**
47
+ * Sets the default signer to use if no other signer is specified.
48
+ * @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
49
+ * @returns The `AlgorandClient` so method calls can be chained
50
+ * @example
51
+ * ```typescript
52
+ * const signer = new SigningAccount(account, account.addr)
53
+ * const algorand = AlgorandClient.mainNet().setDefaultSigner(signer)
54
+ * ```
55
+ */
56
+ setDefaultSigner(signer: algosdk.TransactionSigner | TransactionSignerAccount): AlgorandClient;
57
+ /**
58
+ * Tracks the given account (object that encapsulates an address and a signer) for later signing.
59
+ * @param account The account to register, which can be a `TransactionSignerAccount` or
60
+ * a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount`
61
+ * @example
62
+ * ```typescript
63
+ * const accountManager = AlgorandClient.mainNet()
64
+ * .setSignerFromAccount(algosdk.generateAccount())
65
+ * .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
66
+ * .setSignerFromAccount(new SigningAccount(account, sender))
67
+ * .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
68
+ * .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
69
+ * ```
70
+ * @returns The `AlgorandClient` so method calls can be chained
71
+ */
72
+ setSignerFromAccount(account: TransactionSignerAccount | Account | LogicSigAccount | SigningAccount | MultisigAccount): this;
73
+ /**
74
+ * Tracks the given signer against the given sender for later signing.
75
+ * @param sender The sender address to use this signer for
76
+ * @param signer The signer to sign transactions with for the given sender
77
+ * @returns The `AlgorandClient` so method calls can be chained
78
+ * @example
79
+ * ```typescript
80
+ * const signer = new SigningAccount(account, account.addr)
81
+ * const algorand = AlgorandClient.mainNet().setSigner(signer.addr, signer.signer)
82
+ * ```
83
+ */
84
+ setSigner(sender: string | Address, signer: algosdk.TransactionSigner): this;
85
+ /**
86
+ * Sets a cache value to use for suggested transaction params.
87
+ * @param suggestedParams The suggested params to use
88
+ * @param until A date until which to cache, or if not specified then the timeout is used
89
+ * @returns The `AlgorandClient` so method calls can be chained
90
+ * @example
91
+ * ```typescript
92
+ * const algorand = AlgorandClient.mainNet().setSuggestedParamsCache(suggestedParams, new Date(+new Date() + 3_600_000))
93
+ * ```
94
+ */
95
+ setSuggestedParamsCache(suggestedParams: algosdk.SuggestedParams, until?: Date): this;
96
+ /**
97
+ * Sets the timeout for caching suggested params.
98
+ * @param timeout The timeout in milliseconds
99
+ * @returns The `AlgorandClient` so method calls can be chained
100
+ * @example
101
+ * ```typescript
102
+ * const algorand = AlgorandClient.mainNet().setSuggestedParamsCacheTimeout(10_000)
103
+ * ```
104
+ */
105
+ setSuggestedParamsCacheTimeout(timeout: number): this;
106
+ /**
107
+ * Get suggested params for a transaction (either cached or from algod if the cache is stale or empty)
108
+ * @returns The suggested transaction parameters.
109
+ * @example
110
+ * const params = await AlgorandClient.mainNet().getSuggestedParams();
111
+ */
112
+ getSuggestedParams(): Promise<algosdk.SuggestedParams>;
113
+ /**
114
+ * Get clients, including algosdk clients and app clients.
115
+ * @returns The `ClientManager` instance.
116
+ * @example
117
+ * const clientManager = AlgorandClient.mainNet().client;
118
+ */
119
+ get client(): ClientManager;
120
+ /**
121
+ * Get or create accounts that can sign transactions.
122
+ * @returns The `AccountManager` instance.
123
+ * @example
124
+ * const accountManager = AlgorandClient.mainNet().account;
125
+ */
126
+ get account(): AccountManager;
127
+ /**
128
+ * Methods for interacting with assets.
129
+ * @returns The `AssetManager` instance.
130
+ * @example
131
+ * const assetManager = AlgorandClient.mainNet().asset;
132
+ */
133
+ get asset(): AssetManager;
134
+ /**
135
+ * Methods for interacting with apps.
136
+ * @returns The `AppManager` instance.
137
+ * @example
138
+ * const appManager = AlgorandClient.mainNet().app;
139
+ */
140
+ get app(): AppManager;
141
+ /**
142
+ * Methods for deploying apps and managing app deployment metadata.
143
+ * @returns The `AppDeployer` instance.
144
+ * @example
145
+ * const deployer = AlgorandClient.mainNet().appDeployer;
146
+ */
147
+ get appDeployer(): AppDeployer;
148
+ /**
149
+ * Register a function that will be used to transform an error caught when simulating or executing
150
+ * composed transaction groups made from `newGroup`
151
+ */
152
+ registerErrorTransformer(transformer: ErrorTransformer): void;
153
+ unregisterErrorTransformer(transformer: ErrorTransformer): void;
154
+ /** Start a new `TransactionComposer` transaction group
155
+ * @returns A new instance of `TransactionComposer`.
156
+ * @example
157
+ * const composer = AlgorandClient.mainNet().newGroup();
158
+ * const result = await composer.addTransaction(payment).send()
159
+ */
160
+ newGroup(): TransactionComposer;
161
+ /**
162
+ * Methods for sending a transaction.
163
+ * @returns The `AlgorandClientTransactionSender` instance.
164
+ * @example
165
+ * const result = await AlgorandClient.mainNet().send.payment({
166
+ * sender: "SENDERADDRESS",
167
+ * receiver: "RECEIVERADDRESS",
168
+ * amount: algo(1)
169
+ * })
170
+ */
171
+ get send(): AlgorandClientTransactionSender;
172
+ /**
173
+ * Methods for creating a transaction.
174
+ * @returns The `AlgorandClientTransactionCreator` instance.
175
+ * @example
176
+ * const payment = await AlgorandClient.mainNet().createTransaction.payment({
177
+ * sender: "SENDERADDRESS",
178
+ * receiver: "RECEIVERADDRESS",
179
+ * amount: algo(1)
180
+ * })
181
+ */
182
+ get createTransaction(): AlgorandClientTransactionCreator;
183
+ /**
184
+ * Creates an `AlgorandClient` pointing at default LocalNet ports and API token.
185
+ * @returns An instance of the `AlgorandClient`.
186
+ * @example
187
+ * const algorand = AlgorandClient.defaultLocalNet();
188
+ */
189
+ static defaultLocalNet(): AlgorandClient;
190
+ /**
191
+ * Creates an `AlgorandClient` pointing at TestNet using AlgoNode.
192
+ * @returns An instance of the `AlgorandClient`.
193
+ * @example
194
+ * const algorand = AlgorandClient.testNet();
195
+ */
196
+ static testNet(): AlgorandClient;
197
+ /**
198
+ * Creates an `AlgorandClient` pointing at MainNet using AlgoNode.
199
+ * @returns An instance of the `AlgorandClient`.
200
+ * @example
201
+ * const algorand = AlgorandClient.mainNet();
202
+ */
203
+ static mainNet(): AlgorandClient;
204
+ /**
205
+ * Creates an `AlgorandClient` pointing to the given client(s).
206
+ * @param clients The clients to use.
207
+ * @returns An instance of the `AlgorandClient`.
208
+ * @example
209
+ * const algorand = AlgorandClient.fromClients({ algod, indexer, kmd });
210
+ */
211
+ static fromClients(clients: AlgoSdkClients): AlgorandClient;
212
+ /**
213
+ * Creates an `AlgorandClient` loading the configuration from environment variables.
214
+ *
215
+ * Retrieve configurations from environment variables when defined or get default LocalNet configuration if they aren't defined.
216
+ *
217
+ * Expects to be called from a Node.js environment.
218
+ *
219
+ * If `process.env.ALGOD_SERVER` is defined it will use that along with optional `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN`.
220
+ *
221
+ * If `process.env.INDEXER_SERVER` is defined it will use that along with optional `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.
222
+ *
223
+ * If either aren't defined it will use the default LocalNet config.
224
+ *
225
+ * It will return a KMD configuration that uses `process.env.KMD_PORT` (or port 4002) if `process.env.ALGOD_SERVER` is defined,
226
+ * otherwise it will use the default LocalNet config unless it detects testnet or mainnet.
227
+ * @returns An instance of the `AlgorandClient`.
228
+ * @example
229
+ * const client = AlgorandClient.fromEnvironment();
230
+ */
231
+ static fromEnvironment(): AlgorandClient;
232
+ /**
233
+ * Creates an `AlgorandClient` from the given config.
234
+ * @param config The config to use.
235
+ * @returns An instance of the `AlgorandClient`.
236
+ * @example
237
+ * const client = AlgorandClient.fromConfig({ algodConfig, indexerConfig, kmdConfig });
238
+ */
239
+ static fromConfig(config: AlgoConfig): AlgorandClient;
240
240
  }
241
- //#endregion
242
- export { AlgorandClient };
243
- //# sourceMappingURL=algorand-client.d.ts.map
package/types/amount.d.ts CHANGED
@@ -1,49 +1,45 @@
1
- //#region src/types/amount.d.ts
2
1
  /** Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers */
3
- declare class AlgoAmount {
4
- private amountInMicroAlgo;
5
- /** Return the amount as a number in µAlgo */
6
- get microAlgos(): bigint;
7
- /** Return the amount as a number in µAlgo */
8
- get microAlgo(): bigint;
9
- /** Return the amount as a number in Algo */
10
- get algos(): number;
11
- /** Return the amount as a number in Algo */
12
- get algo(): number;
13
- /**
14
- * Create a new `AlgoAmount` instance.
15
- *
16
- * @param amount - An object specifying the amount in Algo or µALGO. Use the key 'algo' for Algo amounts and 'microAlgo' for µALGO.
17
- * @returns A new instance of `AlgoAmount` representing the specified amount.
18
- * @example
19
- * ```typescript
20
- * const amount = new AlgoAmount({ algo: 5 });
21
- * ```
22
- */
23
- constructor(amount: {
24
- algos: number | bigint;
25
- } | {
26
- algo: number | bigint;
27
- } | {
28
- microAlgos: number | bigint;
29
- } | {
30
- microAlgo: number | bigint;
31
- });
32
- toString(): string;
33
- /** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
34
- * but it's not recommended to use this to convert to a number, it's much safer to explicitly call
35
- * the algos or microAlgos properties
36
- */
37
- valueOf(): number;
38
- /** Create a `AlgoAmount` object representing the given number of Algo */
39
- static Algos(amount: number | bigint): AlgoAmount;
40
- /** Create a `AlgoAmount` object representing the given number of Algo */
41
- static Algo(amount: number | bigint): AlgoAmount;
42
- /** Create a `AlgoAmount` object representing the given number of µAlgo */
43
- static MicroAlgos(amount: number | bigint): AlgoAmount;
44
- /** Create a `AlgoAmount` object representing the given number of µAlgo */
45
- static MicroAlgo(amount: number | bigint): AlgoAmount;
2
+ export declare class AlgoAmount {
3
+ private amountInMicroAlgo;
4
+ /** Return the amount as a number in µAlgo */
5
+ get microAlgos(): bigint;
6
+ /** Return the amount as a number in µAlgo */
7
+ get microAlgo(): bigint;
8
+ /** Return the amount as a number in Algo */
9
+ get algos(): number;
10
+ /** Return the amount as a number in Algo */
11
+ get algo(): number;
12
+ /**
13
+ * Create a new `AlgoAmount` instance.
14
+ *
15
+ * @param amount - An object specifying the amount in Algo or µALGO. Use the key 'algo' for Algo amounts and 'microAlgo' for µALGO.
16
+ * @returns A new instance of `AlgoAmount` representing the specified amount.
17
+ * @example
18
+ * ```typescript
19
+ * const amount = new AlgoAmount({ algo: 5 });
20
+ * ```
21
+ */
22
+ constructor(amount: {
23
+ algos: number | bigint;
24
+ } | {
25
+ algo: number | bigint;
26
+ } | {
27
+ microAlgos: number | bigint;
28
+ } | {
29
+ microAlgo: number | bigint;
30
+ });
31
+ toString(): string;
32
+ /** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
33
+ * but it's not recommended to use this to convert to a number, it's much safer to explicitly call
34
+ * the algos or microAlgos properties
35
+ */
36
+ valueOf(): number;
37
+ /** Create a `AlgoAmount` object representing the given number of Algo */
38
+ static Algos(amount: number | bigint): AlgoAmount;
39
+ /** Create a `AlgoAmount` object representing the given number of Algo */
40
+ static Algo(amount: number | bigint): AlgoAmount;
41
+ /** Create a `AlgoAmount` object representing the given number of µAlgo */
42
+ static MicroAlgos(amount: number | bigint): AlgoAmount;
43
+ /** Create a `AlgoAmount` object representing the given number of µAlgo */
44
+ static MicroAlgo(amount: number | bigint): AlgoAmount;
46
45
  }
47
- //#endregion
48
- export { AlgoAmount };
49
- //# sourceMappingURL=amount.d.ts.map