Class: GalaWalletSigner
Gala Launchpad SDK 9.0.0-rc.5 / index / GalaWalletSigner
Class: GalaWalletSigner
Defined in: packages/launchpad-sdk/dist/signing/signers.d.ts:53
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
Implements
Constructors
Constructor
new GalaWalletSigner(
walletAddress,options?):GalaWalletSigner
Defined in: packages/launchpad-sdk/dist/signing/signers.d.ts:72
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
walletAddress
string
options?
object & object
Returns
GalaWalletSigner
Since
9.0.0
Overrides
CoreGalaWalletSigner.constructor
Properties
scheme
readonlyscheme:GalaWalletScheme
Defined in: packages/gala-core-sdk/dist/index.d.ts:1417
The signing scheme used for every request; it never changes after construction.
Inherited from
CoreGalaWalletSigner.scheme
selectAddress
readonlyselectAddress: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.
Inherited from
CoreGalaWalletSigner.selectAddress
walletAddress
readonlywalletAddress:string
Defined in: packages/gala-core-sdk/dist/index.d.ts:1415
The wallet address supplied to Gala Wallet for each signing request.
Inherited from
CoreGalaWalletSigner.walletAddress
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
Inherited from
CoreGalaWalletSigner.signObject
signTypedData()
signTypedData(
method,rawDto):Promise<SignedTypedDataBody>
Defined in: packages/launchpad-sdk/dist/signing/signers.d.ts:93
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
method
string
rawDto
Record<string, unknown>
Returns
Promise<SignedTypedDataBody>
Example
const body = await signer.signTypedData('BuyWithNative', { amount: '1' });
console.log(body.types.BuyWithNative);