@algorandfoundation/algokit-utils 2.3.3-beta.6 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/account.d.ts +38 -3
- package/cjs/account.d.ts.map +1 -1
- package/cjs/account.js +55 -3
- package/cjs/account.js.map +1 -1
- package/cjs/localnet.d.ts +1 -1
- package/cjs/localnet.js +1 -1
- package/esm/account.js +53 -2
- package/esm/account.js.map +1 -1
- package/esm/localnet.js +1 -1
- package/package.json +1 -1
- package/types/account.d.ts +38 -3
- package/types/account.d.ts.map +1 -1
- package/types/localnet.d.ts +1 -1
package/cjs/account.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare function mnemonicAccount(mnemonicSecret: string): Account;
|
|
|
37
37
|
*
|
|
38
38
|
*/
|
|
39
39
|
export declare function randomAccount(): Account;
|
|
40
|
-
/** @deprecated use
|
|
40
|
+
/** @deprecated use mnemonicAccountFromEnvironment instead
|
|
41
41
|
*
|
|
42
42
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
43
43
|
*
|
|
@@ -71,7 +71,7 @@ export declare function getAccount(account: {
|
|
|
71
71
|
name: string;
|
|
72
72
|
fundWith?: AlgoAmount;
|
|
73
73
|
} | string, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
74
|
-
/**
|
|
74
|
+
/** @deprecated use mnemonicAccountFromEnvironment instead
|
|
75
75
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
76
76
|
*
|
|
77
77
|
* Note: This function expects to run in a Node.js environment.
|
|
@@ -96,6 +96,40 @@ export declare function getAccount(account: {
|
|
|
96
96
|
config: AccountConfig;
|
|
97
97
|
fundWith?: AlgoAmount;
|
|
98
98
|
}, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
101
|
+
*
|
|
102
|
+
* Note: This function expects to run in a Node.js environment.
|
|
103
|
+
*
|
|
104
|
+
* ## Convention:
|
|
105
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
106
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
107
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
108
|
+
* * **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
|
|
109
|
+
*
|
|
110
|
+
* 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).
|
|
111
|
+
*
|
|
112
|
+
* @example Default
|
|
113
|
+
*
|
|
114
|
+
* 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:
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* 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.
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
123
|
+
* * `name`: string: The name identifier of the account
|
|
124
|
+
* * `fundWith`: The 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
|
|
125
|
+
* @param algod An algod client
|
|
126
|
+
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
127
|
+
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
128
|
+
*/
|
|
129
|
+
export declare function mnemonicAccountFromEnvironment(account: string | {
|
|
130
|
+
name: string;
|
|
131
|
+
fundWith?: AlgoAmount;
|
|
132
|
+
}, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
99
133
|
/** Returns an account's address as a byte array
|
|
100
134
|
*
|
|
101
135
|
* @param account Either an account (with private key loaded) or the string address of an account
|
|
@@ -115,7 +149,8 @@ export declare function getAccountAddressAsString(addressEncodedInB64: string):
|
|
|
115
149
|
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
116
150
|
*/
|
|
117
151
|
export declare function getDispenserAccount(algod: Algodv2, kmd?: Kmd): Promise<algosdk.Account | SigningAccount>;
|
|
118
|
-
/**
|
|
152
|
+
/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function
|
|
153
|
+
* Returns the Account configuration from environment variables
|
|
119
154
|
*
|
|
120
155
|
* @param accountName account name
|
|
121
156
|
*
|
package/cjs/account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAK7F,OAAO,EAAE,aAAa,EAAqB,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC7H,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,mBAE9G;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE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A6BG;AACH,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;CAAE,EACzD,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,CAsBnC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,cAElF;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,6CAIlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAUlF"}
|
package/cjs/account.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getAccountConfigFromEnvironment = exports.getDispenserAccount = exports.getAccountAddressAsString = exports.getAccountAddressAsUint8Array = exports.getAccount = exports.randomAccount = exports.mnemonicAccount = exports.transactionSignerAccount = exports.rekeyedAccount = exports.multisigAccount = void 0;
|
|
6
|
+
exports.getAccountConfigFromEnvironment = exports.getDispenserAccount = exports.getAccountAddressAsString = exports.getAccountAddressAsUint8Array = exports.mnemonicAccountFromEnvironment = exports.getAccount = exports.randomAccount = exports.mnemonicAccount = exports.transactionSignerAccount = exports.rekeyedAccount = exports.multisigAccount = void 0;
|
|
7
7
|
const algosdk_1 = __importDefault(require("algosdk"));
|
|
8
8
|
const _1 = require("./");
|
|
9
9
|
const localnet_1 = require("./localnet");
|
|
@@ -62,7 +62,7 @@ function randomAccount() {
|
|
|
62
62
|
return algosdk_1.default.generateAccount();
|
|
63
63
|
}
|
|
64
64
|
exports.randomAccount = randomAccount;
|
|
65
|
-
/**
|
|
65
|
+
/** @deprecated use mnemonicAccountFromEnvironment instead
|
|
66
66
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
67
67
|
*
|
|
68
68
|
* Note: This function expects to run in a Node.js environment.
|
|
@@ -133,6 +133,57 @@ async function getAccount(account, algod, kmdClient) {
|
|
|
133
133
|
throw new Error(`Missing environment variable ${name.toUpperCase()}_MNEMONIC when looking for account ${name}`);
|
|
134
134
|
}
|
|
135
135
|
exports.getAccount = getAccount;
|
|
136
|
+
/**
|
|
137
|
+
* Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
138
|
+
*
|
|
139
|
+
* Note: This function expects to run in a Node.js environment.
|
|
140
|
+
*
|
|
141
|
+
* ## Convention:
|
|
142
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
143
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
144
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
145
|
+
* * **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
|
|
146
|
+
*
|
|
147
|
+
* 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).
|
|
148
|
+
*
|
|
149
|
+
* @example Default
|
|
150
|
+
*
|
|
151
|
+
* 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:
|
|
152
|
+
* ```typescript
|
|
153
|
+
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* 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.
|
|
157
|
+
* 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.
|
|
158
|
+
*
|
|
159
|
+
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
160
|
+
* * `name`: string: The name identifier of the account
|
|
161
|
+
* * `fundWith`: The 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
|
|
162
|
+
* @param algod An algod client
|
|
163
|
+
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
164
|
+
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
165
|
+
*/
|
|
166
|
+
async function mnemonicAccountFromEnvironment(account, algod, kmdClient) {
|
|
167
|
+
const { name, fundWith } = typeof account === 'string' ? { name: account, fundWith: undefined } : account;
|
|
168
|
+
// todo: When eventually removing this method, inline it here
|
|
169
|
+
const config = getAccountConfigFromEnvironment(name);
|
|
170
|
+
if (config.accountMnemonic) {
|
|
171
|
+
const signer = mnemonicAccount(config.accountMnemonic);
|
|
172
|
+
const sender = config.senderAddress;
|
|
173
|
+
if (sender) {
|
|
174
|
+
_1.Config.logger.debug(`Using rekeyed account ${signer.addr} for sender ${sender} for ${name} account`);
|
|
175
|
+
return new account_1.SigningAccount(signer, sender);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
return signer;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (await (0, network_client_1.isLocalNet)(algod)) {
|
|
182
|
+
return await (0, localnet_1.getOrCreateKmdWalletAccount)({ name, fundWith }, algod, kmdClient);
|
|
183
|
+
}
|
|
184
|
+
throw new Error(`Missing environment variable ${name.toUpperCase()}_MNEMONIC when looking for account ${name}`);
|
|
185
|
+
}
|
|
186
|
+
exports.mnemonicAccountFromEnvironment = mnemonicAccountFromEnvironment;
|
|
136
187
|
/** Returns an account's address as a byte array
|
|
137
188
|
*
|
|
138
189
|
* @param account Either an account (with private key loaded) or the string address of an account
|
|
@@ -163,7 +214,8 @@ async function getDispenserAccount(algod, kmd) {
|
|
|
163
214
|
return canFundFromDefaultAccount ? await (0, localnet_1.getLocalNetDispenserAccount)(algod, kmd) : await getAccount(account_1.DISPENSER_ACCOUNT, algod);
|
|
164
215
|
}
|
|
165
216
|
exports.getDispenserAccount = getDispenserAccount;
|
|
166
|
-
/**
|
|
217
|
+
/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function
|
|
218
|
+
* Returns the Account configuration from environment variables
|
|
167
219
|
*
|
|
168
220
|
* @param accountName account name
|
|
169
221
|
*
|
package/cjs/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6F;AAC7F,yBAA2B;AAC3B,yCAAqF;AACrF,qDAA6C;AAC7C,+CAAgD;AAChD,6CAA6H;AAI7H;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,cAAgC,EAAE,eAA6C;IAC7G,OAAO,IAAI,yBAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAFD,0CAEC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,MAAe,EAAE,MAAc;IAC5D,OAAO,IAAI,wBAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAFD,wCAEC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,MAAyB,EAAE,MAAc;IAChF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAFD,4DAEC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,cAAsB;IACpD,iGAAiG;IACjG,OAAO,iBAAO,CAAC,mBAAmB,CAAC,cAAc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C,CAAC,CAAC,SAAS,CAAA;AAC3G,CAAC;AAFD,sEAEC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,mBAA2B;IACnE,OAAO,iBAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC1E,CAAC;AAFD,8DAEC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,KAAc,EAAE,GAAS;IACjE,4LAA4L;IAC5L,MAAM,yBAAyB,GAAG,MAAM,IAAA,2BAAU,EAAC,KAAK,CAAC,CAAA;IACzD,OAAO,yBAAyB,CAAC,CAAC,CAAC,MAAM,IAAA,sCAA2B,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,2BAAiB,EAAE,KAAK,CAAC,CAAA;AAC/H,CAAC;AAJD,kDAIC;AAED;;;;;;;;;GASG;AACH,SAAgB,+BAA+B,CAAC,WAAmB;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;KACtG;IAED,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,SAAS,CAAC;QACjE,WAAW;KACZ,CAAA;AACH,CAAC;AAVD,0EAUC"}
|
package/cjs/localnet.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function isLocalNet(algod: Algodv2): Promise<boolean>;
|
|
|
9
9
|
*
|
|
10
10
|
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
|
|
11
11
|
*
|
|
12
|
-
* If this is used via `
|
|
12
|
+
* If this is used via `mnemonicAccountFromEnvironment`, then you can even use the same code that runs on production without changes for local development!
|
|
13
13
|
*
|
|
14
14
|
* @param walletAccount The wallet details with:
|
|
15
15
|
* * `name`: The name of the wallet to retrieve / create
|
package/cjs/localnet.js
CHANGED
|
@@ -23,7 +23,7 @@ exports.isLocalNet = isLocalNet;
|
|
|
23
23
|
*
|
|
24
24
|
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
|
|
25
25
|
*
|
|
26
|
-
* If this is used via `
|
|
26
|
+
* If this is used via `mnemonicAccountFromEnvironment`, then you can even use the same code that runs on production without changes for local development!
|
|
27
27
|
*
|
|
28
28
|
* @param walletAccount The wallet details with:
|
|
29
29
|
* * `name`: The name of the wallet to retrieve / create
|
package/esm/account.js
CHANGED
|
@@ -51,7 +51,7 @@ export function randomAccount() {
|
|
|
51
51
|
// This method is confusingly named, so this function provides a more dev friendly "wrapper" name
|
|
52
52
|
return algosdk.generateAccount();
|
|
53
53
|
}
|
|
54
|
-
/**
|
|
54
|
+
/** @deprecated use mnemonicAccountFromEnvironment instead
|
|
55
55
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
56
56
|
*
|
|
57
57
|
* Note: This function expects to run in a Node.js environment.
|
|
@@ -121,6 +121,56 @@ export async function getAccount(account, algod, kmdClient) {
|
|
|
121
121
|
}
|
|
122
122
|
throw new Error(`Missing environment variable ${name.toUpperCase()}_MNEMONIC when looking for account ${name}`);
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
126
|
+
*
|
|
127
|
+
* Note: This function expects to run in a Node.js environment.
|
|
128
|
+
*
|
|
129
|
+
* ## Convention:
|
|
130
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
131
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
132
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
133
|
+
* * **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
|
|
134
|
+
*
|
|
135
|
+
* 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).
|
|
136
|
+
*
|
|
137
|
+
* @example Default
|
|
138
|
+
*
|
|
139
|
+
* 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:
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* 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.
|
|
145
|
+
* 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.
|
|
146
|
+
*
|
|
147
|
+
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
148
|
+
* * `name`: string: The name identifier of the account
|
|
149
|
+
* * `fundWith`: The 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
|
|
150
|
+
* @param algod An algod client
|
|
151
|
+
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
152
|
+
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
153
|
+
*/
|
|
154
|
+
export async function mnemonicAccountFromEnvironment(account, algod, kmdClient) {
|
|
155
|
+
const { name, fundWith } = typeof account === 'string' ? { name: account, fundWith: undefined } : account;
|
|
156
|
+
// todo: When eventually removing this method, inline it here
|
|
157
|
+
const config = getAccountConfigFromEnvironment(name);
|
|
158
|
+
if (config.accountMnemonic) {
|
|
159
|
+
const signer = mnemonicAccount(config.accountMnemonic);
|
|
160
|
+
const sender = config.senderAddress;
|
|
161
|
+
if (sender) {
|
|
162
|
+
Config.logger.debug(`Using rekeyed account ${signer.addr} for sender ${sender} for ${name} account`);
|
|
163
|
+
return new SigningAccount(signer, sender);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return signer;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (await isLocalNet(algod)) {
|
|
170
|
+
return await getOrCreateKmdWalletAccount({ name, fundWith }, algod, kmdClient);
|
|
171
|
+
}
|
|
172
|
+
throw new Error(`Missing environment variable ${name.toUpperCase()}_MNEMONIC when looking for account ${name}`);
|
|
173
|
+
}
|
|
124
174
|
/** Returns an account's address as a byte array
|
|
125
175
|
*
|
|
126
176
|
* @param account Either an account (with private key loaded) or the string address of an account
|
|
@@ -148,7 +198,8 @@ export async function getDispenserAccount(algod, kmd) {
|
|
|
148
198
|
const canFundFromDefaultAccount = await isLocalNet(algod);
|
|
149
199
|
return canFundFromDefaultAccount ? await getLocalNetDispenserAccount(algod, kmd) : await getAccount(DISPENSER_ACCOUNT, algod);
|
|
150
200
|
}
|
|
151
|
-
/**
|
|
201
|
+
/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function
|
|
202
|
+
* Returns the Account configuration from environment variables
|
|
152
203
|
*
|
|
153
204
|
* @param accountName account name
|
|
154
205
|
*
|
package/esm/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAuE,MAAM,SAAS,CAAA;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAA;AAC3B,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAiB,i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AC,WAAmB;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;KACtG;IAED,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,SAAS,CAAC;QACjE,WAAW;KACZ,CAAA;AACH,CAAC"}
|
package/esm/localnet.js
CHANGED
|
@@ -16,7 +16,7 @@ export async function isLocalNet(algod) {
|
|
|
16
16
|
*
|
|
17
17
|
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
|
|
18
18
|
*
|
|
19
|
-
* If this is used via `
|
|
19
|
+
* If this is used via `mnemonicAccountFromEnvironment`, then you can even use the same code that runs on production without changes for local development!
|
|
20
20
|
*
|
|
21
21
|
* @param walletAccount The wallet details with:
|
|
22
22
|
* * `name`: The name of the wallet to retrieve / create
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"main": "./cjs/index.js",
|
|
3
3
|
"types": "./types/index.d.ts",
|
|
4
4
|
"name": "@algorandfoundation/algokit-utils",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "3.0.0-beta.1",
|
|
6
6
|
"private": false,
|
|
7
7
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
8
8
|
"author": "Algorand Foundation",
|
package/types/account.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare function mnemonicAccount(mnemonicSecret: string): Account;
|
|
|
37
37
|
*
|
|
38
38
|
*/
|
|
39
39
|
export declare function randomAccount(): Account;
|
|
40
|
-
/** @deprecated use
|
|
40
|
+
/** @deprecated use mnemonicAccountFromEnvironment instead
|
|
41
41
|
*
|
|
42
42
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
43
43
|
*
|
|
@@ -71,7 +71,7 @@ export declare function getAccount(account: {
|
|
|
71
71
|
name: string;
|
|
72
72
|
fundWith?: AlgoAmount;
|
|
73
73
|
} | string, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
74
|
-
/**
|
|
74
|
+
/** @deprecated use mnemonicAccountFromEnvironment instead
|
|
75
75
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
76
76
|
*
|
|
77
77
|
* Note: This function expects to run in a Node.js environment.
|
|
@@ -96,6 +96,40 @@ export declare function getAccount(account: {
|
|
|
96
96
|
config: AccountConfig;
|
|
97
97
|
fundWith?: AlgoAmount;
|
|
98
98
|
}, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
|
|
101
|
+
*
|
|
102
|
+
* Note: This function expects to run in a Node.js environment.
|
|
103
|
+
*
|
|
104
|
+
* ## Convention:
|
|
105
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
106
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
107
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
108
|
+
* * **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
|
|
109
|
+
*
|
|
110
|
+
* 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).
|
|
111
|
+
*
|
|
112
|
+
* @example Default
|
|
113
|
+
*
|
|
114
|
+
* 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:
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* 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.
|
|
120
|
+
* 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.
|
|
121
|
+
*
|
|
122
|
+
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
123
|
+
* * `name`: string: The name identifier of the account
|
|
124
|
+
* * `fundWith`: The 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
|
|
125
|
+
* @param algod An algod client
|
|
126
|
+
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
127
|
+
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
128
|
+
*/
|
|
129
|
+
export declare function mnemonicAccountFromEnvironment(account: string | {
|
|
130
|
+
name: string;
|
|
131
|
+
fundWith?: AlgoAmount;
|
|
132
|
+
}, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
99
133
|
/** Returns an account's address as a byte array
|
|
100
134
|
*
|
|
101
135
|
* @param account Either an account (with private key loaded) or the string address of an account
|
|
@@ -115,7 +149,8 @@ export declare function getAccountAddressAsString(addressEncodedInB64: string):
|
|
|
115
149
|
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
116
150
|
*/
|
|
117
151
|
export declare function getDispenserAccount(algod: Algodv2, kmd?: Kmd): Promise<algosdk.Account | SigningAccount>;
|
|
118
|
-
/**
|
|
152
|
+
/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function
|
|
153
|
+
* Returns the Account configuration from environment variables
|
|
119
154
|
*
|
|
120
155
|
* @param accountName account name
|
|
121
156
|
*
|
package/types/account.d.ts.map
CHANGED
|
@@ -1 +1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2): Promise<boolean>;
|
|
|
9
9
|
*
|
|
10
10
|
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
|
|
11
11
|
*
|
|
12
|
-
* If this is used via `
|
|
12
|
+
* If this is used via `mnemonicAccountFromEnvironment`, then you can even use the same code that runs on production without changes for local development!
|
|
13
13
|
*
|
|
14
14
|
* @param walletAccount The wallet details with:
|
|
15
15
|
* * `name`: The name of the wallet to retrieve / create
|