index/classes/BrowserWalletSigner.md
A personal-sign signer for MetaMask and other EIP-1193 browser wallets.
The chain recovers this signature using the EIP-191 wrap applied by the wallet to
personal_sign. This is the browser-wallet path used by the v2 frontend and resolves the
bare eth| identity.
personal sign
Implements
gala chain signer
Constructors
Constructor
new BrowserWalletSigner(
provider,walletAddress,options?):BrowserWalletSigner
Creates a browser-wallet signer.
Defaults to personal_sign — unchanged from every existing integration, since it only ever
resolves the bare eth| identity and changing that silently would be a real behavior
break for anyone already depending on it. Pass { scheme: 'eip712' } to correctly resolve
a registered client| alias instead, for RequestTrade/AddLiquidity/RemoveLiquidity/
CollectPositionFees (EIP712_CAPABLE_METHODS) — CreatePool and any other method still
falls back to personal_sign even in 'eip712' mode, since its EIP-712 signing is a
separate, unsolved chain-side problem.
Parameters
| Parameter | Type |
|---|---|
provider | BrowserWalletProvider |
walletAddress | string |
options? | { scheme?: "personal-sign" | "eip712"; } |
options.scheme? | "personal-sign" | "eip712" |
Returns
BrowserWalletSigner
Examples
const signer = new BrowserWalletSigner(window.ethereum, '0x0123456789012345678901234567890123456789');
const signed = await signer.signObject('RequestTrade', { token0: 'GALA', token1: 'GUSDC' });
// Correctly resolves a registered client| alias instead of the bare eth| address.
const signer = new BrowserWalletSigner(window.ethereum, walletAddress, { scheme: 'eip712' });
wallet address browser signer personal sign request trade add liquidity remove collect position fees eip712 capable methods create pool provider
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
walletAddress | readonly | string | The selected 0x Ethereum account every signature is requested for. |
wallet address
Methods
signObject()
signObject<
T>(methodName,dto):Promise<SignedDto<T>>
Signs the DTO with eth_signTypedData_v4 (when constructed with { scheme: 'eip712' } and
methodName is in EIP712_CAPABLE_METHODS) or the EIP-1193 personal_sign method
(otherwise — the default).
Type Parameters
| Type Parameter |
|---|
T extends Record<string, unknown> |
Parameters
| Parameter | Type |
|---|---|
methodName | string |
dto | T |
Returns
Promise<SignedDto<T>>
Example
const signed = await signer.signObject('RequestTrade', {
token0: 'GALA',
token1: 'GUSDC',
fee: 3000,
});
Implementation of
sign object method name signed dto eth typed data v4 eip712 capable methods personal gala chain signer