The window.chia provider reference
The DIG Browser (its built-in wallet) and the DIG Chrome extension (self-custody) inject a Chia wallet provider on window.chia. Any web page can ask it for the user's address, public keys, balances, coins, and NFTs, and can request signatures, transfers, and offers — the CHIP-0002 wallet-provider interface, delivered in-page instead of over WalletConnect.
This is the reference: the provider object's fields, connect, the events, and every method with its params, return shape, and error codes. For a walkthrough with the recommended detect → connect → fallback pattern, start with Using window.chia. For a typed wrapper that unifies this surface with the WalletConnect fallback, use @dignetwork/dig-sdk's ChiaProvider.
Every call runs against Chia mainnet. There is no testnet flow: chip0002_chainId resolves to "mainnet", and the chainId getter reads the same value once connected.
The provider object
window.chia is present synchronously on first script execution. Confirm you are talking to the DIG provider with its isDIG marker rather than the bare presence of window.chia (another Chia wallet could also claim the slot).
| Field | Type | Meaning |
|---|---|---|
isDIG | true | Marks the DIG provider. Key on this to target the DIG wallet specifically. |
isGoby | true | Goby-compatibility marker, so a page that feature-detects a Goby-style provider finds this one. |
name | "DIG" | The provider name. |
apiVersion | string | Semantic version of the window.chia surface (e.g. "1.0.0"). |
version | string | The wallet build version. |
info | object | { isDIG, transport: "injected" | "native", edition: "extension" | "browser", providerVersion } — how the provider is delivered and which edition injected it. |
methods | string[] | The method names this provider answers (the catalogue — feature-detect against it). |
errorCodes | object | The numeric error-code enum, exposed for reference. |
chainId | getter → string | "mainnet" once connected. |
selectedAddress | getter → string | The connected address (cached after connect). |
isConnected() | () => boolean | Whether this origin is connected. |
Two call styles are supported and equivalent:
request({ method, params })— the EIP-1193-style entrypoint (below).- Direct methods —
provider.getPublicKeys(...),provider.transfer(...),provider.createOffer(...), and so on. Bare Goby/Sage-style names alias to their namespaced forms (transfer→chia_send,getPublicKeys→chip0002_getPublicKeys), so code written for a Goby- or Sage-shaped provider works unchanged.
// Equivalent — pick whichever style your code prefers.
const keys = await window.chia.request({ method: "chip0002_getPublicKeys" });
const keys2 = await window.chia.getPublicKeys();
request({ method, params })
request takes a single { method, params } object and resolves to the bare result the wallet returns for that method, rejecting with an error on failure. A bare method name (e.g. getPublicKeys) is auto-prefixed to the chip0002_ namespace; a name already starting with chip0002_ or chia_ is used as-is. Prefer the explicit namespaced names in the tables below.
Discovering the method catalogue
Read window.chia.methods directly, or ask the provider (answered locally, no user prompt):
const methods = await window.chia.request({ method: "chip0002_getMethods" }); // string[]
connect
const ok = await window.chia.connect(); // prompt to approve this origin
const eager = await window.chia.connect({ eager: true }); // silently reuse a prior approval