DOGE Connecting

Docs / Wallet provider / Accounts, signing & events

window.dogesoft

Accounts, signing & events

Read the active account, prove ownership with signMessage, and subscribe to account/connection events.

Live

Proving ownership

signMessage() is the standard way to authenticate a wallet address without moving a coin or collecting a secret — sign a challenge string, verify the signature against the address server-side, and you have a login.

sign-in.js
const { accounts } = await dogesoft.connect();
const address = accounts[0];

const signature = await dogesoft.signMessage(
  `Sign in to My App — ${Date.now()}`,
  address
);

await fetch("/api/session", {
  method: "POST",
  body: JSON.stringify({ address, signature })
});

Include something unique — a timestamp or a server-issued nonce — in the message you ask the user to sign, so a captured signature can't be replayed later.

Events

Subscribe with on(event, handler) and remove a listener with off(event, handler). Three events are emitted:

EventFires whenPayload
accountsChangedThe user switches the active wallet/accountNew accounts array
connectYour origin gains an approved connectionAccounts array
disconnectThe user revokes access
events.js
function onAccountsChanged(accounts) {
  syncUi(accounts[0] ?? null);
}

dogesoft.on("accountsChanged", onAccountsChanged);
dogesoft.on("disconnect", () => syncUi(null));

// later, if your component unmounts
dogesoft.off("accountsChanged", onAccountsChanged);
💡

Always drive your UI off accountsChanged rather than caching the address from connect() — wallets can switch accounts at any time without a page reload.