Skip to main content

Class: GalaWalletSigner

GalaChain core SDK 1.0.0-rc.8


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

Class: GalaWalletSigner

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

A Gala Wallet signer using native GalaChain signing, with an opt-in personal-sign mode.

The selected Ethereum account is passed to Gala Wallet. There is NO automatic fallback: a wallet that rejects native surfaces its error to the caller, because the only alternative, personal-sign, silently recovers a phantom signer on every released Gala Wallet.

scheme: 'personal-sign' calls gala_signChainDto([serialize({ ...dto, prefix }), walletAddress, methodName]) and REQUIRES a Gala Wallet build that strips the embedded prefix field and hashes prefix + the prefix-less canonical body (the chain's scheme). Wallet builds that predate that fix hash the string with the prefix field still inside it and the signature recovers to an address nobody holds, so only opt in once the wallet you target has the fix.

Implements​

Constructors​

Constructor​

new GalaWalletSigner(walletAddress, options?): GalaWalletSigner

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

Creates a Gala Wallet signer.

Parameters​

walletAddress​

string

The account passed to Gala Wallet as the signer address. An Ethereum account is 0x plus 40 hex digits (Gala Wallet's eth|... form is normalized to it and held to the same check); a GalaChain id is client| plus 24 hex digits, or the bare 24 hex digits a web app keeps for a direct client| login, and is passed through unchanged.

options?​

Select native signing (default) or personal-sign explicitly. 'personal-sign' requires a Gala Wallet build that signs the bare serialized DTO. selectAddress is the identity (client|... / eth|...) Gala Wallet is switched to with setAddress before every signature, when the wallet offers it. wallet is the Gala Wallet object to sign through (the one an EIP-6963 announcement or a wallet provider holds); without it, window.gala is read at every signature.

scheme?​

GalaWalletScheme

selectAddress?​

string

wallet?​

GalaWalletApi

Returns​

GalaWalletSigner

Example​

const signer = new GalaWalletSigner('0x0123456789012345678901234567890123456789');
const signed = await signer.signObject('RequestTrade', { token0: 'GALA', token1: 'GUSDC' });

Properties​

scheme​

readonly scheme: GalaWalletScheme

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

The signing scheme used for every request; it never changes after construction.


selectAddress​

readonly selectAddress: string | undefined

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

The identity Gala Wallet is switched to before each signature, if one was given.


walletAddress​

readonly walletAddress: string

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

The wallet address supplied to Gala Wallet for each signing request.

Methods​

signObject()​

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

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

Signs a DTO through gala_signChainDto.

Type Parameters​

T​

T extends Record<string, unknown>

Parameters​

methodName​

string

dto​

T

Returns​

Promise<SignedDto<T>>

Example​

const signed = await signer.signObject('AddLiquidity', {
token0: 'GALA',
token1: 'GUSDC',
tickLower: -60,
tickUpper: 60,
});

Implementation of​

GalaChainSigner.signObject