Back to Documentation

DogiWallet SDK API Reference

Explore the full API documentation for advanced usage and all available methods of the DogiWallet SDK.

Table of Contents

Initialization

new DogiWallet(options?)

Creates a new instance of the DogiWallet SDK.


import { DogiWallet } from '@dogiwallet/browser-sdk';

const wallet = new DogiWallet({
  network: 'mainnet', // or 'testnet'
  apiUrl: 'https://api.dogiwallet.com', // optional custom API URL
});
            

Parameters

  • options (optional): Configuration options for the wallet
  • options.network: 'mainnet' or 'testnet' (default: 'mainnet')
  • options.apiUrl: Custom API URL (optional)

Wallet Management

wallet.connect()

Connects to the DogiWallet browser extension.


const connected = await wallet.connect();
console.log('Wallet connected:', connected);
            

Returns

Promise<boolean>: True if connected successfully, false otherwise.

wallet.disconnect()

Disconnects from the DogiWallet browser extension.


await wallet.disconnect();
console.log('Wallet disconnected');
            

Returns

Promise<void>

wallet.getAddress()

Retrieves the current Dogecoin address associated with the wallet.


const address = await wallet.getAddress();
console.log('Wallet address:', address);
            

Returns

Promise<string>: The Dogecoin address.

Transactions

wallet.buildTransaction(options)

Builds a new transaction.


const tx = await wallet.buildTransaction({
  to: 'DBs4WcRE7eysKwRxHNX88XZVCQ9M6qoJv4',
  amount: 100, // Amount in DOGE
  feeRate: 0.01 // Optional: Specify custom fee rate
});
console.log('Built transaction:', tx);
            

Parameters

  • options.to: Recipient's Dogecoin address
  • options.amount: Amount to send in DOGE
  • options.feeRate (optional): Custom fee rate

Returns

Promise<Transaction>: The built transaction object.

wallet.signTransaction(transaction)

Signs a built transaction.


const signedTx = await wallet.signTransaction(tx);
console.log('Signed transaction:', signedTx);
            

Parameters

  • transaction: The transaction object to sign

Returns

Promise<SignedTransaction>: The signed transaction object.

wallet.broadcastTransaction(signedTransaction)

Broadcasts a signed transaction to the Dogecoin network.


const txId = await wallet.broadcastTransaction(signedTx);
console.log('Transaction broadcasted. Transaction ID:', txId);
            

Parameters

  • signedTransaction: The signed transaction object to broadcast

Returns

Promise<string>: The transaction ID of the broadcasted transaction.

Doginals

wallet.getDoginals()

Retrieves all Doginals NFTs associated with the wallet.


const doginals = await wallet.getDoginals();
console.log('Doginals:', doginals);
            

Returns

Promise<Doginal[]>: An array of Doginal objects.

wallet.transferDoginal(options)

Transfers a Doginal NFT to another address.


const transferTx = await wallet.transferDoginal({
  doginalId: 'abc123...',
  to: 'DBs4WcRE7eysKwRxHNX88XZVCQ9M6qoJv4'
});
const signedTransferTx = await wallet.signTransaction(transferTx);
const txId = await wallet.broadcastTransaction(signedTransferTx);
console.log('Doginal transfer transaction broadcasted:', txId);
            

Parameters

  • options.doginalId: The ID of the Doginal to transfer
  • options.to: The recipient's Dogecoin address

Returns

Promise<Transaction>: The built transaction for transferring the Doginal.

Dunes Tokens

wallet.getDunesBalance()

Retrieves the Dunes token balance for the wallet.


const dunesBalance = await wallet.getDunesBalance();
console.log('Dunes Balance:', dunesBalance);
            

Returns

wallet.mintDunes(options)

Mints new Dunes tokens.


const mintTx = await wallet.mintDunes({
  amount: 1000,
  ticker: 'MYDUNE'
});
const signedMintTx = await wallet.signTransaction(mintTx);
const txId = await wallet.broadcastTransaction(signedMintTx);
console.log('Dunes minting transaction broadcasted:', txId);
            

Parameters

  • options.amount: The amount of Dunes tokens to mint
  • options.ticker: The ticker for the Dunes token

Returns

Promise<Transaction>: The built transaction for minting Dunes tokens.

Utility Methods

wallet.getBalance()

Retrieves the DOGE balance for the wallet.


const balance = await wallet.getBalance();
console.log('DOGE Balance:', balance);
            

Returns

Promise<number>: The DOGE balance.

wallet.estimateFee(options)

Estimates the fee for a transaction.


const estimatedFee = await wallet.estimateFee({
  to: 'DBs4WcRE7eysKwRxHNX88XZVCQ9M6qoJv4',
  amount: 100
});
console.log('Estimated fee:', estimatedFee);
            

Parameters

  • options.to: Recipient's Dogecoin address
  • options.amount: Amount to send in DOGE

Returns

Promise<number>: The estimated fee in DOGE.