|
|
@@ -93,24 +93,29 @@ function MyLPPageContent() {
|
|
|
const detailData = data.result.data
|
|
|
const { pool, bonusInfo } = detailData
|
|
|
|
|
|
- const copyInfo = await fetch(
|
|
|
- `/api/my-lp/copyInfo?parentPositionAddress=${bonusInfo.fromCreatorPosition}&poolAddress=${pool.poolAddress}`
|
|
|
- )
|
|
|
let allCopyAmount = 0
|
|
|
- const copyInfoData = await copyInfo.json()
|
|
|
- if (copyInfoData.retCode === 0 && copyInfoData.result) {
|
|
|
- allCopyAmount = copyInfoData.result.data.records
|
|
|
- .filter((item: RecordInfo) => item.status === 0)
|
|
|
- .reduce(
|
|
|
- (acc: number, curr: RecordInfo) =>
|
|
|
- acc + Number(curr.liquidityUsd),
|
|
|
- 0
|
|
|
- )
|
|
|
+ let allCopys = 0
|
|
|
+
|
|
|
+ if (bonusInfo?.fromCreatorPosition) {
|
|
|
+ const copyInfo = await fetch(
|
|
|
+ `/api/my-lp/copyInfo?parentPositionAddress=${bonusInfo.fromCreatorPosition}&poolAddress=${pool.poolAddress}`
|
|
|
+ )
|
|
|
+ const copyInfoData = await copyInfo.json()
|
|
|
+ if (copyInfoData.retCode === 0 && copyInfoData.result) {
|
|
|
+ allCopys = copyInfoData.result.data.total
|
|
|
+ allCopyAmount = copyInfoData.result.data.records
|
|
|
+ .filter((item: RecordInfo) => item.status === 0)
|
|
|
+ .reduce(
|
|
|
+ (acc: number, curr: RecordInfo) =>
|
|
|
+ acc + Number(curr.liquidityUsd),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
const newData = {
|
|
|
...data.result.data,
|
|
|
- allCopyAmount: allCopyAmount,
|
|
|
- allCopys: copyInfoData.result.data.total,
|
|
|
+ allCopyAmount,
|
|
|
+ allCopys,
|
|
|
}
|
|
|
return {
|
|
|
positionAddress: position.positionAddress,
|