Skip to content

Commit 06f530f

Browse files
committed
Merge branch 'staging-beta' into songbird-release
2 parents fcbf08d + 207cbda commit 06f530f

File tree

6 files changed

+68
-5
lines changed

6 files changed

+68
-5
lines changed

src/api/agent.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
IOwnerUnderlyingBalance,
2222
IOwnerFassetBalance,
2323
IRedemptionQueueData,
24-
IOtherBot
24+
IOtherBot, IFullAgentFund
2525
} from "@/types";
2626
import { orderBy } from "lodash";
2727

@@ -45,7 +45,8 @@ const AGENT_KEY = {
4545
OWNER_UNDERLYING_BALANCE: 'agent.ownerUnderlyingBalance',
4646
OWNER_FASSET_BALANCE: 'agent.ownerFassetBalance',
4747
REDEMPTION_QUEUE_DATA: 'agent.redemptionQueueData',
48-
OTHER_BOTS: 'agent.otherBots'
48+
OTHER_BOTS: 'agent.otherBots',
49+
FULL_AGENT_FUNDS: 'agent.fullAgentFunds'
4950
}
5051

5152
export function useWorkAddress(enabled: boolean = true) {
@@ -403,3 +404,14 @@ export function useOtherBots(enabled: boolean = true) {
403404
})
404405
}
405406

407+
export function useFullAgentFunds(enabled: boolean = true) {
408+
return useQuery({
409+
queryKey: [AGENT_KEY.FULL_AGENT_FUNDS],
410+
queryFn: async () => {
411+
const response = await apiClient.get(`${resource}/fullAgentFunds`);
412+
return response.data.data as IFullAgentFund[];
413+
},
414+
enabled: enabled
415+
})
416+
}
417+

src/components/cards/AgentBotsCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface IAgentBotsCard {
2727
balances: UseQueryResult<IBalance[], Error>;
2828
}
2929

30-
export default function AgentBotsCard({ className, balances}: IAgentBotsCard) {
30+
export default function AgentBotsCard({ className, balances }: IAgentBotsCard) {
3131
const { t } = useTranslation();
3232
const workAddress = useWorkAddress();
3333
const botStatus = useBotStatus();

src/components/cards/ManagementAddressCard.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Anchor,
66
rem
77
} from "@mantine/core";
8-
import { useIsWhitelisted, useManagementAddress, useUnderlyingAddresses } from "@/api/agent";
8+
import { useFullAgentFunds, useIsWhitelisted, useManagementAddress, useUnderlyingAddresses } from "@/api/agent";
99
import { useTranslation, Trans } from "react-i18next";
1010
import { IconArrowUpRight } from "@tabler/icons-react";
1111
import { truncateString } from "@/utils";
@@ -20,6 +20,7 @@ export default function ManagementAddressCard({ className }: IManagementAddressC
2020
const isWhitelisted = useIsWhitelisted();
2121
const managementAddress= useManagementAddress();
2222
const underlyingAddresses = useUnderlyingAddresses();
23+
const fullAgentFunds = useFullAgentFunds();
2324

2425
return (
2526
<Paper
@@ -94,6 +95,24 @@ export default function ManagementAddressCard({ className }: IManagementAddressC
9495
</div>
9596
</div>
9697
</div>
98+
<div className="flex justify-between flex-wrap md:flex-nowrap mt-2">
99+
<div className="flex justify-between sm:justify-normal w-full sm:w-auto flex-wrap">
100+
<Text
101+
className="mr-3"
102+
c="var(--flr-darkest-gray)"
103+
size="sm"
104+
>
105+
{t('management_address_card.total_agent_funds_label')}
106+
</Text>
107+
<div>
108+
{fullAgentFunds.data?.map((fund, index) => (
109+
<Text size="sm" key={index}>
110+
{fund.symbol}: {fund.balance}
111+
</Text>
112+
))}
113+
</div>
114+
</div>
115+
</div>
97116
{isWhitelisted.data === false &&
98117
<Paper
99118
className="px-7 py-4 mt-6 max-w-full sm:max-w-xl"

src/components/cards/VaultsCard.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,29 @@ export default function VaultsCard({ className, collateral }: IVaultsCard) {
373373
);
374374
}
375375
},
376+
{
377+
id: 'agentCollateral',
378+
label: t('vaults_card.table.agent_collateral_label'),
379+
render: (vault: IVault) => {
380+
return (
381+
<div>
382+
<Text
383+
size="sm"
384+
>
385+
{vault.agentOnlyPoolCollateral}
386+
<span className="mx-1 text-[var(--flr-darker-gray)]">{process.env.NATIVE_TOKEN}</span>
387+
({vault?.agentOnlyPoolCollateralUSD} <span className="ml-1 text-[var(--flr-darker-gray)]">$</span>)
388+
</Text>
389+
<Text
390+
size="xs"
391+
c="var(--flr-darker-gray)"
392+
>
393+
{t('vaults_card.table.amount_label')}
394+
</Text>
395+
</div>
396+
)
397+
}
398+
},
376399
{
377400
id: 'poolFee',
378401
label: t('vaults_card.table.pool_fee'),

src/languages/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@
348348
"address_whitelisted_label": "Address whitelisted",
349349
"how_to_whitelist_agent_description": "To get your Agent (Management address) on whitelist please register your Agent via the<a>Fassets Telegram bot<icon></icon></a>",
350350
"management_address_label": "Management address",
351-
"underlying_addresses_label": "Underyling addresses"
351+
"total_agent_funds_label": "Total Agent funds (All owner and vault addresses)",
352+
"underlying_addresses_label": "Underlying addresses"
352353
},
353354
"notifications": {
354355
"error_title": "Error",
@@ -551,6 +552,7 @@
551552
"withdraw_collateral_pool_tokens_label": "Withdraw Collateral pool tokens",
552553
"withdraw_vault_collateral_label": "Withdraw Vault Collateral"
553554
},
555+
"agent_collateral_label": "Agent collateral",
554556
"agent_label": "Agent",
555557
"amount_label": "Amount",
556558
"cr_label": "CR",

src/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ export interface INotification {
6363

6464
export interface IVault {
6565
address: string;
66+
agentOnlyPoolCollateral: string;
67+
agentOnlyPoolCollateralUSD: string;
6668
allLots: string;
6769
freeLots: string;
6870
mintedAmount: string;
@@ -274,4 +276,9 @@ export interface IOtherBot {
274276
symbol: string;
275277
balance: string;
276278
}[];
279+
}
280+
281+
export interface IFullAgentFund {
282+
balance: string;
283+
symbol: string;
277284
}

0 commit comments

Comments
 (0)