Skip to content

Commit

Permalink
Merge branch 'feat/cfe-318-api-validator-list' into feat/cfe-358-api-…
Browse files Browse the repository at this point in the history
…validator-info
  • Loading branch information
songwongtp committed Mar 5, 2024
2 parents b48dc0d + 694f363 commit ece8231
Show file tree
Hide file tree
Showing 37 changed files with 114 additions and 138 deletions.
4 changes: 1 addition & 3 deletions src/lib/amplitude/track-event/trackInteraction.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import big from "big.js";

import { amp } from "../Amplitude";
import { AmpEvent } from "../types";
import type { SearchResultType } from "lib/services/searchService";
import type { Addr, Option, Token } from "lib/types";
import { big, type Addr, type Option, type Token } from "lib/types";
import { isHexModuleAddress, isHexWalletAddress } from "lib/utils";

export const trackUseMainSearch = (
Expand Down
3 changes: 1 addition & 2 deletions src/lib/app-provider/hooks/useFabricateFee.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { StdFee } from "@cosmjs/stargate";
import big from "big.js";
import { useCallback } from "react";

import { useCelatoneApp } from "../contexts/app";
import type { Gas } from "lib/types";
import { big, type Gas } from "lib/types";

export const useFabricateFee = () => {
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Flex, Text, Heading, Spinner } from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";

import type { Option, TokenWithValue, USD } from "lib/types";
import { big, type Option, type TokenWithValue, type USD } from "lib/types";
import { formatPrice, totalValueTokenWithValue } from "lib/utils";

interface MultiBondsRadioCardProps {
Expand Down
9 changes: 7 additions & 2 deletions src/lib/components/delegations/total-card/MultiBondsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { Flex, Heading, Text, useDisclosure } from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";
import plur from "plur";

import { CustomIcon } from "lib/components/icon";
import type { BechAddr, Option, TokenWithValue, USD } from "lib/types";
import {
big,
type BechAddr,
type Option,
type TokenWithValue,
type USD,
} from "lib/types";
import { formatPrice, totalValueTokenWithValue } from "lib/utils";

import { TotalCardModal } from "./TotalCardModal";
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/delegations/total-card/OverviewCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Flex, Heading } from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";

import type { Option, TokenWithValue, USD } from "lib/types";
import { big, type Option, type TokenWithValue, type USD } from "lib/types";
import { formatPrice, totalValueTokenWithValue } from "lib/utils";

import { TotalCardTop } from "./TotalCardTop";
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/delegations/total-card/TotalCardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import {
Text,
} from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";

import { CopyLink } from "lib/components/CopyLink";
import { CustomIcon } from "lib/components/icon";
import { TokenImageRender, TokenComposition } from "lib/components/token";
import type { BechAddr, TokenWithValue, USD } from "lib/types";
import { big, type BechAddr, type TokenWithValue, type USD } from "lib/types";
import {
compareTokenWithValues,
formatPrice,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/dropzone/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { FlexProps } from "@chakra-ui/react";
import { Flex, Text } from "@chakra-ui/react";
import big from "big.js";
import { useCallback } from "react";
import { useDropzone } from "react-dropzone";

import { UploadIcon } from "../icon";
import { AmpEvent, track } from "lib/amplitude";
import { useMoveConfig, useWasmConfig } from "lib/app-provider";
import { big } from "lib/types";

import type { DropzoneFileType } from "./config";
import { DROPZONE_CONFIG } from "./config";
Expand Down
3 changes: 1 addition & 2 deletions src/lib/components/upload/UploadCard.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Button, Flex, Text } from "@chakra-ui/react";
import big from "big.js";

import { AmpEvent, track } from "lib/amplitude";
import { CustomIcon, UploadIcon } from "lib/components/icon";
import type { Nullable, Option } from "lib/types";
import { big, type Nullable, type Option } from "lib/types";

type CardTheme = "primary" | "secondary";

Expand Down
20 changes: 10 additions & 10 deletions src/lib/model/account.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { Big } from "big.js";
import big from "big.js";

import { useCelatoneApp } from "lib/app-provider";
import { useAssetInfos } from "lib/services/assetService";
import { useBalanceInfos } from "lib/services/balanceService";
import { useDelegationsByAddress } from "lib/services/delegationService";
import { useMovePoolInfos } from "lib/services/move";
import type {
Option,
BechAddr,
USD,
TokenWithValue,
StakingParams,
Delegation,
Unbonding,
Redelegation,
import {
type Option,
type BechAddr,
type USD,
type TokenWithValue,
type StakingParams,
type Delegation,
type Unbonding,
type Redelegation,
big,
} from "lib/types";
import {
addTokenWithValue,
Expand Down
3 changes: 1 addition & 2 deletions src/lib/pages/pools/components/pool-details/PoolAssets.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Flex, Heading, Badge, Text } from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";
import Link from "next/link";

import { trackWebsite } from "lib/amplitude";
import { CustomIcon } from "lib/components/icon";
import { EmptyState } from "lib/components/state";
import type { PoolDetail, USD } from "lib/types";
import { PoolType } from "lib/types";
import { PoolType, big } from "lib/types";
import { formatPrice } from "lib/utils";

import { PoolAssetsTable } from "./tables/pool-assets";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Flex, SimpleGrid, Text } from "@chakra-ui/react";
import type { Coin } from "@cosmjs/stargate";
import big from "big.js";

import { AssetCard, ErrorFetchingDetail } from "../../components";
import { Loading } from "lib/components/Loading";
import { useTxData } from "lib/services/txService";
import type { AssetInfos, Option } from "lib/types";
import { big, type AssetInfos, type Option } from "lib/types";
import { coinsFromStr } from "lib/utils";

interface PoolAssetsGridProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { Box, Flex, Image, Text } from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";

import { getUndefinedTokenIcon } from "../../utils";
import type { Option, Ratio, Token, U, USD } from "lib/types";
import {
big,
type Option,
type Ratio,
type Token,
type U,
type USD,
} from "lib/types";
import {
getTokenLabel,
formatUTokenWithPrecision,
Expand Down
3 changes: 1 addition & 2 deletions src/lib/pages/pools/components/supportedSection/PoolCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Flex, IconButton, SimpleGrid, Text } from "@chakra-ui/react";
import type { Big } from "big.js";
import big from "big.js";
import Link from "next/link";

import { PoolHeader } from "../PoolHeader";
Expand All @@ -9,7 +8,7 @@ import { useInternalNavigate, usePoolConfig } from "lib/app-provider";
import { CustomIcon } from "lib/components/icon";
import { LabelText } from "lib/components/LabelText";
import { Tooltip } from "lib/components/Tooltip";
import type { USD, Pool, Token, U } from "lib/types";
import { type USD, type Pool, type Token, type U, big } from "lib/types";
import { formatPrice } from "lib/utils";

import { AllocationBadge } from "./AllocationBadge";
Expand Down
20 changes: 10 additions & 10 deletions src/lib/pages/pools/data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Big } from "big.js";
import big from "big.js";

