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

fix: Update SDK and use prettifyCurrency from SDK #7

Merged
merged 1 commit into from
Dec 1, 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,275 changes: 932 additions & 343 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@covalenthq/client-sdk": "^0.6.3",
"@covalenthq/client-sdk": "^0.6.5",
"@headlessui/react": "^1.7.17",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { LineChart } from "@tremor/react";
import { prettyCurrency, rootColor, timestampParser } from "@/utils/functions";
import { rootColor, timestampParser } from "@/utils/functions";
import { TypographyH4 } from "@/components/ui/typography";
import { calculatePrettyBalance } from "@covalenthq/client-sdk";
import { calculatePrettyBalance, prettifyCurrency } from "@covalenthq/client-sdk";
import { Skeleton } from "@/components/ui/skeleton";
import {
CURRENCY,
Expand All @@ -19,11 +19,11 @@
chain_name,
collection_address,
}) => {
const [maybeResult, setResult] = useState<Option<any[]>>(None);

Check warning on line 22 in src/components/Molecules/NFTs/NFTFloorPriceView/NFTFloorPriceView.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const [period, setPeriod] = useState<PERIOD>(PERIOD.DAYS_7);
const [currency, setCurrency] = useState<CURRENCY>(CURRENCY.USD);
const [nativeCurrency, setNativeCurrency] = useState<Option<string>>(None);
const [chartColor, setColor] = useState<any>("");

Check warning on line 26 in src/components/Molecules/NFTs/NFTFloorPriceView/NFTFloorPriceView.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const { covalentClient } = useGoldrush();

useEffect(() => {
Expand All @@ -40,7 +40,7 @@
setColor(rootColor());
setResult(
new Some(
response.data.items.map((x: any) => {

Check warning on line 43 in src/components/Molecules/NFTs/NFTFloorPriceView/NFTFloorPriceView.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const dt = timestampParser(x.date, "DD MMM YY");
return {
date: dt,
Expand Down Expand Up @@ -84,7 +84,7 @@
index="date"
valueFormatter={
currency === CURRENCY.USD
? prettyCurrency
? prettifyCurrency
: undefined
}
categories={[
Expand Down
5 changes: 3 additions & 2 deletions src/components/Molecules/NFTs/NFTVolumeView/NFTVolumeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Option, None, Some } from "@/utils/option";
import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { LineChart } from "@tremor/react";
import { prettyCurrency, rootColor, timestampParser } from "@/utils/functions";
import { rootColor, timestampParser } from "@/utils/functions";
import { TypographyH4 } from "@/components/ui/typography";
import { Skeleton } from "@/components/ui/skeleton";
import {
Expand All @@ -13,6 +13,7 @@ import {
import { CHART_COLORS } from "@/utils/constants/shared.constants";
import { useGoldrush } from "@/utils/store/Goldrush";
import { type NFTVolumeViewProps } from "@/utils/types/molecules.types";
import { prettifyCurrency } from "@covalenthq/client-sdk";

export const NFTVolumeView: React.FC<NFTVolumeViewProps> = ({
chain_name,
Expand Down Expand Up @@ -77,7 +78,7 @@ export const NFTVolumeView: React.FC<NFTVolumeViewProps> = ({
index="date"
valueFormatter={
currency === CURRENCY.USD
? prettyCurrency
? prettifyCurrency
: undefined
}
categories={[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GRK_SIZES } from "@/utils/constants/shared.constants";
import { type Option, Some, None } from "@/utils/option";
import { type NftTokenContractBalanceItem } from "@covalenthq/client-sdk";
import { prettifyCurrency, type NftTokenContractBalanceItem } from "@covalenthq/client-sdk";
import { useEffect, useState } from "react";
import {
Card,
Expand All @@ -14,7 +14,6 @@ import { AccountCardView } from "@/components/Molecules/AccountCardView/AccountC
import { type NFTWalletCollectionViewProps } from "@/utils/types/organisms.types";
import { Skeleton } from "@/components/ui/skeleton";
import { sum } from "lodash";
import { prettyCurrency } from "@/utils/functions";
import { useGoldrush } from "@/utils/store/Goldrush";

export const NFTWalletCollectionView: React.FC<
Expand Down Expand Up @@ -123,7 +122,7 @@ export const NFTWalletCollectionView: React.FC<
)
);
return (
<span>{prettyCurrency(s)}</span>
<span>{prettifyCurrency(s, 2, "USD", true)}</span>
);
},
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GRK_SIZES } from "@/utils/constants/shared.constants";
import { type Option, Some, None } from "@/utils/option";
import { type NftTokenContractBalanceItem } from "@covalenthq/client-sdk";
import { prettifyCurrency, type NftTokenContractBalanceItem } from "@covalenthq/client-sdk";
import { useEffect, useState } from "react";
import {
Card,
Expand All @@ -11,7 +11,6 @@ import {
import { flatMap, sum } from "lodash";
import { AccountCardView } from "@/components/Molecules/AccountCardView/AccountCardView";
import { Skeleton } from "@/components/ui/skeleton";
import { prettyCurrency } from "@/utils/functions";
import { useGoldrush } from "@/utils/store/Goldrush";
import { type NFTWalletTokenListViewProps } from "@/utils/types/organisms.types";

Expand Down Expand Up @@ -112,7 +111,7 @@ export const NFTWalletTokenListView: React.FC<NFTWalletTokenListViewProps> = ({
)
);
return (
<span>{prettyCurrency(s)}</span>
<span>{prettifyCurrency(s, 2, "USD", true)}</span>
);
},
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
type BalanceItem,
type ChainItem,
calculatePrettyBalance,
prettifyCurrency
} from "@covalenthq/client-sdk";
import { useEffect, useState } from "react";
import {
Expand Down Expand Up @@ -33,7 +34,7 @@ import { Checkbox } from "@/components/ui/checkbox";
import { Skeleton } from "@/components/ui/skeleton";
import { TokenAvatar } from "../../../Atoms/TokenAvatar/TokenAvatar";
import { Button } from "@/components/ui/button";
import { prettyCurrency, timestampParser } from "@/utils/functions";
import { timestampParser } from "@/utils/functions";
import { BalancePriceDelta } from "@/components/Atoms/BalancePriceDelta/BalancePriceDelta";
import { AccountCardView } from "@/components/Molecules/AccountCardView/AccountCardView";
import { TableHeaderSorting } from "@/components/ui/tableHeaderSorting";
Expand Down Expand Up @@ -232,7 +233,7 @@ export const TokenBalancesListView: React.FC<TokenBalancesListViewProps> = ({
return (
<div className="text-right">
{" "}
{prettyCurrency(row.getValue("quote_rate"))}{" "}
{prettifyCurrency(row.getValue("quote_rate"), 2, "USD", true)}{" "}
</div>
);
},
Expand Down Expand Up @@ -628,7 +629,7 @@ export const TokenBalancesListView: React.FC<TokenBalancesListViewProps> = ({
),
Some: (result) => {
const s = sum(result.map((x) => x.quote));
return <span>{prettyCurrency(s)}</span>;
return <span>{prettifyCurrency(s, 2, "USD", true)}</span>;
},
})}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type ChainItem,
type Pagination,
calculatePrettyBalance,
prettifyCurrency,
} from "@covalenthq/client-sdk";
import { type TIME_SERIES_GROUP } from "@/utils/constants/shared.constants";
import { Fragment, useEffect, useState } from "react";
Expand All @@ -29,8 +30,7 @@ import { TokenAvatar } from "../../../Atoms/TokenAvatar/TokenAvatar";
import {
timestampParser,
truncate,
calculateTimeSeriesGroup,
prettyCurrency,
calculateTimeSeriesGroup
} from "@/utils/functions";
import { Badge } from "@/components/ui/badge";
import { AccountCardView } from "@/components/Molecules/AccountCardView/AccountCardView";
Expand Down Expand Up @@ -170,7 +170,7 @@ const columns: ColumnDef<BlockTransactionWithContractTransfers>[] = [
cell: ({ row }) => {
return (
<div className="text-right">
{prettyCurrency(row.original.transfers[0].delta_quote)}
{prettifyCurrency(row.original.transfers[0].delta_quote, 2, "USD", true)}
</div>
);
},
Expand Down
Loading