index/classes/GalaWalletSigner.md
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.
gala sign chain dto wallet address method name
Implements
gala chain signer
Constructors
Constructor
new GalaWalletSigner(
walletAddress,options?):GalaWalletSigner
Creates a Gala Wallet signer.
Parameters
| Parameter | Type | Description |
|---|---|---|
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? | { scheme?: GalaWalletScheme; selectAddress?: string; wallet?: GalaWalletApi; } | 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. |
options.scheme? | GalaWalletScheme | - |
options.selectAddress? | string | - |
options.wallet? | GalaWalletApi | - |
Returns
GalaWalletSigner
Example
const signer = new GalaWalletSigner('0x0123456789012345678901234567890123456789');
const signed = await signer.signObject('RequestTrade', { token0: 'GALA', token1: 'GUSDC' });
wallet address gala signer scheme select api set
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
scheme | readonly | GalaWalletScheme | The signing scheme used for every request; it never changes after construction. |
selectAddress | readonly | string | undefined | The identity Gala Wallet is switched to before each signature, if one was given. |
walletAddress | readonly | string | The wallet address supplied to Gala Wallet for each signing request. |
gala wallet scheme select address
Methods
signObject()
signObject<
T>(methodName,dto):Promise<SignedDto<T>>
Signs a DTO through gala_signChainDto.
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('AddLiquidity', {
token0: 'GALA',
token1: 'GUSDC',
tickLower: -60,
tickUpper: 60,
});
Implementation of
sign object method name signed dto gala chain signer