Skip to main content

index/functions/withGalaWalletIdentity.md

withGalaWalletIdentity<T>(wallet, identity, signWith): Promise<T>

Runs signWith with identity selected on a Gala Wallet that supports setAddress. Gala Wallet holds ONE current account, so two signatures for different identities in flight at once would sign as whichever selection came last; the pair (select, sign) is therefore serialized per wallet object, across every signer and provider that signs through it (GalaWalletSigner, ./providers' GalaWalletProvider). A failed selection fails the signature (nothing is requested). Without an identity, or on a wallet without setAddress, it just runs signWith.

Type Parameters​

Type Parameter
T

Parameters​

ParameterType
walletGalaWalletApi
identitystring | undefined
signWith() => Promise<T>

Returns​

Promise<T>

Example​

const signature = await withGalaWalletIdentity(window.gala, 'eth|70997970C51812dc3A010C7d01b50e0d17dc79C8', () =>
window.gala.request({ method: 'personal_sign', params: [hexMessage, address] }),
);