From 708a3125de8c94c131da89eaba00fb13964206b7 Mon Sep 17 00:00:00 2001 From: Raman Shekhawat Date: Wed, 26 Jun 2024 02:56:58 +0530 Subject: [PATCH] do not force metadata on atrribute update --- src/mappings/multiTokens/events/attribute_removed.ts | 4 ++-- src/mappings/multiTokens/events/attribute_set.ts | 8 ++++---- src/mappings/multiTokens/events/minted.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mappings/multiTokens/events/attribute_removed.ts b/src/mappings/multiTokens/events/attribute_removed.ts index 140c958c5..2941645d0 100644 --- a/src/mappings/multiTokens/events/attribute_removed.ts +++ b/src/mappings/multiTokens/events/attribute_removed.ts @@ -64,7 +64,7 @@ export async function attributeRemoved( token.attributeCount -= 1 await ctx.store.save(token) - processMetadata(token.id, 'token', true) + processMetadata(token.id, 'token') computeTraits(data.collectionId.toString()) } else if (attribute.collection) { const collection = await ctx.store.findOne(Collection, { @@ -78,7 +78,7 @@ export async function attributeRemoved( collection.attributeCount -= 1 await ctx.store.save(collection) - processMetadata(collection.id, 'collection', true) + processMetadata(collection.id, 'collection') } await ctx.store.remove(attribute) diff --git a/src/mappings/multiTokens/events/attribute_set.ts b/src/mappings/multiTokens/events/attribute_set.ts index b5e88a3f7..698ac8b78 100644 --- a/src/mappings/multiTokens/events/attribute_set.ts +++ b/src/mappings/multiTokens/events/attribute_set.ts @@ -126,13 +126,13 @@ export async function attributeSet( token.metadata = new Metadata() } await ctx.store.save(token) - processMetadata(token.id, 'token', true) + processMetadata(token.id, 'token') } else if (collection) { if (!collection.metadata) { collection.metadata = new Metadata() } await ctx.store.save(collection) - processMetadata(collection.id, 'collection', true, true) + processMetadata(collection.id, 'collection', false, true) } await ctx.store.save(attribute) } else { @@ -155,14 +155,14 @@ export async function attributeSet( } token.attributeCount += 1 await ctx.store.save(token) - processMetadata(token.id, 'token', true) + processMetadata(token.id, 'token', !skipSave) } else if (collection) { if (!collection.metadata) { collection.metadata = new Metadata() } collection.attributeCount += 1 await ctx.store.save(collection) - processMetadata(collection.id, 'collection', true, true) + processMetadata(collection.id, 'collection', !skipSave, !skipSave) } } if (token) { diff --git a/src/mappings/multiTokens/events/minted.ts b/src/mappings/multiTokens/events/minted.ts index 730056021..eaa810a4c 100644 --- a/src/mappings/multiTokens/events/minted.ts +++ b/src/mappings/multiTokens/events/minted.ts @@ -122,7 +122,7 @@ export async function minted( await Promise.all(promises) - processMetadata(token.id, 'token', true) + processMetadata(token.id, 'token') computeTraits(data.collectionId.toString()) syncCollectionStats(data.collectionId.toString())