import { UPPERBOUND_COUNT } from "lib/data";
import type { Order_By } from "lib/gql/graphql";
Expand All @@ -9,15 +8,16 @@ import {
useTxsByPoolIdPagination,
useTxsCountByPoolId,
} from "lib/services/txService";
import type {
Option,
Pool,
PoolDetail,
PoolTxFilter,
PoolTypeFilter,
PoolWeight,
Ratio,
TokenWithValue,
import {
big,
type Option,
type Pool,
type PoolDetail,
type PoolTxFilter,
type PoolTypeFilter,
type PoolWeight,
type Ratio,
type TokenWithValue,
} from "lib/types";
import { coinToTokenWithValue, divWithDefault, formatRatio } from "lib/utils";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Meta, StoryObj } from "@storybook/react";
import big from "big.js";
import type Big from "big.js";
import dayjs from "dayjs";

import { StatusSummary } from "../status-summary";
import { ProposalStatus } from "lib/types";
import { ProposalStatus, big } from "lib/types";
import type { ProposalParams, ProposalData, Token, U } from "lib/types";

const meta: Meta<typeof StatusSummary> = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Divider, Flex, Heading, Spacer, Text } from "@chakra-ui/react";
import big from "big.js";

import type { VoteDetailsProps } from "..";
import { ErrorFetchingProposalInfos } from "../../ErrorFetchingProposalInfos";
Expand All @@ -13,6 +12,7 @@ import {
extractParams,
normalizeVotesInfo,
} from "lib/pages/proposal-details/utils";
import { big } from "lib/types";

