|
|
@@ -43,6 +43,16 @@ interface PoolOption {
|
|
|
interface PoolInfo {
|
|
|
poolAddress: string
|
|
|
displayReversed?: boolean
|
|
|
+ feeUsd1d?: number
|
|
|
+ feeUsd1h?: number
|
|
|
+ baseMint?: {
|
|
|
+ price?: number
|
|
|
+ mintInfo: {
|
|
|
+ address?: string
|
|
|
+ symbol?: string
|
|
|
+ decimals?: number
|
|
|
+ }
|
|
|
+ }
|
|
|
mintA?: {
|
|
|
address: string
|
|
|
symbol?: string
|
|
|
@@ -120,6 +130,8 @@ function DataTableContent() {
|
|
|
// const [priceUpper, setPriceUpper] = useState<number>(0)
|
|
|
const [balanceUsd, setBalanceUsd] = useState<number>(0)
|
|
|
const [currentPrice, setCurrentPrice] = useState<number>(0)
|
|
|
+ const [feeUsd1d, setFeeUsd1d] = useState<number>(0)
|
|
|
+ const [feeUsd1h, setFeeUsd1h] = useState<number>(0)
|
|
|
|
|
|
const fetchBalance = async (
|
|
|
tokenAddress: string,
|
|
|
@@ -159,22 +171,13 @@ function DataTableContent() {
|
|
|
const poolInfo = result?.result?.data?.records?.find(
|
|
|
(option) => option.poolAddress === selectedPoolAddress
|
|
|
)
|
|
|
- const symbolA = poolInfo?.mintA?.mintInfo?.symbol || ''
|
|
|
- const symbolB = poolInfo?.mintB?.mintInfo?.symbol || ''
|
|
|
- let label = ''
|
|
|
- let address = ''
|
|
|
- let price = 0
|
|
|
- if (symbolA === 'USDC' || symbolA === 'USDT' || symbolA === 'SOL') {
|
|
|
- address = poolInfo?.mintB?.mintInfo?.address || ''
|
|
|
- label = symbolB
|
|
|
- price = poolInfo?.mintB?.price || 0
|
|
|
- } else {
|
|
|
- address = poolInfo?.mintA?.mintInfo?.address || ''
|
|
|
- label = symbolA
|
|
|
- price = poolInfo?.mintA?.price || 0
|
|
|
- }
|
|
|
+ const price = poolInfo?.baseMint?.price || 0
|
|
|
+ const label = poolInfo?.baseMint?.mintInfo?.symbol || ''
|
|
|
+ const address = poolInfo?.baseMint?.mintInfo?.address || ''
|
|
|
setCurrentPrice(price)
|
|
|
- setTokenName(label || '')
|
|
|
+ setTokenName(label)
|
|
|
+ setFeeUsd1d(poolInfo?.feeUsd1d || 0)
|
|
|
+ setFeeUsd1h(poolInfo?.feeUsd1h || 0)
|
|
|
return fetchBalance(address, userAddressRef.current, price)
|
|
|
}
|
|
|
|
|
|
@@ -894,7 +897,14 @@ function DataTableContent() {
|
|
|
/>
|
|
|
<span className="ml-2 mr-2 text-lg font-bold text-green-500">
|
|
|
余额:{balance} {tokenName} (${balanceUsd}) | 当前价格:$
|
|
|
- {Number(currentPrice).toFixed(4)}
|
|
|
+ {Number(currentPrice).toFixed(4)} | 24h Fee:
|
|
|
+ <span className="text-orange-500 font-bold text-xl">
|
|
|
+ ${Number(feeUsd1d).toFixed(2)}
|
|
|
+ </span>{' '}
|
|
|
+ | 1h Fee:
|
|
|
+ <span className="text-orange-500 font-bold text-xl">
|
|
|
+ ${Number(feeUsd1h).toFixed(2)}
|
|
|
+ </span>
|
|
|
</span>
|
|
|
<Button type="primary" className="ml-2 mr-2" onClick={handleRefresh}>
|
|
|
刷新
|