add staking page

This commit is contained in:
2026-06-17 18:10:23 +03:00
parent 7966ef1c52
commit a5bb7abce8
17 changed files with 928 additions and 330 deletions

View File

@@ -1,53 +1,5 @@
import { COIN_ICONS } from '@shared/assets/coins'
/** Курируемый пул Uniswap v3 (данные из GET /wallets/ETH/lp/pools). */
export interface Pool {
poolAddress: string
symbol0: string
symbol1: string
decimals0: number
decimals1: number
/** В сотых долях процента: 3000 = 0.3%, 500 = 0.05%. */
feeTier: number
currentPrice: number
/** Внешняя статистика может быть недоступна — тогда null (прочерк в UI). */
tvlUSD: number | null
volumeUSD24h: number | null
aprPercent: number | null
}
/** LP-позиция юзера (NFT) из GET /wallets/ETH/lp/positions. */
export interface LpPosition {
tokenId: string
symbol0: string
symbol1: string
feeTier: number
priceLower: number
priceUpper: number
currentAmount0Human: string
currentAmount1Human: string
feesOwed0Human: string
feesOwed1Human: string
/** false → цена вышла за диапазон, позиция временно не зарабатывает комиссии. */
inRange: boolean
}
/** Превью депозита (POST /wallets/ETH/lp/quote) — комиссия 0.7% + проверка баланса. */
export interface LpQuote {
amount0DesiredHuman: string
amount1DesiredHuman: string
aprPercent: number | null
appFee0Human: string
appFee1Human: string
appFeeTotalUsd: number | null
balance: {
token0: { symbol: string; have: string; need: string; sufficient: boolean | null }
token1: { symbol: string; have: string; need: string; sufficient: boolean | null }
gas: { symbol: string; have: string; needReserve: string; sufficient: boolean }
sufficient: boolean
}
}
/** Иконка по символу токена: WETH→ETH, WBTC→BTC, иначе по тикеру (может вернуть undefined). */
export function coinIcon(symbol: string): string | undefined {
const map: Record<string, string> = { WETH: 'ETH', WBTC: 'BTC' }
@@ -58,90 +10,3 @@ export function coinIcon(symbol: string): string | undefined {
export function formatFeeTier(feeTier: number): string {
return `${feeTier / 10000}%`
}
// ── Мок-данные (раздел 2 CryptoWallet-DeFi-Guide.md). Заменяются API позже. ──
export const MOCK_POOLS: Pool[] = [
{
poolAddress: '0x4e68ccd3e89f51c3074ca5072bbac773960dfa36',
symbol0: 'WETH',
symbol1: 'USDT',
decimals0: 18,
decimals1: 6,
feeTier: 3000,
currentPrice: 1665.75,
tvlUSD: 33_000_000,
volumeUSD24h: 5_400_000,
aprPercent: 40.33,
},
{
poolAddress: '0xcbcdf9626bc03e24f779434178a73a0b4bad62ed',
symbol0: 'WBTC',
symbol1: 'WETH',
decimals0: 8,
decimals1: 18,
feeTier: 500,
currentPrice: 18.42,
tvlUSD: 21_700_000,
volumeUSD24h: 3_120_000,
aprPercent: 22.5,
},
{
poolAddress: '0x5c128d25a21f681e678cb050e551a895c9309945',
symbol0: 'XAUt',
symbol1: 'USDT',
decimals0: 6,
decimals1: 6,
feeTier: 3000,
currentPrice: 2384.1,
// Внешняя статистика недоступна — null (показываем прочерк, депозит не блокируется).
tvlUSD: null,
volumeUSD24h: null,
aprPercent: null,
},
]
export const MOCK_POSITIONS: LpPosition[] = [
{
tokenId: '123456',
symbol0: 'WETH',
symbol1: 'USDT',
feeTier: 3000,
priceLower: 1568.75,
priceUpper: 1665.75,
currentAmount0Human: '0.000099',
currentAmount1Human: '0.26',
feesOwed0Human: '0.0000000012',
feesOwed1Human: '0.0005',
inRange: true,
},
{
tokenId: '123498',
symbol0: 'WBTC',
symbol1: 'WETH',
feeTier: 500,
priceLower: 19.1,
priceUpper: 21.4,
currentAmount0Human: '0.0021',
currentAmount1Human: '0.0',
feesOwed0Human: '0.0000004',
feesOwed1Human: '0.00012',
inRange: false,
},
]
/** Мок-квота под выбранный пул (для превью депозита). */
export const MOCK_QUOTE: LpQuote = {
amount0DesiredHuman: '0.0001',
amount1DesiredHuman: '0.263359',
aprPercent: 40.33,
appFee0Human: '0.0007',
appFee1Human: '0.001843',
appFeeTotalUsd: 3.04,
balance: {
token0: { symbol: 'WETH', have: '0.5', need: '0.0001', sufficient: true },
token1: { symbol: 'USDT', have: '0', need: '0.263359', sufficient: false },
gas: { symbol: 'ETH', have: '0.02', needReserve: '0.001', sufficient: true },
sufficient: false,
},
}