Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: do not force metadata on attrribute update #1146

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading