|
|
@@ -195,7 +195,10 @@ function MyLPPageContent() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- const handleClosePosition = (record: RecordInfo): Promise<void> => {
|
|
|
+ const handleClosePosition = (
|
|
|
+ record: RecordInfo,
|
|
|
+ fromBatch: boolean = false
|
|
|
+ ): Promise<void> => {
|
|
|
message.loading({
|
|
|
key: 'closePosition',
|
|
|
content: '正在关仓...',
|
|
|
@@ -212,10 +215,12 @@ function MyLPPageContent() {
|
|
|
message.destroy('closePosition')
|
|
|
if (data.success) {
|
|
|
message.success('关仓成功')
|
|
|
- const newLpList = lpList.filter(
|
|
|
- (item) => item.nftMintAddress !== record.nftMintAddress
|
|
|
- )
|
|
|
- setLpList(newLpList)
|
|
|
+ if (!fromBatch) {
|
|
|
+ const newLpList = lpList.filter(
|
|
|
+ (item) => item.nftMintAddress !== record.nftMintAddress
|
|
|
+ )
|
|
|
+ setLpList(newLpList)
|
|
|
+ }
|
|
|
} else {
|
|
|
message.error('关仓失败')
|
|
|
}
|
|
|
@@ -476,13 +481,18 @@ function MyLPPageContent() {
|
|
|
try {
|
|
|
for (let i = 0; i < allPositions.length; i++) {
|
|
|
const position = allPositions[i]
|
|
|
- await handleClosePosition(position)
|
|
|
+ await handleClosePosition(position, true)
|
|
|
message.loading({
|
|
|
key: 'closeAllPositionWithoutParent',
|
|
|
content: `正在一键关闭无上级仓位... (${i + 1}/${allPositions.length})`,
|
|
|
duration: 0,
|
|
|
})
|
|
|
}
|
|
|
+ const newLpList = lpList.filter(
|
|
|
+ (item) =>
|
|
|
+ !allPositions.some((p) => p.nftMintAddress === item.nftMintAddress)
|
|
|
+ )
|
|
|
+ setLpList(newLpList)
|
|
|
message.success(
|
|
|
`一键关闭无上级仓位成功,关闭了 ${allPositions.length} 个仓位`
|
|
|
)
|