Skip to content

Commit

Permalink
fix: address_coin_balance_chart api
Browse files Browse the repository at this point in the history
  • Loading branch information
KieSun committed Jul 22, 2024
1 parent c6f50cd commit decd605
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/api/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import type {
AddressTransactionsResponse,
AddressTokenTransferResponse,
AddressCoinBalanceHistoryResponse,
AddressCoinBalanceHistoryChart,
AddressBlocksValidatedResponse,
AddressInternalTxsResponse,
AddressTxsFilters,
AddressTokenTransferFilters,
AddressTokensFilter,
AddressTokensResponse,
AddressWithdrawalsResponse, AddressAspectResponse } from 'types/api/address';
AddressWithdrawalsResponse, AddressAspectResponse, AddressCoinBalanceHistoryChartResponse,
} from 'types/api/address';
import type { AddressesResponse } from 'types/api/addresses';
import type {
BlocksResponse,
Expand Down Expand Up @@ -723,7 +723,7 @@ export type ResourcePayload<Q extends ResourceName> = Q extends 'user_info'
: Q extends 'address_coin_balance'
? AddressCoinBalanceHistoryResponse
: Q extends 'address_coin_balance_chart'
? AddressCoinBalanceHistoryChart
? AddressCoinBalanceHistoryChartResponse
: Q extends 'address_logs'
? LogsResponseAddress
: Q extends 'address_tokens'
Expand Down
5 changes: 5 additions & 0 deletions types/api/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ export type AddressCoinBalanceHistoryChart = Array<{
value: string;
}>

export interface AddressCoinBalanceHistoryChartResponse {
items: AddressCoinBalanceHistoryChart;
days: number;
}

export interface AddressBlocksValidatedResponse {
items: Array<Block>;
next_page_params: {
Expand Down
2 changes: 1 addition & 1 deletion ui/address/coinBalance/AddressCoinBalanceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AddressCoinBalanceChart = ({ addressHash }: Props) => {
pathParams: { hash: addressHash },
});

const items = React.useMemo(() => data?.map(({ date, value }) => ({
const items = React.useMemo(() => data?.items.map(({ date, value }) => ({
date: new Date(date),
value: BigNumber(value).div(10 ** config.chain.currency.decimals).toNumber(),
})), [ data ]);
Expand Down

0 comments on commit decd605

Please sign in to comment.