From 3d5d39a39788cce5661a657e72737d31e65982af Mon Sep 17 00:00:00 2001 From: JQQQ Date: Thu, 9 Nov 2023 10:52:07 +1300 Subject: [PATCH] update bifrost --- bifrost-parachain/package.json | 2 +- bifrost-parachain/project.yaml | 5 ++++- bifrost-parachain/src/chaintypes.ts | 11 +++++++++++ bifrost-parachain/src/mappings/mappingHandlers.ts | 12 +++++++----- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/bifrost-parachain/package.json b/bifrost-parachain/package.json index a3dbdf2..5de62c5 100644 --- a/bifrost-parachain/package.json +++ b/bifrost-parachain/package.json @@ -20,7 +20,7 @@ "author": "SubQuery Network", "license": "Apache-2.0", "devDependencies": { - "@bifrost-finance/type-definitions": "latest", + "@bifrost-finance/type-definitions": "1.11.3", "@polkadot/api": "^10.9.1", "@subql/cli": "latest", "@subql/types": "latest", diff --git a/bifrost-parachain/project.yaml b/bifrost-parachain/project.yaml index 2a9c6cd..e5d014b 100644 --- a/bifrost-parachain/project.yaml +++ b/bifrost-parachain/project.yaml @@ -4,7 +4,10 @@ version: 1.0.0 runner: node: name: '@subql/node' - version: '*' + version: '>=3.0.0' + options: + unfinalizedBlocks: false + historical: false query: name: '@subql/query' version: '*' diff --git a/bifrost-parachain/src/chaintypes.ts b/bifrost-parachain/src/chaintypes.ts index c3648f8..f6a3904 100644 --- a/bifrost-parachain/src/chaintypes.ts +++ b/bifrost-parachain/src/chaintypes.ts @@ -1,3 +1,14 @@ import { typesBundleForPolkadot } from '@bifrost-finance/type-definitions'; +// @ts-ignore +typesBundleForPolkadot.spec.bifrost.types[0].types.DispatchErrorModule = 'DispatchErrorModuleU8' +typesBundleForPolkadot.spec.bifrost.types.push( + { + minmax: [0, undefined], + types:{ + // @ts-ignore + DispatchErrorModule: 'DispatchErrorModuleU8', + } + } +) export default { typesBundle: typesBundleForPolkadot }; diff --git a/bifrost-parachain/src/mappings/mappingHandlers.ts b/bifrost-parachain/src/mappings/mappingHandlers.ts index f5761d1..bcb2ed2 100644 --- a/bifrost-parachain/src/mappings/mappingHandlers.ts +++ b/bifrost-parachain/src/mappings/mappingHandlers.ts @@ -34,11 +34,13 @@ export async function handleBlock(block: SubstrateBlock): Promise { handleCall(`${block.block.header.number.toString()}-${idx}`, ext) ); - // Save all data - await Promise.all([ - store.bulkCreate("Event", events), - store.bulkCreate("Extrinsic", calls), - ]); + // All save order should always follow this structure + for (const event of events) { + await event.save() + } + for (const call of calls) { + await call.save() + } } function handleEvent(