index/classes/GalaWalletSigner.md
A Gala Wallet signer with the launchpad frontend's eth_signTypedData shape.
Example
const signer = new GalaWalletSigner('0x1234');
const body = await signer.signTypedData('BuyWithNative', { amount: '1' });
console.log(body.signature);
Extends
GalaWalletSigner
gala wallet signer
Implements
launchpad signer
Constructors
Constructor
new GalaWalletSigner(
walletAddress,options?):GalaWalletSigner
Same arguments as gala-core-sdk's GalaWalletSigner (scheme, selectAddress, wallet), and:
verifyActiveAccount(defaultfalse): before every typed-data signature, refuse unless the wallet's active account is this signer's key. See GalaWalletSigner.signTypedData. The key iswalletAddresswhen that is an Ethereum account (0x.../eth|...), elseselectAddresswhen that is one; a signer that names no key cannot be verified and is refused at construction (INVALID_SIGNER_OPTIONS).
Parameters
| Parameter | Type |
|---|---|
walletAddress | string |
options? | object & object |
Returns
GalaWalletSigner
Since
9.0.0
Overrides
CoreGalaWalletSigner.constructor
wallet address gala signer select verify active account invalid options core
Properties
gala wallet scheme core signer 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
Inherited from
CoreGalaWalletSigner.signObject
sign object method name signed dto gala chain launchpad signer core wallet
signTypedData()
signTypedData(
method,rawDto):Promise<SignedTypedDataBody>
With verifyActiveAccount, the first step is the active-account check (below); the RPC order is
then the check (window.gala.address, else eth_accounts when the wallet has not reported an
account yet), setAddress, eth_signTypedData. A mismatch, or a wallet reporting no account,
is WALLET_ACCOUNT_CHANGED and nothing is signed. The check runs before this signer's own
setAddress, so it sees the account the person has active, not one this signer just selected;
another signer's select on the same wallet object in flight at that moment is not observable.
Sign a launchpad DTO through Gala Wallet. Gala Wallet holds one current account, so the
account is selected first (setAddress, where the wallet offers it, with selectAddress or
else the Ethereum account the request names) and the select-then-sign pair is serialized per
wallet object with every other signer and provider that signs through it (gala-core-sdk's
withGalaWalletIdentity). The wallet is the wallet option, else window.gala.
Parameters
| Parameter | Type |
|---|---|
method | string |
rawDto | Record<string, unknown> |
Returns
Promise<SignedTypedDataBody>
Example
const body = await signer.signTypedData('BuyWithNative', { amount: '1' });
console.log(body.types.BuyWithNative);
Implementation of
sign typed data raw dto signed body verify active account eth accounts set address wallet changed select with gala identity launchpad signer