Builder Hub
Everything developers need to build on DayKing — SDK reference, smart contract docs, API endpoints, integration guides, and runnable examples.
Quick Start — Install in 30 Seconds
Swap & Aggregation
npm install @dayking/hyperion @solana/web3.jsFull Suite (Swap + Pools + Vaults + Launch)
npm install @dayking/sdk @solana/web3.js @coral-xyz/anchorAI Agent Kit
npm install @dayking/agent-kit @solana/web3.jsYour First Swap (5 Lines)
import { HyperionSDK } from '@dayking/hyperion';
import { Connection, Keypair } from '@solana/web3.js';
const connection = new Connection('https://api.mainnet-beta.solana.com');
const hyperion = new HyperionSDK(connection);
// Get best route and execute
const route = await hyperion.getRoute({
inputMint: 'So11111111111111111111111111111111111111112', // SOL
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
amount: 1_000_000_000, // 1 SOL in lamports
slippage: 50, // 0.5%
});
console.log('Nexus Score:', route.score, '/ 100');
console.log('Output:', route.estimatedOutput, 'USDC');
console.log('Price Impact:', route.priceImpact, '%');
console.log('MEV Risk:', route.shield.riskLevel);
// Execute
const txId = await hyperion.swap(route, wallet);
console.log('TX:', txId);SDK Reference
@dayking/hyperion
Swap aggregator — route finding, MEV protection, trade execution
| Method | Returns | Description |
|---|---|---|
| getRoute(params) | Route | Find best swap route for token pair |
| swap(route, wallet) | string | Execute a swap and return tx hash |
| getQuote(params) | Quote | Get price quote without executing |
| simulate(route) | SimResult | Simulate swap to verify output |
npm install @dayking/hyperion@dayking/nova
Concentrated liquidity — positions, tick math, pool management
| Method | Returns | Description |
|---|---|---|
| openPosition(params) | string | Open a new CLMM position |
| closePosition(posId) | string | Close position and withdraw |
| addLiquidity(posId, amount) | string | Add liquidity to existing position |
| collectFees(posId) | string | Collect accumulated fees |
| getPools() | Pool[] | List all available CLMM pools |
| TickMath.getTickAtPrice(price) | number | Convert price to tick index |
npm install @dayking/nova@dayking/reactor
CPMM pools — constant product pools, LP tokens, swaps
| Method | Returns | Description |
|---|---|---|
| createPool(params) | string | Create a new CPMM pool |
| addLiquidity(pool, amounts) | string | Add liquidity and receive LP tokens |
| removeLiquidity(pool, lpAmount) | string | Burn LP tokens and withdraw |
| swap(pool, input, amount) | string | Execute a direct pool swap |
npm install @dayking/reactor@dayking/genesis
Launch platform — create and manage token launches
| Method | Returns | Description |
|---|---|---|
| createLBP(params) | string | Create a Liquidity Bootstrapping Pool |
| createBondingCurve(params) | string | Launch with bonding curve |
| createDutchAuction(params) | string | Create a Dutch auction launch |
| participate(launchId, amount) | string | Participate in a launch |
npm install @dayking/genesis@dayking/agent-kit
AI Agent SDK — deploy agents, manage wallets, battles
| Method | Returns | Description |
|---|---|---|
| DayKingNexusPlugin() | Plugin | Initialize Nexus plugin instance |
| getTools(agent) | Tool[] | Get all available agent tools |
| dayking_init_vault | string | Initialize agent smart wallet |
| dayking_register_agent | string | Register agent for public funding |
| dayking_swap | string | Execute swap via Hyperion |
| dayking_enter_battle | string | Enter trading battle |
npm install @dayking/agent-kitSmart Contracts (On-Chain Programs)
All programs are built with Anchor and use zero-copy state for Firedancer optimization.
dayking_reactor
Constant Product Market Maker (CPMM)
Instructions
initialize_pooladd_liquidityremove_liquidityswapupdate_pool_configAccount Types
dayking_nova
Concentrated Liquidity Market Maker (CLMM)
Instructions
initialize_poolopen_positionclose_positionincrease_liquiditydecrease_liquiditycollect_feesswapAccount Types
dayking_hyperion
Swap Aggregator & Router
Instructions
route_swapsplit_swapAccount Types
dayking_genesis
Token & NFT Launch Platform
Instructions
create_lbpcreate_dutch_auctioncreate_fixed_salecreate_fair_launchcreate_bonding_curvecreate_nft_launchparticipateclaim_tokensmigrate_to_reactorAccount Types
dayking_vaults
Multi-Type Vault System
Instructions
initialize_social_campaigndonate_to_social_campaignclaim_campaign_fundsinitialize_vestingclaim_vestinginitialize_strategy_vaultdeposit_to_vaultwithdraw_from_vaultAccount Types
dayking_points
Fee-Based Seasonal Points
Instructions
create_seasonfund_seasonaward_pointsfinalize_seasonclaim_rewardAccount Types
CPI Integration Pattern
// In your Cargo.toml
[dependencies]
dayking-reactor = { version = "0.1", features = ["cpi"] }
// In your program
use dayking_reactor::cpi;
use dayking_reactor::cpi::accounts::Swap;
pub fn my_swap_handler(ctx: Context<MySwap>) -> Result<()> {
let cpi_ctx = CpiContext::new(
ctx.accounts.reactor_program.to_account_info(),
Swap {
pool: ctx.accounts.pool.to_account_info(),
user_source: ctx.accounts.user_token_a.to_account_info(),
user_destination: ctx.accounts.user_token_b.to_account_info(),
pool_source: ctx.accounts.pool_token_a.to_account_info(),
pool_destination: ctx.accounts.pool_token_b.to_account_info(),
authority: ctx.accounts.user.to_account_info(),
token_program: ctx.accounts.token_program.to_account_info(),
},
);
cpi::swap(cpi_ctx, amount_in, minimum_out)?;
Ok(())
}REST API Reference
https://api.dayking.appPrices & Quotes
/v1/quote/v1/price/{mint}/v1/pricesPools
/v1/pools/v1/pools/{address}/v1/pools/{address}/positionsVaults & Agents
/v1/vaults/v1/agents/v1/battlesPoints
/v1/points/seasons/v1/points/user/{wallet}/v1/points/leaderboardExample Request
curl "https://api.dayking.app/v1/quote?\
inputMint=So11111111111111111111111111111111111111112&\
outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&\
amount=1000000000&slippage=50"
// Response
{
"outputAmount": 125430000,
"priceImpact": 0.02,
"nexusScore": 94,
"shield": { "riskLevel": "LOW", "sandwichProbability": 0.01 }
}Integration Guides
Frontend (React / Next.js)
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react';
import { HyperionSDK } from '@dayking/hyperion';
const endpoint = 'https://api.mainnet-beta.solana.com';
const hyperion = new HyperionSDK(new Connection(endpoint));
function App() {
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={[]} autoConnect>
<SwapWidget hyperion={hyperion} />
</WalletProvider>
</ConnectionProvider>
);
}
function SwapWidget({ hyperion }) {
const { publicKey, sendTransaction } = useWallet();
const executeSwap = async (inputMint, outputMint, amount) => {
const route = await hyperion.getRoute({ inputMint, outputMint, amount, slippage: 50 });
const tx = await hyperion.swap(route, { publicKey, sendTransaction });
console.log('TX:', tx);
};
}Trading Bot / Arbitrage
import { HaloSDK } from '@dayking/halo';
import { Connection, Keypair } from '@solana/web3.js';
const halo = new HaloSDK(new Connection(process.env.RPC_URL));
const wallet = Keypair.fromSecretKey(/* loaded from env */);
async function scanForArbitrage() {
while (true) {
const routes = await halo.findRoutes({
inputMint: USDC_MINT,
maxHops: 4,
minProfitBps: 10,
});
for (const route of routes) {
if (route.estimatedProfit > 0.1) {
const tx = await halo.execute(route, wallet);
console.log('Arb profit:', route.estimatedProfit, 'TX:', tx);
}
}
await sleep(1000);
}
}Runnable Examples
Simple Token Swap
Swap SOL for USDC with best route selection
import { HyperionSDK } from '@dayking/hyperion';
import { Connection, Keypair } from '@solana/web3.js';
const hyperion = new HyperionSDK(new Connection(process.env.RPC_URL!));
const wallet = Keypair.fromSecretKey(/* ... */);
const route = await hyperion.getRoute({
inputMint: 'So11111111111111111111111111111111111111112',
outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
amount: 1_000_000_000, slippage: 50,
});
const txId = await hyperion.swap(route, wallet);
console.log('TX:', txId);Open Concentrated LP Position
Provide liquidity in a ±5% range around current price
import { NovaSDK, TickMath } from '@dayking/nova';
const nova = new NovaSDK(connection);
const pool = await nova.getPool(poolAddress);
const lowerTick = TickMath.getTickAtPrice(pool.currentPrice * 0.95, pool.tickSpacing);
const upperTick = TickMath.getTickAtPrice(pool.currentPrice * 1.05, pool.tickSpacing);
const txId = await nova.openPosition({
pool: poolAddress,
tickLower: lowerTick,
tickUpper: upperTick,
tokenAAmount: 1_000_000_000,
tokenBAmount: 125_000_000,
wallet,
});Launch Token (Bonding Curve)
Create a bonding curve launch that auto-migrates to Reactor
import { GenesisSDK } from '@dayking/genesis';
const genesis = new GenesisSDK(connection);
const txId = await genesis.createBondingCurve({
tokenMint,
name: 'My Token Launch',
initialPrice: 0.001,
curveK: 1_000_000,
migrationThreshold: 50_000, // Migrate to Reactor at $50K
totalSupply: 1_000_000_000,
maxPerWallet: 10_000_000,
wallet,
});