@algorandfoundation/algokit-utils 6.0.0-beta.3 → 6.0.0-beta.5
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/account.d.ts +33 -1
- package/account/account.d.ts.map +1 -1
- package/account/account.js +63 -0
- package/account/account.js.map +1 -1
- package/account/account.mjs +62 -1
- package/account/account.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/index.mjs +3 -2
- package/index.mjs.map +1 -1
- package/indexer-lookup.d.ts +11 -2
- package/indexer-lookup.d.ts.map +1 -1
- package/indexer-lookup.js +33 -1
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +33 -2
- package/indexer-lookup.mjs.map +1 -1
- package/package.json +1 -1
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
- package/testing/fixtures/algorand-fixture.js +15 -2
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +15 -2
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/types/account-manager.d.ts +211 -0
- package/types/account-manager.d.ts.map +1 -0
- package/types/account-manager.js +265 -0
- package/types/account-manager.js.map +1 -0
- package/types/account-manager.mjs +263 -0
- package/types/account-manager.mjs.map +1 -0
- package/types/account.d.ts +19 -0
- package/types/account.d.ts.map +1 -1
- package/types/account.js.map +1 -1
- package/types/account.mjs.map +1 -1
- package/types/algorand-client.d.ts +183 -0
- package/types/algorand-client.d.ts.map +1 -0
- package/types/algorand-client.js +296 -0
- package/types/algorand-client.js.map +1 -0
- package/types/algorand-client.mjs +291 -0
- package/types/algorand-client.mjs.map +1 -0
- package/types/client-manager.d.ts +99 -0
- package/types/client-manager.d.ts.map +1 -0
- package/types/client-manager.js +99 -0
- package/types/client-manager.js.map +1 -0
- package/types/client-manager.mjs +97 -0
- package/types/client-manager.mjs.map +1 -0
- package/types/composer.d.ts +331 -0
- package/types/composer.d.ts.map +1 -0
- package/types/composer.js +446 -0
- package/types/composer.js.map +1 -0
- package/types/composer.mjs +444 -0
- package/types/composer.mjs.map +1 -0
- package/types/indexer.d.ts +39 -0
- package/types/indexer.d.ts.map +1 -1
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs.map +1 -1
- package/types/network-client.d.ts +2 -2
- package/types/network-client.d.ts.map +1 -1
- package/types/testing.d.ts +8 -2
- package/types/testing.d.ts.map +1 -1
- package/types/transaction.d.ts +4 -0
- package/types/transaction.d.ts.map +1 -1
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var config = require('../config.js');
|
|
6
|
+
var networkClient = require('../network-client.js');
|
|
7
|
+
var types_accountManager = require('./account-manager.js');
|
|
8
|
+
var types_clientManager = require('./client-manager.js');
|
|
9
|
+
var types_composer = require('./composer.js');
|
|
10
|
+
|
|
11
|
+
/** A client that brokers easy access to Algorand functionality.
|
|
12
|
+
*
|
|
13
|
+
* Note: this class is a new Beta feature and may be subject to change.
|
|
14
|
+
*
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
class AlgorandClient {
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this._cachedSuggestedParamsTimeout = 3000; // three seconds
|
|
20
|
+
this._defaultValidityWindow = 10;
|
|
21
|
+
/**
|
|
22
|
+
* Methods for sending a single transaction.
|
|
23
|
+
*/
|
|
24
|
+
this.send = {
|
|
25
|
+
/**
|
|
26
|
+
* Send a payment transaction.
|
|
27
|
+
*/
|
|
28
|
+
payment: this._send((c) => c.addPayment, {
|
|
29
|
+
preLog: (params, transaction) => `Sending ${params.amount.microAlgos} µALGOs from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
|
|
30
|
+
}),
|
|
31
|
+
/**
|
|
32
|
+
* Create an asset.
|
|
33
|
+
*/
|
|
34
|
+
assetCreate: this._send((c) => c.addAssetCreate, {
|
|
35
|
+
postLog: (params, result) => `Created asset${params.assetName ? ` ${params.assetName} ` : ''}${params.unitName ? ` (${params.unitName}) ` : ''} with ${params.total} units and ${params.decimals ?? 0} decimals created by ${params.sender} with ID ${result.confirmation.assetIndex} via transaction ${result.txIds.at(-1)}`,
|
|
36
|
+
}),
|
|
37
|
+
/**
|
|
38
|
+
* Configure an existing asset.
|
|
39
|
+
*/
|
|
40
|
+
assetConfig: this._send((c) => c.addAssetConfig, {
|
|
41
|
+
preLog: (params, transaction) => `Configuring asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
42
|
+
}),
|
|
43
|
+
/**
|
|
44
|
+
* Freeze or unfreeze an asset.
|
|
45
|
+
*/
|
|
46
|
+
assetFreeze: this._send((c) => c.addAssetFreeze, {
|
|
47
|
+
preLog: (params, transaction) => `Freezing asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
48
|
+
}),
|
|
49
|
+
/**
|
|
50
|
+
* Destroy an asset.
|
|
51
|
+
*/
|
|
52
|
+
assetDestroy: this._send((c) => c.addAssetDestroy, {
|
|
53
|
+
preLog: (params, transaction) => `Destroying asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
54
|
+
}),
|
|
55
|
+
/**
|
|
56
|
+
* Transfer an asset.
|
|
57
|
+
*/
|
|
58
|
+
assetTransfer: this._send((c) => c.addAssetTransfer, {
|
|
59
|
+
preLog: (params, transaction) => `Transferring ${params.amount} units of asset with ID ${params.assetId} from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
|
|
60
|
+
}),
|
|
61
|
+
/**
|
|
62
|
+
* Opt an account into an asset.
|
|
63
|
+
*/
|
|
64
|
+
assetOptIn: this._send((c) => c.addAssetOptIn, {
|
|
65
|
+
preLog: (params, transaction) => `Opting in ${params.sender} to asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
66
|
+
}),
|
|
67
|
+
/**
|
|
68
|
+
* Call a smart contract.
|
|
69
|
+
*
|
|
70
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
71
|
+
*/
|
|
72
|
+
appCall: this._send((c) => c.addAppCall),
|
|
73
|
+
/**
|
|
74
|
+
* Call a smart contract ABI method.
|
|
75
|
+
*
|
|
76
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
77
|
+
*/
|
|
78
|
+
methodCall: this._send((c) => c.addMethodCall),
|
|
79
|
+
/** Register an online key. */
|
|
80
|
+
onlineKeyRegistration: this._send((c) => c.addOnlineKeyRegistration, {
|
|
81
|
+
preLog: (params, transaction) => `Registering online key for ${params.sender} via transaction ${transaction.txID()}`,
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Methods for building transactions
|
|
86
|
+
*/
|
|
87
|
+
this.transactions = {
|
|
88
|
+
/** Create a payment transaction. */
|
|
89
|
+
payment: this._transaction((c) => c.addPayment),
|
|
90
|
+
/** Create an asset creation transaction. */
|
|
91
|
+
assetCreate: this._transaction((c) => c.addAssetCreate),
|
|
92
|
+
/** Create an asset config transaction. */
|
|
93
|
+
assetConfig: this._transaction((c) => c.addAssetConfig),
|
|
94
|
+
/** Create an asset freeze transaction. */
|
|
95
|
+
assetFreeze: this._transaction((c) => c.addAssetFreeze),
|
|
96
|
+
/** Create an asset destroy transaction. */
|
|
97
|
+
assetDestroy: this._transaction((c) => c.addAssetDestroy),
|
|
98
|
+
/** Create an asset transfer transaction. */
|
|
99
|
+
assetTransfer: this._transaction((c) => c.addAssetTransfer),
|
|
100
|
+
/** Create an asset opt-in transaction. */
|
|
101
|
+
assetOptIn: this._transaction((c) => c.addAssetOptIn),
|
|
102
|
+
/** Create an application call transaction. */
|
|
103
|
+
appCall: this._transaction((c) => c.addAppCall),
|
|
104
|
+
/** Create an application call with ABI method call transaction. */
|
|
105
|
+
methodCall: async (params) => {
|
|
106
|
+
return (await this.newGroup().addMethodCall(params).build()).transactions.map((ts) => ts.txn);
|
|
107
|
+
},
|
|
108
|
+
/** Create an online key registration transaction. */
|
|
109
|
+
onlineKeyRegistration: this._transaction((c) => c.addOnlineKeyRegistration),
|
|
110
|
+
};
|
|
111
|
+
this._clientManager = new types_clientManager.ClientManager(config);
|
|
112
|
+
this._accountManager = new types_accountManager.AccountManager(this._clientManager);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Sets the default validity window for transactions.
|
|
116
|
+
* @param validityWindow The number of rounds between the first and last valid rounds
|
|
117
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
118
|
+
*/
|
|
119
|
+
setDefaultValidityWindow(validityWindow) {
|
|
120
|
+
this._defaultValidityWindow = validityWindow;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Sets the default signer to use if no other signer is specified.
|
|
125
|
+
* @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
|
|
126
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
127
|
+
*/
|
|
128
|
+
setDefaultSigner(signer) {
|
|
129
|
+
this._accountManager.setDefaultSigner(signer);
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Tracks the given account for later signing.
|
|
134
|
+
* @param account The account to register
|
|
135
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
136
|
+
*/
|
|
137
|
+
setSignerFromAccount(account) {
|
|
138
|
+
this._accountManager.setSignerFromAccount(account);
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Tracks the given account for later signing.
|
|
143
|
+
* @param sender The sender address to use this signer for
|
|
144
|
+
* @param signer The signer to sign transactions with for the given sender
|
|
145
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
146
|
+
*/
|
|
147
|
+
setSigner(sender, signer) {
|
|
148
|
+
this._accountManager.setSigner(sender, signer);
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Sets a cache value to use for suggested params.
|
|
153
|
+
* @param suggestedParams The suggested params to use
|
|
154
|
+
* @param until A date until which to cache, or if not specified then the timeout is used
|
|
155
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
156
|
+
*/
|
|
157
|
+
setSuggestedParams(suggestedParams, until) {
|
|
158
|
+
this._cachedSuggestedParams = suggestedParams;
|
|
159
|
+
this._cachedSuggestedParamsExpiry = until ?? new Date(+new Date() + this._cachedSuggestedParamsTimeout);
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Sets the timeout for caching suggested params.
|
|
164
|
+
* @param timeout The timeout in milliseconds
|
|
165
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
166
|
+
*/
|
|
167
|
+
setSuggestedParamsTimeout(timeout) {
|
|
168
|
+
this._cachedSuggestedParamsTimeout = timeout;
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/** Get suggested params for a transaction (either cached or from algod if the cache is stale or empty) */
|
|
172
|
+
async getSuggestedParams() {
|
|
173
|
+
if (this._cachedSuggestedParams && (!this._cachedSuggestedParamsExpiry || this._cachedSuggestedParamsExpiry > new Date())) {
|
|
174
|
+
return {
|
|
175
|
+
...this._cachedSuggestedParams,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
this._cachedSuggestedParams = await this._clientManager.algod.getTransactionParams().do();
|
|
179
|
+
this._cachedSuggestedParamsExpiry = new Date(new Date().getTime() + this._cachedSuggestedParamsTimeout);
|
|
180
|
+
return {
|
|
181
|
+
...this._cachedSuggestedParams,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/** Get clients, including algosdk clients and app clients. */
|
|
185
|
+
get client() {
|
|
186
|
+
return this._clientManager;
|
|
187
|
+
}
|
|
188
|
+
/** Get or create accounts that can sign transactions. */
|
|
189
|
+
get account() {
|
|
190
|
+
return this._accountManager;
|
|
191
|
+
}
|
|
192
|
+
/** Start a new `AlgokitComposer` transaction group */
|
|
193
|
+
newGroup() {
|
|
194
|
+
return new types_composer({
|
|
195
|
+
algod: this.client.algod,
|
|
196
|
+
getSigner: (addr) => this.account.getSigner(addr),
|
|
197
|
+
getSuggestedParams: () => this.getSuggestedParams(),
|
|
198
|
+
defaultValidityWindow: this._defaultValidityWindow,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
_send(c, log) {
|
|
202
|
+
return async (params, config$1) => {
|
|
203
|
+
const composer = this.newGroup();
|
|
204
|
+
// Ensure `this` is properly populated
|
|
205
|
+
c(composer).apply(composer, [params]);
|
|
206
|
+
if (log?.preLog) {
|
|
207
|
+
const transaction = (await composer.build()).transactions.at(-1).txn;
|
|
208
|
+
config.Config.getLogger(config$1?.suppressLog).debug(log.preLog(params, transaction));
|
|
209
|
+
}
|
|
210
|
+
const rawResult = await composer.execute(config$1);
|
|
211
|
+
const result = {
|
|
212
|
+
// Last item covers when a group is created by an app call with ABI transaction parameters
|
|
213
|
+
transaction: rawResult.transactions[rawResult.transactions.length - 1],
|
|
214
|
+
confirmation: rawResult.confirmations[rawResult.confirmations.length - 1],
|
|
215
|
+
txId: rawResult.txIds[0],
|
|
216
|
+
...rawResult,
|
|
217
|
+
};
|
|
218
|
+
if (log?.postLog) {
|
|
219
|
+
config.Config.getLogger(config$1?.suppressLog).debug(log.postLog(params, result));
|
|
220
|
+
}
|
|
221
|
+
return result;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
_transaction(c) {
|
|
225
|
+
return async (params) => {
|
|
226
|
+
const composer = this.newGroup();
|
|
227
|
+
const result = await c(composer).apply(composer, [params]).build();
|
|
228
|
+
return result.transactions.map((ts) => ts.txn)[0];
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
// Static methods to create an `AlgorandClient`
|
|
232
|
+
/**
|
|
233
|
+
* Returns an `AlgorandClient` pointing at default LocalNet ports and API token.
|
|
234
|
+
* @returns The `AlgorandClient`
|
|
235
|
+
*/
|
|
236
|
+
static defaultLocalNet() {
|
|
237
|
+
return new AlgorandClient({
|
|
238
|
+
algodConfig: networkClient.getDefaultLocalNetConfig('algod'),
|
|
239
|
+
indexerConfig: networkClient.getDefaultLocalNetConfig('indexer'),
|
|
240
|
+
kmdConfig: networkClient.getDefaultLocalNetConfig('kmd'),
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Returns an `AlgorandClient` pointing at TestNet using AlgoNode.
|
|
245
|
+
* @returns The `AlgorandClient`
|
|
246
|
+
*/
|
|
247
|
+
static testNet() {
|
|
248
|
+
return new AlgorandClient({
|
|
249
|
+
algodConfig: networkClient.getAlgoNodeConfig('testnet', 'algod'),
|
|
250
|
+
indexerConfig: networkClient.getAlgoNodeConfig('testnet', 'indexer'),
|
|
251
|
+
kmdConfig: undefined,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Returns an `AlgorandClient` pointing at MainNet using AlgoNode.
|
|
256
|
+
* @returns The `AlgorandClient`
|
|
257
|
+
*/
|
|
258
|
+
static mainNet() {
|
|
259
|
+
return new AlgorandClient({
|
|
260
|
+
algodConfig: networkClient.getAlgoNodeConfig('mainnet', 'algod'),
|
|
261
|
+
indexerConfig: networkClient.getAlgoNodeConfig('mainnet', 'indexer'),
|
|
262
|
+
kmdConfig: undefined,
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Returns an `AlgorandClient` pointing to the given client(s).
|
|
267
|
+
* @param clients The clients to use
|
|
268
|
+
* @returns The `AlgorandClient`
|
|
269
|
+
*/
|
|
270
|
+
static fromClients(clients) {
|
|
271
|
+
return new AlgorandClient(clients);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Returns an `AlgorandClient` loading the configuration from environment variables.
|
|
275
|
+
*
|
|
276
|
+
* Retrieve configurations from environment variables when defined or get defaults.
|
|
277
|
+
*
|
|
278
|
+
* Expects to be called from a Node.js environment.
|
|
279
|
+
* @returns The `AlgorandClient`
|
|
280
|
+
*/
|
|
281
|
+
static fromEnvironment() {
|
|
282
|
+
return new AlgorandClient(networkClient.getConfigFromEnvOrDefaults());
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Returns an `AlgorandClient` from the given config.
|
|
286
|
+
* @param config The config to use
|
|
287
|
+
* @returns The `AlgorandClient`
|
|
288
|
+
*/
|
|
289
|
+
static fromConfig(config) {
|
|
290
|
+
return new AlgorandClient(config);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
exports.AlgorandClient = AlgorandClient;
|
|
295
|
+
exports.default = AlgorandClient;
|
|
296
|
+
//# sourceMappingURL=algorand-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorand-client.js","sources":["../../src/types/algorand-client.ts"],"sourcesContent":[null],"names":["ClientManager","AccountManager","AlgokitComposer","config","Config","getDefaultLocalNetConfig","getAlgoNodeConfig","getConfigFromEnvOrDefaults"],"mappings":";;;;;;;;;;AAcA;;;;;AAKG;MACU,cAAc,CAAA;AAUzB,IAAA,WAAA,CAAoB,MAAmC,EAAA;AAJ/C,QAAA,IAAA,CAAA,6BAA6B,GAAW,IAAK,CAAA;QAE7C,IAAsB,CAAA,sBAAA,GAAW,EAAE,CAAA;AA6I3C;;AAEG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG;AACL;;AAEG;AACH,YAAA,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE;gBACvC,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAC1B,CAAA,QAAA,EAAW,MAAM,CAAC,MAAM,CAAC,UAAU,CAAA,aAAA,EAAgB,MAAM,CAAC,MAAM,CAAA,IAAA,EAAO,MAAM,CAAC,QAAQ,CAAA,iBAAA,EAAoB,WAAW,CAAC,IAAI,EAAE,CAAE,CAAA;aACjI,CAAC;AACF;;AAEG;AACH,YAAA,WAAW,EAA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AAC,CAAA;KAClC;AACF;;;;;"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { Config } from '../config.mjs';
|
|
2
|
+
import { getDefaultLocalNetConfig, getAlgoNodeConfig, getConfigFromEnvOrDefaults } from '../network-client.mjs';
|
|
3
|
+
import { AccountManager } from './account-manager.mjs';
|
|
4
|
+
import { ClientManager } from './client-manager.mjs';
|
|
5
|
+
import AlgokitComposer from './composer.mjs';
|
|
6
|
+
|
|
7
|
+
/** A client that brokers easy access to Algorand functionality.
|
|
8
|
+
*
|
|
9
|
+
* Note: this class is a new Beta feature and may be subject to change.
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
class AlgorandClient {
|
|
14
|
+
constructor(config) {
|
|
15
|
+
this._cachedSuggestedParamsTimeout = 3000; // three seconds
|
|
16
|
+
this._defaultValidityWindow = 10;
|
|
17
|
+
/**
|
|
18
|
+
* Methods for sending a single transaction.
|
|
19
|
+
*/
|
|
20
|
+
this.send = {
|
|
21
|
+
/**
|
|
22
|
+
* Send a payment transaction.
|
|
23
|
+
*/
|
|
24
|
+
payment: this._send((c) => c.addPayment, {
|
|
25
|
+
preLog: (params, transaction) => `Sending ${params.amount.microAlgos} µALGOs from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
|
|
26
|
+
}),
|
|
27
|
+
/**
|
|
28
|
+
* Create an asset.
|
|
29
|
+
*/
|
|
30
|
+
assetCreate: this._send((c) => c.addAssetCreate, {
|
|
31
|
+
postLog: (params, result) => `Created asset${params.assetName ? ` ${params.assetName} ` : ''}${params.unitName ? ` (${params.unitName}) ` : ''} with ${params.total} units and ${params.decimals ?? 0} decimals created by ${params.sender} with ID ${result.confirmation.assetIndex} via transaction ${result.txIds.at(-1)}`,
|
|
32
|
+
}),
|
|
33
|
+
/**
|
|
34
|
+
* Configure an existing asset.
|
|
35
|
+
*/
|
|
36
|
+
assetConfig: this._send((c) => c.addAssetConfig, {
|
|
37
|
+
preLog: (params, transaction) => `Configuring asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
38
|
+
}),
|
|
39
|
+
/**
|
|
40
|
+
* Freeze or unfreeze an asset.
|
|
41
|
+
*/
|
|
42
|
+
assetFreeze: this._send((c) => c.addAssetFreeze, {
|
|
43
|
+
preLog: (params, transaction) => `Freezing asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
44
|
+
}),
|
|
45
|
+
/**
|
|
46
|
+
* Destroy an asset.
|
|
47
|
+
*/
|
|
48
|
+
assetDestroy: this._send((c) => c.addAssetDestroy, {
|
|
49
|
+
preLog: (params, transaction) => `Destroying asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
50
|
+
}),
|
|
51
|
+
/**
|
|
52
|
+
* Transfer an asset.
|
|
53
|
+
*/
|
|
54
|
+
assetTransfer: this._send((c) => c.addAssetTransfer, {
|
|
55
|
+
preLog: (params, transaction) => `Transferring ${params.amount} units of asset with ID ${params.assetId} from ${params.sender} to ${params.receiver} via transaction ${transaction.txID()}`,
|
|
56
|
+
}),
|
|
57
|
+
/**
|
|
58
|
+
* Opt an account into an asset.
|
|
59
|
+
*/
|
|
60
|
+
assetOptIn: this._send((c) => c.addAssetOptIn, {
|
|
61
|
+
preLog: (params, transaction) => `Opting in ${params.sender} to asset with ID ${params.assetId} via transaction ${transaction.txID()}`,
|
|
62
|
+
}),
|
|
63
|
+
/**
|
|
64
|
+
* Call a smart contract.
|
|
65
|
+
*
|
|
66
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
67
|
+
*/
|
|
68
|
+
appCall: this._send((c) => c.addAppCall),
|
|
69
|
+
/**
|
|
70
|
+
* Call a smart contract ABI method.
|
|
71
|
+
*
|
|
72
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
73
|
+
*/
|
|
74
|
+
methodCall: this._send((c) => c.addMethodCall),
|
|
75
|
+
/** Register an online key. */
|
|
76
|
+
onlineKeyRegistration: this._send((c) => c.addOnlineKeyRegistration, {
|
|
77
|
+
preLog: (params, transaction) => `Registering online key for ${params.sender} via transaction ${transaction.txID()}`,
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Methods for building transactions
|
|
82
|
+
*/
|
|
83
|
+
this.transactions = {
|
|
84
|
+
/** Create a payment transaction. */
|
|
85
|
+
payment: this._transaction((c) => c.addPayment),
|
|
86
|
+
/** Create an asset creation transaction. */
|
|
87
|
+
assetCreate: this._transaction((c) => c.addAssetCreate),
|
|
88
|
+
/** Create an asset config transaction. */
|
|
89
|
+
assetConfig: this._transaction((c) => c.addAssetConfig),
|
|
90
|
+
/** Create an asset freeze transaction. */
|
|
91
|
+
assetFreeze: this._transaction((c) => c.addAssetFreeze),
|
|
92
|
+
/** Create an asset destroy transaction. */
|
|
93
|
+
assetDestroy: this._transaction((c) => c.addAssetDestroy),
|
|
94
|
+
/** Create an asset transfer transaction. */
|
|
95
|
+
assetTransfer: this._transaction((c) => c.addAssetTransfer),
|
|
96
|
+
/** Create an asset opt-in transaction. */
|
|
97
|
+
assetOptIn: this._transaction((c) => c.addAssetOptIn),
|
|
98
|
+
/** Create an application call transaction. */
|
|
99
|
+
appCall: this._transaction((c) => c.addAppCall),
|
|
100
|
+
/** Create an application call with ABI method call transaction. */
|
|
101
|
+
methodCall: async (params) => {
|
|
102
|
+
return (await this.newGroup().addMethodCall(params).build()).transactions.map((ts) => ts.txn);
|
|
103
|
+
},
|
|
104
|
+
/** Create an online key registration transaction. */
|
|
105
|
+
onlineKeyRegistration: this._transaction((c) => c.addOnlineKeyRegistration),
|
|
106
|
+
};
|
|
107
|
+
this._clientManager = new ClientManager(config);
|
|
108
|
+
this._accountManager = new AccountManager(this._clientManager);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Sets the default validity window for transactions.
|
|
112
|
+
* @param validityWindow The number of rounds between the first and last valid rounds
|
|
113
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
114
|
+
*/
|
|
115
|
+
setDefaultValidityWindow(validityWindow) {
|
|
116
|
+
this._defaultValidityWindow = validityWindow;
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Sets the default signer to use if no other signer is specified.
|
|
121
|
+
* @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
|
|
122
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
123
|
+
*/
|
|
124
|
+
setDefaultSigner(signer) {
|
|
125
|
+
this._accountManager.setDefaultSigner(signer);
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Tracks the given account for later signing.
|
|
130
|
+
* @param account The account to register
|
|
131
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
132
|
+
*/
|
|
133
|
+
setSignerFromAccount(account) {
|
|
134
|
+
this._accountManager.setSignerFromAccount(account);
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Tracks the given account for later signing.
|
|
139
|
+
* @param sender The sender address to use this signer for
|
|
140
|
+
* @param signer The signer to sign transactions with for the given sender
|
|
141
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
142
|
+
*/
|
|
143
|
+
setSigner(sender, signer) {
|
|
144
|
+
this._accountManager.setSigner(sender, signer);
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Sets a cache value to use for suggested params.
|
|
149
|
+
* @param suggestedParams The suggested params to use
|
|
150
|
+
* @param until A date until which to cache, or if not specified then the timeout is used
|
|
151
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
152
|
+
*/
|
|
153
|
+
setSuggestedParams(suggestedParams, until) {
|
|
154
|
+
this._cachedSuggestedParams = suggestedParams;
|
|
155
|
+
this._cachedSuggestedParamsExpiry = until ?? new Date(+new Date() + this._cachedSuggestedParamsTimeout);
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Sets the timeout for caching suggested params.
|
|
160
|
+
* @param timeout The timeout in milliseconds
|
|
161
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
162
|
+
*/
|
|
163
|
+
setSuggestedParamsTimeout(timeout) {
|
|
164
|
+
this._cachedSuggestedParamsTimeout = timeout;
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
/** Get suggested params for a transaction (either cached or from algod if the cache is stale or empty) */
|
|
168
|
+
async getSuggestedParams() {
|
|
169
|
+
if (this._cachedSuggestedParams && (!this._cachedSuggestedParamsExpiry || this._cachedSuggestedParamsExpiry > new Date())) {
|
|
170
|
+
return {
|
|
171
|
+
...this._cachedSuggestedParams,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
this._cachedSuggestedParams = await this._clientManager.algod.getTransactionParams().do();
|
|
175
|
+
this._cachedSuggestedParamsExpiry = new Date(new Date().getTime() + this._cachedSuggestedParamsTimeout);
|
|
176
|
+
return {
|
|
177
|
+
...this._cachedSuggestedParams,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/** Get clients, including algosdk clients and app clients. */
|
|
181
|
+
get client() {
|
|
182
|
+
return this._clientManager;
|
|
183
|
+
}
|
|
184
|
+
/** Get or create accounts that can sign transactions. */
|
|
185
|
+
get account() {
|
|
186
|
+
return this._accountManager;
|
|
187
|
+
}
|
|
188
|
+
/** Start a new `AlgokitComposer` transaction group */
|
|
189
|
+
newGroup() {
|
|
190
|
+
return new AlgokitComposer({
|
|
191
|
+
algod: this.client.algod,
|
|
192
|
+
getSigner: (addr) => this.account.getSigner(addr),
|
|
193
|
+
getSuggestedParams: () => this.getSuggestedParams(),
|
|
194
|
+
defaultValidityWindow: this._defaultValidityWindow,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
_send(c, log) {
|
|
198
|
+
return async (params, config) => {
|
|
199
|
+
const composer = this.newGroup();
|
|
200
|
+
// Ensure `this` is properly populated
|
|
201
|
+
c(composer).apply(composer, [params]);
|
|
202
|
+
if (log?.preLog) {
|
|
203
|
+
const transaction = (await composer.build()).transactions.at(-1).txn;
|
|
204
|
+
Config.getLogger(config?.suppressLog).debug(log.preLog(params, transaction));
|
|
205
|
+
}
|
|
206
|
+
const rawResult = await composer.execute(config);
|
|
207
|
+
const result = {
|
|
208
|
+
// Last item covers when a group is created by an app call with ABI transaction parameters
|
|
209
|
+
transaction: rawResult.transactions[rawResult.transactions.length - 1],
|
|
210
|
+
confirmation: rawResult.confirmations[rawResult.confirmations.length - 1],
|
|
211
|
+
txId: rawResult.txIds[0],
|
|
212
|
+
...rawResult,
|
|
213
|
+
};
|
|
214
|
+
if (log?.postLog) {
|
|
215
|
+
Config.getLogger(config?.suppressLog).debug(log.postLog(params, result));
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
_transaction(c) {
|
|
221
|
+
return async (params) => {
|
|
222
|
+
const composer = this.newGroup();
|
|
223
|
+
const result = await c(composer).apply(composer, [params]).build();
|
|
224
|
+
return result.transactions.map((ts) => ts.txn)[0];
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// Static methods to create an `AlgorandClient`
|
|
228
|
+
/**
|
|
229
|
+
* Returns an `AlgorandClient` pointing at default LocalNet ports and API token.
|
|
230
|
+
* @returns The `AlgorandClient`
|
|
231
|
+
*/
|
|
232
|
+
static defaultLocalNet() {
|
|
233
|
+
return new AlgorandClient({
|
|
234
|
+
algodConfig: getDefaultLocalNetConfig('algod'),
|
|
235
|
+
indexerConfig: getDefaultLocalNetConfig('indexer'),
|
|
236
|
+
kmdConfig: getDefaultLocalNetConfig('kmd'),
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Returns an `AlgorandClient` pointing at TestNet using AlgoNode.
|
|
241
|
+
* @returns The `AlgorandClient`
|
|
242
|
+
*/
|
|
243
|
+
static testNet() {
|
|
244
|
+
return new AlgorandClient({
|
|
245
|
+
algodConfig: getAlgoNodeConfig('testnet', 'algod'),
|
|
246
|
+
indexerConfig: getAlgoNodeConfig('testnet', 'indexer'),
|
|
247
|
+
kmdConfig: undefined,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Returns an `AlgorandClient` pointing at MainNet using AlgoNode.
|
|
252
|
+
* @returns The `AlgorandClient`
|
|
253
|
+
*/
|
|
254
|
+
static mainNet() {
|
|
255
|
+
return new AlgorandClient({
|
|
256
|
+
algodConfig: getAlgoNodeConfig('mainnet', 'algod'),
|
|
257
|
+
indexerConfig: getAlgoNodeConfig('mainnet', 'indexer'),
|
|
258
|
+
kmdConfig: undefined,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Returns an `AlgorandClient` pointing to the given client(s).
|
|
263
|
+
* @param clients The clients to use
|
|
264
|
+
* @returns The `AlgorandClient`
|
|
265
|
+
*/
|
|
266
|
+
static fromClients(clients) {
|
|
267
|
+
return new AlgorandClient(clients);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Returns an `AlgorandClient` loading the configuration from environment variables.
|
|
271
|
+
*
|
|
272
|
+
* Retrieve configurations from environment variables when defined or get defaults.
|
|
273
|
+
*
|
|
274
|
+
* Expects to be called from a Node.js environment.
|
|
275
|
+
* @returns The `AlgorandClient`
|
|
276
|
+
*/
|
|
277
|
+
static fromEnvironment() {
|
|
278
|
+
return new AlgorandClient(getConfigFromEnvOrDefaults());
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Returns an `AlgorandClient` from the given config.
|
|
282
|
+
* @param config The config to use
|
|
283
|
+
* @returns The `AlgorandClient`
|
|
284
|
+
*/
|
|
285
|
+
static fromConfig(config) {
|
|
286
|
+
return new AlgorandClient(config);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export { AlgorandClient, AlgorandClient as default };
|
|
291
|
+
//# sourceMappingURL=algorand-client.mjs.map
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