From b08e855c748b1931fe6e58eebfa5f906aba82433 Mon Sep 17 00:00:00 2001 From: Fabian Bormann Date: Fri, 10 May 2024 13:45:28 +0200 Subject: [PATCH] fix: adapt new Koios api response to fix loading the NFT list --- src/global/api.ts | 4 ++-- src/global/types.ts | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/global/api.ts b/src/global/api.ts index 0e2300a..53a7e54 100644 --- a/src/global/api.ts +++ b/src/global/api.ts @@ -71,7 +71,7 @@ export const getNFTsFromStakeAddress = async (stakeAddress: string) => { await defaultAxios.post(`${koiosBaseUrl}account_assets`, { _stake_addresses: [stakeAddress], }) - ).data[0] as NftFetchResponse; + ).data as NftFetchResponse[]; } catch (error) { const axiosError = error as AxiosError; console.log(axiosError); @@ -83,7 +83,7 @@ export const getNFTsFromStakeAddress = async (stakeAddress: string) => { return ( await defaultAxios.post(`${koiosBaseUrl}asset_info`, { - _asset_list: nftFetchResponse.asset_list.map((asset) => [ + _asset_list: nftFetchResponse.map((asset) => [ asset.policy_id, asset.asset_name, ]), diff --git a/src/global/types.ts b/src/global/types.ts index 9da1658..95cb6e8 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -34,13 +34,11 @@ export type HeaderProps = { export type NftFetchResponse = { stake_address: string; - asset_list: Array<{ - decimals: number; - quantity: number; - policy_id: string; - asset_name: string; - fingerprint: string; - }>; + decimals: number; + quantity: number; + policy_id: string; + asset_name: string; + fingerprint: string; }; export type NFTDetail = {