From cf523cdad2f952acfefe15a63e7cddd797bbcf0e Mon Sep 17 00:00:00 2001 From: James Bayly Date: Fri, 16 Jun 2023 17:42:19 +0800 Subject: [PATCH] Aleph Zero Fixes --- aleph-zero/.gitignore | 3 +- aleph-zero/.project-cid | 1 + aleph-zero/package.json | 6 ++-- aleph-zero/schema.graphql | 1 - aleph-zero/src/mappings/mappingHandlers.ts | 14 +++++---- aleph-zero/tsconfig.json | 3 +- astar/schema.graphql | 34 ++++++++++++++++------ 7 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 aleph-zero/.project-cid diff --git a/aleph-zero/.gitignore b/aleph-zero/.gitignore index 7bc6395..5140c32 100644 --- a/aleph-zero/.gitignore +++ b/aleph-zero/.gitignore @@ -50,5 +50,4 @@ Thumbs.db *.mov *.wmv -.data - +.data \ No newline at end of file diff --git a/aleph-zero/.project-cid b/aleph-zero/.project-cid new file mode 100644 index 0000000..f04c714 --- /dev/null +++ b/aleph-zero/.project-cid @@ -0,0 +1 @@ +QmRy53SPQ3JRNdjKhPRguYdmGMpWbjf1TfLvzpHwEFJUgh \ No newline at end of file diff --git a/aleph-zero/package.json b/aleph-zero/package.json index 45c7272..c224403 100644 --- a/aleph-zero/package.json +++ b/aleph-zero/package.json @@ -20,10 +20,10 @@ "author": "SubQuery Network", "license": "Apache-2.0", "devDependencies": { - "@polkadot/api": "^9", + "@polkadot/api": "10.1.4", + "@subql/cli": "latest", "@subql/types": "latest", - "typescript": "^4.1.3", - "@subql/cli": "latest" + "typescript": "^5.0.4" }, "resolutions": { "ipfs-unixfs": "6.0.6" diff --git a/aleph-zero/schema.graphql b/aleph-zero/schema.graphql index 3c0fd50..3959775 100644 --- a/aleph-zero/schema.graphql +++ b/aleph-zero/schema.graphql @@ -12,7 +12,6 @@ type Event @entity { type Extrinsic @entity { id: ID! - txHash: String! module: String! @index call: String! @index blockHeight: BigInt! @index diff --git a/aleph-zero/src/mappings/mappingHandlers.ts b/aleph-zero/src/mappings/mappingHandlers.ts index 5b9b9b1..2ec26ea 100644 --- a/aleph-zero/src/mappings/mappingHandlers.ts +++ b/aleph-zero/src/mappings/mappingHandlers.ts @@ -2,7 +2,7 @@ import { EventRecord } from "@polkadot/types/interfaces"; import { SubstrateExtrinsic, SubstrateBlock } from "@subql/types"; import { SpecVersion, Event, Extrinsic } from "../types"; -let specVersion: SpecVersion; +let specVersion: SpecVersion | undefined; export async function handleBlock(block: SubstrateBlock): Promise { // Initialise Spec Version if (!specVersion) { @@ -11,7 +11,10 @@ export async function handleBlock(block: SubstrateBlock): Promise { // Check for updates to Spec Version if (!specVersion || specVersion.id !== block.specVersion.toString()) { - specVersion = new SpecVersion(block.specVersion.toString(), block.block.header.number.toBigInt()); + specVersion = SpecVersion.create({ + id: block.specVersion.toString(), + blockHeight: block.block.header.number.toBigInt(), + }); await specVersion.save(); } @@ -19,8 +22,10 @@ export async function handleBlock(block: SubstrateBlock): Promise { const events = block.events .filter( (evt) => - !(evt.event.section === "system" && - evt.event.method === "ExtrinsicSuccess") + !( + evt.event.section === "system" && + evt.event.method === "ExtrinsicSuccess" + ) ) .map((evt, idx) => handleEvent(block.block.header.number.toString(), idx, evt) @@ -54,7 +59,6 @@ function handleEvent( function handleCall(idx: string, extrinsic: SubstrateExtrinsic): Extrinsic { return Extrinsic.create({ id: idx, - txHash: extrinsic.extrinsic.hash.toString(), module: extrinsic.extrinsic.method.section, call: extrinsic.extrinsic.method.method, blockHeight: extrinsic.block.block.header.number.toBigInt(), diff --git a/aleph-zero/tsconfig.json b/aleph-zero/tsconfig.json index 9b95212..7aa2c0d 100644 --- a/aleph-zero/tsconfig.json +++ b/aleph-zero/tsconfig.json @@ -9,7 +9,8 @@ "module": "commonjs", "outDir": "dist", "rootDir": "src", - "target": "es2017" + "target": "es2017", + "strict": true }, "include": [ "src/**/*", diff --git a/astar/schema.graphql b/astar/schema.graphql index e41ddfa..7473cb0 100644 --- a/astar/schema.graphql +++ b/astar/schema.graphql @@ -22,11 +22,17 @@ type Extrinsic @entity { type EvmTransaction @entity { id: ID! txHash: String! - """A lowercase address of the sender""" + """ + A lowercase address of the sender + """ from: String! @index - """A lowercase address. This will be null for contract creations""" + """ + A lowercase address. This will be null for contract creations + """ to: String @index - """A lowercased function sighash extracted from the data field""" + """ + A lowercased function sighash extracted from the data field + """ func: String @index blockHeight: BigInt! @index success: Boolean! @@ -34,16 +40,26 @@ type EvmTransaction @entity { type EvmLog @entity { id: ID! - """The contract address that emitted the event. Lowercased""" + """ + The contract address that emitted the event. Lowercased + """ address: String! @index blockHeight: BigInt! @index - """The lowercase event signature""" + """ + The lowercase event signature + """ topics0: String! @index - """The lowercase first indexed argument""" + """ + The lowercase first indexed argument + """ topics1: String - """The lowercase second indexed argument""" + """ + The lowercase second indexed argument + """ topics2: String - """The lowercase third indexed argument""" + """ + The lowercase third indexed argument + """ topics3: String } @@ -59,7 +75,7 @@ type ContractsCall @entity { type ContractEmitted @entity { id: ID! contract: String! @index - from: String !@index + from: String! @index eventIndex: Int! @index blockHeight: BigInt! @index }