Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: added TPS data for homepage for block and transaction graphs #555

Merged
merged 5 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { sdk } from '~/systems/Core/utils/sdk';

export const getBlocksDashboard = async () => {
const { data } = await sdk.getBlocksDashboard();
return data;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { sdk } from '~/systems/Core/utils/sdk';

export const getTPS = async () => {
const { data } = await sdk.tps();
return data;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
query getBlocksDashboard{
getBlocksDashboard{
nodes{
timestamp
gasUsed
blockNo
producer
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ module.exports.transaction = fs.readFileSync(path.join(__dirname, 'transaction.g
module.exports.transactions = fs.readFileSync(path.join(__dirname, 'transactions.graphql'), 'utf8');
module.exports.transactionsByOwner = fs.readFileSync(path.join(__dirname, 'transactionsByOwner.graphql'), 'utf8');
module.exports.transactionsByBlockId = fs.readFileSync(path.join(__dirname, 'transactionsByBlockId.graphql'), 'utf8');
module.exports.tps = fs.readFileSync(path.join(__dirname, 'tps.graphql'), 'utf8');
module.exports.getBlocksDashboard = fs.readFileSync(path.join(__dirname, 'getBlocksDashboard.graphql'), 'utf8');
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
query tps{
tps{
nodes{
start
end
txCount
totalGas
}
}
}
38 changes: 37 additions & 1 deletion packages/graphql/src/graphql/generated/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GQLBalance, GQLBalanceConnection, GQLBalanceEdge, GQLBalanceFilterInput, GQLBlock, GQLBlockConnection, GQLBlockEdge, GQLBreakpoint, GQLChainInfo, GQLChangeOutput, GQLCoin, GQLCoinConnection, GQLCoinEdge, GQLCoinFilterInput, GQLCoinOutput, GQLConsensusParameters, GQLConsensusParametersPurpose, GQLContract, GQLContractBalance, GQLContractBalanceConnection, GQLContractBalanceEdge, GQLContractBalanceFilterInput, GQLContractConnection, GQLContractCreated, GQLContractOutput, GQLContractParameters, GQLDryRunFailureStatus, GQLDryRunSuccessStatus, GQLDryRunTransactionExecutionStatus, GQLEstimateGasPrice, GQLExcludeInput, GQLFailureStatus, GQLFeeParameters, GQLGasCosts, GQLGenesis, GQLGroupedInputCoin, GQLGroupedInputContract, GQLGroupedInputMessage, GQLGroupedOutputChanged, GQLGroupedOutputCoin, GQLGroupedOutputContractCreated, GQLHeader, GQLHeavyOperation, GQLInputCoin, GQLInputContract, GQLInputMessage, GQLLatestGasPrice, GQLLightOperation, GQLMerkleProof, GQLMessage, GQLMessageCoin, GQLMessageConnection, GQLMessageEdge, GQLMessageProof, GQLMessageStatus, GQLMutation, GQLNodeInfo, GQLOperation, GQLOperationReceipt, GQLOperationsFilterInput, GQLOutputBreakpoint, GQLPageInfo, GQLParsedTime, GQLPeerInfo, GQLPoAConsensus, GQLPolicies, GQLPredicateItem, GQLPredicateParameters, GQLProgramState, GQLQuery, GQLReceipt, GQLRelayedTransactionFailed, GQLRunResult, GQLScriptParameters, GQLSearchAccount, GQLSearchBlock, GQLSearchContract, GQLSearchResult, GQLSearchTransaction, GQLSpendQueryElementInput, GQLSqueezedOutStatus, GQLStateTransitionPurpose, GQLSubmittedStatus, GQLSubscription, GQLSuccessStatus, GQLTransaction, GQLTransactionConnection, GQLTransactionEdge, GQLTransactionGasCosts, GQLTxParameters, GQLUtxoItem, GQLVariableOutput, GQLBlockVersion, GQLConsensusParametersVersion, GQLContractParametersVersion, GQLFeeParametersVersion, GQLGasCostsVersion, GQLGroupedInputType, GQLGroupedOutputType, GQLHeaderVersion, GQLMessageState, GQLOperationType, GQLPredicateParametersVersion, GQLReceiptType, GQLReturnType, GQLRunState, GQLScriptParametersVersion, GQLTxParametersVersion } from './sdk';
import type { GQLBalance, GQLBalanceConnection, GQLBalanceEdge, GQLBalanceFilterInput, GQLBlock, GQLBlockConnection, GQLBlockEdge, GQLBlocksDashboard, GQLBlocksDashboardConnection, GQLBreakpoint, GQLChainInfo, GQLChangeOutput, GQLCoin, GQLCoinConnection, GQLCoinEdge, GQLCoinFilterInput, GQLCoinOutput, GQLConsensusParameters, GQLConsensusParametersPurpose, GQLContract, GQLContractBalance, GQLContractBalanceConnection, GQLContractBalanceEdge, GQLContractBalanceFilterInput, GQLContractConnection, GQLContractCreated, GQLContractOutput, GQLContractParameters, GQLDryRunFailureStatus, GQLDryRunSuccessStatus, GQLDryRunTransactionExecutionStatus, GQLEstimateGasPrice, GQLExcludeInput, GQLFailureStatus, GQLFeeParameters, GQLGasCosts, GQLGenesis, GQLGroupedInputCoin, GQLGroupedInputContract, GQLGroupedInputMessage, GQLGroupedOutputChanged, GQLGroupedOutputCoin, GQLGroupedOutputContractCreated, GQLHeader, GQLHeavyOperation, GQLInputCoin, GQLInputContract, GQLInputMessage, GQLLatestGasPrice, GQLLightOperation, GQLMerkleProof, GQLMessage, GQLMessageCoin, GQLMessageConnection, GQLMessageEdge, GQLMessageProof, GQLMessageStatus, GQLMutation, GQLNodeInfo, GQLOperation, GQLOperationReceipt, GQLOperationsFilterInput, GQLOutputBreakpoint, GQLPageInfo, GQLParsedTime, GQLPeerInfo, GQLPoAConsensus, GQLPolicies, GQLPredicateItem, GQLPredicateParameters, GQLProgramState, GQLQuery, GQLReceipt, GQLRelayedTransactionFailed, GQLRunResult, GQLScriptParameters, GQLSearchAccount, GQLSearchBlock, GQLSearchContract, GQLSearchResult, GQLSearchTransaction, GQLSpendQueryElementInput, GQLSqueezedOutStatus, GQLStateTransitionPurpose, GQLSubmittedStatus, GQLSubscription, GQLSuccessStatus, GQLTps, GQLTpsConnection, GQLTransaction, GQLTransactionConnection, GQLTransactionEdge, GQLTransactionGasCosts, GQLTxParameters, GQLUtxoItem, GQLVariableOutput, GQLBlockVersion, GQLConsensusParametersVersion, GQLContractParametersVersion, GQLFeeParametersVersion, GQLGasCostsVersion, GQLGroupedInputType, GQLGroupedOutputType, GQLHeaderVersion, GQLMessageState, GQLOperationType, GQLPredicateParametersVersion, GQLReceiptType, GQLReturnType, GQLRunState, GQLScriptParametersVersion, GQLTxParametersVersion } from './sdk';

export const aBalance = (overrides?: Partial<GQLBalance>): { __typename: 'Balance' } & GQLBalance => {
return {
Expand Down Expand Up @@ -66,6 +66,23 @@ export const aBlockEdge = (overrides?: Partial<GQLBlockEdge>): { __typename: 'Bl
};
};

export const aBlocksDashboard = (overrides?: Partial<GQLBlocksDashboard>): { __typename: 'BlocksDashboard' } & GQLBlocksDashboard => {
return {
__typename: 'BlocksDashboard',
blockNo: overrides && overrides.hasOwnProperty('blockNo') ? overrides.blockNo! : '0xc',
gasUsed: overrides && overrides.hasOwnProperty('gasUsed') ? overrides.gasUsed! : '0x5',
producer: overrides && overrides.hasOwnProperty('producer') ? overrides.producer! : 'error',
timestamp: overrides && overrides.hasOwnProperty('timestamp') ? overrides.timestamp! : '0x8',
};
};

export const aBlocksDashboardConnection = (overrides?: Partial<GQLBlocksDashboardConnection>): { __typename: 'BlocksDashboardConnection' } & GQLBlocksDashboardConnection => {
return {
__typename: 'BlocksDashboardConnection',
nodes: overrides && overrides.hasOwnProperty('nodes') ? overrides.nodes! : [aBlocksDashboard()],
};
};

export const aBreakpoint = (overrides?: Partial<GQLBreakpoint>): GQLBreakpoint => {
return {
contract: overrides && overrides.hasOwnProperty('contract') ? overrides.contract! : 'spxsyh8uujdpzc8kg4t7lkz0r7qmcdsb',
Expand Down Expand Up @@ -806,6 +823,7 @@ export const aQuery = (overrides?: Partial<GQLQuery>): { __typename: 'Query' } &
contracts: overrides && overrides.hasOwnProperty('contracts') ? overrides.contracts! : aContractConnection(),
estimateGasPrice: overrides && overrides.hasOwnProperty('estimateGasPrice') ? overrides.estimateGasPrice! : anEstimateGasPrice(),
estimatePredicates: overrides && overrides.hasOwnProperty('estimatePredicates') ? overrides.estimatePredicates! : aTransaction(),
getBlocksDashboard: overrides && overrides.hasOwnProperty('getBlocksDashboard') ? overrides.getBlocksDashboard! : aBlocksDashboardConnection(),
health: overrides && overrides.hasOwnProperty('health') ? overrides.health! : true,
latestGasPrice: overrides && overrides.hasOwnProperty('latestGasPrice') ? overrides.latestGasPrice! : aLatestGasPrice(),
memory: overrides && overrides.hasOwnProperty('memory') ? overrides.memory! : 'id',
Expand All @@ -818,6 +836,7 @@ export const aQuery = (overrides?: Partial<GQLQuery>): { __typename: 'Query' } &
register: overrides && overrides.hasOwnProperty('register') ? overrides.register! : '0x3',
relayedTransactionStatus: overrides && overrides.hasOwnProperty('relayedTransactionStatus') ? overrides.relayedTransactionStatus! : aRelayedTransactionFailed(),
search: overrides && overrides.hasOwnProperty('search') ? overrides.search! : aSearchResult(),
tps: overrides && overrides.hasOwnProperty('tps') ? overrides.tps! : aTpsConnection(),
transaction: overrides && overrides.hasOwnProperty('transaction') ? overrides.transaction! : aTransaction(),
transactions: overrides && overrides.hasOwnProperty('transactions') ? overrides.transactions! : aTransactionConnection(),
transactionsByBlockId: overrides && overrides.hasOwnProperty('transactionsByBlockId') ? overrides.transactionsByBlockId! : aTransactionConnection(),
Expand Down Expand Up @@ -975,6 +994,23 @@ export const aSuccessStatus = (overrides?: Partial<GQLSuccessStatus>): { __typen
};
};

export const aTps = (overrides?: Partial<GQLTps>): { __typename: 'TPS' } & GQLTps => {
return {
__typename: 'TPS',
end: overrides && overrides.hasOwnProperty('end') ? overrides.end! : 'unde',
start: overrides && overrides.hasOwnProperty('start') ? overrides.start! : 'rerum',
totalGas: overrides && overrides.hasOwnProperty('totalGas') ? overrides.totalGas! : '0x9',
txCount: overrides && overrides.hasOwnProperty('txCount') ? overrides.txCount! : '0xA',
};
};

export const aTpsConnection = (overrides?: Partial<GQLTpsConnection>): { __typename: 'TPSConnection' } & GQLTpsConnection => {
return {
__typename: 'TPSConnection',
nodes: overrides && overrides.hasOwnProperty('nodes') ? overrides.nodes! : [aTps()],
};
};

export const aTransaction = (overrides?: Partial<GQLTransaction>): { __typename: 'Transaction' } & GQLTransaction => {
return {
__typename: 'Transaction',
Expand Down
Loading
Loading