From fcabe495899a3e14759a7fe5ca95e528258307a0 Mon Sep 17 00:00:00 2001 From: Lou-Kamades Date: Fri, 22 Dec 2023 17:24:43 -0600 Subject: [PATCH] add settle funds fees to activity feed --- components/account/ActivityFeedTable.tsx | 10 +++++++++- public/locales/en/activity.json | 1 + public/locales/es/activity.json | 1 + public/locales/ru/activity.json | 1 + public/locales/zh/activity.json | 1 + public/locales/zh_tw/activity.json | 1 + types/index.ts | 16 ++++++++++++++++ 7 files changed, 30 insertions(+), 1 deletion(-) diff --git a/components/account/ActivityFeedTable.tsx b/components/account/ActivityFeedTable.tsx index 8fd0dffa..002936a4 100644 --- a/components/account/ActivityFeedTable.tsx +++ b/components/account/ActivityFeedTable.tsx @@ -73,6 +73,10 @@ export const getFee = (activity: any, mangoAccountAddress: string) => { const { borrow_fee, symbol } = activity.activity_details fee = { value: formatFee(borrow_fee), symbol } } + if (activity_type == 'settle_funds') { + const { fee: settleFee, symbol } = activity.activity_details + fee = { value: formatFee(settleFee), symbol } + } if (activity_type === 'liquidate_token_with_token') { const { side, liab_amount, liab_price, asset_amount, asset_price } = activity.activity_details @@ -274,7 +278,11 @@ export const getValue = (activity: any, mangoAccountAddress: string) => { const { price, size } = activity.activity_details value = price * size } - return value + if (activity_type === 'settle_funds') { + const { price, fee } = activity.activity_details + value = price * fee + } + return -value } const ActivityFeedTable = () => { diff --git a/public/locales/en/activity.json b/public/locales/en/activity.json index 14750a74..69c4eaba 100644 --- a/public/locales/en/activity.json +++ b/public/locales/en/activity.json @@ -33,6 +33,7 @@ "perp_trade": "Perp Trade", "reset-filters": "Reset Filters", "select-tokens": "Select Tokens", + "settle-funds": "Settle Funds", "spot-trade": "Spot Trade", "swap": "Swap", "swaps": "Swaps", diff --git a/public/locales/es/activity.json b/public/locales/es/activity.json index 14750a74..e1f7a912 100644 --- a/public/locales/es/activity.json +++ b/public/locales/es/activity.json @@ -32,6 +32,7 @@ "perps": "Perps", "perp_trade": "Perp Trade", "reset-filters": "Reset Filters", + "settle-funds": "Settle Funds", "select-tokens": "Select Tokens", "spot-trade": "Spot Trade", "swap": "Swap", diff --git a/public/locales/ru/activity.json b/public/locales/ru/activity.json index 14750a74..69c4eaba 100644 --- a/public/locales/ru/activity.json +++ b/public/locales/ru/activity.json @@ -33,6 +33,7 @@ "perp_trade": "Perp Trade", "reset-filters": "Reset Filters", "select-tokens": "Select Tokens", + "settle-funds": "Settle Funds", "spot-trade": "Spot Trade", "swap": "Swap", "swaps": "Swaps", diff --git a/public/locales/zh/activity.json b/public/locales/zh/activity.json index 0fdfa5e2..fa50e5c4 100644 --- a/public/locales/zh/activity.json +++ b/public/locales/zh/activity.json @@ -33,6 +33,7 @@ "perps": "永续合约", "reset-filters": "重置筛选", "select-tokens": "选择币种", + "settle-funds": "Settle Funds", "spot-trade": "现货交易", "swap": "换币", "swaps": "换币", diff --git a/public/locales/zh_tw/activity.json b/public/locales/zh_tw/activity.json index f928353b..4dc8f1cb 100644 --- a/public/locales/zh_tw/activity.json +++ b/public/locales/zh_tw/activity.json @@ -32,6 +32,7 @@ "perp_trade": "合約交易", "perps": "永續合約", "reset-filters": "重置篩選", + "settle-funds": "Settle Funds", "select-tokens": "選擇幣種", "spot-trade": "現貨交易", "swap": "換幣", diff --git a/types/index.ts b/types/index.ts index f0e4dfe7..547b135e 100644 --- a/types/index.ts +++ b/types/index.ts @@ -308,6 +308,21 @@ export interface SwapActivity { activity_type: string } +export interface SettleFundsActivity { + activity_details: SettleFundsItem + block_datetime: string + activity_type: string +} + +export interface SettleFundsItem { + block_datetime: string + mango_account: string + signature: string + symbol: string + price: number + fee: number +} + interface DepositWithdrawActivity { activity_details: DepositWithdrawFeedItem block_datetime: string @@ -412,6 +427,7 @@ export type ActivityFeed = { | SpotLiquidationFeedItem | PerpLiquidationFeedItem | SwapHistoryItem + | SettleFundsItem | PerpTradeActivityFeedItem | SpotTradeHistory }