From a84cca1439acdd9fc7b610b7d209c064b4d2086a Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 11 Dec 2024 16:54:20 -0500 Subject: [PATCH 1/8] simplify leaderboard schema and logic and add extrinsic and event id --- indexers/taurus/leaderboard/schema.graphql | 192 +++++----- .../taurus/leaderboard/src/mappings/db.ts | 336 ++++++++++-------- .../src/mappings/mappingHandlers.ts | 311 +++++++++------- 3 files changed, 480 insertions(+), 359 deletions(-) diff --git a/indexers/taurus/leaderboard/schema.graphql b/indexers/taurus/leaderboard/schema.graphql index ef119761f..e214de04c 100644 --- a/indexers/taurus/leaderboard/schema.graphql +++ b/indexers/taurus/leaderboard/schema.graphql @@ -5,219 +5,219 @@ # account type AccountTransferSenderTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransferSenderTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransferReceiverTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransferReceiverTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountRemarkCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountExtrinsicTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountExtrinsicSuccessTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountExtrinsicFailedTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransactionFeePaidTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } # farmer type FarmerVoteTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerVoteTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerBlockTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerBlockTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerVoteAndBlockTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerVoteAndBlockTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } # operator type OperatorTotalRewardsCollectedHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorTotalTaxCollectedHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorBundleTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorDepositsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorDepositsTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorWithdrawalsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } # nominator/account type NominatorDepositsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type NominatorDepositsTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type NominatorWithdrawalsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } diff --git a/indexers/taurus/leaderboard/src/mappings/db.ts b/indexers/taurus/leaderboard/src/mappings/db.ts index 1cbdbd761..4da7c9886 100644 --- a/indexers/taurus/leaderboard/src/mappings/db.ts +++ b/indexers/taurus/leaderboard/src/mappings/db.ts @@ -25,436 +25,484 @@ import { OperatorWithdrawalsTotalCountHistory, } from "../types"; -export async function checkAndGetAccountTransferSenderTotalCount( +export async function createAndSaveAccountTransferSenderTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferSenderTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransferSenderTotalValue( +export async function createAndSaveAccountTransferSenderTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferSenderTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransferReceiverTotalCount( +export async function createAndSaveAccountTransferReceiverTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferReceiverTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransferReceiverTotalValue( +export async function createAndSaveAccountTransferReceiverTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferReceiverTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountRemarkCount( +export async function createAndSaveAccountRemarkCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountRemarkCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountExtrinsicTotalCount( +export async function createAndSaveAccountExtrinsicTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountExtrinsicTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountExtrinsicSuccessTotalCount( +export async function createAndSaveAccountExtrinsicSuccessTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountExtrinsicSuccessTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountExtrinsicFailedTotalCount( +export async function createAndSaveAccountExtrinsicFailedTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountExtrinsicFailedTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransactionFeePaidTotalValue( +export async function createAndSaveAccountTransactionFeePaidTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransactionFeePaidTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } // Farmer entities -export async function checkAndGetFarmerVoteTotalCount( +export async function createAndSaveFarmerVoteTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerVoteTotalValue( +export async function createAndSaveFarmerVoteTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerBlockTotalCount( +export async function createAndSaveFarmerBlockTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerBlockTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerBlockTotalValue( +export async function createAndSaveFarmerBlockTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerBlockTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerVoteAndBlockTotalCount( +export async function createAndSaveFarmerVoteAndBlockTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteAndBlockTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerVoteAndBlockTotalValue( +export async function createAndSaveFarmerVoteAndBlockTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteAndBlockTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } // Operator entities -export async function checkAndGetOperatorTotalRewardsCollected( +export async function createAndSaveOperatorTotalRewardsCollected( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorTotalRewardsCollectedHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorTotalTaxCollected( +export async function createAndSaveOperatorTotalTaxCollected( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorTotalTaxCollectedHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorBundleTotalCount( +export async function createAndSaveOperatorBundleTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorBundleTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorDepositsTotalCount( +export async function createAndSaveOperatorDepositsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorDepositsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorDepositsTotalValue( +export async function createAndSaveOperatorDepositsTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorDepositsTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorWithdrawalsTotalCount( +export async function createAndSaveOperatorWithdrawalsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorWithdrawalsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } // Nominator entities -export async function checkAndGetNominatorDepositsTotalCount( +export async function createAndSaveNominatorDepositsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = NominatorDepositsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetNominatorDepositsTotalValue( +export async function createAndSaveNominatorDepositsTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = NominatorDepositsTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetNominatorWithdrawalsTotalCount( +export async function createAndSaveNominatorWithdrawalsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = NominatorWithdrawalsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; diff --git a/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts b/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts index 552384cc3..a438719a3 100644 --- a/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts +++ b/indexers/taurus/leaderboard/src/mappings/mappingHandlers.ts @@ -1,6 +1,15 @@ import { SubstrateEvent } from "@subql/types"; import * as db from "./db"; +const getEventInfo = (event: SubstrateEvent) => { + const { extrinsic } = event; + const blockHeight = BigInt(event.block.block.header.number.toString()); + const timestamp = event.block.timestamp ?? new Date(0); + const extrinsicId = `${blockHeight}-${extrinsic ? extrinsic.idx : "system"}`; + const eventId = `${blockHeight}-${event.event.index}`; + return { blockHeight, timestamp, extrinsicId, eventId }; +}; + export async function handleTransferEvent( event: SubstrateEvent ): Promise { @@ -12,52 +21,60 @@ export async function handleTransferEvent( const from = _from.toString(); const to = _to.toString(); const amount = BigInt(_amount.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountTransferSenderTotalCount( + await db.createAndSaveAccountTransferSenderTotalCount( from, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountTransferSenderTotalValue( + await db.createAndSaveAccountTransferSenderTotalValue( from, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountTransferReceiverTotalCount( + await db.createAndSaveAccountTransferReceiverTotalCount( to, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountTransferReceiverTotalValue( + await db.createAndSaveAccountTransferReceiverTotalValue( to, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } export async function handleRemarkEvent(event: SubstrateEvent): Promise { const { + extrinsic, event: { index }, } = event; + if (!extrinsic) return; - const extrinsicIndex = Number(index); - const extrinsic = event.block.block.extrinsics[extrinsicIndex]; - const accountId = extrinsic.signer.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const accountId = extrinsic.extrinsic.signer.toString(); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountRemarkCount( + await db.createAndSaveAccountRemarkCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -65,26 +82,29 @@ export async function handleExtrinsicSuccessEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { index }, } = event; + if (!extrinsic) return; - const extrinsicIndex = Number(index); - const extrinsic = event.block.block.extrinsics[extrinsicIndex]; - const accountId = extrinsic.signer.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const accountId = extrinsic.extrinsic.signer.toString(); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountExtrinsicTotalCount( + await db.createAndSaveAccountExtrinsicTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountExtrinsicSuccessTotalCount( + await db.createAndSaveAccountExtrinsicSuccessTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -92,25 +112,29 @@ export async function handleExtrinsicFailedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { index }, } = event; - const extrinsicIndex = Number(index); - const extrinsic = event.block.block.extrinsics[extrinsicIndex]; - const accountId = extrinsic.signer.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + if (!extrinsic) return; + + const accountId = extrinsic.extrinsic.signer.toString(); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountExtrinsicTotalCount( + await db.createAndSaveAccountExtrinsicTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountExtrinsicFailedTotalCount( + await db.createAndSaveAccountExtrinsicFailedTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -118,7 +142,9 @@ export async function handleTransactionFeePaidEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_who, _actualFee, _tip], }, } = event; @@ -126,14 +152,15 @@ export async function handleTransactionFeePaidEvent( const actualFee = BigInt(_actualFee.toString()); const tip = BigInt(_tip.toString()); const totalFeePaid = actualFee + tip; - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountTransactionFeePaidTotalValue( + await db.createAndSaveAccountTransactionFeePaidTotalValue( who, totalFeePaid, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -141,39 +168,50 @@ export async function handleFarmerVoteRewardEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_voter, _reward], }, } = event; + if (!extrinsic) return; + const voter = _voter.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetFarmerVoteTotalCount( + await db.createAndSaveFarmerVoteTotalCount( voter, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteTotalValue( + await db.createAndSaveFarmerVoteTotalValue( voter, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalCount( + await db.createAndSaveFarmerVoteAndBlockTotalCount( voter, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalValue( + await db.createAndSaveFarmerVoteAndBlockTotalValue( voter, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -181,39 +219,48 @@ export async function handleFarmerBlockRewardEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_blockAuthor, _reward], }, } = event; const blockAuthor = _blockAuthor.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetFarmerBlockTotalCount( + await db.createAndSaveFarmerBlockTotalCount( blockAuthor, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerBlockTotalValue( + await db.createAndSaveFarmerBlockTotalValue( blockAuthor, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalCount( + await db.createAndSaveFarmerVoteAndBlockTotalCount( blockAuthor, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalValue( + await db.createAndSaveFarmerVoteAndBlockTotalValue( blockAuthor, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -221,22 +268,25 @@ export async function handleOperatorRewardedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _reward], }, } = event; const operatorId = _operatorId.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); if (reward === BigInt(0)) return; - await db.checkAndGetOperatorTotalRewardsCollected( + await db.createAndSaveOperatorTotalRewardsCollected( operatorId, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -244,20 +294,23 @@ export async function handleOperatorTaxCollectedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _tax], }, } = event; const operatorId = _operatorId.toString(); const tax = BigInt(_tax.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorTotalTaxCollected( + await db.createAndSaveOperatorTotalTaxCollected( operatorId, tax, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -265,19 +318,22 @@ export async function handleBundleStoredEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_bundleAuthor], }, } = event; const operatorId = _bundleAuthor.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorBundleTotalCount( + await db.createAndSaveOperatorBundleTotalCount( operatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -285,20 +341,23 @@ export async function handleOperatorRegisteredEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _reward], }, } = event; const operatorId = _operatorId.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorTotalRewardsCollected( + await db.createAndSaveOperatorTotalRewardsCollected( operatorId, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -306,40 +365,49 @@ export async function handleOperatorNominatedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _nominatorId, _amount], }, } = event; const operatorId = _operatorId.toString(); const nominatorId = _nominatorId.toString(); const amount = BigInt(_amount.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorDepositsTotalCount( + await db.createAndSaveOperatorDepositsTotalCount( operatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetOperatorDepositsTotalValue( + await db.createAndSaveOperatorDepositsTotalValue( operatorId, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetNominatorDepositsTotalCount( + await db.createAndSaveNominatorDepositsTotalCount( nominatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetNominatorDepositsTotalValue( + await db.createAndSaveNominatorDepositsTotalValue( nominatorId, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -347,25 +415,30 @@ export async function handleWithdrewStakeEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _nominatorId], }, } = event; const operatorId = _operatorId.toString(); const nominatorId = _nominatorId.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorWithdrawalsTotalCount( + await db.createAndSaveOperatorWithdrawalsTotalCount( operatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetNominatorWithdrawalsTotalCount( + await db.createAndSaveNominatorWithdrawalsTotalCount( nominatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } From f64def28f11f1285a24cf1c749e7e9135039174a Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:02:52 -0500 Subject: [PATCH 2/8] apply the same changes to mainnet leaderboard indexer --- indexers/mainnet/leaderboard/schema.graphql | 192 +++++----- .../mainnet/leaderboard/src/mappings/db.ts | 336 ++++++++++-------- .../src/mappings/mappingHandlers.ts | 311 +++++++++------- 3 files changed, 480 insertions(+), 359 deletions(-) diff --git a/indexers/mainnet/leaderboard/schema.graphql b/indexers/mainnet/leaderboard/schema.graphql index ef119761f..e214de04c 100644 --- a/indexers/mainnet/leaderboard/schema.graphql +++ b/indexers/mainnet/leaderboard/schema.graphql @@ -5,219 +5,219 @@ # account type AccountTransferSenderTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransferSenderTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransferReceiverTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransferReceiverTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountRemarkCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountExtrinsicTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountExtrinsicSuccessTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountExtrinsicFailedTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type AccountTransactionFeePaidTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } # farmer type FarmerVoteTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerVoteTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerBlockTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerBlockTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerVoteAndBlockTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type FarmerVoteAndBlockTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } # operator type OperatorTotalRewardsCollectedHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorTotalTaxCollectedHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorBundleTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorDepositsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorDepositsTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type OperatorWithdrawalsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } # nominator/account type NominatorDepositsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type NominatorDepositsTotalValueHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } type NominatorWithdrawalsTotalCountHistory @entity { id: ID! - rank: Int! @index - value: BigInt! @index + value: BigInt! lastContributionAt: Date! - createdAt: Int! @index - updatedAt: Int! @index + blockHeight: BigInt! @index + extrinsicId: String! + eventId: String! } diff --git a/indexers/mainnet/leaderboard/src/mappings/db.ts b/indexers/mainnet/leaderboard/src/mappings/db.ts index 1cbdbd761..4da7c9886 100644 --- a/indexers/mainnet/leaderboard/src/mappings/db.ts +++ b/indexers/mainnet/leaderboard/src/mappings/db.ts @@ -25,436 +25,484 @@ import { OperatorWithdrawalsTotalCountHistory, } from "../types"; -export async function checkAndGetAccountTransferSenderTotalCount( +export async function createAndSaveAccountTransferSenderTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferSenderTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransferSenderTotalValue( +export async function createAndSaveAccountTransferSenderTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferSenderTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransferReceiverTotalCount( +export async function createAndSaveAccountTransferReceiverTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferReceiverTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransferReceiverTotalValue( +export async function createAndSaveAccountTransferReceiverTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransferReceiverTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountRemarkCount( +export async function createAndSaveAccountRemarkCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountRemarkCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountExtrinsicTotalCount( +export async function createAndSaveAccountExtrinsicTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountExtrinsicTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountExtrinsicSuccessTotalCount( +export async function createAndSaveAccountExtrinsicSuccessTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountExtrinsicSuccessTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountExtrinsicFailedTotalCount( +export async function createAndSaveAccountExtrinsicFailedTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountExtrinsicFailedTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetAccountTransactionFeePaidTotalValue( +export async function createAndSaveAccountTransactionFeePaidTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = AccountTransactionFeePaidTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } // Farmer entities -export async function checkAndGetFarmerVoteTotalCount( +export async function createAndSaveFarmerVoteTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerVoteTotalValue( +export async function createAndSaveFarmerVoteTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerBlockTotalCount( +export async function createAndSaveFarmerBlockTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerBlockTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerBlockTotalValue( +export async function createAndSaveFarmerBlockTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerBlockTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerVoteAndBlockTotalCount( +export async function createAndSaveFarmerVoteAndBlockTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteAndBlockTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetFarmerVoteAndBlockTotalValue( +export async function createAndSaveFarmerVoteAndBlockTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = FarmerVoteAndBlockTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } // Operator entities -export async function checkAndGetOperatorTotalRewardsCollected( +export async function createAndSaveOperatorTotalRewardsCollected( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorTotalRewardsCollectedHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorTotalTaxCollected( +export async function createAndSaveOperatorTotalTaxCollected( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorTotalTaxCollectedHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorBundleTotalCount( +export async function createAndSaveOperatorBundleTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorBundleTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorDepositsTotalCount( +export async function createAndSaveOperatorDepositsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorDepositsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorDepositsTotalValue( +export async function createAndSaveOperatorDepositsTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorDepositsTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetOperatorWithdrawalsTotalCount( +export async function createAndSaveOperatorWithdrawalsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = OperatorWithdrawalsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } // Nominator entities -export async function checkAndGetNominatorDepositsTotalCount( +export async function createAndSaveNominatorDepositsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = NominatorDepositsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetNominatorDepositsTotalValue( +export async function createAndSaveNominatorDepositsTotalValue( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = NominatorDepositsTotalValueHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; } -export async function checkAndGetNominatorWithdrawalsTotalCount( +export async function createAndSaveNominatorWithdrawalsTotalCount( id: string, value: bigint, - blockNumber: number, - lastContributionAt: Date = new Date() + blockHeight: bigint, + lastContributionAt: Date = new Date(), + extrinsicId: string, + eventId: string ): Promise { const account = NominatorWithdrawalsTotalCountHistory.create({ id, - rank: 0, value, lastContributionAt, - createdAt: blockNumber, - updatedAt: blockNumber, + blockHeight, + extrinsicId, + eventId, }); await account.save(); return account; diff --git a/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts b/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts index 552384cc3..a438719a3 100644 --- a/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts +++ b/indexers/mainnet/leaderboard/src/mappings/mappingHandlers.ts @@ -1,6 +1,15 @@ import { SubstrateEvent } from "@subql/types"; import * as db from "./db"; +const getEventInfo = (event: SubstrateEvent) => { + const { extrinsic } = event; + const blockHeight = BigInt(event.block.block.header.number.toString()); + const timestamp = event.block.timestamp ?? new Date(0); + const extrinsicId = `${blockHeight}-${extrinsic ? extrinsic.idx : "system"}`; + const eventId = `${blockHeight}-${event.event.index}`; + return { blockHeight, timestamp, extrinsicId, eventId }; +}; + export async function handleTransferEvent( event: SubstrateEvent ): Promise { @@ -12,52 +21,60 @@ export async function handleTransferEvent( const from = _from.toString(); const to = _to.toString(); const amount = BigInt(_amount.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountTransferSenderTotalCount( + await db.createAndSaveAccountTransferSenderTotalCount( from, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountTransferSenderTotalValue( + await db.createAndSaveAccountTransferSenderTotalValue( from, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountTransferReceiverTotalCount( + await db.createAndSaveAccountTransferReceiverTotalCount( to, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountTransferReceiverTotalValue( + await db.createAndSaveAccountTransferReceiverTotalValue( to, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } export async function handleRemarkEvent(event: SubstrateEvent): Promise { const { + extrinsic, event: { index }, } = event; + if (!extrinsic) return; - const extrinsicIndex = Number(index); - const extrinsic = event.block.block.extrinsics[extrinsicIndex]; - const accountId = extrinsic.signer.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const accountId = extrinsic.extrinsic.signer.toString(); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountRemarkCount( + await db.createAndSaveAccountRemarkCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -65,26 +82,29 @@ export async function handleExtrinsicSuccessEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { index }, } = event; + if (!extrinsic) return; - const extrinsicIndex = Number(index); - const extrinsic = event.block.block.extrinsics[extrinsicIndex]; - const accountId = extrinsic.signer.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const accountId = extrinsic.extrinsic.signer.toString(); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountExtrinsicTotalCount( + await db.createAndSaveAccountExtrinsicTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountExtrinsicSuccessTotalCount( + await db.createAndSaveAccountExtrinsicSuccessTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -92,25 +112,29 @@ export async function handleExtrinsicFailedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { index }, } = event; - const extrinsicIndex = Number(index); - const extrinsic = event.block.block.extrinsics[extrinsicIndex]; - const accountId = extrinsic.signer.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + if (!extrinsic) return; + + const accountId = extrinsic.extrinsic.signer.toString(); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountExtrinsicTotalCount( + await db.createAndSaveAccountExtrinsicTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetAccountExtrinsicFailedTotalCount( + await db.createAndSaveAccountExtrinsicFailedTotalCount( accountId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -118,7 +142,9 @@ export async function handleTransactionFeePaidEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_who, _actualFee, _tip], }, } = event; @@ -126,14 +152,15 @@ export async function handleTransactionFeePaidEvent( const actualFee = BigInt(_actualFee.toString()); const tip = BigInt(_tip.toString()); const totalFeePaid = actualFee + tip; - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetAccountTransactionFeePaidTotalValue( + await db.createAndSaveAccountTransactionFeePaidTotalValue( who, totalFeePaid, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -141,39 +168,50 @@ export async function handleFarmerVoteRewardEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_voter, _reward], }, } = event; + if (!extrinsic) return; + const voter = _voter.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetFarmerVoteTotalCount( + await db.createAndSaveFarmerVoteTotalCount( voter, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteTotalValue( + await db.createAndSaveFarmerVoteTotalValue( voter, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalCount( + await db.createAndSaveFarmerVoteAndBlockTotalCount( voter, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalValue( + await db.createAndSaveFarmerVoteAndBlockTotalValue( voter, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -181,39 +219,48 @@ export async function handleFarmerBlockRewardEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_blockAuthor, _reward], }, } = event; const blockAuthor = _blockAuthor.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetFarmerBlockTotalCount( + await db.createAndSaveFarmerBlockTotalCount( blockAuthor, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerBlockTotalValue( + await db.createAndSaveFarmerBlockTotalValue( blockAuthor, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalCount( + await db.createAndSaveFarmerVoteAndBlockTotalCount( blockAuthor, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetFarmerVoteAndBlockTotalValue( + await db.createAndSaveFarmerVoteAndBlockTotalValue( blockAuthor, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -221,22 +268,25 @@ export async function handleOperatorRewardedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _reward], }, } = event; const operatorId = _operatorId.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); if (reward === BigInt(0)) return; - await db.checkAndGetOperatorTotalRewardsCollected( + await db.createAndSaveOperatorTotalRewardsCollected( operatorId, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -244,20 +294,23 @@ export async function handleOperatorTaxCollectedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _tax], }, } = event; const operatorId = _operatorId.toString(); const tax = BigInt(_tax.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorTotalTaxCollected( + await db.createAndSaveOperatorTotalTaxCollected( operatorId, tax, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -265,19 +318,22 @@ export async function handleBundleStoredEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_bundleAuthor], }, } = event; const operatorId = _bundleAuthor.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorBundleTotalCount( + await db.createAndSaveOperatorBundleTotalCount( operatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -285,20 +341,23 @@ export async function handleOperatorRegisteredEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _reward], }, } = event; const operatorId = _operatorId.toString(); const reward = BigInt(_reward.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorTotalRewardsCollected( + await db.createAndSaveOperatorTotalRewardsCollected( operatorId, reward, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -306,40 +365,49 @@ export async function handleOperatorNominatedEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _nominatorId, _amount], }, } = event; const operatorId = _operatorId.toString(); const nominatorId = _nominatorId.toString(); const amount = BigInt(_amount.toString()); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorDepositsTotalCount( + await db.createAndSaveOperatorDepositsTotalCount( operatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetOperatorDepositsTotalValue( + await db.createAndSaveOperatorDepositsTotalValue( operatorId, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetNominatorDepositsTotalCount( + await db.createAndSaveNominatorDepositsTotalCount( nominatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetNominatorDepositsTotalValue( + await db.createAndSaveNominatorDepositsTotalValue( nominatorId, amount, - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } @@ -347,25 +415,30 @@ export async function handleWithdrewStakeEvent( event: SubstrateEvent ): Promise { const { + extrinsic, event: { + index, data: [_operatorId, _nominatorId], }, } = event; const operatorId = _operatorId.toString(); const nominatorId = _nominatorId.toString(); - const blockNumber = event.block.block.header.number.toNumber(); - const timestamp = event.block.timestamp ?? new Date(0); + const { blockHeight, timestamp, extrinsicId, eventId } = getEventInfo(event); - await db.checkAndGetOperatorWithdrawalsTotalCount( + await db.createAndSaveOperatorWithdrawalsTotalCount( operatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); - await db.checkAndGetNominatorWithdrawalsTotalCount( + await db.createAndSaveNominatorWithdrawalsTotalCount( nominatorId, BigInt(1), - blockNumber, - timestamp + blockHeight, + timestamp, + extrinsicId, + eventId ); } From b6e326d7e006d3ecca219b4e60941347e93b70e6 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:50:12 -0500 Subject: [PATCH 3/8] fix init-db following change in schema --- .../db/docker-entrypoint-initdb.d/init-db.sql | 318 +++++++----------- 1 file changed, 124 insertions(+), 194 deletions(-) diff --git a/indexers/db/docker-entrypoint-initdb.d/init-db.sql b/indexers/db/docker-entrypoint-initdb.d/init-db.sql index ec8036dc9..e30a99faf 100644 --- a/indexers/db/docker-entrypoint-initdb.d/init-db.sql +++ b/indexers/db/docker-entrypoint-initdb.d/init-db.sql @@ -352,14 +352,16 @@ ALTER TABLE dictionary.spec_versions OWNER TO postgres; CREATE TABLE leaderboard.account_extrinsic_failed_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); + + ALTER TABLE leaderboard.account_extrinsic_failed_total_count_histories OWNER TO postgres; CREATE TABLE leaderboard.account_extrinsic_failed_total_counts ( @@ -374,11 +376,11 @@ ALTER TABLE leaderboard.account_extrinsic_failed_total_counts OWNER TO postgres; CREATE TABLE leaderboard.account_extrinsic_success_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -396,11 +398,11 @@ ALTER TABLE leaderboard.account_extrinsic_success_total_counts OWNER TO postgres CREATE TABLE leaderboard.account_extrinsic_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -418,11 +420,11 @@ ALTER TABLE leaderboard.account_extrinsic_total_counts OWNER TO postgres; CREATE TABLE leaderboard.account_remark_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -440,11 +442,11 @@ ALTER TABLE leaderboard.account_remark_counts OWNER TO postgres; CREATE TABLE leaderboard.account_transaction_fee_paid_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -462,11 +464,11 @@ ALTER TABLE leaderboard.account_transaction_fee_paid_total_values OWNER TO postg CREATE TABLE leaderboard.account_transfer_receiver_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -484,11 +486,11 @@ ALTER TABLE leaderboard.account_transfer_receiver_total_counts OWNER TO postgres CREATE TABLE leaderboard.account_transfer_receiver_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -506,11 +508,11 @@ ALTER TABLE leaderboard.account_transfer_receiver_total_values OWNER TO postgres CREATE TABLE leaderboard.account_transfer_sender_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -528,11 +530,11 @@ ALTER TABLE leaderboard.account_transfer_sender_total_counts OWNER TO postgres; CREATE TABLE leaderboard.account_transfer_sender_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -550,11 +552,11 @@ ALTER TABLE leaderboard.account_transfer_sender_total_values OWNER TO postgres; CREATE TABLE leaderboard.farmer_block_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -572,11 +574,11 @@ ALTER TABLE leaderboard.farmer_block_total_counts OWNER TO postgres; CREATE TABLE leaderboard.farmer_block_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -594,11 +596,11 @@ ALTER TABLE leaderboard.farmer_block_total_values OWNER TO postgres; CREATE TABLE leaderboard.farmer_vote_and_block_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -616,11 +618,11 @@ ALTER TABLE leaderboard.farmer_vote_and_block_total_counts OWNER TO postgres; CREATE TABLE leaderboard.farmer_vote_and_block_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -638,11 +640,11 @@ ALTER TABLE leaderboard.farmer_vote_and_block_total_values OWNER TO postgres; CREATE TABLE leaderboard.farmer_vote_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -660,11 +662,11 @@ ALTER TABLE leaderboard.farmer_vote_total_counts OWNER TO postgres; CREATE TABLE leaderboard.farmer_vote_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -682,11 +684,11 @@ ALTER TABLE leaderboard.farmer_vote_total_values OWNER TO postgres; CREATE TABLE leaderboard.nominator_deposits_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -704,11 +706,11 @@ ALTER TABLE leaderboard.nominator_deposits_total_counts OWNER TO postgres; CREATE TABLE leaderboard.nominator_deposits_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -726,11 +728,11 @@ ALTER TABLE leaderboard.nominator_deposits_total_values OWNER TO postgres; CREATE TABLE leaderboard.nominator_withdrawals_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -748,11 +750,11 @@ ALTER TABLE leaderboard.nominator_withdrawals_total_counts OWNER TO postgres; CREATE TABLE leaderboard.operator_bundle_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -770,11 +772,11 @@ ALTER TABLE leaderboard.operator_bundle_total_counts OWNER TO postgres; CREATE TABLE leaderboard.operator_deposits_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -792,11 +794,11 @@ ALTER TABLE leaderboard.operator_deposits_total_counts OWNER TO postgres; CREATE TABLE leaderboard.operator_deposits_total_value_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -814,11 +816,11 @@ ALTER TABLE leaderboard.operator_deposits_total_values OWNER TO postgres; CREATE TABLE leaderboard.operator_total_rewards_collected_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -836,11 +838,11 @@ ALTER TABLE leaderboard.operator_total_rewards_collecteds OWNER TO postgres; CREATE TABLE leaderboard.operator_total_tax_collected_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -858,11 +860,11 @@ ALTER TABLE leaderboard.operator_total_tax_collecteds OWNER TO postgres; CREATE TABLE leaderboard.operator_withdrawals_total_count_histories ( id text NOT NULL, - rank integer NOT NULL, value numeric NOT NULL, last_contribution_at timestamp without time zone NOT NULL, - created_at integer NOT NULL, - updated_at integer NOT NULL, + block_height numeric NOT NULL, + extrinsic_id text NOT NULL, + event_id text NOT NULL, _id uuid NOT NULL, _block_range int8range NOT NULL ); @@ -1181,221 +1183,149 @@ CREATE INDEX "0x5b57ecd94445ad2e" ON dictionary.extrinsics USING btree (call); CREATE INDEX "0x62b8f3181611d490" ON dictionary.events USING btree (module); CREATE INDEX "0xc0c9768d1987b60f" ON dictionary.events USING btree (block_height); + +CREATE INDEX "0x00a19bd16cefb56d" ON leaderboard.operator_total_rewards_collected_histories USING gist (block_height, _block_range); +CREATE INDEX "0x0244cc7c84316bf5" ON leaderboard.nominator_deposits_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0x0a914dd2bb308160" ON leaderboard.farmer_block_total_value_histories USING btree (id); +CREATE INDEX "0x1fcbfceab1d743dc" ON leaderboard.nominator_deposits_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0x1fd4ad1795e237a1" ON leaderboard.farmer_vote_total_value_histories USING btree (id); +CREATE INDEX "0x3082545cf9f8ade6" ON leaderboard.operator_total_rewards_collected_histories USING btree (id); +CREATE INDEX "0x37cd3b31685e6b8a" ON leaderboard.operator_deposits_total_count_histories USING btree (id); +CREATE INDEX "0x3c11ae5e03742fc1" ON leaderboard.farmer_vote_total_count_histories USING btree (id); +CREATE INDEX "0x4ca9e9ee31b8c664" ON leaderboard.account_remark_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0x4da777bb92510b22" ON leaderboard.farmer_vote_and_block_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0x4ebb0e134d2bbcde" ON leaderboard.operator_deposits_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0x554eb4e5ac77f3eb" ON leaderboard.operator_withdrawals_total_count_histories USING btree (id); +CREATE INDEX "0x5691017160aa14de" ON leaderboard.account_transfer_sender_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0x865a7a78cd9957e1" ON leaderboard.account_transaction_fee_paid_total_value_histories USING btree (id); +CREATE INDEX "0x878e2eb4c7464f91" ON leaderboard.farmer_block_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0x882daca0abfba2b8" ON leaderboard.account_extrinsic_success_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0x8b7c68617ff4e62b" ON leaderboard.operator_deposits_total_value_histories USING btree (id); +CREATE INDEX "0x8c12fe09c9fbcd4f" ON leaderboard.farmer_block_total_count_histories USING btree (id); +CREATE INDEX "0x8d7008ea364cf94c" ON leaderboard.account_transfer_sender_total_count_histories USING btree (id); +CREATE INDEX "0x8fa61e629a2dcd38" ON leaderboard.account_transfer_receiver_total_value_histories USING btree (id); +CREATE INDEX "0x9100c4535abd1ba4" ON leaderboard.farmer_vote_and_block_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0x957df7861716b7e5" ON leaderboard.nominator_deposits_total_count_histories USING btree (id); +CREATE INDEX "0x97633453dae86d22" ON leaderboard.account_transfer_receiver_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0x9b42c9f7087cc0dd" ON leaderboard.account_transfer_receiver_total_count_histories USING btree (id); +CREATE INDEX "0x9cd9957f6e6b9cf4" ON leaderboard.account_extrinsic_total_count_histories USING btree (id); +CREATE INDEX "0x9f3af39f22aac290" ON leaderboard.farmer_vote_and_block_total_count_histories USING btree (id); +CREATE INDEX "0xa0e359a56914557a" ON leaderboard.account_extrinsic_failed_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xa8fab7e0a0c35981" ON leaderboard.account_transfer_receiver_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xab879a58ac57bb2e" ON leaderboard.account_remark_count_histories USING btree (id); +CREATE INDEX "0xb06359b1f82d8bc4" ON leaderboard.farmer_block_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xb685fea77550c4ba" ON leaderboard.account_transaction_fee_paid_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0xba8274c63f512a6c" ON leaderboard.operator_withdrawals_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xbd7d3688774132d9" ON leaderboard.account_extrinsic_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xc18397609d2e50fc" ON leaderboard.nominator_withdrawals_total_count_histories USING btree (id); +CREATE INDEX "0xc26c8c9093762044" ON leaderboard.nominator_deposits_total_value_histories USING btree (id); +CREATE INDEX "0xc2d1db0e1993ab6d" ON leaderboard.farmer_vote_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0xc39dcd4a26cdd42d" ON leaderboard.operator_total_tax_collected_histories USING gist (block_height, _block_range); +CREATE INDEX "0xc660a8aa2ffa9c5a" ON leaderboard.farmer_vote_and_block_total_value_histories USING btree (id); +CREATE INDEX "0xc9823b43f2d5fc8e" ON leaderboard.operator_bundle_total_count_histories USING btree (id); +CREATE INDEX "0xcae5a2492334afca" ON leaderboard.farmer_vote_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xcb5285231d73e9cc" ON leaderboard.nominator_withdrawals_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xcc867b5b6030777d" ON leaderboard.account_transfer_sender_total_count_histories USING gist (block_height, _block_range); +CREATE INDEX "0xda2d0c5abd8f415c" ON leaderboard.operator_total_tax_collected_histories USING btree (id); +CREATE INDEX "0xdc3838f306829259" ON leaderboard.account_extrinsic_success_total_count_histories USING btree (id); +CREATE INDEX "0xde3fa7f872aada9f" ON leaderboard.account_transfer_sender_total_value_histories USING btree (id); +CREATE INDEX "0xf44d2de87975dc53" ON leaderboard.operator_deposits_total_value_histories USING gist (block_height, _block_range); +CREATE INDEX "0xf458f461b30a6b5e" ON leaderboard.account_extrinsic_failed_total_count_histories USING btree (id); +CREATE INDEX "0xf8f1f913b372d0d0" ON leaderboard.operator_bundle_total_count_histories USING gist (block_height, _block_range); + CREATE INDEX "0x0237b4bb45c8cd3d" ON leaderboard.farmer_vote_and_block_total_values USING btree (created_at); -CREATE INDEX "0x02f8da0e922b0056" ON leaderboard.account_transfer_sender_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0x03f87f972ff639fb" ON leaderboard.nominator_deposits_total_counts USING btree (rank); -CREATE INDEX "0x0438dd6e4a5f836c" ON leaderboard.account_extrinsic_total_count_histories USING gist (rank, _block_range); CREATE INDEX "0x04c74d64a2ca170d" ON leaderboard.operator_deposits_total_values USING btree (created_at); -CREATE INDEX "0x04dfb89b9e2af7a7" ON leaderboard.operator_total_rewards_collected_histories USING gist (created_at, _block_range); CREATE INDEX "0x0a50f1f460ef26ea" ON leaderboard.farmer_vote_and_block_total_counts USING btree (created_at); CREATE INDEX "0x0a89134e4a3de20e" ON leaderboard.account_transfer_receiver_total_values USING btree (updated_at); -CREATE INDEX "0x0a914dd2bb308160" ON leaderboard.farmer_block_total_value_histories USING btree (id); -CREATE INDEX "0x0b8b8b69754807d3" ON leaderboard.farmer_vote_and_block_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0x0e0b83f71c1fa808" ON leaderboard.farmer_block_total_value_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x0f8ff92ec1de897d" ON leaderboard.operator_deposits_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x109ef24a7bb98d30" ON leaderboard.operator_withdrawals_total_counts USING btree (rank); -CREATE INDEX "0x11c7fbd504978be3" ON leaderboard.operator_deposits_total_value_histories USING gist (created_at, _block_range); -CREATE INDEX "0x1354e8ceab9831c9" ON leaderboard.operator_deposits_total_value_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x141aea21e5105cd2" ON leaderboard.account_transfer_sender_total_value_histories USING gist (updated_at, _block_range); CREATE INDEX "0x15178b2615ecb334" ON leaderboard.farmer_vote_total_counts USING btree (value); -CREATE INDEX "0x174bea85db7e2379" ON leaderboard.account_extrinsic_failed_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x17aa9d3d762269fa" ON leaderboard.account_transfer_receiver_total_value_histories USING gist (value, _block_range); -CREATE INDEX "0x19ecd7ecdee51bdc" ON leaderboard.account_transfer_sender_total_value_histories USING gist (value, _block_range); -CREATE INDEX "0x1a653356147e1a5c" ON leaderboard.farmer_block_total_count_histories USING gist (created_at, _block_range); -CREATE INDEX "0x1ab55399690fbf98" ON leaderboard.operator_withdrawals_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x1bd9b5a195d85978" ON leaderboard.farmer_block_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x1c3ef49edcc0984d" ON leaderboard.farmer_vote_and_block_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0x1dc9d229fc046a77" ON leaderboard.farmer_block_total_counts USING btree (value); CREATE INDEX "0x1ed6c532b99ee178" ON leaderboard.nominator_deposits_total_values USING btree (rank); -CREATE INDEX "0x1fd4ad1795e237a1" ON leaderboard.farmer_vote_total_value_histories USING btree (id); CREATE INDEX "0x203a197257ce12a5" ON leaderboard.farmer_vote_total_counts USING btree (rank); -CREATE INDEX "0x206ce884fc1c5cd0" ON leaderboard.account_transfer_sender_total_count_histories USING gist (value, _block_range); CREATE INDEX "0x21d9f76ed37bd96e" ON leaderboard.account_transfer_receiver_total_counts USING btree (created_at); -CREATE INDEX "0x23e27116b9f0acfb" ON leaderboard.farmer_vote_total_value_histories USING gist (rank, _block_range); -CREATE INDEX "0x246b2da19131c0aa" ON leaderboard.farmer_vote_and_block_total_value_histories USING gist (created_at, _block_range); CREATE INDEX "0x2543cf3b9ae14ab8" ON leaderboard.operator_deposits_total_counts USING btree (created_at); CREATE INDEX "0x25d59bd5befefa21" ON leaderboard.farmer_vote_and_block_total_values USING btree (updated_at); CREATE INDEX "0x261402fc9f454bf4" ON leaderboard.nominator_deposits_total_values USING btree (updated_at); CREATE INDEX "0x274bfb55e0692363" ON leaderboard.account_transfer_sender_total_counts USING btree (updated_at); -CREATE INDEX "0x2a08ed126a9ec75f" ON leaderboard.operator_deposits_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x2ab353d6f5476280" ON leaderboard.farmer_vote_and_block_total_value_histories USING gist (value, _block_range); -CREATE INDEX "0x2b0706c6c4786c0b" ON leaderboard.operator_total_tax_collected_histories USING gist (created_at, _block_range); -CREATE INDEX "0x2e81c6470104e40a" ON leaderboard.account_transfer_receiver_total_counts USING btree (updated_at); -CREATE INDEX "0x3082545cf9f8ade6" ON leaderboard.operator_total_rewards_collected_histories USING btree (id); -CREATE INDEX "0x31c5517209f3c88a" ON leaderboard.account_transfer_receiver_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x33208903dd1d791b" ON leaderboard.operator_deposits_total_value_histories USING gist (value, _block_range); CREATE INDEX "0x36fad076b7b609c8" ON leaderboard.operator_total_tax_collecteds USING btree (rank); -CREATE INDEX "0x37cd3b31685e6b8a" ON leaderboard.operator_deposits_total_count_histories USING btree (id); CREATE INDEX "0x3bb471ec1101b66a" ON leaderboard.account_transfer_receiver_total_values USING btree (created_at); -CREATE INDEX "0x3c11ae5e03742fc1" ON leaderboard.farmer_vote_total_count_histories USING btree (id); CREATE INDEX "0x3c8d59be33cc30fd" ON leaderboard.account_transaction_fee_paid_total_values USING btree (value); CREATE INDEX "0x3fb3bf4c3648e89f" ON leaderboard.operator_bundle_total_counts USING btree (value); -CREATE INDEX "0x40908f6096f8aae1" ON leaderboard.operator_total_tax_collected_histories USING gist (rank, _block_range); CREATE INDEX "0x414cf5a248371b9e" ON leaderboard.operator_total_rewards_collecteds USING btree (value); -CREATE INDEX "0x453b4a7d0154c00e" ON leaderboard.account_extrinsic_failed_total_count_histories USING gist (updated_at, _block_range); CREATE INDEX "0x45b6baa60f76afe5" ON leaderboard.farmer_block_total_counts USING btree (rank); CREATE INDEX "0x45db7717e810fbed" ON leaderboard.account_extrinsic_failed_total_counts USING btree (created_at); -CREATE INDEX "0x477f46ee7c4e2806" ON leaderboard.operator_bundle_total_count_histories USING gist (updated_at, _block_range); CREATE INDEX "0x48833908a7574703" ON leaderboard.account_transfer_sender_total_counts USING btree (created_at); -CREATE INDEX "0x499757adbe68e426" ON leaderboard.operator_bundle_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0x4d064ce423ead9f9" ON leaderboard.nominator_deposits_total_value_histories USING gist (value, _block_range); -CREATE INDEX "0x4e064e2070199ae3" ON leaderboard.account_extrinsic_success_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x5009af847af1621d" ON leaderboard.account_remark_count_histories USING gist (updated_at, _block_range); CREATE INDEX "0x5162c85596c9338e" ON leaderboard.operator_deposits_total_values USING btree (value); CREATE INDEX "0x52d6270f1cc3c4dd" ON leaderboard.operator_bundle_total_counts USING btree (rank); CREATE INDEX "0x547b123af6dcd32a" ON leaderboard.account_extrinsic_total_counts USING btree (updated_at); -CREATE INDEX "0x547bce6e924324b3" ON leaderboard.farmer_vote_and_block_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x554eb4e5ac77f3eb" ON leaderboard.operator_withdrawals_total_count_histories USING btree (id); -CREATE INDEX "0x571e7ad4adadc8ab" ON leaderboard.account_extrinsic_success_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0x5738b9b369347bf1" ON leaderboard.account_remark_counts USING btree (created_at); -CREATE INDEX "0x58a6a962f5dabf12" ON leaderboard.farmer_vote_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x594dec910ab418ad" ON leaderboard.operator_total_rewards_collected_histories USING gist (value, _block_range); CREATE INDEX "0x5b1a07a2eacad81c" ON leaderboard.operator_bundle_total_counts USING btree (updated_at); CREATE INDEX "0x5bd3b2299db13775" ON leaderboard.farmer_vote_and_block_total_counts USING btree (updated_at); CREATE INDEX "0x5cfd74ecb2e7596e" ON leaderboard.nominator_withdrawals_total_counts USING btree (created_at); -CREATE INDEX "0x5d789c4c98a92206" ON leaderboard.account_transfer_receiver_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x5ed08ec48c219622" ON leaderboard.farmer_vote_total_value_histories USING gist (value, _block_range); CREATE INDEX "0x6446d391095803fe" ON leaderboard.account_transfer_receiver_total_values USING btree (rank); CREATE INDEX "0x648d3308d6c4914f" ON leaderboard.operator_deposits_total_counts USING btree (value); -CREATE INDEX "0x6500d8534ebd4e12" ON leaderboard.operator_total_tax_collected_histories USING gist (updated_at, _block_range); CREATE INDEX "0x6625bd986dfdd912" ON leaderboard.farmer_vote_total_values USING btree (rank); -CREATE INDEX "0x66c003a28114773c" ON leaderboard.nominator_deposits_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x66d778d3ec849bd8" ON leaderboard.nominator_deposits_total_value_histories USING gist (rank, _block_range); CREATE INDEX "0x67610203489d7569" ON leaderboard.operator_total_tax_collecteds USING btree (created_at); CREATE INDEX "0x67876d73c8d1484a" ON leaderboard.nominator_deposits_total_values USING btree (created_at); -CREATE INDEX "0x6a80c339bc124d94" ON leaderboard.account_extrinsic_success_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0x6b6077a1d8b8d586" ON leaderboard.operator_bundle_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0x6e3c8d300e206644" ON leaderboard.account_transfer_sender_total_values USING btree (value); CREATE INDEX "0x6e7ba35bab79dae5" ON leaderboard.account_remark_counts USING btree (value); -CREATE INDEX "0x6ede99acc34cc024" ON leaderboard.farmer_vote_and_block_total_value_histories USING gist (rank, _block_range); CREATE INDEX "0x6effab7bf55318c0" ON leaderboard.farmer_block_total_values USING btree (created_at); -CREATE INDEX "0x719e87ef859d46f9" ON leaderboard.account_extrinsic_total_count_histories USING gist (value, _block_range); CREATE INDEX "0x73606d69a16a51ed" ON leaderboard.farmer_vote_and_block_total_counts USING btree (rank); CREATE INDEX "0x74444c6cbb827fed" ON leaderboard.account_extrinsic_failed_total_counts USING btree (rank); -CREATE INDEX "0x74e5dcda7b724127" ON leaderboard.account_transaction_fee_paid_total_value_histories USING gist (rank, _block_range); -CREATE INDEX "0x759f7e295510308d" ON leaderboard.operator_deposits_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0x75d5f56abf048ee1" ON leaderboard.account_remark_count_histories USING gist (value, _block_range); CREATE INDEX "0x77f1b742d319402c" ON leaderboard.account_transaction_fee_paid_total_values USING btree (created_at); -CREATE INDEX "0x796003f4275de9f4" ON leaderboard.nominator_deposits_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0x7c0e839f35282376" ON leaderboard.farmer_block_total_counts USING btree (created_at); CREATE INDEX "0x7c584a4083105781" ON leaderboard.farmer_block_total_values USING btree (value); CREATE INDEX "0x7cdbfa16661f71ee" ON leaderboard.nominator_withdrawals_total_counts USING btree (value); CREATE INDEX "0x7ef3b9aa555b5a05" ON leaderboard.account_transfer_receiver_total_values USING btree (value); -CREATE INDEX "0x7fcce6162fd86748" ON leaderboard.farmer_vote_and_block_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x804628cadf8ddb42" ON leaderboard.farmer_block_total_value_histories USING gist (value, _block_range); -CREATE INDEX "0x809dc846b29ce189" ON leaderboard.account_transfer_sender_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0x80bd9d9b56f42c8c" ON leaderboard.farmer_vote_and_block_total_value_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x81f5dea1dc8bdbd9" ON leaderboard.account_transfer_sender_total_count_histories USING gist (updated_at, _block_range); CREATE INDEX "0x82f033a6c175eddd" ON leaderboard.farmer_vote_and_block_total_values USING btree (value); CREATE INDEX "0x82fe14c738066801" ON leaderboard.account_transfer_sender_total_values USING btree (created_at); -CREATE INDEX "0x8463b2f12b68a67c" ON leaderboard.operator_withdrawals_total_count_histories USING gist (value, _block_range); CREATE INDEX "0x84d750e3c36ee4ab" ON leaderboard.operator_total_tax_collecteds USING btree (updated_at); -CREATE INDEX "0x865a7a78cd9957e1" ON leaderboard.account_transaction_fee_paid_total_value_histories USING btree (id); CREATE INDEX "0x87379ebd9abb3c9f" ON leaderboard.account_extrinsic_total_counts USING btree (created_at); -CREATE INDEX "0x882bd0f439486d4f" ON leaderboard.farmer_block_total_value_histories USING gist (created_at, _block_range); -CREATE INDEX "0x89a552b0035c9bac" ON leaderboard.operator_deposits_total_count_histories USING gist (created_at, _block_range); -CREATE INDEX "0x89e6563a1f910e74" ON leaderboard.operator_deposits_total_value_histories USING gist (rank, _block_range); -CREATE INDEX "0x8a9ec139a3b7547d" ON leaderboard.account_extrinsic_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x8b7c68617ff4e62b" ON leaderboard.operator_deposits_total_value_histories USING btree (id); CREATE INDEX "0x8ba1fd011d0120e6" ON leaderboard.account_remark_counts USING btree (updated_at); -CREATE INDEX "0x8c12fe09c9fbcd4f" ON leaderboard.farmer_block_total_count_histories USING btree (id); -CREATE INDEX "0x8d7008ea364cf94c" ON leaderboard.account_transfer_sender_total_count_histories USING btree (id); -CREATE INDEX "0x8fa61e629a2dcd38" ON leaderboard.account_transfer_receiver_total_value_histories USING btree (id); CREATE INDEX "0x901aff3934f41bd9" ON leaderboard.farmer_vote_total_counts USING btree (updated_at); -CREATE INDEX "0x90d324df0a448bbe" ON leaderboard.nominator_withdrawals_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x957df7861716b7e5" ON leaderboard.nominator_deposits_total_count_histories USING btree (id); CREATE INDEX "0x958866172e237c5c" ON leaderboard.operator_total_rewards_collecteds USING btree (updated_at); -CREATE INDEX "0x964d1cdad7a5330f" ON leaderboard.farmer_vote_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0x979a3db4e9e7c431" ON leaderboard.account_extrinsic_failed_total_count_histories USING gist (value, _block_range); CREATE INDEX "0x97d32cd19e3802db" ON leaderboard.farmer_block_total_values USING btree (rank); CREATE INDEX "0x99d0f21c8605c41c" ON leaderboard.account_transfer_sender_total_counts USING btree (value); -CREATE INDEX "0x9b42c9f7087cc0dd" ON leaderboard.account_transfer_receiver_total_count_histories USING btree (id); -CREATE INDEX "0x9cd9957f6e6b9cf4" ON leaderboard.account_extrinsic_total_count_histories USING btree (id); -CREATE INDEX "0x9d162fe9f8c06084" ON leaderboard.account_transfer_receiver_total_value_histories USING gist (created_at, _block_range); -CREATE INDEX "0x9d8ba3138d055469" ON leaderboard.farmer_vote_total_value_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x9dee2d53a2eb345d" ON leaderboard.farmer_block_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0x9f3af39f22aac290" ON leaderboard.farmer_vote_and_block_total_count_histories USING btree (id); CREATE INDEX "0x9fc7939319b88d37" ON leaderboard.nominator_deposits_total_counts USING btree (value); CREATE INDEX "0xa035d5be2ef2e7ff" ON leaderboard.nominator_deposits_total_values USING btree (value); CREATE INDEX "0xa0371f05d6ab705d" ON leaderboard.farmer_vote_total_values USING btree (created_at); CREATE INDEX "0xa03f24a9dfd38cdc" ON leaderboard.farmer_vote_total_values USING btree (value); -CREATE INDEX "0xa13419e05df57bc9" ON leaderboard.account_transfer_receiver_total_value_histories USING gist (rank, _block_range); CREATE INDEX "0xa6e9645812acf3c5" ON leaderboard.operator_withdrawals_total_counts USING btree (updated_at); -CREATE INDEX "0xa7ec65297714a878" ON leaderboard.account_remark_count_histories USING gist (rank, _block_range); -CREATE INDEX "0xa84f9c2f9b56e910" ON leaderboard.account_remark_count_histories USING gist (created_at, _block_range); CREATE INDEX "0xab244f4097d5b7de" ON leaderboard.account_transfer_receiver_total_counts USING btree (value); CREATE INDEX "0xab389403bd29540d" ON leaderboard.operator_total_rewards_collecteds USING btree (rank); -CREATE INDEX "0xab879a58ac57bb2e" ON leaderboard.account_remark_count_histories USING btree (id); CREATE INDEX "0xac1bf85d692ba008" ON leaderboard.account_transfer_sender_total_values USING btree (rank); CREATE INDEX "0xac5a3d6fd52e2eba" ON leaderboard.farmer_vote_and_block_total_values USING btree (rank); -CREATE INDEX "0xacea6ba8b4475b52" ON leaderboard.operator_total_tax_collected_histories USING gist (value, _block_range); -CREATE INDEX "0xb1d45dae81251f24" ON leaderboard.account_transfer_receiver_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0xb3402699fe4397b8" ON leaderboard.account_transaction_fee_paid_total_value_histories USING gist (updated_at, _block_range); CREATE INDEX "0xb65383ff3975f7d0" ON leaderboard.nominator_withdrawals_total_counts USING btree (rank); CREATE INDEX "0xb8c311b80e4878cf" ON leaderboard.operator_total_tax_collecteds USING btree (value); -CREATE INDEX "0xb9b3589a500a4db1" ON leaderboard.operator_withdrawals_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0xb9c1f66664e1525c" ON leaderboard.account_extrinsic_success_total_counts USING btree (rank); CREATE INDEX "0xba6d7a768cf0f48a" ON leaderboard.account_extrinsic_success_total_counts USING btree (value); CREATE INDEX "0xbb772bc16a6f55fa" ON leaderboard.account_extrinsic_total_counts USING btree (rank); -CREATE INDEX "0xbd9aadf5a0a985b6" ON leaderboard.farmer_block_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0xbdd64bae0c93c9a6" ON leaderboard.farmer_vote_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0xbfc0515dbc24baa0" ON leaderboard.operator_bundle_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0xc032b3ad6fce379b" ON leaderboard.account_transfer_sender_total_value_histories USING gist (rank, _block_range); -CREATE INDEX "0xc18397609d2e50fc" ON leaderboard.nominator_withdrawals_total_count_histories USING btree (id); -CREATE INDEX "0xc26c8c9093762044" ON leaderboard.nominator_deposits_total_value_histories USING btree (id); CREATE INDEX "0xc2d78cc1bc2d4d1d" ON leaderboard.operator_bundle_total_counts USING btree (created_at); CREATE INDEX "0xc62ca597010fa42d" ON leaderboard.operator_deposits_total_counts USING btree (rank); -CREATE INDEX "0xc633abfc19104b3e" ON leaderboard.nominator_deposits_total_value_histories USING gist (updated_at, _block_range); -CREATE INDEX "0xc660a8aa2ffa9c5a" ON leaderboard.farmer_vote_and_block_total_value_histories USING btree (id); -CREATE INDEX "0xc66251f1e0f605d2" ON leaderboard.account_transfer_receiver_total_count_histories USING gist (created_at, _block_range); -CREATE INDEX "0xc704c2e4e4bda11e" ON leaderboard.account_extrinsic_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0xc777a0fed62b8863" ON leaderboard.account_extrinsic_success_total_counts USING btree (updated_at); -CREATE INDEX "0xc81dade686cf3dcf" ON leaderboard.account_extrinsic_failed_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0xc859dbf1a9895777" ON leaderboard.nominator_deposits_total_counts USING btree (created_at); CREATE INDEX "0xc88f7e95a1a80085" ON leaderboard.farmer_vote_and_block_total_counts USING btree (value); -CREATE INDEX "0xc9823b43f2d5fc8e" ON leaderboard.operator_bundle_total_count_histories USING btree (id); CREATE INDEX "0xc9ad4369f9204059" ON leaderboard.account_extrinsic_success_total_counts USING btree (created_at); CREATE INDEX "0xcb0aa6b763df69f6" ON leaderboard.operator_deposits_total_values USING btree (updated_at); CREATE INDEX "0xd1ed11b719eccd00" ON leaderboard.farmer_vote_total_values USING btree (updated_at); -CREATE INDEX "0xd22511462ced1db7" ON leaderboard.farmer_vote_total_value_histories USING gist (created_at, _block_range); CREATE INDEX "0xd2beaf5abcec6d67" ON leaderboard.operator_deposits_total_values USING btree (rank); -CREATE INDEX "0xd39bc9f009b16698" ON leaderboard.operator_total_rewards_collected_histories USING gist (updated_at, _block_range); CREATE INDEX "0xd74476f68a157f82" ON leaderboard.account_transaction_fee_paid_total_values USING btree (rank); CREATE INDEX "0xd8e7a933c1384413" ON leaderboard.account_extrinsic_failed_total_counts USING btree (value); -CREATE INDEX "0xda2d0c5abd8f415c" ON leaderboard.operator_total_tax_collected_histories USING btree (id); CREATE INDEX "0xdb955231fab08930" ON leaderboard.account_extrinsic_total_counts USING btree (value); CREATE INDEX "0xdbb2243b8d9f31b1" ON leaderboard.account_extrinsic_failed_total_counts USING btree (updated_at); -CREATE INDEX "0xdc3838f306829259" ON leaderboard.account_extrinsic_success_total_count_histories USING btree (id); -CREATE INDEX "0xde3fa7f872aada9f" ON leaderboard.account_transfer_sender_total_value_histories USING btree (id); -CREATE INDEX "0xe15c940bb687f7d3" ON leaderboard.nominator_deposits_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0xe332bf4f536fa749" ON leaderboard.nominator_withdrawals_total_count_histories USING gist (rank, _block_range); CREATE INDEX "0xe3fc37f3b8d89c8d" ON leaderboard.operator_total_rewards_collecteds USING btree (created_at); -CREATE INDEX "0xe804db0947f40afe" ON leaderboard.farmer_vote_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0xe8f087b3187060f5" ON leaderboard.farmer_vote_total_counts USING btree (created_at); -CREATE INDEX "0xe965018817336f74" ON leaderboard.account_extrinsic_success_total_count_histories USING gist (rank, _block_range); CREATE INDEX "0xea4fb11415169d44" ON leaderboard.farmer_block_total_counts USING btree (updated_at); -CREATE INDEX "0xeaa4f72de256f32f" ON leaderboard.account_transfer_receiver_total_value_histories USING gist (updated_at, _block_range); CREATE INDEX "0xed196db1fdf8e1ba" ON leaderboard.nominator_deposits_total_counts USING btree (updated_at); CREATE INDEX "0xed89d2ba5685cb9f" ON leaderboard.account_transfer_sender_total_counts USING btree (rank); CREATE INDEX "0xefc871c495be2e8b" ON leaderboard.nominator_withdrawals_total_counts USING btree (updated_at); CREATE INDEX "0xf08c870c8311438f" ON leaderboard.operator_withdrawals_total_counts USING btree (created_at); -CREATE INDEX "0xf0d0d07c02740c62" ON leaderboard.account_transaction_fee_paid_total_value_histories USING gist (created_at, _block_range); -CREATE INDEX "0xf2725a417965f8d8" ON leaderboard.nominator_deposits_total_value_histories USING gist (created_at, _block_range); CREATE INDEX "0xf37e3b354eac5a6e" ON leaderboard.operator_withdrawals_total_counts USING btree (value); CREATE INDEX "0xf3b812b4322af338" ON leaderboard.farmer_block_total_values USING btree (updated_at); -CREATE INDEX "0xf3e7c86856dd5b8c" ON leaderboard.operator_total_rewards_collected_histories USING gist (rank, _block_range); CREATE INDEX "0xf3ee1a0c9ddee938" ON leaderboard.account_transfer_receiver_total_counts USING btree (rank); -CREATE INDEX "0xf458f461b30a6b5e" ON leaderboard.account_extrinsic_failed_total_count_histories USING btree (id); CREATE INDEX "0xf59765eb34448af2" ON leaderboard.account_transaction_fee_paid_total_values USING btree (updated_at); -CREATE INDEX "0xf69f639e813865ed" ON leaderboard.nominator_withdrawals_total_count_histories USING gist (value, _block_range); -CREATE INDEX "0xf7b4d5d42d0c08f4" ON leaderboard.farmer_block_total_value_histories USING gist (rank, _block_range); -CREATE INDEX "0xf81f7cbe047781f3" ON leaderboard.nominator_withdrawals_total_count_histories USING gist (created_at, _block_range); CREATE INDEX "0xf8a25fbf0822721a" ON leaderboard.account_remark_counts USING btree (rank); CREATE INDEX "0xf8b032ae97b931bd" ON leaderboard.operator_deposits_total_counts USING btree (updated_at); -CREATE INDEX "0xfb5c0413cc0c1767" ON leaderboard.account_transaction_fee_paid_total_value_histories USING gist (value, _block_range); -CREATE INDEX "0xfba7f80d0621780a" ON leaderboard.operator_withdrawals_total_count_histories USING gist (rank, _block_range); -CREATE INDEX "0xfc26abe752b123fe" ON leaderboard.nominator_deposits_total_count_histories USING gist (updated_at, _block_range); -CREATE INDEX "0xfc93123fd50e301f" ON leaderboard.account_transfer_sender_total_value_histories USING gist (created_at, _block_range); CREATE INDEX "0xfe4c85f6ab059ff1" ON leaderboard.account_transfer_sender_total_values USING btree (updated_at); CREATE TRIGGER "0x648269cc35867c16" AFTER UPDATE ON consensus._metadata FOR EACH ROW WHEN (((new.key)::text = 'schemaMigrationCount'::text)) EXECUTE FUNCTION consensus.schema_notification(); From 24a4b5fd838a233e42f8740f25142b06f5db4cd2 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:52:21 -0500 Subject: [PATCH 4/8] fix leaderboard sort and rank query in task board --- indexers/taskboard/src/utils/db.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indexers/taskboard/src/utils/db.ts b/indexers/taskboard/src/utils/db.ts index f3c46e247..5b7352ee3 100644 --- a/indexers/taskboard/src/utils/db.ts +++ b/indexers/taskboard/src/utils/db.ts @@ -55,8 +55,8 @@ const updateLeaderboardRanking = (sourceTable: string, targetTable: string) => ` SELECT id, SUM(value) AS total_value, MAX(last_contribution_at) AS last_contribution_at, - MIN(created_at) AS created_at, - MAX(updated_at) AS updated_at + block_height AS created_at, + block_height AS updated_at FROM leaderboard.${sourceTable} GROUP BY id ), From 7804046d4522e1ee3e2d7d8e5a5daf0138073a4b Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:58:16 -0500 Subject: [PATCH 5/8] fix query --- indexers/taskboard/src/utils/db.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indexers/taskboard/src/utils/db.ts b/indexers/taskboard/src/utils/db.ts index 5b7352ee3..913e4b1cc 100644 --- a/indexers/taskboard/src/utils/db.ts +++ b/indexers/taskboard/src/utils/db.ts @@ -55,8 +55,8 @@ const updateLeaderboardRanking = (sourceTable: string, targetTable: string) => ` SELECT id, SUM(value) AS total_value, MAX(last_contribution_at) AS last_contribution_at, - block_height AS created_at, - block_height AS updated_at + MIN(block_height) AS created_at, + MAX(block_height) AS updated_at FROM leaderboard.${sourceTable} GROUP BY id ), @@ -72,7 +72,7 @@ const updateLeaderboardRanking = (sourceTable: string, targetTable: string) => ` INSERT INTO leaderboard.${targetTable} (id, rank, value, last_contribution_at, created_at, updated_at) SELECT id, new_rank, total_value, last_contribution_at, created_at, updated_at FROM ranked_entries ON CONFLICT (id) - DO UPDATE SET rank = EXCLUDED.rank, value = EXCLUDED.value, last_contribution_at = EXCLUDED.last_contribution_at, created_at = EXCLUDED.created_at, updated_at = EXCLUDED.updated_at; + DO UPDATE SET rank = EXCLUDED.rank, value = EXCLUDED.value, last_contribution_at = EXCLUDED.last_contribution_at, updated_at = EXCLUDED.updated_at; `; const consensusUpsertAccountQuery = ` From 99b254eba63b29c438c9f4e439a0704fc6eb42a8 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:34:26 -0500 Subject: [PATCH 6/8] fix queries --- explorer/gql/graphql.tsx | 692 +++++++++++++++--- .../src/components/Consensus/Account/query.ts | 12 +- 2 files changed, 609 insertions(+), 95 deletions(-) diff --git a/explorer/gql/graphql.tsx b/explorer/gql/graphql.tsx index e99f395c2..9be12716f 100644 --- a/explorer/gql/graphql.tsx +++ b/explorer/gql/graphql.tsx @@ -93,7 +93,6 @@ export type Consensus_Account_Histories = { nonce: Scalars['numeric']['output']; reserved: Scalars['numeric']['output']; total?: Maybe; - updated_at: Scalars['numeric']['output']; uuid: Scalars['uuid']['output']; }; @@ -135,7 +134,6 @@ export type Consensus_Account_Histories_Avg_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** Boolean expression to filter rows from the table "consensus.account_histories". All fields are combined with a logical 'AND'. */ @@ -151,7 +149,6 @@ export type Consensus_Account_Histories_Bool_Exp = { nonce?: InputMaybe; reserved?: InputMaybe; total?: InputMaybe; - updated_at?: InputMaybe; uuid?: InputMaybe; }; @@ -164,7 +161,6 @@ export type Consensus_Account_Histories_Max_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; uuid?: Maybe; }; @@ -177,7 +173,6 @@ export type Consensus_Account_Histories_Min_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; uuid?: Maybe; }; @@ -191,7 +186,6 @@ export type Consensus_Account_Histories_Order_By = { nonce?: InputMaybe; reserved?: InputMaybe; total?: InputMaybe; - updated_at?: InputMaybe; uuid?: InputMaybe; }; @@ -212,8 +206,6 @@ export enum Consensus_Account_Histories_Select_Column { /** column name */ Total = 'total', /** column name */ - UpdatedAt = 'updated_at', - /** column name */ Uuid = 'uuid' } @@ -225,7 +217,6 @@ export type Consensus_Account_Histories_Stddev_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** aggregate stddev_pop on columns */ @@ -236,7 +227,6 @@ export type Consensus_Account_Histories_Stddev_Pop_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** aggregate stddev_samp on columns */ @@ -247,7 +237,6 @@ export type Consensus_Account_Histories_Stddev_Samp_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** Streaming cursor of the table "consensus_account_histories" */ @@ -267,7 +256,6 @@ export type Consensus_Account_Histories_Stream_Cursor_Value_Input = { nonce?: InputMaybe; reserved?: InputMaybe; total?: InputMaybe; - updated_at?: InputMaybe; uuid?: InputMaybe; }; @@ -279,7 +267,6 @@ export type Consensus_Account_Histories_Sum_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** aggregate var_pop on columns */ @@ -290,7 +277,6 @@ export type Consensus_Account_Histories_Var_Pop_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** aggregate var_samp on columns */ @@ -301,7 +287,6 @@ export type Consensus_Account_Histories_Var_Samp_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** aggregate variance on columns */ @@ -312,7 +297,6 @@ export type Consensus_Account_Histories_Variance_Fields = { nonce?: Maybe; reserved?: Maybe; total?: Maybe; - updated_at?: Maybe; }; /** columns and relationships of "consensus.account_profiles" */ @@ -577,6 +561,7 @@ export type Consensus_Account_Rewards_Stream_Cursor_Value_Input = { export type Consensus_Accounts = { __typename?: 'consensus_accounts'; _block_range: Scalars['int8range']['output']; + account_id: Scalars['String']['output']; created_at: Scalars['numeric']['output']; /** An array relationship */ extrinsics: Array; @@ -684,6 +669,7 @@ export type Consensus_Accounts_Bool_Exp = { _block_range?: InputMaybe; _not?: InputMaybe; _or?: InputMaybe>; + account_id?: InputMaybe; created_at?: InputMaybe; extrinsics?: InputMaybe; extrinsics_aggregate?: InputMaybe; @@ -702,6 +688,7 @@ export type Consensus_Accounts_Bool_Exp = { /** aggregate max on columns */ export type Consensus_Accounts_Max_Fields = { __typename?: 'consensus_accounts_max_fields'; + account_id?: Maybe; created_at?: Maybe; free?: Maybe; id?: Maybe; @@ -715,6 +702,7 @@ export type Consensus_Accounts_Max_Fields = { /** aggregate min on columns */ export type Consensus_Accounts_Min_Fields = { __typename?: 'consensus_accounts_min_fields'; + account_id?: Maybe; created_at?: Maybe; free?: Maybe; id?: Maybe; @@ -728,6 +716,7 @@ export type Consensus_Accounts_Min_Fields = { /** Ordering options when selecting data from "consensus.accounts". */ export type Consensus_Accounts_Order_By = { _block_range?: InputMaybe; + account_id?: InputMaybe; created_at?: InputMaybe; extrinsics_aggregate?: InputMaybe; free?: InputMaybe; @@ -746,6 +735,8 @@ export enum Consensus_Accounts_Select_Column { /** column name */ BlockRange = '_block_range', /** column name */ + AccountId = 'account_id', + /** column name */ CreatedAt = 'created_at', /** column name */ Free = 'free', @@ -807,6 +798,7 @@ export type Consensus_Accounts_Stream_Cursor_Input = { /** Initial value of the column from where the streaming should start */ export type Consensus_Accounts_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; + account_id?: InputMaybe; created_at?: InputMaybe; free?: InputMaybe; id?: InputMaybe; @@ -865,9 +857,27 @@ export type Consensus_Accounts_Variance_Fields = { export type Consensus_Blocks = { __typename?: 'consensus_blocks'; _block_range: Scalars['int8range']['output']; + accounts_count: Scalars['Int']['output']; author_id: Scalars['String']['output']; + block_reward_value: Scalars['numeric']['output']; + block_rewards_count: Scalars['Int']['output']; blockchain_size: Scalars['numeric']['output']; /** An array relationship */ + cids: Array; + /** An aggregate relationship */ + cids_aggregate: Files_Cids_Aggregate; + cumulative_accounts_count: Scalars['numeric']['output']; + cumulative_block_reward_value: Scalars['numeric']['output']; + cumulative_block_rewards_count: Scalars['numeric']['output']; + cumulative_events_count: Scalars['numeric']['output']; + cumulative_extrinsics_count: Scalars['numeric']['output']; + cumulative_reward_value: Scalars['numeric']['output']; + cumulative_rewards_count: Scalars['numeric']['output']; + cumulative_transfer_value: Scalars['numeric']['output']; + cumulative_transfers_count: Scalars['numeric']['output']; + cumulative_vote_reward_value: Scalars['numeric']['output']; + cumulative_vote_rewards_count: Scalars['numeric']['output']; + /** An array relationship */ events: Array; /** An aggregate relationship */ events_aggregate: Consensus_Events_Aggregate; @@ -886,12 +896,38 @@ export type Consensus_Blocks = { /** An aggregate relationship */ logs_aggregate: Consensus_Logs_Aggregate; parent_hash: Scalars['String']['output']; + reward_value: Scalars['numeric']['output']; + rewards_count: Scalars['Int']['output']; sort_id: Scalars['String']['output']; space_pledged: Scalars['numeric']['output']; spec_id: Scalars['String']['output']; state_root: Scalars['String']['output']; timestamp: Scalars['timestamp']['output']; + transfer_value: Scalars['numeric']['output']; + transfers_count: Scalars['Int']['output']; uuid: Scalars['uuid']['output']; + vote_reward_value: Scalars['numeric']['output']; + vote_rewards_count: Scalars['Int']['output']; +}; + + +/** columns and relationships of "consensus.blocks" */ +export type Consensus_BlocksCidsArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + +/** columns and relationships of "consensus.blocks" */ +export type Consensus_BlocksCids_AggregateArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; }; @@ -987,11 +1023,31 @@ export type Consensus_Blocks_Aggregate_FieldsCountArgs = { /** aggregate avg on columns */ export type Consensus_Blocks_Avg_Fields = { __typename?: 'consensus_blocks_avg_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** Boolean expression to filter rows from the table "consensus.blocks". All fields are combined with a logical 'AND'. */ @@ -1000,8 +1056,24 @@ export type Consensus_Blocks_Bool_Exp = { _block_range?: InputMaybe; _not?: InputMaybe; _or?: InputMaybe>; + accounts_count?: InputMaybe; author_id?: InputMaybe; + block_reward_value?: InputMaybe; + block_rewards_count?: InputMaybe; blockchain_size?: InputMaybe; + cids?: InputMaybe; + cids_aggregate?: InputMaybe; + cumulative_accounts_count?: InputMaybe; + cumulative_block_reward_value?: InputMaybe; + cumulative_block_rewards_count?: InputMaybe; + cumulative_events_count?: InputMaybe; + cumulative_extrinsics_count?: InputMaybe; + cumulative_reward_value?: InputMaybe; + cumulative_rewards_count?: InputMaybe; + cumulative_transfer_value?: InputMaybe; + cumulative_transfers_count?: InputMaybe; + cumulative_vote_reward_value?: InputMaybe; + cumulative_vote_rewards_count?: InputMaybe; events?: InputMaybe; events_aggregate?: InputMaybe; events_count?: InputMaybe; @@ -1015,19 +1087,39 @@ export type Consensus_Blocks_Bool_Exp = { logs?: InputMaybe; logs_aggregate?: InputMaybe; parent_hash?: InputMaybe; + reward_value?: InputMaybe; + rewards_count?: InputMaybe; sort_id?: InputMaybe; space_pledged?: InputMaybe; spec_id?: InputMaybe; state_root?: InputMaybe; timestamp?: InputMaybe; + transfer_value?: InputMaybe; + transfers_count?: InputMaybe; uuid?: InputMaybe; + vote_reward_value?: InputMaybe; + vote_rewards_count?: InputMaybe; }; /** aggregate max on columns */ export type Consensus_Blocks_Max_Fields = { __typename?: 'consensus_blocks_max_fields'; + accounts_count?: Maybe; author_id?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; extrinsics_root?: Maybe; @@ -1035,19 +1127,39 @@ export type Consensus_Blocks_Max_Fields = { height?: Maybe; id?: Maybe; parent_hash?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; sort_id?: Maybe; space_pledged?: Maybe; spec_id?: Maybe; state_root?: Maybe; timestamp?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; uuid?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** aggregate min on columns */ export type Consensus_Blocks_Min_Fields = { __typename?: 'consensus_blocks_min_fields'; + accounts_count?: Maybe; author_id?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; extrinsics_root?: Maybe; @@ -1055,19 +1167,40 @@ export type Consensus_Blocks_Min_Fields = { height?: Maybe; id?: Maybe; parent_hash?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; sort_id?: Maybe; space_pledged?: Maybe; spec_id?: Maybe; state_root?: Maybe; timestamp?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; uuid?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** Ordering options when selecting data from "consensus.blocks". */ export type Consensus_Blocks_Order_By = { _block_range?: InputMaybe; + accounts_count?: InputMaybe; author_id?: InputMaybe; + block_reward_value?: InputMaybe; + block_rewards_count?: InputMaybe; blockchain_size?: InputMaybe; + cids_aggregate?: InputMaybe; + cumulative_accounts_count?: InputMaybe; + cumulative_block_reward_value?: InputMaybe; + cumulative_block_rewards_count?: InputMaybe; + cumulative_events_count?: InputMaybe; + cumulative_extrinsics_count?: InputMaybe; + cumulative_reward_value?: InputMaybe; + cumulative_rewards_count?: InputMaybe; + cumulative_transfer_value?: InputMaybe; + cumulative_transfers_count?: InputMaybe; + cumulative_vote_reward_value?: InputMaybe; + cumulative_vote_rewards_count?: InputMaybe; events_aggregate?: InputMaybe; events_count?: InputMaybe; extrinsics_aggregate?: InputMaybe; @@ -1078,12 +1211,18 @@ export type Consensus_Blocks_Order_By = { id?: InputMaybe; logs_aggregate?: InputMaybe; parent_hash?: InputMaybe; + reward_value?: InputMaybe; + rewards_count?: InputMaybe; sort_id?: InputMaybe; space_pledged?: InputMaybe; spec_id?: InputMaybe; state_root?: InputMaybe; timestamp?: InputMaybe; + transfer_value?: InputMaybe; + transfers_count?: InputMaybe; uuid?: InputMaybe; + vote_reward_value?: InputMaybe; + vote_rewards_count?: InputMaybe; }; /** select columns of table "consensus.blocks" */ @@ -1091,10 +1230,38 @@ export enum Consensus_Blocks_Select_Column { /** column name */ BlockRange = '_block_range', /** column name */ + AccountsCount = 'accounts_count', + /** column name */ AuthorId = 'author_id', /** column name */ + BlockRewardValue = 'block_reward_value', + /** column name */ + BlockRewardsCount = 'block_rewards_count', + /** column name */ BlockchainSize = 'blockchain_size', /** column name */ + CumulativeAccountsCount = 'cumulative_accounts_count', + /** column name */ + CumulativeBlockRewardValue = 'cumulative_block_reward_value', + /** column name */ + CumulativeBlockRewardsCount = 'cumulative_block_rewards_count', + /** column name */ + CumulativeEventsCount = 'cumulative_events_count', + /** column name */ + CumulativeExtrinsicsCount = 'cumulative_extrinsics_count', + /** column name */ + CumulativeRewardValue = 'cumulative_reward_value', + /** column name */ + CumulativeRewardsCount = 'cumulative_rewards_count', + /** column name */ + CumulativeTransferValue = 'cumulative_transfer_value', + /** column name */ + CumulativeTransfersCount = 'cumulative_transfers_count', + /** column name */ + CumulativeVoteRewardValue = 'cumulative_vote_reward_value', + /** column name */ + CumulativeVoteRewardsCount = 'cumulative_vote_rewards_count', + /** column name */ EventsCount = 'events_count', /** column name */ ExtrinsicsCount = 'extrinsics_count', @@ -1109,6 +1276,10 @@ export enum Consensus_Blocks_Select_Column { /** column name */ ParentHash = 'parent_hash', /** column name */ + RewardValue = 'reward_value', + /** column name */ + RewardsCount = 'rewards_count', + /** column name */ SortId = 'sort_id', /** column name */ SpacePledged = 'space_pledged', @@ -1119,37 +1290,105 @@ export enum Consensus_Blocks_Select_Column { /** column name */ Timestamp = 'timestamp', /** column name */ - Uuid = 'uuid' + TransferValue = 'transfer_value', + /** column name */ + TransfersCount = 'transfers_count', + /** column name */ + Uuid = 'uuid', + /** column name */ + VoteRewardValue = 'vote_reward_value', + /** column name */ + VoteRewardsCount = 'vote_rewards_count' } /** aggregate stddev on columns */ export type Consensus_Blocks_Stddev_Fields = { __typename?: 'consensus_blocks_stddev_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** aggregate stddev_pop on columns */ export type Consensus_Blocks_Stddev_Pop_Fields = { __typename?: 'consensus_blocks_stddev_pop_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** aggregate stddev_samp on columns */ export type Consensus_Blocks_Stddev_Samp_Fields = { __typename?: 'consensus_blocks_stddev_samp_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** Streaming cursor of the table "consensus_blocks" */ @@ -1163,8 +1402,22 @@ export type Consensus_Blocks_Stream_Cursor_Input = { /** Initial value of the column from where the streaming should start */ export type Consensus_Blocks_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; + accounts_count?: InputMaybe; author_id?: InputMaybe; + block_reward_value?: InputMaybe; + block_rewards_count?: InputMaybe; blockchain_size?: InputMaybe; + cumulative_accounts_count?: InputMaybe; + cumulative_block_reward_value?: InputMaybe; + cumulative_block_rewards_count?: InputMaybe; + cumulative_events_count?: InputMaybe; + cumulative_extrinsics_count?: InputMaybe; + cumulative_reward_value?: InputMaybe; + cumulative_rewards_count?: InputMaybe; + cumulative_transfer_value?: InputMaybe; + cumulative_transfers_count?: InputMaybe; + cumulative_vote_reward_value?: InputMaybe; + cumulative_vote_rewards_count?: InputMaybe; events_count?: InputMaybe; extrinsics_count?: InputMaybe; extrinsics_root?: InputMaybe; @@ -1172,52 +1425,138 @@ export type Consensus_Blocks_Stream_Cursor_Value_Input = { height?: InputMaybe; id?: InputMaybe; parent_hash?: InputMaybe; + reward_value?: InputMaybe; + rewards_count?: InputMaybe; sort_id?: InputMaybe; space_pledged?: InputMaybe; spec_id?: InputMaybe; state_root?: InputMaybe; timestamp?: InputMaybe; + transfer_value?: InputMaybe; + transfers_count?: InputMaybe; uuid?: InputMaybe; + vote_reward_value?: InputMaybe; + vote_rewards_count?: InputMaybe; }; /** aggregate sum on columns */ export type Consensus_Blocks_Sum_Fields = { __typename?: 'consensus_blocks_sum_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** aggregate var_pop on columns */ export type Consensus_Blocks_Var_Pop_Fields = { __typename?: 'consensus_blocks_var_pop_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** aggregate var_samp on columns */ export type Consensus_Blocks_Var_Samp_Fields = { __typename?: 'consensus_blocks_var_samp_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** aggregate variance on columns */ export type Consensus_Blocks_Variance_Fields = { __typename?: 'consensus_blocks_variance_fields'; + accounts_count?: Maybe; + block_reward_value?: Maybe; + block_rewards_count?: Maybe; blockchain_size?: Maybe; + cumulative_accounts_count?: Maybe; + cumulative_block_reward_value?: Maybe; + cumulative_block_rewards_count?: Maybe; + cumulative_events_count?: Maybe; + cumulative_extrinsics_count?: Maybe; + cumulative_reward_value?: Maybe; + cumulative_rewards_count?: Maybe; + cumulative_transfer_value?: Maybe; + cumulative_transfers_count?: Maybe; + cumulative_vote_reward_value?: Maybe; + cumulative_vote_rewards_count?: Maybe; events_count?: Maybe; extrinsics_count?: Maybe; height?: Maybe; + reward_value?: Maybe; + rewards_count?: Maybe; space_pledged?: Maybe; + transfer_value?: Maybe; + transfers_count?: Maybe; + vote_reward_value?: Maybe; + vote_rewards_count?: Maybe; }; /** columns and relationships of "consensus.event_modules" */ @@ -1232,6 +1571,7 @@ export type Consensus_Event_Modules = { method: Scalars['String']['output']; /** An object relationship */ module_section?: Maybe; + name: Scalars['String']['output']; section: Scalars['String']['output']; uuid: Scalars['uuid']['output']; }; @@ -1307,6 +1647,7 @@ export type Consensus_Event_Modules_Bool_Exp = { id?: InputMaybe; method?: InputMaybe; module_section?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1316,6 +1657,7 @@ export type Consensus_Event_Modules_Max_Fields = { __typename?: 'consensus_event_modules_max_fields'; id?: Maybe; method?: Maybe; + name?: Maybe; section?: Maybe; uuid?: Maybe; }; @@ -1324,6 +1666,7 @@ export type Consensus_Event_Modules_Max_Fields = { export type Consensus_Event_Modules_Max_Order_By = { id?: InputMaybe; method?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1333,6 +1676,7 @@ export type Consensus_Event_Modules_Min_Fields = { __typename?: 'consensus_event_modules_min_fields'; id?: Maybe; method?: Maybe; + name?: Maybe; section?: Maybe; uuid?: Maybe; }; @@ -1341,6 +1685,7 @@ export type Consensus_Event_Modules_Min_Fields = { export type Consensus_Event_Modules_Min_Order_By = { id?: InputMaybe; method?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1352,6 +1697,7 @@ export type Consensus_Event_Modules_Order_By = { id?: InputMaybe; method?: InputMaybe; module_section?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1365,6 +1711,8 @@ export enum Consensus_Event_Modules_Select_Column { /** column name */ Method = 'method', /** column name */ + Name = 'name', + /** column name */ Section = 'section', /** column name */ Uuid = 'uuid' @@ -1383,6 +1731,7 @@ export type Consensus_Event_Modules_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; id?: InputMaybe; method?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1396,6 +1745,7 @@ export type Consensus_Events = { block?: Maybe; block_hash: Scalars['String']['output']; block_height: Scalars['numeric']['output']; + cid?: Maybe; /** An object relationship */ event_module?: Maybe; /** An object relationship */ @@ -1495,6 +1845,7 @@ export type Consensus_Events_Bool_Exp = { block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; event_module?: InputMaybe; extrinsic?: InputMaybe; extrinsic_hash?: InputMaybe; @@ -1517,6 +1868,7 @@ export type Consensus_Events_Max_Fields = { args?: Maybe; block_hash?: Maybe; block_height?: Maybe; + cid?: Maybe; extrinsic_hash?: Maybe; extrinsic_id?: Maybe; id?: Maybe; @@ -1536,6 +1888,7 @@ export type Consensus_Events_Max_Order_By = { args?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; extrinsic_hash?: InputMaybe; extrinsic_id?: InputMaybe; id?: InputMaybe; @@ -1556,6 +1909,7 @@ export type Consensus_Events_Min_Fields = { args?: Maybe; block_hash?: Maybe; block_height?: Maybe; + cid?: Maybe; extrinsic_hash?: Maybe; extrinsic_id?: Maybe; id?: Maybe; @@ -1575,6 +1929,7 @@ export type Consensus_Events_Min_Order_By = { args?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; extrinsic_hash?: InputMaybe; extrinsic_id?: InputMaybe; id?: InputMaybe; @@ -1596,6 +1951,7 @@ export type Consensus_Events_Order_By = { block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; event_module?: InputMaybe; extrinsic?: InputMaybe; extrinsic_hash?: InputMaybe; @@ -1623,6 +1979,8 @@ export enum Consensus_Events_Select_Column { /** column name */ BlockHeight = 'block_height', /** column name */ + Cid = 'cid', + /** column name */ ExtrinsicHash = 'extrinsic_hash', /** column name */ ExtrinsicId = 'extrinsic_id', @@ -1707,6 +2065,7 @@ export type Consensus_Events_Stream_Cursor_Value_Input = { args?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; extrinsic_hash?: InputMaybe; extrinsic_id?: InputMaybe; id?: InputMaybe; @@ -1793,6 +2152,7 @@ export type Consensus_Extrinsic_Modules = { method: Scalars['String']['output']; /** An object relationship */ module_section?: Maybe; + name: Scalars['String']['output']; section: Scalars['String']['output']; uuid: Scalars['uuid']['output']; }; @@ -1868,6 +2228,7 @@ export type Consensus_Extrinsic_Modules_Bool_Exp = { id?: InputMaybe; method?: InputMaybe; module_section?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1877,6 +2238,7 @@ export type Consensus_Extrinsic_Modules_Max_Fields = { __typename?: 'consensus_extrinsic_modules_max_fields'; id?: Maybe; method?: Maybe; + name?: Maybe; section?: Maybe; uuid?: Maybe; }; @@ -1885,6 +2247,7 @@ export type Consensus_Extrinsic_Modules_Max_Fields = { export type Consensus_Extrinsic_Modules_Max_Order_By = { id?: InputMaybe; method?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1894,6 +2257,7 @@ export type Consensus_Extrinsic_Modules_Min_Fields = { __typename?: 'consensus_extrinsic_modules_min_fields'; id?: Maybe; method?: Maybe; + name?: Maybe; section?: Maybe; uuid?: Maybe; }; @@ -1902,6 +2266,7 @@ export type Consensus_Extrinsic_Modules_Min_Fields = { export type Consensus_Extrinsic_Modules_Min_Order_By = { id?: InputMaybe; method?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1913,6 +2278,7 @@ export type Consensus_Extrinsic_Modules_Order_By = { id?: InputMaybe; method?: InputMaybe; module_section?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1926,6 +2292,8 @@ export enum Consensus_Extrinsic_Modules_Select_Column { /** column name */ Method = 'method', /** column name */ + Name = 'name', + /** column name */ Section = 'section', /** column name */ Uuid = 'uuid' @@ -1944,6 +2312,7 @@ export type Consensus_Extrinsic_Modules_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; id?: InputMaybe; method?: InputMaybe; + name?: InputMaybe; section?: InputMaybe; uuid?: InputMaybe; }; @@ -1957,6 +2326,11 @@ export type Consensus_Extrinsics = { block?: Maybe; block_hash: Scalars['String']['output']; block_height: Scalars['numeric']['output']; + cid?: Maybe; + /** An array relationship */ + cids: Array; + /** An aggregate relationship */ + cids_aggregate: Files_Cids_Aggregate; error: Scalars['String']['output']; /** An array relationship */ events: Array; @@ -1983,6 +2357,26 @@ export type Consensus_Extrinsics = { }; +/** columns and relationships of "consensus.extrinsics" */ +export type Consensus_ExtrinsicsCidsArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + +/** columns and relationships of "consensus.extrinsics" */ +export type Consensus_ExtrinsicsCids_AggregateArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + /** columns and relationships of "consensus.extrinsics" */ export type Consensus_ExtrinsicsEventsArgs = { distinct_on?: InputMaybe>; @@ -2105,6 +2499,9 @@ export type Consensus_Extrinsics_Bool_Exp = { block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; + cids?: InputMaybe; + cids_aggregate?: InputMaybe; error?: InputMaybe; events?: InputMaybe; events_aggregate?: InputMaybe; @@ -2133,6 +2530,7 @@ export type Consensus_Extrinsics_Max_Fields = { args?: Maybe; block_hash?: Maybe; block_height?: Maybe; + cid?: Maybe; error?: Maybe; fee?: Maybe; hash?: Maybe; @@ -2156,6 +2554,7 @@ export type Consensus_Extrinsics_Max_Order_By = { args?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; error?: InputMaybe; fee?: InputMaybe; hash?: InputMaybe; @@ -2180,6 +2579,7 @@ export type Consensus_Extrinsics_Min_Fields = { args?: Maybe; block_hash?: Maybe; block_height?: Maybe; + cid?: Maybe; error?: Maybe; fee?: Maybe; hash?: Maybe; @@ -2203,6 +2603,7 @@ export type Consensus_Extrinsics_Min_Order_By = { args?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; error?: InputMaybe; fee?: InputMaybe; hash?: InputMaybe; @@ -2228,6 +2629,8 @@ export type Consensus_Extrinsics_Order_By = { block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; + cids_aggregate?: InputMaybe; error?: InputMaybe; events_aggregate?: InputMaybe; extrinsic_module?: InputMaybe; @@ -2260,6 +2663,8 @@ export enum Consensus_Extrinsics_Select_Column { /** column name */ BlockHeight = 'block_height', /** column name */ + Cid = 'cid', + /** column name */ Error = 'error', /** column name */ Fee = 'fee', @@ -2384,6 +2789,7 @@ export type Consensus_Extrinsics_Stream_Cursor_Value_Input = { args?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + cid?: InputMaybe; error?: InputMaybe; fee?: InputMaybe; hash?: InputMaybe; @@ -2492,6 +2898,7 @@ export type Consensus_Log_Kinds = { __typename?: 'consensus_log_kinds'; _block_range: Scalars['int8range']['output']; id: Scalars['String']['output']; + kind: Scalars['String']['output']; /** An array relationship */ logs: Array; /** An aggregate relationship */ @@ -2548,6 +2955,7 @@ export type Consensus_Log_Kinds_Bool_Exp = { _not?: InputMaybe; _or?: InputMaybe>; id?: InputMaybe; + kind?: InputMaybe; logs?: InputMaybe; logs_aggregate?: InputMaybe; uuid?: InputMaybe; @@ -2557,6 +2965,7 @@ export type Consensus_Log_Kinds_Bool_Exp = { export type Consensus_Log_Kinds_Max_Fields = { __typename?: 'consensus_log_kinds_max_fields'; id?: Maybe; + kind?: Maybe; uuid?: Maybe; }; @@ -2564,6 +2973,7 @@ export type Consensus_Log_Kinds_Max_Fields = { export type Consensus_Log_Kinds_Min_Fields = { __typename?: 'consensus_log_kinds_min_fields'; id?: Maybe; + kind?: Maybe; uuid?: Maybe; }; @@ -2571,6 +2981,7 @@ export type Consensus_Log_Kinds_Min_Fields = { export type Consensus_Log_Kinds_Order_By = { _block_range?: InputMaybe; id?: InputMaybe; + kind?: InputMaybe; logs_aggregate?: InputMaybe; uuid?: InputMaybe; }; @@ -2582,6 +2993,8 @@ export enum Consensus_Log_Kinds_Select_Column { /** column name */ Id = 'id', /** column name */ + Kind = 'kind', + /** column name */ Uuid = 'uuid' } @@ -2597,6 +3010,7 @@ export type Consensus_Log_Kinds_Stream_Cursor_Input = { export type Consensus_Log_Kinds_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; id?: InputMaybe; + kind?: InputMaybe; uuid?: InputMaybe; }; @@ -2926,8 +3340,9 @@ export type Consensus_Rewards = { block?: Maybe; block_hash: Scalars['String']['output']; block_height: Scalars['numeric']['output']; + event_id: Scalars['String']['output']; + extrinsic_id: Scalars['String']['output']; id: Scalars['String']['output']; - index_in_block: Scalars['numeric']['output']; reward_type: Scalars['String']['output']; timestamp: Scalars['timestamp']['output']; uuid: Scalars['uuid']['output']; @@ -2994,14 +3409,12 @@ export type Consensus_Rewards_Avg_Fields = { __typename?: 'consensus_rewards_avg_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by avg() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Avg_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** Boolean expression to filter rows from the table "consensus.rewards". All fields are combined with a logical 'AND'. */ @@ -3016,8 +3429,9 @@ export type Consensus_Rewards_Bool_Exp = { block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + event_id?: InputMaybe; + extrinsic_id?: InputMaybe; id?: InputMaybe; - index_in_block?: InputMaybe; reward_type?: InputMaybe; timestamp?: InputMaybe; uuid?: InputMaybe; @@ -3030,8 +3444,9 @@ export type Consensus_Rewards_Max_Fields = { amount?: Maybe; block_hash?: Maybe; block_height?: Maybe; + event_id?: Maybe; + extrinsic_id?: Maybe; id?: Maybe; - index_in_block?: Maybe; reward_type?: Maybe; timestamp?: Maybe; uuid?: Maybe; @@ -3043,8 +3458,9 @@ export type Consensus_Rewards_Max_Order_By = { amount?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + event_id?: InputMaybe; + extrinsic_id?: InputMaybe; id?: InputMaybe; - index_in_block?: InputMaybe; reward_type?: InputMaybe; timestamp?: InputMaybe; uuid?: InputMaybe; @@ -3057,8 +3473,9 @@ export type Consensus_Rewards_Min_Fields = { amount?: Maybe; block_hash?: Maybe; block_height?: Maybe; + event_id?: Maybe; + extrinsic_id?: Maybe; id?: Maybe; - index_in_block?: Maybe; reward_type?: Maybe; timestamp?: Maybe; uuid?: Maybe; @@ -3070,8 +3487,9 @@ export type Consensus_Rewards_Min_Order_By = { amount?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + event_id?: InputMaybe; + extrinsic_id?: InputMaybe; id?: InputMaybe; - index_in_block?: InputMaybe; reward_type?: InputMaybe; timestamp?: InputMaybe; uuid?: InputMaybe; @@ -3086,8 +3504,9 @@ export type Consensus_Rewards_Order_By = { block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + event_id?: InputMaybe; + extrinsic_id?: InputMaybe; id?: InputMaybe; - index_in_block?: InputMaybe; reward_type?: InputMaybe; timestamp?: InputMaybe; uuid?: InputMaybe; @@ -3106,9 +3525,11 @@ export enum Consensus_Rewards_Select_Column { /** column name */ BlockHeight = 'block_height', /** column name */ - Id = 'id', + EventId = 'event_id', /** column name */ - IndexInBlock = 'index_in_block', + ExtrinsicId = 'extrinsic_id', + /** column name */ + Id = 'id', /** column name */ RewardType = 'reward_type', /** column name */ @@ -3122,14 +3543,12 @@ export type Consensus_Rewards_Stddev_Fields = { __typename?: 'consensus_rewards_stddev_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by stddev() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Stddev_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** aggregate stddev_pop on columns */ @@ -3137,14 +3556,12 @@ export type Consensus_Rewards_Stddev_Pop_Fields = { __typename?: 'consensus_rewards_stddev_pop_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by stddev_pop() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Stddev_Pop_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** aggregate stddev_samp on columns */ @@ -3152,14 +3569,12 @@ export type Consensus_Rewards_Stddev_Samp_Fields = { __typename?: 'consensus_rewards_stddev_samp_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by stddev_samp() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Stddev_Samp_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** Streaming cursor of the table "consensus_rewards" */ @@ -3177,8 +3592,9 @@ export type Consensus_Rewards_Stream_Cursor_Value_Input = { amount?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; + event_id?: InputMaybe; + extrinsic_id?: InputMaybe; id?: InputMaybe; - index_in_block?: InputMaybe; reward_type?: InputMaybe; timestamp?: InputMaybe; uuid?: InputMaybe; @@ -3189,14 +3605,12 @@ export type Consensus_Rewards_Sum_Fields = { __typename?: 'consensus_rewards_sum_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by sum() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Sum_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** aggregate var_pop on columns */ @@ -3204,14 +3618,12 @@ export type Consensus_Rewards_Var_Pop_Fields = { __typename?: 'consensus_rewards_var_pop_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by var_pop() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Var_Pop_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** aggregate var_samp on columns */ @@ -3219,14 +3631,12 @@ export type Consensus_Rewards_Var_Samp_Fields = { __typename?: 'consensus_rewards_var_samp_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by var_samp() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Var_Samp_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** aggregate variance on columns */ @@ -3234,14 +3644,12 @@ export type Consensus_Rewards_Variance_Fields = { __typename?: 'consensus_rewards_variance_fields'; amount?: Maybe; block_height?: Maybe; - index_in_block?: Maybe; }; /** order by variance() on columns of table "consensus.rewards" */ export type Consensus_Rewards_Variance_Order_By = { amount?: InputMaybe; block_height?: InputMaybe; - index_in_block?: InputMaybe; }; /** columns and relationships of "consensus.sections" */ @@ -3257,6 +3665,7 @@ export type Consensus_Sections = { /** An aggregate relationship */ extrinsic_modules_aggregate: Consensus_Extrinsic_Modules_Aggregate; id: Scalars['String']['output']; + section: Scalars['String']['output']; uuid: Scalars['uuid']['output']; }; @@ -3333,6 +3742,7 @@ export type Consensus_Sections_Bool_Exp = { extrinsic_modules?: InputMaybe; extrinsic_modules_aggregate?: InputMaybe; id?: InputMaybe; + section?: InputMaybe; uuid?: InputMaybe; }; @@ -3340,6 +3750,7 @@ export type Consensus_Sections_Bool_Exp = { export type Consensus_Sections_Max_Fields = { __typename?: 'consensus_sections_max_fields'; id?: Maybe; + section?: Maybe; uuid?: Maybe; }; @@ -3347,6 +3758,7 @@ export type Consensus_Sections_Max_Fields = { export type Consensus_Sections_Min_Fields = { __typename?: 'consensus_sections_min_fields'; id?: Maybe; + section?: Maybe; uuid?: Maybe; }; @@ -3356,6 +3768,7 @@ export type Consensus_Sections_Order_By = { event_modules_aggregate?: InputMaybe; extrinsic_modules_aggregate?: InputMaybe; id?: InputMaybe; + section?: InputMaybe; uuid?: InputMaybe; }; @@ -3366,6 +3779,8 @@ export enum Consensus_Sections_Select_Column { /** column name */ Id = 'id', /** column name */ + Section = 'section', + /** column name */ Uuid = 'uuid' } @@ -3381,6 +3796,7 @@ export type Consensus_Sections_Stream_Cursor_Input = { export type Consensus_Sections_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; id?: InputMaybe; + section?: InputMaybe; uuid?: InputMaybe; }; @@ -3388,15 +3804,15 @@ export type Consensus_Sections_Stream_Cursor_Value_Input = { export type Consensus_Transfers = { __typename?: 'consensus_transfers'; _block_range: Scalars['int8range']['output']; - created_at: Scalars['numeric']['output']; - date: Scalars['timestamp']['output']; + block_hash: Scalars['String']['output']; + block_height: Scalars['numeric']['output']; event_id: Scalars['String']['output']; extrinsic_id: Scalars['String']['output']; fee: Scalars['numeric']['output']; from: Scalars['String']['output']; id: Scalars['String']['output']; success: Scalars['Boolean']['output']; - timestamp: Scalars['numeric']['output']; + timestamp: Scalars['timestamp']['output']; to: Scalars['String']['output']; uuid: Scalars['uuid']['output']; value: Scalars['numeric']['output']; @@ -3435,9 +3851,8 @@ export type Consensus_Transfers_Aggregate_FieldsCountArgs = { /** aggregate avg on columns */ export type Consensus_Transfers_Avg_Fields = { __typename?: 'consensus_transfers_avg_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; @@ -3447,15 +3862,15 @@ export type Consensus_Transfers_Bool_Exp = { _block_range?: InputMaybe; _not?: InputMaybe; _or?: InputMaybe>; - created_at?: InputMaybe; - date?: InputMaybe; + block_hash?: InputMaybe; + block_height?: InputMaybe; event_id?: InputMaybe; extrinsic_id?: InputMaybe; fee?: InputMaybe; from?: InputMaybe; id?: InputMaybe; success?: InputMaybe; - timestamp?: InputMaybe; + timestamp?: InputMaybe; to?: InputMaybe; uuid?: InputMaybe; value?: InputMaybe; @@ -3464,14 +3879,14 @@ export type Consensus_Transfers_Bool_Exp = { /** aggregate max on columns */ export type Consensus_Transfers_Max_Fields = { __typename?: 'consensus_transfers_max_fields'; - created_at?: Maybe; - date?: Maybe; + block_hash?: Maybe; + block_height?: Maybe; event_id?: Maybe; extrinsic_id?: Maybe; fee?: Maybe; from?: Maybe; id?: Maybe; - timestamp?: Maybe; + timestamp?: Maybe; to?: Maybe; uuid?: Maybe; value?: Maybe; @@ -3480,14 +3895,14 @@ export type Consensus_Transfers_Max_Fields = { /** aggregate min on columns */ export type Consensus_Transfers_Min_Fields = { __typename?: 'consensus_transfers_min_fields'; - created_at?: Maybe; - date?: Maybe; + block_hash?: Maybe; + block_height?: Maybe; event_id?: Maybe; extrinsic_id?: Maybe; fee?: Maybe; from?: Maybe; id?: Maybe; - timestamp?: Maybe; + timestamp?: Maybe; to?: Maybe; uuid?: Maybe; value?: Maybe; @@ -3496,8 +3911,8 @@ export type Consensus_Transfers_Min_Fields = { /** Ordering options when selecting data from "consensus.transfers". */ export type Consensus_Transfers_Order_By = { _block_range?: InputMaybe; - created_at?: InputMaybe; - date?: InputMaybe; + block_hash?: InputMaybe; + block_height?: InputMaybe; event_id?: InputMaybe; extrinsic_id?: InputMaybe; fee?: InputMaybe; @@ -3515,9 +3930,9 @@ export enum Consensus_Transfers_Select_Column { /** column name */ BlockRange = '_block_range', /** column name */ - CreatedAt = 'created_at', + BlockHash = 'block_hash', /** column name */ - Date = 'date', + BlockHeight = 'block_height', /** column name */ EventId = 'event_id', /** column name */ @@ -3543,27 +3958,24 @@ export enum Consensus_Transfers_Select_Column { /** aggregate stddev on columns */ export type Consensus_Transfers_Stddev_Fields = { __typename?: 'consensus_transfers_stddev_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; /** aggregate stddev_pop on columns */ export type Consensus_Transfers_Stddev_Pop_Fields = { __typename?: 'consensus_transfers_stddev_pop_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; /** aggregate stddev_samp on columns */ export type Consensus_Transfers_Stddev_Samp_Fields = { __typename?: 'consensus_transfers_stddev_samp_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; @@ -3578,15 +3990,15 @@ export type Consensus_Transfers_Stream_Cursor_Input = { /** Initial value of the column from where the streaming should start */ export type Consensus_Transfers_Stream_Cursor_Value_Input = { _block_range?: InputMaybe; - created_at?: InputMaybe; - date?: InputMaybe; + block_hash?: InputMaybe; + block_height?: InputMaybe; event_id?: InputMaybe; extrinsic_id?: InputMaybe; fee?: InputMaybe; from?: InputMaybe; id?: InputMaybe; success?: InputMaybe; - timestamp?: InputMaybe; + timestamp?: InputMaybe; to?: InputMaybe; uuid?: InputMaybe; value?: InputMaybe; @@ -3595,36 +4007,32 @@ export type Consensus_Transfers_Stream_Cursor_Value_Input = { /** aggregate sum on columns */ export type Consensus_Transfers_Sum_Fields = { __typename?: 'consensus_transfers_sum_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; /** aggregate var_pop on columns */ export type Consensus_Transfers_Var_Pop_Fields = { __typename?: 'consensus_transfers_var_pop_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; /** aggregate var_samp on columns */ export type Consensus_Transfers_Var_Samp_Fields = { __typename?: 'consensus_transfers_var_samp_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; /** aggregate variance on columns */ export type Consensus_Transfers_Variance_Fields = { __typename?: 'consensus_transfers_variance_fields'; - created_at?: Maybe; + block_height?: Maybe; fee?: Maybe; - timestamp?: Maybe; value?: Maybe; }; @@ -3904,10 +4312,14 @@ export type Files_Chunks_Stream_Cursor_Value_Input = { export type Files_Cids = { __typename?: 'files_cids'; _block_range: Scalars['int8range']['output']; + /** An object relationship */ + block?: Maybe; block_hash: Scalars['String']['output']; block_height: Scalars['numeric']['output']; /** An object relationship */ chunk?: Maybe; + /** An object relationship */ + extrinsic?: Maybe; extrinsic_hash: Scalars['String']['output']; extrinsic_id: Scalars['String']['output']; id: Scalars['String']['output']; @@ -3930,6 +4342,17 @@ export type Files_Cids_Aggregate = { nodes: Array; }; +export type Files_Cids_Aggregate_Bool_Exp = { + count?: InputMaybe; +}; + +export type Files_Cids_Aggregate_Bool_Exp_Count = { + arguments?: InputMaybe>; + distinct?: InputMaybe; + filter?: InputMaybe; + predicate: Int_Comparison_Exp; +}; + /** aggregate fields of "files.cids" */ export type Files_Cids_Aggregate_Fields = { __typename?: 'files_cids_aggregate_fields'; @@ -3953,6 +4376,21 @@ export type Files_Cids_Aggregate_FieldsCountArgs = { distinct?: InputMaybe; }; +/** order by aggregate values of table "files.cids" */ +export type Files_Cids_Aggregate_Order_By = { + avg?: InputMaybe; + count?: InputMaybe; + max?: InputMaybe; + min?: InputMaybe; + stddev?: InputMaybe; + stddev_pop?: InputMaybe; + stddev_samp?: InputMaybe; + sum?: InputMaybe; + var_pop?: InputMaybe; + var_samp?: InputMaybe; + variance?: InputMaybe; +}; + /** aggregate avg on columns */ export type Files_Cids_Avg_Fields = { __typename?: 'files_cids_avg_fields'; @@ -3960,15 +4398,23 @@ export type Files_Cids_Avg_Fields = { index_in_block?: Maybe; }; +/** order by avg() on columns of table "files.cids" */ +export type Files_Cids_Avg_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** Boolean expression to filter rows from the table "files.cids". All fields are combined with a logical 'AND'. */ export type Files_Cids_Bool_Exp = { _and?: InputMaybe>; _block_range?: InputMaybe; _not?: InputMaybe; _or?: InputMaybe>; + block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; chunk?: InputMaybe; + extrinsic?: InputMaybe; extrinsic_hash?: InputMaybe; extrinsic_id?: InputMaybe; id?: InputMaybe; @@ -3991,6 +4437,18 @@ export type Files_Cids_Max_Fields = { uuid?: Maybe; }; +/** order by max() on columns of table "files.cids" */ +export type Files_Cids_Max_Order_By = { + block_hash?: InputMaybe; + block_height?: InputMaybe; + extrinsic_hash?: InputMaybe; + extrinsic_id?: InputMaybe; + id?: InputMaybe; + index_in_block?: InputMaybe; + timestamp?: InputMaybe; + uuid?: InputMaybe; +}; + /** aggregate min on columns */ export type Files_Cids_Min_Fields = { __typename?: 'files_cids_min_fields'; @@ -4004,12 +4462,26 @@ export type Files_Cids_Min_Fields = { uuid?: Maybe; }; +/** order by min() on columns of table "files.cids" */ +export type Files_Cids_Min_Order_By = { + block_hash?: InputMaybe; + block_height?: InputMaybe; + extrinsic_hash?: InputMaybe; + extrinsic_id?: InputMaybe; + id?: InputMaybe; + index_in_block?: InputMaybe; + timestamp?: InputMaybe; + uuid?: InputMaybe; +}; + /** Ordering options when selecting data from "files.cids". */ export type Files_Cids_Order_By = { _block_range?: InputMaybe; + block?: InputMaybe; block_hash?: InputMaybe; block_height?: InputMaybe; chunk?: InputMaybe; + extrinsic?: InputMaybe; extrinsic_hash?: InputMaybe; extrinsic_id?: InputMaybe; id?: InputMaybe; @@ -4050,6 +4522,12 @@ export type Files_Cids_Stddev_Fields = { index_in_block?: Maybe; }; +/** order by stddev() on columns of table "files.cids" */ +export type Files_Cids_Stddev_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** aggregate stddev_pop on columns */ export type Files_Cids_Stddev_Pop_Fields = { __typename?: 'files_cids_stddev_pop_fields'; @@ -4057,6 +4535,12 @@ export type Files_Cids_Stddev_Pop_Fields = { index_in_block?: Maybe; }; +/** order by stddev_pop() on columns of table "files.cids" */ +export type Files_Cids_Stddev_Pop_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** aggregate stddev_samp on columns */ export type Files_Cids_Stddev_Samp_Fields = { __typename?: 'files_cids_stddev_samp_fields'; @@ -4064,6 +4548,12 @@ export type Files_Cids_Stddev_Samp_Fields = { index_in_block?: Maybe; }; +/** order by stddev_samp() on columns of table "files.cids" */ +export type Files_Cids_Stddev_Samp_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** Streaming cursor of the table "files_cids" */ export type Files_Cids_Stream_Cursor_Input = { /** Stream column input with initial value */ @@ -4093,6 +4583,12 @@ export type Files_Cids_Sum_Fields = { index_in_block?: Maybe; }; +/** order by sum() on columns of table "files.cids" */ +export type Files_Cids_Sum_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** aggregate var_pop on columns */ export type Files_Cids_Var_Pop_Fields = { __typename?: 'files_cids_var_pop_fields'; @@ -4100,6 +4596,12 @@ export type Files_Cids_Var_Pop_Fields = { index_in_block?: Maybe; }; +/** order by var_pop() on columns of table "files.cids" */ +export type Files_Cids_Var_Pop_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** aggregate var_samp on columns */ export type Files_Cids_Var_Samp_Fields = { __typename?: 'files_cids_var_samp_fields'; @@ -4107,6 +4609,12 @@ export type Files_Cids_Var_Samp_Fields = { index_in_block?: Maybe; }; +/** order by var_samp() on columns of table "files.cids" */ +export type Files_Cids_Var_Samp_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** aggregate variance on columns */ export type Files_Cids_Variance_Fields = { __typename?: 'files_cids_variance_fields'; @@ -4114,6 +4622,12 @@ export type Files_Cids_Variance_Fields = { index_in_block?: Maybe; }; +/** order by variance() on columns of table "files.cids" */ +export type Files_Cids_Variance_Order_By = { + block_height?: InputMaybe; + index_in_block?: InputMaybe; +}; + /** columns and relationships of "files.file_cids" */ export type Files_File_Cids = { __typename?: 'files_file_cids'; @@ -17746,7 +18260,7 @@ export type LatestRewardsWeekQueryVariables = Exact<{ }>; -export type LatestRewardsWeekQuery = { __typename?: 'query_root', consensus_rewards: Array<{ __typename?: 'consensus_rewards', id: string, block_height: any, index_in_block: any, reward_type: string, amount: any, timestamp: any }> }; +export type LatestRewardsWeekQuery = { __typename?: 'query_root', consensus_rewards: Array<{ __typename?: 'consensus_rewards', id: string, block_height: any, extrinsic_id: string, event_id: string, reward_type: string, amount: any, timestamp: any }> }; export type RewardsListQueryVariables = Exact<{ accountId: Scalars['String']['input']; @@ -17756,7 +18270,7 @@ export type RewardsListQueryVariables = Exact<{ }>; -export type RewardsListQuery = { __typename?: 'query_root', consensus_rewards_aggregate: { __typename?: 'consensus_rewards_aggregate', aggregate?: { __typename?: 'consensus_rewards_aggregate_fields', count: number } | null }, consensus_rewards: Array<{ __typename?: 'consensus_rewards', id: string, block_height: any, index_in_block: any, reward_type: string, amount: any, timestamp: any, block?: { __typename?: 'consensus_blocks', hash: string, id: string, height: any } | null, account?: { __typename?: 'consensus_accounts', id: string, free: any, reserved: any, total?: any | null, updated_at: any } | null }> }; +export type RewardsListQuery = { __typename?: 'query_root', consensus_rewards_aggregate: { __typename?: 'consensus_rewards_aggregate', aggregate?: { __typename?: 'consensus_rewards_aggregate_fields', count: number } | null }, consensus_rewards: Array<{ __typename?: 'consensus_rewards', id: string, block_height: any, extrinsic_id: string, event_id: string, reward_type: string, amount: any, timestamp: any, block?: { __typename?: 'consensus_blocks', hash: string, id: string, height: any } | null, account?: { __typename?: 'consensus_accounts', id: string, free: any, reserved: any, total?: any | null, updated_at: any } | null }> }; export type ExtrinsicsByAccountIdQueryVariables = Exact<{ limit: Scalars['Int']['input']; @@ -17776,7 +18290,7 @@ export type TransfersByAccountIdQueryVariables = Exact<{ }>; -export type TransfersByAccountIdQuery = { __typename?: 'query_root', consensus_transfers_aggregate: { __typename?: 'consensus_transfers_aggregate', aggregate?: { __typename?: 'consensus_transfers_aggregate_fields', count: number } | null }, consensus_transfers: Array<{ __typename?: 'consensus_transfers', id: string, extrinsic_id: string, event_id: string, from: string, to: string, value: any, fee: any, success: boolean, timestamp: any, date: any, created_at: any }> }; +export type TransfersByAccountIdQuery = { __typename?: 'query_root', consensus_transfers_aggregate: { __typename?: 'consensus_transfers_aggregate', aggregate?: { __typename?: 'consensus_transfers_aggregate_fields', count: number } | null }, consensus_transfers: Array<{ __typename?: 'consensus_transfers', id: string, extrinsic_id: string, event_id: string, from: string, to: string, value: any, fee: any, success: boolean, timestamp: any }> }; export type BalanceHistoryByAccountIdQueryVariables = Exact<{ limit: Scalars['Int']['input']; @@ -17786,14 +18300,14 @@ export type BalanceHistoryByAccountIdQueryVariables = Exact<{ }>; -export type BalanceHistoryByAccountIdQuery = { __typename?: 'query_root', consensus_account_histories_aggregate: { __typename?: 'consensus_account_histories_aggregate', aggregate?: { __typename?: 'consensus_account_histories_aggregate_fields', count: number } | null }, consensus_account_histories: Array<{ __typename?: 'consensus_account_histories', reserved: any, total?: any | null, nonce: any, free: any, created_at: any, updated_at: any, _block_range: any, id: any }> }; +export type BalanceHistoryByAccountIdQuery = { __typename?: 'query_root', consensus_account_histories_aggregate: { __typename?: 'consensus_account_histories_aggregate', aggregate?: { __typename?: 'consensus_account_histories_aggregate_fields', count: number } | null }, consensus_account_histories: Array<{ __typename?: 'consensus_account_histories', reserved: any, total?: any | null, nonce: any, free: any, created_at: any, _block_range: any, id: any }> }; export type AllRewardForAccountByIdQueryVariables = Exact<{ accountId: Scalars['String']['input']; }>; -export type AllRewardForAccountByIdQuery = { __typename?: 'query_root', consensus_rewards: Array<{ __typename?: 'consensus_rewards', id: string, block_height: any, index_in_block: any, reward_type: string, amount: any, timestamp: any }> }; +export type AllRewardForAccountByIdQuery = { __typename?: 'query_root', consensus_rewards: Array<{ __typename?: 'consensus_rewards', id: string, block_height: any, extrinsic_id: string, event_id: string, reward_type: string, amount: any, timestamp: any }> }; export type BlocksQueryVariables = Exact<{ limit: Scalars['Int']['input']; @@ -18462,7 +18976,8 @@ export const LatestRewardsWeekDocument = gql` ) { id block_height - index_in_block + extrinsic_id + event_id reward_type amount timestamp @@ -18520,7 +19035,8 @@ export const RewardsListDocument = gql` ) { id block_height - index_in_block + extrinsic_id + event_id reward_type amount timestamp @@ -18657,8 +19173,6 @@ export const TransfersByAccountIdDocument = gql` fee success timestamp - date - created_at } } `; @@ -18717,7 +19231,6 @@ export const BalanceHistoryByAccountIdDocument = gql` nonce free created_at - updated_at _block_range } } @@ -18766,7 +19279,8 @@ export const AllRewardForAccountByIdDocument = gql` ) { id block_height - index_in_block + extrinsic_id + event_id reward_type amount timestamp diff --git a/explorer/src/components/Consensus/Account/query.ts b/explorer/src/components/Consensus/Account/query.ts index a78e2cc68..2f5327c40 100644 --- a/explorer/src/components/Consensus/Account/query.ts +++ b/explorer/src/components/Consensus/Account/query.ts @@ -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 @@ -97,7 +98,8 @@ export const QUERY_REWARDS_LIST = gql` ) { id block_height - index_in_block + extrinsic_id + event_id reward_type amount timestamp @@ -164,8 +166,6 @@ export const QUERY_ACCOUNT_TRANSFERS = gql` fee success timestamp - date - created_at } } ` @@ -189,7 +189,6 @@ export const QUERY_ACCOUNT_BALANCE_HISTORY = gql` nonce free created_at - updated_at _block_range } } @@ -200,7 +199,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 From 2f1a56595e9d919b8a5eda431b095596466658d2 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:39:09 -0500 Subject: [PATCH 7/8] fix build --- explorer/gql/graphql.tsx | 3 ++- .../Consensus/Account/AccountTransfersList.tsx | 11 ++++++----- .../components/Consensus/Account/BalanceHistory.tsx | 4 ++-- explorer/src/components/Consensus/Account/query.ts | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/explorer/gql/graphql.tsx b/explorer/gql/graphql.tsx index 9be12716f..5d29ce90d 100644 --- a/explorer/gql/graphql.tsx +++ b/explorer/gql/graphql.tsx @@ -18290,7 +18290,7 @@ export type TransfersByAccountIdQueryVariables = Exact<{ }>; -export type TransfersByAccountIdQuery = { __typename?: 'query_root', consensus_transfers_aggregate: { __typename?: 'consensus_transfers_aggregate', aggregate?: { __typename?: 'consensus_transfers_aggregate_fields', count: number } | null }, consensus_transfers: Array<{ __typename?: 'consensus_transfers', id: string, extrinsic_id: string, event_id: string, from: string, to: string, value: any, fee: any, success: boolean, timestamp: any }> }; +export type TransfersByAccountIdQuery = { __typename?: 'query_root', consensus_transfers_aggregate: { __typename?: 'consensus_transfers_aggregate', aggregate?: { __typename?: 'consensus_transfers_aggregate_fields', count: number } | null }, consensus_transfers: Array<{ __typename?: 'consensus_transfers', id: string, block_height: any, extrinsic_id: string, event_id: string, from: string, to: string, value: any, fee: any, success: boolean, timestamp: any }> }; export type BalanceHistoryByAccountIdQueryVariables = Exact<{ limit: Scalars['Int']['input']; @@ -19165,6 +19165,7 @@ export const TransfersByAccountIdDocument = gql` where: $where ) { id + block_height extrinsic_id event_id from diff --git a/explorer/src/components/Consensus/Account/AccountTransfersList.tsx b/explorer/src/components/Consensus/Account/AccountTransfersList.tsx index b7ca60255..cdb435796 100644 --- a/explorer/src/components/Consensus/Account/AccountTransfersList.tsx +++ b/explorer/src/components/Consensus/Account/AccountTransfersList.tsx @@ -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 = { @@ -40,7 +41,7 @@ type Row = TransfersByAccountIdQuery['consensus_transfers'][0] export const AccountTransfersList: FC = ({ accountId }) => { const { ref, inView } = useInView() const [sorting, setSorting] = useState([ - { id: TransferColumn.CreatedAt, desc: true }, + { id: TransferColumn.BlockHeight, desc: true }, ]) const [pagination, setPagination] = useState({ pageSize: PAGE_SIZE, @@ -117,7 +118,7 @@ export const AccountTransfersList: FC = ({ accountId }) => { const columns = useMemo( () => [ { - accessorKey: 'created_at', + accessorKey: 'block_height', header: 'Block', enableSorting: true, cell: ({ row }: Cell) => ( @@ -127,11 +128,11 @@ export const AccountTransfersList: FC = ({ accountId }) => { href={INTERNAL_ROUTES.blocks.id.page( network, Routes.consensus, - row.original.created_at, + row.original.block_height, )} className='hover:text-primaryAccent' > -
{row.original.created_at}
+
{row.original.block_height}
), @@ -236,7 +237,7 @@ export const AccountTransfersList: FC = ({ accountId }) => { enableSorting: true, cell: ({ row }: Cell) => (
- {row.original.timestamp(row.original.date)} + {utcToLocalRelativeTime(row.original.timestamp)}
), }, diff --git a/explorer/src/components/Consensus/Account/BalanceHistory.tsx b/explorer/src/components/Consensus/Account/BalanceHistory.tsx index 626cb9cdf..77f72f110 100644 --- a/explorer/src/components/Consensus/Account/BalanceHistory.tsx +++ b/explorer/src/components/Consensus/Account/BalanceHistory.tsx @@ -37,7 +37,7 @@ type Row = BalanceHistoryByAccountIdQuery['consensus_account_histories'][0] export const BalanceHistory: FC = ({ accountId }) => { const { ref, inView } = useInView() const [sorting, setSorting] = useState([ - { id: TransferColumn.CreatedAt, desc: true }, + { id: TransferColumn.BlockHeight, desc: true }, ]) const [pagination, setPagination] = useState({ pageSize: PAGE_SIZE, @@ -53,7 +53,7 @@ export const BalanceHistory: FC = ({ accountId }) => { ? sorting[0].id.endsWith('aggregate') ? { [sorting[0].id]: sorting[0].desc ? { count: OrderBy.Desc } : { count: OrderBy.Asc } } : { [sorting[0].id]: sorting[0].desc ? OrderBy.Desc : OrderBy.Asc } - : { id: OrderBy.Asc }, + : { [TransferColumn.BlockHeight]: OrderBy.Asc }, [sorting], ) diff --git a/explorer/src/components/Consensus/Account/query.ts b/explorer/src/components/Consensus/Account/query.ts index 2f5327c40..e590071e9 100644 --- a/explorer/src/components/Consensus/Account/query.ts +++ b/explorer/src/components/Consensus/Account/query.ts @@ -158,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 From 172a9dff01ced8d32b52f90d0c82f1f55fd4d187 Mon Sep 17 00:00:00 2001 From: Marc-Aurele Besner <82244926+marc-aurele-besner@users.noreply.github.com> Date: Fri, 13 Dec 2024 08:11:41 -0500 Subject: [PATCH 8/8] fix build issues --- explorer/src/components/Consensus/Account/BalanceHistory.tsx | 2 +- explorer/src/constants/indexers.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/explorer/src/components/Consensus/Account/BalanceHistory.tsx b/explorer/src/components/Consensus/Account/BalanceHistory.tsx index 77f72f110..a4fb00693 100644 --- a/explorer/src/components/Consensus/Account/BalanceHistory.tsx +++ b/explorer/src/components/Consensus/Account/BalanceHistory.tsx @@ -53,7 +53,7 @@ export const BalanceHistory: FC = ({ accountId }) => { ? sorting[0].id.endsWith('aggregate') ? { [sorting[0].id]: sorting[0].desc ? { count: OrderBy.Desc } : { count: OrderBy.Asc } } : { [sorting[0].id]: sorting[0].desc ? OrderBy.Desc : OrderBy.Asc } - : { [TransferColumn.BlockHeight]: OrderBy.Asc }, + : { id: OrderBy.Asc }, [sorting], ) diff --git a/explorer/src/constants/indexers.ts b/explorer/src/constants/indexers.ts index f3f3fe2a7..ddee0247d 100644 --- a/explorer/src/constants/indexers.ts +++ b/explorer/src/constants/indexers.ts @@ -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[] = [ {