diff --git a/apps/explorer/src/app/components/assets/assets-table.tsx b/apps/explorer/src/app/components/assets/assets-table.tsx index b5ce2377d..8519406bd 100644 --- a/apps/explorer/src/app/components/assets/assets-table.tsx +++ b/apps/explorer/src/app/components/assets/assets-table.tsx @@ -12,7 +12,8 @@ import { type VegaICellRendererParams } from '@vegaprotocol/datagrid'; import { useRef, useLayoutEffect } from 'react'; import { BREAKPOINT_MD } from '../../config/breakpoints'; import { useNavigate } from 'react-router-dom'; -import { type RowClickedEvent, ColDef } from 'ag-grid-community'; +import { ColDef } from 'ag-grid-community'; +import type { RowClickedEvent } from 'ag-grid-community'; type AssetsTableProps = { data: AssetFieldsFragment[] | null; diff --git a/apps/explorer/src/app/components/proposals/proposals-table.tsx b/apps/explorer/src/app/components/proposals/proposals-table.tsx index dcf25e05c..61ac0718e 100644 --- a/apps/explorer/src/app/components/proposals/proposals-table.tsx +++ b/apps/explorer/src/app/components/proposals/proposals-table.tsx @@ -8,7 +8,8 @@ import { type VegaValueFormatterParams, } from '@vegaprotocol/datagrid'; import { useLayoutEffect, useMemo, useRef, useState } from 'react'; -import { type RowClickedEvent, ColDef } from 'ag-grid-community'; +import { ColDef } from 'ag-grid-community'; +import type { RowClickedEvent } from 'ag-grid-community'; import { getDateTimeFormat } from '@vegaprotocol/utils'; import { t } from '@vegaprotocol/i18n'; import { diff --git a/apps/explorer/src/app/components/signature/signature.tsx b/apps/explorer/src/app/components/signature/signature.tsx new file mode 100644 index 000000000..88f73d2fb --- /dev/null +++ b/apps/explorer/src/app/components/signature/signature.tsx @@ -0,0 +1,59 @@ +import { useState } from 'react'; +import type { BlockExplorerTransactionResult } from '../../routes/types/block-explorer-response'; +import { + CopyWithTooltip, + VegaIcon, + VegaIconNames, +} from '@vegaprotocol/ui-toolkit'; +import { t } from '@vegaprotocol/i18n'; + +interface SignatureProps { + signature: BlockExplorerTransactionResult['signature']; +} + +const valueClass = + 'font-mono px-2.5 py-0.5 text-xs max-w-[200px] cursor-pointer'; +const valueClassClosed = 'text-ellipsis overflow-hidden'; +const valueClassOpen = 'break-words text-left'; + +/** + * Viewer component for a vega signature. Featuers copy and pasting, truncation + * + * @param signature + */ +export const Signature = ({ signature }: SignatureProps) => { + const [isOpen, setIsOpen] = useState(false); + + if (!signature || !signature.value || !signature.version || !signature.algo) { + return null; + } + + return ( +
+ + {signature.algo} + +
+ + {signature.value} + +
+ +
+ ); +}; diff --git a/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx b/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx index b9b202adf..f093646c0 100644 --- a/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx +++ b/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx @@ -9,6 +9,7 @@ import { Time } from '../../../time'; import { ChainResponseCode } from '../chain-response-code/chain-reponse.code'; import { TxDataView } from '../../tx-data-view'; import Hash from '../../../links/hash'; +import { Signature } from '../../../signature/signature'; interface TxDetailsSharedProps { txData: BlockExplorerTransactionResult | undefined; @@ -75,6 +76,12 @@ export const TxDetailsShared = ({ + + {t('Signature')} + + + + {t('Time')} diff --git a/apps/explorer/src/app/components/txs/tx-transfer.spec.tsx b/apps/explorer/src/app/components/txs/tx-transfer.spec.tsx index 1d8ad8413..f9c67e18d 100644 --- a/apps/explorer/src/app/components/txs/tx-transfer.spec.tsx +++ b/apps/explorer/src/app/components/txs/tx-transfer.spec.tsx @@ -98,6 +98,8 @@ describe('TxDetailsTransfer', () => { }, }, signature: { + version: '1', + algo: 'vega/ed25519', value: '610c2e196a7d4fed4413b9e82af267b1ff3e30e943df3a3d28096fd60604d430d752fbaf6dd4f84d496be78885bb6118f40560bff7832c06bd7a3d67b718b700', }, diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx index 107a17521..95e4fa4ef 100644 --- a/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx +++ b/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx @@ -20,6 +20,8 @@ const generateTxs = (number: number): BlockExplorerTransactionResult[] => { '4b782482f587d291e8614219eb9a5ee9280fa2c58982dee71d976782a9be1964', type: 'Submit Order', signature: { + version: '1', + algo: 'vega/ed25519', value: '123', }, code: 0, diff --git a/apps/explorer/src/app/routes/txs/id/tx-details.spec.tsx b/apps/explorer/src/app/routes/txs/id/tx-details.spec.tsx index 7b58423bb..1bb3a0a2f 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-details.spec.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-details.spec.tsx @@ -23,6 +23,8 @@ const txData: BlockExplorerTransactionResult = { type: 'type', command: {} as ValidatorHeartbeat, signature: { + version: '1', + algo: 'vega/ed25519', value: '123', }, }; diff --git a/apps/explorer/src/app/routes/types/block-explorer-response.d.ts b/apps/explorer/src/app/routes/types/block-explorer-response.d.ts index 13a422cd5..3b1c874a9 100644 --- a/apps/explorer/src/app/routes/types/block-explorer-response.d.ts +++ b/apps/explorer/src/app/routes/types/block-explorer-response.d.ts @@ -11,6 +11,8 @@ export interface BlockExplorerTransactionResult { cursor: string; command: components['schemas']['blockexplorerv1transaction']; signature: { + version: string; + algo: string; value: string; }; error?: string;