Builder class for creating and managing state overrides in Ethereum transactions. Allows for overriding balances, code, and paymaster deposits in a chainable manner.

const builder = new StateOverrideBuilder()
.overrideBalance('0x123...', 1000n)
.overrideCode('0x456...', '0x1234...')
.build();

Constructors

Methods

  • Overrides the balance for a specific address

    Parameters

    • address: `0x${string}`

      The Ethereum address to override the balance for

    • balance: bigint

      The new balance value as a bigint

    Returns StateOverrideBuilder

    The builder instance for method chaining

    builder.overrideBalance('0x123...', 1000000000000000000n); // Set balance to 1 ETH
    
  • Overrides the contract code for a specific address

    Parameters

    • address: `0x${string}`

      The Ethereum address to override the code for

    • code: `0x${string}`

      The new contract bytecode as a hex string

    Returns StateOverrideBuilder

    The builder instance for method chaining

    builder.overrideCode('0x123...', '0x608060405234801...');
    
  • Overrides the paymaster deposit amount in the EntryPoint contract

    Parameters

    • entryPointAddress: `0x${string}`

      The address of the EntryPoint contract

    • paymasterAddress: `0x${string}`

      The address of the Paymaster contract

    • storageValue: string = PAYMASTER_DEPOSIT_MAX

      The deposit amount to set, defaults to PAYMASTER_DEPOSIT_MAX

    Returns StateOverrideBuilder

    The builder instance for method chaining

    builder.overridePaymasterDeposit(
    '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
    '0x123...'
    );