krystal-defi-api

Provides DeFi liquidity pool data, vault management, user positions, and LP transaction-building via the Krystal API. Use for pool analytics (TVL/volume/APR), listing positions (including single-position lookup by positionId), and LP actions like zap-in, zap-out (including fee-claim via liquidityPercent=0), swap-and-increase, adjust-range (rebalance), and compound across chains like Ethereum, BSC, Polygon, Arbitrum, Base, and Solana.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "krystal-defi-api" with this command: npx skills add krystaldefi/krystal-api-skill/krystaldefi-krystal-api-skill-krystal-defi-api

Krystal API

DeFi liquidity pool explorer and transaction API supporting 13+ blockchains.

Quick Start

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

# Get top pools across all chains
curl "https://api.krystal.app/all/v2/lp_explorer/top_pools?skipCheckAutomation=true"

# Get pool details
curl "https://api.krystal.app/all/v1/lp_explorer/pool_detail?chainId=8453&poolAddress=0x..."

Instructions

Finding Pools

  1. Use Top Pools to discover high-performing pools
  2. Use Pool Detail for specific pool information
  3. Use Pool Chart for liquidity distribution visualization

Creating LP Positions

  1. Get pool details including tickSpacing from Pool Detail
  2. Calculate tick range aligned with pool's tick spacing
  3. Use Zap In to build the transaction
  4. Sign and send txData using a web3 provider

Increasing Liquidity (Swap and Increase)

  1. Get position tokenId from User Positions (for Solana, also pass nftMintAddress)
  2. Use Swap and Increase with tokenInAddress, amountIn, swapSlippage, and liquiditySlippage
  3. Set fundFromOwner=true and isVault=true when adding to a Krystal auto-farm vault position
  4. Sign and send txData using a web3 provider (same as Zap In)

Withdrawing LP Positions (Zap Out)

  1. Get position tokenId from User Positions (for Solana, also pass nftMintAddress)
  2. Use Zap Out with targetToken, liquidityPercent, swapSlippage, and withdrawSlippage
    • Set liquidityPercent = 0 to claim only fees (principal stays in the pool; claimed tokens are swapped to targetToken)
    • Use 0 < liquidityPercent ≤ 1 to withdraw principal liquidity (plus any fees) to targetToken
  3. Sign and send txData using a web3 provider (same as Zap In)

Compounding Fees into a Position

  1. Get position tokenId from User Positions (for Solana, also pass nftMintAddress)
  2. Use Compound with swapSlippage and liquiditySlippage to reinvest unclaimed fees back into the same position
  3. Set isVault=true when compounding a Krystal auto-farm vault position
  4. Sign and send txData using a web3 provider

Rebalancing Positions (Adjust Range)

  1. Get position tokenId from User Positions (for Solana, also pass nftMintAddress)
  2. Get pool tickSpacing from Pool Detail and choose new newTickLower and newTickUpper aligned with it
  3. Use Adjust Range with swapSlippage, liquiditySlippage, and withdrawSlippage
  4. On EVM chains, sign and send txData directly. On Solana, call with buildTx=true first to get txData, then sign and send it.

Exploring Vaults

  1. Use Vaults to list available vaults
  2. Filter by category (ALL_VAULT, NEW_VAULT, BOOST_VAULT) and isAutoFarmVault to narrow results
  3. Evaluate vaults by tvl, apr, riskScore, and vaultSecurities
  4. Use Vault Profile Stats to get a wallet's aggregate vault statistics (owned, joined, yields, PnL)

Viewing Positions

  1. Use User Positions to list a wallet's liquidity positions
  2. Check statsByChain["all"] for aggregate portfolio metrics (total PnL, APR, unclaimed fees)
  3. Filter by chainIds or positionStatus (open/closed) to narrow results
  4. Evaluate individual positions by pnl, apr, impermanentLoss, compareWithHodl, and status (IN_RANGE/OUT_RANGE)
  5. Use refreshAll=true for fresh on-chain data (slower) or omit for cached data (faster)

Wallet Operations

  1. Use Token Search to get user's token balances
  2. Select input token for swap/zap operations

Key Conventions

  • Always use skipCheckAutomation=true for faster responses
  • Monetary values: Returned as strings to preserve precision
  • APR values: Returned as numbers (percentages)
  • Native tokens: Use NativeTokenAddress placeholders
  • Amounts: Always in wei (smallest unit)

Endpoints Reference

EndpointPurpose
Top PoolsDiscover pools by TVL, volume, APR
Pool DetailGet pool info, tick spacing, incentives
Pool ChartLiquidity distribution and price history
Zap InBuild swap + mint transaction
Swap and IncreaseAdd liquidity to existing position (swap + increase)
Zap OutBuild withdraw + swap transaction
CompoundReinvest unclaimed fees into existing position
Adjust RangeRebalance position to new tick range
User PositionsList wallet LP positions & stats
VaultsList shared & auto-farm vaults
Token SearchQuery wallet token balances

Types Reference

See types.md for complete type definitions:

Core Types: Token, Pool, PoolDetail, ChainId, LPProtocolAlias

Chart Types: PoolChartData, Tick, PricePoint

Transaction Types: TxData, ZapTxInfo, SwapAmount

Position Types: UserPosition, PositionChainStats, PositionTokenAmount, PositionPool

Vault Types: Vault, VaultOwner, VaultSecurity, VaultStats

Wallet Types: WalletToken, TokenBalance

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Web3

china-sportswear-outdoor-sourcing

Comprehensive sportswear and outdoor equipment sourcing guide for international buyers – provides detailed information about China's athletic apparel, footwear, outdoor gear, and accessories manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated
Web3

china-lighting-sourcing

Comprehensive lighting industry sourcing guide for international buyers – provides detailed information about China's LED, smart, outdoor, automotive, and specialty lighting manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated
Web3

china-furniture-sourcing

Comprehensive furniture industry sourcing guide for international buyers – provides detailed information about China's residential, office, hotel, outdoor, and custom furniture manufacturing clusters, supply chain structure, regional specializations, and industry trends (2026 updated).

Archived SourceRecently Updated