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

# Flashnet

> Swap tokens on Spark using Flashnet's AMM and liquidity pools.

export const Button = ({href, children, className = "", target = "_self", outline}) => {
  return <a href={href} target={target} rel="noopener noreferrer" className={`not-prose inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-xl transition-colors duration-200 ${outline ? "spark-button-outline" : "spark-button"} ${className}`}>
      {children}
    </a>;
};

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>;
};

export const VCard = ({img, light, dark, icon, href, title, description, target = "_self"}) => {
  return <div className="spark-card overflow-hidden rounded-2xl flex justify-center items-center hover:scale-[1.02] transition-all duration-300">
      <a href={href} target={target} rel={target === "_blank" ? "noopener noreferrer" : undefined} className="w-full">
        <div className="vcard-col">
          <div className="vcard-image w-full aspect-video relative">
            {light && dark ? <>
                <img src={light} alt={title} className="icon-light w-full h-full object-cover pointer-events-none" />
                <img src={dark} alt={title} className="icon-dark w-full h-full object-cover pointer-events-none" />
              </> : <div className="w-full h-full bg-cover bg-center bg-no-repeat" style={{
    backgroundImage: `url(${img})`
  }} />}
          </div>
          <div className="vcard-content flex flex-col gap-2 p-6">
            <h2 className="card-title text font-semibold leading-none">
              {title}
            </h2>
            <p className="card-description text-sm leading-tight">
              {description}
            </p>
          </div>
        </div>
      </a>
    </div>;
};

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>;
};

<Frame className="chill">
  <img src="https://mintcdn.com/lightspark/1qhg2-dutO4_dxVH/images/integrations/flashnet.png?fit=max&auto=format&n=1qhg2-dutO4_dxVH&q=85&s=6b8bb4447f87cf0ec03a1c68f528bcda" alt="Flashnet" width="1920" height="1081" data-path="images/integrations/flashnet.png" />
</Frame>

Flashnet is the leading AMM (automated market maker) on Spark. It enables instant token swaps, liquidity pools, and market creation without custody risk. Built on Spark's cryptographic messaging layer, Flashnet provides near-instant settlement and zero-fee transactions for Bitcoin and token trading in your applications.

<Button href="https://flashnet.xyz" outline target="_blank">
  Learn more ->
</Button>

<br />

***

## Use Cases

<Columns cols="3" className="chill">
  <Card title="Trading Apps" iconDark="/icons/icon-chart-white.svg" iconLight="/icons/icon-chart-black.svg" href="/quickstart/launch-token" description="Build DEX interfaces with instant swaps" />

  <Card title="Liquidity Pools" iconDark="/icons/icon-drop-white.svg" iconLight="/icons/icon-drop-black.svg" href="/quickstart/create-wallet" description="Add liquidity to trading pairs" />

  <Card title="Defi Wallets" iconDark="/icons/icon-wallet-white.svg" iconLight="/icons/icon-wallet-black.svg" href="/quickstart/create-wallet" description="Build DeFi wallets with instant swaps" />
</Columns>

<br />

***

## Quick Integration

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

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

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

### Initialize Flashnet Client

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

// Initialize your Spark wallet
const { wallet } = await SparkWallet.initialize({
  mnemonicOrSeed: process.env.MNEMONIC,
  options: {
    network: "REGTEST", // or "MAINNET"
  },
});

// Create the Flashnet client
const client = new FlashnetClient(wallet);

await client.initialize();

// The client will automatically:
// - Authenticate with the AMM service
// - Handle all signing and intent generation
```

### Using the Spark Wallet

The Flashnet client can also be used as a regular Spark wallet:

```typescript theme={null}
// Create a Lightning invoice using the client wallet
const invoice = await client.wallet.createLightningInvoice({
  amountSats: 1000000,
  memo: "Test invoice",
});

console.log(invoice);
```

<br />

***

## Documentation

<Columns cols="1">
  <HCard title="Flashnet Official Docs" icon="/icons/icon-app-flashnet.svg" description="Official documentation for Flashnet" href="https://docs.flashnet.xyz/" target="_blank" />
</Columns>
