diff --git a/packages/assets-controllers/src/NftController.test.ts b/packages/assets-controllers/src/NftController.test.ts index 1eef6f7035..3dce16119e 100644 --- a/packages/assets-controllers/src/NftController.test.ts +++ b/packages/assets-controllers/src/NftController.test.ts @@ -272,7 +272,7 @@ describe('NftController', () => { collection: 'FOO', contract_standard: 'erc721', name: 'Name', - supply: 0, + total_supply: 0, }) .get(`/collections/FOO`) .reply(200, { @@ -286,7 +286,7 @@ describe('NftController', () => { collection: 'FOU', contract_standard: 'erc721', name: 'FOU', - supply: 0, + total_supply: 0, }) .get(`/collections/FOO`) .reply(200, { @@ -1288,7 +1288,7 @@ describe('NftController', () => { collection: 'Kudos', contract_standard: 'erc721', name: 'Name', - supply: 10, + total_supply: 10, }); nock('https://ipfs.gitcoin.co:443') @@ -1845,7 +1845,7 @@ describe('NftController', () => { collection: 'KDO', contract_standard: 'erc721', name: 'Kudos', - supply: 10, + total_supply: 10, }) .get(`/collections/KDO`) .reply(200, { diff --git a/packages/assets-controllers/src/NftController.ts b/packages/assets-controllers/src/NftController.ts index b3e1d7baa6..cb0351122a 100644 --- a/packages/assets-controllers/src/NftController.ts +++ b/packages/assets-controllers/src/NftController.ts @@ -105,7 +105,7 @@ export type OpenSeaV2Contract = { collection: string; contract_standard: string; name: string; - supply: number; + total_supply?: number; }; export type OpenSeaV2Collection = { @@ -125,6 +125,7 @@ export type OpenSeaV2Collection = { telegram_url?: string; twitter_username?: string; instagram_username?: string; + total_supply?: number; }; /** diff --git a/packages/assets-controllers/src/NftDetectionController.test.ts b/packages/assets-controllers/src/NftDetectionController.test.ts index 70a959aeae..1ecdfa5064 100644 --- a/packages/assets-controllers/src/NftDetectionController.test.ts +++ b/packages/assets-controllers/src/NftDetectionController.test.ts @@ -166,7 +166,7 @@ describe('NftDetectionController', () => { collection: 'Name', contract_standard: 'erc721', name: 'Name', - supply: 0, + total_supply: 0, }) .get( `/chain/ethereum/contract/0xebE4e5E773AFD2bAc25De0cFafa084CFb3cBf1eD`, @@ -177,7 +177,7 @@ describe('NftDetectionController', () => { collection: 'Name HH', contract_standard: 'erc721', name: 'Name HH', - supply: 10, + total_supply: 10, }) .get(`/collections/Name%20HH`) .reply(200, { @@ -694,7 +694,7 @@ describe('NftDetectionController', () => { collection: 'Name GG', contract_standard: 'erc721', name: 'Name GG', - supply: 10, + total_supply: 10, }) .get(`/collections/Name%20GG`) .reply(200, { @@ -710,7 +710,7 @@ describe('NftDetectionController', () => { collection: 'Name II', contract_standard: 'erc721', name: 'Name II', - supply: 10, + total_supply: 10, }) .get(`/collections/Name%20II`) .reply(200, { @@ -878,7 +878,7 @@ describe('NftDetectionController', () => { collection: 'mycollection', contract_standard: 'erc721', name: 'myname', - supply: 0, + total_supply: 0, }) .get(`/collections/mycollection`) .reply(200, {}); diff --git a/packages/assets-controllers/src/assetsUtil.ts b/packages/assets-controllers/src/assetsUtil.ts index c9d5db5e14..65c0a76e67 100644 --- a/packages/assets-controllers/src/assetsUtil.ts +++ b/packages/assets-controllers/src/assetsUtil.ts @@ -376,7 +376,10 @@ export function mapOpenSeaContractV2ToV1( created_date: null, schema_name: contract.contract_standard.toUpperCase(), symbol: null, - total_supply: contract.supply.toString(), + total_supply: + collection?.total_supply?.toString() ?? + contract.total_supply?.toString() ?? + null, description: collection?.description ?? null, external_link: collection?.project_url ?? null, collection: {