Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.overpass.ag/llms.txt

Use this file to discover all available pages before exploring further.

This quickstart shows the core Overpass flows using the TypeScript SDK.

Install

npm install @symmetry-hq/overpass @solana/web3.js @solana/spl-token

Connect to Solana

import { Connection, PublicKey } from "@solana/web3.js";
import {
  PROGRAM_ID,
  createWrapper,
  buildOverpassSwap,
  loadAllWrappers,
} from "@symmetry-hq/overpass";

const connection = new Connection("https://api.mainnet-beta.solana.com");
The mainnet program ID is:
WRAPdXmxrH37RKUbH1QMnYrKdNe8w4Kz44t1cXmYeum

Discover wrappers

Use wrapper discovery when you need to list existing yield tokens.
const wrappers = await loadAllWrappers(connection, {
  programId: PROGRAM_ID,
  refresh: true,
});

for (const wrapper of wrappers) {
  console.log({
    wrapperMint: wrapper.wrapperMint.toBase58(),
    underlyingMint: wrapper.underlyingMint.toBase58(),
    protocol: wrapper.protocol,
    sourcePool: wrapper.wrapperVault.sourcePool.toBase58(),
  });
}

Create a yield token

Creating a wrapper mints a new SPL token tied to a source pool.
const result = await createWrapper(connection, {
  creator: walletPublicKey,
  source: new PublicKey("SOURCE_POOL_ADDRESS"),
  underlyingMint: new PublicKey("UNDERLYING_MINT"),
  name: "Wrapped USDC",
  symbol: "wUSDC",
  uri: "ipfs://...",
  creatorDepositFeeBps: 0,
  initialDeposit: {
    amount: 1_000_000n,
    minOut: 0n,
  },
});

const signed = await wallet.signTransaction(result.tx);
const sig = await connection.sendTransaction(signed);
console.log(result.wrapperMint.toBase58(), sig);
initialDeposit is optional. If supplied, the wrapper launches with backing in the same transaction as creation.

Deposit into a yield token

A deposit moves the underlying asset into the source pool and returns the yield token.
const built = await buildOverpassSwap(connection, {
  user: walletPublicKey,
  wrapperMint: new PublicKey("WRAPPER_MINT"),
  amount: 1_000_000n,
  direction: "deposit",
  minOut: 0n,
});

// Send the returned instructions with your wallet transaction flow.
console.log(built.ixs, built.lookupTables, built.suggestedComputeUnits);

Withdraw from a yield token

A withdrawal burns the yield token and redeems the underlying asset.
const built = await buildOverpassSwap(connection, {
  user: walletPublicKey,
  wrapperMint: new PublicKey("WRAPPER_MINT"),
  amount: 1_000_000n,
  direction: "withdraw",
  minOut: 0n,
});
Withdrawal quality depends on the source pool. A highly utilized, paused, stale-oracle, or impaired pool can make withdrawals fail or reduce practical redeemability.

Quote before building

Use quotes when you need preview amounts, warnings, or route simulation.
import { Overpass, OverpassLoader, SwapMode } from "@symmetry-hq/overpass";

const overpass = Overpass.fromAccount(wrapperVaultPda, accountData);
const loader = new OverpassLoader();
await loader.refreshMany(connection, [overpass]);

const ctx = overpass.getQuoteContext(
  BigInt(currentSlot),
  BigInt(Math.floor(Date.now() / 1000)),
);

const quote = overpass.quote(
  {
    amount: 1_000_000n,
    inputMint: overpass.underlyingMint,
    outputMint: overpass.wrapperMint,
    swapMode: SwapMode.ExactIn,
  },
  ctx,
);

console.log(quote.outAmount, quote.feeAmount, quote.warnings);

Next steps