Skip to content

Commit

Permalink
Fix circular dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Feb 18, 2025
1 parent 6dbffcd commit 5c25f61
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 21 deletions.
3 changes: 2 additions & 1 deletion yarn-project/ethereum/src/contracts/forwarder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import { type PrivateKeyAccount, privateKeyToAccount } from 'viem/accounts';
import { foundry } from 'viem/chains';

import { DefaultL1ContractsConfig } from '../config.js';
import { type L1Clients, createL1Clients, deployL1Contract, deployL1Contracts } from '../deploy_l1_contracts.js';
import { createL1Clients, deployL1Contract, deployL1Contracts } from '../deploy_l1_contracts.js';
import { L1TxUtils } from '../l1_tx_utils.js';
import { startAnvil } from '../test/start_anvil.js';
import { type L1Clients } from '../types.js';
import { FormattedViemError } from '../utils.js';
import { ForwarderContract } from './forwarder.js';

Expand Down
3 changes: 2 additions & 1 deletion yarn-project/ethereum/src/contracts/forwarder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import {
getContract,
} from 'viem';

import { type L1Clients, deployL1Contract } from '../deploy_l1_contracts.js';
import { deployL1Contract } from '../deploy_l1_contracts.js';
import { type L1BlobInputs, type L1GasConfig, type L1TxRequest, type L1TxUtils } from '../l1_tx_utils.js';
import { type L1Clients } from '../types.js';
import { RollupContract } from './rollup.js';

export class ForwarderContract {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/contracts/governance_proposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
getContract,
} from 'viem';

import type { L1Clients } from '../deploy_l1_contracts.js';
import type { GasPrice, L1TxRequest, L1TxUtils } from '../l1_tx_utils.js';
import { type L1Clients } from '../types.js';
import { type IEmpireBase, encodeVote } from './empire_base.js';

export class GovernanceProposerContract implements IEmpireBase {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/contracts/slashing_proposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
getContract,
} from 'viem';

import type { L1Clients } from '../deploy_l1_contracts.js';
import type { L1TxRequest } from '../l1_tx_utils.js';
import type { L1Clients } from '../types.js';
import { type IEmpireBase, encodeVote } from './empire_base.js';

export class SlashingProposerContract implements IEmpireBase {
Expand Down
17 changes: 1 addition & 16 deletions yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,10 @@ import type { Abi, Narrow } from 'abitype';
import {
type Account,
type Chain,
type Client,
type Hex,
type HttpTransport,
type PublicActions,
type PublicClient,
type PublicRpcSchema,
type WalletActions,
type WalletClient,
type WalletRpcSchema,
concatHex,
createPublicClient,
createWalletClient,
Expand All @@ -68,6 +63,7 @@ import { isAnvilTestChain } from './chain.js';
import { type L1ContractsConfig } from './config.js';
import { type L1ContractAddresses } from './l1_contract_addresses.js';
import { L1TxUtils, type L1TxUtilsConfig, defaultL1TxUtilsConfig } from './l1_tx_utils.js';
import type { L1Clients } from './types.js';

export const DEPLOYER_ADDRESS: Hex = '0x4e59b44847b379578588920cA78FbF26c0B4956C';

Expand Down Expand Up @@ -210,17 +206,6 @@ export interface DeployL1ContractsArgs extends L1ContractsConfig {
l1TxConfig?: Partial<L1TxUtilsConfig>;
}

export type L1Clients = {
publicClient: PublicClient<HttpTransport, Chain>;
walletClient: Client<
HttpTransport,
Chain,
PrivateKeyAccount,
[...WalletRpcSchema, ...PublicRpcSchema],
PublicActions<HttpTransport, Chain> & WalletActions<Chain, PrivateKeyAccount>
>;
};

/**
* Creates a wallet and a public viem client for interacting with L1.
* @param rpcUrl - RPC URL to connect to L1.
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/ethereum/src/l1_tx_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
hexToBytes,
} from 'viem';

import { type L1Clients } from './deploy_l1_contracts.js';
import { type L1Clients } from './types.js';
import { formatViemError } from './utils.js';

// 1_000_000_000 Gwei = 1 ETH
Expand Down
6 changes: 6 additions & 0 deletions yarn-project/ethereum/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ export type ViemClient = Client<

/** Type for a viem public client */
export type ViemPublicClient = PublicClient<HttpTransport, Chain>;

/** Both L1 clients */
export type L1Clients = {
publicClient: ViemPublicClient;
walletClient: ViemClient;
};

0 comments on commit 5c25f61

Please sign in to comment.