Skip to content

Commit

Permalink
refactor: do not force metadata on attrribute update (#1146)
Browse files Browse the repository at this point in the history
do not force metadata on atrribute update
  • Loading branch information
justraman authored Jun 25, 2024
1 parent db2f0fb commit 22a07a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/mappings/multiTokens/events/attribute_removed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>(Collection, {
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/mappings/multiTokens/events/attribute_set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/multiTokens/events/minted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit 22a07a4

Please sign in to comment.