Arkade allows you to easily check your wallet balances, both on-chain and off-chain. The balance information is structured to provide detailed insights into your funds.

// Get detailed balance information
const balance = await wallet.getBalance()
console.log('Total Onchain:', balance.onchain.total)
console.log('Total Offchain:', balance.offchain.total)

Balance Object Structure

The balance object contains detailed information about both on-chain and off-chain funds:

{
  onchain: {
    total: 100000,     // Total on-chain balance (confirmed + unconfirmed) in sats
    confirmed: 50000,  // Confirmed on-chain balance in sats
    unconfirmed: 50000 // Unconfirmed on-chain balance in sats
  },
  offchain: {
    total: 200000,    // Total off-chain balance in sats
    settled: 200000,   // Settled (available) off-chain balance in sats
    pending: 0         // Pending off-chain balance in sats
  }
}

Managing Coins

Getting Virtual UTXOs

Virtual UTXOs (VTXOs) are off-chain constructs that allow for virtual transactions within Arkade. You can retrieve all your VTXOs with a simple call:

// Get virtual UTXOs (off-chain)
const vtxos = await wallet.getVtxos()
console.log('Number of VTXOs:', vtxos.length)

// Log important information about each VTXO
vtxos.forEach((vtxo, index) => {
  console.log(`VTXO #${index + 1}:`);
  console.log(`  ID: ${vtxo.txid}:${vtxo.vout}`);
  console.log(`  Amount: ${vtxo.value} sats`);
  console.log(`  Batch ID: ${vtxo.virtualStatus.batchTxID}`);
  console.log(`  Status: ${vtxo.virtualStatus.state}`); // "pending" | "settled" | "swept" | "spent";
});

Getting Boarding UTXOs

Boarding UTXOs are on-chain UTXOs that have been sent to a boarding address but haven’t yet been converted to VTXOs:

// Get boarding UTXOs
const boardingUtxos = await wallet.getBoardingUtxos()
console.log('Number of boarding UTXOs:', boardingUtxos.length)

// Log important information about each boarding UTXO
boardingUtxos.forEach((utxo, index) => {
  console.log(`Boarding UTXO #${index + 1}:`);
  console.log(`  TXID: ${utxo.txid}`);
  console.log(`  Output Index: ${utxo.vout}`);
  console.log(`  Amount: ${utxo.value} sats`);
  console.log(`  Status: ${utxo.status.confirmed ? 'Confirmed' : 'Unconfirmed'}`);
});

Next Steps

Now that you understand how to work with balances and coins in Arkade, you can explore more advanced topics:

  • Detecting Payments - Learn how to monitor and detect incoming payments
  • Payment History - Retrieve and work with transaction history
  • Ramps - Understand how to move funds in and out of Arkade