Added display strings for tx order type

This commit is contained in:
sam-keen 2022-03-15 14:49:10 +00:00
parent c2e4f1d007
commit 775b4a7de9
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,39 @@
interface TxOrderTypeProps {
orderType: string;
className?: string;
}
interface StringMap {
[key: string]: string;
}
// Using https://github.com/vegaprotocol/protos/blob/e0f646ce39aab1fc66a9200ceec0262306d3beb3/commands/transaction.go#L93 as a reference
const displayString: StringMap = {
OrderSubmission: 'Order Submission',
OrderCancellation: 'Order Cancellation',
OrderAmendment: 'Order Amendment',
VoteSubmission: 'Vote Submission',
WithdrawSubmission: 'Withdraw Submission',
LiquidityProvisionSubmission: 'Liquidity Provision',
LiquidityProvisionCancellation: 'Liquidity Cancellation',
LiquidityProvisionAmendment: 'Liquidity Amendment',
ProposalSubmission: 'Governance Proposal',
AnnounceNode: 'Node Announcement',
NodeVote: 'Node Vote',
NodeSignature: 'Node Signature',
ChainEvent: 'Chain Event',
OracleDataSubmission: 'Oracle Data',
DelegateSubmission: 'Delegation',
UndelegateSubmission: 'Undelegation',
KeyRotateSubmission: 'Key Rotation',
StateVariableProposal: 'State Variable Proposal',
Transfer: 'Transfer',
CancelTransfer: 'Cancel Transfer',
ValidatorHeartbeat: 'Validator Heartbeat',
};
export const TxOrderType = ({ orderType, className }: TxOrderTypeProps) => {
return (
<span className={className}>{displayString[orderType] || orderType}</span>
);
};

View File

@ -5,6 +5,7 @@ import { DATA_SOURCES } from '../../../config';
import { Link } from 'react-router-dom';
import { RenderFetched } from '../../render-fetched';
import { TruncateInline } from '../../truncate/truncate';
import { TxOrderType } from '../tx-order-type';
interface TxsPerBlockProps {
blockHeight: string | undefined;
@ -62,7 +63,9 @@ export const TxsPerBlock = ({ blockHeight }: TxsPerBlockProps) => {
className="font-mono"
/>
</td>
<td>{Type}</td>
<td>
<TxOrderType orderType={Type} />
</td>
</tr>
);
})}