diff --git a/CHANGELOG.md b/CHANGELOG.md index de65cc48..a307505b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### vNext - Fixed fractional Matic balance transfer issue -- Updated Freeport URLs +- Fixed deprecated API usage ### v1.29.0 diff --git a/src/api/freeport-api.service.ts b/src/api/freeport-api.service.ts index 549cd75e..7b83c917 100644 --- a/src/api/freeport-api.service.ts +++ b/src/api/freeport-api.service.ts @@ -36,7 +36,7 @@ export class FreeportApiService { public static async getMinterCollections(minter: string): Promise { try { - const { data } = await api.get(`/wallet/${minter}/collections`); + const { data } = await api.get(`/api/wallet/${minter}/collections`); return Array.isArray(data) ? data.filter((item: unknown) => freeportCollectionValidator(item)) : []; } catch (err: any) { reportError(err); diff --git a/src/api/interfaces/freeport-nft.interface.ts b/src/api/interfaces/freeport-nft.interface.ts index ec26ded6..ef2bc16b 100644 --- a/src/api/interfaces/freeport-nft.interface.ts +++ b/src/api/interfaces/freeport-nft.interface.ts @@ -1,9 +1,6 @@ export interface FreeportNftInterface { nftId: string; - minter: string; - collectionAddress: string | null; - supply: number; - quantity: number; - priceInUsdCents: number; - priceInCereUnits: number; + collection: { + address: string; + }; } diff --git a/src/api/validators/freeport-nft.validator.ts b/src/api/validators/freeport-nft.validator.ts index 890987fb..29d218f4 100644 --- a/src/api/validators/freeport-nft.validator.ts +++ b/src/api/validators/freeport-nft.validator.ts @@ -3,12 +3,11 @@ import * as yup from 'yup'; let schema = yup.object().shape({ nftId: yup.string().required(), - minter: yup.string().required(), - collectionAddress: yup.string().nullable(true), - supply: yup.number().required(), - quantity: yup.number().required(), - priceInUsdCents: yup.number().required(), - priceInCereUnits: yup.number().required(), + collection: yup + .object({ + address: yup.string().required(), + }) + .required(), }); export const freeportNftValidator = (data: unknown): data is FreeportNftInterface => { diff --git a/src/stores/CollectiblesStore/CollectionStore.ts b/src/stores/CollectiblesStore/CollectionStore.ts index 021436bd..5e6e0683 100644 --- a/src/stores/CollectiblesStore/CollectionStore.ts +++ b/src/stores/CollectiblesStore/CollectionStore.ts @@ -56,7 +56,7 @@ export class CollectiblesStore { const freeportNfts = await FreeportApiService.getWalletNftList(wallet); const nftIds: string[] = freeportNfts.map((nft) => nft.nftId); - const minters: string[] = freeportNfts.map((nft) => nft.minter); + const minters: string[] = freeportNfts.map((nft) => '').filter(Boolean); const cids = await Promise.all(nftIds.map(FreeportApiService.getNftCids)); const assets = await Promise.all(cids.map((cid, i) => DdcApiService.getAssetInfo(minters[i], cid[0]))); const collections = await Promise.all(Array.from(new Set(minters)).map(FreeportApiService.getMinterCollections)); @@ -66,15 +66,15 @@ export class CollectiblesStore { const result = freeportNfts.map((nft, i) => ({ nftId: nft.nftId, - minter: nft.minter, + minter: '', // TODO: Add to the API title: assets[i]?.contentMetadata?.title || nft.nftId, description: assets[i]?.contentMetadata?.description, previewUrl: cids[i]?.length > 0 ? `${REACT_APP_DDC_API}/assets/v2/${minters[i]}/${cids[i][0]}/preview` : undefined, network: 'CERE', - collectionAddress: nft.collectionAddress ? nft.collectionAddress : undefined, - collectionName: nft.collectionAddress ? collectionKeyMap[nft.collectionAddress] : undefined, - quantity: nft.quantity, + collectionAddress: nft.collection ? nft.collection.address : undefined, + collectionName: nft.collection ? collectionKeyMap[nft.collection.address] : undefined, + quantity: 0, // TODO: Add to the API })); runInAction(() => {