Skip to main content

Class: BrowserWalletSigner

GalaChain core SDK 1.0.0-rc.8


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

Class: BrowserWalletSigner

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

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.

Implements​

Constructors​

Constructor​

new BrowserWalletSigner(provider, walletAddress, options?): BrowserWalletSigner

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

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​

provider​

BrowserWalletProvider

walletAddress​

string

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' });

Properties​

walletAddress​

readonly walletAddress: string

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

The selected 0x Ethereum account every signature is requested for.

Methods​

signObject()​

signObject<T>(methodName, dto): Promise<SignedDto<T>>

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

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​

T​

T extends Record<string, unknown>

Parameters​

methodName​

string

dto​

T

Returns​

Promise<SignedDto<T>>

Example​

const signed = await signer.signObject('RequestTrade', {
token0: 'GALA',
token1: 'GUSDC',
fee: 3000,
});

Implementation of​

GalaChainSigner.signObject