Build
SDK reference
@pyre-one/sdk — a typed viem client for reading, trading, launching, and configuring tokens on Pyre. Works in Node and the browser.
bash
npm install @pyre-one/sdk viemPyreClient
The entry point. Everything hangs off one client.
ts
import { PyreClient } from "@pyre-one/sdk";
const pyre = new PyreClient({
chainId: 4663, // 4663 mainnet · 46630 testnet
rpcUrl: "https://…", // defaults to the chain's public RPC
indexerUrl: "https://…", // the Pyre token API
addresses: { pyreFactory: "0x…" }, // or PYRE_* env vars
privateKey: process.env.PYRE_KEY, // or account / walletClient
});| Property | Type | Notes |
|---|---|---|
pyre.read | PyreReadClient | token/price/holder/reward queries |
pyre.write | PyreWriteClient | launch / trade / configure |
pyre.address | Address | undefined | the configured signer |
pyre.isUndeployed | boolean | true until contracts are set |
pyre.curveState(curve) | Promise<CurveState> | live on-chain phase/progress/price |
Reading data — pyre.read
ts
await pyre.read.tokens(); // Token[] — newest launches
await pyre.read.token(address); // Token | null
await pyre.read.candles(address, "5m"); // Candle[] (1m | 5m | 1h)
await pyre.read.holders(address); // Holder[] (top 100)
await pyre.read.feeEvents(address); // FeeEvent[]
await pyre.read.rewards(wallet); // Rewards (earned across all tokens)
await pyre.read.stats(); // GlobalStatsAll monetary fields are bigint (wei / raw token units) — the SDK converts the API's decimal strings for you.
Launching — pyre.write.launch
ts
const { token, curve } = await pyre.write.launchAndWait({
name: "Ember",
symbol: "EMBER",
preset: 1, // 0 Small · 1 Standard · 2 Large
metadataURI: "ipfs://…", // optional
fees: { buyTaxBps: 100, sellTaxBps: 100, curveFeeBps: 100, locked: true },
mixer: [
{ moduleId: 5, weight: 50, params: { drawInterval: 3600, top3: true } },
{ moduleId: 1, weight: 30 },
{ moduleId: 4, weight: 20 },
],
volley: { enabled: true, startBps: 3000, durationSeconds: 1200 }, // anti-snipe
devBuyEth: "0.05",
});The Mixer
Each entry is { moduleId, weight, params? }. Weights are relative and normalized to 10,000 bps. Params are typed per mode and optional — see the ten modes. Ready-made bundles:
ts
import { MIXER_PRESETS, normalizeSplits, encodeModeParams } from "@pyre-one/sdk";
MIXER_PRESETS.degen; // { 5: 5000, 6: 3000, 1: 2000 }
MIXER_PRESETS.bluechip; // { 10: 4000, 4: 4000, 1: 2000 }Trading
ts
await pyre.write.buy({ curve, ethIn: "0.1", feeBps: 200, slippageBps: 100 });
await pyre.write.sell({ token, curve, tokensIn, slippageBps: 100 }); // auto-approves
await pyre.write.graduate(curve); // permissionless once ready
// quotes
await pyre.write.quoteBuy(curve, ethInWei, feeBps);
await pyre.write.quoteSell(curve, tokensInWei);Configuring fees
Unlocked configs can be changed through a 72-hour timelock:proposeFeeChange → wait → executeFeeChange (permissionless).
Prepare-only mode
Every write has a prepare* builder returning an unsigned request — sign and send it however you like.
ts
const req = pyre.write.prepareLaunch({ … });
// { address, abi, functionName, args, value, chainId }
await myWallet.writeContract(req);Addresses
Set contract addresses via theaddresses option or the PYRE_FACTORY / PYRE_FEE_CONFIG_REGISTRY / PYRE_MODULE_1…10 env vars. Until then, isUndeployed is true and writes throw.