parent
b9202237b4
commit
53609bf93c
@ -7,8 +7,25 @@ import {
|
|||||||
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
|
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
|
||||||
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import { AccountTypeMapping, TransferTypeMapping } from '@vegaprotocol/types';
|
import {
|
||||||
|
AccountTypeMapping,
|
||||||
|
DescriptionTransferTypeMapping,
|
||||||
|
TransferTypeMapping,
|
||||||
|
} from '@vegaprotocol/types';
|
||||||
import type { LedgerEntry } from './ledger-entries-data-provider';
|
import type { LedgerEntry } from './ledger-entries-data-provider';
|
||||||
|
import type { ITooltipParams } from 'ag-grid-community';
|
||||||
|
|
||||||
|
export const TransferTooltipCellComponent = ({ value }: ITooltipParams) => {
|
||||||
|
return (
|
||||||
|
<p className="max-w-sm bg-neutral-200 px-4 py-2 z-20 rounded text-sm break-word text-black">
|
||||||
|
{value
|
||||||
|
? DescriptionTransferTypeMapping[
|
||||||
|
value as keyof typeof TransferTypeMapping
|
||||||
|
]
|
||||||
|
: ''}
|
||||||
|
</p>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const LedgerTable = ({ ...props }) => (
|
export const LedgerTable = ({ ...props }) => (
|
||||||
<AgGrid
|
<AgGrid
|
||||||
@ -16,10 +33,12 @@ export const LedgerTable = ({ ...props }) => (
|
|||||||
overlayNoRowsTemplate={t('No entries')}
|
overlayNoRowsTemplate={t('No entries')}
|
||||||
rowHeight={34}
|
rowHeight={34}
|
||||||
getRowId={({ data }) => data.id}
|
getRowId={({ data }) => data.id}
|
||||||
|
tooltipShowDelay={500}
|
||||||
defaultColDef={{
|
defaultColDef={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
tooltipComponent: TransferTooltipCellComponent,
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
@ -37,6 +56,7 @@ export const LedgerTable = ({ ...props }) => (
|
|||||||
<AgGridColumn
|
<AgGridColumn
|
||||||
headerName={t('Transfer Type')}
|
headerName={t('Transfer Type')}
|
||||||
field="transferType"
|
field="transferType"
|
||||||
|
tooltipField="transferType"
|
||||||
valueFormatter={({
|
valueFormatter={({
|
||||||
value,
|
value,
|
||||||
}: VegaValueFormatterParams<LedgerEntry, 'transferType'>) =>
|
}: VegaValueFormatterParams<LedgerEntry, 'transferType'>) =>
|
||||||
|
@ -312,3 +312,31 @@ export enum TransferTypeMapping {
|
|||||||
TRANSFER_TYPE_CLEAR_ACCOUNT = 'Market is closed, accounts are cleared',
|
TRANSFER_TYPE_CLEAR_ACCOUNT = 'Market is closed, accounts are cleared',
|
||||||
TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = 'Restore a balance from a checkpoint',
|
TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = 'Restore a balance from a checkpoint',
|
||||||
}
|
}
|
||||||
|
export enum DescriptionTransferTypeMapping {
|
||||||
|
TRANSFER_TYPE_LOSS = `Final settlement loss: Funds deducted after final settlement loss`,
|
||||||
|
TRANSFER_TYPE_WIN = `Final settlement gain: Funds added to your general account after final settlement gain`,
|
||||||
|
TRANSFER_TYPE_MTM_LOSS = `Mark to market loss: Funds deducted from your margin account after mark to market loss`,
|
||||||
|
TRANSFER_TYPE_MTM_WIN = `Mark to market gain: Funds added to your margin account after mark to market gain`,
|
||||||
|
TRANSFER_TYPE_MARGIN_LOW = `Margin topped up: Funds deducted from your general account to meet margin requirement`,
|
||||||
|
TRANSFER_TYPE_MARGIN_HIGH = `Margin returned: Excess margin amount returned to your general account`,
|
||||||
|
TRANSFER_TYPE_MARGIN_CONFISCATED = `Margin confiscated: Margin confiscated from your margin account to fulfil closeout`,
|
||||||
|
TRANSFER_TYPE_MAKER_FEE_PAY = `Maker fee paid: Maker fee paid from your general account when your aggressive trade was filled`,
|
||||||
|
TRANSFER_TYPE_MAKER_FEE_RECEIVE = `Maker fee received: Maker fee received into your general account when your passive trade was filled`,
|
||||||
|
TRANSFER_TYPE_INFRASTRUCTURE_FEE_PAY = `Infrastructure fee paid: Infrastructure fee paid from your general account when your trade was filled`,
|
||||||
|
TRANSFER_TYPE_INFRASTRUCTURE_FEE_DISTRIBUTE = `Infrastructure fee received: Infrastructure fee, paid by traders, received into your general account`,
|
||||||
|
TRANSFER_TYPE_LIQUIDITY_FEE_PAY = `Liquidity fee paid: Liquidity fee paid from your general account to market's liquidity providers`,
|
||||||
|
TRANSFER_TYPE_LIQUIDITY_FEE_DISTRIBUTE = `Liquidity fee received: Liquidity fee received into your general account from traders`,
|
||||||
|
TRANSFER_TYPE_BOND_LOW = `Bond account funded: Funds deducted from your general account to meet your required liquidity bond amount`,
|
||||||
|
TRANSFER_TYPE_BOND_HIGH = `Bond returned: Bond returned to your general account after your liquidity commitment was reduced`,
|
||||||
|
TRANSFER_TYPE_WITHDRAW = `Withdrawal: Funds withdrawn from your general account`,
|
||||||
|
TRANSFER_TYPE_DEPOSIT = `Deposit: Funds deposited to your general account`,
|
||||||
|
TRANSFER_TYPE_BOND_SLASHING = `Bond slashed: Bond account penalized when liquidity commitment not met`,
|
||||||
|
TRANSFER_TYPE_STAKE_REWARD = `Staking reward received: Rewards for staking received into your general account`,
|
||||||
|
TRANSFER_TYPE_TRANSFER_FUNDS_SEND = `Transfer sent: Funds deducted from your general account to fulfil a transfer`,
|
||||||
|
TRANSFER_TYPE_TRANSFER_FUNDS_DISTRIBUTE = `Transfer received: Funds added to your general account to fulfil a transfer`,
|
||||||
|
TRANSFER_TYPE_CLEAR_ACCOUNT = `Market accounts cleared: Market-related accounts emptied, and balances moved, because the market has closed`,
|
||||||
|
TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE = `Balances restored: Your balances were restored after a network restart`,
|
||||||
|
TRANSFER_TYPE_UNSPECIFIED = 'Default value, always invalid',
|
||||||
|
TRANSFER_TYPE_CLOSE = 'Close',
|
||||||
|
TRANSFER_TYPE_WITHDRAW_LOCK = 'Lock amount for withdraw',
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user