Skip to content

Commit

Permalink
chore: rename to RenameToken.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
chloezxyy committed Jul 22, 2024
1 parent 5afbf1b commit 8355f7a
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/components/commons/token/PoolPairSymbol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classnames from "classnames";
import { useWhaleApiClient } from "@contexts/WhaleContext";
import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
import { getAssetIcon } from "@components/icons/assets/tokens";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface PoolPairSymbolProps {
poolPairId: string | number;
Expand Down Expand Up @@ -57,8 +57,8 @@ export function PoolPairSymbol(props: PoolPairSymbolProps): JSX.Element {
const IconA = getAssetIcon(poolPairData.tokenA.symbol);
const IconB = getAssetIcon(poolPairData.tokenB.symbol);

const tokenADisplay = tokenSymbolRename(poolPairData.tokenA.displaySymbol);
const tokenBDisplay = tokenSymbolRename(poolPairData.tokenB.displaySymbol);
const tokenADisplay = renameTokenSymbol(poolPairData.tokenA.displaySymbol);
const tokenBDisplay = renameTokenSymbol(poolPairData.tokenB.displaySymbol);

return (
<div className="flex items-center" data-testid={props.testId}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/commons/token/PoolPairSymbolLocal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classnames from "classnames";
import { getAssetIcon } from "@components/icons/assets/tokens";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface PoolPairSymbolProps {
tokenA: {
Expand All @@ -24,8 +24,8 @@ export function PoolPairSymbolLocal(props: PoolPairSymbolProps): JSX.Element {
const IconA = getAssetIcon(props.tokenA.symbol);
const IconB = getAssetIcon(props.tokenB.symbol);

const tokenADisplaySymbol = tokenSymbolRename(props.tokenA.displaySymbol);
const tokenBDisplaySymbol = tokenSymbolRename(props.tokenB.displaySymbol);
const tokenADisplaySymbol = renameTokenSymbol(props.tokenA.displaySymbol);
const tokenBDisplaySymbol = renameTokenSymbol(props.tokenB.displaySymbol);

return (
<div className="flex items-center" data-testid={props.testId}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/commons/token/TokenSymbol.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TokenData } from "@defichain/whale-api-client/dist/api/tokens";
import classNames from "classnames";
import { getAssetIcon, getTokenIcon } from "@components/icons/assets/tokens";
import { EVMLinearGradient } from "@components/icons/assets/tokens/EVMLinearGradient";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface TokenSymbolProps {
tokenId: number;
Expand Down Expand Up @@ -70,7 +70,7 @@ export function TokenSymbol(props: TokenSymbolProps): JSX.Element {
)}
data-testid={props.testId}
>
{tokenSymbolRename(tokenData.displaySymbol)}
{renameTokenSymbol(tokenData.displaySymbol)}
{!tokenData.isDAT && `#${tokenData.id}`}
</div>
{(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/index/LiquidityPoolList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
import { Link } from "@components/commons/link/Link";
import { NumericFormat } from "react-number-format";
import { PoolPairSymbol } from "@components/commons/token/PoolPairSymbol";
import { tokenSymbolRename } from "../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../utils/commons/RenameToken";

export function LiquidityPoolList({
liquidityPools,
Expand Down Expand Up @@ -33,8 +33,8 @@ export function LiquidityPoolList({
: ""
}
priceRatio={pool.priceRatio.ba}
tokenASymbol={tokenSymbolRename(pool.tokenA.displaySymbol)}
tokenBSymbol={tokenSymbolRename(pool.tokenB.displaySymbol)}
tokenASymbol={renameTokenSymbol(pool.tokenA.displaySymbol)}
tokenBSymbol={renameTokenSymbol(pool.tokenB.displaySymbol)}
/>
);
})}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/address/_components/AddressBalances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CgSpinner } from "react-icons/cg";
import { PoolPairSymbol } from "@components/commons/token/PoolPairSymbol";
import { Link } from "@components/commons/link/Link";
import { EmptySection } from "@components/commons/sections/EmptySection";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface AddressBalancesProps {
address: string;
Expand Down Expand Up @@ -164,7 +164,7 @@ function TokenSymbolName(props: { token: AddressToken }): JSX.Element {
>
<Link href={{ pathname: `/tokens/${props.token.id}` }}>
<a className="contents">
{tokenSymbolRename(props.token.displaySymbol)}
{renameTokenSymbol(props.token.displaySymbol)}
{!props.token.isDAT && `#${props.token.id}`}
</a>
</Link>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/auctions/_components/commons/BidAmountValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from "react";
import { LoanVaultLiquidationBatch } from "@defichain/whale-api-client/dist/api/loan";
import classNames from "classnames";
import { useTokenPrice } from "../../../vaults/hooks/TokenPrice";
import { tokenSymbolRename } from "../../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

interface BidAmountValueProps {
batch: LoanVaultLiquidationBatch;
Expand Down Expand Up @@ -36,7 +36,7 @@ export function BidAmountValue(props: BidAmountValueProps): JSX.Element {
value={minBidAmount.toFixed(8)}
thousandSeparator
decimalScale={8}
suffix={` ${tokenSymbolRename(props.batch.loan.displaySymbol)}`}
suffix={` ${renameTokenSymbol(props.batch.loan.displaySymbol)}`}
displayType="text"
data-testid="BidAmountValue.MinBidAmount"
className="dark:text-gray-100"
Expand Down
4 changes: 2 additions & 2 deletions src/pages/dex/[poolpairId]/_components/PoolPairDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
import { NumericFormat } from "react-number-format";
import { getAssetIcon } from "@components/icons/assets/tokens";
import { tokenSymbolRename } from "../../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

export function PoolPairDetails(props: {
poolpair: PoolPairData;
Expand Down Expand Up @@ -91,7 +91,7 @@ function TokenDetailsItem(props: {
>
<span className="flex items-center dark:text-gray-400">
<TokenIcon className="mr-2 w-4 h-4" />{" "}
{tokenSymbolRename(props.displaySymbol)}
{renameTokenSymbol(props.displaySymbol)}
</span>
<NumericFormat
value={props.value}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/dex/[poolpairId]/_components/PoolPairDetailsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PoolPairSymbolLocal } from "@components/commons/token/PoolPairSymbolLoc
import { NumericFormat } from "react-number-format";
import BigNumber from "bignumber.js";
import { useTokenPrice } from "../../../vaults/hooks/TokenPrice";
import { tokenSymbolRename } from "../../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

export function PoolPairDetailsBar(props: {
poolpair: PoolPairData;
Expand Down Expand Up @@ -47,7 +47,7 @@ export function PoolPairDetailsBar(props: {
fixedDecimalScale
className="text-sm flex lg:justify-end text-gray-400"
prefix="≈ "
suffix={` ${tokenSymbolRename(
suffix={` ${renameTokenSymbol(
props.poolpair.tokenB.displaySymbol,
)} `}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/dex/_components/TotalLiquidityInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NumericFormat } from "react-number-format";
import React from "react";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

interface TotalLiquidityInfoProps {
tokenA: {
Expand Down Expand Up @@ -31,7 +31,7 @@ export function TotalLiquidityInfo(
<div className="font-medium">Total Liquidity</div>
<div className="flex mt-1">
<div className="w-1/2">
{tokenSymbolRename(props.tokenA.displaySymbol)}
{renameTokenSymbol(props.tokenA.displaySymbol)}
</div>
<div className="w-1/2 font-medium text-right">
<NumericFormat
Expand All @@ -45,7 +45,7 @@ export function TotalLiquidityInfo(
</div>
<div className="flex mt-0.5">
<div className="w-1/2">
{tokenSymbolRename(props.tokenB.displaySymbol)}
{renameTokenSymbol(props.tokenB.displaySymbol)}
</div>
<div className="w-1/2 font-medium text-right">
<NumericFormat
Expand Down
4 changes: 2 additions & 2 deletions src/pages/proof-of-backing/_components/BackingCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "react-icons/md";
import { NumericFormat } from "react-number-format";
import { TokenWithBacking } from "../index.page";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

export function BackingCard({
token,
Expand All @@ -27,7 +27,7 @@ export function BackingCard({
<div className="flex items-center">
<Icon width={28} height={28} />
<span className="pl-2 font-semibold text-gray-900 dark:text-dark-gray-900">
{tokenSymbolRename(token.displaySymbol)}
{renameTokenSymbol(token.displaySymbol)}
</span>
</div>
<div
Expand Down
6 changes: 3 additions & 3 deletions src/pages/proof-of-backing/_components/BackingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from "classnames";
import { TOKEN_BACKED_ADDRESS } from "constants/TokenBackedAddress";
import { NumericFormat } from "react-number-format";
import { TokenWithBacking } from "../index.page";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

export function BackingTable({
tokens,
Expand Down Expand Up @@ -88,7 +88,7 @@ function TableRow({
<div className="flex items-center">
<Icon width={28} height={28} />
<span className="pl-2 font-semibold text-gray-900 dark:text-dark-gray-900 group-hover:text-primary-500">
{tokenSymbolRename(token.displaySymbol)}
{renameTokenSymbol(token.displaySymbol)}
</span>
</div>
</div>
Expand All @@ -108,7 +108,7 @@ function TableRow({
displayType="text"
thousandSeparator
value={token.netSupply}
suffix={` ${tokenSymbolRename(token.displaySymbol)}`}
suffix={` ${renameTokenSymbol(token.displaySymbol)}`}
className="break-all"
data-testid={`netSupply-value-${token.displaySymbol}`}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/tokens/[id].page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { getTokenName } from "../../utils/commons/token/getTokenName";
import { isAlphanumeric, isNumeric } from "../../utils/commons/StringValidator";
import { getAllTokens } from "./shared/getAllTokens";
import { tokenSymbolRename } from "../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../utils/commons/RenameToken";

interface TokenAssetPageProps {
token: TokenData;
Expand Down Expand Up @@ -204,7 +204,7 @@ function ListLeft({
})()}
</AdaptiveList.Row>
<AdaptiveList.Row name="Symbol">
{tokenSymbolRename(token.displaySymbol)}
{renameTokenSymbol(token.displaySymbol)}
</AdaptiveList.Row>
<AdaptiveList.Row name="Mintable">
{(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/tokens/_components/TokenTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TokenData } from "@defichain/whale-api-client/dist/api/tokens";
import { getAssetIcon, getTokenIcon } from "@components/icons/assets/tokens";
import { Link } from "@components/commons/link/Link";
import { getTokenName } from "../../../utils/commons/token/getTokenName";
import { tokenSymbolRename } from "../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../utils/commons/RenameToken";

export function TokenTable({ tokens }: { tokens: TokenData[] }): JSX.Element {
return (
Expand Down Expand Up @@ -51,7 +51,7 @@ function TokenRow({ data }: { data: TokenData }): JSX.Element {
return <TokenIcon className="h-8 w-8" />;
})()}
<div className="font-medium ml-3">
{tokenSymbolRename(data.displaySymbol)}
{renameTokenSymbol(data.displaySymbol)}
{!data.isDAT && `#${data.id}`}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { EmptySection } from "@components/commons/sections/EmptySection";
import { IconTooltip } from "@components/commons/IconsTooltip";
import { getActivePrice } from "pages/vaults/utils/ActivePrice";
import { VaultNumberValues } from "../../_components/commons/VaultNumberValues";
import { tokenSymbolRename } from "../../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

export function VaultIdCollateralDetails(props: {
totalCollateralValue: string;
Expand Down Expand Up @@ -134,7 +134,7 @@ function CollateralCard(props: {
data-testid="CollateralCard.displaySymbol"
>
<div className="dark:text-gray-400">
{tokenSymbolRename(props.col.displaySymbol)}
{renameTokenSymbol(props.col.displaySymbol)}
</div>
{props.col.symbol === "DUSD" ? (
<InfoHoverPopover
Expand Down Expand Up @@ -174,7 +174,7 @@ function CollateralCard(props: {
<NumericFormat
value={new BigNumber(props.col.amount).toFixed(8)}
displayType="text"
suffix={` ${tokenSymbolRename(props.col.displaySymbol)}`}
suffix={` ${renameTokenSymbol(props.col.displaySymbol)}`}
decimalScale={8}
fixedDecimalScale
thousandSeparator
Expand Down
4 changes: 2 additions & 2 deletions src/pages/vaults/_components/commons/VaultAuctionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { VaultTokenSymbols } from "./VaultTokenSymbols";
import { AuctionTimeLeft } from "../../../auctions/_components/commons/AuctionTimeLeft";
import { BidAmountValue } from "../../../auctions/_components/commons/BidAmountValue";
import { useCalculateAuctionsValue } from "../../hooks/CalculateAuctionsValue";
import { tokenSymbolRename } from "../../../../utils/commons/TokenRename";
import { renameTokenSymbol } from "../../../../utils/commons/RenameToken";

interface VaultAuctionDetailsProps {
batch: LoanVaultLiquidationBatch;
Expand All @@ -37,7 +37,7 @@ export function AuctionsTableRow(props: VaultAuctionDetailsProps): JSX.Element {
data-testid="AuctionsTableRow.LoanToken.TokenSymbol"
/>
<span data-testid="AuctionsTableRow.LoanToken.displaySymbol">
{tokenSymbolRename(props.batch.loan.displaySymbol)}
{renameTokenSymbol(props.batch.loan.displaySymbol)}
</span>
</div>
</OverflowTable.Cell>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function tokenSymbolRename(symbol: string): string {
export function renameTokenSymbol(symbol: string): string {
return symbol.includes("dUSDT") ? symbol.replace("dUSDT", "ex_USDT") : symbol;
}

0 comments on commit 8355f7a

Please sign in to comment.