> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spark.money/llms.txt
> Use this file to discover all available pages before exploring further.

# Balances & Activity

export const Method = ({children, className = ""}) => {
  return <code className={`spark-method not-prose inline-block px-2 py-1 mt-12 text-sm font-mono font-semibold rounded-md border ${className}`}>
      {children}
    </code>;
};

Query balances, view transfer history, and monitor wallet activity in real-time.

<Frame className="chill">
  <img className="block dark:hidden" src="https://mintcdn.com/lightspark/RCkJgy8FQAJRUhsh/images/wallets/balances-light.png?fit=max&auto=format&n=RCkJgy8FQAJRUhsh&q=85&s=b29e734355cddeec7b2b41f8d064b5f7" alt="Balances & Activity" width="3840" height="2160" data-path="images/wallets/balances-light.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/lightspark/RCkJgy8FQAJRUhsh/images/wallets/balances.png?fit=max&auto=format&n=RCkJgy8FQAJRUhsh&q=85&s=e17b7e367bcd0ccb8782cfe9e6db1170" alt="Balances & Activity" width="3840" height="2160" data-path="images/wallets/balances.png" />
</Frame>

***

## Check Wallet Balance

Get your current Bitcoin balance and token holdings in your Spark wallet.

<Method>getBalance()</Method>

Gets the current balance of the wallet, including Bitcoin balance and token balances.

```typescript theme={null}
const balance = await wallet.getBalance();
console.log("Balance:", balance.balance, "sats");
console.log("Token Balances:", balance.tokenBalances);
```

<Expandable title="Returns">
  <ResponseField name="balance" type="bigint" required>
    The wallet's current balance in satoshis
  </ResponseField>

  <ResponseField name="tokenBalances" type="Map" required>
    Map of Bech32m token identifiers to token balance objects. Each balance includes `ownedBalance` (total owned), `availableToSendBalance` (excludes pending transfers), and token metadata.
  </ResponseField>
</Expandable>

***

## View Transfer History

Track all incoming and outgoing transfers for your wallet with pagination support.

<Method>getTransfers(limit?, offset?)</Method>

Gets all transfers for the wallet with optional pagination.

<Info>
  `getTransfers()` includes Spark transfers, Lightning sends/receives, and cooperative exits. For token transaction details (e.g., sender address), use [`queryTokenTransactionsWithFilters()`](/api-reference/wallet/query-token-transactions-with-filters).
</Info>

```typescript theme={null}
// Get first 20 transfers
const transfers = await wallet.getTransfers();
console.log("Transfers:", transfers.transfers);

// Get next 10 transfers with pagination
const nextTransfers = await wallet.getTransfers(10, 20);
console.log("Next page:", nextTransfers.transfers);

// Get transfers from the last 24 hours
const yesterday = new Date(Date.now() - 24 * 60 * 60 * 1000);
const recentTransfers = await wallet.getTransfers(50, 0, yesterday);
```

<Expandable title="Parameters">
  <ResponseField name="limit" type="number" required={false}>
    Maximum number of transfers to return (default: 20)
  </ResponseField>

  <ResponseField name="offset" type="number" required={false}>
    Offset for pagination (default: 0)
  </ResponseField>

  <ResponseField name="createdAfter" type="Date" required={false}>
    Only return transfers created after this date (mutually exclusive with `createdBefore`)
  </ResponseField>

  <ResponseField name="createdBefore" type="Date" required={false}>
    Only return transfers created before this date (mutually exclusive with `createdAfter`)
  </ResponseField>
</Expandable>

<Expandable title="Returns">
  <ResponseField name="transfers" type="WalletTransfer[]" required>
    Array of transfer objects containing transfer details
  </ResponseField>

  <ResponseField name="offset" type="number" required>
    The offset used for this request
  </ResponseField>
</Expandable>

***

## Real-time Event Monitoring

Monitor wallet activity in real-time using EventEmitter methods for instant updates.

<Method>on(event, listener)</Method>

Adds a listener for the specified event to monitor wallet activity.

