Skip to content

Commit

Permalink
feat: update processor to 8.5.0 (#1197)
Browse files Browse the repository at this point in the history
* update processor to 8.5.0

* fix attempted
  • Loading branch information
justraman authored Jul 26, 2024
1 parent 88beec8 commit 3fd83cb
Show file tree
Hide file tree
Showing 8 changed files with 14,930 additions and 667 deletions.
11 changes: 11 additions & 0 deletions db/migrations/1721915534639-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = class Data1721915534639 {
name = 'Data1721915534639'

async up(db) {
await db.query(`CREATE INDEX "IDX_2e957c007c0f7ec5fc1dc4b5d5" ON "collection" ("hidden") `)
}

async down(db) {
await db.query(`DROP INDEX "public"."IDX_2e957c007c0f7ec5fc1dc4b5d5"`)
}
}
15,551 changes: 14,896 additions & 655 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@subsquid/cli": "^2.12.0",
"@subsquid/graphql-server": "^4.6.0",
"@subsquid/ss58": "^2.0.2",
"@subsquid/substrate-processor": "^8.3.1",
"@subsquid/substrate-processor": "^8.5.0",
"@subsquid/typeorm-migration": "^1.3.0",
"@subsquid/typeorm-store": "^1.5.1",
"axios": "^1.7.2",
Expand Down
4 changes: 2 additions & 2 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ type Collection @entity {
socials: CollectionSocials!
category: String
verifiedAt: DateTime
hidden: Boolean!
hidden: Boolean! @index

# Marketplace analytics
stats: CollectionStats!
Expand Down Expand Up @@ -717,7 +717,7 @@ type AuctionData {

type OfferData {
listingType: ListingType!
expiration: Int!
expiration: Int
}

union ListingData = FixedPriceData | AuctionData | OfferData
Expand Down
5 changes: 1 addition & 4 deletions src/job-handlers/fetch-collection-extra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ export default async (job: Queue.Job<JobData>, done: Queue.DoneCallback) => {
syncCollectionStats(_c.collectionId)
computeTraits(_c.collectionId)

await em.update(Collection, { id: _c.collectionId }, collection as any).catch((err) => {
// eslint-disable-next-line no-console
console.error('Error: Updating collection', _c.collectionId, err)
})
return em.update(Collection, { id: _c.collectionId }, collection as any)
})

await Promise.all(collectionsPromise)
Expand Down
14 changes: 14 additions & 0 deletions src/mappings/xcm/events/attempted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
return calls.polkadotXcm.limitedTeleportAssets.matrixEnjinV603.decode(call)
}

if (calls.polkadotXcm.limitedTeleportAssets.v1010.is(call)) {
return calls.polkadotXcm.limitedTeleportAssets.v1010.decode(call)
}

throw new UnknownVersionError(calls.polkadotXcm.limitedTeleportAssets.name)
}

if (call.name === 'PolkadotXcm.teleport_assets') {
if (calls.polkadotXcm.teleportAssets.matrixEnjinV603.is(call)) {
return calls.polkadotXcm.teleportAssets.matrixEnjinV603.decode(call)
}
if (calls.polkadotXcm.teleportAssets.v1010.is(call)) {
return calls.polkadotXcm.teleportAssets.v1010.decode(call)
}

throw new UnknownVersionError(calls.polkadotXcm.teleportAssets.name)
}
Expand All @@ -27,6 +34,9 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
if (calls.polkadotXcm.limitedReserveTransferAssets.matrixEnjinV603.is(call)) {
return calls.polkadotXcm.limitedReserveTransferAssets.matrixEnjinV603.decode(call)
}
if (calls.polkadotXcm.limitedReserveTransferAssets.v1010.is(call)) {
return calls.polkadotXcm.limitedReserveTransferAssets.v1010.decode(call)
}

throw new UnknownVersionError(calls.polkadotXcm.limitedReserveTransferAssets.name)
}
Expand Down Expand Up @@ -56,6 +66,10 @@ async function getCallData(ctx: CommonContext, call: CallItem) {
callData = data.matrixEnjinV603.decode(call)
}

if (data.v1010.is(call)) {
callData = data.v1010.decode(call)
}

if (data.v1005.is(call)) {
callData = data.v1005.decode(call)
}
Expand Down
9 changes: 4 additions & 5 deletions src/model/generated/_offerData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {ListingType} from "./_listingType"
export class OfferData {
public readonly isTypeOf = 'OfferData'
private _listingType!: ListingType
private _expiration!: number
private _expiration!: number | undefined | null

constructor(props?: Partial<Omit<OfferData, 'toJSON'>>, json?: any) {
Object.assign(this, props)
if (json != null) {
this._listingType = marshal.enumFromJson(json.listingType, ListingType)
this._expiration = marshal.int.fromJSON(json.expiration)
this._expiration = json.expiration == null ? undefined : marshal.int.fromJSON(json.expiration)
}
}

Expand All @@ -24,12 +24,11 @@ export class OfferData {
this._listingType = value
}

get expiration(): number {
assert(this._expiration != null, 'uninitialized access')
get expiration(): number | undefined | null {
return this._expiration
}

set expiration(value: number) {
set expiration(value: number | undefined | null) {
this._expiration = value
}

Expand Down
1 change: 1 addition & 0 deletions src/model/generated/collection.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class Collection {
@DateTimeColumn_({nullable: true})
verifiedAt!: Date | undefined | null

@Index_()
@BooleanColumn_({nullable: false})
hidden!: boolean

Expand Down

0 comments on commit 3fd83cb

Please sign in to comment.