|
@@ -100,8 +100,10 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|
|
let tokenAPriceUsd = 0
|
|
let tokenAPriceUsd = 0
|
|
|
let tokenBPriceUsd = 0
|
|
let tokenBPriceUsd = 0
|
|
|
let priceFromApi = false
|
|
let priceFromApi = false
|
|
|
|
|
+ let tokenASymbol: string | undefined
|
|
|
|
|
+ let tokenBSymbol: string | undefined
|
|
|
|
|
|
|
|
- // 首先尝试从 ByReal API 获取真实 USD 价格
|
|
|
|
|
|
|
+ // 首先尝试从 ByReal API 获取真实 USD 价格和 symbol
|
|
|
try {
|
|
try {
|
|
|
const detailData = await fetch(
|
|
const detailData = await fetch(
|
|
|
`https://api2.byreal.io/byreal/api/dex/v2/position/detail?address=${positionAddress}`
|
|
`https://api2.byreal.io/byreal/api/dex/v2/position/detail?address=${positionAddress}`
|
|
@@ -113,6 +115,9 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|
|
tokenBPriceUsd = parseFloat(poolData.mintB.price)
|
|
tokenBPriceUsd = parseFloat(poolData.mintB.price)
|
|
|
priceFromApi = true
|
|
priceFromApi = true
|
|
|
}
|
|
}
|
|
|
|
|
+ // 提取 symbol
|
|
|
|
|
+ tokenASymbol = poolData?.mintA?.symbol
|
|
|
|
|
+ tokenBSymbol = poolData?.mintB?.symbol
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.warn('Failed to fetch prices from API:', error)
|
|
console.warn('Failed to fetch prices from API:', error)
|
|
|
}
|
|
}
|
|
@@ -424,6 +429,7 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|
|
estimatedValue: totalValue,
|
|
estimatedValue: totalValue,
|
|
|
tokenA: {
|
|
tokenA: {
|
|
|
address: poolInfo.mintA.toBase58(),
|
|
address: poolInfo.mintA.toBase58(),
|
|
|
|
|
+ symbol: tokenASymbol,
|
|
|
decimals: poolInfo.mintDecimalsA,
|
|
decimals: poolInfo.mintDecimalsA,
|
|
|
amount: finalUiAmountA.toString(),
|
|
amount: finalUiAmountA.toString(),
|
|
|
amountRaw: (base === 'MintA'
|
|
amountRaw: (base === 'MintA'
|
|
@@ -435,6 +441,7 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|
|
},
|
|
},
|
|
|
tokenB: {
|
|
tokenB: {
|
|
|
address: poolInfo.mintB.toBase58(),
|
|
address: poolInfo.mintB.toBase58(),
|
|
|
|
|
+ symbol: tokenBSymbol,
|
|
|
decimals: poolInfo.mintDecimalsB,
|
|
decimals: poolInfo.mintDecimalsB,
|
|
|
amount: finalUiAmountB.toString(),
|
|
amount: finalUiAmountB.toString(),
|
|
|
amountRaw: (base === 'MintB'
|
|
amountRaw: (base === 'MintB'
|