Skip to content

Commit

Permalink
remove AddressCoinBalanceHistoryChartOld
Browse files Browse the repository at this point in the history
  • Loading branch information
tom2drum committed Sep 5, 2024
1 parent c9dcfbc commit b5abddc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/api/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import type {
AddressNFTsResponse,
AddressCollectionsResponse,
AddressNFTTokensFilter,
AddressCoinBalanceHistoryChartOld,
AddressMudTables,
AddressMudTablesFilter,
AddressMudRecords,
Expand Down Expand Up @@ -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 :
Expand Down
6 changes: 0 additions & 6 deletions types/api/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions ui/address/coinBalance/AddressCoinBalanceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}));
Expand All @@ -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` }
/>
);
};
Expand Down

0 comments on commit b5abddc

Please sign in to comment.