export const VotingQuorum = ({
proposalData,
Expand Down
16 changes: 8 additions & 8 deletions src/lib/pages/proposal-details/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type Big from "big.js";
import big from "big.js";

import type {
Nullable,
ProposalParams,
ProposalVotesInfo,
Token,
TokenWithValue,
U,
import {
big,
type Nullable,
type ProposalParams,
type ProposalVotesInfo,
type Token,
type TokenWithValue,
type U,
} from "lib/types";
import { divWithDefault } from "lib/utils";

Expand Down
4 changes: 1 addition & 3 deletions src/lib/pages/proposal/utils/getAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import big from "big.js";

import { CustomIcon } from "lib/components/icon";
import type { Nullable, Option } from "lib/types";
import { big, type Nullable, type Option } from "lib/types";
import { d2Formatter } from "lib/utils";

interface AlertProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
/* eslint-disable sonarjs/max-switch-cases */
/* eslint-disable complexity */
import { Flex } from "@chakra-ui/react";
import big from "big.js";

import type { TxMsgData } from "..";
import type { AddressReturnType } from "lib/app-provider";
import { CopyButton } from "lib/components/copy";
import { PermissionChip } from "lib/components/PermissionChip";
import { ViewPermissionAddresses } from "lib/components/ViewPermissionAddresses";
import type { TxReceipt, Option } from "lib/types";
import { type TxReceipt, type Option, big } from "lib/types";
import type { VoteOption } from "lib/utils";
import {
voteOption,
Expand Down
9 changes: 7 additions & 2 deletions src/lib/services/balanceService.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import type { Coin } from "@cosmjs/stargate";
import { useQuery, type UseQueryResult } from "@tanstack/react-query";
import type Big from "big.js";
import big from "big.js";

import { CELATONE_QUERY_KEYS, useBaseApiRoute } from "lib/app-provider";
import type { BechAddr, Option, TokenWithValue, USD } from "lib/types";
import {
big,
type BechAddr,
type Option,
type TokenWithValue,
type USD,
} from "lib/types";
import {
coinToTokenWithValue,
compareTokenWithValues,
Expand Down
3 changes: 1 addition & 2 deletions src/lib/services/faucetService.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { UseQueryResult } from "@tanstack/react-query";
import { useQuery } from "@tanstack/react-query";
import big from "big.js";

import { CELATONE_QUERY_KEYS, useFaucetConfig } from "lib/app-provider";
import type { Token, U } from "lib/types";
import { big, type Token, type U } from "lib/types";
import { deexponentify, getTokenLabel } from "lib/utils";

import { useAssetInfos } from "./assetService";
Expand Down
10 changes: 8 additions & 2 deletions src/lib/services/move/poolService.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { useQuery } from "@tanstack/react-query";
import type { Big } from "big.js";
import big from "big.js";

import { useAssetInfos } from "../assetService";
import {
CELATONE_QUERY_KEYS,
useBaseApiRoute,
useMoveConfig,
} from "lib/app-provider";
import type { MovePoolInfos, Option, Token, U, USD } from "lib/types";
import {
big,
type MovePoolInfos,
type Option,
type Token,
type U,
type USD,
} from "lib/types";
import { calculateAssetValue, toToken } from "lib/utils";

import { getMovePoolInfos } from "./pool";
Expand Down
20 changes: 7 additions & 13 deletions src/lib/services/proposal.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Coin } from "@cosmjs/stargate";
import axios from "axios";
import big from "big.js";
import { z } from "zod";

import {
zBechAddr,
zBig,
zCoin,
zProposalStatus,
zProposalType,
Expand Down Expand Up @@ -250,19 +250,13 @@ export const getProposalData = async (

const zProposalVotesInfoResponse = z
.object({
yes: z.string(),
abstain: z.string(),
no: z.string(),
no_with_veto: z.string(),
total_voting_power: z.string(),
yes: zBig,
abstain: zBig,
no: zBig,
no_with_veto: zBig,
total_voting_power: zBig,
})
.transform<ProposalVotesInfo>((val) => ({
yes: big(val.yes),
abstain: big(val.abstain),
no: big(val.no),
noWithVeto: big(val.no_with_veto),
totalVotingPower: big(val.total_voting_power),
}));
.transform<ProposalVotesInfo>(snakeToCamel);

export const getProposalVotesInfo = async (
endpoint: string,
Expand Down
Loading

0 comments on commit ece8231

Please sign in to comment.