Skip to main content

Function: eip712DomainFor()

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / index / eip712DomainFor

Function: eip712DomainFor()

eip712DomainFor(chainId): EIP712DomainValue

Defined in: packages/gala-core-sdk/dist/index.d.ts:1718

Builds the EIP-712 domain from the wallet's LIVE eth_chainId result: a wallet hashes whatever domain it is handed, and MetaMask refuses a chainId that differs from its active network, so a hardcoded 1 breaks every wallet that is not on Mainnet. The backend recovers the signer from the domain the payload carries (live-proven for chain ids 1, 56 and 11155111), so following the wallet is correct on every network.

Parameters​

chainId​

unknown

The raw eth_chainId result: a 0x hex string (the JSON-RPC form) or an integer.

Returns​

EIP712DomainValue

Throws​

GalaSDKError (INVALID_CHAIN_ID) when the wallet answers with anything else.