Docs / Wallet provider / Quickstart & connect

window.dogesoft

Quickstart & connect

Detect window.dogesoft, request access, and read your first connected account.

Live

Doge Soft injects a single object, window.dogesoft, into the page — from the browser extension on desktop, and from the DogeSoft app's in-app browser on mobile. Same object, same methods on both. It's the only thing you need to feature-detect, connect, and start reading a user's Dogecoin account. No SDK install, no iframe, no API key.

ℹ️

window.dogesoft.version currently reports "1.1.0", and window.dogesoft.network is "mainnet" — there's no separate testnet provider today.

1. Detect the provider

The provider is injected before your page's scripts run (at document start in the extension, and as each page loads in the app browser), so a synchronous check at load time is almost always enough. For scripts that might run before injection completes, listen for the dogesoft#initialized event as a fallback.

detect.js
function waitForDogesoft() {
  return new Promise((resolve) => {
    if (window.dogesoft) return resolve(window.dogesoft);
    window.addEventListener("dogesoft#initialized", () => resolve(window.dogesoft), { once: true });
  });
}

const dogesoft = await waitForDogesoft();
console.log("ready:", dogesoft.version, dogesoft.network);

2. Connect

connect() prompts the user to approve your origin, then resolves with their account list. Nothing is shared before the user explicitly approves the prompt: until then getAccounts() returns [] and every other method rejects with not connected. The wallet enforces this, not the page.

An approved site stays connected across page reloads, so there is no need to call connect() again. Calling it again is still safe; for an approved site with an unlocked wallet it returns immediately without a prompt.

connect.js
const { accounts, address, publicKey } = await window.dogesoft.connect();
// accounts: ["D…"], address: "D…", publicKey: hex string (or null)

const isConnected = window.dogesoft.isConnected(); // synchronous boolean
const { balance } = await window.dogesoft.getBalance(); // DOGE

console.log(address, balance);

New to Doge Soft? Build on Doge Soft walks through the whole flow (connect, sign, send, PSBTs, reading the chain) in one page.

3. Read the active account

MethodReturns
isConnected()true once your site is approved (synchronous)
getAccounts()Array of connected addresses ([] when not connected or locked)
getAddress()The active address as a string, or null
getPublicKey()The active account's public key (hex)
getBalance()Spendable balance: { balance, balanceDoge } in DOGE (not koinu). The extension also returns balance_koinu, spendable and spendable_koinu
disconnect()Revokes your origin's access

Next: react to account changes and prove ownership with signMessage.