diff --git a/bun.lock b/bun.lock index 98264ca..08e62c5 100644 --- a/bun.lock +++ b/bun.lock @@ -25,7 +25,7 @@ "clsx": "^2.1.1", "date-fns": "^4.1.0", "graphql": "^16.11.0", - "human-readable-checksum": "./package/human-readable-checksum-0.3.0.tgz", + "human-readable-checksum": "./package/human-readable-checksum-0.2.0.tgz", "lucide-react": "^0.516.0", "nuqs": "2.4.3", "react": "19.1.1", @@ -1550,7 +1550,7 @@ "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], - "human-readable-checksum": ["human-readable-checksum@./package/human-readable-checksum-0.3.0.tgz", { "dependencies": { "pbkdf2": "^3.1.3" } }, "sha512-B1O/e+o+dzo4NPIS4RER+rRQis5SJh/oGNht+ZyFJ+YgJpEcWghJyV3fnTuA1m+2ucgExI3myldZ5JuJRj8eeA=="], + "human-readable-checksum": ["human-readable-checksum@./package/human-readable-checksum-0.2.0.tgz", { "dependencies": { "pbkdf2": "^3.1.3" } }], "human-signals": ["human-signals@5.0.0", "", {}, "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ=="], diff --git a/src/components/common/table-columns/ACCOUNT_BENEFICIARIES_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_BENEFICIARIES_COLUMNS.tsx index cf9ff2d..94676ec 100644 --- a/src/components/common/table-columns/ACCOUNT_BENEFICIARIES_COLUMNS.tsx +++ b/src/components/common/table-columns/ACCOUNT_BENEFICIARIES_COLUMNS.tsx @@ -8,7 +8,7 @@ import { formatMonetaryValue } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const ACCOUNT_BENEFICIARIES_COLUMNS = [ - columnHelper.accessor('node.who.id', { + columnHelper.accessor('who.id', { id: 'id', header: 'Identity', cell: (props) => ( @@ -19,19 +19,19 @@ export const ACCOUNT_BENEFICIARIES_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.who.free', { + columnHelper.accessor('who.free', { id: 'free', header: 'Free', cell: (props) => formatMonetaryValue(props.getValue(), 5), enableSorting: true }), - columnHelper.accessor('node.who.frozen', { + columnHelper.accessor('who.frozen', { id: 'frozen', header: 'Frozen', cell: (props) => formatMonetaryValue(props.getValue(), 5), enableSorting: true }), - columnHelper.accessor('node.who.reserved', { + columnHelper.accessor('who.reserved', { id: 'reserved', header: 'Reserved', cell: (props) => formatMonetaryValue(props.getValue(), 5), diff --git a/src/components/common/table-columns/ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS.tsx deleted file mode 100644 index 88c4904..0000000 --- a/src/components/common/table-columns/ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountCancelledReversibleTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = - createColumnHelper(); - -export const ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS = [ - columnHelper.accessor('node.scheduledTransfer.tx_id', { - id: 'tx-id', - header: 'Tx ID', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'blockNumber', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.cancelledBy.id', { - id: 'cancelledBy', - header: 'Cancelled By', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS.tsx deleted file mode 100644 index 2cca26d..0000000 --- a/src/components/common/table-columns/ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountExecutedReversibleTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS = [ - columnHelper.accessor('node.scheduledTransfer.tx_id', { - id: 'tx-id', - header: 'Tx ID', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'blockNumber', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.scheduledTransfer.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/ACCOUNT_GUARDIAN_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_GUARDIAN_COLUMNS.tsx index 4ec5222..e2b5cc6 100644 --- a/src/components/common/table-columns/ACCOUNT_GUARDIAN_COLUMNS.tsx +++ b/src/components/common/table-columns/ACCOUNT_GUARDIAN_COLUMNS.tsx @@ -8,7 +8,7 @@ import { formatMonetaryValue } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const ACCOUNT_GUARDIAN_COLUMNS = [ - columnHelper.accessor('node.interceptor.id', { + columnHelper.accessor('interceptor.id', { id: 'id', header: 'Identity', cell: (props) => ( @@ -19,19 +19,19 @@ export const ACCOUNT_GUARDIAN_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.interceptor.free', { + columnHelper.accessor('interceptor.free', { id: 'free', header: 'Free', cell: (props) => formatMonetaryValue(props.getValue(), 5), enableSorting: true }), - columnHelper.accessor('node.interceptor.frozen', { + columnHelper.accessor('interceptor.frozen', { id: 'frozen', header: 'Frozen', cell: (props) => formatMonetaryValue(props.getValue(), 5), enableSorting: true }), - columnHelper.accessor('node.interceptor.reserved', { + columnHelper.accessor('interceptor.reserved', { id: 'reserved', header: 'Reserved', cell: (props) => formatMonetaryValue(props.getValue(), 5), diff --git a/src/components/common/table-columns/ACCOUNT_MINER_REWARDS_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_MINER_REWARDS_COLUMNS.tsx deleted file mode 100644 index 6bbb7a8..0000000 --- a/src/components/common/table-columns/ACCOUNT_MINER_REWARDS_COLUMNS.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountMinerRewards } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const ACCOUNT_MINER_REWARDS_COLUMNS = [ - columnHelper.accessor('node.block.hash', { - id: 'node_block_hash', - header: 'Hash', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.block.height', { - id: 'node_block_height', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.miner.id', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.reward', { - id: 'from', - header: 'From', - cell: (props) => formatMonetaryValue(props.getValue()), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'to', - header: 'To', - cell: (props) => , - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS.tsx deleted file mode 100644 index 6e56fa3..0000000 --- a/src/components/common/table-columns/ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountScheduledReversibleTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = - createColumnHelper(); - -export const ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS = [ - columnHelper.accessor('node.tx_id', { - id: 'tx-id', - header: 'Tx ID', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'blockNumber', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.scheduled_at', { - id: 'scheduledAt', - header: 'Scheduled At', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/ACCOUNT_TRANSACTION_COLUMNS.tsx b/src/components/common/table-columns/ACCOUNT_TRANSACTION_COLUMNS.tsx deleted file mode 100644 index f8c9be3..0000000 --- a/src/components/common/table-columns/ACCOUNT_TRANSACTION_COLUMNS.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const ACCOUNT_TRANSACTION_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { - id: 'tx-hash', - header: 'Hash', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'blockNumber', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }), - columnHelper.accessor('node.fee', { - id: 'fee', - header: 'Fee', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/BLOCK_CANCELLED_REVERSIBLE_COLUMNS.tsx b/src/components/common/table-columns/BLOCK_CANCELLED_REVERSIBLE_COLUMNS.tsx deleted file mode 100644 index 1e0bf70..0000000 --- a/src/components/common/table-columns/BLOCK_CANCELLED_REVERSIBLE_COLUMNS.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockCancelledReversibleTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const BLOCK_CANCELLED_REVERSIBLE_COLUMNS = [ - columnHelper.accessor('node.tx_id', { - id: 'tx-id', - header: 'Tx ID', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.cancelledBy.id', { - id: 'cancelledBy', - header: 'Cancelled By', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/BLOCK_ERROR_EVENT_COLUMNS.tsx b/src/components/common/table-columns/BLOCK_ERROR_EVENT_COLUMNS.tsx deleted file mode 100644 index 714978e..0000000 --- a/src/components/common/table-columns/BLOCK_ERROR_EVENT_COLUMNS.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockErrorEvent } from '@/schemas'; -import { formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const BLOCK_ERROR_EVENT_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { - id: 'extrinsicHash', - header: 'Extrinsic Hash', - cell: (props) => - props.getValue() ? ( - - ) : ( - 'Is not available' - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'block_height', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.error_type', { - id: 'errorType', - header: 'Type', - cell: (props) => props.getValue(), - enableSorting: true - }), - columnHelper.accessor('node.error_name', { - id: 'errorName', - header: 'Name', - cell: (props) => props.getValue() ?? '-', - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/BLOCK_EXECUTED_REVERSIBLE_COLUMNS.tsx b/src/components/common/table-columns/BLOCK_EXECUTED_REVERSIBLE_COLUMNS.tsx deleted file mode 100644 index 74be939..0000000 --- a/src/components/common/table-columns/BLOCK_EXECUTED_REVERSIBLE_COLUMNS.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockExecutedReversibleTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const BLOCK_EXECUTED_REVERSIBLE_COLUMNS = [ - columnHelper.accessor('node.tx_id', { - id: 'tx-id', - header: 'Tx ID', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.scheduledTransfer.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.scheduledTransfer.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/BLOCK_HIGH_SECURITY_SET_COLUMNS.tsx b/src/components/common/table-columns/BLOCK_HIGH_SECURITY_SET_COLUMNS.tsx deleted file mode 100644 index cda8242..0000000 --- a/src/components/common/table-columns/BLOCK_HIGH_SECURITY_SET_COLUMNS.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockHighSecuritySet } from '@/schemas'; -import { formatDuration, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const BLOCK_HIGH_SECURITY_SET_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { - id: 'tx-hash', - header: 'Hash', - cell: (props) => - props.getValue() ? ( - - ) : ( - 'Is not available' - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'block_height', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.who.id', { - id: 'who', - header: 'Beneficiary', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.interceptor.id', { - id: 'interceptor', - header: 'Guardian', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.delay', { - id: 'delay', - header: 'Reversible Time', - cell: (props) => formatDuration(props.getValue()), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/BLOCK_SCHEDULED_REVERSIBLE_COLUMNS.tsx b/src/components/common/table-columns/BLOCK_SCHEDULED_REVERSIBLE_COLUMNS.tsx deleted file mode 100644 index b4a1bfb..0000000 --- a/src/components/common/table-columns/BLOCK_SCHEDULED_REVERSIBLE_COLUMNS.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockScheduledReversibleTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const BLOCK_SCHEDULED_REVERSIBLE_COLUMNS = [ - columnHelper.accessor('node.tx_id', { - id: 'tx-id', - header: 'Tx ID', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.scheduled_at', { - id: 'scheduledAt', - header: 'Scheduled At', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/BLOCK_TRANSACTION_COLUMNS.tsx b/src/components/common/table-columns/BLOCK_TRANSACTION_COLUMNS.tsx deleted file mode 100644 index c577f99..0000000 --- a/src/components/common/table-columns/BLOCK_TRANSACTION_COLUMNS.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { createColumnHelper } from '@tanstack/react-table'; - -import { LinkWithCopy } from '@/components/ui/composites/link-with-copy/LinkWithCopy'; -import { TimestampDisplay } from '@/components/ui/timestamp-display'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockTransaction } from '@/schemas'; -import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; - -const columnHelper = createColumnHelper(); - -export const BLOCK_TRANSACTION_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { - id: 'tx-hash', - header: 'Hash', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.block.height', { - id: 'blockNumber', - header: 'Block', - cell: (props) => ( - - ), - enableSorting: true - }), - columnHelper.accessor('node.timestamp', { - id: 'timestamp', - header: 'Timestamp', - cell: (props) => , - enableSorting: true - }), - columnHelper.accessor('node.from.id', { - id: 'from', - header: 'From', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.to.id', { - id: 'to', - header: 'To', - cell: (props) => ( - - ), - enableSorting: false - }), - columnHelper.accessor('node.amount', { - id: 'amount', - header: 'Amount', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }), - columnHelper.accessor('node.fee', { - id: 'fee', - header: 'Fee', - cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true - }) -]; diff --git a/src/components/common/table-columns/CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS.tsx b/src/components/common/table-columns/CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS.tsx index 01fe0e1..e5aec08 100644 --- a/src/components/common/table-columns/CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS.tsx +++ b/src/components/common/table-columns/CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS = [ - columnHelper.accessor('node.tx_id', { + columnHelper.accessor('tx_id', { id: 'tx-id', header: 'Tx ID', cell: (props) => ( @@ -21,7 +21,7 @@ export const CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -32,13 +32,13 @@ export const CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.cancelledBy.id', { + columnHelper.accessor('cancelledBy.id', { id: 'cancelledBy', header: 'Cancelled By', cell: (props) => ( @@ -50,7 +50,7 @@ export const CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.scheduledTransfer.from.id', { + columnHelper.accessor('scheduledTransfer.from.id', { id: 'from', header: 'From', cell: (props) => ( @@ -62,7 +62,7 @@ export const CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.scheduledTransfer.to.id', { + columnHelper.accessor('scheduledTransfer.to.id', { id: 'to', header: 'To', cell: (props) => ( @@ -74,7 +74,7 @@ export const CANCELLED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.scheduledTransfer.amount', { + columnHelper.accessor('scheduledTransfer.amount', { id: 'amount', header: 'Amount', cell: (props) => formatMonetaryValue(props.getValue(), 5), diff --git a/src/components/common/table-columns/ERROR_EVENT_COLUMNS.tsx b/src/components/common/table-columns/ERROR_EVENT_COLUMNS.tsx index 50b9a56..3b7ec42 100644 --- a/src/components/common/table-columns/ERROR_EVENT_COLUMNS.tsx +++ b/src/components/common/table-columns/ERROR_EVENT_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const ERROR_EVENT_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { + columnHelper.accessor('extrinsic.id', { id: 'extrinsicHash', header: 'Extrinsic Hash', cell: (props) => @@ -24,7 +24,7 @@ export const ERROR_EVENT_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -35,19 +35,19 @@ export const ERROR_EVENT_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.error_type', { + columnHelper.accessor('error_type', { id: 'errorType', header: 'Type', cell: (props) => props.getValue(), enableSorting: true }), - columnHelper.accessor('node.error_name', { + columnHelper.accessor('error_name', { id: 'errorName', header: 'Name', cell: (props) => props.getValue() ?? '-', diff --git a/src/components/common/table-columns/EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS.tsx b/src/components/common/table-columns/EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS.tsx index 53d3f23..697a4a2 100644 --- a/src/components/common/table-columns/EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS.tsx +++ b/src/components/common/table-columns/EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS = [ - columnHelper.accessor('node.tx_id', { + columnHelper.accessor('tx_id', { id: 'tx-id', header: 'Tx ID', cell: (props) => ( @@ -21,7 +21,7 @@ export const EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -32,13 +32,13 @@ export const EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.scheduledTransfer.from.id', { + columnHelper.accessor('scheduledTransfer.from.id', { id: 'from', header: 'From', cell: (props) => ( @@ -50,7 +50,7 @@ export const EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.scheduledTransfer.to.id', { + columnHelper.accessor('scheduledTransfer.to.id', { id: 'to', header: 'To', cell: (props) => ( @@ -62,7 +62,7 @@ export const EXECUTED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.scheduledTransfer.amount', { + columnHelper.accessor('scheduledTransfer.amount', { id: 'amount', header: 'Amount', cell: (props) => formatMonetaryValue(props.getValue(), 5), diff --git a/src/components/common/table-columns/HIGH_SECURITY_SET_COLUMNS.tsx b/src/components/common/table-columns/HIGH_SECURITY_SET_COLUMNS.tsx index bf1134f..ec09641 100644 --- a/src/components/common/table-columns/HIGH_SECURITY_SET_COLUMNS.tsx +++ b/src/components/common/table-columns/HIGH_SECURITY_SET_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatDuration, formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const HIGH_SECURITY_SET_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { + columnHelper.accessor('extrinsic.id', { id: 'tx-hash', header: 'Hash', cell: (props) => @@ -24,7 +24,7 @@ export const HIGH_SECURITY_SET_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -35,13 +35,13 @@ export const HIGH_SECURITY_SET_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.who.id', { + columnHelper.accessor('who.id', { id: 'who', header: 'Beneficiary', cell: (props) => ( @@ -53,7 +53,7 @@ export const HIGH_SECURITY_SET_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.interceptor.id', { + columnHelper.accessor('interceptor.id', { id: 'interceptor', header: 'Guardian', cell: (props) => ( @@ -65,7 +65,7 @@ export const HIGH_SECURITY_SET_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.delay', { + columnHelper.accessor('delay', { id: 'delay', header: 'Reversible Time', cell: (props) => formatDuration(props.getValue()), diff --git a/src/components/common/table-columns/MINER_REWARD_COLUMNS.tsx b/src/components/common/table-columns/MINER_REWARD_COLUMNS.tsx index ad01a4b..b48fc21 100644 --- a/src/components/common/table-columns/MINER_REWARD_COLUMNS.tsx +++ b/src/components/common/table-columns/MINER_REWARD_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const MINER_REWARD_COLUMNS = [ - columnHelper.accessor('node.block.hash', { + columnHelper.accessor('block.hash', { id: 'block_hash', header: 'Hash', cell: (props) => ( @@ -20,7 +20,7 @@ export const MINER_REWARD_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -31,7 +31,7 @@ export const MINER_REWARD_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.miner.id', { + columnHelper.accessor('miner.id', { id: 'miner', header: 'Mined by', cell: (props) => ( @@ -42,13 +42,13 @@ export const MINER_REWARD_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.reward', { + columnHelper.accessor('reward', { id: 'reward', header: 'Reward', cell: (props) => formatMonetaryValue(props.getValue()), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , diff --git a/src/components/common/table-columns/SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS.tsx b/src/components/common/table-columns/SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS.tsx index 073bcac..54c06c1 100644 --- a/src/components/common/table-columns/SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS.tsx +++ b/src/components/common/table-columns/SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS = [ - columnHelper.accessor('node.tx_id', { + columnHelper.accessor('tx_id', { id: 'tx-id', header: 'Tx ID', cell: (props) => ( @@ -21,7 +21,7 @@ export const SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -32,19 +32,19 @@ export const SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.scheduled_at', { + columnHelper.accessor('scheduled_at', { id: 'scheduled_at', header: 'Scheduled At', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.from.id', { + columnHelper.accessor('from.id', { id: 'from', header: 'From', cell: (props) => ( @@ -56,7 +56,7 @@ export const SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.to.id', { + columnHelper.accessor('to.id', { id: 'to', header: 'To', cell: (props) => ( @@ -68,7 +68,7 @@ export const SCHEDULED_REVERSIBLE_TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.amount', { + columnHelper.accessor('amount', { id: 'amount', header: 'Amount', cell: (props) => formatMonetaryValue(props.getValue(), 5), diff --git a/src/components/common/table-columns/TRANSACTION_COLUMNS.tsx b/src/components/common/table-columns/TRANSACTION_COLUMNS.tsx index e0feb45..a056847 100644 --- a/src/components/common/table-columns/TRANSACTION_COLUMNS.tsx +++ b/src/components/common/table-columns/TRANSACTION_COLUMNS.tsx @@ -9,7 +9,7 @@ import { formatMonetaryValue, formatTxAddress } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const TRANSACTION_COLUMNS = [ - columnHelper.accessor('node.extrinsic.id', { + columnHelper.accessor('extrinsic.id', { id: 'tx-hash', header: 'Hash', cell: (props) => @@ -24,7 +24,7 @@ export const TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.block.height', { + columnHelper.accessor('block.height', { id: 'block_height', header: 'Block', cell: (props) => ( @@ -35,13 +35,13 @@ export const TRANSACTION_COLUMNS = [ ), enableSorting: true }), - columnHelper.accessor('node.timestamp', { + columnHelper.accessor('timestamp', { id: 'timestamp', header: 'Timestamp', cell: (props) => , enableSorting: true }), - columnHelper.accessor('node.from.id', { + columnHelper.accessor('from.id', { id: 'from', header: 'From', cell: (props) => ( @@ -53,7 +53,7 @@ export const TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.to.id', { + columnHelper.accessor('to.id', { id: 'to', header: 'To', cell: (props) => ( @@ -65,13 +65,13 @@ export const TRANSACTION_COLUMNS = [ ), enableSorting: false }), - columnHelper.accessor('node.amount', { + columnHelper.accessor('amount', { id: 'amount', header: 'Amount', cell: (props) => formatMonetaryValue(props.getValue(), 5), enableSorting: true }), - columnHelper.accessor('node.fee', { + columnHelper.accessor('fee', { id: 'fee', header: 'Fee', cell: (props) => formatMonetaryValue(props.getValue(), 5), diff --git a/src/components/features/account-details/account-all-transactions/hook.tsx b/src/components/features/account-details/account-all-transactions/hook.tsx index 69f3a3f..b02ce76 100644 --- a/src/components/features/account-details/account-all-transactions/hook.tsx +++ b/src/components/features/account-details/account-all-transactions/hook.tsx @@ -18,11 +18,7 @@ import { transformScheduledTransaction, transformWormholeOutput } from '@/hooks/useUnifiedTransactions'; -import type { - AccountResponse, - HighSecuritySet, - UnifiedTransaction -} from '@/schemas'; +import type { AccountResponse, UnifiedTransaction } from '@/schemas'; // Account page shows block column const columns = createUnifiedTransactionColumns({ showBlockColumn: true }); @@ -73,15 +69,13 @@ export const useAccountAllTransactions = ( unified.push( transformHighSecuritySet( { - node: { - timestamp: (guardian as any).timestamp ?? '', - block: (guardian as any).block ?? { - height: 0 - }, - who: { id: '' }, // Guardian view doesn't have who (it's the current account) - interceptor: guardian.node.interceptor - } - } as HighSecuritySet, + timestamp: (guardian as { timestamp?: string }).timestamp ?? '', + block: (guardian as { block?: { height: number } }).block ?? { + height: 0 + }, + who: { id: '' }, // Guardian view doesn't have who (it's the current account) + interceptor: guardian.interceptor + }, idx ) ); @@ -92,15 +86,13 @@ export const useAccountAllTransactions = ( unified.push( transformHighSecuritySet( { - node: { - timestamp: (beneficiary as any).timestamp ?? '', - block: (beneficiary as any).block ?? { - height: 0 - }, - who: beneficiary.node.who, - interceptor: { id: '' } // Beneficiary view doesn't have interceptor (it's the current account) - } - } as HighSecuritySet, + timestamp: (beneficiary as { timestamp?: string }).timestamp ?? '', + block: (beneficiary as { block?: { height: number } }).block ?? { + height: 0 + }, + who: beneficiary.who, + interceptor: { id: '' } // Beneficiary view doesn't have interceptor (it's the current account) + }, idx ) ); diff --git a/src/components/features/account-details/account-cancelled-reversible-transactions/AccountCancelledReversibleTransactions.tsx b/src/components/features/account-details/account-cancelled-reversible-transactions/AccountCancelledReversibleTransactions.tsx deleted file mode 100644 index afe8d01..0000000 --- a/src/components/features/account-details/account-cancelled-reversible-transactions/AccountCancelledReversibleTransactions.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import type { FC } from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountResponse } from '@/schemas'; - -import { useAccountCancelledReversibleTransactions } from './hook'; - -interface Props { - query: QueryResult; - accountId: string; -} - -export const AccountCancelledReversibleTransactions: FC = ({ - query, - accountId -}) => { - const { getStatus, table, error } = - useAccountCancelledReversibleTransactions(query); - - return ( - -

