TESTNETRobinhood Chain testnet (id 46630). USDG here is a faucet token anyone can mint — prices, liquidity and fees on this page are not real money.

The SDK: Quote, Prepare, Send 🐝

The buzz

A library for people who would rather call a function than click a splat. You hand it your RPC. You hand it a key, if you want it to spend. It does the routing, the approvals, the gas padding for graduation and the "will this revert" check, and it hands you back something you can read before anything leaves your machine. 🫡

The boring part

Connect

import { Fly } from "@fly/sdk";

// Read-only: no key. Your RPC, or the chain's public endpoint (rate limited).
const fly = new Fly({ network: "testnet", rpcUrl: process.env.FLY_RPC_URL });
Option Meaning
network testnet (default). mainnet is refused until the launchpad is deployed there
rpcUrl your RPC. A list (comma separated) fails over in order. Falls back to FLY_RPC_URL, then the chain's public endpoint
account a private key, to sign. Without it the object can only read and prepare
deployment a custom deployment file, for a fork or a private deployment
policy, ledger the spending limits and the 24 h record (read from the environment by default, see below)

Read

Call Returns
fly.info() network, RPC host, signer, contract addresses
fly.terms() launch fee, supply, graduation threshold, fee bps (read from the factory)
fly.launches({ limit, offset }) newest first, up to 50 per call: state, progress to graduation, price
fly.launch(idOrTokenAddress) one launch in full, including what it takes to graduate it
fly.balances(address?, extraAssets?) ETH, USDG, $FLY and any extra assets
fly.claimable(address?) fees credited to that address (see Launchpad Fees and Pairings)
fly.quoteTrade({ launch, side, via, amount }) what a buy or sell would give, along the best route
fly.quoteSwap({ from, to, amount }) a swap between FLY, USDG, ETH, WETH or a listed asset

Amounts are plain decimal strings in the asset's own units ("0.5"). Assets are given by symbol (ETH, USDG, FLY, WETH, or a registered pairing asset) or by address. A launch token is always addressed by id or by address, never by symbol, because symbols are not unique.

Prepare, inspect, send

Every call that spends money is two steps, and the first one sends nothing:

const trader = new Fly({ account: privateKey });

const prepared = await trader.prepareTrade({ launch: 1, side: "buy", via: "USDG", amount: "5" });
console.log(prepared.lines, prepared.warnings, prepared.simulation);

const result = await trader.send(prepared);
Prepare For
prepareTrade({ launch, side, via, amount }) buy or sell a launch
prepareSwap({ from, to, amount }) swap between assets
prepareLaunch({ name, symbol, quote, premine? }) create a token, with an optional first buy in the same transaction
prepareClaim({ asset }) pay out fees credited to a wallet in one asset
prepareDetails({ launch, description?, links?, logo? }) a launch's logo, description and links: creator only, off chain, see below

A prepared transaction lists its steps (an approval first if one is needed, then the router call), the expected and minimum amounts, any warnings (for example, that the buy fills the curve and graduates the token), and the result of simulating it. It expires after 2 minutes.

What send does

In this order:

  1. refuses a stale preparation, one made for another wallet or chain, or one whose simulation failed;
  2. checks the spending limits (below) and refuses anything outside them;
  3. sends an exact-amount approval to the LaunchRouter if one is needed;
  4. simulates the main call again, now that the approval is mined, and refuses if it would revert;
  5. adds gas for the things a node's estimate cannot see: graduation (800k extra) and a child-pool harvest;
  6. sends, waits for the receipt, and records the spend in the 24 h ledger.

Slippage defaults to 1% (100 bps). The router deadline is 10 minutes from preparation.

Logo, description and links

import { readLogoFile } from "@fly/sdk";

const prepared = await trader.prepareDetails({
  launch: 5,
  description: "What it is",
  links: { x: "@handle", website: "https://example.com" },
  logo: readLogoFile("./logo.png"),
});
await trader.saveDetails(prepared);

These are stored by the launchpad website, not on chain. The signer must be the launch's creator; it signs one message covering every field and the logo's hash (no gas, no funds). What you leave out keeps its saved value; an empty string clears a field. The rules match the website's: description up to 500 characters; links are https (X on x.com, Telegram on t.me, Discord on discord.gg or discord.com, website anywhere); the logo is a PNG, JPEG, GIF or WebP up to 1 MB. prepareDetails and saveDetails are the only calls that contact a FLY server (the launchpad at FLY_LAUNCHPAD_URL, default https://launchpad.fly.christmas, https only).

Spending limits

Read from the environment of the process that holds the key. They are not parameters of a call, so a call cannot raise them.

Variable Meaning
FLY_ENABLE_WRITES=1 required before anything is sent
FLY_MAX_PER_TX="ETH=0.01,USDG=25" required. Largest single spend per asset. An asset with no entry cannot be spent
FLY_MAX_PER_DAY rolling 24 h cap per asset. Default: 5 times the per-transaction cap
FLY_MAX_SLIPPAGE_BPS highest slippage allowed. Default 300, at most 1000
FLY_ALLOW_TOKENS only these launch tokens may be traded (comma separated addresses). Unset: any
FLY_ALLOW_LAUNCH=1 creating tokens is off unless this is set (the launch fee is not refundable and the name is permanent)
FLY_ALLOW_DETAILS=1 an agent may save logo, description and links (it contacts the launchpad). Off unless set
FLY_LOGO_DIR the only folder an agent may read a logo from. Unset: an agent cannot upload a logo
FLY_ALLOW_OTHER_RECIPIENT=1 proceeds may go only to the signing wallet unless this is set
FLY_PRIVATE_KEY, or FLY_KEY_FILE the signer (the first line of the file)
FLY_LEDGER_PATH where the 24 h record is kept. Default ~/.fly/ledger.json

A buy is counted in what it pays; a sell in what it should receive; a launch in its fee. If the ledger file is unreadable the toolkit refuses to send rather than forgetting what was spent.

Everything as a file

manifest(deployment) builds addresses, the ABIs a trader touches, the fee schedule and the trading rules as one JSON object with no chain access. fly manifest prints it.

Next: The CLI, The Agent Server. Back to Builders and Agents.