@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,263 @@
|
|
|
1
|
+
import algosdk from 'algosdk';
|
|
2
|
+
import { getAccountInformation, getAccountAssetInformation, rekeyedAccount, mnemonicAccountFromEnvironment, multisigAccount, randomAccount } from '../account/account.mjs';
|
|
3
|
+
import { getDispenserAccount } from '../account/get-dispenser-account.mjs';
|
|
4
|
+
import { mnemonicAccount } from '../account/mnemonic-account.mjs';
|
|
5
|
+
import { getKmdWalletAccount } from '../localnet/get-kmd-wallet-account.mjs';
|
|
6
|
+
import { getLocalNetDispenserAccount } from '../localnet/get-localnet-dispenser-account.mjs';
|
|
7
|
+
import { getSenderAddress, getSenderTransactionSigner } from '../transaction/transaction.mjs';
|
|
8
|
+
|
|
9
|
+
var LogicSigAccount = algosdk.LogicSigAccount;
|
|
10
|
+
/** Creates and keeps track of signing accounts that can sign transactions for a sending address. */
|
|
11
|
+
class AccountManager {
|
|
12
|
+
/**
|
|
13
|
+
* Create a new account manager.
|
|
14
|
+
* @param clientManager The ClientManager client to use for algod and kmd clients
|
|
15
|
+
*/
|
|
16
|
+
constructor(clientManager) {
|
|
17
|
+
this._accounts = {};
|
|
18
|
+
this._clientManager = clientManager;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Sets the default signer to use if no other signer is specified.
|
|
22
|
+
*
|
|
23
|
+
* If this isn't set an a transaction needs signing for a given sender
|
|
24
|
+
* then an error will be thrown from `getSigner` / `getAccount`.
|
|
25
|
+
* @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
|
|
26
|
+
* @returns The `AccountManager` so method calls can be chained
|
|
27
|
+
*/
|
|
28
|
+
setDefaultSigner(signer) {
|
|
29
|
+
this._defaultSigner = 'signer' in signer ? signer.signer : signer;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Records the given account against the address of the account for later
|
|
34
|
+
* retrieval and returns a `TransactionSignerAccount`.
|
|
35
|
+
*/
|
|
36
|
+
signerAccount(account) {
|
|
37
|
+
const acc = {
|
|
38
|
+
addr: getSenderAddress(account),
|
|
39
|
+
signer: getSenderTransactionSigner(account),
|
|
40
|
+
};
|
|
41
|
+
this._accounts[acc.addr] = acc;
|
|
42
|
+
return { ...acc, account };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Tracks the given account for later signing.
|
|
46
|
+
* @param account The account to register, which can be a `TransactionSignerAccount`
|
|
47
|
+
* or any `SendTransactionFrom` compatible account object
|
|
48
|
+
* @returns The `AccountManager` instance for method chaining
|
|
49
|
+
*/
|
|
50
|
+
setSignerFromAccount(account) {
|
|
51
|
+
this.signerAccount(account);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Tracks the given account for later signing.
|
|
56
|
+
* @param sender The sender address to use this signer for
|
|
57
|
+
* @param signer The signer to sign transactions with for the given sender
|
|
58
|
+
* @returns The `AccountManager` instance for method chaining
|
|
59
|
+
*/
|
|
60
|
+
setSigner(sender, signer) {
|
|
61
|
+
this._accounts[sender] = { addr: sender, signer };
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Returns the `TransactionSigner` for the given sender address.
|
|
66
|
+
*
|
|
67
|
+
* If no signer has been registered for that address then the default signer is used if registered.
|
|
68
|
+
*
|
|
69
|
+
* @param sender The sender address
|
|
70
|
+
* @returns The `TransactionSigner` or throws an error if not found
|
|
71
|
+
*/
|
|
72
|
+
getSigner(sender) {
|
|
73
|
+
const signer = this._accounts[sender]?.signer ?? this._defaultSigner;
|
|
74
|
+
if (!signer)
|
|
75
|
+
throw new Error(`No signer found for address ${sender}`);
|
|
76
|
+
return signer;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the `TransactionSignerAccount` for the given sender address.
|
|
80
|
+
* @param sender The sender address
|
|
81
|
+
* @returns The `TransactionSignerAccount` or throws an error if not found
|
|
82
|
+
*/
|
|
83
|
+
getAccount(sender) {
|
|
84
|
+
const account = this._accounts[sender];
|
|
85
|
+
if (!account)
|
|
86
|
+
throw new Error(`No signer found for address ${sender}`);
|
|
87
|
+
return account;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns the given sender account's current status, balance and spendable amounts.
|
|
91
|
+
*
|
|
92
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
96
|
+
* const accountInfo = await accountManager.getInformation(address);
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @param sender The account / address to look up
|
|
100
|
+
* @returns The account information
|
|
101
|
+
*/
|
|
102
|
+
async getInformation(sender) {
|
|
103
|
+
return getAccountInformation(sender, this._clientManager.algod);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Returns the given sender account's asset holding for a given asset.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
|
|
111
|
+
* const assetId = 123345;
|
|
112
|
+
* const accountInfo = await accountManager.getAccountAssetInformation(address, assetId);
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)
|
|
116
|
+
* @param sender The address of the sender/account to look up
|
|
117
|
+
* @param assetId The ID of the asset to return a holding for
|
|
118
|
+
* @returns The account asset holding information
|
|
119
|
+
*/
|
|
120
|
+
async getAssetInformation(sender, assetId) {
|
|
121
|
+
return getAccountAssetInformation(sender, assetId, this._clientManager.algod);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Tracks and returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const account = await account.fromMnemonic("mnemonic secret ...")
|
|
129
|
+
* const rekeyedAccount = await account.fromMnemonic("mnemonic secret ...", "SENDERADDRESS...")
|
|
130
|
+
* ```
|
|
131
|
+
* @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
|
|
132
|
+
* never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
|
|
133
|
+
* @param sender The optional sender address to use this signer for (aka a rekeyed account)
|
|
134
|
+
* @returns The account
|
|
135
|
+
*/
|
|
136
|
+
fromMnemonic(mnemonicSecret, sender) {
|
|
137
|
+
const account = mnemonicAccount(mnemonicSecret);
|
|
138
|
+
return this.signerAccount(sender ? rekeyedAccount(account, sender) : account);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Tracks and returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
142
|
+
*
|
|
143
|
+
* Note: This function expects to run in a Node.js environment.
|
|
144
|
+
*
|
|
145
|
+
* ## Convention:
|
|
146
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
147
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
148
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
149
|
+
* * **LocalNet:** will load the account from a KMD wallet called \{NAME\} and if that wallet doesn't exist it will create it and fund the account for you
|
|
150
|
+
*
|
|
151
|
+
* This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).
|
|
152
|
+
*
|
|
153
|
+
* @example Default
|
|
154
|
+
*
|
|
155
|
+
* If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const account = await account.fromEnvironment('MY_ACCOUNT', algod)
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGOs from the default LocalNet dispenser.
|
|
161
|
+
* If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.
|
|
162
|
+
*
|
|
163
|
+
* @param name The name identifier of the account
|
|
164
|
+
* @param fundWith The optional amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 Algos will be funded from the dispenser account
|
|
165
|
+
* @returns The account
|
|
166
|
+
*/
|
|
167
|
+
async fromEnvironment(name, fundWith) {
|
|
168
|
+
this.signerAccount(await mnemonicAccountFromEnvironment({ name, fundWith }, this._clientManager.algod, this._clientManager.kmd));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Tracks and returns an Algorand account with private key loaded from the given KMD wallet (identified by name).
|
|
172
|
+
*
|
|
173
|
+
* @param name The name of the wallet to retrieve an account from
|
|
174
|
+
* @param predicate An optional filter to use to find the account (otherwise it will return a random account from the wallet)
|
|
175
|
+
* @param sender The optional sender address to use this signer for (aka a rekeyed account)
|
|
176
|
+
* @example Get default funded account in a LocalNet
|
|
177
|
+
*
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const defaultDispenserAccount = await account.fromKmd('unencrypted-default-wallet',
|
|
180
|
+
* a => a.status !== 'Offline' && a.amount > 1_000_000_000
|
|
181
|
+
* )
|
|
182
|
+
* ```
|
|
183
|
+
* @returns The account
|
|
184
|
+
*/
|
|
185
|
+
async fromKmd(name,
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
187
|
+
predicate, sender) {
|
|
188
|
+
const account = await getKmdWalletAccount({ name, predicate }, this._clientManager.algod, this._clientManager.kmd);
|
|
189
|
+
if (!account)
|
|
190
|
+
throw new Error(`Unable to find KMD account ${name}${predicate ? ' with predicate' : ''}`);
|
|
191
|
+
return this.signerAccount(sender ? rekeyedAccount(account, sender) : account);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Tracks and returns an account that supports partial or full multisig signing.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const account = await account.multisig({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]},
|
|
199
|
+
* await account.fromEnvironment('ACCOUNT1'))
|
|
200
|
+
* ```
|
|
201
|
+
* @param multisigParams The parameters that define the multisig account
|
|
202
|
+
* @param signingAccounts The signers that are currently present
|
|
203
|
+
* @returns A multisig account wrapper
|
|
204
|
+
*/
|
|
205
|
+
multisig(multisigParams, signingAccounts) {
|
|
206
|
+
return this.signerAccount(multisigAccount(multisigParams, signingAccounts));
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Tracks and returns an account that represents a logic signature.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const account = await account.logicsig(program, [new Uint8Array(3, ...)])
|
|
214
|
+
* ```
|
|
215
|
+
* @param program The bytes that make up the compiled logic signature
|
|
216
|
+
* @param args The (binary) arguments to pass into the logic signature
|
|
217
|
+
* @returns A logic signature account wrapper
|
|
218
|
+
*/
|
|
219
|
+
logicsig(program, args) {
|
|
220
|
+
this.signerAccount(new LogicSigAccount(program, args));
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Tracks and returns a new, random Algorand account with secret key loaded.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const account = await account.random()
|
|
228
|
+
* ```
|
|
229
|
+
* @returns The account
|
|
230
|
+
*/
|
|
231
|
+
random() {
|
|
232
|
+
this.signerAccount(randomAccount());
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Returns an account (with private key loaded) that can act as a dispenser.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const account = await account.dispenser()
|
|
240
|
+
* ```
|
|
241
|
+
* If running on LocalNet then it will return the default dispenser account automatically,
|
|
242
|
+
* otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC.
|
|
243
|
+
* @returns The account
|
|
244
|
+
*/
|
|
245
|
+
async dispenser() {
|
|
246
|
+
this.signerAccount(await getDispenserAccount(this._clientManager.algod, this._clientManager.kmd));
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* const account = await account.localNetDispenser()
|
|
254
|
+
* ```
|
|
255
|
+
* @returns The account
|
|
256
|
+
*/
|
|
257
|
+
async localNetDispenser() {
|
|
258
|
+
this.signerAccount(await getLocalNetDispenserAccount(this._clientManager.algod, this._clientManager.kmd));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export { AccountManager };
|
|
263
|
+
//# sourceMappingURL=account-manager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-manager.mjs","sources":["../../src/types/account-manager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAkBA,IAAO,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;AAEh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,2BAA2B,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAA;KAC1G;AACF;;;;"}
|
package/types/account.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
|
+
import AccountInformationModel = algosdk.modelsv2.Account;
|
|
2
3
|
import Account = algosdk.Account;
|
|
3
4
|
import MultisigMetadata = algosdk.MultisigMetadata;
|
|
4
5
|
import Transaction = algosdk.Transaction;
|
|
@@ -67,4 +68,22 @@ export interface AccountConfig {
|
|
|
67
68
|
/** @deprecated Renamed to senderAddress in 2.3.1 */
|
|
68
69
|
senderMnemonic?: string;
|
|
69
70
|
}
|
|
71
|
+
type NumberConverter<T extends AccountInformationModel> = {
|
|
72
|
+
[key in keyof T]: ToNumberIfExtends<T[key], number | bigint>;
|
|
73
|
+
};
|
|
74
|
+
type ToNumberIfExtends<K, E> = K extends E ? number : K;
|
|
75
|
+
/** Account information at a given round. */
|
|
76
|
+
export type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>;
|
|
77
|
+
/** Account asset holding information at a given round. */
|
|
78
|
+
export type AccountAssetInformation = {
|
|
79
|
+
/** The ID of the asset held. */
|
|
80
|
+
assetId: bigint;
|
|
81
|
+
/** The current balance of that asset holding. */
|
|
82
|
+
balance: bigint;
|
|
83
|
+
/** Whether or not the asset is frozen for the account. */
|
|
84
|
+
frozen: boolean;
|
|
85
|
+
/** The round as at which the holding was correct. */
|
|
86
|
+
round: bigint;
|
|
87
|
+
};
|
|
88
|
+
export {};
|
|
70
89
|
//# sourceMappingURL=account.d.ts.map
|
package/types/account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,OAAO,GAAG,O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SAAS,uBAAuB,IAAI;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAAE,CAAA;AAC1H,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,CAAC,CAAA;AACvD,4CAA4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,CAAC,uBAAuB,CAAC,EAAE,sBAAsB,CAAC,CAAA;AAEvG,0DAA0D;AAC1D,MAAM,MAAM,uBAAuB,GAAG;IACpC,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAA;IACf,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAA;IACf,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
|
package/types/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sources":["../../src/types/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"account.js","sources":["../../src/types/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA;;AAEG;AACI,MAAM,iBAAiB,GAAG,YAAW;AAE5C;MACa,eAAe,CAAA;;AAO1B,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;;AAGD,IAAA,IAAI,eAAe,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;KAC7B;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;KAClB;AAED,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;IAED,WAAY,CAAA,cAAgC,EAAE,eAA6C,EAAA;AACzF,QAAA,IAAI,CAAC,OAAO,GAAG,cAAc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IAAI,CAAC,QAAQ,CAAC,EAAE;SACrB,CAAA;KACF;IAED,WAAY,CAAA,OAAgB,EAAE,MAA0B,EAAA;AACtD,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;KAClE;AACF;;;;;;"}
|
package/types/account.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.mjs","sources":["../../src/types/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"account.mjs","sources":["../../src/types/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAOA;;AAEG;AACI,MAAM,iBAAiB,GAAG,YAAW;AAE5C;MACa,eAAe,CAAA;;AAO1B,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;;AAGD,IAAA,IAAI,eAAe,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;KAC7B;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;KAClB;AAED,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;IAED,WAAY,CAAA,cAAgC,EAAE,eAA6C,EAAA;AACzF,QAAA,IAAI,CAAC,OAAO,GAAG,cAAc,CAAA;AAC7B,QAAA,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAA;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,oCAAoC,CACzD,cAAc,EACd,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CACjC,CAAA;KACF;AA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ClE;AACF;;;;"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import algosdk from 'algosdk';
|
|
2
|
+
import { TransactionSignerAccount } from './account';
|
|
3
|
+
import { AccountManager } from './account-manager';
|
|
4
|
+
import { AlgoSdkClients, ClientManager } from './client-manager';
|
|
5
|
+
import AlgokitComposer, { ExecuteParams, MethodCallParams } from './composer';
|
|
6
|
+
import { AlgoConfig } from './network-client';
|
|
7
|
+
import { ConfirmedTransactionResult, SendAtomicTransactionComposerResults, SendTransactionFrom } from './transaction';
|
|
8
|
+
import Transaction = algosdk.Transaction;
|
|
9
|
+
/** Result from sending a single transaction. */
|
|
10
|
+
export type SendSingleTransactionResult = SendAtomicTransactionComposerResults & ConfirmedTransactionResult;
|
|
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
|
+
export declare class AlgorandClient {
|
|
18
|
+
private _clientManager;
|
|
19
|
+
private _accountManager;
|
|
20
|
+
private _cachedSuggestedParams?;
|
|
21
|
+
private _cachedSuggestedParamsExpiry?;
|
|
22
|
+
private _cachedSuggestedParamsTimeout;
|
|
23
|
+
private _defaultValidityWindow;
|
|
24
|
+
private constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Sets the default validity window for transactions.
|
|
27
|
+
* @param validityWindow The number of rounds between the first and last valid rounds
|
|
28
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
29
|
+
*/
|
|
30
|
+
setDefaultValidityWindow(validityWindow: number): this;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the default signer to use if no other signer is specified.
|
|
33
|
+
* @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
|
|
34
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
35
|
+
*/
|
|
36
|
+
setDefaultSigner(signer: algosdk.TransactionSigner | TransactionSignerAccount): AlgorandClient;
|
|
37
|
+
/**
|
|
38
|
+
* Tracks the given account for later signing.
|
|
39
|
+
* @param account The account to register
|
|
40
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
41
|
+
*/
|
|
42
|
+
setSignerFromAccount(account: TransactionSignerAccount | SendTransactionFrom): this;
|
|
43
|
+
/**
|
|
44
|
+
* Tracks the given account for later signing.
|
|
45
|
+
* @param sender The sender address to use this signer for
|
|
46
|
+
* @param signer The signer to sign transactions with for the given sender
|
|
47
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
48
|
+
*/
|
|
49
|
+
setSigner(sender: string, signer: algosdk.TransactionSigner): this;
|
|
50
|
+
/**
|
|
51
|
+
* Sets a cache value to use for suggested params.
|
|
52
|
+
* @param suggestedParams The suggested params to use
|
|
53
|
+
* @param until A date until which to cache, or if not specified then the timeout is used
|
|
54
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
55
|
+
*/
|
|
56
|
+
setSuggestedParams(suggestedParams: algosdk.SuggestedParams, until?: Date): this;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the timeout for caching suggested params.
|
|
59
|
+
* @param timeout The timeout in milliseconds
|
|
60
|
+
* @returns The `AlgorandClient` so method calls can be chained
|
|
61
|
+
*/
|
|
62
|
+
setSuggestedParamsTimeout(timeout: number): this;
|
|
63
|
+
/** Get suggested params for a transaction (either cached or from algod if the cache is stale or empty) */
|
|
64
|
+
getSuggestedParams(): Promise<algosdk.SuggestedParams>;
|
|
65
|
+
/** Get clients, including algosdk clients and app clients. */
|
|
66
|
+
get client(): ClientManager;
|
|
67
|
+
/** Get or create accounts that can sign transactions. */
|
|
68
|
+
get account(): AccountManager;
|
|
69
|
+
/** Start a new `AlgokitComposer` transaction group */
|
|
70
|
+
newGroup(): AlgokitComposer;
|
|
71
|
+
private _send;
|
|
72
|
+
/**
|
|
73
|
+
* Methods for sending a single transaction.
|
|
74
|
+
*/
|
|
75
|
+
send: {
|
|
76
|
+
/**
|
|
77
|
+
* Send a payment transaction.
|
|
78
|
+
*/
|
|
79
|
+
payment: (params: import("./composer").PaymentParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Create an asset.
|
|
82
|
+
*/
|
|
83
|
+
assetCreate: (params: import("./composer").AssetCreateParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Configure an existing asset.
|
|
86
|
+
*/
|
|
87
|
+
assetConfig: (params: import("./composer").AssetConfigParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Freeze or unfreeze an asset.
|
|
90
|
+
*/
|
|
91
|
+
assetFreeze: (params: import("./composer").AssetFreezeParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Destroy an asset.
|
|
94
|
+
*/
|
|
95
|
+
assetDestroy: (params: import("./composer").AssetDestroyParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Transfer an asset.
|
|
98
|
+
*/
|
|
99
|
+
assetTransfer: (params: import("./composer").AssetTransferParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Opt an account into an asset.
|
|
102
|
+
*/
|
|
103
|
+
assetOptIn: (params: import("./composer").AssetOptInParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Call a smart contract.
|
|
106
|
+
*
|
|
107
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
108
|
+
*/
|
|
109
|
+
appCall: (params: import("./composer").AppCallParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Call a smart contract ABI method.
|
|
112
|
+
*
|
|
113
|
+
* Note: you may prefer to use `algorandClient.client` to get an app client for more advanced functionality.
|
|
114
|
+
*/
|
|
115
|
+
methodCall: (params: MethodCallParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
116
|
+
/** Register an online key. */
|
|
117
|
+
onlineKeyRegistration: (params: import("./composer").OnlineKeyRegistrationParams, config?: ExecuteParams) => Promise<SendSingleTransactionResult>;
|
|
118
|
+
};
|
|
119
|
+
private _transaction;
|
|
120
|
+
/**
|
|
121
|
+
* Methods for building transactions
|
|
122
|
+
*/
|
|
123
|
+
transactions: {
|
|
124
|
+
/** Create a payment transaction. */
|
|
125
|
+
payment: (params: import("./composer").PaymentParams) => Promise<Transaction>;
|
|
126
|
+
/** Create an asset creation transaction. */
|
|
127
|
+
assetCreate: (params: import("./composer").AssetCreateParams) => Promise<Transaction>;
|
|
128
|
+
/** Create an asset config transaction. */
|
|
129
|
+
assetConfig: (params: import("./composer").AssetConfigParams) => Promise<Transaction>;
|
|
130
|
+
/** Create an asset freeze transaction. */
|
|
131
|
+
assetFreeze: (params: import("./composer").AssetFreezeParams) => Promise<Transaction>;
|
|
132
|
+
/** Create an asset destroy transaction. */
|
|
133
|
+
assetDestroy: (params: import("./composer").AssetDestroyParams) => Promise<Transaction>;
|
|
134
|
+
/** Create an asset transfer transaction. */
|
|
135
|
+
assetTransfer: (params: import("./composer").AssetTransferParams) => Promise<Transaction>;
|
|
136
|
+
/** Create an asset opt-in transaction. */
|
|
137
|
+
assetOptIn: (params: import("./composer").AssetOptInParams) => Promise<Transaction>;
|
|
138
|
+
/** Create an application call transaction. */
|
|
139
|
+
appCall: (params: import("./composer").AppCallParams) => Promise<Transaction>;
|
|
140
|
+
/** Create an application call with ABI method call transaction. */
|
|
141
|
+
methodCall: (params: MethodCallParams) => Promise<algosdk.Transaction[]>;
|
|
142
|
+
/** Create an online key registration transaction. */
|
|
143
|
+
onlineKeyRegistration: (params: import("./composer").OnlineKeyRegistrationParams) => Promise<Transaction>;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Returns an `AlgorandClient` pointing at default LocalNet ports and API token.
|
|
147
|
+
* @returns The `AlgorandClient`
|
|
148
|
+
*/
|
|
149
|
+
static defaultLocalNet(): AlgorandClient;
|
|
150
|
+
/**
|
|
151
|
+
* Returns an `AlgorandClient` pointing at TestNet using AlgoNode.
|
|
152
|
+
* @returns The `AlgorandClient`
|
|
153
|
+
*/
|
|
154
|
+
static testNet(): AlgorandClient;
|
|
155
|
+
/**
|
|
156
|
+
* Returns an `AlgorandClient` pointing at MainNet using AlgoNode.
|
|
157
|
+
* @returns The `AlgorandClient`
|
|
158
|
+
*/
|
|
159
|
+
static mainNet(): AlgorandClient;
|
|
160
|
+
/**
|
|
161
|
+
* Returns an `AlgorandClient` pointing to the given client(s).
|
|
162
|
+
* @param clients The clients to use
|
|
163
|
+
* @returns The `AlgorandClient`
|
|
164
|
+
*/
|
|
165
|
+
static fromClients(clients: AlgoSdkClients): AlgorandClient;
|
|
166
|
+
/**
|
|
167
|
+
* Returns an `AlgorandClient` loading the configuration from environment variables.
|
|
168
|
+
*
|
|
169
|
+
* Retrieve configurations from environment variables when defined or get defaults.
|
|
170
|
+
*
|
|
171
|
+
* Expects to be called from a Node.js environment.
|
|
172
|
+
* @returns The `AlgorandClient`
|
|
173
|
+
*/
|
|
174
|
+
static fromEnvironment(): AlgorandClient;
|
|
175
|
+
/**
|
|
176
|
+
* Returns an `AlgorandClient` from the given config.
|
|
177
|
+
* @param config The config to use
|
|
178
|
+
* @returns The `AlgorandClient`
|
|
179
|
+
*/
|
|
180
|
+
static fromConfig(config: AlgoConfig): AlgorandClient;
|
|
181
|
+
}
|
|
182
|
+
export default AlgorandClient;
|
|
183
|
+
//# sourceMappingURL=algorand-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algorand-client.d.ts","sourceRoot":"","sources":["../../src/types/algorand-client.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACpD,OAAO,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