Function: eip1193ProviderFromEthers()
GalaChain core SDK 1.0.0-rc.8 / index / eip1193ProviderFromEthers
Function: eip1193ProviderFromEthers()
eip1193ProviderFromEthers(
provider,options?):BrowserWalletProvider
Defined in: packages/gala-core-sdk/dist/index.d.ts:2012
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.
Parameters
provider
EthersLikeProvider | null | undefined
options?
Returns
Example
const signer = new BrowserWalletSigner(eip1193ProviderFromEthers(browserProvider), account, {
scheme: 'eip712',
});