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/pool tx table #294

Merged
merged 35 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
44e6305
feat: pool related table blank
songwongtp Apr 23, 2023
a7bd094
fix: tx badge count
songwongtp Apr 23, 2023
f880a39
fix: table border style
songwongtp Apr 24, 2023
b15c14f
fix: hide pagination when count is 0
songwongtp Apr 24, 2023
1f281e7
feat: add swapexactin action
songwongtp Apr 25, 2023
c71fa2d
feat: add swap msg
songwongtp Apr 26, 2023
2a712f2
fix: bugs
songwongtp Apr 26, 2023
0fcb7eb
fix: amount no suffix
songwongtp Apr 26, 2023
dc9f2a5
Merge branch 'pages/pool-list' into feat/pool-tx-table
songwongtp May 3, 2023
c3b5aed
fix: comments
songwongtp May 3, 2023
f2f157f
fix: comments
songwongtp May 9, 2023
00917e4
fix: comments
songwongtp May 9, 2023
a535322
fix: query fn error
songwongtp May 9, 2023
5f498e0
Merge branch 'pages/pool-list' into feat/pool-tx-table
songwongtp May 9, 2023
864e825
fix: remove superfluid table for non super pools
songwongtp May 9, 2023
6568237
fix: rename and structure
songwongtp May 10, 2023
825b6b7
fix: pool txs accordion arrow to the front
songwongtp May 10, 2023
5bcae7a
fix: refactor
songwongtp May 11, 2023
f4425d2
feat: add lp messages
songwongtp May 16, 2023
4d15c33
fix: detail uis
songwongtp May 16, 2023
cbb8296
fix: empty array for join exit pool
songwongtp May 16, 2023
141c71c
fix: pool logo
songwongtp May 16, 2023
d069d94
fix: pool tx count timeout
songwongtp May 17, 2023
d175712
feat: lock and superfluid message
songwongtp May 18, 2023
7d21dcd
fix: validator badge size
songwongtp May 18, 2023
500a66d
fix: add tooltip
songwongtp May 19, 2023
113d1b5
fix: change pooltxs template column
songwongtp May 19, 2023
ae64abc
fix: add tooltip
songwongtp May 23, 2023
63f1d9c
fix: change accordion color
songwongtp May 23, 2023
e2dea17
Merge branch 'pages/pool-list' into feat/pool-tx-table
songwongtp May 23, 2023
fc9b444
fix: tooltip
songwongtp May 23, 2023
6037038
fix: comment
songwongtp May 23, 2023
43809d6
fix: comment
songwongtp May 23, 2023
b0009ac
fix: add ibc tag
songwongtp May 23, 2023
69a59bd
fix: comment
songwongtp May 23, 2023
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