```typescript theme={null}
// Listen for incoming transfer claims
wallet.on("transfer:claimed", (transferId, updatedBalance) => {
  console.log(`Transfer ${transferId} claimed. New balance: ${updatedBalance}`);
});

// Listen for deposit confirmations (after 3 L1 confirmations)
wallet.on("deposit:confirmed", (depositId, updatedBalance) => {
  console.log(`Deposit ${depositId} confirmed. New balance: ${updatedBalance}`);
});
```

<Expandable title="Parameters">
  <ResponseField name="event" type="string" required>
    The event name to listen for (e.g., "transfer:claimed", "deposit:confirmed")
  </ResponseField>

  <ResponseField name="listener" type="Function" required>
    The callback function to execute when the event is emitted
  </ResponseField>
</Expandable>

<Expandable title="Returns">
  <ResponseField name="this" type="SparkWallet" required>
    The SparkWallet instance for method chaining
  </ResponseField>
</Expandable>

<Method>once(event, listener)</Method>

Adds a one-time listener for the specified event.

```typescript theme={null}
// Listen for a single incoming transfer
wallet.once("transfer:claimed", (transferId, updatedBalance) => {
  console.log(`Transfer ${transferId} claimed! New balance: ${updatedBalance}`);
});
```

<Expandable title="Parameters">
  <ResponseField name="event" type="string" required>
    The event name to listen for
  </ResponseField>

  <ResponseField name="listener" type="Function" required>
    The callback function to execute when the event is emitted
  </ResponseField>
</Expandable>

<Expandable title="Returns">
  <ResponseField name="this" type="SparkWallet" required>
    The SparkWallet instance for method chaining
  </ResponseField>
</Expandable>

<Method>off(event, listener)</Method>

Removes the specified listener from the specified event.

```typescript theme={null}
// Remove a specific listener
const handleTransfer = (transferId) => console.log(`Transfer: ${transferId}`);
wallet.on("transfer:claimed", handleTransfer);

// Later, remove the listener
wallet.off("transfer:claimed", handleTransfer);
```

<Expandable title="Parameters">
  <ResponseField name="event" type="string" required>
    The event name to remove the listener from
  </ResponseField>

  <ResponseField name="listener" type="Function" required>
    The specific callback function to remove
  </ResponseField>
</Expandable>

<Expandable title="Returns">
  <ResponseField name="this" type="SparkWallet" required>
    The SparkWallet instance for method chaining
  </ResponseField>
</Expandable>

***

## Available Events

Spark wallets emit various events for different types of activity:

#### Available Events

| Event                 | Description                                         |
| --------------------- | --------------------------------------------------- |
| `transfer:claimed`    | Emitted when an **incoming** transfer is claimed    |
| `deposit:confirmed`   | Emitted when a pending L1 deposit becomes spendable |
| `stream:connected`    | Emitted when the event stream connects              |
| `stream:disconnected` | Emitted when the stream disconnects                 |
| `stream:reconnecting` | Emitted when attempting to reconnect                |

<Warning>
  Events only fire for **incoming** funds. For outgoing operations (Lightning sends, withdrawals), poll the status using `getLightningSendRequest()` or `getCoopExitRequest()`.
</Warning>

***

## Use Sparkscan Explorer

Monitor your wallet activity using the Sparkscan block explorer for a visual interface.

<Button href="https://www.sparkscan.io/?network=mainnet" target="_blank">
  Open Sparkscan Explorer
</Button>

<Info>
  Sparkscan provides a web interface to view your wallet's transaction history, balance, and activity without needing to implement the API calls yourself.
</Info>

***

## Example: Complete Balance Monitoring

```typescript theme={null}
import { SparkWallet } from "@buildonspark/spark-sdk";

async function setupBalanceMonitoring() {
  const { wallet } = await SparkWallet.initialize({
    options: { network: "REGTEST" }
  });

  // Get initial balance
  const balance = await wallet.getBalance();
  console.log("Initial balance:", balance.balance, "sats");

  // Set up event listeners
  wallet.on("transfer:claimed", (transferId, newBalance) => {
    console.log(`Transfer ${transferId} claimed. New balance: ${newBalance} sats`);
  });

  // Get recent transfers
  const transfers = await wallet.getTransfers(10);
  console.log("Recent transfers:", transfers.transfers);

  return wallet;
}
```
