Skip to main content
OnchainTestKit uses a fluent builder pattern for configuration, making it easy to set up different wallet and network combinations for your tests.

Configuration Builder

The configure() function provides a chainable API for building test configurations:

Wallet Configuration

MetaMask Configuration

Coinbase Wallet Configuration

Network Configuration

Local Node Options

Configure a local Anvil node with specific parameters:

Network Details

Add custom networks to your wallet:

Environment Variables

Use environment variables to keep sensitive data out of your code and enable different configurations for different environments.

Required Variables

.env

Other Env Variables

.env

Using Configurations in Tests

Configuration Best Practices

1

Separate config files

Create separate configuration files for each wallet type to keep your code organized:
2

Use environment variables

Never hardcode sensitive data. Always use environment variables for:
  • Seed phrases
  • API keys
  • RPC endpoints
  • Private keys
3

Type your configurations

Export typed configurations for better IDE support:
4

Validate environment

Add validation for required environment variables:

Next Steps