@phera/sdk
v1.1.0
Published
Build a launchpad on PHERA. Trade bonding curves and concentrated-liquidity pools, read markets, and create tokens on Robinhood Chain. Includes a read-only CLI.
Maintainers
Readme
@phera/sdk
Build a launchpad on PHERA — the native CLMM DEX and launchpad on Robinhood Chain.
Every PHERA token launches on a bonding curve with a fixed 10,000 supply, and graduates into PHERA's own concentrated-liquidity DEX with its liquidity permanently locked.
Both of those are properties of the deployed contracts, not defaults you override: the supply is a constant in LaunchToken, and each quote asset carries one graduation target that the factory enforces exactly. Together they give every PHERA launch the same shape — 75% of the supply sells on the curve and the price climbs 16x from launch to graduation, whichever asset it is paired against.
npm install @phera/sdk viemTry it without writing code
npx @phera/sdk markets # every launch, live from the chain
npx @phera/sdk quote HOOD 0.001 # what a buy returns, priced by the curve
npx @phera/sdk info HOOD # identity, state, reserves, fee split
npx @phera/sdk quotes # the assets a launch can be paired against
npx @phera/sdk protocol # the constants every launch is built on
npx @phera/sdk --helpThe command line is read-only: it holds no keys, takes no wallet and cannot move funds. Add --json to
any command to pipe it somewhere else.
Quick start
import { Phera } from "@phera/sdk";
const phera = new Phera();
// Read — no wallet, no key, no signup
const markets = await phera.markets();
const quote = await phera.quote({ token: markets[0].token, side: "buy", amountIn: 10n ** 15n });
console.log(`${quote.amountOut} tokens, fee ${quote.feePpm / 10_000}%`);Add a wallet to trade:
import { createWalletClient, custom } from "viem";
import { Phera, robinhoodChain } from "@phera/sdk";
const phera = new Phera({
walletClient: createWalletClient({ chain: robinhoodChain, transport: custom(window.ethereum) }),
});
await phera.buy({ token, amountIn: 10n ** 15n }); // pays in the market's quote asset
await phera.buyWithETH({ token, amountIn: 10n ** 15n }); // pays in native ETH, one signature
await phera.sell({ token, amountIn: 10n ** 18n });
await phera.sellToETH({ token, amountIn: 10n ** 18n }); // receive native ETHWhat needs nobody's permission
Trading, quoting, swapping, providing liquidity and reading markets call the contracts directly. No key, no registration, no PHERA server in the path — they keep working whatever happens to phera.pro.
What the chain gates
Creating a launch. LaunchFactory requires an EIP-712 media attestation signed by PHERA's attestor, checked on-chain. The SDK obtains it for you: still no registration and no key, but the request travels through PHERA's signer.
const { token, launch } = await phera.createLaunch({
name: "My Token",
symbol: "MTK",
metadataURI: "ipfs://…", // you pin this
metadataHash, imageHash, // you host and moderate the image
creator: splitterAddress, // who receives the creator fee — see below
quoteToken: wethAddress,
graduationTarget: 2n * 10n ** 18n,
feeConfig: feeConfig({ totalPercent: 1.0, creatorPercent: 0.45 }),
initialPurchase: 0n,
creatorBuybackBurn: false,
launchProtection: true,
});You own your launchpad's policy
PHERA does not moderate content, rate-limit your users, host images, or cap how much of the supply a creator may buy. Those are yours to decide and to pay for. If you want image screening, wire your own. If you want a launch limit, enforce it in your app.
How your launchpad earns
The trading fee is chosen per launch, between 0.50% and 2.00% in 0.05% steps, and it is immutable afterwards. It splits three ways:
| Share | Goes to | Configurable |
| --- | --- | --- |
| 0.10% | PHERA treasury | No — fixed in the deployed contracts, for everyone including PHERA |
| Creator share | The address you pass as creator | Yes, 0% to the whole remainder |
| LP share | Liquidity providers | Yes, 0% to the whole remainder |
A launch names one creator, and that address receives the creator share for the life of the token. Put a splitter contract there and you can divide it between your platform and the user who created the token — examples/CreatorSplitter.sol is a small, readable one, ready to deploy.
Trade, 1.00% fee
├─ 0.10% → PHERA treasury (fixed)
├─ 0.45% → liquidity providers
└─ 0.45% → your splitter → 70% user · 30% your platformThere is no separate "integrator fee" in the protocol. This is the mechanism.
Fees, safely
import { feeConfig } from "@phera/sdk";
feeConfig({ totalPercent: 1.0, creatorPercent: 0.45 }); // ok
feeConfig({ totalPercent: 5.0, creatorPercent: 1.0 }); // throws — the chain caps the total at 2.00%The bounds are the contract's, not the SDK's. Checking here turns a reverted transaction into an error before anything is signed.
Quote assets, and what they decide
A launch can be paired against any of the registered quote assets — ETH, USDG, tokenized stocks, or a meme. phera.quotes() lists them.
Choosing the pair chooses the graduation threshold. Each quote carries a single target that the factory enforces exactly, so graduationTarget is a field you send but not a number you pick: send anything else and the transaction reverts. Read the value for your chosen asset from quotes() and pass it through.
WETH 2 WETH
USDG 4,930.25 USDG
TSLA 14.00 TSLA
CASHCAT 22,241.99 CASHCAT
…All of them are the same value in ETH terms at the moment they were registered — the differences are just each asset's price.
Reference
| | |
| --- | --- |
| Chain | Robinhood Chain, id 4663 |
| Contracts | phera.pro/developers/contracts |
| Read API | https://phera.pro/api/indexer/markets?chainId=4663 |
| Router | ABI-identical to Uniswap V3's SwapRouter; the fee field is named feePpm and its unit is parts per million (10000 = 1.00%) |
Notes
- Fixed supply: every launch mints exactly 10,000 tokens, once, in its constructor. It is a contract constant, not a parameter — no launchpad can change it, PHERA included. No mint function, no owner, no pause, no blocklist.
- Slippage: every trade sends an on-chain minimum. Default tolerance is 0.50%; override per call or per client.
- Anti-sniper: a protected launch charges a decaying surcharge for its first six seconds.
quote()reads the fee the curve will actually charge, not the base. - Approvals are exact, never unbounded, and skipped when the existing allowance already covers the trade.
License
MIT
