> ## 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.

# Wallet API

> SparkWallet class methods for deposits, transfers, Lightning, and tokens.

export const Card = ({icon, iconLight, iconDark, href, title, description, target = "_self"}) => {
  return <div className="spark-card rounded-2xl flex justify-center p-4 hover:scale-[1.02] transition-all duration-300">
      <a href={href} target={target} rel={target === "_blank" ? "noopener noreferrer" : undefined} className="w-full">
        <div className="flex flex-col gap-12 justify-space-between">
          <div className="w-8 h-8">
            {iconLight && iconDark ? <>
                <img src={iconLight} className="icon-light w-full h-full pointer-events-none" alt={title} width={32} height={32} />
                <img src={iconDark} className="icon-dark w-full h-full pointer-events-none" alt={title} width={32} height={32} />
              </> : <img src={icon} className="w-full h-full pointer-events-none" alt={title} width={32} height={32} />}
          </div>
          <div className="flex flex-col gap-2">
            <h2 className="card-title text font-semibold leading-tight">
              {title}
            </h2>
            <p className="card-description text-sm leading-tight">
              {description}
            </p>
          </div>
        </div>
      </a>
    </div>;
};

export const HCard = ({icon, light, dark, href, title, description, target = "_self"}) => {
  return <div className="spark-card rounded-2xl flex justify-center items-center p-4 hover:scale-[1.02] transition-all duration-300">
      <a href={href} target={target} rel={target === "_blank" ? "noopener noreferrer" : undefined} className="w-full">
        <div className="hcard-row" style={{
    display: 'flex',
    flexDirection: 'row',
    alignItems: 'center',
    gap: '1rem'
  }}>
          <div className="hcard-icon" style={{
    flexShrink: 0,
    width: '40px',
    height: '40px'
  }}>
            {light && dark ? <>
                <img src={light} className="icon-light pointer-events-none" alt={title} width={40} height={40} style={{
    width: '40px',
    height: '40px',
    margin: 0
  }} />
                <img src={dark} className="icon-dark pointer-events-none" alt={title} width={40} height={40} style={{
    width: '40px',
    height: '40px',
    margin: 0
  }} />
              </> : <img src={icon} className="pointer-events-none" alt={title} width={40} height={40} style={{
    width: '40px',
    height: '40px',
    margin: 0
  }} />}
          </div>
          <div className="hcard-text" style={{
    display: 'flex',
    flexDirection: 'column',
    gap: '0.5rem'
  }}>
            <h2 className="card-title text font-semibold leading-none" style={{
    margin: 0
  }}>
              {title}
            </h2>
            <p className="card-description text-sm leading-none" style={{
    margin: 0
  }}>
              {description}
            </p>
          </div>
        </div>
      </a>
    </div>;
};

The `SparkWallet` class is the primary interface for interacting with the Spark network, providing everything you need to build wallet applications on Bitcoin. It includes methods for creating and managing wallets, handling deposits and withdrawals, executing transfers, and interacting with the Lightning Network.

***

## Installation

Install the Spark SDK packages using your package manager of choice.

<CodeGroup>
  ```bash npm theme={null}
  npm install @buildonspark/spark-sdk
  ```

  ```bash yarn theme={null}
  yarn add @buildonspark/spark-sdk
  ```

  ```bash pnpm theme={null}
  pnpm add @buildonspark/spark-sdk
  ```
</CodeGroup>

***

## Method Categories

<Columns cols={3} className="gap-4">
  <Card icon="https://mintcdn.com/lightspark/QeKlW2AmFua1qq8H/icons/icon-components-red.svg?fit=max&auto=format&n=QeKlW2AmFua1qq8H&q=85&s=3a8999fbce231882d5b624367d9ecff2" href="/api-reference/wallet/initialize" title="Core Operations" description="Initialize, balance queries, and address management" width="16" height="16" data-path="icons/icon-components-red.svg" />

  <Card icon="https://mintcdn.com/lightspark/QeKlW2AmFua1qq8H/icons/icon-arrows-greenbright.svg?fit=max&auto=format&n=QeKlW2AmFua1qq8H&q=85&s=03fc3541f924a3ce9d796c9581e133c0" href="/api-reference/wallet/transfer" title="Transfers" description="Send Bitcoin and tokens between Spark wallets" width="16" height="16" data-path="icons/icon-arrows-greenbright.svg" />

  <Card icon="https://mintcdn.com/lightspark/QeKlW2AmFua1qq8H/icons/icon-coins-blue.svg?fit=max&auto=format&n=QeKlW2AmFua1qq8H&q=85&s=1e1d8a72c41968c2d56c8ea0e4b3652e" href="/api-reference/wallet/transfer-tokens" title="Tokens" description="Transfer tokens and query transaction history" width="16" height="16" data-path="icons/icon-coins-blue.svg" />

  <Card icon="https://mintcdn.com/lightspark/QeKlW2AmFua1qq8H/icons/icon-btc.svg?fit=max&auto=format&n=QeKlW2AmFua1qq8H&q=85&s=27e89c1041a9c88eba89bae069f88c65" href="/api-reference/wallet/get-single-use-deposit-address" title="Bitcoin" description="Deposits, withdrawals, and address management" width="16" height="16" data-path="icons/icon-btc.svg" />

  <Card icon="https://mintcdn.com/lightspark/CTf3lWSz3PciiPxG/icons/icon-lightning.svg?fit=max&auto=format&n=CTf3lWSz3PciiPxG&q=85&s=e6c91429f16c252387d4c641721ed7d0" href="/api-reference/wallet/pay-lightning-invoice" title="Lightning" description="Send and receive Bitcoin via Lightning Network" width="16" height="16" data-path="icons/icon-lightning.svg" />

  <Card icon="https://mintcdn.com/lightspark/y_i-zvoD8RGnL1Jv/icons/icon-math-lime.svg?fit=max&auto=format&n=y_i-zvoD8RGnL1Jv&q=85&s=95ec07783f039bd1fdd81d504ec5af6e" href="/api-reference/wallet/get-swap-fee-estimate" title="Fees" description="Estimate transaction and swap fees" width="16" height="16" data-path="icons/icon-math-lime.svg" />

  <Card icon="https://mintcdn.com/lightspark/CTf3lWSz3PciiPxG/icons/icon-flag-green.svg?fit=max&auto=format&n=CTf3lWSz3PciiPxG&q=85&s=6d6b8b6e1d76eb1421dc644ff64eab77" href="/api-reference/wallet/event-emitter" title="Events" description="Listen for wallet events and state changes" width="16" height="16" data-path="icons/icon-flag-green.svg" />
</Columns>
