diff --git a/framework/src/modules/nft/method.ts b/framework/src/modules/nft/method.ts index 48731fdc3b..c1443aabb6 100644 --- a/framework/src/modules/nft/method.ts +++ b/framework/src/modules/nft/method.ts @@ -711,6 +711,8 @@ export class NFTMethod extends BaseMethod { await supportedNFTsStore.del(methodContext, key); } + await supportedNFTsStore.del(methodContext, ALL_SUPPORTED_NFTS_KEY); + this.events.get(AllNFTsSupportRemovedEvent).log(methodContext); } diff --git a/framework/test/unit/modules/nft/method.spec.ts b/framework/test/unit/modules/nft/method.spec.ts index 991d64ebf1..6f4e07a140 100644 --- a/framework/test/unit/modules/nft/method.spec.ts +++ b/framework/test/unit/modules/nft/method.spec.ts @@ -1189,6 +1189,20 @@ describe('NFTMethod', () => { checkEventResult(methodContext.eventQueue, 1, AllNFTsSupportRemovedEvent, 0, {}, null); }); + + it('should remove all existing entries even if the ALL_SUPPORTED_NFTS_KEY entry exists', async () => { + await supportedNFTsStore.save(methodContext, ALL_SUPPORTED_NFTS_KEY, { + supportedCollectionIDArray: [], + }); + + await expect(method.removeSupportAllNFTs(methodContext)).resolves.toBeUndefined(); + await expect( + supportedNFTsStore.has(methodContext, ALL_SUPPORTED_NFTS_KEY), + ).resolves.toBeFalse(); + + checkEventResult(methodContext.eventQueue, 1, AllNFTsSupportRemovedEvent, 0, {}, null); + expect(methodContext.eventQueue.getEvents()).toHaveLength(1); + }); }); describe('supportAllNFTsFromChain', () => {