← Back to DogeDrop
DEVELOPER REFERENCE · MAINNET

DogeDrop API

Overview

DogeDrop exposes a browser API through an embeddable JavaScript connector. The wallet runs in an iframe; your site interacts with window.doge. User approval is required for connection, transactions, and message signing.

Installation

Include the connector on your page. It mounts the wallet interface and exposes window.doge.

<script src="https://wallet.simosnap.org/wallet/connect.js"></script>

Initialization

Wait for the doge#initialized browser event before calling the API. If the wallet has already initialized, window.doge is available.

window.addEventListener('doge#initialized', () => {
  console.log('Wallet ready:', window.doge);
});

if (window.doge?.isDogePocket) {
  console.log(window.doge.network); // mainnet
}

Connect and disconnect

Connect asks the user to authorize the current website. Permissions are stored per website origin. Disconnect revokes that authorization.

const account = await window.doge.connect();
console.log(account.address, account.balance);

await window.doge.disconnect();

Address and status

Check whether the current origin is authorized before accessing account information. getAddress requires an authorized connection.

const status = await window.doge.getConnectionStatus();
if (status.connected) {
  const { address, publicKey } = await window.doge.getAddress();
  console.log(address, publicKey);
}

Balance

getBalance requires an authorized connection and refreshes blockchain data. Koinu are the smallest Dogecoin units (100,000,000 koinu = 1 DOGE). Large balances may be returned as strings.

const balance = await window.doge.getBalance();
console.log(balance.balanceDoge, 'DOGE');
console.log(balance.balanceKoinu, 'koinu');
{
  balance: 150000000,
  balanceKoinu: "150000000",
  balanceDoge: "1.5",
  balanceVm: null,
  balanceVmKoinu: null,
  balanceVmDoge: null
}

Send a transaction

requestTransaction opens a wallet approval flow. Specify a destination and amount in DOGE. The request may also accept a payment URI. A successful broadcast returns the transaction ID.

const result = await window.doge.requestTransaction({
  recipientAddress: 'D...recipient-address...',
  dogeAmount: '1.5',
  fee: 'normal'
});
console.log(result.txid);

Sign a message

requestSignedMessage requests a local signature after user approval. Never assume a signature was produced until the promise resolves.

const result = await window.doge.requestSignedMessage({
  message: 'Sign in to example.com'
});
console.log(result.signature, result.address);

Events

The connector emits connect and disconnect through on/off when those API methods complete. The initialization event is dispatched on window.

const onConnect = (account) => console.log('Connected:', account);
window.doge.on('connect', onConnect);
window.doge.off('connect', onConnect);

window.doge.on('disconnect', (result) => console.log(result));

Errors and timeouts

API calls return promises. Rejections can occur when the user cancels, the wallet rejects a request, the website is not connected, or a request times out. Handle failures with try/catch.

try {
  await window.doge.connect();
} catch (error) {
  console.error('Wallet request failed:', error.message);
}

Script configuration

Optional data attributes on the connector script control its wallet URL, button and DogecoinVM availability.

<script
  src="https://wallet.simosnap.org/wallet/connect.js"
  data-label="DogeDrop"
  data-button="false"
  data-dogevm="false"
></script>
AttributeDescription
data-wallet
data-label
data-button="false"
data-dogevm="false"

API reference

Public interface exposed by the connector.

Method / propertyPurpose
connect()
disconnect()
getConnectionStatus()
getAddress()
getBalance()
requestTransaction(tx)
requestSignedMessage({ message })
open()
on(name, fn)
off(name, fn)
request({ method, params })
isDogePocket
isDogecoin
network

Security notes

Wallet keys remain inside the wallet. The connector verifies iframe messages against the wallet origin. Each site has its own authorization. Do not request sensitive information outside the wallet UI.