Skip to content

Commit 368232b

Browse files
authored
fix: indexes to entities (#43)
* fix: added indexes * fix: i fucking hate this life * fix: i fucking hate this life
1 parent 55df01a commit 368232b

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

project-westend-asset-hub.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ schema:
1515
network:
1616
chainId: "0x67f9723393ef76214df0118c34bbbd3dbebc8ed46a10973a8c969d48fe7598c9"
1717
endpoint: >-
18-
wss://asset-hub-westend.dotters.network
19-
bypassBlocks:
20-
- 12160396 # extra large block, indexer hangs on it https://assethub-westend.subscan.io/block/0x8d5e7883e7a4f06605d0d4e272ae6215f54935ecbd742d983ca2c802097ce01e
18+
https://asset-hub-westend-rpc.n.dwellir.com
2119
dataSources:
2220
- name: main
2321
kind: substrate/Runtime

schema.graphql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Proxied @entity {
1010
type: String!
1111
proxyAccountId: String! @index
1212
accountId: String! @index
13-
delay: Int!
13+
delay: Int! @index
1414
blockNumber: Int!
1515
extrinsicIndex: Int!
1616
isPureProxy: Boolean!
@@ -32,8 +32,8 @@ type Account @entity {
3232
# entity for linking accounts and multisigs
3333
type AccountMultisig @entity {
3434
id: ID!
35-
multisig: Account!
36-
signatory: Account!
35+
multisig: Account! @index
36+
signatory: Account! @index
3737
}
3838

3939
enum EventStatus {
@@ -47,7 +47,7 @@ type MultisigEvent @entity {
4747
status: EventStatus!
4848
blockCreated: Int!
4949
indexCreated: Int!
50-
multisig: MultisigOperation!
50+
multisig: MultisigOperation! @index
5151
timestamp: Int!
5252
}
5353

src/mappings/handlers/multisigRemarkHandler.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { decodeAddress, createKeyMultiAddress } from "../../utils";
55
import { u8aToHex } from "@polkadot/util";
66
import { MultisigRemarkArgs } from "../types";
77
import { validateAddress } from "../../utils/validateAddress";
8-
8+
import { isJsonStringArgs } from "../../utils/isJson";
99

1010
export async function handleMultisigRemarkEventHandler(event: SubstrateEvent): Promise<void> {
1111
if (!event) return;
@@ -14,6 +14,10 @@ export async function handleMultisigRemarkEventHandler(event: SubstrateEvent): P
1414

1515
if (!extrinsic) return;
1616

17+
if (!isJsonStringArgs(extrinsic)) {
18+
return
19+
}
20+
1721
const args = extrinsic.args[0]?.toHuman() as unknown as string;
1822

1923
let parsedArgs: MultisigRemarkArgs;

src/utils/isJson.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Bytes } from "@polkadot/types";
2+
import { Extrinsic } from "@polkadot/types/interfaces";
3+
4+
export const isJsonStringArgs = (extrinsic: Extrinsic) => {
5+
//123 is { and 125 is } :)
6+
return (extrinsic.args[0] as Bytes).at(-1) === 125 && (extrinsic.args[0] as Bytes).at(0) === 123;
7+
}

0 commit comments

Comments
 (0)