index/functions/eip1193ProviderFromEthers.md
eip1193ProviderFromEthers(
provider,options?):BrowserWalletProvider
An EIP-1193 provider over an ethers v6 provider, for BrowserWalletSigner: apps whose
wallet connection is an ethers BrowserProvider sign through the very ethers calls they always
made, with no hand-written shim.
eth_chainIdisprovider.send('eth_chainId', []): the wallet's LIVE chain. Neverprovider.getNetwork(), which ethers caches and does not invalidate onchainChanged, so a user who switches networks after connecting would sign against a stale chainId.eth_signTypedData_v4parses the[account, JSON]params and callssigner.signTypedData(domain, types, message)withEIP712Domainremoved fromtypes.personal_signisoptions.personalSign(message)when given, elsesigner.signMessage.- Anything else is
UNSUPPORTED_WALLET_METHOD; a malformed request isMALFORMED_WALLET_REQUEST; a missing provider isWALLET_UNAVAILABLE.
provider may be null/undefined (nothing connected): a request that needs it then fails
with WALLET_UNAVAILABLE rather than at construction, so a signer can be built before the
connection state is known.
browser wallet provider eth chain id get network changed sign typed data v4 eip712 domain personal message unsupported method malformed request unavailable
Parameters
| Parameter | Type |
|---|---|
provider | EthersLikeProvider | null | undefined |
options? | EthersEip1193Options |
ethers like provider eip1193 options
Returns
browser wallet provider
Example
const signer = new BrowserWalletSigner(eip1193ProviderFromEthers(browserProvider), account, {
scheme: 'eip712',
});