Skip to main content

Overview

  • createTestWalletConnector creates a wagmi-compatible, in-memory EVM wallet connector backed by a mnemonic or private key.
  • createTestCosmosWallet creates a Cosmos wallet entry that appears in the Bridge wallet picker, derived lazily per chain prefix from a mnemonic.
  • Use these helpers when you want deterministic wallet behavior in automated tests (Playwright, Cypress, Vitest) or local development without browser extensions or external wallet apps.
These helpers are intended for testing and local development only. They read raw mnemonics and private keys directly from your environment. Never ship them, or wallets created with them, with real user funds.

Prerequisites

  • Must run in a browser-like environment for the EVM connector because it is implemented as an injected wagmi connector.
  • Provide test credentials via environment variables (e.g. TEST_MNEMONIC, TEST_PRIVATE_KEY, TEST_COSMOS_MNEMONIC) — never hardcode them in source.

createTestWalletConnector

An EVM wallet connector that handles chain switching, message signing, and transaction submission entirely in memory. Standard contract interactions and RPC reads (gas estimation, receipts, etc.) are proxied to the chain’s RPC node.

Config

string
BIP-39 mnemonic phrase. Provide either mnemonic or privateKey.
`0x${string}`
Hex-encoded private key with 0x prefix. Provide either mnemonic or privateKey.
string
default:"\"testWallet\""
Wagmi connector ID. Set this when running multiple test wallets in the same config.
string
default:"\"Test Wallet\""
Display name shown in the wallet selection UI.
Record<number, string>
CORS-friendly RPC URLs keyed by EVM chain ID. User-provided URLs override the built-in defaults (Ethereum mainnet, Arbitrum One, Base) for matching chain IDs.
boolean
default:"false"
When true, logs every RPC call to the console.
{ gas?: bigint; maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint }
Overrides applied to every eth_sendTransaction call. Useful for forcing failure scenarios in tests (e.g. { gas: 21000n } to trigger out-of-gas reverts on contract calls, or { maxFeePerGas: 1n } to land below the base fee).

Supported EIP-1193 methods

Return value

createTestCosmosWallet

Returns a CosmosWallet entry that appears in the Bridge wallet picker alongside Keplr and Leap. Pass it through the cosmosWallets prop on InterwovenKitProvider.

Config

string
required
BIP-39 mnemonic phrase used to derive Cosmos accounts.
string
default:"\"Test Cosmos Wallet\""
Display name shown in the Bridge wallet selection list. A matching name replaces the built-in wallet with the same name (e.g. naming this Keplr replaces the Keplr entry).
string
Wallet icon URL. Omit to show the default placeholder.
Record<string, { prefix: string }>
Override the bech32 prefix for specific chain IDs. By default the prefix is derived from the chain ID stem (e.g. noble-1noble). Use this for chains whose prefix differs from the stem (e.g. cosmoshub-4cosmos).
boolean
default:"false"
When true, logs signer creation to the console.

Return value

Notes

  • createTestWalletConnector accepts either a mnemonic or a privateKey, not both. Built-in CORS-safe RPCs are provided for Ethereum mainnet, Arbitrum One, and Base; pass rpcUrls to add or override others.
  • wallet_addEthereumChain does not auto-switch to the newly added chain, unlike MetaMask. Call wallet_switchEthereumChain afterwards to activate it.
  • eth_signTypedData and eth_signTypedData_v4 sign raw bytes rather than performing full EIP-712 encoding. InterwovenKit only relies on personal_sign for key derivation, so this is sufficient for its flows but signatures will not validate against on-chain EIP-712 verifiers (e.g. Permit2).
  • createTestCosmosWallet caches one signer per derived bech32 prefix, so repeated tests are deterministic and fast.
  • See InterwovenKitProvider for the cosmosWallets prop and the related CosmosWallet type.