Skip to main content

Gala Wallet browser extension

Gala Wallet is the browser extension that holds a person's GalaChain account and signs for the apps they use. This page covers getting it, what it does for a person, and how a web app connects to it and asks it to sign.

Install it​

Install Gala Wallet from the Chrome Web Store: https://chromewebstore.google.com/detail/gala-wallet/enogcihmejeobfbnkkbcgcjffgdieaoj. It is a Chrome (Manifest V3) extension.

On first open the wallet creates a new account or imports an existing one from a recovery phrase or private key, and asks for a password. The password unlocks the wallet; the recovery phrase is the only way to restore the account on another device, so it is shown once and must be kept offline.

What it does for a person​

  • Holds one or more accounts and shows their GalaChain balances.
  • Sends tokens and shows the result once the chain confirms it.
  • Asks before every signature. A connected app can read the account address on its own; it cannot sign anything without a popup the person approves.
  • Locks itself after a period of inactivity. A locked wallet keeps the apps it was connected to; the next signature asks for the password first.
  • Lets the person disconnect an app at any time from the wallet.

What an app sees​

The extension injects a provider into every page as window.gala (and the same object as window.ethereum, so EIP-1193 libraries work), and announces itself with EIP-6963 as com.gala.wallet. Prefer the EIP-6963 announcement: with several wallets installed, window.ethereum belongs to whichever loaded last.

The wallet picks its backend environment at run time from the page's origin: the known stage hostnames use stage, everything else uses prod. One published extension therefore works for both; an app on an unknown origin always gets prod.

Connect and sign from an app​

The core SDK wraps the extension as GalaWalletProvider (see Wallet providers). Detect the wallet, connect, then sign.

import { detectWallets, GalaWalletProvider, KNOWN_WALLET_RDNS } from '@gala-chain/gala-core-sdk/providers';

const { wallets } = await detectWallets();
const gala = wallets.find((wallet) => wallet.rdns === KNOWN_WALLET_RDNS.GALA);
if (gala === undefined) throw new Error('Gala Wallet is not installed');

const provider = new GalaWalletProvider(gala.provider);
const address = await provider.connect(); // opens the wallet's connect popup
const signature = await provider.signMessage('Sign in to my app');
const signer = provider.getSigner(); // a GalaChainSigner for gateway writes, gswap-sdk, ...

In React, WalletProvider autoDetect with useWalletConnection().connectDetected does the same and keeps the address in step with the wallet (see React).

If the wallet is missing, send the person to the install link above. Detection finds nothing and throws nothing outside a browser.

The provider methods​

The provider speaks EIP-1193 (request({ method, params })). It supports:

MethodWhat it does
eth_requestAccountsOpens the connect popup; returns the account as an EIP-55 checksummed 0x address
eth_accounts, eth_coinbaseThe connected account, or an empty list when not connected
eth_chainId, net_versionThe fixed chain identifiers (the wallet is a single-chain GalaChain wallet)
personal_signSigns a message after the person approves it
personal_ecRecoverRecovers the signer of a message and signature; needs no connection and shows no popup
eth_signTypedData, eth_signTypedData_v3, eth_signTypedData_v4Signs EIP-712 typed data after approval. Chain writes use the unversioned name
gala_signChainDtoSigns a GalaChain request body after approval
gala_getCanonicalAddressThe account's client| identity alias, which owns the account's tokens on chain
disconnectEnds this app's connection to the wallet

It emits accountsChanged (an empty list means the app was disconnected or the account was removed) and chainChanged.

These are refused on purpose with error 4200: eth_sign (blind signing), eth_sendTransaction (there is no EVM transaction to send), wallet_watchAsset, wallet_addEthereumChain, wallet_switchEthereumChain, and any other method. Calls that need a connection before the person connects fail with 4100. A signature the person declines rejects with SIGNING_FAILED and reason user_rejected when you use GalaWalletProvider, and with the wallet's own error object when you use the raw provider.

Addresses​

Connecting returns a checksummed 0x address, which the SDK reads as eth|<40 hex>. A wallet that is registered on GalaChain owns its tokens under a client| alias, not under the eth| form, so a balance read for a registered account must use the alias: call gala_getCanonicalAddress, or resolve it with the backend. Feature-detect with window.gala?.isGala before calling it.

Keep the checksum. GalaChain backends reject the all-lower-case form of an address.

Testing against stage​

Serve the app from a stage hostname so the wallet uses stage, and use a stage account. Never paste a real recovery phrase into a test script; the SDK's PrivateKeyProvider is the tool for unattended tests and bots.