Skip to content

Commit

Permalink
Merge pull request #134 from kodadot/main
Browse files Browse the repository at this point in the history
🔖 Stick v6.0.2
  • Loading branch information
vikiival authored Oct 25, 2023
2 parents e47cbd6 + 74fda95 commit a99d2c1
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/mappings/nfts/burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function handleTokenBurn(context: Context): Promise<void> {

await burnHandler(context, entity)

success(OPERATION, `${id} by ${event.caller}}`)
success(OPERATION, `${id} by ${event.caller}`)
await context.store.save(entity)
const meta = entity.metadata ?? ''
await createEvent(entity, OPERATION, event, meta, context.store)
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/nfts/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionOwnerChange(context: Context): Promise<voi
const entity = await get(context.store, CE, event.id)
entity.currentOwner = event.owner

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
2 changes: 1 addition & 1 deletion src/mappings/nfts/changeTeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export async function handleCollectionTeamChange(context: Context): Promise<void

entity.issuer = event.issuer

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
2 changes: 1 addition & 1 deletion src/mappings/nfts/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionDestroy(context: Context): Promise<void> {
const entity = await get(context.store, CE, event.id)
entity.burned = true

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
2 changes: 1 addition & 1 deletion src/mappings/nfts/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionLock(context: Context): Promise<void> {
const entity = await get(context.store, CE, event.id)
entity.max = event.max

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
6 changes: 2 additions & 4 deletions src/mappings/nfts/setAttribute.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getOrFail as get } from '@kodadot1/metasquid/entity'
import { CollectionEntity, NFTEntity } from '../../model'
import { unwrap } from '../utils/extract'
import { addressOf } from '../utils/helper'
import { Context, isNFT } from '../utils/types'
import { getAttributeEvent } from './getters'
import { attributeFrom, tokenIdOf } from './types'
Expand All @@ -13,13 +12,12 @@ export async function handleAttributeSet(context: Context): Promise<void> {
isNFT(event)
? await get(context.store, NFTEntity, tokenIdOf(event as any))
: await get(context.store, CollectionEntity, event.collectionId)

if (!final.attributes) {
final.attributes = []
}

if ('royalty' in final && event.trait === 'royalty') {
final.royalty = final.royalty ?? Number.parseInt(event.value as string)
final.royalty = final.royalty ?? Number.parseFloat(event.value as string)
}

if ('recipient' in final && event.trait === 'recipient') {
Expand All @@ -32,7 +30,7 @@ export async function handleAttributeSet(context: Context): Promise<void> {
const attribute = final.attributes?.find((attr) => attr.trait === event.trait)
if (attribute) {
attribute.value = String(event.value)
} else {
} else if (event.trait !== 'royalty' && event.trait !== 'recipient') {
const newAttribute = attributeFrom({ trait_type: event.trait, value: String(event.value) })
final.attributes?.push(newAttribute)
}
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/uniques/burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function handleTokenBurn(context: Context): Promise<void> {

await burnHandler(context, entity)

success(OPERATION, `${id} by ${event.caller}}`)
success(OPERATION, `${id} by ${event.caller}`)
await context.store.save(entity)
const meta = entity.metadata ?? ''
await createEvent(entity, OPERATION, event, meta, context.store)
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/uniques/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionOwnerChange(context: Context): Promise<voi
const entity = await get(context.store, CE, event.id)
entity.currentOwner = event.owner

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
2 changes: 1 addition & 1 deletion src/mappings/uniques/changeTeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionTeamChange(context: Context): Promise<void
const entity = await get(context.store, CE, event.id)
entity.issuer = event.issuer

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
2 changes: 1 addition & 1 deletion src/mappings/uniques/destroy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionDestroy(context: Context): Promise<void> {
const entity = await get(context.store, CE, event.id)
entity.burned = true

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}
2 changes: 1 addition & 1 deletion src/mappings/uniques/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export async function handleCollectionLock(context: Context): Promise<void> {
const entity = await get(context.store, CE, event.id)
entity.max = event.max

success(OPERATION, `${event.id} by ${event.caller}}`)
success(OPERATION, `${event.id} by ${event.caller}`)
await context.store.save(entity)
}

0 comments on commit a99d2c1

Please sign in to comment.