Recent Cancelled Reversible Transactions

- - Error : {error && error.message}

- }} - /> - - {!query.loading && - query.data?.cancelledReversibleTransactions.aggregate.totalCount !== - 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/account-details/account-cancelled-reversible-transactions/hook.tsx b/src/components/features/account-details/account-cancelled-reversible-transactions/hook.tsx deleted file mode 100644 index ca84323..0000000 --- a/src/components/features/account-details/account-cancelled-reversible-transactions/hook.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useCallback, useMemo } from 'react'; - -import { ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS } from '@/components/common/table-columns/ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS'; -import type { - AccountCancelledReversibleTransaction, - AccountResponse -} from '@/schemas'; - -export const useAccountCancelledReversibleTransactions = ( - query: QueryResult -) => { - const { data, error: fetchError, loading } = query; - const columns = useMemo(() => ACCOUNT_CANCELLED_REVERSIBLE_COLUMNS, []); - - const tableData = useMemo( - () => data?.cancelledReversibleTransactions?.nodes ?? [], - [data?.cancelledReversibleTransactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: columns as any, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = useCallback(() => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }, [success, error, loading]); - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/account-details/account-executed-reversible-transactions/AccountExecutedReversibleTransactions.tsx b/src/components/features/account-details/account-executed-reversible-transactions/AccountExecutedReversibleTransactions.tsx deleted file mode 100644 index e2ece5e..0000000 --- a/src/components/features/account-details/account-executed-reversible-transactions/AccountExecutedReversibleTransactions.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import type { FC } from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountResponse } from '@/schemas'; - -import { useAccountExecutedReversibleTransactions } from './hook'; - -interface Props { - query: QueryResult; - accountId: string; -} - -export const AccountExecutedReversibleTransactions: FC = ({ - query, - accountId -}) => { - const { getStatus, table, error } = - useAccountExecutedReversibleTransactions(query); - - return ( - -

Recent Executed Reversible Transactions

- - Error : {error && error.message}

- }} - /> - - {!query.loading && - query.data?.executedReversibleTransactions.aggregate.totalCount !== - 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/account-details/account-executed-reversible-transactions/hook.tsx b/src/components/features/account-details/account-executed-reversible-transactions/hook.tsx deleted file mode 100644 index d5c74ef..0000000 --- a/src/components/features/account-details/account-executed-reversible-transactions/hook.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useCallback, useMemo } from 'react'; - -import { ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS } from '@/components/common/table-columns/ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS'; -import type { - AccountExecutedReversibleTransaction, - AccountResponse -} from '@/schemas'; - -export const useAccountExecutedReversibleTransactions = ( - query: QueryResult -) => { - const { data, error: fetchError, loading } = query; - const columns = useMemo(() => ACCOUNT_EXECUTED_REVERSIBLE_COLUMNS, []); - - const tableData = useMemo( - () => data?.executedReversibleTransactions?.nodes ?? [], - [data?.executedReversibleTransactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: columns as any, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = useCallback(() => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }, [success, error, loading]); - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/account-details/account-miner-rewards/AccountMinerRewards.tsx b/src/components/features/account-details/account-miner-rewards/AccountMinerRewards.tsx deleted file mode 100644 index 466655b..0000000 --- a/src/components/features/account-details/account-miner-rewards/AccountMinerRewards.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import type { AccountResponse } from '@/schemas'; - -import { useAccountMinerRewards } from './hook'; - -interface Props { - query: QueryResult; - accountId: string; -} - -export const AccountMinerRewards: React.FC = ({ query, accountId }) => { - const { getStatus, table, error } = useAccountMinerRewards(query); - - return ( - -

Recent Miner Rewards

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.minerRewards.aggregate.totalCount !== 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/account-details/account-miner-rewards/hook.tsx b/src/components/features/account-details/account-miner-rewards/hook.tsx deleted file mode 100644 index 33a803d..0000000 --- a/src/components/features/account-details/account-miner-rewards/hook.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useCallback, useMemo } from 'react'; - -import { ACCOUNT_MINER_REWARDS_COLUMNS } from '@/components/common/table-columns/ACCOUNT_MINER_REWARDS_COLUMNS'; -import type { AccountMinerRewards, AccountResponse } from '@/schemas'; - -export const useAccountMinerRewards = (query: QueryResult) => { - const { data, error: fetchError, loading } = query; - const minerRewardColumns = useMemo(() => ACCOUNT_MINER_REWARDS_COLUMNS, []); - - const tableData = useMemo( - () => data?.minerRewards?.nodes ?? [], - [data?.minerRewards?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: minerRewardColumns, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = useCallback(() => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }, [success, error, loading]); - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/account-details/account-scheduled-reversible-transactions/AccountScheduledReversibleTransactions.tsx b/src/components/features/account-details/account-scheduled-reversible-transactions/AccountScheduledReversibleTransactions.tsx deleted file mode 100644 index bf1bdbe..0000000 --- a/src/components/features/account-details/account-scheduled-reversible-transactions/AccountScheduledReversibleTransactions.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import type { FC } from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import { RESOURCES } from '@/constants/resources'; -import type { AccountResponse } from '@/schemas'; - -import { useAccountScheduledReversibleTransactions } from './hook'; - -interface Props { - query: QueryResult; - accountId: string; -} - -export const AccountScheduledReversibleTransactions: FC = ({ - query, - accountId -}) => { - const { getStatus, table, error } = - useAccountScheduledReversibleTransactions(query); - - return ( - -

Recent Scheduled Reversible Transactions

- - Error : {error && error.message}

- }} - /> - - {!query.loading && - query.data?.scheduledReversibleTransactions.aggregate.totalCount !== - 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/account-details/account-scheduled-reversible-transactions/hook.tsx b/src/components/features/account-details/account-scheduled-reversible-transactions/hook.tsx deleted file mode 100644 index db3a9db..0000000 --- a/src/components/features/account-details/account-scheduled-reversible-transactions/hook.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useCallback, useMemo } from 'react'; - -import { ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS } from '@/components/common/table-columns/ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS'; -import type { - AccountResponse, - AccountScheduledReversibleTransaction -} from '@/schemas'; - -export const useAccountScheduledReversibleTransactions = ( - query: QueryResult -) => { - const { data, error: fetchError, loading } = query; - const columns = useMemo(() => ACCOUNT_SCHEDULED_REVERSIBLE_COLUMNS, []); - - const tableData = useMemo( - () => data?.scheduledReversibleTransactions?.nodes ?? [], - [data?.scheduledReversibleTransactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: columns as any, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = useCallback(() => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }, [success, error, loading]); - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/account-details/account-transactions/AccountTransactions.tsx b/src/components/features/account-details/account-transactions/AccountTransactions.tsx deleted file mode 100644 index 39cc3fe..0000000 --- a/src/components/features/account-details/account-transactions/AccountTransactions.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import type { AccountResponse } from '@/schemas'; - -import { useAccountTransactions } from './hook'; - -interface Props { - query: QueryResult; - accountId: string; -} - -export const AccountTransactions: React.FC = ({ query, accountId }) => { - const { getStatus, table, error } = useAccountTransactions(query); - - return ( - -

Recent Immediate Transactions

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.transactions.aggregate.totalCount !== 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/account-details/account-transactions/hook.tsx b/src/components/features/account-details/account-transactions/hook.tsx deleted file mode 100644 index 6f1de7a..0000000 --- a/src/components/features/account-details/account-transactions/hook.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useCallback, useMemo } from 'react'; - -import { ACCOUNT_TRANSACTION_COLUMNS } from '@/components/common/table-columns/ACCOUNT_TRANSACTION_COLUMNS'; -import type { AccountResponse, AccountTransaction } from '@/schemas'; - -export const useAccountTransactions = (query: QueryResult) => { - const { data, error: fetchError, loading } = query; - const transactionColumns = useMemo(() => ACCOUNT_TRANSACTION_COLUMNS, []); - - const tableData = useMemo( - () => data?.transactions?.nodes ?? [], - [data?.transactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: transactionColumns, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = useCallback(() => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }, [success, error, loading]); - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/block-details/block-cancelled-reversible-transactions/BlockCancelledReversibleTransactions.tsx b/src/components/features/block-details/block-cancelled-reversible-transactions/BlockCancelledReversibleTransactions.tsx deleted file mode 100644 index 0e05b26..0000000 --- a/src/components/features/block-details/block-cancelled-reversible-transactions/BlockCancelledReversibleTransactions.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockResponse } from '@/schemas'; - -import { useBlockCancelledReversibleTransactions } from './hook'; - -interface Props { - query: QueryResult; -} - -export const BlockCancelledReversibleTransactions: React.FC = ({ - query -}) => { - const { getStatus, table, error } = - useBlockCancelledReversibleTransactions(query); - - return ( - -

Recent Cancelled Reversible Transactions

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.cancelledReversibleTransactions.aggregate.totalCount !== - 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/block-details/block-cancelled-reversible-transactions/hook.tsx b/src/components/features/block-details/block-cancelled-reversible-transactions/hook.tsx deleted file mode 100644 index f89bafe..0000000 --- a/src/components/features/block-details/block-cancelled-reversible-transactions/hook.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useMemo } from 'react'; - -import { BLOCK_CANCELLED_REVERSIBLE_COLUMNS } from '@/components/common/table-columns/BLOCK_CANCELLED_REVERSIBLE_COLUMNS'; -import type { - BlockCancelledReversibleTransaction, - BlockResponse -} from '@/schemas'; - -export const useBlockCancelledReversibleTransactions = ( - query: QueryResult -) => { - const { data, error: fetchError, loading } = query; - const columns = useMemo(() => BLOCK_CANCELLED_REVERSIBLE_COLUMNS, []); - - const tableData = useMemo( - () => data?.cancelledReversibleTransactions?.nodes ?? [], - [data?.cancelledReversibleTransactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: columns as any, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = () => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }; - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/block-details/block-error-events/BlockErrorEvents.tsx b/src/components/features/block-details/block-error-events/BlockErrorEvents.tsx deleted file mode 100644 index a2df7ee..0000000 --- a/src/components/features/block-details/block-error-events/BlockErrorEvents.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import type { BlockResponse } from '@/schemas'; - -import { useBlockErrorEvents } from './hook'; - -interface Props { - query: QueryResult; -} - -export const BlockErrorEvents: React.FC = ({ query }) => { - const { getStatus, table, error } = useBlockErrorEvents(query); - - return ( - -

Recent Error Events

- - Error: {error && error.message}

- }} - /> - - {!query.loading && query.data?.errorEvents.aggregate.totalCount !== 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/block-details/block-error-events/hook.tsx b/src/components/features/block-details/block-error-events/hook.tsx deleted file mode 100644 index d42b44c..0000000 --- a/src/components/features/block-details/block-error-events/hook.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useMemo } from 'react'; - -import { BLOCK_ERROR_EVENT_COLUMNS } from '@/components/common/table-columns/BLOCK_ERROR_EVENT_COLUMNS'; -import type { BlockResponse, BlockErrorEvent } from '@/schemas'; - -export const useBlockErrorEvents = (query: QueryResult) => { - const { data, error: fetchError, loading } = query; - const blockColumns = useMemo(() => BLOCK_ERROR_EVENT_COLUMNS, []); - - const table = useReactTable({ - data: data?.errorEvents?.nodes ?? [], - columns: blockColumns, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = () => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }; - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/block-details/block-executed-reversible-transactions/BlockExecutedReversibleTransactions.tsx b/src/components/features/block-details/block-executed-reversible-transactions/BlockExecutedReversibleTransactions.tsx deleted file mode 100644 index 2092243..0000000 --- a/src/components/features/block-details/block-executed-reversible-transactions/BlockExecutedReversibleTransactions.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockResponse } from '@/schemas'; - -import { useBlockExecutedReversibleTransactions } from './hook'; - -interface Props { - query: QueryResult; -} - -export const BlockExecutedReversibleTransactions: React.FC = ({ - query -}) => { - const { getStatus, table, error } = - useBlockExecutedReversibleTransactions(query); - - return ( - -

Recent Executed Reversible Transactions

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.executedReversibleTransactions.aggregate.totalCount !== - 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/block-details/block-executed-reversible-transactions/hook.tsx b/src/components/features/block-details/block-executed-reversible-transactions/hook.tsx deleted file mode 100644 index d7b4185..0000000 --- a/src/components/features/block-details/block-executed-reversible-transactions/hook.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useMemo } from 'react'; - -import { BLOCK_EXECUTED_REVERSIBLE_COLUMNS } from '@/components/common/table-columns/BLOCK_EXECUTED_REVERSIBLE_COLUMNS'; -import type { - BlockExecutedReversibleTransaction, - BlockResponse -} from '@/schemas'; - -export const useBlockExecutedReversibleTransactions = ( - query: QueryResult -) => { - const { data, error: fetchError, loading } = query; - const columns = useMemo(() => BLOCK_EXECUTED_REVERSIBLE_COLUMNS, []); - - const tableData = useMemo( - () => data?.executedReversibleTransactions?.nodes ?? [], - [data?.executedReversibleTransactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: columns as any, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = () => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }; - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/block-details/block-high-security-sets/BlockHighSecuritySets.tsx b/src/components/features/block-details/block-high-security-sets/BlockHighSecuritySets.tsx deleted file mode 100644 index eb75a3a..0000000 --- a/src/components/features/block-details/block-high-security-sets/BlockHighSecuritySets.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import type { BlockResponse } from '@/schemas'; - -import { useBlockHighSecuritySets } from './hook'; - -interface Props { - query: QueryResult; -} - -export const BlockHighSecuritySets: React.FC = ({ query }) => { - const { getStatus, table, error } = useBlockHighSecuritySets(query); - - return ( - -

Recent High Security Sets

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.highSecuritySets.aggregate.totalCount !== 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/block-details/block-high-security-sets/hook.tsx b/src/components/features/block-details/block-high-security-sets/hook.tsx deleted file mode 100644 index 8c45a62..0000000 --- a/src/components/features/block-details/block-high-security-sets/hook.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useMemo } from 'react'; - -import { BLOCK_HIGH_SECURITY_SET_COLUMNS } from '@/components/common/table-columns/BLOCK_HIGH_SECURITY_SET_COLUMNS'; -import type { BlockResponse, BlockHighSecuritySet } from '@/schemas'; - -export const useBlockHighSecuritySets = (query: QueryResult) => { - const { data, error: fetchError, loading } = query; - const blockColumns = useMemo(() => BLOCK_HIGH_SECURITY_SET_COLUMNS, []); - - const table = useReactTable({ - data: data?.highSecuritySets?.nodes ?? [], - columns: blockColumns, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = () => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }; - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/block-details/block-scheduled-reversible-transactions/BlockScheduledReversibleTransactions.tsx b/src/components/features/block-details/block-scheduled-reversible-transactions/BlockScheduledReversibleTransactions.tsx deleted file mode 100644 index 664e195..0000000 --- a/src/components/features/block-details/block-scheduled-reversible-transactions/BlockScheduledReversibleTransactions.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import { RESOURCES } from '@/constants/resources'; -import type { BlockResponse } from '@/schemas'; - -import { useBlockScheduledReversibleTransactions } from './hook'; - -interface Props { - query: QueryResult; -} - -export const BlockScheduledReversibleTransactions: React.FC = ({ - query -}) => { - const { getStatus, table, error } = - useBlockScheduledReversibleTransactions(query); - - return ( - -

Recent Scheduled Reversible Transactions

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.scheduledReversibleTransactions.aggregate.totalCount !== - 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/block-details/block-scheduled-reversible-transactions/hook.tsx b/src/components/features/block-details/block-scheduled-reversible-transactions/hook.tsx deleted file mode 100644 index 6d00b14..0000000 --- a/src/components/features/block-details/block-scheduled-reversible-transactions/hook.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useMemo } from 'react'; - -import { BLOCK_SCHEDULED_REVERSIBLE_COLUMNS } from '@/components/common/table-columns/BLOCK_SCHEDULED_REVERSIBLE_COLUMNS'; -import type { - BlockResponse, - BlockScheduledReversibleTransaction -} from '@/schemas'; - -export const useBlockScheduledReversibleTransactions = ( - query: QueryResult -) => { - const { data, error: fetchError, loading } = query; - const columns = useMemo(() => BLOCK_SCHEDULED_REVERSIBLE_COLUMNS, []); - - // Map BlockScheduledReversibleTransaction[] to ScheduledReversibleTransaction[] - const tableData = useMemo( - () => data?.scheduledReversibleTransactions?.nodes ?? [], - [data?.scheduledReversibleTransactions?.nodes] - ); - - const table = useReactTable({ - data: tableData, - columns: columns as any, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = () => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }; - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/block-details/block-transactions/BlockTransactions.tsx b/src/components/features/block-details/block-transactions/BlockTransactions.tsx deleted file mode 100644 index 4751ad6..0000000 --- a/src/components/features/block-details/block-transactions/BlockTransactions.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { Link } from '@tanstack/react-router'; -import React from 'react'; - -import { Button } from '@/components/ui/button'; -import { DataTable } from '@/components/ui/composites/data-table/DataTable'; -import { ContentContainer } from '@/components/ui/content-container'; -import type { BlockResponse } from '@/schemas'; - -import { useBlockTransactions } from './hook'; - -interface Props { - query: QueryResult; -} - -export const BlockTransactions: React.FC = ({ query }) => { - const { getStatus, table, error } = useBlockTransactions(query); - - return ( - -

Recent Immediate Transactions

- - Error: {error && error.message}

- }} - /> - - {!query.loading && - query.data?.transactions.aggregate.totalCount !== 0 && ( - - )} -
- ); -}; diff --git a/src/components/features/block-details/block-transactions/hook.tsx b/src/components/features/block-details/block-transactions/hook.tsx deleted file mode 100644 index eab0239..0000000 --- a/src/components/features/block-details/block-transactions/hook.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { QueryResult } from '@apollo/client'; -import { getCoreRowModel, useReactTable } from '@tanstack/react-table'; -import { useMemo } from 'react'; - -import { BLOCK_TRANSACTION_COLUMNS } from '@/components/common/table-columns/BLOCK_TRANSACTION_COLUMNS'; -import type { BlockResponse, BlockTransaction } from '@/schemas'; - -export const useBlockTransactions = (query: QueryResult) => { - const { data, error: fetchError, loading } = query; - const blockColumns = useMemo(() => BLOCK_TRANSACTION_COLUMNS, []); - - const table = useReactTable({ - data: data?.transactions?.nodes ?? [], - columns: blockColumns, - getCoreRowModel: getCoreRowModel(), - enableSorting: false - }); - - const success = !loading && !fetchError; - const error = !loading && fetchError; - - const getStatus = () => { - switch (true) { - case success: - return 'success'; - case !!error: - return 'error'; - case !!loading: - return 'loading'; - default: - return 'idle'; - } - }; - - return { - table, - getStatus, - error - }; -}; diff --git a/src/components/features/cancelled-reversible-transaction-details/cancelled-reversible-transaction-information/CancelledReversibleTransactionInformation.tsx b/src/components/features/cancelled-reversible-transaction-details/cancelled-reversible-transaction-information/CancelledReversibleTransactionInformation.tsx index aae8734..23912b6 100644 --- a/src/components/features/cancelled-reversible-transaction-details/cancelled-reversible-transaction-information/CancelledReversibleTransactionInformation.tsx +++ b/src/components/features/cancelled-reversible-transaction-details/cancelled-reversible-transaction-information/CancelledReversibleTransactionInformation.tsx @@ -29,19 +29,19 @@ export const CancelledReversibleTransactionInformation: React.FC< const tx = data?.cancelledReversibleTransactions[0]; - const information: Partial[] = [ + const information: Partial[] = [ { - tx_id: tx?.node.tx_id, - block: tx?.node.block, - timestamp: tx?.node.timestamp, - cancelledBy: tx?.node.cancelledBy, - extrinsic: tx?.node.extrinsic, - scheduledTransfer: tx?.node.scheduledTransfer + tx_id: tx?.tx_id, + block: tx?.block, + timestamp: tx?.timestamp, + cancelledBy: tx?.cancelledBy, + extrinsic: tx?.extrinsic, + scheduledTransfer: tx?.scheduledTransfer } ]; return ( - > + > loading={loading} data={information} fields={[ @@ -56,7 +56,7 @@ export const CancelledReversibleTransactionInformation: React.FC< label: 'Extrinsic Hash', key: 'extrinsic', render: (value) => ( - + ) }, { @@ -64,8 +64,8 @@ export const CancelledReversibleTransactionInformation: React.FC< key: 'block', render: (value) => ( ) @@ -73,15 +73,15 @@ export const CancelledReversibleTransactionInformation: React.FC< { label: 'Timestamp', key: 'timestamp', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) }, { label: 'Cancelled By', key: 'cancelledBy', render: (value) => ( ) @@ -91,8 +91,8 @@ export const CancelledReversibleTransactionInformation: React.FC< key: 'scheduledTransfer', render: (value) => ( ) @@ -102,8 +102,8 @@ export const CancelledReversibleTransactionInformation: React.FC< key: 'scheduledTransfer', render: (value) => ( ) @@ -111,12 +111,12 @@ export const CancelledReversibleTransactionInformation: React.FC< { label: 'Amount', key: 'scheduledTransfer', - render: (value) => formatMonetaryValue(value?.amount) + render: (value) => formatMonetaryValue(value.amount) }, { label: 'Fee', key: 'scheduledTransfer', - render: (value) => formatMonetaryValue((value as any)?.fee) + render: (value) => formatMonetaryValue(value.fee) } ]} /> diff --git a/src/components/features/error-event-details/error-event-information/ErrorEventInformation.tsx b/src/components/features/error-event-details/error-event-information/ErrorEventInformation.tsx index 94e4fea..0ad6665 100644 --- a/src/components/features/error-event-details/error-event-information/ErrorEventInformation.tsx +++ b/src/components/features/error-event-details/error-event-information/ErrorEventInformation.tsx @@ -23,22 +23,22 @@ export const ErrorEventInformation: React.FC = ({ const event = data?.errorEvents[0]; - const information: Partial[] = [ + const information: Partial[] = [ { - timestamp: event?.node.timestamp, - block: event?.node.block, - extrinsic: event?.node.extrinsic, - error_type: event?.node.error_type, - error_module: event?.node.error_module, - error_name: event?.node.error_name, - error_docs: event?.node.error_docs + timestamp: event?.timestamp, + block: event?.block, + extrinsic: event?.extrinsic, + error_type: event?.error_type, + error_module: event?.error_module, + error_name: event?.error_name, + error_docs: event?.error_docs } ]; return ( <>

Event Information

- > + > loading={loading} data={information} fields={[ @@ -46,9 +46,9 @@ export const ErrorEventInformation: React.FC = ({ label: 'Extrinsic Hash', key: 'extrinsic', render: (value) => - (value as ErrorEvent['node']['extrinsic'])?.id ? ( + (value as ErrorEvent['extrinsic'])?.id ? ( ) : ( @@ -58,15 +58,15 @@ export const ErrorEventInformation: React.FC = ({ { label: 'Timestamp', key: 'timestamp', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) }, { label: 'Block', key: 'block', render: (value) => ( ) diff --git a/src/components/features/executed-reversible-transaction-details/executed-reversible-transaction-information/ExecutedReversibleTransactionInformation.tsx b/src/components/features/executed-reversible-transaction-details/executed-reversible-transaction-information/ExecutedReversibleTransactionInformation.tsx index da3533c..608a134 100644 --- a/src/components/features/executed-reversible-transaction-details/executed-reversible-transaction-information/ExecutedReversibleTransactionInformation.tsx +++ b/src/components/features/executed-reversible-transaction-details/executed-reversible-transaction-information/ExecutedReversibleTransactionInformation.tsx @@ -29,17 +29,17 @@ export const ExecutedReversibleTransactionInformation: React.FC< const tx = data?.executedReversibleTransactions[0]; - const information: Partial[] = [ + const information: Partial[] = [ { - tx_id: tx?.node.tx_id, - block: tx?.node.block, - timestamp: tx?.node.timestamp, - scheduledTransfer: tx?.node.scheduledTransfer + tx_id: tx?.tx_id, + block: tx?.block, + timestamp: tx?.timestamp, + scheduledTransfer: tx?.scheduledTransfer } ]; return ( - > + > loading={loading} data={information} fields={[ @@ -55,8 +55,8 @@ export const ExecutedReversibleTransactionInformation: React.FC< key: 'block', render: (value) => ( ) @@ -64,15 +64,15 @@ export const ExecutedReversibleTransactionInformation: React.FC< { label: 'Timestamp', key: 'timestamp', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) }, { label: 'From', key: 'scheduledTransfer', render: (value) => ( ) @@ -82,8 +82,8 @@ export const ExecutedReversibleTransactionInformation: React.FC< key: 'scheduledTransfer', render: (value) => ( ) @@ -91,12 +91,12 @@ export const ExecutedReversibleTransactionInformation: React.FC< { label: 'Amount', key: 'scheduledTransfer', - render: (value) => formatMonetaryValue(value?.amount) + render: (value) => formatMonetaryValue(value.amount) }, { label: 'Fee', key: 'scheduledTransfer', - render: (value) => formatMonetaryValue((value as any)?.fee) + render: (value) => formatMonetaryValue(value.fee) } ]} /> diff --git a/src/components/features/high-security-set-details/high-security-set-information/HighSecuritySetInformation.tsx b/src/components/features/high-security-set-details/high-security-set-information/HighSecuritySetInformation.tsx index 9f9007c..830c37a 100644 --- a/src/components/features/high-security-set-details/high-security-set-information/HighSecuritySetInformation.tsx +++ b/src/components/features/high-security-set-details/high-security-set-information/HighSecuritySetInformation.tsx @@ -26,19 +26,19 @@ export const HighSecuritySetInformation: React.FC< const highSecuritySet = data?.highSecuritySets[0]; - const information: Partial[] = [ + const information: Partial[] = [ { - extrinsic: highSecuritySet?.node.extrinsic, - block: highSecuritySet?.node.block, - timestamp: highSecuritySet?.node.timestamp, - who: highSecuritySet?.node.who, - interceptor: highSecuritySet?.node.interceptor, - delay: highSecuritySet?.node.delay + extrinsic: highSecuritySet?.extrinsic, + block: highSecuritySet?.block, + timestamp: highSecuritySet?.timestamp, + who: highSecuritySet?.who, + interceptor: highSecuritySet?.interceptor, + delay: highSecuritySet?.delay } ]; return ( - > + > loading={loading} data={information} fields={[ @@ -47,7 +47,7 @@ export const HighSecuritySetInformation: React.FC< key: 'extrinsic', render: (value) => ( ) @@ -57,11 +57,9 @@ export const HighSecuritySetInformation: React.FC< key: 'block', render: (value) => ( @@ -70,7 +68,7 @@ export const HighSecuritySetInformation: React.FC< { label: 'Timestamp', key: 'timestamp', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) }, { label: 'Beneficiary', @@ -78,9 +76,9 @@ export const HighSecuritySetInformation: React.FC< key: 'who', render: (value) => ( @@ -92,9 +90,9 @@ export const HighSecuritySetInformation: React.FC< key: 'interceptor', render: (value) => ( diff --git a/src/components/features/landing/hero/Hero.stories.tsx b/src/components/features/landing/hero/Hero.stories.tsx deleted file mode 100644 index 2ba482f..0000000 --- a/src/components/features/landing/hero/Hero.stories.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react-vite'; - -import { WithProviders } from '@/decorators/WithProviders'; - -import { Hero } from './Hero'; - -const meta: Meta = { - title: 'Components/Features/Landing/Hero', - component: Hero, - parameters: { - layout: 'centered' - }, - decorators: [WithProviders], - argTypes: {} -}; - -export default meta; - -type Story = StoryObj; - -export const Default: Story = { - args: {} -}; diff --git a/src/components/features/miner-reward-details/miner-reward-information/MinerRewardInformation.tsx b/src/components/features/miner-reward-details/miner-reward-information/MinerRewardInformation.tsx index 0497250..330f428 100644 --- a/src/components/features/miner-reward-details/miner-reward-information/MinerRewardInformation.tsx +++ b/src/components/features/miner-reward-details/miner-reward-information/MinerRewardInformation.tsx @@ -25,14 +25,17 @@ export const MinerRewardInformation: React.FC = ({ (prev: MinerReward | undefined, curr: MinerReward) => { if (!prev) return curr; - const newReward = BigInt(prev.node.reward) + BigInt(curr.node.reward); + const newReward = BigInt(prev.reward) + BigInt(curr.reward); const acc: MinerReward = { ...prev, - node: { - ...prev.node, - reward: newReward.toString() - } + block: { + ...prev.block + }, + miner: { + ...prev.miner + }, + reward: newReward.toString() }; return acc; @@ -40,17 +43,17 @@ export const MinerRewardInformation: React.FC = ({ undefined ); - const information: Partial[] = [ + const information: Partial[] = [ { - block: minerReward?.node.block, - miner: minerReward?.node.miner, - reward: minerReward?.node.reward, - timestamp: minerReward?.node.timestamp + block: minerReward?.block, + miner: minerReward?.miner, + reward: minerReward?.reward, + timestamp: minerReward?.timestamp } ]; return ( - > + > loading={loading} data={information} fields={[ @@ -59,7 +62,7 @@ export const MinerRewardInformation: React.FC = ({ key: 'block', render: (value) => ( ) @@ -69,8 +72,8 @@ export const MinerRewardInformation: React.FC = ({ key: 'block', render: (value) => ( ) @@ -80,8 +83,8 @@ export const MinerRewardInformation: React.FC = ({ key: 'miner', render: (value) => ( ) @@ -89,12 +92,12 @@ export const MinerRewardInformation: React.FC = ({ { label: 'Reward', key: 'reward', - render: (value) => formatMonetaryValue(value as string) + render: (value) => formatMonetaryValue(value) }, { label: 'Timestamp', key: 'timestamp', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) } ]} /> diff --git a/src/components/features/scheduled-reversible-transaction-details/scheduled-reversible-transaction-information/ScheduledReversibleTransactionInformation.tsx b/src/components/features/scheduled-reversible-transaction-details/scheduled-reversible-transaction-information/ScheduledReversibleTransactionInformation.tsx index f9cb22b..e9191eb 100644 --- a/src/components/features/scheduled-reversible-transaction-details/scheduled-reversible-transaction-information/ScheduledReversibleTransactionInformation.tsx +++ b/src/components/features/scheduled-reversible-transaction-details/scheduled-reversible-transaction-information/ScheduledReversibleTransactionInformation.tsx @@ -29,22 +29,22 @@ export const ScheduledReversibleTransactionInformation: React.FC< const tx = data?.scheduledReversibleTransactions[0]; - const information: Partial[] = [ + const information: Partial[] = [ { - tx_id: tx?.node.tx_id, - amount: tx?.node.amount, - extrinsic: tx?.node.extrinsic, - block: tx?.node.block, - timestamp: tx?.node.timestamp, - scheduled_at: tx?.node.scheduled_at, - from: tx?.node.from, - to: tx?.node.to, - fee: (tx?.node as any).fee + tx_id: tx?.tx_id, + amount: tx?.amount, + extrinsic: tx?.extrinsic, + block: tx?.block, + timestamp: tx?.timestamp, + scheduled_at: tx?.scheduled_at, + from: tx?.from, + to: tx?.to, + fee: tx?.fee } ]; return ( - > + > loading={loading} data={information} fields={[ @@ -61,8 +61,8 @@ export const ScheduledReversibleTransactionInformation: React.FC< render: (value) => ( @@ -73,8 +73,8 @@ export const ScheduledReversibleTransactionInformation: React.FC< key: 'block', render: (value) => ( ) @@ -82,20 +82,20 @@ export const ScheduledReversibleTransactionInformation: React.FC< { label: 'Timestamp', key: 'timestamp', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) }, { label: 'Scheduled At', key: 'scheduled_at', - render: (value) => formatTimestamp(value as string, true) + render: (value) => formatTimestamp(value, true) }, { label: 'From', key: 'from', render: (value) => ( ) @@ -105,8 +105,8 @@ export const ScheduledReversibleTransactionInformation: React.FC< key: 'to', render: (value) => ( ) @@ -114,12 +114,12 @@ export const ScheduledReversibleTransactionInformation: React.FC< { label: 'Amount', key: 'amount', - render: (value) => formatMonetaryValue(value as string) + render: (value) => formatMonetaryValue(value) }, { label: 'Fee', key: 'fee', - render: (value) => formatMonetaryValue(value as string) + render: (value) => formatMonetaryValue(value) } ]} /> diff --git a/src/components/ui/composites/data-table/DataTable.stories.tsx b/src/components/ui/composites/data-table/DataTable.stories.tsx index 9905304..09a10d0 100644 --- a/src/components/ui/composites/data-table/DataTable.stories.tsx +++ b/src/components/ui/composites/data-table/DataTable.stories.tsx @@ -28,80 +28,72 @@ export const Primary: Omit = { const transactionDataTable = useReactTable({ data: [ { - node: { - block: { height: 293293 }, - extrinsic: { - id: '0xjdwjaidwjaidj', - pallet: 'balances', - call: 'transfer' - } as any, - fee: '120000000', - amount: '999999', - transfer_count: 1, - from: { id: '0x2131313' }, - to: { id: '0xdjwaidjiajdi' }, - timestamp: new Date().toISOString(), - from_hash: '0x2131313', - to_hash: '0xdjwaidjiajdi', - leaf_index: 0 - } + block: { height: 293293 }, + extrinsic: { + id: '0xjdwjaidwjaidj', + pallet: 'balances', + call: 'transfer' + } as any, + fee: '120000000', + amount: '999999', + transfer_count: 1, + from: { id: '0x2131313' }, + to: { id: '0xdjwaidjiajdi' }, + from_hash: '0x2131313', + to_hash: '0xdjwaidjiajdi', + timestamp: new Date().toISOString(), + leaf_index: 0 }, { - node: { - block: { height: 293293 }, - extrinsic: { - id: '0xjdwjaidwjaidj', - pallet: 'balances', - call: 'transfer' - } as any, - fee: '120000000', - amount: '999999', - transfer_count: 1, - from: { id: '0x2131313' }, - to: { id: '0xdjwaidjiajdi' }, - timestamp: new Date().toISOString(), - from_hash: '0x2131313', - to_hash: '0xdjwaidjiajdi', - leaf_index: 0 - } + block: { height: 293293 }, + extrinsic: { + id: '0xjdwjaidwjaidj', + pallet: 'balances', + call: 'transfer' + } as any, + fee: '120000000', + amount: '999999', + transfer_count: 1, + from: { id: '0x2131313' }, + to: { id: '0xdjwaidjiajdi' }, + from_hash: '0x2131313', + to_hash: '0xdjwaidjiajdi', + timestamp: new Date().toISOString(), + leaf_index: 0 }, { - node: { - block: { height: 293293 }, - extrinsic: { - id: '0xjdwjaidwjaidj', - pallet: 'balances', - call: 'transfer' - } as any, - fee: '120000000', - amount: '999999', - transfer_count: 1, - from: { id: '0x2131313' }, - to: { id: '0xdjwaidjiajdi' }, - timestamp: new Date().toISOString(), - from_hash: '0x2131313', - to_hash: '0xdjwaidjiajdi', - leaf_index: 0 - } + block: { height: 293293 }, + extrinsic: { + id: '0xjdwjaidwjaidj', + pallet: 'balances', + call: 'transfer' + } as any, + fee: '120000000', + amount: '999999', + transfer_count: 1, + from: { id: '0x2131313' }, + to: { id: '0xdjwaidjiajdi' }, + from_hash: '0x2131313', + to_hash: '0xdjwaidjiajdi', + timestamp: new Date().toISOString(), + leaf_index: 0 }, { - node: { - block: { height: 293293 }, - extrinsic: { - id: '0xjdwjaidwjaidj', - pallet: 'balances', - call: 'transfer' - } as any, - fee: '120000000', - amount: '999999', - from: { id: '0x2131313' }, - to: { id: '0xdjwaidjiajdi' }, - transfer_count: 1, - timestamp: new Date().toISOString(), - from_hash: '0x2131313', - to_hash: '0xdjwaidjiajdi', - leaf_index: 0 - } + block: { height: 293293 }, + extrinsic: { + id: '0xjdwjaidwjaidj', + pallet: 'balances', + call: 'transfer' + } as any, + fee: '120000000', + amount: '999999', + from: { id: '0x2131313' }, + to: { id: '0xdjwaidjiajdi' }, + transfer_count: 1, + from_hash: '0x2131313', + to_hash: '0xdjwaidjiajdi', + timestamp: new Date().toISOString(), + leaf_index: 0 } ], columns: transactionColumns, diff --git a/src/hooks/useUnifiedTransactions.ts b/src/hooks/useUnifiedTransactions.ts index 890547b..0a7988a 100644 --- a/src/hooks/useUnifiedTransactions.ts +++ b/src/hooks/useUnifiedTransactions.ts @@ -1,10 +1,7 @@ import type { CancelledReversibleTransaction, ExecutedReversibleTransaction, - HighSecuritySet, - MinerReward, - ScheduledReversibleTransaction, - Transaction + ScheduledReversibleTransaction } from '@/schemas'; import type { ExtrinsicInfo, @@ -14,6 +11,32 @@ import type { import type { WormholeOutput } from '@/schemas/wormhole'; // Common transformer input types +interface TransferInput { + extrinsic?: ExtrinsicInfo | null; + timestamp: string; + amount: number; + fee?: number; + from: { id: string }; + to: { id: string }; + block: { height: number }; +} + +interface MinerRewardInput { + reward: string | number; + timestamp: string; + miner: { id: string }; + block: { height: number; hash?: string }; +} + +interface HighSecuritySetInput { + extrinsic?: ExtrinsicInfo | null; + timestamp: string; + who: { id: string }; + interceptor: { id: string }; + delay?: number; + block: { height: number }; +} + interface WormholeInput { id: string; extrinsic?: ExtrinsicInfo | null; @@ -36,88 +59,87 @@ interface ErrorEventInput { // Transformer functions export const transformImmediateTransaction = ( - tx: Transaction, + tx: TransferInput, idx: number ): UnifiedTransaction => ({ - id: `immediate-${tx.node.extrinsic?.id ?? idx}`, + id: `immediate-${tx.extrinsic?.id ?? idx}`, type: 'immediate' as UnifiedTransactionType, - timestamp: tx.node.timestamp, - block: tx.node.block, - extrinsic: tx.node.extrinsic, - from: tx.node.from, - to: tx.node.to, - amount: Number(tx.node.amount), - fee: Number(tx.node.fee) + timestamp: tx.timestamp, + block: tx.block, + extrinsic: tx.extrinsic, + from: tx.from, + to: tx.to, + amount: tx.amount, + fee: tx.fee }); export const transformScheduledTransaction = ( tx: ScheduledReversibleTransaction ): UnifiedTransaction => ({ - id: `scheduled-${tx.node.tx_id}`, + id: `scheduled-${tx.tx_id}`, type: 'scheduled-reversible' as UnifiedTransactionType, - timestamp: tx.node.timestamp, - block: tx.node.block, - extrinsic: tx.node.extrinsic, - from: tx.node.from, - to: tx.node.to, - amount: Number(tx.node.amount), - scheduled_at: tx.node.scheduled_at + timestamp: tx.timestamp, + block: tx.block, + extrinsic: tx.extrinsic, + from: tx.from, + to: tx.to, + amount: tx.amount }); export const transformExecutedTransaction = ( tx: ExecutedReversibleTransaction ): UnifiedTransaction => ({ - id: `executed-${tx.node.tx_id}`, + id: `executed-${tx.tx_id}`, type: 'executed-reversible' as UnifiedTransactionType, - timestamp: tx.node.timestamp, - block: tx.node.block, + timestamp: tx.timestamp, + block: tx.block, extrinsic: { id: 'N/A (unsigned)', pallet: 'ReversibleTransfers', call: 'transaction_executed' }, - from: tx.node.scheduledTransfer.from, - to: tx.node.scheduledTransfer.to, - amount: Number(tx.node.scheduledTransfer.amount) + from: tx.scheduledTransfer.from, + to: tx.scheduledTransfer.to, + amount: tx.scheduledTransfer.amount }); export const transformCancelledTransaction = ( tx: CancelledReversibleTransaction ): UnifiedTransaction => ({ - id: `cancelled-${tx.node.tx_id}`, + id: `cancelled-${tx.tx_id}`, type: 'cancelled-reversible' as UnifiedTransactionType, - timestamp: tx.node.timestamp, - block: tx.node.block, - extrinsic: tx.node.extrinsic, - from: tx.node.scheduledTransfer.from, - to: tx.node.scheduledTransfer.to, - amount: Number(tx.node.scheduledTransfer.amount) + timestamp: tx.timestamp, + block: tx.block, + extrinsic: tx.extrinsic, + from: tx.scheduledTransfer.from, + to: tx.scheduledTransfer.to, + amount: tx.scheduledTransfer.amount }); export const transformMinerReward = ( - reward: MinerReward, + reward: MinerRewardInput, idx: number ): UnifiedTransaction => ({ - id: `miner-reward-${reward.node.block?.hash ?? idx}`, + id: `miner-reward-${reward.block?.hash ?? idx}`, type: 'miner-reward' as UnifiedTransactionType, - timestamp: reward.node.timestamp, - block: reward.node.block, - reward: String(reward.node.reward), - miner: reward.node.miner + timestamp: reward.timestamp, + block: reward.block, + reward: String(reward.reward), + miner: reward.miner }); export const transformHighSecuritySet = ( - hss: HighSecuritySet, + hss: HighSecuritySetInput, idx: number ): UnifiedTransaction => ({ - id: `high-security-${hss.node.extrinsic?.id ?? idx}`, + id: `high-security-${hss.extrinsic?.id ?? idx}`, type: 'high-security' as UnifiedTransactionType, - timestamp: hss.node.timestamp, - block: hss.node.block, - extrinsic: hss.node.extrinsic, - who: hss.node.who, - interceptor: hss.node.interceptor, - delay: hss.node.delay + timestamp: hss.timestamp, + block: hss.block, + extrinsic: hss.extrinsic, + who: hss.who, + interceptor: hss.interceptor, + delay: hss.delay }); export const transformWormholeOutput = ( diff --git a/src/schemas/account.ts b/src/schemas/account.ts index 6c17152..c139731 100644 --- a/src/schemas/account.ts +++ b/src/schemas/account.ts @@ -63,36 +63,6 @@ export interface AccountResponse { totalCount: number; }; }; - transactions: { - nodes: Transaction[]; - aggregate: { - totalCount: number; - }; - }; - scheduledReversibleTransactions: { - nodes: ScheduledReversibleTransaction[]; - aggregate: { - totalCount: number; - }; - }; - executedReversibleTransactions: { - nodes: ExecutedReversibleTransaction[]; - aggregate: { - totalCount: number; - }; - }; - cancelledReversibleTransactions: { - nodes: CancelledReversibleTransaction[]; - aggregate: { - totalCount: number; - }; - }; - minerRewards: { - nodes: MinerReward[]; - aggregate: { - totalCount: number; - }; - }; wormholeOutputs: AccountWormholeOutput[]; } @@ -104,26 +74,13 @@ export interface AccountListResponse { } export interface AccountBeneficiary { - node: { - who: Account; - }; + who: Account; } export interface AccountGuardian { - node: { - interceptor: Account; - }; + interceptor: Account; } -export type AccountTransaction = Transaction; -export type AccountScheduledReversibleTransaction = - ScheduledReversibleTransaction; -export type AccountExecutedReversibleTransaction = - ExecutedReversibleTransaction; -export type AccountCancelledReversibleTransaction = - CancelledReversibleTransaction; -export type AccountMinerRewards = MinerReward; - export interface AccountStatsResponse { all: { total_accounts: number; diff --git a/src/schemas/blocks.ts b/src/schemas/blocks.ts index 953b4bc..03ec95e 100644 --- a/src/schemas/blocks.ts +++ b/src/schemas/blocks.ts @@ -55,42 +55,6 @@ export interface BlockWormholeExtrinsic { export interface BlockResponse { blocks: [Block]; minerRewards: BlockMinerReward[]; - transactions: { - nodes: Transaction[]; - aggregate: { - totalCount: number; - }; - }; - scheduledReversibleTransactions: { - nodes: ScheduledReversibleTransaction[]; - aggregate: { - totalCount: number; - }; - }; - executedReversibleTransactions: { - nodes: ExecutedReversibleTransaction[]; - aggregate: { - totalCount: number; - }; - }; - cancelledReversibleTransactions: { - nodes: CancelledReversibleTransaction[]; - aggregate: { - totalCount: number; - }; - }; - highSecuritySets: { - nodes: HighSecuritySet[]; - aggregate: { - totalCount: number; - }; - }; - errorEvents: { - nodes: ErrorEvent[]; - aggregate: { - totalCount: number; - }; - }; } export interface BlockListResponse { @@ -105,27 +69,27 @@ export interface RecentBlocksResponse { } export interface BlockTransaction { - node: Transaction['node']; + node: Transaction; } export interface BlockScheduledReversibleTransaction { - node: ScheduledReversibleTransaction['node']; + node: ScheduledReversibleTransaction; } export interface BlockExecutedReversibleTransaction { - node: ExecutedReversibleTransaction['node']; + node: ExecutedReversibleTransaction; } export interface BlockCancelledReversibleTransaction { - node: CancelledReversibleTransaction['node']; + node: CancelledReversibleTransaction; } export interface BlockHighSecuritySet { - node: HighSecuritySet['node']; + node: HighSecuritySet; } export interface BlockErrorEvent { - node: ErrorEvent['node']; + node: ErrorEvent; } export interface BlockStatsResponse { diff --git a/src/schemas/cancelled-reversible-transaction.ts b/src/schemas/cancelled-reversible-transaction.ts index 1ee58f1..667d8ab 100644 --- a/src/schemas/cancelled-reversible-transaction.ts +++ b/src/schemas/cancelled-reversible-transaction.ts @@ -1,15 +1,14 @@ import type * as gql from '../__generated__/graphql'; import type { ScheduledReversibleTransaction } from './scheduled-reversible-transaction'; -export interface CancelledReversibleTransaction { - node: Omit< +export interface CancelledReversibleTransaction + extends Omit< gql.Cancelled_Reversible_Transfer, 'id' | 'block' | 'event' | 'cancelledBy' | 'scheduledTransfer' - > & { - block: Pick; - cancelledBy: Pick; - scheduledTransfer: ScheduledReversibleTransaction['node']; - }; + > { + block: Pick; + cancelledBy: Pick; + scheduledTransfer: ScheduledReversibleTransaction; } export interface CancelledReversibleTransactionResponse { diff --git a/src/schemas/errors.ts b/src/schemas/errors.ts index 0281e82..12427af 100644 --- a/src/schemas/errors.ts +++ b/src/schemas/errors.ts @@ -1,9 +1,7 @@ import type * as gql from '../__generated__/graphql'; -export interface ErrorEvent { - node: Omit & { - block: Pick; - }; +export interface ErrorEvent extends Omit { + block: Pick; } export interface ErrorEventResponse { diff --git a/src/schemas/executed-reversible-transaction.ts b/src/schemas/executed-reversible-transaction.ts index 644bc54..13225bf 100644 --- a/src/schemas/executed-reversible-transaction.ts +++ b/src/schemas/executed-reversible-transaction.ts @@ -1,14 +1,13 @@ import type * as gql from '../__generated__/graphql'; import type { ScheduledReversibleTransaction } from './scheduled-reversible-transaction'; -export interface ExecutedReversibleTransaction { - node: Omit< +export interface ExecutedReversibleTransaction + extends Omit< gql.Executed_Reversible_Transfer, 'id' | 'block' | 'event' | 'executedTransfer' | 'scheduledTransfer' - > & { - block: Pick; - scheduledTransfer: ScheduledReversibleTransaction['node']; - }; + > { + block: Pick; + scheduledTransfer: ScheduledReversibleTransaction; } export interface ExecutedReversibleTransactionResponse { diff --git a/src/schemas/high-security-set.ts b/src/schemas/high-security-set.ts index 5dfbfa0..5b7e273 100644 --- a/src/schemas/high-security-set.ts +++ b/src/schemas/high-security-set.ts @@ -1,14 +1,13 @@ import type * as gql from '../__generated__/graphql'; -export interface HighSecuritySet { - node: Omit< +export interface HighSecuritySet + extends Omit< gql.High_Security_Set, 'id' | 'who' | 'interceptor' | 'block' | 'event' - > & { - who: Pick; - interceptor: Pick; - block: Pick; - }; + > { + who: Pick; + interceptor: Pick; + block: Pick; } export interface HighSecuritySetResponse { diff --git a/src/schemas/miner-reward.ts b/src/schemas/miner-reward.ts index b5fb843..4442858 100644 --- a/src/schemas/miner-reward.ts +++ b/src/schemas/miner-reward.ts @@ -1,10 +1,9 @@ import type * as gql from '../__generated__/graphql'; -export interface MinerReward { - node: Omit & { - miner: Pick; - block: Pick; - }; +export interface MinerReward + extends Omit { + miner: Pick; + block: Pick; } export interface MinerRewardResponse { diff --git a/src/schemas/scheduled-reversible-transaction.ts b/src/schemas/scheduled-reversible-transaction.ts index 1cc6208..8ef5738 100644 --- a/src/schemas/scheduled-reversible-transaction.ts +++ b/src/schemas/scheduled-reversible-transaction.ts @@ -1,14 +1,13 @@ import type * as gql from '../__generated__/graphql'; -export interface ScheduledReversibleTransaction { - node: Omit< +export interface ScheduledReversibleTransaction + extends Omit< gql.Scheduled_Reversible_Transfer, 'id' | 'block' | 'event' | 'from' | 'to' - > & { - block: Pick; - from: Pick; - to: Pick; - }; + > { + block: Pick; + from: Pick; + to: Pick; } export interface ScheduledReversibleTransactionResponse { diff --git a/src/schemas/searchs.ts b/src/schemas/searchs.ts index cfeba40..d290338 100644 --- a/src/schemas/searchs.ts +++ b/src/schemas/searchs.ts @@ -9,19 +9,22 @@ import type { ScheduledReversibleTransaction } from './scheduled-reversible-tran import type { Transaction } from './transcation'; export interface SearchAllResponse { - transactions: { node: Pick }[]; - scheduledReversibleTransactions: { - node: Pick; - }[]; - executedReversibleTransactions: { - node: Pick; - }[]; - cancelledReversibleTransactions: { - node: Pick; - }[]; + transactions: Pick[]; + scheduledReversibleTransactions: Pick< + ScheduledReversibleTransaction, + 'extrinsic' | 'tx_id' + >[]; + executedReversibleTransactions: Pick< + ExecutedReversibleTransaction, + 'tx_id' + >[]; + cancelledReversibleTransactions: Pick< + CancelledReversibleTransaction, + 'tx_id' + >[]; accounts: Pick[]; blocks: Pick[]; - highSecuritySets: { node: Pick }[]; - minerRewards: { node: Pick }[]; - errorEvents: { node: Pick }[]; + highSecuritySets: Pick[]; + minerRewards: Pick[]; + errorEvents: Pick[]; } diff --git a/src/schemas/transcation.ts b/src/schemas/transcation.ts index e26f694..d7a4ad7 100644 --- a/src/schemas/transcation.ts +++ b/src/schemas/transcation.ts @@ -1,11 +1,10 @@ import type * as gql from '../__generated__/graphql'; -export interface Transaction { - node: Omit & { - from: Pick; - to: Pick; - block: Pick; - }; +export interface Transaction + extends Omit { + from: Pick; + to: Pick; + block: Pick; } export interface TransactionResponse { diff --git a/src/schemas/unified-transaction.ts b/src/schemas/unified-transaction.ts index 7d68618..6e6e624 100644 --- a/src/schemas/unified-transaction.ts +++ b/src/schemas/unified-transaction.ts @@ -31,7 +31,6 @@ export interface UnifiedTransaction { to?: { id: string }; amount?: string | number; fee?: number; - scheduled_at?: string; // Miner reward fields reward?: string; diff --git a/src/utils/formatter.ts b/src/utils/formatter.ts index 5598a42..d1d57d9 100644 --- a/src/utils/formatter.ts +++ b/src/utils/formatter.ts @@ -36,22 +36,9 @@ export const formatDistanceTimestamp = (timestamp?: string | Date) => { return distance; }; -export const formatMonetaryValue = ( - value: number | string | bigint, - digits?: number -) => { +export const formatMonetaryValue = (value: number, digits?: number) => { const denominator = 10 ** 12; - let numValue: number; - - if (typeof value === 'string') { - numValue = Number.parseFloat(value); - } else if (typeof value === 'bigint') { - numValue = Number(value); - } else { - numValue = value; - } - - const convertedValue = numValue / denominator; + const convertedValue = value / denominator; if (!digits) return `${convertedValue} ${env.COIN_SYMBOL}`;