Skip to main content

Function: withGalaWalletIdentity()

GalaChain core SDK 1.0.0-rc.8


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

Function: withGalaWalletIdentity()

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

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

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​

T​

T

Parameters​

wallet​

GalaWalletApi

identity​

string | 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] }),
);