From b5abddce2110f6120ad369ad68f56e47a9cacc36 Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 5 Sep 2024 15:54:13 +0200 Subject: [PATCH] remove AddressCoinBalanceHistoryChartOld --- lib/api/resources.ts | 3 +-- types/api/address.ts | 6 ------ ui/address/coinBalance/AddressCoinBalanceChart.tsx | 5 ++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/api/resources.ts b/lib/api/resources.ts index b53076521c..588d9d2140 100644 --- a/lib/api/resources.ts +++ b/lib/api/resources.ts @@ -31,7 +31,6 @@ import type { AddressNFTsResponse, AddressCollectionsResponse, AddressNFTTokensFilter, - AddressCoinBalanceHistoryChartOld, AddressMudTables, AddressMudTablesFilter, AddressMudRecords, @@ -1042,7 +1041,7 @@ Q extends 'address_internal_txs' ? AddressInternalTxsResponse : Q extends 'address_token_transfers' ? AddressTokenTransferResponse : Q extends 'address_blocks_validated' ? AddressBlocksValidatedResponse : Q extends 'address_coin_balance' ? AddressCoinBalanceHistoryResponse : -Q extends 'address_coin_balance_chart' ? AddressCoinBalanceHistoryChartOld | AddressCoinBalanceHistoryChart : +Q extends 'address_coin_balance_chart' ? AddressCoinBalanceHistoryChart : Q extends 'address_logs' ? LogsResponseAddress : Q extends 'address_tokens' ? AddressTokensResponse : Q extends 'address_nfts' ? AddressNFTsResponse : diff --git a/types/api/address.ts b/types/api/address.ts index d8235125e0..2fe4e2d3ab 100644 --- a/types/api/address.ts +++ b/types/api/address.ts @@ -142,12 +142,6 @@ export interface AddressCoinBalanceHistoryResponse { } | null; } -// remove after api release -export type AddressCoinBalanceHistoryChartOld = Array<{ - date: string; - value: string; -}> - export type AddressCoinBalanceHistoryChart = { items: Array<{ date: string; diff --git a/ui/address/coinBalance/AddressCoinBalanceChart.tsx b/ui/address/coinBalance/AddressCoinBalanceChart.tsx index 15003058a4..94542df368 100644 --- a/ui/address/coinBalance/AddressCoinBalanceChart.tsx +++ b/ui/address/coinBalance/AddressCoinBalanceChart.tsx @@ -20,8 +20,7 @@ const AddressCoinBalanceChart = ({ addressHash }: Props) => { return undefined; } - const dataItems = 'items' in data ? data.items : data; - return dataItems.map(({ date, value }) => ({ + return data.items.map(({ date, value }) => ({ date: new Date(date), value: BigNumber(value).div(10 ** config.chain.currency.decimals).toNumber(), })); @@ -35,7 +34,7 @@ const AddressCoinBalanceChart = ({ addressHash }: Props) => { isLoading={ isPending } h="300px" units={ currencyUnits.ether } - emptyText={ data && 'days' in data && `Insufficient data for the past ${ data.days } days` } + emptyText={ data?.days && `Insufficient data for the past ${ data.days } days` } /> ); };