Home/Builders

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.js

Full Suite (Swap + Pools + Vaults + Launch)

npm install @dayking/sdk @solana/web3.js @coral-xyz/anchor

AI Agent Kit

npm install @dayking/agent-kit @solana/web3.js

Your 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

MethodReturnsDescription
getRoute(params)RouteFind best swap route for token pair
swap(route, wallet)stringExecute a swap and return tx hash
getQuote(params)QuoteGet price quote without executing
simulate(route)SimResultSimulate swap to verify output
npm install @dayking/hyperion

@dayking/nova

Concentrated liquidity — positions, tick math, pool management

MethodReturnsDescription
openPosition(params)stringOpen a new CLMM position
closePosition(posId)stringClose position and withdraw
addLiquidity(posId, amount)stringAdd liquidity to existing position
collectFees(posId)stringCollect accumulated fees
getPools()Pool[]List all available CLMM pools
TickMath.getTickAtPrice(price)numberConvert price to tick index
npm install @dayking/nova

@dayking/reactor

CPMM pools — constant product pools, LP tokens, swaps

MethodReturnsDescription
createPool(params)stringCreate a new CPMM pool
addLiquidity(pool, amounts)stringAdd liquidity and receive LP tokens
removeLiquidity(pool, lpAmount)stringBurn LP tokens and withdraw
swap(pool, input, amount)stringExecute a direct pool swap
npm install @dayking/reactor

@dayking/genesis

Launch platform — create and manage token launches

MethodReturnsDescription
createLBP(params)stringCreate a Liquidity Bootstrapping Pool
createBondingCurve(params)stringLaunch with bonding curve
createDutchAuction(params)stringCreate a Dutch auction launch
participate(launchId, amount)stringParticipate in a launch
npm install @dayking/genesis

@dayking/agent-kit

AI Agent SDK — deploy agents, manage wallets, battles

MethodReturnsDescription
DayKingNexusPlugin()PluginInitialize Nexus plugin instance
getTools(agent)Tool[]Get all available agent tools
dayking_init_vaultstringInitialize agent smart wallet
dayking_register_agentstringRegister agent for public funding
dayking_swapstringExecute swap via Hyperion
dayking_enter_battlestringEnter trading battle
npm install @dayking/agent-kit

Smart 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_config

Account Types

Pool (zero-copy)LpPositionFeeAccountPoolConfig

dayking_nova

Concentrated Liquidity Market Maker (CLMM)

Instructions

initialize_poolopen_positionclose_positionincrease_liquiditydecrease_liquiditycollect_feesswap

Account Types

NovaPool (zero-copy)PositionTickArray (bitmap)TickState

dayking_hyperion

Swap Aggregator & Router

Instructions

route_swapsplit_swap

Account Types

RouteConfigSwapState

dayking_genesis

Token & NFT Launch Platform

Instructions

create_lbpcreate_dutch_auctioncreate_fixed_salecreate_fair_launchcreate_bonding_curvecreate_nft_launchparticipateclaim_tokensmigrate_to_reactor

Account Types

LaunchConfig (zero-copy)ParticipationLaunchState

dayking_vaults

Multi-Type Vault System

Instructions

initialize_social_campaigndonate_to_social_campaignclaim_campaign_fundsinitialize_vestingclaim_vestinginitialize_strategy_vaultdeposit_to_vaultwithdraw_from_vault

Account Types

SocialCampaignVestingScheduleStrategyVaultTreasuryVaultUserDeposit

dayking_points

Fee-Based Seasonal Points

Instructions

create_seasonfund_seasonaward_pointsfinalize_seasonclaim_reward

Account Types

PointsConfigSeasonUserPoints

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

Base URL: https://api.dayking.app

Prices & Quotes

GET/v1/quote
GET/v1/price/{mint}
GET/v1/prices

Pools

GET/v1/pools
GET/v1/pools/{address}
GET/v1/pools/{address}/positions

Vaults & Agents

GET/v1/vaults
GET/v1/agents
GET/v1/battles

Points

GET/v1/points/seasons
GET/v1/points/user/{wallet}
GET/v1/points/leaderboard

Example 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,
});

Need Help?