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: add block proposer to block list and block details page #286

Merged
merged 1 commit into from
Apr 20, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib/app-provider/query-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const GRAPH_URL: Record<string, string> = {
/**
* 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",
};
Expand Down
20 changes: 16 additions & 4 deletions src/lib/components/ValidatorBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
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";
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 (
<Text variant="body2" color="text.disabled">
N/A
</Text>
);

return (
<Flex alignItems="center" gap={2}>
<Image
boxSize={10}
boxSize={badgeSize}
src={`https://raw.githubusercontent.com/cosmostation/chainlist/master/chain/${getChainApiPath(
currentChainName
)}/${validator.validatorAddress}.png`}
Expand Down
12 changes: 6 additions & 6 deletions src/lib/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/
const documents = {
"\n query getBlockTimestampByHeightQuery($height: Int!) {\n blocks_by_pk(height: $height) {\n timestamp\n }\n }\n":
types.GetBlockTimestampByHeightQueryDocument,
"\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n }\n }\n":
"\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n validator {\n moniker\n operator_address\n }\n }\n }\n":
types.GetBlockListQueryDocument,
"\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n }\n }\n":
"\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n validator {\n moniker\n operator_address\n }\n }\n }\n":
types.GetBlockDetailsByHeightDocument,
"\n query getLatestBlockInfo {\n blocks(limit: 1, order_by: { height: desc }) {\n height\n timestamp\n }\n }\n":
types.GetLatestBlockInfoDocument,
Expand Down Expand Up @@ -79,11 +79,11 @@ export function graphql(
source: "\n query getBlockTimestampByHeightQuery($height: Int!) {\n blocks_by_pk(height: $height) {\n timestamp\n }\n }\n"
): typeof documents["\n query getBlockTimestampByHeightQuery($height: Int!) {\n blocks_by_pk(height: $height) {\n timestamp\n }\n }\n"];
export function graphql(
source: "\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n }\n }\n"
): typeof documents["\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n }\n }\n"];
source: "\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n validator {\n moniker\n operator_address\n }\n }\n }\n"
): typeof documents["\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n validator {\n moniker\n operator_address\n }\n }\n }\n"];
export function graphql(
source: "\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n }\n }\n"
): typeof documents["\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n }\n }\n"];
source: "\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n validator {\n moniker\n operator_address\n }\n }\n }\n"
): typeof documents["\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n validator {\n moniker\n operator_address\n }\n }\n }\n"];
export function graphql(
source: "\n query getLatestBlockInfo {\n blocks(limit: 1, order_by: { height: desc }) {\n height\n timestamp\n }\n }\n"
): typeof documents["\n query getLatestBlockInfo {\n blocks(limit: 1, order_by: { height: desc }) {\n height\n timestamp\n }\n }\n"];
Expand Down
Loading