|
|
@@ -1,7 +1,17 @@
|
|
|
'use client'
|
|
|
|
|
|
import { useEffect, useState } from 'react'
|
|
|
-import { Button, Modal, Input, Table, Spin, Image, App, Typography } from 'antd'
|
|
|
+import {
|
|
|
+ Button,
|
|
|
+ Modal,
|
|
|
+ Input,
|
|
|
+ Table,
|
|
|
+ Spin,
|
|
|
+ Image,
|
|
|
+ App,
|
|
|
+ Typography,
|
|
|
+ Tag,
|
|
|
+} from 'antd'
|
|
|
import type { ColumnsType } from 'antd/es/table'
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
@@ -31,6 +41,10 @@ interface RecordInfo {
|
|
|
earnedUsdPercent: string
|
|
|
openTime: number
|
|
|
hasDetail?: boolean
|
|
|
+ priceOutType?: string
|
|
|
+ priceLower?: string
|
|
|
+ priceUpper?: string
|
|
|
+ isInRange?: boolean
|
|
|
bonusInfo?: {
|
|
|
fromCreatorPositionStatus: number
|
|
|
fromCreatorPosition: string
|
|
|
@@ -203,26 +217,16 @@ function MyLPPageContent() {
|
|
|
</div>
|
|
|
),
|
|
|
},
|
|
|
- {
|
|
|
- title: '当前价格',
|
|
|
- dataIndex: 'price',
|
|
|
- key: 'price',
|
|
|
- render: (text: string, record: RecordInfo) => (
|
|
|
- <span className="font-mono text-sm">
|
|
|
- ${Number(getPoolInfo(record.poolAddress).price[0]).toFixed(8)}
|
|
|
- </span>
|
|
|
- ),
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'NFT Token Address',
|
|
|
- dataIndex: 'nftMintAddress',
|
|
|
- key: 'nftMintAddress',
|
|
|
- render: (text: string) => (
|
|
|
- <span className="font-mono text-sm">
|
|
|
- {text.slice(0, 6)}...{text.slice(-4)}
|
|
|
- </span>
|
|
|
- ),
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // title: 'NFT Token Address',
|
|
|
+ // dataIndex: 'nftMintAddress',
|
|
|
+ // key: 'nftMintAddress',
|
|
|
+ // render: (text: string) => (
|
|
|
+ // <span className="font-mono text-sm">
|
|
|
+ // {text.slice(0, 6)}...{text.slice(-4)}
|
|
|
+ // </span>
|
|
|
+ // ),
|
|
|
+ // },
|
|
|
{
|
|
|
title: 'Total Deposit',
|
|
|
dataIndex: 'liquidityUsd',
|
|
|
@@ -268,12 +272,39 @@ function MyLPPageContent() {
|
|
|
),
|
|
|
},
|
|
|
{
|
|
|
- title: 'Earned Percent',
|
|
|
- dataIndex: 'earnedUsdPercent',
|
|
|
- key: 'earnedUsdPercent',
|
|
|
- render: (text: string) => (
|
|
|
+ title: '当前价格',
|
|
|
+ dataIndex: 'price',
|
|
|
+ key: 'price',
|
|
|
+ render: (text: string, record: RecordInfo) => (
|
|
|
<span className="font-mono text-sm">
|
|
|
- {(Number(text) * 100).toFixed(2)}%
|
|
|
+ ${Number(getPoolInfo(record.poolAddress).price[0]).toFixed(6)}
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '区间',
|
|
|
+ dataIndex: 'priceRange',
|
|
|
+ key: 'priceRange',
|
|
|
+ render: (text: string, record: RecordInfo) => (
|
|
|
+ <span className="font-mono text-sm text-red-500">
|
|
|
+ {Number(record.priceLower).toFixed(4)} -{' '}
|
|
|
+ {Number(record.priceUpper).toFixed(4)}
|
|
|
+ </span>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '区间状态',
|
|
|
+ dataIndex: 'isInRange',
|
|
|
+ key: 'isInRange',
|
|
|
+ render: (text: string, record: RecordInfo) => (
|
|
|
+ <span className="font-mono text-sm">
|
|
|
+ {text ? (
|
|
|
+ <Tag color="green">区间内</Tag>
|
|
|
+ ) : (
|
|
|
+ <Tag color="red">
|
|
|
+ {record.priceOutType === 'priceUp' ? '超出上限' : '低于下限'}
|
|
|
+ </Tag>
|
|
|
+ )}
|
|
|
</span>
|
|
|
),
|
|
|
},
|
|
|
@@ -298,6 +329,7 @@ function MyLPPageContent() {
|
|
|
{
|
|
|
title: '仓位来源',
|
|
|
dataIndex: 'bonusInfo',
|
|
|
+ width: 180,
|
|
|
key: 'bonusInfo',
|
|
|
render: (text: string, record: RecordInfo) => (
|
|
|
<span className="font-mono text-sm">
|
|
|
@@ -321,6 +353,7 @@ function MyLPPageContent() {
|
|
|
{
|
|
|
title: '操作',
|
|
|
dataIndex: 'bonusInfo',
|
|
|
+ width: 200,
|
|
|
key: 'bonusInfo',
|
|
|
render: (text: string, record: RecordInfo) => (
|
|
|
<div className="flex items-center gap-2">
|
|
|
@@ -338,11 +371,26 @@ function MyLPPageContent() {
|
|
|
},
|
|
|
]
|
|
|
|
|
|
+ function fetchAddress() {
|
|
|
+ fetch('/api/my-lp/getAddress')
|
|
|
+ .then((res) => res.json())
|
|
|
+ .then((data) => {
|
|
|
+ setUserAddress(data.address)
|
|
|
+ fetchLPList(data.address)
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error('Error fetching address:', err)
|
|
|
+ message.error('获取地址失败')
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
const userAddress = localStorage.getItem('userAddress')
|
|
|
if (userAddress) {
|
|
|
setUserAddress(userAddress)
|
|
|
fetchLPList(userAddress)
|
|
|
+ } else {
|
|
|
+ fetchAddress()
|
|
|
}
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
}, [])
|