@algorandfoundation/algokit-utils 6.0.5 → 6.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/account/account.d.ts +24 -3
- package/account/account.d.ts.map +1 -1
- package/account/account.js +29 -53
- package/account/account.js.map +1 -1
- package/account/account.mjs +29 -53
- package/account/account.mjs.map +1 -1
- package/account/get-account.d.ts +2 -2
- package/account/get-account.d.ts.map +1 -1
- package/account/get-account.js +9 -29
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs +4 -24
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.d.ts +7 -2
- package/account/get-dispenser-account.d.ts.map +1 -1
- package/account/get-dispenser-account.js +7 -8
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs +7 -8
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/mnemonic-account.d.ts +4 -1
- package/account/mnemonic-account.d.ts.map +1 -1
- package/account/mnemonic-account.js +4 -1
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs +4 -1
- package/account/mnemonic-account.mjs.map +1 -1
- package/dispenser-client.d.ts +2 -0
- package/dispenser-client.d.ts.map +1 -1
- package/dispenser-client.js +2 -0
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs +2 -0
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +7 -7
- package/index.d.ts.map +1 -1
- package/index.js +31 -31
- package/index.mjs +9 -9
- package/localnet/get-kmd-wallet-account.d.ts +2 -0
- package/localnet/get-kmd-wallet-account.d.ts.map +1 -1
- package/localnet/get-kmd-wallet-account.js +5 -30
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs +5 -30
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.d.ts +2 -0
- package/localnet/get-localnet-dispenser-account.d.ts.map +1 -1
- package/localnet/get-localnet-dispenser-account.js +5 -7
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs +5 -7
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts +2 -0
- package/localnet/get-or-create-kmd-wallet-account.d.ts.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js +5 -27
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs +5 -27
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/is-localnet.d.ts +4 -1
- package/localnet/is-localnet.d.ts.map +1 -1
- package/localnet/is-localnet.js +7 -3
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs +7 -3
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.d.ts +36 -8
- package/network-client.d.ts.map +1 -1
- package/network-client.js +49 -88
- package/network-client.js.map +1 -1
- package/network-client.mjs +49 -88
- package/network-client.mjs.map +1 -1
- package/package.json +3 -2
- package/testing/account.d.ts +3 -5
- package/testing/account.d.ts.map +1 -1
- package/testing/account.js +6 -9
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +6 -9
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +20 -2
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
- package/testing/fixtures/algorand-fixture.js +11 -30
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +11 -30
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/transaction/transaction.d.ts.map +1 -1
- package/transaction/transaction.js +22 -9
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +22 -9
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer.js +4 -4
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +4 -4
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +108 -24
- package/types/account-manager.d.ts.map +1 -1
- package/types/account-manager.js +167 -34
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +166 -34
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +13 -11
- package/types/account.d.ts.map +1 -1
- package/types/algorand-client.d.ts +12 -6
- package/types/algorand-client.d.ts.map +1 -1
- package/types/algorand-client.js +20 -15
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +20 -15
- package/types/algorand-client.mjs.map +1 -1
- package/types/client-manager.d.ts +197 -4
- package/types/client-manager.d.ts.map +1 -1
- package/types/client-manager.js +284 -7
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +284 -7
- package/types/client-manager.mjs.map +1 -1
- package/types/kmd-account-manager.d.ts +70 -0
- package/types/kmd-account-manager.d.ts.map +1 -0
- package/types/kmd-account-manager.js +144 -0
- package/types/kmd-account-manager.js.map +1 -0
- package/types/kmd-account-manager.mjs +142 -0
- package/types/kmd-account-manager.mjs.map +1 -0
- package/types/network-client.d.ts +2 -2
- package/types/network-client.d.ts.map +1 -1
- package/types/testing.d.ts +9 -6
- package/types/testing.d.ts.map +1 -1
|
@@ -1,58 +1,114 @@
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
|
-
import { AccountInformation, SigningAccount, TransactionSignerAccount } from './account';
|
|
2
|
+
import { AccountInformation, MultisigAccount, SigningAccount, TransactionSignerAccount } from './account';
|
|
3
3
|
import { AlgoAmount } from './amount';
|
|
4
4
|
import { ClientManager } from './client-manager';
|
|
5
|
-
import {
|
|
5
|
+
import { KmdAccountManager } from './kmd-account-manager';
|
|
6
|
+
import LogicSigAccount = algosdk.LogicSigAccount;
|
|
7
|
+
import Account = algosdk.Account;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a `TransactionSigner` for the given account that can sign a transaction.
|
|
10
|
+
* This function has memoization, so will return the same transaction signer for a given account.
|
|
11
|
+
* @param account An account that can sign a transaction
|
|
12
|
+
* @returns A transaction signer
|
|
13
|
+
*/
|
|
14
|
+
export declare const getAccountTransactionSigner: (val: MultisigAccount | algosdk.Account | SigningAccount | TransactionSignerAccount | algosdk.LogicSigAccount) => algosdk.TransactionSigner;
|
|
6
15
|
/** Creates and keeps track of signing accounts that can sign transactions for a sending address. */
|
|
7
16
|
export declare class AccountManager {
|
|
8
17
|
private _clientManager;
|
|
18
|
+
private _kmdAccountManager;
|
|
9
19
|
private _accounts;
|
|
10
20
|
private _defaultSigner?;
|
|
11
21
|
/**
|
|
12
22
|
* Create a new account manager.
|
|
13
23
|
* @param clientManager The ClientManager client to use for algod and kmd clients
|
|
24
|
+
* @example Create a new account manager
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const accountManager = new AccountManager(clientManager)
|
|
27
|
+
* ```
|
|
14
28
|
*/
|
|
15
29
|
constructor(clientManager: ClientManager);
|
|
30
|
+
/** KMD account manager that allows you to easily get and create accounts using KMD. */
|
|
31
|
+
get kmd(): KmdAccountManager;
|
|
16
32
|
/**
|
|
17
33
|
* Sets the default signer to use if no other signer is specified.
|
|
18
34
|
*
|
|
19
35
|
* If this isn't set an a transaction needs signing for a given sender
|
|
20
36
|
* then an error will be thrown from `getSigner` / `getAccount`.
|
|
21
37
|
* @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const signer = accountManager.random() // Can be anything that returns a `algosdk.TransactionSigner` or `TransactionSignerAccount`
|
|
41
|
+
* accountManager.setDefaultSigner(signer)
|
|
42
|
+
*
|
|
43
|
+
* // When signing a transaction, if there is no signer registered for the sender then the default signer will be used
|
|
44
|
+
* const signer = accountManager.getSigner("{SENDERADDRESS}")
|
|
45
|
+
* ```
|
|
22
46
|
* @returns The `AccountManager` so method calls can be chained
|
|
23
47
|
*/
|
|
24
48
|
setDefaultSigner(signer: algosdk.TransactionSigner | TransactionSignerAccount): AccountManager;
|
|
25
49
|
/**
|
|
26
|
-
* Records the given account against the address of the account for later
|
|
27
|
-
* retrieval and returns a `TransactionSignerAccount
|
|
50
|
+
* Records the given account (that can sign) against the address of the provided account for later
|
|
51
|
+
* retrieval and returns a `TransactionSignerAccount` along with the original account in an `account` property.
|
|
28
52
|
*/
|
|
29
53
|
private signerAccount;
|
|
30
54
|
/**
|
|
31
55
|
* Tracks the given account for later signing.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
56
|
+
*
|
|
57
|
+
* Note: If you are generating accounts via the various methods on `AccountManager`
|
|
58
|
+
* (like `random`, `fromMnemonic`, `logicsig`, etc.) then they automatically get tracked.
|
|
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 = new AccountManager(clientManager)
|
|
64
|
+
* .setSignerFromAccount(algosdk.generateAccount())
|
|
65
|
+
* .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
|
|
66
|
+
* .setSignerFromAccount(new SigningAccount(mnemonic, sender))
|
|
67
|
+
* .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
|
|
68
|
+
* .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
|
|
69
|
+
* ```
|
|
34
70
|
* @returns The `AccountManager` instance for method chaining
|
|
35
71
|
*/
|
|
36
|
-
setSignerFromAccount(account: TransactionSignerAccount |
|
|
72
|
+
setSignerFromAccount(account: TransactionSignerAccount | Account | LogicSigAccount | SigningAccount | MultisigAccount): this;
|
|
37
73
|
/**
|
|
38
|
-
* Tracks the given
|
|
74
|
+
* Tracks the given `algosdk.TransactionSigner` against the given sender address for later signing.
|
|
39
75
|
* @param sender The sender address to use this signer for
|
|
40
|
-
* @param signer The
|
|
76
|
+
* @param signer The `algosdk.TransactionSigner` to sign transactions with for the given sender
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const accountManager = new AccountManager(clientManager)
|
|
80
|
+
* .setSigner("SENDERADDRESS", transactionSigner)
|
|
81
|
+
* ```
|
|
41
82
|
* @returns The `AccountManager` instance for method chaining
|
|
42
83
|
*/
|
|
43
84
|
setSigner(sender: string, signer: algosdk.TransactionSigner): this;
|
|
44
85
|
/**
|
|
45
|
-
* Returns the `TransactionSigner` for the given sender address.
|
|
86
|
+
* Returns the `TransactionSigner` for the given sender address, ready to sign a transaction for that sender.
|
|
46
87
|
*
|
|
47
|
-
* If no signer has been registered for that address then the default signer is used if registered
|
|
88
|
+
* If no signer has been registered for that address then the default signer is used if registered and
|
|
89
|
+
* if not then an error is thrown.
|
|
48
90
|
*
|
|
49
91
|
* @param sender The sender address
|
|
50
|
-
* @
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const signer = accountManager.getSigner("SENDERADDRESS")
|
|
95
|
+
* ```
|
|
96
|
+
* @returns The `TransactionSigner` or throws an error if not found and no default signer is set
|
|
51
97
|
*/
|
|
52
98
|
getSigner(sender: string): algosdk.TransactionSigner;
|
|
53
99
|
/**
|
|
54
100
|
* Returns the `TransactionSignerAccount` for the given sender address.
|
|
101
|
+
*
|
|
102
|
+
* If no signer has been registered for that address then an error is thrown.
|
|
55
103
|
* @param sender The sender address
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const account = accountManager.random()
|
|
107
|
+
* const sender = account.addr
|
|
108
|
+
* // ...
|
|
109
|
+
* // Returns the `TransactionSignerAccount` for `sender` that has previously been registered
|
|
110
|
+
* const account = accountManager.getAccount(sender)
|
|
111
|
+
* ```
|
|
56
112
|
* @returns The `TransactionSignerAccount` or throws an error if not found
|
|
57
113
|
*/
|
|
58
114
|
getAccount(sender: string): TransactionSignerAccount;
|
|
@@ -85,7 +141,12 @@ export declare class AccountManager {
|
|
|
85
141
|
* @param assetId The ID of the asset to return a holding for
|
|
86
142
|
* @returns The account asset holding information
|
|
87
143
|
*/
|
|
88
|
-
getAssetInformation(sender: string | TransactionSignerAccount, assetId: number | bigint): Promise<
|
|
144
|
+
getAssetInformation(sender: string | TransactionSignerAccount, assetId: number | bigint): Promise<{
|
|
145
|
+
assetId: bigint;
|
|
146
|
+
balance: bigint;
|
|
147
|
+
frozen: boolean;
|
|
148
|
+
round: bigint;
|
|
149
|
+
}>;
|
|
89
150
|
/**
|
|
90
151
|
* Tracks and returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
91
152
|
*
|
|
@@ -100,7 +161,25 @@ export declare class AccountManager {
|
|
|
100
161
|
* @returns The account
|
|
101
162
|
*/
|
|
102
163
|
fromMnemonic(mnemonicSecret: string, sender?: string): TransactionSignerAccount & {
|
|
103
|
-
account:
|
|
164
|
+
account: SigningAccount;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Tracks and returns an Algorand account that is a rekeyed version of the given account to a new sender.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* const account = await account.fromMnemonic("mnemonic secret ...")
|
|
172
|
+
* const rekeyedAccount = await account.rekeyed(account, "SENDERADDRESS...")
|
|
173
|
+
* ```
|
|
174
|
+
* @param account The account to use as the signer for this new rekeyed account
|
|
175
|
+
* @param sender The sender address to use as the new sender
|
|
176
|
+
* @returns The account
|
|
177
|
+
*/
|
|
178
|
+
rekeyed(account: TransactionSignerAccount, sender: string): TransactionSignerAccount & {
|
|
179
|
+
account: {
|
|
180
|
+
addr: string;
|
|
181
|
+
signer: algosdk.TransactionSigner;
|
|
182
|
+
};
|
|
104
183
|
};
|
|
105
184
|
/**
|
|
106
185
|
* Tracks and returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
@@ -130,7 +209,7 @@ export declare class AccountManager {
|
|
|
130
209
|
* @returns The account
|
|
131
210
|
*/
|
|
132
211
|
fromEnvironment(name: string, fundWith?: AlgoAmount): Promise<TransactionSignerAccount & {
|
|
133
|
-
account:
|
|
212
|
+
account: SigningAccount;
|
|
134
213
|
}>;
|
|
135
214
|
/**
|
|
136
215
|
* Tracks and returns an Algorand account with private key loaded from the given KMD wallet (identified by name).
|
|
@@ -148,7 +227,7 @@ export declare class AccountManager {
|
|
|
148
227
|
* @returns The account
|
|
149
228
|
*/
|
|
150
229
|
fromKmd(name: string, predicate?: (account: Record<string, any>) => boolean, sender?: string): Promise<TransactionSignerAccount & {
|
|
151
|
-
account:
|
|
230
|
+
account: SigningAccount;
|
|
152
231
|
}>;
|
|
153
232
|
/**
|
|
154
233
|
* Tracks and returns an account that supports partial or full multisig signing.
|
|
@@ -163,7 +242,7 @@ export declare class AccountManager {
|
|
|
163
242
|
* @returns A multisig account wrapper
|
|
164
243
|
*/
|
|
165
244
|
multisig(multisigParams: algosdk.MultisigMetadata, signingAccounts: (algosdk.Account | SigningAccount)[]): TransactionSignerAccount & {
|
|
166
|
-
account:
|
|
245
|
+
account: MultisigAccount;
|
|
167
246
|
};
|
|
168
247
|
/**
|
|
169
248
|
* Tracks and returns an account that represents a logic signature.
|
|
@@ -192,18 +271,23 @@ export declare class AccountManager {
|
|
|
192
271
|
account: algosdk.Account;
|
|
193
272
|
};
|
|
194
273
|
/**
|
|
195
|
-
* Returns an account (with private key loaded) that can act as a dispenser
|
|
274
|
+
* Returns an account (with private key loaded) that can act as a dispenser from
|
|
275
|
+
* environment variables, or against default LocalNet if no environment variables present.
|
|
276
|
+
*
|
|
277
|
+
* Note: requires a Node.js environment to execute.
|
|
278
|
+
*
|
|
279
|
+
* If present, it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC and optionally
|
|
280
|
+
* process.env.DISPENSER_SENDER if it's a rekeyed account.
|
|
196
281
|
*
|
|
197
282
|
* @example
|
|
198
283
|
* ```typescript
|
|
199
|
-
* const account = await account.
|
|
284
|
+
* const account = await account.dispenserFromEnvironment()
|
|
200
285
|
* ```
|
|
201
|
-
*
|
|
202
|
-
* otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC.
|
|
286
|
+
*
|
|
203
287
|
* @returns The account
|
|
204
288
|
*/
|
|
205
|
-
|
|
206
|
-
account:
|
|
289
|
+
dispenserFromEnvironment(): Promise<TransactionSignerAccount & {
|
|
290
|
+
account: SigningAccount;
|
|
207
291
|
}>;
|
|
208
292
|
/**
|
|
209
293
|
* Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
|
|
@@ -215,7 +299,7 @@ export declare class AccountManager {
|
|
|
215
299
|
* @returns The account
|
|
216
300
|
*/
|
|
217
301
|
localNetDispenser(): Promise<TransactionSignerAccount & {
|
|
218
|
-
account:
|
|
302
|
+
account: SigningAccount;
|
|
219
303
|
}>;
|
|
220
304
|
}
|
|
221
305
|
//# sourceMappingURL=account-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/types/account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/types/account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,kBAAkB,EAAqB,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAC5H,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;AAChD,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAahC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,6IAQtC,CAAA;AAEF,oGAAoG;AACpG,qBAAa,cAAc;IACzB,OAAO,CAAC,c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AAQ,CAAC,EAAE,UAAU;;;IAqBhE;;;;;;;;;;;;;;OAcG;IACU,OAAO,CAClB,IAAI,EAAE,MAAM,EAEZ,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,EACrD,MAAM,CAAC,EAAE,MAAM;;;IAOjB;;;;;;;;;;;OAWG;IACI,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE;;;IAI/G;;;;;;;;;;OAUG;IACI,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;;;IAI7D;;;;;;;;OAQG;IACI,MAAM;;;IAIb;;;;;;;;;;;;;;;OAeG;IACU,wBAAwB;;;IAUrC;;;;;;;;OAQG;IACU,iBAAiB;;;CAI/B"}
|
package/types/account-manager.js
CHANGED
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var algosdk = require('algosdk');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var mnemonicAccount = require('../account/mnemonic-account.js');
|
|
7
|
-
var getKmdWalletAccount = require('../localnet/get-kmd-wallet-account.js');
|
|
8
|
-
var getLocalnetDispenserAccount = require('../localnet/get-localnet-dispenser-account.js');
|
|
9
|
-
var transaction = require('../transaction/transaction.js');
|
|
4
|
+
var types_account = require('./account.js');
|
|
5
|
+
var types_kmdAccountManager = require('./kmd-account-manager.js');
|
|
10
6
|
|
|
11
7
|
var LogicSigAccount = algosdk.LogicSigAccount;
|
|
8
|
+
var AccountInformationModel = algosdk.modelsv2.Account;
|
|
9
|
+
const memoize = (fn) => {
|
|
10
|
+
const cache = new Map();
|
|
11
|
+
const cached = function (val) {
|
|
12
|
+
return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val);
|
|
13
|
+
};
|
|
14
|
+
cached.cache = cache;
|
|
15
|
+
return cached;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Returns a `TransactionSigner` for the given account that can sign a transaction.
|
|
19
|
+
* This function has memoization, so will return the same transaction signer for a given account.
|
|
20
|
+
* @param account An account that can sign a transaction
|
|
21
|
+
* @returns A transaction signer
|
|
22
|
+
*/
|
|
23
|
+
const getAccountTransactionSigner = memoize(function (account) {
|
|
24
|
+
return 'signer' in account
|
|
25
|
+
? account.signer
|
|
26
|
+
: 'lsig' in account
|
|
27
|
+
? algosdk.makeLogicSigAccountTransactionSigner(account)
|
|
28
|
+
: algosdk.makeBasicAccountTransactionSigner(account);
|
|
29
|
+
});
|
|
12
30
|
/** Creates and keeps track of signing accounts that can sign transactions for a sending address. */
|
|
13
31
|
class AccountManager {
|
|
14
32
|
/**
|
|
15
33
|
* Create a new account manager.
|
|
16
34
|
* @param clientManager The ClientManager client to use for algod and kmd clients
|
|
35
|
+
* @example Create a new account manager
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const accountManager = new AccountManager(clientManager)
|
|
38
|
+
* ```
|
|
17
39
|
*/
|
|
18
40
|
constructor(clientManager) {
|
|
19
41
|
this._accounts = {};
|
|
20
42
|
this._clientManager = clientManager;
|
|
43
|
+
this._kmdAccountManager = new types_kmdAccountManager.KmdAccountManager(clientManager);
|
|
44
|
+
}
|
|
45
|
+
/** KMD account manager that allows you to easily get and create accounts using KMD. */
|
|
46
|
+
get kmd() {
|
|
47
|
+
return this._kmdAccountManager;
|
|
21
48
|
}
|
|
22
49
|
/**
|
|
23
50
|
* Sets the default signer to use if no other signer is specified.
|
|
@@ -25,6 +52,14 @@ class AccountManager {
|
|
|
25
52
|
* If this isn't set an a transaction needs signing for a given sender
|
|
26
53
|
* then an error will be thrown from `getSigner` / `getAccount`.
|
|
27
54
|
* @param signer The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount`
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const signer = accountManager.random() // Can be anything that returns a `algosdk.TransactionSigner` or `TransactionSignerAccount`
|
|
58
|
+
* accountManager.setDefaultSigner(signer)
|
|
59
|
+
*
|
|
60
|
+
* // When signing a transaction, if there is no signer registered for the sender then the default signer will be used
|
|
61
|
+
* const signer = accountManager.getSigner("{SENDERADDRESS}")
|
|
62
|
+
* ```
|
|
28
63
|
* @returns The `AccountManager` so method calls can be chained
|
|
29
64
|
*/
|
|
30
65
|
setDefaultSigner(signer) {
|
|
@@ -32,21 +67,33 @@ class AccountManager {
|
|
|
32
67
|
return this;
|
|
33
68
|
}
|
|
34
69
|
/**
|
|
35
|
-
* Records the given account against the address of the account for later
|
|
36
|
-
* retrieval and returns a `TransactionSignerAccount
|
|
70
|
+
* Records the given account (that can sign) against the address of the provided account for later
|
|
71
|
+
* retrieval and returns a `TransactionSignerAccount` along with the original account in an `account` property.
|
|
37
72
|
*/
|
|
38
73
|
signerAccount(account) {
|
|
39
74
|
const acc = {
|
|
40
|
-
addr:
|
|
41
|
-
signer:
|
|
75
|
+
addr: 'addr' in account ? account.addr : account.address(),
|
|
76
|
+
signer: getAccountTransactionSigner(account),
|
|
42
77
|
};
|
|
43
78
|
this._accounts[acc.addr] = acc;
|
|
44
79
|
return { ...acc, account };
|
|
45
80
|
}
|
|
46
81
|
/**
|
|
47
82
|
* Tracks the given account for later signing.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
83
|
+
*
|
|
84
|
+
* Note: If you are generating accounts via the various methods on `AccountManager`
|
|
85
|
+
* (like `random`, `fromMnemonic`, `logicsig`, etc.) then they automatically get tracked.
|
|
86
|
+
* @param account The account to register, which can be a `TransactionSignerAccount` or
|
|
87
|
+
* a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount`
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const accountManager = new AccountManager(clientManager)
|
|
91
|
+
* .setSignerFromAccount(algosdk.generateAccount())
|
|
92
|
+
* .setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
|
|
93
|
+
* .setSignerFromAccount(new SigningAccount(mnemonic, sender))
|
|
94
|
+
* .setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
|
|
95
|
+
* .setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})
|
|
96
|
+
* ```
|
|
50
97
|
* @returns The `AccountManager` instance for method chaining
|
|
51
98
|
*/
|
|
52
99
|
setSignerFromAccount(account) {
|
|
@@ -54,9 +101,14 @@ class AccountManager {
|
|
|
54
101
|
return this;
|
|
55
102
|
}
|
|
56
103
|
/**
|
|
57
|
-
* Tracks the given
|
|
104
|
+
* Tracks the given `algosdk.TransactionSigner` against the given sender address for later signing.
|
|
58
105
|
* @param sender The sender address to use this signer for
|
|
59
|
-
* @param signer The
|
|
106
|
+
* @param signer The `algosdk.TransactionSigner` to sign transactions with for the given sender
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const accountManager = new AccountManager(clientManager)
|
|
110
|
+
* .setSigner("SENDERADDRESS", transactionSigner)
|
|
111
|
+
* ```
|
|
60
112
|
* @returns The `AccountManager` instance for method chaining
|
|
61
113
|
*/
|
|
62
114
|
setSigner(sender, signer) {
|
|
@@ -64,12 +116,17 @@ class AccountManager {
|
|
|
64
116
|
return this;
|
|
65
117
|
}
|
|
66
118
|
/**
|
|
67
|
-
* Returns the `TransactionSigner` for the given sender address.
|
|
119
|
+
* Returns the `TransactionSigner` for the given sender address, ready to sign a transaction for that sender.
|
|
68
120
|
*
|
|
69
|
-
* If no signer has been registered for that address then the default signer is used if registered
|
|
121
|
+
* If no signer has been registered for that address then the default signer is used if registered and
|
|
122
|
+
* if not then an error is thrown.
|
|
70
123
|
*
|
|
71
124
|
* @param sender The sender address
|
|
72
|
-
* @
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const signer = accountManager.getSigner("SENDERADDRESS")
|
|
128
|
+
* ```
|
|
129
|
+
* @returns The `TransactionSigner` or throws an error if not found and no default signer is set
|
|
73
130
|
*/
|
|
74
131
|
getSigner(sender) {
|
|
75
132
|
const signer = this._accounts[sender]?.signer ?? this._defaultSigner;
|
|
@@ -79,7 +136,17 @@ class AccountManager {
|
|
|
79
136
|
}
|
|
80
137
|
/**
|
|
81
138
|
* Returns the `TransactionSignerAccount` for the given sender address.
|
|
139
|
+
*
|
|
140
|
+
* If no signer has been registered for that address then an error is thrown.
|
|
82
141
|
* @param sender The sender address
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* const account = accountManager.random()
|
|
145
|
+
* const sender = account.addr
|
|
146
|
+
* // ...
|
|
147
|
+
* // Returns the `TransactionSignerAccount` for `sender` that has previously been registered
|
|
148
|
+
* const account = accountManager.getAccount(sender)
|
|
149
|
+
* ```
|
|
83
150
|
* @returns The `TransactionSignerAccount` or throws an error if not found
|
|
84
151
|
*/
|
|
85
152
|
getAccount(sender) {
|
|
@@ -102,7 +169,25 @@ class AccountManager {
|
|
|
102
169
|
* @returns The account information
|
|
103
170
|
*/
|
|
104
171
|
async getInformation(sender) {
|
|
105
|
-
|
|
172
|
+
const account = AccountInformationModel.from_obj_for_encoding(await this._clientManager.algod.accountInformation(typeof sender === 'string' ? sender : sender.addr).do());
|
|
173
|
+
return {
|
|
174
|
+
...account,
|
|
175
|
+
// None of these can practically overflow 2^53
|
|
176
|
+
amount: Number(account.amount),
|
|
177
|
+
amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),
|
|
178
|
+
minBalance: Number(account.minBalance),
|
|
179
|
+
pendingRewards: Number(account.pendingRewards),
|
|
180
|
+
rewards: Number(account.rewards),
|
|
181
|
+
round: Number(account.round),
|
|
182
|
+
totalAppsOptedIn: Number(account.totalAppsOptedIn),
|
|
183
|
+
totalAssetsOptedIn: Number(account.totalAssetsOptedIn),
|
|
184
|
+
totalCreatedApps: Number(account.totalCreatedApps),
|
|
185
|
+
totalCreatedAssets: Number(account.totalCreatedAssets),
|
|
186
|
+
appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,
|
|
187
|
+
rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,
|
|
188
|
+
totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,
|
|
189
|
+
totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,
|
|
190
|
+
};
|
|
106
191
|
}
|
|
107
192
|
/**
|
|
108
193
|
* Returns the given sender account's asset holding for a given asset.
|
|
@@ -120,7 +205,15 @@ class AccountManager {
|
|
|
120
205
|
* @returns The account asset holding information
|
|
121
206
|
*/
|
|
122
207
|
async getAssetInformation(sender, assetId) {
|
|
123
|
-
|
|
208
|
+
const info = await this._clientManager.algod
|
|
209
|
+
.accountAssetInformation(typeof sender === 'string' ? sender : sender.addr, Number(assetId))
|
|
210
|
+
.do();
|
|
211
|
+
return {
|
|
212
|
+
assetId: BigInt(assetId),
|
|
213
|
+
balance: BigInt(info['asset-holding']['amount']),
|
|
214
|
+
frozen: info['asset-holding']['is-frozen'] === 'true',
|
|
215
|
+
round: BigInt(info['round']),
|
|
216
|
+
};
|
|
124
217
|
}
|
|
125
218
|
/**
|
|
126
219
|
* Tracks and returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
@@ -136,8 +229,23 @@ class AccountManager {
|
|
|
136
229
|
* @returns The account
|
|
137
230
|
*/
|
|
138
231
|
fromMnemonic(mnemonicSecret, sender) {
|
|
139
|
-
const account
|
|
140
|
-
return this.signerAccount(
|
|
232
|
+
const account = algosdk.mnemonicToSecretKey(mnemonicSecret);
|
|
233
|
+
return this.signerAccount(new types_account.SigningAccount(account, sender));
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Tracks and returns an Algorand account that is a rekeyed version of the given account to a new sender.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* const account = await account.fromMnemonic("mnemonic secret ...")
|
|
241
|
+
* const rekeyedAccount = await account.rekeyed(account, "SENDERADDRESS...")
|
|
242
|
+
* ```
|
|
243
|
+
* @param account The account to use as the signer for this new rekeyed account
|
|
244
|
+
* @param sender The sender address to use as the new sender
|
|
245
|
+
* @returns The account
|
|
246
|
+
*/
|
|
247
|
+
rekeyed(account, sender) {
|
|
248
|
+
return this.signerAccount({ addr: sender, signer: account.signer });
|
|
141
249
|
}
|
|
142
250
|
/**
|
|
143
251
|
* Tracks and returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
@@ -167,7 +275,20 @@ class AccountManager {
|
|
|
167
275
|
* @returns The account
|
|
168
276
|
*/
|
|
169
277
|
async fromEnvironment(name, fundWith) {
|
|
170
|
-
|
|
278
|
+
if (!process || !process.env) {
|
|
279
|
+
throw new Error('Attempt to get account with private key from a non Node.js context; this is not supported!');
|
|
280
|
+
}
|
|
281
|
+
const accountMnemonic = process.env[`${name.toUpperCase()}_MNEMONIC`];
|
|
282
|
+
const sender = process.env[`${name.toUpperCase()}_SENDER`];
|
|
283
|
+
if (accountMnemonic) {
|
|
284
|
+
const signer = algosdk.mnemonicToSecretKey(accountMnemonic);
|
|
285
|
+
return this.signerAccount(new types_account.SigningAccount(signer, sender));
|
|
286
|
+
}
|
|
287
|
+
if (await this._clientManager.isLocalNet()) {
|
|
288
|
+
const account = await this._kmdAccountManager.getOrCreateWalletAccount(name, fundWith);
|
|
289
|
+
return this.signerAccount(account.account);
|
|
290
|
+
}
|
|
291
|
+
throw new Error(`Missing environment variable ${name.toUpperCase()}_MNEMONIC when looking for account ${name}`);
|
|
171
292
|
}
|
|
172
293
|
/**
|
|
173
294
|
* Tracks and returns an Algorand account with private key loaded from the given KMD wallet (identified by name).
|
|
@@ -187,10 +308,10 @@ class AccountManager {
|
|
|
187
308
|
async fromKmd(name,
|
|
188
309
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
189
310
|
predicate, sender) {
|
|
190
|
-
const account
|
|
191
|
-
if (!account
|
|
311
|
+
const account = await this.kmd.getWalletAccount(name, predicate, sender);
|
|
312
|
+
if (!account)
|
|
192
313
|
throw new Error(`Unable to find KMD account ${name}${predicate ? ' with predicate' : ''}`);
|
|
193
|
-
return this.signerAccount(
|
|
314
|
+
return this.signerAccount(account.account);
|
|
194
315
|
}
|
|
195
316
|
/**
|
|
196
317
|
* Tracks and returns an account that supports partial or full multisig signing.
|
|
@@ -205,7 +326,7 @@ class AccountManager {
|
|
|
205
326
|
* @returns A multisig account wrapper
|
|
206
327
|
*/
|
|
207
328
|
multisig(multisigParams, signingAccounts) {
|
|
208
|
-
return this.signerAccount(
|
|
329
|
+
return this.signerAccount(new types_account.MultisigAccount(multisigParams, signingAccounts));
|
|
209
330
|
}
|
|
210
331
|
/**
|
|
211
332
|
* Tracks and returns an account that represents a logic signature.
|
|
@@ -231,21 +352,31 @@ class AccountManager {
|
|
|
231
352
|
* @returns The account
|
|
232
353
|
*/
|
|
233
354
|
random() {
|
|
234
|
-
return this.signerAccount(
|
|
355
|
+
return this.signerAccount(algosdk.generateAccount());
|
|
235
356
|
}
|
|
236
357
|
/**
|
|
237
|
-
* Returns an account (with private key loaded) that can act as a dispenser
|
|
358
|
+
* Returns an account (with private key loaded) that can act as a dispenser from
|
|
359
|
+
* environment variables, or against default LocalNet if no environment variables present.
|
|
360
|
+
*
|
|
361
|
+
* Note: requires a Node.js environment to execute.
|
|
362
|
+
*
|
|
363
|
+
* If present, it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC and optionally
|
|
364
|
+
* process.env.DISPENSER_SENDER if it's a rekeyed account.
|
|
238
365
|
*
|
|
239
366
|
* @example
|
|
240
367
|
* ```typescript
|
|
241
|
-
* const account = await account.
|
|
368
|
+
* const account = await account.dispenserFromEnvironment()
|
|
242
369
|
* ```
|
|
243
|
-
*
|
|
244
|
-
* otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC.
|
|
370
|
+
*
|
|
245
371
|
* @returns The account
|
|
246
372
|
*/
|
|
247
|
-
async
|
|
248
|
-
|
|
373
|
+
async dispenserFromEnvironment() {
|
|
374
|
+
if (!process || !process.env) {
|
|
375
|
+
throw new Error('Attempt to get dispenser from environment from a non Node.js context; this is not supported!');
|
|
376
|
+
}
|
|
377
|
+
return process.env[`${types_account.DISPENSER_ACCOUNT.toUpperCase()}_MNEMONIC`]
|
|
378
|
+
? await this.fromEnvironment(types_account.DISPENSER_ACCOUNT)
|
|
379
|
+
: await this.localNetDispenser();
|
|
249
380
|
}
|
|
250
381
|
/**
|
|
251
382
|
* Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
|
|
@@ -257,9 +388,11 @@ class AccountManager {
|
|
|
257
388
|
* @returns The account
|
|
258
389
|
*/
|
|
259
390
|
async localNetDispenser() {
|
|
260
|
-
|
|
391
|
+
const dispenser = await this._kmdAccountManager.getLocalNetDispenserAccount();
|
|
392
|
+
return this.signerAccount(dispenser.account);
|
|
261
393
|
}
|
|
262
394
|
}
|
|
263
395
|
|
|
264
396
|
exports.AccountManager = AccountManager;
|
|
397
|
+
exports.getAccountTransactionSigner = getAccountTransactionSigner;
|
|
265
398
|
//# sourceMappingURL=account-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-manager.js","sources":["../../src/types/account-manager.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"account-manager.js","sources":["../../src/types/account-manager.ts"],"sourcesContent":[null],"names":["KmdAccountManager","SigningAccount","MultisigAccount","DISPENSER_ACCOUNT"],"mappings":";;;;;;AAKA,IAAO,eAAe,GAAG,OAAO,CAAC,eAAe,CAAA;AAGhD,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAEzD,MAAM,OAAO,GAAG,CAA2B,EAAiB,KAAI;AAC9D,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAA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