@aztec/cli 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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/dest/cmds/infrastructure/setup_l2_contract.d.ts +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.d.ts.map +1 -1
- package/dest/cmds/infrastructure/setup_l2_contract.js +10 -6
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts +2 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.d.ts.map +1 -0
- package/dest/cmds/validator_keys/eth_json_v3_worker.js +27 -0
- package/dest/cmds/validator_keys/index.d.ts +1 -1
- package/dest/cmds/validator_keys/index.d.ts.map +1 -1
- package/dest/cmds/validator_keys/index.js +7 -6
- package/dest/cmds/validator_keys/new.d.ts +7 -1
- package/dest/cmds/validator_keys/new.d.ts.map +1 -1
- package/dest/cmds/validator_keys/new.js +98 -12
- package/dest/cmds/validator_keys/set_funding_account.d.ts +14 -0
- package/dest/cmds/validator_keys/set_funding_account.d.ts.map +1 -0
- package/dest/cmds/validator_keys/set_funding_account.js +37 -0
- package/dest/cmds/validator_keys/shared.d.ts +15 -2
- package/dest/cmds/validator_keys/shared.d.ts.map +1 -1
- package/dest/cmds/validator_keys/shared.js +100 -23
- package/dest/cmds/validator_keys/utils.d.ts +12 -2
- package/dest/cmds/validator_keys/utils.d.ts.map +1 -1
- package/dest/cmds/validator_keys/utils.js +34 -0
- package/dest/config/chain_l2_config.d.ts +7 -2
- package/dest/config/chain_l2_config.d.ts.map +1 -1
- package/dest/config/chain_l2_config.js +14 -1
- package/dest/config/generated/networks.d.ts +53 -35
- package/dest/config/generated/networks.d.ts.map +1 -1
- package/dest/config/generated/networks.js +52 -34
- package/dest/utils/commands.d.ts +7 -6
- package/dest/utils/commands.d.ts.map +1 -1
- package/dest/utils/commands.js +10 -9
- package/dest/utils/inspect.js +5 -6
- package/package.json +30 -30
- package/src/cmds/infrastructure/setup_l2_contract.ts +9 -5
- package/src/cmds/validator_keys/eth_json_v3_worker.ts +30 -0
- package/src/cmds/validator_keys/index.ts +48 -8
- package/src/cmds/validator_keys/new.ts +129 -9
- package/src/cmds/validator_keys/set_funding_account.ts +55 -0
- package/src/cmds/validator_keys/shared.ts +123 -35
- package/src/cmds/validator_keys/utils.ts +44 -1
- package/src/config/chain_l2_config.ts +14 -1
- package/src/config/generated/networks.ts +52 -34
- package/src/utils/commands.ts +14 -13
- package/src/utils/inspect.ts +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
export declare function setupL2Contracts(nodeUrl: string, testAccounts: boolean, json: boolean, log: LogFn): Promise<void>;
|
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dXBfbDJfY29udHJhY3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbWRzL2luZnJhc3RydWN0dXJlL3NldHVwX2wyX2NvbnRyYWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBS25ELHdCQUFzQixnQkFBZ0IsQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLFlBQVksRUFBRSxPQUFPLEVBQUUsSUFBSSxFQUFFLE9BQU8sRUFBRSxHQUFHLEVBQUUsS0FBSyxpQkEyQnZHIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup_l2_contract.d.ts","sourceRoot":"","sources":["../../../src/cmds/infrastructure/setup_l2_contract.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAKnD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,iBA2BvG"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
2
2
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
3
|
+
import { TxStatus } from '@aztec/aztec.js/tx';
|
|
3
4
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
4
5
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
6
|
import { EmbeddedWallet } from '@aztec/wallets/embedded';
|
|
6
|
-
import {
|
|
7
|
+
import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
|
|
7
8
|
export async function setupL2Contracts(nodeUrl, testAccounts, json, log) {
|
|
8
9
|
const waitOpts = {
|
|
9
10
|
timeout: 180,
|
|
10
|
-
interval: 1
|
|
11
|
+
interval: 1,
|
|
12
|
+
// The embedded wallet defaults to PROPOSED, which can be dropped if its proposed block is pruned
|
|
13
|
+
// before the checkpoint lands. Wait for the checkpoint so serial setup is reliable.
|
|
14
|
+
waitForStatus: TxStatus.CHECKPOINTED
|
|
11
15
|
};
|
|
12
16
|
log('setupL2Contracts: Wait options' + jsonStringify(waitOpts));
|
|
13
17
|
log('setupL2Contracts: Creating PXE client...');
|
|
14
18
|
const node = createAztecNodeClient(nodeUrl);
|
|
15
19
|
const wallet = await EmbeddedWallet.create(node);
|
|
16
|
-
let
|
|
20
|
+
let accountManagers = [];
|
|
17
21
|
if (testAccounts) {
|
|
18
|
-
log('setupL2Contracts:
|
|
22
|
+
log('setupL2Contracts: Creating test accounts...');
|
|
19
23
|
const initialAccountsData = await getInitialTestAccountsData();
|
|
20
|
-
|
|
24
|
+
accountManagers = await createFundedInitializerlessAccounts(wallet, initialAccountsData);
|
|
21
25
|
}
|
|
22
26
|
if (json) {
|
|
23
27
|
const toPrint = {
|
|
24
28
|
...ProtocolContractAddress
|
|
25
29
|
};
|
|
26
|
-
|
|
30
|
+
accountManagers.forEach((a, i)=>{
|
|
27
31
|
toPrint[`testAccount${i}`] = a.address;
|
|
28
32
|
});
|
|
29
33
|
log(JSON.stringify(toPrint, null, 2));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eth_json_v3_worker.d.ts","sourceRoot":"","sources":["../../../src/cmds/validator_keys/eth_json_v3_worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Wallet } from '@ethersproject/wallet';
|
|
2
|
+
import { parentPort, workerData } from 'worker_threads';
|
|
3
|
+
function serializeError(error) {
|
|
4
|
+
if (error instanceof Error) {
|
|
5
|
+
return {
|
|
6
|
+
message: error.message,
|
|
7
|
+
name: error.name,
|
|
8
|
+
stack: error.stack
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
message: String(error)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
void (async ()=>{
|
|
16
|
+
try {
|
|
17
|
+
const { privateKeyHex, password } = workerData;
|
|
18
|
+
const json = await new Wallet(privateKeyHex).encrypt(password);
|
|
19
|
+
parentPort?.postMessage({
|
|
20
|
+
json
|
|
21
|
+
});
|
|
22
|
+
} catch (error) {
|
|
23
|
+
parentPort?.postMessage({
|
|
24
|
+
error: serializeError(error)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LogFn } from '@aztec/foundation/log';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
export declare function injectCommands(program: Command, log: LogFn): Command;
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbWRzL3ZhbGlkYXRvcl9rZXlzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRW5ELE9BQU8sRUFBRSxPQUFPLEVBQVUsTUFBTSxXQUFXLENBQUM7QUFLNUMsd0JBQWdCLGNBQWMsQ0FBQyxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsRUFBRSxLQUFLLFdBOEsxRCJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/validator_keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/validator_keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAK5C,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,WA8K1D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
1
2
|
import { parseAztecAddress, parseEthereumAddress, parseHex, parseOptionalInteger } from '../../utils/commands.js';
|
|
2
3
|
import { defaultBlsPath } from './utils.js';
|
|
3
4
|
export function injectCommands(program, log) {
|
|
@@ -5,18 +6,18 @@ export function injectCommands(program, log) {
|
|
|
5
6
|
'valKeys',
|
|
6
7
|
'valkeys'
|
|
7
8
|
]).description('Manage validator keystores for node operators');
|
|
8
|
-
group.command('new').summary('Generate a new validator keystore JSON').description('Generates a new validator keystore with ETH secp256k1 accounts and optional BLS accounts').option('--data-dir <path>', 'Directory to store keystore(s). Defaults to ~/.aztec/keystore').option('--file <name>', 'Keystore file name. Defaults to key1.json (or keyN.json if key1.json exists)').option('--count <N>', 'Number of validators to generate', parseOptionalInteger).option('--publisher-count <N>', 'Number of publisher accounts per validator (default 0)', (value)=>parseOptionalInteger(value, 0)).option('--publishers <privateKeys>', 'Comma-separated list of publisher private keys for all validators.', (value)=>value.split(',').map((key)=>key.trim())).option('--mnemonic <mnemonic>', 'Mnemonic for ETH/BLS derivation').option('--passphrase <str>', 'Optional passphrase for mnemonic').option('--account-index <N>', 'Base account index for ETH/BLS derivation', parseOptionalInteger).option('--address-index <N>', 'Base address index for ETH/BLS derivation', parseOptionalInteger).option('--coinbase <address>', 'Coinbase ETH address to use when proposing. Defaults to attester address.', parseEthereumAddress)
|
|
9
|
-
// .option('--funding-account <privateKey|address>', 'ETH private key (or address for remote signer setup) to fund publishers')
|
|
10
|
-
.option('--remote-signer <url>', 'Default remote signer URL for accounts in this file').option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', (value)=>parseHex(value, 32)).option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`).option('--password <str>', 'Password for writing keystore files (ETH JSON V3 and BLS EIP-2335). Empty string allowed').option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)').option('--json', 'Echo resulting JSON to stdout').option('--staker-output', 'Generate a single staker output JSON file with an array of validator entries').option('--gse-address <address>', 'GSE contract address (required with --staker-output)', parseEthereumAddress).option('--l1-rpc-urls <urls>', 'L1 RPC URLs (comma-separated, required with --staker-output)', (value)=>value.split(',')).option('-c, --l1-chain-id <number>', 'L1 chain ID (required with --staker-output)', (value)=>parseInt(value), 31337).requiredOption('--fee-recipient <address>', 'Aztec address that will receive fees', parseAztecAddress).action(async (options)=>{
|
|
9
|
+
group.command('new').summary('Generate a new validator keystore JSON').description('Generates a new validator keystore with ETH secp256k1 accounts and optional BLS accounts').option('--data-dir <path>', 'Directory to store keystore(s). Defaults to ~/.aztec/keystore').option('--file <name>', 'Keystore file name. Defaults to key1.json (or keyN.json if key1.json exists)').option('--count <N>', 'Number of validators to generate', parseOptionalInteger).option('--publisher-count <N>', 'Number of publisher accounts per validator (default 0)', (value)=>parseOptionalInteger(value, 0)).option('--publishers <privateKeys>', 'Comma-separated list of publisher private keys for all validators.', (value)=>value.split(',').map((key)=>key.trim())).option('--mnemonic <mnemonic>', 'Mnemonic for ETH/BLS derivation').option('--passphrase <str>', 'Optional passphrase for mnemonic').option('--account-index <N>', 'Base account index for ETH/BLS derivation', parseOptionalInteger).option('--address-index <N>', 'Base address index for ETH/BLS derivation', parseOptionalInteger).option('--coinbase <address>', 'Coinbase ETH address to use when proposing. Defaults to attester address.', parseEthereumAddress).option('--funding-account <privateKey|address>', 'ETH funding account used to top up publisher EOAs. Provide a private key, or an address together with --remote-signer.').option('--remote-signer <url>', 'Default remote signer URL for accounts in this file').option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', (value)=>parseHex(value, 32)).option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`).addOption(new Option('--password <str>', 'Shared password for writing ETH JSON V3 and BLS EIP-2335 keystore files').env('AZTEC_KEYSTORE_PASSWORD')).option('--password-file <path>', 'File containing the shared password for writing keystore files').addOption(new Option('--eth-password <str>', 'Password for writing ETH JSON V3 keystore files').env('AZTEC_ETH_KEYSTORE_PASSWORD')).option('--eth-password-file <path>', 'File containing the password for writing ETH JSON V3 keystore files').addOption(new Option('--bls-password <str>', 'Password for writing BLS EIP-2335 keystore files').env('AZTEC_BLS_KEYSTORE_PASSWORD')).option('--bls-password-file <path>', 'File containing the password for writing BLS EIP-2335 keystore files').option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)').option('--json', 'Echo resulting JSON to stdout').option('--staker-output', 'Generate a single staker output JSON file with an array of validator entries').option('--gse-address <address>', 'GSE contract address (required with --staker-output)', parseEthereumAddress).option('--l1-rpc-urls <urls>', 'L1 RPC URLs (comma-separated, required with --staker-output)', (value)=>value.split(',')).option('-c, --l1-chain-id <number>', 'L1 chain ID (required with --staker-output)', (value)=>parseInt(value), 31337).requiredOption('--fee-recipient <address>', 'Aztec address that will receive fees', parseAztecAddress).action(async (options)=>{
|
|
11
10
|
const { newValidatorKeystore } = await import('./new.js');
|
|
12
11
|
await newValidatorKeystore(options, log);
|
|
13
12
|
});
|
|
14
|
-
group.command('add').summary('Augment an existing validator keystore JSON').description('Adds attester/publisher/BLS entries to an existing keystore using the same flags as new').argument('<existing>', 'Path to existing keystore JSON').option('--data-dir <path>', 'Directory where keystore(s) live. (default: ~/.aztec/keystore)').option('--file <name>', 'Override output file name. (default: key<N>.json)').option('--count <N>', 'Number of validators to add. (default: 1)', parseOptionalInteger).option('--publisher-count <N>', 'Number of publisher accounts per validator (default 0)', (value)=>parseOptionalInteger(value, 0)).option('--publishers <privateKeys>', 'Comma-separated list of publisher private keys for all validators.', (value)=>value.split(',').map((key)=>key.trim())).option('--mnemonic <mnemonic>', 'Mnemonic for ETH/BLS derivation').option('--passphrase <str>', 'Optional passphrase for mnemonic').option('--account-index <N>', 'Base account index for ETH/BLS derivation', parseOptionalInteger).option('--address-index <N>', 'Base address index for ETH/BLS derivation', parseOptionalInteger).option('--coinbase <address>', 'Coinbase ETH address to use when proposing. Defaults to attester address.', parseEthereumAddress)
|
|
15
|
-
// .option('--funding-account <privateKey|address>', 'ETH private key (or address for remote signer setup) to fund publishers')
|
|
16
|
-
.option('--remote-signer <url>', 'Default remote signer URL for accounts in this file').option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', (value)=>parseHex(value, 32)).option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`).option('--empty', 'Generate an empty skeleton without keys').option('--password <str>', 'Password for writing keystore files (ETH JSON V3 and BLS EIP-2335). Empty string allowed').option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)').option('--json', 'Echo resulting JSON to stdout').requiredOption('--fee-recipient <address>', 'Aztec address that will receive fees', parseAztecAddress).action(async (existing, options)=>{
|
|
13
|
+
group.command('add').summary('Augment an existing validator keystore JSON').description('Adds attester/publisher/BLS entries to an existing keystore using the same flags as new').argument('<existing>', 'Path to existing keystore JSON').option('--data-dir <path>', 'Directory where keystore(s) live. (default: ~/.aztec/keystore)').option('--file <name>', 'Override output file name. (default: key<N>.json)').option('--count <N>', 'Number of validators to add. (default: 1)', parseOptionalInteger).option('--publisher-count <N>', 'Number of publisher accounts per validator (default 0)', (value)=>parseOptionalInteger(value, 0)).option('--publishers <privateKeys>', 'Comma-separated list of publisher private keys for all validators.', (value)=>value.split(',').map((key)=>key.trim())).option('--mnemonic <mnemonic>', 'Mnemonic for ETH/BLS derivation').option('--passphrase <str>', 'Optional passphrase for mnemonic').option('--account-index <N>', 'Base account index for ETH/BLS derivation', parseOptionalInteger).option('--address-index <N>', 'Base address index for ETH/BLS derivation', parseOptionalInteger).option('--coinbase <address>', 'Coinbase ETH address to use when proposing. Defaults to attester address.', parseEthereumAddress).option('--remote-signer <url>', 'Default remote signer URL for accounts in this file').option('--ikm <hex>', 'Initial keying material for BLS (alternative to mnemonic)', (value)=>parseHex(value, 32)).option('--bls-path <path>', `EIP-2334 path (default ${defaultBlsPath})`).option('--empty', 'Generate an empty skeleton without keys').option('--password <str>', 'Password for writing keystore files (ETH JSON V3 and BLS EIP-2335). Empty string allowed').option('--encrypted-keystore-dir <dir>', 'Output directory for encrypted keystore file(s)').option('--json', 'Echo resulting JSON to stdout').requiredOption('--fee-recipient <address>', 'Aztec address that will receive fees', parseAztecAddress).action(async (existing, options)=>{
|
|
17
14
|
const { addValidatorKeys } = await import('./add.js');
|
|
18
15
|
await addValidatorKeys(existing, options, log);
|
|
19
16
|
});
|
|
17
|
+
group.command('set-funding-account').summary('Set the funding account of an existing keystore').description('Sets the keystore-level ETH funding account used to top up publisher EOAs, replacing any existing one').argument('<existing>', 'Path to existing keystore JSON').argument('<privateKey|address>', 'Funding account: a private key, or an address (needs --remote-signer unless the keystore already defines one)').option('--remote-signer <url>', 'Remote signer URL for the funding account (required with an address unless the keystore already defines one)').option('--password <str>', 'Password for writing the funding key as an encrypted ETH JSON V3 file. Empty string allowed').option('--encrypted-keystore-dir <dir>', 'Output directory for the encrypted funding key file').option('--json', 'Echo resulting JSON to stdout').action(async (existing, fundingAccount, options)=>{
|
|
18
|
+
const { setFundingAccount } = await import('./set_funding_account.js');
|
|
19
|
+
await setFundingAccount(existing, fundingAccount, options, log);
|
|
20
|
+
});
|
|
20
21
|
group.command('staker').summary('Generate staking JSON from keystore').description('Reads a validator keystore and outputs staking data with BLS public keys for each attester (skips mnemonics)').requiredOption('--from <keystore>', 'Path to keystore JSON file').option('--password <password>', 'Password for decrypting encrypted keystores (if not specified in keystore file)').requiredOption('--gse-address <address>', 'GSE contract address', parseEthereumAddress).option('--l1-rpc-urls <urls>', 'L1 RPC URLs (comma-separated)', (value)=>value.split(','), [
|
|
21
22
|
'http://localhost:8545'
|
|
22
23
|
]).option('-c, --l1-chain-id <number>', 'L1 chain ID', (value)=>parseInt(value), 31337).option('--output <file>', 'Output file path (if not specified, JSON is written to stdout)').action(async (options)=>{
|
|
@@ -15,10 +15,16 @@ export type NewValidatorKeystoreOptions = {
|
|
|
15
15
|
ikm?: string;
|
|
16
16
|
blsPath?: string;
|
|
17
17
|
password?: string;
|
|
18
|
+
passwordFile?: string;
|
|
19
|
+
ethPassword?: string;
|
|
20
|
+
ethPasswordFile?: string;
|
|
21
|
+
blsPassword?: string;
|
|
22
|
+
blsPasswordFile?: string;
|
|
18
23
|
encryptedKeystoreDir?: string;
|
|
19
24
|
json?: boolean;
|
|
20
25
|
feeRecipient: AztecAddress;
|
|
21
26
|
coinbase?: EthAddress;
|
|
27
|
+
fundingAccount?: string;
|
|
22
28
|
remoteSigner?: string;
|
|
23
29
|
stakerOutput?: boolean;
|
|
24
30
|
gseAddress?: EthAddress;
|
|
@@ -26,4 +32,4 @@ export type NewValidatorKeystoreOptions = {
|
|
|
26
32
|
l1ChainId?: number;
|
|
27
33
|
};
|
|
28
34
|
export declare function newValidatorKeystore(options: NewValidatorKeystoreOptions, log: LogFn): Promise<void>;
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY21kcy92YWxpZGF0b3Jfa2V5cy9uZXcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFDaEUsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDbkQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUE0QmhFLE1BQU0sTUFBTSwyQkFBMkIsR0FBRztJQUN4QyxPQUFPLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDakIsSUFBSSxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2QsS0FBSyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ2YsY0FBYyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ3hCLFVBQVUsQ0FBQyxFQUFFLE1BQU0sRUFBRSxDQUFDO0lBQ3RCLFFBQVEsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQixVQUFVLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDcEIsWUFBWSxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ3RCLFlBQVksQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUN0QixpQkFBaUIsQ0FBQyxFQUFFLE9BQU8sQ0FBQztJQUM1QixHQUFHLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDYixPQUFPLENBQUMsRUF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S,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAkFF,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,EAAE,GAAG,EAAE,KAAK,iBAsL1F"}
|
|
@@ -2,13 +2,74 @@ import { prettyPrintJSON } from '@aztec/cli/utils';
|
|
|
2
2
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
3
|
import { GSEContract } from '@aztec/ethereum/contracts';
|
|
4
4
|
import { wordlist } from '@scure/bip39/wordlists/english.js';
|
|
5
|
-
import { writeFile } from 'fs/promises';
|
|
5
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
6
6
|
import { basename, dirname, join } from 'path';
|
|
7
7
|
import { createPublicClient, fallback, http } from 'viem';
|
|
8
|
-
import { generateMnemonic, mnemonicToAccount } from 'viem/accounts';
|
|
9
|
-
import { buildValidatorEntries, logValidatorSummaries, maybePrintJson, resolveKeystoreOutputPath, writeBlsBn254ToFile, writeEthJsonV3ToFile, writeKeystoreFile } from './shared.js';
|
|
8
|
+
import { generateMnemonic, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
9
|
+
import { buildValidatorEntries, encryptFundingAccountToFile, logValidatorSummaries, maybePrintJson, resolveFundingAccount, resolveKeystoreOutputPath, writeBlsBn254ToFile, writeEthJsonV3ToFile, writeKeystoreFile } from './shared.js';
|
|
10
10
|
import { processAttesterAccounts } from './staker.js';
|
|
11
|
-
import { validateBlsPathOptions, validatePublisherOptions, validateRemoteSignerOptions, validateStakerOutputOptions } from './utils.js';
|
|
11
|
+
import { validateBlsPathOptions, validateFundingAccountOptions, validatePublisherOptions, validateRemoteSignerOptions, validateStakerOutputOptions } from './utils.js';
|
|
12
|
+
function validatePassword(password, source) {
|
|
13
|
+
if (password.length === 0) {
|
|
14
|
+
throw new Error(`${source} cannot be empty`);
|
|
15
|
+
}
|
|
16
|
+
return password;
|
|
17
|
+
}
|
|
18
|
+
function stripOneTrailingNewline(password) {
|
|
19
|
+
if (password.endsWith('\n')) {
|
|
20
|
+
password = password.slice(0, -1);
|
|
21
|
+
}
|
|
22
|
+
if (password.endsWith('\r')) {
|
|
23
|
+
password = password.slice(0, -1);
|
|
24
|
+
}
|
|
25
|
+
return password;
|
|
26
|
+
}
|
|
27
|
+
async function resolvePasswordSource(source) {
|
|
28
|
+
if (source.password !== undefined && source.passwordFile !== undefined) {
|
|
29
|
+
throw new Error(`${source.passwordOption} and ${source.passwordFileOption} cannot be used together`);
|
|
30
|
+
}
|
|
31
|
+
if (source.password !== undefined) {
|
|
32
|
+
return validatePassword(source.password, source.passwordOption);
|
|
33
|
+
}
|
|
34
|
+
if (source.passwordFile !== undefined) {
|
|
35
|
+
if (source.passwordFile.length === 0) {
|
|
36
|
+
throw new Error(`${source.passwordFileOption} cannot be empty`);
|
|
37
|
+
}
|
|
38
|
+
const password = stripOneTrailingNewline(await readFile(source.passwordFile, 'utf-8'));
|
|
39
|
+
return validatePassword(password, source.passwordFileOption);
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
async function resolvePasswords(options) {
|
|
44
|
+
const sharedPassword = await resolvePasswordSource({
|
|
45
|
+
password: options.password,
|
|
46
|
+
passwordFile: options.passwordFile,
|
|
47
|
+
passwordOption: '--password',
|
|
48
|
+
passwordFileOption: '--password-file'
|
|
49
|
+
});
|
|
50
|
+
const ethPassword = await resolvePasswordSource({
|
|
51
|
+
password: options.ethPassword,
|
|
52
|
+
passwordFile: options.ethPasswordFile,
|
|
53
|
+
passwordOption: '--eth-password',
|
|
54
|
+
passwordFileOption: '--eth-password-file'
|
|
55
|
+
}) ?? sharedPassword;
|
|
56
|
+
const blsPassword = await resolvePasswordSource({
|
|
57
|
+
password: options.blsPassword,
|
|
58
|
+
passwordFile: options.blsPasswordFile,
|
|
59
|
+
passwordOption: '--bls-password',
|
|
60
|
+
passwordFileOption: '--bls-password-file'
|
|
61
|
+
}) ?? sharedPassword;
|
|
62
|
+
if (ethPassword === undefined && blsPassword === undefined) {
|
|
63
|
+
return {};
|
|
64
|
+
}
|
|
65
|
+
if (ethPassword === undefined || blsPassword === undefined) {
|
|
66
|
+
throw new Error('Both ETH and BLS passwords are required when writing encrypted keystores. Provide --password to use one password for both, or provide both --eth-password and --bls-password.');
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
ethPassword,
|
|
70
|
+
blsPassword
|
|
71
|
+
};
|
|
72
|
+
}
|
|
12
73
|
export async function newValidatorKeystore(options, log) {
|
|
13
74
|
// validate bls-path inputs before proceeding with key generation
|
|
14
75
|
validateBlsPathOptions(options);
|
|
@@ -18,9 +79,20 @@ export async function newValidatorKeystore(options, log) {
|
|
|
18
79
|
validatePublisherOptions(options);
|
|
19
80
|
// validate remote signer options
|
|
20
81
|
validateRemoteSignerOptions(options);
|
|
21
|
-
|
|
82
|
+
// validate funding account option
|
|
83
|
+
validateFundingAccountOptions(options);
|
|
84
|
+
const { dataDir, file, count, publisherCount = 0, publishers, json, coinbase, fundingAccount, accountIndex = 0, addressIndex = 0, feeRecipient, remoteSigner, blsPath, ikm, mnemonic: _mnemonic, password: passwordOption, passwordFile, ethPassword: ethPasswordOption, ethPasswordFile, blsPassword: blsPasswordOption, blsPasswordFile, encryptedKeystoreDir, stakerOutput, gseAddress, l1RpcUrls, l1ChainId } = options;
|
|
85
|
+
const { ethPassword, blsPassword } = await resolvePasswords({
|
|
86
|
+
password: passwordOption,
|
|
87
|
+
passwordFile,
|
|
88
|
+
ethPassword: ethPasswordOption,
|
|
89
|
+
ethPasswordFile,
|
|
90
|
+
blsPassword: blsPasswordOption,
|
|
91
|
+
blsPasswordFile
|
|
92
|
+
});
|
|
93
|
+
const shouldEncryptKeystores = ethPassword !== undefined && blsPassword !== undefined;
|
|
22
94
|
const mnemonic = _mnemonic ?? generateMnemonic(wordlist);
|
|
23
|
-
if (!_mnemonic && !json) {
|
|
95
|
+
if (!_mnemonic && !json && !shouldEncryptKeystores) {
|
|
24
96
|
log('No mnemonic provided, generating new one...');
|
|
25
97
|
log(`Using new mnemonic:`);
|
|
26
98
|
log('');
|
|
@@ -43,21 +115,31 @@ export async function newValidatorKeystore(options, log) {
|
|
|
43
115
|
coinbase,
|
|
44
116
|
remoteSigner
|
|
45
117
|
});
|
|
118
|
+
let resolvedFundingAccount = fundingAccount ? resolveFundingAccount(fundingAccount, remoteSigner) : undefined;
|
|
46
119
|
// If password provided, write ETH JSON V3 and BLS BN254 keystores and replace plaintext
|
|
47
|
-
if (
|
|
120
|
+
if (shouldEncryptKeystores) {
|
|
48
121
|
const encryptedKeystoreOutDir = encryptedKeystoreDir && encryptedKeystoreDir.length > 0 ? encryptedKeystoreDir : keystoreOutDir;
|
|
49
122
|
await writeEthJsonV3ToFile(validators, {
|
|
50
123
|
outDir: encryptedKeystoreOutDir,
|
|
51
|
-
password
|
|
124
|
+
password: ethPassword
|
|
52
125
|
});
|
|
53
126
|
await writeBlsBn254ToFile(validators, {
|
|
54
127
|
outDir: encryptedKeystoreOutDir,
|
|
55
|
-
password
|
|
128
|
+
password: blsPassword
|
|
56
129
|
});
|
|
130
|
+
if (resolvedFundingAccount) {
|
|
131
|
+
resolvedFundingAccount = await encryptFundingAccountToFile(resolvedFundingAccount, {
|
|
132
|
+
outDir: encryptedKeystoreOutDir,
|
|
133
|
+
password: ethPassword
|
|
134
|
+
});
|
|
135
|
+
}
|
|
57
136
|
}
|
|
58
137
|
const keystore = {
|
|
59
138
|
schemaVersion: 1,
|
|
60
|
-
validators
|
|
139
|
+
validators,
|
|
140
|
+
...resolvedFundingAccount ? {
|
|
141
|
+
fundingAccount: resolvedFundingAccount
|
|
142
|
+
} : {}
|
|
61
143
|
};
|
|
62
144
|
await writeKeystoreFile(outputPath, keystore);
|
|
63
145
|
// Generate staker outputs if requested
|
|
@@ -76,7 +158,7 @@ export async function newValidatorKeystore(options, log) {
|
|
|
76
158
|
// Process each validator
|
|
77
159
|
for(let i = 0; i < validators.length; i++){
|
|
78
160
|
const validator = validators[i];
|
|
79
|
-
const outputs = await processAttesterAccounts(validator.attester, gse
|
|
161
|
+
const outputs = await processAttesterAccounts(validator.attester, gse);
|
|
80
162
|
// Collect all staker outputs
|
|
81
163
|
for(let j = 0; j < outputs.length; j++){
|
|
82
164
|
allStakerOutputs.push(outputs[j]);
|
|
@@ -88,7 +170,7 @@ export async function newValidatorKeystore(options, log) {
|
|
|
88
170
|
await writeFile(stakerOutputPath, prettyPrintJSON(allStakerOutputs), 'utf-8');
|
|
89
171
|
}
|
|
90
172
|
}
|
|
91
|
-
const outputData = !_mnemonic ? {
|
|
173
|
+
const outputData = !_mnemonic && !shouldEncryptKeystores ? {
|
|
92
174
|
...keystore,
|
|
93
175
|
generatedMnemonic: mnemonic
|
|
94
176
|
} : keystore;
|
|
@@ -115,6 +197,10 @@ export async function newValidatorKeystore(options, log) {
|
|
|
115
197
|
// print a concise summary of public keys (addresses and BLS pubkeys) if no --json options was selected
|
|
116
198
|
if (!json) {
|
|
117
199
|
logValidatorSummaries(log, summaries);
|
|
200
|
+
if (fundingAccount) {
|
|
201
|
+
const funderAddress = fundingAccount.length === 66 ? privateKeyToAccount(fundingAccount).address : fundingAccount;
|
|
202
|
+
log(`funding account: ${funderAddress}`);
|
|
203
|
+
}
|
|
118
204
|
}
|
|
119
205
|
if (mnemonic && remoteSigner && !json) {
|
|
120
206
|
for(let i = 0; i < validatorCount; i++){
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LogFn } from '@aztec/foundation/log';
|
|
2
|
+
export type SetFundingAccountOptions = {
|
|
3
|
+
remoteSigner?: string;
|
|
4
|
+
password?: string;
|
|
5
|
+
encryptedKeystoreDir?: string;
|
|
6
|
+
json?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sets the top-level funding account of an existing keystore, replacing any previous one. The
|
|
10
|
+
* account may be a private key, or an address paired with a remote signer URL. With a password,
|
|
11
|
+
* a plaintext key is encrypted to an ETH JSON V3 file and stored as a { path, password } reference.
|
|
12
|
+
*/
|
|
13
|
+
export declare function setFundingAccount(existing: string, fundingAccount: string, options: SetFundingAccountOptions, log: LogFn): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0X2Z1bmRpbmdfYWNjb3VudC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NtZHMvdmFsaWRhdG9yX2tleXMvc2V0X2Z1bmRpbmdfYWNjb3VudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQVVuRCxNQUFNLE1BQU0sd0JBQXdCLEdBQUc7SUFDckMsWUFBWSxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQ3RCLFFBQVEsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNsQixvQkFBb0IsQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUM5QixJQUFJLENBQUMsRUFBRSxPQUFPLENBQUM7Q0FDaEIsQ0FBQztBQUVGOzs7O0dBSUc7QUFDSCx3QkFBc0IsaUJBQWlCLENBQ3JDLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLGNBQWMsRUFBRSxNQUFNLEVBQ3RCLE9BQU8sRUFBRSx3QkFBd0IsRUFDakMsR0FBRyxFQUFFLEtBQUssaUJBNEJYIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set_funding_account.d.ts","sourceRoot":"","sources":["../../../src/cmds/validator_keys/set_funding_account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAUnD,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,wBAAwB,EACjC,GAAG,EAAE,KAAK,iBA4BX"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { loadKeystoreFile } from '@aztec/node-keystore/loader';
|
|
2
|
+
import { dirname } from 'path';
|
|
3
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
4
|
+
import { encryptFundingAccountToFile, maybePrintJson, resolveFundingAccount, writeKeystoreFile } from './shared.js';
|
|
5
|
+
import { validateFundingAccountOptions } from './utils.js';
|
|
6
|
+
/**
|
|
7
|
+
* Sets the top-level funding account of an existing keystore, replacing any previous one. The
|
|
8
|
+
* account may be a private key, or an address paired with a remote signer URL. With a password,
|
|
9
|
+
* a plaintext key is encrypted to an ETH JSON V3 file and stored as a { path, password } reference.
|
|
10
|
+
*/ export async function setFundingAccount(existing, fundingAccount, options, log) {
|
|
11
|
+
const { remoteSigner, password, encryptedKeystoreDir, json } = options;
|
|
12
|
+
const keystore = loadKeystoreFile(existing);
|
|
13
|
+
const validated = {
|
|
14
|
+
fundingAccount,
|
|
15
|
+
remoteSigner
|
|
16
|
+
};
|
|
17
|
+
validateFundingAccountOptions(validated, !!keystore.remoteSigner);
|
|
18
|
+
let resolved = resolveFundingAccount(validated.fundingAccount, remoteSigner);
|
|
19
|
+
if (password !== undefined) {
|
|
20
|
+
const outDir = encryptedKeystoreDir && encryptedKeystoreDir.length > 0 ? encryptedKeystoreDir : dirname(existing);
|
|
21
|
+
resolved = await encryptFundingAccountToFile(resolved, {
|
|
22
|
+
outDir,
|
|
23
|
+
password
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (keystore.fundingAccount) {
|
|
27
|
+
log('Replacing existing funding account in keystore');
|
|
28
|
+
}
|
|
29
|
+
keystore.fundingAccount = resolved;
|
|
30
|
+
await writeKeystoreFile(existing, keystore);
|
|
31
|
+
if (!json) {
|
|
32
|
+
const value = validated.fundingAccount;
|
|
33
|
+
const funderAddress = value.length === 66 ? privateKeyToAccount(value).address : value;
|
|
34
|
+
log(`Set funding account ${funderAddress} in ${existing}`);
|
|
35
|
+
}
|
|
36
|
+
maybePrintJson(log, !!json, keystore);
|
|
37
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import type { LogFn } from '@aztec/foundation/log';
|
|
3
3
|
import type { EthAccount, EthPrivateKey, ValidatorKeyStore } from '@aztec/node-keystore/types';
|
|
4
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -28,6 +28,14 @@ export declare function withValidatorIndex(path: string, accountIndex?: number,
|
|
|
28
28
|
*/
|
|
29
29
|
export declare function computeBlsPublicKeyCompressed(privateKeyHex: string): Promise<string>;
|
|
30
30
|
export declare function deriveEthAttester(mnemonic: string, baseAccountIndex: number, addressIndex: number, remoteSigner?: string): EthAccount | EthPrivateKey;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve a `--funding-account` value into a keystore `EthAccount`. A 66-char value is a private key
|
|
33
|
+
* (used verbatim). A 42-char value is an address: with an explicit `remoteSigner` URL it becomes an
|
|
34
|
+
* `{ address, remoteSignerUrl }` pair; without one it is stored as a bare address that falls back to
|
|
35
|
+
* the keystore-level remote signer at runtime. Callers must validate the value first (see
|
|
36
|
+
* `validateFundingAccountOptions`).
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveFundingAccount(fundingAccount: string, remoteSigner?: string): EthAccount;
|
|
31
39
|
export declare function buildValidatorEntries(input: BuildValidatorsInput): Promise<{
|
|
32
40
|
validators: ValidatorKeyStore[];
|
|
33
41
|
summaries: ValidatorSummary[];
|
|
@@ -60,9 +68,14 @@ export declare function writeBlsBn254ToFile(validators: ValidatorKeyStore[], opt
|
|
|
60
68
|
}): Promise<void>;
|
|
61
69
|
/** Writes an Ethereum JSON V3 keystore using ethers, returns absolute path */
|
|
62
70
|
export declare function writeEthJsonV3Keystore(outDir: string, fileNameBase: string, password: string, privateKeyHex: string): Promise<string>;
|
|
71
|
+
/** Encrypt a plaintext funding-account key to a JSON V3 file, replacing it with a { path, password } reference. */
|
|
72
|
+
export declare function encryptFundingAccountToFile(account: EthAccount, options: {
|
|
73
|
+
outDir: string;
|
|
74
|
+
password: string;
|
|
75
|
+
}): Promise<EthAccount>;
|
|
63
76
|
/** Replace plaintext ETH keys in validators with { path, password } pointing to JSON V3 files. */
|
|
64
77
|
export declare function writeEthJsonV3ToFile(validators: ValidatorKeyStore[], options: {
|
|
65
78
|
outDir: string;
|
|
66
79
|
password: string;
|
|
67
80
|
}): Promise<void>;
|
|
68
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
81
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhcmVkLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY21kcy92YWxpZGF0b3Jfa2V5cy9zaGFyZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS0EsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQzNELE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25ELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUMvRixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQTJEaEUsTUFBTSxNQUFNLGdCQUFnQixHQUFHO0lBQUUsV0FBVyxDQUFDLEVBQUUsTUFBTSxDQUFDO0lBQUMsV0FBVyxDQU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QzlELE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0F3QmY7QUFFRCw4RUFBOEU7QUFDOUUsd0JBQXNCLHNCQUFzQixDQUMxQyxNQUFNLEVBQUUsTUFBTSxFQUNkLFlBQVksRUFBRSxNQUFNLEVBQ3BCLFFBQVEsRUFBRSxNQUFNLEVBQ2hCLGFBQWEsRUFBRSxNQUFNLEdBQ3BCLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FPakI7QUFlRCxtSEFBbUg7QUFDbkgsd0JBQXNCLDJCQUEyQixDQUMvQyxPQUFPLEVBQUUsVUFBVSxFQUNuQixPQUFPLEVBQUU7SUFBRSxNQUFNLEVBQUUsTUFBTSxDQUFDO0lBQUMsUUFBUSxFQUFFLE1BQU0sQ0FBQTtDQUFFLEdBQzVDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FFckI7QUFFRCxrR0FBa0c7QUFDbEcsd0JBQXNCLG9CQUFvQixDQUN4QyxVQUFVLEVBQUUsaUJBQWlCLEVBQUUsRUFDL0IsT0FBTyxFQUFFO0lBQUUsTUFBTSxFQUFFLE1BQU0sQ0FBQztJQUFDLFFBQVEsRUFBRSxNQUFNLENBQUE7Q0FBRSxHQUM1QyxPQUFPLENBQUMsSUFBSSxDQUFDLENBeUNmIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/cmds/validator_keys/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/cmds/validator_keys/shared.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,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