Skip to content

Commit

Permalink
waiting for changes in substrate-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
justraman committed May 31, 2023
1 parent 92d955f commit 036e2ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
},
"peerDependencies": {
"@polkadot/types": "^10.2.1",
"@subsquid/logger": "^0.3.1",
"@subsquid/typeorm-config": "^2.0.2",
"@subsquid/util-internal-hex": "^0.0.1",
"@subsquid/logger": "^0.3.1",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.3.11"
}
Expand Down
17 changes: 9 additions & 8 deletions src/mappings/multiTokens/events/token_destroyed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ export async function tokenDestroyed(
},
})

/*
FIXME: remove listings
await ctx.store
// fix later
await (ctx.store as any)
.em()
.getRepository(ListingStatus)
.query(
'DELETE FROM listing_status USING listing WHERE listing_status.listing_id = listing.id AND listing.make_asset_id_id = $1',
[token.id]
) */
)

const makeListings = await ctx.store.findBy(Listing, {
makeAssetId: {
Expand All @@ -78,13 +78,14 @@ export async function tokenDestroyed(

const listings = [...makeListings, ...takeListings]
await ctx.store.remove(listings)
// FIXME:
// await ctx.store.delete(TraitToken, { token: { id: token.id } })

const traitTokens = await ctx.store.findBy(TraitToken, { token: { id: token.id } })
await ctx.store.remove(traitTokens)
// TODO: We are removing all events that are related to this token.
// We should only update the events that have relationship so it is null.
// await ctx.store.delete(Event, { tokenId: token.id })
// FIXME:
// await ctx.store.delete(AccountTokenEvent, { token: { id: token.id } })
const accountTokenEvents = await ctx.store.findBy(AccountTokenEvent, { token: { id: token.id } })
await ctx.store.remove(accountTokenEvents)
await ctx.store.remove(attributes)
}

Expand Down
4 changes: 3 additions & 1 deletion src/services/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export class CollectionService {
private floorQuery = `SELECT MIN("listing"."highest_price") AS floor_price FROM "listing" AS "listing" INNER JOIN "token" "token" ON "token"."id" = "listing"."make_asset_id_id" INNER JOIN "collection" "collection" ON "collection"."id" = "token"."collection_id" WHERE "collection"."id" = $1 AND
(SELECT count(*) FROM "listing_status" AS "listing_status" WHERE "listing_status"."type" = 'Active' AND "listing_status"."listing_id" = "listing"."id") = (SELECT count(*) FROM "listing_status" AS "listing_status_1" WHERE "listing_status_1"."listing_id" = "listing"."id")`

async sync(collectionId: string) {
async sync(collectionId: string) {}

async sync1(collectionId: string) {
if (!collectionId) throw new Error('null collectionId not allowed')

const promises = [
Expand Down

0 comments on commit 036e2ae

Please sign in to comment.