Skip to content

Commit

Permalink
Move cache_dir config option to ForkConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
iosh committed Dec 15, 2024
1 parent 8a0cf75 commit f48a18e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/edr_napi/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export interface ForkConfig {
blockNumber?: bigint
/** The HTTP headers to use when making requests to the JSON-RPC endpoint */
httpHeaders?: Array<HttpHeader>
/** The directory to cache remote JSON-RPC responses */
cacheDir?: string
}
export interface HttpHeader {
name: string
Expand Down Expand Up @@ -192,8 +194,6 @@ export interface ProviderConfig {
bailOnTransactionFailure: boolean
/** The gas limit of each block */
blockGasLimit: bigint
/** The directory to cache remote JSON-RPC responses */
cacheDir?: string
/** The chain ID of the blockchain */
chainId: bigint
/** The configuration for chains */
Expand Down
6 changes: 3 additions & 3 deletions crates/edr_napi/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ pub struct ForkConfig {
pub block_number: Option<BigInt>,
/// The HTTP headers to use when making requests to the JSON-RPC endpoint
pub http_headers: Option<Vec<HttpHeader>>,
/// The directory to cache remote JSON-RPC responses
pub cache_dir: Option<String>,
}

#[napi(object)]
Expand Down Expand Up @@ -91,8 +93,6 @@ pub struct ProviderConfig {
pub bail_on_transaction_failure: bool,
/// The gas limit of each block
pub block_gas_limit: BigInt,
/// The directory to cache remote JSON-RPC responses
pub cache_dir: Option<String>,
/// The chain ID of the blockchain
pub chain_id: BigInt,
/// The configuration for chains
Expand Down Expand Up @@ -256,7 +256,7 @@ impl TryFrom<ProviderConfig> for edr_napi_core::provider::Config {
bail_on_call_failure: value.bail_on_call_failure,
bail_on_transaction_failure: value.bail_on_transaction_failure,
block_gas_limit,
cache_dir: value.cache_dir,
cache_dir: value.fork.as_ref().and_then(|fork_config| fork_config.cache_dir.clone()),
chain_id: value.chain_id.try_cast()?,
chains,
coinbase: value.coinbase.try_cast()?,
Expand Down

0 comments on commit f48a18e

Please sign in to comment.