Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify leaderboard schema and logic and add extrinsic and event id #1025

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
693 changes: 604 additions & 89 deletions explorer/gql/graphql.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { downloadFullData } from 'utils/downloadFullData'
import { bigNumberToNumber } from 'utils/number'
import { formatExtrinsicId } from 'utils/string'
import { countTablePages } from 'utils/table'
import { utcToLocalRelativeTime } from 'utils/time'
import { QUERY_ACCOUNT_TRANSFERS } from './query'

type Props = {
Expand All @@ -40,7 +41,7 @@ type Row = TransfersByAccountIdQuery['consensus_transfers'][0]
export const AccountTransfersList: FC<Props> = ({ accountId }) => {
const { ref, inView } = useInView()
const [sorting, setSorting] = useState<SortingState>([
{ id: TransferColumn.CreatedAt, desc: true },
{ id: TransferColumn.BlockHeight, desc: true },
])
const [pagination, setPagination] = useState({
pageSize: PAGE_SIZE,
Expand Down Expand Up @@ -117,7 +118,7 @@ export const AccountTransfersList: FC<Props> = ({ accountId }) => {
const columns = useMemo(
() => [
{
accessorKey: 'created_at',
accessorKey: 'block_height',
header: 'Block',
enableSorting: true,
cell: ({ row }: Cell<Row>) => (
Expand All @@ -127,11 +128,11 @@ export const AccountTransfersList: FC<Props> = ({ accountId }) => {
href={INTERNAL_ROUTES.blocks.id.page(
network,
Routes.consensus,
row.original.created_at,
row.original.block_height,
)}
className='hover:text-primaryAccent'
>
<div>{row.original.created_at}</div>
<div>{row.original.block_height}</div>
</Link>
</div>
),
Expand Down Expand Up @@ -236,7 +237,7 @@ export const AccountTransfersList: FC<Props> = ({ accountId }) => {
enableSorting: true,
cell: ({ row }: Cell<Row>) => (
<div key={`${row.original.id}-created_at-${row.index}`}>
{row.original.timestamp(row.original.date)}
{utcToLocalRelativeTime(row.original.timestamp)}
</div>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Row = BalanceHistoryByAccountIdQuery['consensus_account_histories'][0]
export const BalanceHistory: FC<Props> = ({ accountId }) => {
const { ref, inView } = useInView()
const [sorting, setSorting] = useState<SortingState>([
{ id: TransferColumn.CreatedAt, desc: true },
{ id: TransferColumn.BlockHeight, desc: true },
])
const [pagination, setPagination] = useState({
pageSize: PAGE_SIZE,
Expand Down
13 changes: 7 additions & 6 deletions explorer/src/components/Consensus/Account/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const QUERY_LAST_WEEK_REWARDS = gql`
) {
id
block_height
index_in_block
extrinsic_id
event_id
reward_type
amount
timestamp
Expand Down Expand Up @@ -97,7 +98,8 @@ export const QUERY_REWARDS_LIST = gql`
) {
id
block_height
index_in_block
extrinsic_id
event_id
reward_type
amount
timestamp
Expand Down Expand Up @@ -156,6 +158,7 @@ export const QUERY_ACCOUNT_TRANSFERS = gql`
}
consensus_transfers(order_by: $orderBy, limit: $limit, offset: $offset, where: $where) {
id
block_height
extrinsic_id
event_id
from
Expand All @@ -164,8 +167,6 @@ export const QUERY_ACCOUNT_TRANSFERS = gql`
fee
success
timestamp
date
created_at
}
}
`
Expand All @@ -189,7 +190,6 @@ export const QUERY_ACCOUNT_BALANCE_HISTORY = gql`
nonce
free
created_at
updated_at
_block_range
}
}
Expand All @@ -200,7 +200,8 @@ export const QUERY_ALL_REWARDS_FOR_ACCOUNT_BY_ID = gql`
consensus_rewards(where: { account_id: { _eq: $accountId }, amount: { _gt: 0 } }, limit: 1) {
id
block_height
index_in_block
extrinsic_id
event_id
reward_type
amount
timestamp
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/constants/indexers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface Indexer {
telemetryNetworkName?: string
}

const LOCAL_INDEXER = 'https://subql.green.mainnet.subspace.network/v1/graphql'
const LOCAL_INDEXER = 'https://subql.blue.mainnet.subspace.network/v1/graphql'

export const indexers: Indexer[] = [
{
Expand Down
Loading
Loading