Skip to content

Commit

Permalink
Merge pull request #234 from kodadot/main
Browse files Browse the repository at this point in the history
🔖 Speck fix
  • Loading branch information
vikiival authored Mar 12, 2024
2 parents 0f79ba7 + 486b765 commit 4ba03ad
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/subsquid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
- name: install @subsquid/cli
run: npm install --location=global @subsquid/cli
- name: auth subsquid
Expand Down
16 changes: 13 additions & 3 deletions src/mappings/shared/token/tokenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export class TokenAPI {
debug(OPERATION, { removeNftFromToken: `Unlink NFT ${nft.id} from TOKEN ${token.id}` })

await emOf(this.store).update(NE, nft.id, { token: null })
const updatedCount = token.count - 1
const updatedCount = await emOf(this.store).countBy(NE, {
token: {
id: token.id,
},
})
await emOf(this.store).update(TE, token.id, {
supply: token.supply - 1,
count: updatedCount,
Expand All @@ -53,8 +57,14 @@ export class TokenAPI {

if (updatedCount === 0) {
debug(OPERATION, { deleteEmptyToken: `delete empty token ${token.id}` })

await emOf(this.store).delete(TE, token.id)
try {
await emOf(this.store).delete(TE, token.id)
} catch (error) {
debug(OPERATION, {
deleteEmptyToken: `Failed to delete token ${token.id}`,
error,
})
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/mappings/shared/token/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ export const tokenName = (nftName: string | undefined | null, collectionId: stri

return doNotAlter ? nftName : nftName.replace(/([#_]\d+$)/g, '')
}

0 comments on commit 4ba03ad

Please sign in to comment.