Skip to content

Commit

Permalink
fix: adapt new Koios api response to fix loading the NFT list
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbormann committed May 10, 2024
1 parent 0c751cf commit b08e855
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/global/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
]),
Expand Down
12 changes: 5 additions & 7 deletions src/global/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit b08e855

Please sign in to comment.