From 0c1b9178d837baad56b72d9233104c40526c7a3c Mon Sep 17 00:00:00 2001 From: 0xDmitry Date: Thu, 26 Oct 2023 18:22:27 +0300 Subject: [PATCH] fix(cli): move anvilOptions to commandsConfig file --- packages/cli/src/commandsConfig.ts | 158 ++++++++++++++++++++++++++++- packages/cli/src/util/anvil.ts | 158 ----------------------------- 2 files changed, 157 insertions(+), 159 deletions(-) diff --git a/packages/cli/src/commandsConfig.ts b/packages/cli/src/commandsConfig.ts index 34bf17522..e3ffc0771 100644 --- a/packages/cli/src/commandsConfig.ts +++ b/packages/cli/src/commandsConfig.ts @@ -1,4 +1,160 @@ -import { anvilOptions } from './util/anvil'; +const anvilOptions = [ + { + flags: '-p --port ', + description: 'Port which the JSON-RPC server will be exposed.', + defaultValue: '8545', + }, + { + flags: '-c --chain-id ', + description: 'The chain id to run against', + }, + { + flags: '--compute-units-per-second [number]', + description: 'Sets the number of assumed available compute units per second for this fork provider.', + }, + { + flags: '--fork-url [url]', + description: 'Fetch state over a remote endpoint instead of starting from an empty state.', + }, + { + flags: '--fork-block-number [number]', + description: 'Fetch state from a specific block number over a remote endpoint.', + }, + { + flags: '--fork-chain-id [number]', + description: 'Specify chain id to skip fetching it from remote endpoint.', + }, + { + flags: '--fork-retry-backoff [number]', + description: 'Initial retry backoff on encountering errors.', + }, + { + flags: '--no-rate-limit', + description: "Disables rate limiting for this node's provider.", + }, + { + flags: '--no-storage-caching', + description: 'Explicitly disables the use of RPC caching. All storage slots are read entirely from the endpoint.', + }, + { + flags: '--retries [number]', + description: 'Number of retry requests for spurious networks (timed out requests).', + }, + { + flags: '--timeout [number]', + description: 'Timeout in ms for requests sent to remote JSON-RPC server in forking mode.', + }, + { + flags: '--block-base-fee-per-gas [number]', + description: 'The base fee in a block.', + }, + { + flags: '--code-size-limit [number]', + description: 'EIP-170: Contract code size limit in bytes. Useful to increase this because of tests.', + }, + { + flags: '--disable-block-gas-limit', + description: 'Disable the call.gas_limit <= block.gas_limit constraint.', + }, + { + flags: '--gas-limit [number]', + description: 'The block gas limit.', + }, + { + flags: '--gas-price [number]', + description: 'The gas price.', + }, + { + flags: '--accounts [number]', + description: 'Number of dev accounts to generate and configure.', + }, + { + flags: '--balance [number]', + description: 'The balance of every dev account in Ether.', + }, + { + flags: '--derivation-path [path]', + description: 'Sets the derivation path of the child key to be derived.', + }, + { + flags: '--mnemonic [phrase]', + description: 'BIP39 mnemonic phrase used for generating accounts.', + }, + { + flags: '--steps-tracing', + description: 'Enable steps tracing used for debug calls returning geth-style traces.', + }, + { + flags: '--timestamp [number]', + description: 'The timestamp of the genesis block.', + }, + { + flags: '--allow-origin [string]', + description: 'Set the Access-Control-Allow-Origin response header (CORS).', + }, + { + flags: '--block-time [number]', + description: 'Block time in seconds for interval mining.', + }, + { + flags: '--config-out [path]', + description: 'Writes output of anvil as json to user-specified file.', + }, + { + flags: '--dump-state [path]', + description: 'Dump the state of chain on exit to the given file.', + }, + { + flags: '--hardfork [type]', + description: 'The EVM hardfork to use.', + }, + { + flags: '--host [string]', + description: 'The host the server will listen on.', + }, + { + flags: '--init [path]', + description: 'Initialize the genesis block with the given genesis.json file.', + }, + { + flags: '--ipc [path]', + description: 'Launch an ipc server at the given path or default path = /tmp/anvil.ipc.', + }, + { + flags: '--load-state [path]', + description: 'Initialize the chain from a previously saved state snapshot.', + }, + { + flags: '--no-cors', + description: 'Disable CORS.', + }, + { + flags: '--no-mining', + description: 'Disable auto and interval mining, and mine on demand instead.', + }, + { + flags: '--order [string]', + description: 'How transactions are sorted in the mempool.', + }, + { + flags: '--prune-history [value]', + description: + "Don't keep full chain history. If a number argument is specified, at most this number of states is kept in memory.", + }, + { + flags: '--state-interval [number]', + description: 'Interval in seconds at which the status is to be dumped to disk.', + }, + { + flags: '--state [path]', + description: + "Alias for both loadState and dumpState. Initializes the chain with the state stored at the file, if it exists, and dumps the chain's state on exit.", + }, + { + flags: '--transaction-block-keeper [number]', + description: 'Number of blocks with transactions to keep in memory.', + }, +]; const commandsConfig = { run: { diff --git a/packages/cli/src/util/anvil.ts b/packages/cli/src/util/anvil.ts index a9c7e6e42..5ee958a66 100644 --- a/packages/cli/src/util/anvil.ts +++ b/packages/cli/src/util/anvil.ts @@ -254,161 +254,3 @@ const anvilOptionKeys = [ export function pickAnvilOptions(obj: object) { return _.pick(obj, anvilOptionKeys) as AnvilOptions; } - -export const anvilOptions = [ - { - flags: '-p --port ', - description: 'Port which the JSON-RPC server will be exposed.', - defaultValue: '8545', - }, - { - flags: '-c --chain-id ', - description: 'The chain id to run against', - }, - { - flags: '--compute-units-per-second [number]', - description: 'Sets the number of assumed available compute units per second for this fork provider.', - }, - { - flags: '--fork-url [url]', - description: 'Fetch state over a remote endpoint instead of starting from an empty state.', - }, - { - flags: '--fork-block-number [number]', - description: 'Fetch state from a specific block number over a remote endpoint.', - }, - { - flags: '--fork-chain-id [number]', - description: 'Specify chain id to skip fetching it from remote endpoint.', - }, - { - flags: '--fork-retry-backoff [number]', - description: 'Initial retry backoff on encountering errors.', - }, - { - flags: '--no-rate-limit', - description: "Disables rate limiting for this node's provider.", - }, - { - flags: '--no-storage-caching', - description: 'Explicitly disables the use of RPC caching. All storage slots are read entirely from the endpoint.', - }, - { - flags: '--retries [number]', - description: 'Number of retry requests for spurious networks (timed out requests).', - }, - { - flags: '--timeout [number]', - description: 'Timeout in ms for requests sent to remote JSON-RPC server in forking mode.', - }, - { - flags: '--block-base-fee-per-gas [number]', - description: 'The base fee in a block.', - }, - { - flags: '--code-size-limit [number]', - description: 'EIP-170: Contract code size limit in bytes. Useful to increase this because of tests.', - }, - { - flags: '--disable-block-gas-limit', - description: 'Disable the call.gas_limit <= block.gas_limit constraint.', - }, - { - flags: '--gas-limit [number]', - description: 'The block gas limit.', - }, - { - flags: '--gas-price [number]', - description: 'The gas price.', - }, - { - flags: '--accounts [number]', - description: 'Number of dev accounts to generate and configure.', - }, - { - flags: '--balance [number]', - description: 'The balance of every dev account in Ether.', - }, - { - flags: '--derivation-path [path]', - description: 'Sets the derivation path of the child key to be derived.', - }, - { - flags: '--mnemonic [phrase]', - description: 'BIP39 mnemonic phrase used for generating accounts.', - }, - { - flags: '--steps-tracing', - description: 'Enable steps tracing used for debug calls returning geth-style traces.', - }, - { - flags: '--timestamp [number]', - description: 'The timestamp of the genesis block.', - }, - { - flags: '--allow-origin [string]', - description: 'Set the Access-Control-Allow-Origin response header (CORS).', - }, - { - flags: '--block-time [number]', - description: 'Block time in seconds for interval mining.', - }, - { - flags: '--config-out [path]', - description: 'Writes output of anvil as json to user-specified file.', - }, - { - flags: '--dump-state [path]', - description: 'Dump the state of chain on exit to the given file.', - }, - { - flags: '--hardfork [type]', - description: 'The EVM hardfork to use.', - }, - { - flags: '--host [string]', - description: 'The host the server will listen on.', - }, - { - flags: '--init [path]', - description: 'Initialize the genesis block with the given genesis.json file.', - }, - { - flags: '--ipc [path]', - description: 'Launch an ipc server at the given path or default path = /tmp/anvil.ipc.', - }, - { - flags: '--load-state [path]', - description: 'Initialize the chain from a previously saved state snapshot.', - }, - { - flags: '--no-cors', - description: 'Disable CORS.', - }, - { - flags: '--no-mining', - description: 'Disable auto and interval mining, and mine on demand instead.', - }, - { - flags: '--order [string]', - description: 'How transactions are sorted in the mempool.', - }, - { - flags: '--prune-history [value]', - description: - "Don't keep full chain history. If a number argument is specified, at most this number of states is kept in memory.", - }, - { - flags: '--state-interval [number]', - description: 'Interval in seconds at which the status is to be dumped to disk.', - }, - { - flags: '--state [path]', - description: - "Alias for both loadState and dumpState. Initializes the chain with the state stored at the file, if it exists, and dumps the chain's state on exit.", - }, - { - flags: '--transaction-block-keeper [number]', - description: 'Number of blocks with transactions to keep in memory.', - }, -];