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

# Quickstart

> Fetch a pool, quote and build a swap, sign and send it

The SDK is built around stateful classes — `DlmmProgram`, `Pool`, `Position`, `BinArray` — that
cache on-chain state to avoid redundant RPC round trips. Every method returns unsigned
`Instruction`s and never signs or sends; you build, sign, and send the transaction yourself
with `@solana/kit`.

```ts theme={null}
import {
  createSolanaRpc,
  pipe,
  createTransactionMessage,
  setTransactionMessageFeePayerSigner,
  appendTransactionMessageInstructions,
  setTransactionMessageLifetimeUsingBlockhash,
  signTransactionMessageWithSigners,
  sendAndConfirmTransactionFactory,
  createSolanaRpcSubscriptions,
} from "@solana/kit";
import { DlmmProgram } from "@picon-finance/dlmm-sdk";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");

// Omit programAddress to target mainnet. Testing against devnet instead? Import
// DEVNET_PROGRAM_ADDRESS and pass it as the second argument here.
const dlmmProgram = new DlmmProgram(rpc);

// Fetch and cache a pool's account data, mints, and token programs in one call.
const pool = await dlmmProgram.getPool(poolAddress);

// Pool.swapExactIn() quotes internally (right-sizing exactly which bin arrays it needs) and
// returns both the quote and the matching swap instructions built against it — no separate
// quote step. Pool.swapExactOut() is the mirror image, fixing the output instead of the input.
const { quoteOutput, instructions } = await pool.swapExactIn(userSigner, {
  xToY: true,
  amountIn: 1_000_000n,
  slippageToleranceBps: 50,
});

// Every entity method returns Instruction[] (or a single Instruction) — build, sign and
// send the transaction however you normally do with @solana/kit.
const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
const transactionMessage = pipe(
  createTransactionMessage({ version: 0 }),
  msg => setTransactionMessageFeePayerSigner(userSigner, msg),
  msg => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, msg),
  msg => appendTransactionMessageInstructions(instructions, msg),
);
const signedTransaction = await signTransactionMessageWithSigners(transactionMessage);

const rpcSubscriptions = createSolanaRpcSubscriptions("wss://api.mainnet-beta.solana.com");
const sendAndConfirm = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });
await sendAndConfirm(signedTransaction, { commitment: "confirmed" });
```

## Low-level access

For raw instruction builders, account decoders, or PDA derivation below the entity-class layer,
the Codama-generated client is exposed as `generated` and used internally by the SDK itself:

```ts theme={null}
import { generated } from "@picon-finance/dlmm-sdk";
```

## Where to go next

<CardGroup cols={2}>
  <Card title="Pools and swaps" icon="right-left" href="/sdk/pools-and-swaps">
    Quoting, fee rates, transfer fees, and the bin-array trimming the SDK does under the hood.
  </Card>

  <Card title="Positions" icon="layer-group" href="/sdk/positions">
    Open, deposit, read, withdraw, claim, close — the full position lifecycle.
  </Card>

  <Card title="Events" icon="bolt" href="/sdk/events">
    Subscribe to and decode on-chain program events.
  </Card>

  <Card title="Price math" icon="calculator" href="/sdk/price-math">
    Compute a bin's price off-chain, no RPC round trip.
  </Card>
</CardGroup>
