Skip to content

Commit

Permalink
fix fuelTank destroy mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
justraman committed Oct 12, 2023
1 parent a68b59b commit 2d93b58
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mappings/fuelTanks/events/fuelTankDestroyed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ export async function fuelTankDestroyed(

const tankId = u8aToHex(eventData.tankId)

await ctx.store.delete(PermittedExtrinsics, { ruleSet: { tank: { id: tankId } } })
const pE = await ctx.store.find(PermittedExtrinsics, {
relations: { ruleSet: true },
where: { ruleSet: { tank: { id: tankId } } },
})

await ctx.store.remove(pE)
await Promise.all([
ctx.store.delete(FuelTankRuleSet, { tank: { id: tankId } }),
ctx.store.delete(FuelTankAccountRules, { tank: { id: tankId } }),
])

ctx.store.delete(FuelTank, { tank: { id: tankId } })
ctx.store.delete(FuelTank, { id: tankId })

return new EventModel({
id: item.event.id,
Expand Down

0 comments on commit 2d93b58

Please sign in to comment.