diff --git a/CHANGELOG.md b/CHANGELOG.md index d056befaa..2327e5678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features +- [#286](https://github.com/alleslabs/celatone-frontend/pull/286) Add block proposer - [#275](https://github.com/alleslabs/celatone-frontend/pull/275) Searching can now be determined by chain - [#273](https://github.com/alleslabs/celatone-frontend/pull/273) Add subheader and network overview - [#278](https://github.com/alleslabs/celatone-frontend/pull/278) Fully wired block details page diff --git a/src/lib/app-provider/query-client/index.ts b/src/lib/app-provider/query-client/index.ts index 7467c5254..2b4359f9e 100644 --- a/src/lib/app-provider/query-client/index.ts +++ b/src/lib/app-provider/query-client/index.ts @@ -4,7 +4,7 @@ export const GRAPH_URL: Record = { /** * Revisit graphql for terra2 mainnet and osmosis mainnet */ - osmosis: "https://osmosis-mainnet-graphql.alleslabs.dev/v1/graphql", + osmosis: "https://osmosis-mainnet-graphql2.alleslabs.dev/v1/graphql", osmosistestnet: "https://osmosis-testnet-graphql2.alleslabs.dev/v1/graphql", terra2testnet: "https://terra-testnet-graphql.alleslabs.dev/v1/graphql", }; diff --git a/src/lib/components/ValidatorBadge.tsx b/src/lib/components/ValidatorBadge.tsx index c41b96ac2..57ced18ea 100644 --- a/src/lib/components/ValidatorBadge.tsx +++ b/src/lib/components/ValidatorBadge.tsx @@ -1,4 +1,5 @@ -import { Flex, Image } from "@chakra-ui/react"; +import type { ImageProps } from "@chakra-ui/react"; +import { Flex, Image, Text } from "@chakra-ui/react"; import { useWallet } from "@cosmos-kit/react"; import { getChainApiPath } from "env"; @@ -6,16 +7,27 @@ import { ExplorerLink } from "lib/components/ExplorerLink"; import type { ValidatorInfo } from "lib/types"; interface ValidatorBadgeProps { - validator: ValidatorInfo; + validator: ValidatorInfo | null; + badgeSize?: ImageProps["boxSize"]; } -export const ValidatorBadge = ({ validator }: ValidatorBadgeProps) => { +export const ValidatorBadge = ({ + validator, + badgeSize = 10, +}: ValidatorBadgeProps) => { const { currentChainName } = useWallet(); + if (!validator) + return ( + + N/A + + ); + return ( ; + /** An array relationship */ + validators: Array; + /** An aggregate relationship */ + validators_aggregate: Validators_Aggregate; }; /** columns and relationships of "accounts" */ @@ -654,6 +658,24 @@ export type AccountsTransactions_AggregateArgs = { where?: InputMaybe; }; +/** columns and relationships of "accounts" */ +export type AccountsValidatorsArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +/** columns and relationships of "accounts" */ +export type AccountsValidators_AggregateArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + /** aggregated selection of "accounts" */ export type Accounts_Aggregate = { __typename?: "accounts_aggregate"; @@ -714,6 +736,8 @@ export type Accounts_Bool_Exp = { transactions?: InputMaybe; transactions_aggregate?: InputMaybe; type?: InputMaybe; + validators?: InputMaybe; + validators_aggregate?: InputMaybe; }; /** unique or primary key constraints on table "accounts" */ @@ -743,6 +767,7 @@ export type Accounts_Insert_Input = { proposals?: InputMaybe; transactions?: InputMaybe; type?: InputMaybe; + validators?: InputMaybe; }; /** aggregate max on columns */ @@ -800,6 +825,7 @@ export type Accounts_Order_By = { proposals_aggregate?: InputMaybe; transactions_aggregate?: InputMaybe; type?: InputMaybe; + validators_aggregate?: InputMaybe; }; /** primary key columns input for table: accounts */ @@ -1227,6 +1253,7 @@ export type Blocks = { proposals: Array; /** An aggregate relationship */ proposals_aggregate: Proposals_Aggregate; + proposer?: Maybe; timestamp: Scalars["timestamp"]; /** An array relationship */ trade_by_routes: Array; @@ -1240,6 +1267,8 @@ export type Blocks = { transactions: Array; /** An aggregate relationship */ transactions_aggregate: Transactions_Aggregate; + /** An object relationship */ + validator?: Maybe; }; /** columns and relationships of "blocks" */ @@ -1501,6 +1530,17 @@ export type Blocks_Aggregate = { nodes: Array; }; +export type Blocks_Aggregate_Bool_Exp = { + count?: InputMaybe; +}; + +export type Blocks_Aggregate_Bool_Exp_Count = { + arguments?: InputMaybe>; + distinct?: InputMaybe; + filter?: InputMaybe; + predicate: Int_Comparison_Exp; +}; + /** aggregate fields of "blocks" */ export type Blocks_Aggregate_Fields = { __typename?: "blocks_aggregate_fields"; @@ -1523,12 +1563,39 @@ export type Blocks_Aggregate_FieldsCountArgs = { distinct?: InputMaybe; }; +/** order by aggregate values of table "blocks" */ +export type Blocks_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; +}; + +/** input type for inserting array relation for remote table "blocks" */ +export type Blocks_Arr_Rel_Insert_Input = { + data: Array; + /** upsert condition */ + on_conflict?: InputMaybe; +}; + /** aggregate avg on columns */ export type Blocks_Avg_Fields = { __typename?: "blocks_avg_fields"; height?: Maybe; }; +/** order by avg() on columns of table "blocks" */ +export type Blocks_Avg_Order_By = { + height?: InputMaybe; +}; + /** Boolean expression to filter rows from the table "blocks". All fields are combined with a logical 'AND'. */ export type Blocks_Bool_Exp = { _and?: InputMaybe>; @@ -1558,6 +1625,7 @@ export type Blocks_Bool_Exp = { profit_by_routes_aggregate?: InputMaybe; proposals?: InputMaybe; proposals_aggregate?: InputMaybe; + proposer?: InputMaybe; timestamp?: InputMaybe; trade_by_routes?: InputMaybe; trade_by_routes_aggregate?: InputMaybe; @@ -1565,6 +1633,7 @@ export type Blocks_Bool_Exp = { trades_aggregate?: InputMaybe; transactions?: InputMaybe; transactions_aggregate?: InputMaybe; + validator?: InputMaybe; }; /** unique or primary key constraints on table "blocks" */ @@ -1593,26 +1662,44 @@ export type Blocks_Insert_Input = { profit_by_denoms?: InputMaybe; profit_by_routes?: InputMaybe; proposals?: InputMaybe; + proposer?: InputMaybe; timestamp?: InputMaybe; trade_by_routes?: InputMaybe; trades?: InputMaybe; transactions?: InputMaybe; + validator?: InputMaybe; }; /** aggregate max on columns */ export type Blocks_Max_Fields = { __typename?: "blocks_max_fields"; height?: Maybe; + proposer?: Maybe; timestamp?: Maybe; }; +/** order by max() on columns of table "blocks" */ +export type Blocks_Max_Order_By = { + height?: InputMaybe; + proposer?: InputMaybe; + timestamp?: InputMaybe; +}; + /** aggregate min on columns */ export type Blocks_Min_Fields = { __typename?: "blocks_min_fields"; height?: Maybe; + proposer?: Maybe; timestamp?: Maybe; }; +/** order by min() on columns of table "blocks" */ +export type Blocks_Min_Order_By = { + height?: InputMaybe; + proposer?: InputMaybe; + timestamp?: InputMaybe; +}; + /** response of any mutation on the table "blocks" */ export type Blocks_Mutation_Response = { __typename?: "blocks_mutation_response"; @@ -1651,10 +1738,12 @@ export type Blocks_Order_By = { profit_by_denoms_aggregate?: InputMaybe; profit_by_routes_aggregate?: InputMaybe; proposals_aggregate?: InputMaybe; + proposer?: InputMaybe; timestamp?: InputMaybe; trade_by_routes_aggregate?: InputMaybe; trades_aggregate?: InputMaybe; transactions_aggregate?: InputMaybe; + validator?: InputMaybe; }; /** primary key columns input for table: blocks */ @@ -1669,6 +1758,8 @@ export enum Blocks_Select_Column { /** column name */ Height = "height", /** column name */ + Proposer = "proposer", + /** column name */ Timestamp = "timestamp", } @@ -1676,6 +1767,7 @@ export enum Blocks_Select_Column { export type Blocks_Set_Input = { hash?: InputMaybe; height?: InputMaybe; + proposer?: InputMaybe; timestamp?: InputMaybe; }; @@ -1685,18 +1777,33 @@ export type Blocks_Stddev_Fields = { height?: Maybe; }; +/** order by stddev() on columns of table "blocks" */ +export type Blocks_Stddev_Order_By = { + height?: InputMaybe; +}; + /** aggregate stddev_pop on columns */ export type Blocks_Stddev_Pop_Fields = { __typename?: "blocks_stddev_pop_fields"; height?: Maybe; }; +/** order by stddev_pop() on columns of table "blocks" */ +export type Blocks_Stddev_Pop_Order_By = { + height?: InputMaybe; +}; + /** aggregate stddev_samp on columns */ export type Blocks_Stddev_Samp_Fields = { __typename?: "blocks_stddev_samp_fields"; height?: Maybe; }; +/** order by stddev_samp() on columns of table "blocks" */ +export type Blocks_Stddev_Samp_Order_By = { + height?: InputMaybe; +}; + /** Streaming cursor of the table "blocks" */ export type Blocks_Stream_Cursor_Input = { /** Stream column input with initial value */ @@ -1709,6 +1816,7 @@ export type Blocks_Stream_Cursor_Input = { export type Blocks_Stream_Cursor_Value_Input = { hash?: InputMaybe; height?: InputMaybe; + proposer?: InputMaybe; timestamp?: InputMaybe; }; @@ -1718,6 +1826,11 @@ export type Blocks_Sum_Fields = { height?: Maybe; }; +/** order by sum() on columns of table "blocks" */ +export type Blocks_Sum_Order_By = { + height?: InputMaybe; +}; + /** update columns of table "blocks" */ export enum Blocks_Update_Column { /** column name */ @@ -1725,6 +1838,8 @@ export enum Blocks_Update_Column { /** column name */ Height = "height", /** column name */ + Proposer = "proposer", + /** column name */ Timestamp = "timestamp", } @@ -1743,18 +1858,33 @@ export type Blocks_Var_Pop_Fields = { height?: Maybe; }; +/** order by var_pop() on columns of table "blocks" */ +export type Blocks_Var_Pop_Order_By = { + height?: InputMaybe; +}; + /** aggregate var_samp on columns */ export type Blocks_Var_Samp_Fields = { __typename?: "blocks_var_samp_fields"; height?: Maybe; }; +/** order by var_samp() on columns of table "blocks" */ +export type Blocks_Var_Samp_Order_By = { + height?: InputMaybe; +}; + /** aggregate variance on columns */ export type Blocks_Variance_Fields = { __typename?: "blocks_variance_fields"; height?: Maybe; }; +/** order by variance() on columns of table "blocks" */ +export type Blocks_Variance_Order_By = { + height?: InputMaybe; +}; + /** Boolean expression to compare columns of type "bytea". All fields are combined with logical 'AND'. */ export type Bytea_Comparison_Exp = { _eq?: InputMaybe; @@ -5049,6 +5179,10 @@ export type Mutation_Root = { delete_transactions?: Maybe; /** delete single row from the table: "transactions" */ delete_transactions_by_pk?: Maybe; + /** delete data from the table: "validators" */ + delete_validators?: Maybe; + /** delete single row from the table: "validators" */ + delete_validators_by_pk?: Maybe; /** insert data into the table: "account_transactions" */ insert_account_transactions?: Maybe; /** insert a single row into the table: "account_transactions" */ @@ -5141,6 +5275,10 @@ export type Mutation_Root = { insert_transactions?: Maybe; /** insert a single row into the table: "transactions" */ insert_transactions_one?: Maybe; + /** insert data into the table: "validators" */ + insert_validators?: Maybe; + /** insert a single row into the table: "validators" */ + insert_validators_one?: Maybe; /** update data of the table: "account_transactions" */ update_account_transactions?: Maybe; /** update single row of the table: "account_transactions" */ @@ -5281,6 +5419,12 @@ export type Mutation_Root = { update_transactions_many?: Maybe< Array> >; + /** update data of the table: "validators" */ + update_validators?: Maybe; + /** update single row of the table: "validators" */ + update_validators_by_pk?: Maybe; + /** update multiples rows of table: "validators" */ + update_validators_many?: Maybe>>; }; /** mutation root */ @@ -5445,6 +5589,16 @@ export type Mutation_RootDelete_Transactions_By_PkArgs = { hash: Scalars["bytea"]; }; +/** mutation root */ +export type Mutation_RootDelete_ValidatorsArgs = { + where: Validators_Bool_Exp; +}; + +/** mutation root */ +export type Mutation_RootDelete_Validators_By_PkArgs = { + operator_address: Scalars["String"]; +}; + /** mutation root */ export type Mutation_RootInsert_Account_TransactionsArgs = { objects: Array; @@ -5693,6 +5847,18 @@ export type Mutation_RootInsert_Transactions_OneArgs = { on_conflict?: InputMaybe; }; +/** mutation root */ +export type Mutation_RootInsert_ValidatorsArgs = { + objects: Array; + on_conflict?: InputMaybe; +}; + +/** mutation root */ +export type Mutation_RootInsert_Validators_OneArgs = { + object: Validators_Insert_Input; + on_conflict?: InputMaybe; +}; + /** mutation root */ export type Mutation_RootUpdate_Account_TransactionsArgs = { _inc?: InputMaybe; @@ -6032,6 +6198,25 @@ export type Mutation_RootUpdate_Transactions_ManyArgs = { updates: Array; }; +/** mutation root */ +export type Mutation_RootUpdate_ValidatorsArgs = { + _inc?: InputMaybe; + _set?: InputMaybe; + where: Validators_Bool_Exp; +}; + +/** mutation root */ +export type Mutation_RootUpdate_Validators_By_PkArgs = { + _inc?: InputMaybe; + _set?: InputMaybe; + pk_columns: Validators_Pk_Columns_Input; +}; + +/** mutation root */ +export type Mutation_RootUpdate_Validators_ManyArgs = { + updates: Array; +}; + /** column ordering options */ export enum Order_By { /** in ascending order, nulls last */ @@ -8191,9 +8376,9 @@ export type Query_Root = { begin_block_events: Array; /** An aggregate relationship */ begin_block_events_aggregate: Begin_Block_Events_Aggregate; - /** fetch data from the table: "blocks" */ + /** An array relationship */ blocks: Array; - /** fetch aggregated fields from the table: "blocks" */ + /** An aggregate relationship */ blocks_aggregate: Blocks_Aggregate; /** fetch data from the table: "blocks" using primary key columns */ blocks_by_pk?: Maybe; @@ -8297,6 +8482,12 @@ export type Query_Root = { transactions_aggregate: Transactions_Aggregate; /** fetch data from the table: "transactions" using primary key columns */ transactions_by_pk?: Maybe; + /** An array relationship */ + validators: Array; + /** An aggregate relationship */ + validators_aggregate: Validators_Aggregate; + /** fetch data from the table: "validators" using primary key columns */ + validators_by_pk?: Maybe; }; export type Query_RootAccount_TransactionsArgs = { @@ -8759,6 +8950,26 @@ export type Query_RootTransactions_By_PkArgs = { hash: Scalars["bytea"]; }; +export type Query_RootValidatorsArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +export type Query_RootValidators_AggregateArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +export type Query_RootValidators_By_PkArgs = { + operator_address: Scalars["String"]; +}; + export type Search_Pools_With_Denom_Args = { denom?: InputMaybe; }; @@ -8791,9 +9002,9 @@ export type Subscription_Root = { begin_block_events_aggregate: Begin_Block_Events_Aggregate; /** fetch data from the table in a streaming manner: "begin_block_events" */ begin_block_events_stream: Array; - /** fetch data from the table: "blocks" */ + /** An array relationship */ blocks: Array; - /** fetch aggregated fields from the table: "blocks" */ + /** An aggregate relationship */ blocks_aggregate: Blocks_Aggregate; /** fetch data from the table: "blocks" using primary key columns */ blocks_by_pk?: Maybe; @@ -8937,6 +9148,14 @@ export type Subscription_Root = { transactions_by_pk?: Maybe; /** fetch data from the table in a streaming manner: "transactions" */ transactions_stream: Array; + /** An array relationship */ + validators: Array; + /** An aggregate relationship */ + validators_aggregate: Validators_Aggregate; + /** fetch data from the table: "validators" using primary key columns */ + validators_by_pk?: Maybe; + /** fetch data from the table in a streaming manner: "validators" */ + validators_stream: Array; }; export type Subscription_RootAccount_TransactionsArgs = { @@ -9537,6 +9756,32 @@ export type Subscription_RootTransactions_StreamArgs = { where?: InputMaybe; }; +export type Subscription_RootValidatorsArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +export type Subscription_RootValidators_AggregateArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +export type Subscription_RootValidators_By_PkArgs = { + operator_address: Scalars["String"]; +}; + +export type Subscription_RootValidators_StreamArgs = { + batch_size: Scalars["Int"]; + cursor: Array>; + where?: InputMaybe; +}; + /** Boolean expression to compare columns of type "timestamp". All fields are combined with logical 'AND'. */ export type Timestamp_Comparison_Exp = { _eq?: InputMaybe; @@ -11333,6 +11578,526 @@ export type Transactions_Variance_Order_By = { sender?: InputMaybe; }; +/** columns and relationships of "validators" */ +export type Validators = { + __typename?: "validators"; + /** An object relationship */ + account: Accounts; + account_id: Scalars["Int"]; + /** An array relationship */ + blocks: Array; + /** An aggregate relationship */ + blocks_aggregate: Blocks_Aggregate; + commission_max_change: Scalars["String"]; + commission_max_rate: Scalars["String"]; + commission_rate: Scalars["String"]; + consensus_address: Scalars["String"]; + details: Scalars["String"]; + id: Scalars["Int"]; + identity: Scalars["String"]; + jailed: Scalars["Boolean"]; + min_self_delegation: Scalars["String"]; + moniker: Scalars["String"]; + operator_address: Scalars["String"]; + website: Scalars["String"]; +}; + +/** columns and relationships of "validators" */ +export type ValidatorsBlocksArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +/** columns and relationships of "validators" */ +export type ValidatorsBlocks_AggregateArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +/** aggregated selection of "validators" */ +export type Validators_Aggregate = { + __typename?: "validators_aggregate"; + aggregate?: Maybe; + nodes: Array; +}; + +export type Validators_Aggregate_Bool_Exp = { + bool_and?: InputMaybe; + bool_or?: InputMaybe; + count?: InputMaybe; +}; + +export type Validators_Aggregate_Bool_Exp_Bool_And = { + arguments: Validators_Select_Column_Validators_Aggregate_Bool_Exp_Bool_And_Arguments_Columns; + distinct?: InputMaybe; + filter?: InputMaybe; + predicate: Boolean_Comparison_Exp; +}; + +export type Validators_Aggregate_Bool_Exp_Bool_Or = { + arguments: Validators_Select_Column_Validators_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns; + distinct?: InputMaybe; + filter?: InputMaybe; + predicate: Boolean_Comparison_Exp; +}; + +export type Validators_Aggregate_Bool_Exp_Count = { + arguments?: InputMaybe>; + distinct?: InputMaybe; + filter?: InputMaybe; + predicate: Int_Comparison_Exp; +}; + +/** aggregate fields of "validators" */ +export type Validators_Aggregate_Fields = { + __typename?: "validators_aggregate_fields"; + avg?: Maybe; + count: Scalars["Int"]; + max?: Maybe; + min?: Maybe; + stddev?: Maybe; + stddev_pop?: Maybe; + stddev_samp?: Maybe; + sum?: Maybe; + var_pop?: Maybe; + var_samp?: Maybe; + variance?: Maybe; +}; + +/** aggregate fields of "validators" */ +export type Validators_Aggregate_FieldsCountArgs = { + columns?: InputMaybe>; + distinct?: InputMaybe; +}; + +/** order by aggregate values of table "validators" */ +export type Validators_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; +}; + +/** input type for inserting array relation for remote table "validators" */ +export type Validators_Arr_Rel_Insert_Input = { + data: Array; + /** upsert condition */ + on_conflict?: InputMaybe; +}; + +/** aggregate avg on columns */ +export type Validators_Avg_Fields = { + __typename?: "validators_avg_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by avg() on columns of table "validators" */ +export type Validators_Avg_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** Boolean expression to filter rows from the table "validators". All fields are combined with a logical 'AND'. */ +export type Validators_Bool_Exp = { + _and?: InputMaybe>; + _not?: InputMaybe; + _or?: InputMaybe>; + account?: InputMaybe; + account_id?: InputMaybe; + blocks?: InputMaybe; + blocks_aggregate?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + jailed?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** unique or primary key constraints on table "validators" */ +export enum Validators_Constraint { + /** unique or primary key constraint on columns "account_id" */ + ValidatorsAccountIdKey = "validators_account_id_key", + /** unique or primary key constraint on columns "consensus_address" */ + ValidatorsConsensusAddressKey = "validators_consensus_address_key", + /** unique or primary key constraint on columns "id" */ + ValidatorsIdKey = "validators_id_key", + /** unique or primary key constraint on columns "operator_address" */ + ValidatorsPkey = "validators_pkey", +} + +/** input type for incrementing numeric columns in table "validators" */ +export type Validators_Inc_Input = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** input type for inserting data into table "validators" */ +export type Validators_Insert_Input = { + account?: InputMaybe; + account_id?: InputMaybe; + blocks?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + jailed?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** aggregate max on columns */ +export type Validators_Max_Fields = { + __typename?: "validators_max_fields"; + account_id?: Maybe; + commission_max_change?: Maybe; + commission_max_rate?: Maybe; + commission_rate?: Maybe; + consensus_address?: Maybe; + details?: Maybe; + id?: Maybe; + identity?: Maybe; + min_self_delegation?: Maybe; + moniker?: Maybe; + operator_address?: Maybe; + website?: Maybe; +}; + +/** order by max() on columns of table "validators" */ +export type Validators_Max_Order_By = { + account_id?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** aggregate min on columns */ +export type Validators_Min_Fields = { + __typename?: "validators_min_fields"; + account_id?: Maybe; + commission_max_change?: Maybe; + commission_max_rate?: Maybe; + commission_rate?: Maybe; + consensus_address?: Maybe; + details?: Maybe; + id?: Maybe; + identity?: Maybe; + min_self_delegation?: Maybe; + moniker?: Maybe; + operator_address?: Maybe; + website?: Maybe; +}; + +/** order by min() on columns of table "validators" */ +export type Validators_Min_Order_By = { + account_id?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** response of any mutation on the table "validators" */ +export type Validators_Mutation_Response = { + __typename?: "validators_mutation_response"; + /** number of rows affected by the mutation */ + affected_rows: Scalars["Int"]; + /** data from the rows affected by the mutation */ + returning: Array; +}; + +/** input type for inserting object relation for remote table "validators" */ +export type Validators_Obj_Rel_Insert_Input = { + data: Validators_Insert_Input; + /** upsert condition */ + on_conflict?: InputMaybe; +}; + +/** on_conflict condition type for table "validators" */ +export type Validators_On_Conflict = { + constraint: Validators_Constraint; + update_columns?: Array; + where?: InputMaybe; +}; + +/** Ordering options when selecting data from "validators". */ +export type Validators_Order_By = { + account?: InputMaybe; + account_id?: InputMaybe; + blocks_aggregate?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + jailed?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** primary key columns input for table: validators */ +export type Validators_Pk_Columns_Input = { + operator_address: Scalars["String"]; +}; + +/** select columns of table "validators" */ +export enum Validators_Select_Column { + /** column name */ + AccountId = "account_id", + /** column name */ + CommissionMaxChange = "commission_max_change", + /** column name */ + CommissionMaxRate = "commission_max_rate", + /** column name */ + CommissionRate = "commission_rate", + /** column name */ + ConsensusAddress = "consensus_address", + /** column name */ + Details = "details", + /** column name */ + Id = "id", + /** column name */ + Identity = "identity", + /** column name */ + Jailed = "jailed", + /** column name */ + MinSelfDelegation = "min_self_delegation", + /** column name */ + Moniker = "moniker", + /** column name */ + OperatorAddress = "operator_address", + /** column name */ + Website = "website", +} + +/** select "validators_aggregate_bool_exp_bool_and_arguments_columns" columns of table "validators" */ +export enum Validators_Select_Column_Validators_Aggregate_Bool_Exp_Bool_And_Arguments_Columns { + /** column name */ + Jailed = "jailed", +} + +/** select "validators_aggregate_bool_exp_bool_or_arguments_columns" columns of table "validators" */ +export enum Validators_Select_Column_Validators_Aggregate_Bool_Exp_Bool_Or_Arguments_Columns { + /** column name */ + Jailed = "jailed", +} + +/** input type for updating data in table "validators" */ +export type Validators_Set_Input = { + account_id?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + jailed?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** aggregate stddev on columns */ +export type Validators_Stddev_Fields = { + __typename?: "validators_stddev_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by stddev() on columns of table "validators" */ +export type Validators_Stddev_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** aggregate stddev_pop on columns */ +export type Validators_Stddev_Pop_Fields = { + __typename?: "validators_stddev_pop_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by stddev_pop() on columns of table "validators" */ +export type Validators_Stddev_Pop_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** aggregate stddev_samp on columns */ +export type Validators_Stddev_Samp_Fields = { + __typename?: "validators_stddev_samp_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by stddev_samp() on columns of table "validators" */ +export type Validators_Stddev_Samp_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** Streaming cursor of the table "validators" */ +export type Validators_Stream_Cursor_Input = { + /** Stream column input with initial value */ + initial_value: Validators_Stream_Cursor_Value_Input; + /** cursor ordering */ + ordering?: InputMaybe; +}; + +/** Initial value of the column from where the streaming should start */ +export type Validators_Stream_Cursor_Value_Input = { + account_id?: InputMaybe; + commission_max_change?: InputMaybe; + commission_max_rate?: InputMaybe; + commission_rate?: InputMaybe; + consensus_address?: InputMaybe; + details?: InputMaybe; + id?: InputMaybe; + identity?: InputMaybe; + jailed?: InputMaybe; + min_self_delegation?: InputMaybe; + moniker?: InputMaybe; + operator_address?: InputMaybe; + website?: InputMaybe; +}; + +/** aggregate sum on columns */ +export type Validators_Sum_Fields = { + __typename?: "validators_sum_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by sum() on columns of table "validators" */ +export type Validators_Sum_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** update columns of table "validators" */ +export enum Validators_Update_Column { + /** column name */ + AccountId = "account_id", + /** column name */ + CommissionMaxChange = "commission_max_change", + /** column name */ + CommissionMaxRate = "commission_max_rate", + /** column name */ + CommissionRate = "commission_rate", + /** column name */ + ConsensusAddress = "consensus_address", + /** column name */ + Details = "details", + /** column name */ + Id = "id", + /** column name */ + Identity = "identity", + /** column name */ + Jailed = "jailed", + /** column name */ + MinSelfDelegation = "min_self_delegation", + /** column name */ + Moniker = "moniker", + /** column name */ + OperatorAddress = "operator_address", + /** column name */ + Website = "website", +} + +export type Validators_Updates = { + /** increments the numeric columns with given value of the filtered values */ + _inc?: InputMaybe; + /** sets the columns of the filtered rows to the given values */ + _set?: InputMaybe; + /** filter the rows which have to be updated */ + where: Validators_Bool_Exp; +}; + +/** aggregate var_pop on columns */ +export type Validators_Var_Pop_Fields = { + __typename?: "validators_var_pop_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by var_pop() on columns of table "validators" */ +export type Validators_Var_Pop_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** aggregate var_samp on columns */ +export type Validators_Var_Samp_Fields = { + __typename?: "validators_var_samp_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by var_samp() on columns of table "validators" */ +export type Validators_Var_Samp_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + +/** aggregate variance on columns */ +export type Validators_Variance_Fields = { + __typename?: "validators_variance_fields"; + account_id?: Maybe; + id?: Maybe; +}; + +/** order by variance() on columns of table "validators" */ +export type Validators_Variance_Order_By = { + account_id?: InputMaybe; + id?: InputMaybe; +}; + export type GetBlockTimestampByHeightQueryQueryVariables = Exact<{ height: Scalars["Int"]; }>; @@ -11361,6 +12126,11 @@ export type GetBlockListQueryQuery = { count: number; } | null; }; + validator?: { + __typename?: "validators"; + moniker: string; + operator_address: string; + } | null; }>; }; @@ -11386,6 +12156,11 @@ export type GetBlockDetailsByHeightQuery = { } | null; } | null; }; + validator?: { + __typename?: "validators"; + moniker: string; + operator_address: string; + } | null; } | null; }; @@ -12142,6 +12917,23 @@ export const GetBlockListQueryDocument = { ], }, }, + { + kind: "Field", + name: { kind: "Name", value: "validator" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "moniker" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "operator_address" }, + }, + ], + }, + }, ], }, }, @@ -12230,6 +13022,23 @@ export const GetBlockDetailsByHeightDocument = { ], }, }, + { + kind: "Field", + name: { kind: "Name", value: "validator" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "moniker" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "operator_address" }, + }, + ], + }, + }, ], }, }, diff --git a/src/lib/pages/block-details/components/BlockInfo.tsx b/src/lib/pages/block-details/components/BlockInfo.tsx index 2509f444b..51569f194 100644 --- a/src/lib/pages/block-details/components/BlockInfo.tsx +++ b/src/lib/pages/block-details/components/BlockInfo.tsx @@ -1,6 +1,7 @@ -import { Box, Flex, Heading, Image, Text } from "@chakra-ui/react"; +import { Box, Flex, Heading } from "@chakra-ui/react"; import { LabelText } from "lib/components/LabelText"; +import { ValidatorBadge } from "lib/components/ValidatorBadge"; import type { BlockDetails } from "lib/types/block"; import { formatInteger } from "lib/utils"; @@ -17,17 +18,7 @@ export const BlockInfo = ({ blockData }: BlockInfoProps) => { {blockData.network} - {/* TODO: Gather this */} - - - - Honeytoast - - + {`${blockData.gasUsed ? formatInteger(blockData.gasUsed) : 0} / ${ diff --git a/src/lib/pages/blocks/components/BlocksRow.tsx b/src/lib/pages/blocks/components/BlocksRow.tsx index 036270069..0e8133107 100644 --- a/src/lib/pages/blocks/components/BlocksRow.tsx +++ b/src/lib/pages/blocks/components/BlocksRow.tsx @@ -3,6 +3,7 @@ import { Flex, Text, Grid } from "@chakra-ui/react"; import { ExplorerLink } from "lib/components/ExplorerLink"; import { TableRow } from "lib/components/table"; +import { ValidatorBadge } from "lib/components/ValidatorBadge"; import type { BlockInfo } from "lib/types/block"; import { dateFromNow, formatUTC, truncate } from "lib/utils"; @@ -24,8 +25,9 @@ export const BlocksRow = ({ templateColumns, blockData }: BlocksRowProps) => { {truncate(blockData.hash.toUpperCase())} - {/* TODO: Wireup Proposer */} - mitovaloper325KJNUFNU12N4J1KBTDXD + + + {blockData.txCount} diff --git a/src/lib/pages/txs/index.tsx b/src/lib/pages/txs/index.tsx index a70fd1bee..25ab85b41 100644 --- a/src/lib/pages/txs/index.tsx +++ b/src/lib/pages/txs/index.tsx @@ -1,4 +1,4 @@ -import { Flex, Heading, Text } from "@chakra-ui/react"; +import { Heading, Text } from "@chakra-ui/react"; import PageContainer from "lib/components/PageContainer"; @@ -6,14 +6,12 @@ import { TxsTable } from "./components/TxsTable"; const Txs = () => ( - - - Transactions - - - This page displays all transactions in this network sorted by recency - - + + Transactions + + + This page displays all transactions in this network sorted by recency + ); diff --git a/src/lib/query/block.ts b/src/lib/query/block.ts index 9f9a0e561..e961d9e27 100644 --- a/src/lib/query/block.ts +++ b/src/lib/query/block.ts @@ -19,6 +19,10 @@ export const getBlockListQueryDocument = graphql(` count } } + validator { + moniker + operator_address + } } } `); @@ -37,6 +41,10 @@ export const getBlockDetailsByHeightQueryDocument = graphql(` } } } + validator { + moniker + operator_address + } } } `); diff --git a/src/lib/services/blockService.ts b/src/lib/services/blockService.ts index 99d79bec1..7cf07c37f 100644 --- a/src/lib/services/blockService.ts +++ b/src/lib/services/blockService.ts @@ -8,7 +8,12 @@ import { getBlockDetailsByHeightQueryDocument, getBlockListQueryDocument, } from "lib/query"; -import type { BlockDetails, BlockInfo, LatestBlock } from "lib/types"; +import type { + BlockDetails, + BlockInfo, + LatestBlock, + ValidatorAddr, +} from "lib/types"; import { parseDate, parseDateOpt, parseTxHash } from "lib/utils"; export const useBlocklistQuery = ( @@ -23,12 +28,25 @@ export const useBlocklistQuery = ( .request(getBlockListQueryDocument, { limit, offset }) .then(({ blocks }) => blocks.map( - ({ hash, height, timestamp, transactions_aggregate }) => ({ + ({ + hash, + height, + timestamp, + transactions_aggregate, + validator, + }) => ({ network: chainId, hash: parseTxHash(hash), height, timestamp: parseDate(timestamp), txCount: transactions_aggregate.aggregate?.count ?? 0, + proposer: validator + ? { + moniker: validator.moniker, + validatorAddress: + validator.operator_address as ValidatorAddr, + } + : null, }) ) ), @@ -71,6 +89,13 @@ export const useBlockDetailsQuery = ( blocks_by_pk.transactions_aggregate.aggregate?.sum?.gas_used, gasLimit: blocks_by_pk.transactions_aggregate.aggregate?.sum?.gas_limit, + proposer: blocks_by_pk.validator + ? { + moniker: blocks_by_pk.validator.moniker, + validatorAddress: blocks_by_pk.validator + .operator_address as ValidatorAddr, + } + : null, } : null ), diff --git a/src/lib/types/block.ts b/src/lib/types/block.ts index a80cd9378..194d79a94 100644 --- a/src/lib/types/block.ts +++ b/src/lib/types/block.ts @@ -1,4 +1,5 @@ import type { Option } from "./common"; +import type { ValidatorInfo } from "./validator"; export interface BlockInfo { network: string; @@ -6,6 +7,7 @@ export interface BlockInfo { height: number; timestamp: Date; txCount: number; + proposer: ValidatorInfo | null; } export interface BlockDetails extends Omit {