- [#294](https://github.com/alleslabs/celatone-frontend/pull/294) Add Pool related txs table
- [#296](https://github.com/alleslabs/celatone-frontend/pull/296) Add pool header and pool assets section for pool details page
- [#295](https://github.com/alleslabs/celatone-frontend/pull/295) Add expand/collapse all for unsupported pool list
- [#277](https://github.com/alleslabs/celatone-frontend/pull/277) Wire up data for pool navigation page
Expand Down
29 changes: 16 additions & 13 deletions src/lib/components/AccordionStepperItem.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import type { FlexProps } from "@chakra-ui/react";
import { Flex } from "@chakra-ui/react";

const AccordionStepperItemLine = (props: FlexProps) => (
<Flex
{...props}
w="1px"
h="28px"
right="45%"
background="pebble.600"
position="absolute"
visibility="hidden"
zIndex={0}
/>
);

export const AccordionStepperItem = () => (
<Flex position="relative">
<Flex
id="before-stepper"
w="1px"
h="31px"
right="45%"
bottom="9px"
background="pebble.600"
position="absolute"
visibility="hidden"
zIndex={0}
/>
<AccordionStepperItemLine id="before-stepper" bottom="9px" />
<Flex
id="stepper"
borderRadius="full"
h="10px"
w="10px"
borderColor="pebble.600"
borderWidth="1px"
position="relative"
zIndex={1}
/>
<AccordionStepperItemLine id="after-stepper" top="9px" />
</Flex>
);
2 changes: 1 addition & 1 deletion src/lib/components/CustomTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { TabProps } from "@chakra-ui/react";
import { Button, useTab, Badge, useMultiStyleConfig } from "@chakra-ui/react";

interface CustomTabProps extends TabProps {
count?: number;
count?: number | string;
}

export const CustomTab = ({ count, ...restProps }: CustomTabProps) => {
Expand Down
9 changes: 7 additions & 2 deletions src/lib/components/ExplorerLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export type LinkType =
| "tx_hash"
| "code_id"
| "block_height"
| "proposal_id";
| "proposal_id"
| "pool_id";

interface ExplorerLinkProps extends BoxProps {
value: string;
Expand Down Expand Up @@ -63,6 +64,9 @@ const getNavigationUrl = (
case "proposal_id":
url = getExplorerProposalUrl(currentChainName);
break;
case "pool_id":
url = "/pools";
break;
case "invalid_address":
return "";
default:
Expand Down Expand Up @@ -161,7 +165,8 @@ export const ExplorerLink = ({
type === "contract_address" ||
type === "user_address" ||
type === "tx_hash" ||
type === "block_height";
type === "block_height" ||
type === "pool_id";

const [hrefLink, textValue] = [
getNavigationUrl(type, currentChainName, copyValue || value),
Expand Down
8 changes: 6 additions & 2 deletions src/lib/components/Loading.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Flex, Spinner, Text } from "@chakra-ui/react";

export const Loading = () => (
interface LoadingProps {
withBorder?: boolean;
}

export const Loading = ({ withBorder = true }: LoadingProps) => (
<Flex
borderY="1px solid"
borderY={withBorder ? "1px solid" : undefined}
borderColor="pebble.700"
width="full"
py="60px"
Expand Down
7 changes: 1 addition & 6 deletions src/lib/components/TokenCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ export const TokenCard = ({
const { symbol, price, amount, precision, id } = userBalance.balance;

return (
<Tooltip
label={`Token ID: ${id}`}
maxW="240px"
whiteSpace="pre-line"
textAlign="center"
>
<Tooltip label={`Token ID: ${id}`} maxW="240px" textAlign="center">
<Flex
className="copier-wrapper"
direction="column"
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const TooltipInfo = ({
<Tooltip {...tooltipProps}>
<div style={{ cursor: "pointer" }}>
<CustomIcon
color="pebble.600"
name={iconVariant === "solid" ? "info-circle-solid" : "info-circle"}
boxSize={3}
m={0}
Expand Down
42 changes: 42 additions & 0 deletions src/lib/components/action-msg/MsgToken.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Flex, Text } from "@chakra-ui/react";
import type { Coin } from "@cosmjs/stargate";

import { Copier } from "../copy";
import { TooltipInfo } from "../Tooltip";
import { formatBalanceWithDenom } from "lib/utils";

interface MsgTokenProps {
coin: Coin;
symbol?: string;
precision?: number;
fontWeight?: number;
}

export const MsgToken = ({
coin,
symbol,
precision,
fontWeight = 600,
}: MsgTokenProps) => (
<Flex role="group" align="center" gap={1}>
<Text fontWeight={fontWeight}>
{formatBalanceWithDenom({
coin,
symbol,
precision,
})}
</Text>
<TooltipInfo
label={`Token ID: ${coin.denom}`}
maxW="240px"
textAlign="center"
/>
<Copier
type={symbol ? "supported_asset" : "unsupported_asset"}
value={coin.denom}
copyLabel="Token ID Copied!"
display="none"
ml="4px"
/>
</Flex>
);
44 changes: 12 additions & 32 deletions src/lib/components/action-msg/SingleMsg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import { Tag, Text, Flex } from "@chakra-ui/react";
import type { Coin } from "@cosmjs/stargate";
import { snakeCase } from "snake-case";

import { Copier } from "../copy";
import { CustomIcon } from "../icon";
import { Tooltip } from "../Tooltip";
import type { LinkType } from "lib/components/ExplorerLink";
import { ExplorerLink } from "lib/components/ExplorerLink";
import type { Option } from "lib/types";
import { formatBalanceWithDenom } from "lib/utils";

import { MsgToken } from "./MsgToken";

interface LinkElement {
type: LinkType;
Expand Down Expand Up @@ -50,35 +48,17 @@ export const SingleMsg = ({
<Flex gap={1} alignItems="center" flexWrap="wrap">
{type} {text1}
{tokens?.map((token: Token, index: number) => (
<Flex
<MsgToken
key={index.toString() + token}
role="group"
align="center"
gap={1}
>
<Text fontWeight="medium">
{formatBalanceWithDenom({
coin: {
denom: token.id,
amount: token.amount,
} as Coin,
symbol: token.symbol,
precision: token.precision,
})}
</Text>
<Tooltip label={`Token ID: ${token.id}`} maxW="240px">
<Flex cursor="pointer">
<CustomIcon name="info-circle" boxSize="3" color="pebble.600" />
</Flex>
</Tooltip>
<Copier
type={token.symbol ? "supported_asset" : "unsupported_asset"}
value={token.id}
copyLabel="Token ID Copied!"
display="none"
ml="4px"
/>
</Flex>
coin={
songwongtp marked this conversation as resolved.
Show resolved Hide resolved
{
denom: token.id,
amount: token.amount,
} as Coin
}
symbol={token.symbol}
precision={token.precision}
/>
))}
{/* Tags */}
{tags?.map((tag: string, index: number) => (
Expand Down
6 changes: 1 addition & 5 deletions src/lib/components/table/AccordionTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,14 @@ export const AccordionTx = ({
const [showButton, setShowButton] = useState(false);
return (
<TableRow
className="accordion-stepper-wrapper"
minH={0}
h="40px"
borderBottom="none"
pl={accordionSpacing}
gap={3}
_hover={{ background: "pebble.800" }}
transition="all .25s ease-in-out"
css={{
"&:not(:first-of-type) div#before-stepper": {
visibility: "visible",
},
}}
onMouseEnter={() => setShowButton(true)}
onMouseLeave={() => setShowButton(false)}
>
Expand Down
8 changes: 8 additions & 0 deletions src/lib/components/table/tableComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ export const TableRow = chakra(GridItem, {
baseStyle: tableRowBaseStyle,
});

export const TableNoBorderRow = chakra(GridItem, {
baseStyle: {
...tableRowBaseStyle,
borderBottom: undefined,
borderColor: undefined,
},
});

export const TableRowFreeze = chakra(GridItem, {
baseStyle: {
...tableRowBaseStyle,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/data/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export type TypeUrl =
| "/ibc.core.channel.v1.MsgTimeoutOnClose"
| "/ibc.core.channel.v1.MsgAcknowledgement"
// osmosis
| "/osmosis.poolmanager.v1beta1.MsgSwapExactAmountIn"
| "/osmosis.poolmanager.v1beta1.MsgSwapExactAmountOut"
| "/osmosis.gamm.poolmodels.balancer.v1beta1.MsgCreateBalancerPool"
| "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgCreateStableswapPool"
| "/osmosis.gamm.poolmodels.stableswap.v1beta1.MsgStableSwapAdjustScalingFactors"
Expand Down
11 changes: 8 additions & 3 deletions src/lib/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const documents = {
types.GetPoolListByDenomsCountDocument,
"\n query getPoolByPoolId($poolId: Int!) {\n pools_by_pk(id: $poolId) {\n id\n type\n is_superfluid\n is_supported\n liquidity\n transaction {\n block_height\n }\n account {\n address\n }\n address\n swap_fee\n exit_fee\n future_pool_governor\n weight\n smooth_weight_change_params\n scaling_factors\n scaling_factor_controller\n }\n }\n":
types.GetPoolByPoolIdDocument,
"\n query getPoolsByPoolIds($poolIds: [Int!]!) {\n pools(where: { id: { _in: $poolIds } }) {\n id\n liquidity\n }\n }\n":
types.GetPoolsByPoolIdsDocument,
"\n query getRelatedProposalsByContractAddressPagination(\n $contractAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contract_proposals(\n where: { contract: { address: { _eq: $contractAddress } } }\n order_by: { proposal_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n proposal {\n title\n status\n voting_end_time\n deposit_end_time\n type\n account {\n address\n }\n is_expedited\n }\n proposal_id\n resolved_height\n }\n }\n":
types.GetRelatedProposalsByContractAddressPaginationDocument,
"\n query getRelatedProposalsCountByContractAddress($contractAddress: String!) {\n contract_proposals_aggregate(\n where: { contract: { address: { _eq: $contractAddress } } }\n ) {\n aggregate {\n count\n }\n }\n }\n":
Expand All @@ -77,7 +79,7 @@ const documents = {
types.GetTxsByAddressPaginationDocument,
"\n query getTxsCountByAddress($expression: account_transactions_bool_exp) {\n account_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n":
types.GetTxsCountByAddressDocument,
"\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n":
"\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc, transaction_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n":
types.GetTxsByPoolIdPaginationDocument,
"\n query getTxsCountByPoolId($expression: pool_transactions_bool_exp) {\n pool_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n":
types.GetTxsCountByPoolIdDocument,
Expand Down Expand Up @@ -175,6 +177,9 @@ export function graphql(
export function graphql(
source: "\n query getPoolByPoolId($poolId: Int!) {\n pools_by_pk(id: $poolId) {\n id\n type\n is_superfluid\n is_supported\n liquidity\n transaction {\n block_height\n }\n account {\n address\n }\n address\n swap_fee\n exit_fee\n future_pool_governor\n weight\n smooth_weight_change_params\n scaling_factors\n scaling_factor_controller\n }\n }\n"
): typeof documents["\n query getPoolByPoolId($poolId: Int!) {\n pools_by_pk(id: $poolId) {\n id\n type\n is_superfluid\n is_supported\n liquidity\n transaction {\n block_height\n }\n account {\n address\n }\n address\n swap_fee\n exit_fee\n future_pool_governor\n weight\n smooth_weight_change_params\n scaling_factors\n scaling_factor_controller\n }\n }\n"];
export function graphql(
source: "\n query getPoolsByPoolIds($poolIds: [Int!]!) {\n pools(where: { id: { _in: $poolIds } }) {\n id\n liquidity\n }\n }\n"
): typeof documents["\n query getPoolsByPoolIds($poolIds: [Int!]!) {\n pools(where: { id: { _in: $poolIds } }) {\n id\n liquidity\n }\n }\n"];
export function graphql(
source: "\n query getRelatedProposalsByContractAddressPagination(\n $contractAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contract_proposals(\n where: { contract: { address: { _eq: $contractAddress } } }\n order_by: { proposal_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n proposal {\n title\n status\n voting_end_time\n deposit_end_time\n type\n account {\n address\n }\n is_expedited\n }\n proposal_id\n resolved_height\n }\n }\n"
): typeof documents["\n query getRelatedProposalsByContractAddressPagination(\n $contractAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n contract_proposals(\n where: { contract: { address: { _eq: $contractAddress } } }\n order_by: { proposal_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n proposal {\n title\n status\n voting_end_time\n deposit_end_time\n type\n account {\n address\n }\n is_expedited\n }\n proposal_id\n resolved_height\n }\n }\n"];
Expand Down Expand Up @@ -203,8 +208,8 @@ export function graphql(
source: "\n query getTxsCountByAddress($expression: account_transactions_bool_exp) {\n account_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"
): typeof documents["\n query getTxsCountByAddress($expression: account_transactions_bool_exp) {\n account_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"];
export function graphql(
source: "\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n"
): typeof documents["\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n"];
source: "\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc, transaction_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n"
): typeof documents["\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc, transaction_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n"];
export function graphql(
source: "\n query getTxsCountByPoolId($expression: pool_transactions_bool_exp) {\n pool_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"
): typeof documents["\n query getTxsCountByPoolId($expression: pool_transactions_bool_exp) {\n pool_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"];
Expand Down
Loading