Skip to content

Commit 23863f7

Browse files
authored
fix: remark parse muy rapido (#44)
* fix: remark parse muy rapido * fix: lib upgreade * fix: order
1 parent 95f948e commit 23863f7

File tree

4 files changed

+514
-1231
lines changed

4 files changed

+514
-1231
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@
2929
"license": "MIT",
3030
"devDependencies": {
3131
"cross-env": "7.0.3",
32-
"@polkadot/api": "15.5.2",
33-
"@subql/cli": "5.5.2",
34-
"@subql/testing": "2.2.3",
35-
"@subql/types": "3.11.5",
36-
"moonbeam-types-bundle": "^2.0.8",
37-
"typescript": "^5.2.2"
32+
"@polkadot/api": "16.4.1",
33+
"@subql/cli": "5.14.0",
34+
"@subql/testing": "2.3.0",
35+
"@subql/types": "3.13.0",
36+
"moonbeam-types-bundle": "2.0.10",
37+
"typescript": "5.8.3"
3838
},
3939
"resolutions": {
4040
"ipfs-unixfs": "6.0.6"
4141
},
4242
"dependencies": {
43-
"@polkadot/api-augment": "^15.5.2",
44-
"@polkadot/types": "^15.5.2",
45-
"@polkadot/util": "^13.3.1",
46-
"@polkadot/util-crypto": "^13.3.1",
47-
"@subql/types-core": "^2.0.1",
43+
"@polkadot/api-augment": "16.4.1",
44+
"@polkadot/types": "16.4.1",
45+
"@polkadot/util": "13.5.3",
46+
"@polkadot/util-crypto": "13.5.3",
47+
"@subql/types-core": "2.1.0",
4848
"subquery-call-visitor": "1.3.3",
49-
"tslib": "^2.6.2"
49+
"tslib": "2.8.1"
5050
},
5151
"exports": {
5252
"moonbeamChaintypes": "./chainTypes/moonbeamChaintypes.ts",

src/mappings/handlers/multisigRemarkHandler.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +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+
import { isJsonStringArgs } from "../../utils/isJson";
89

910

1011
export async function handleMultisigRemarkEventHandler(event: SubstrateEvent): Promise<void> {
@@ -14,9 +15,9 @@ export async function handleMultisigRemarkEventHandler(event: SubstrateEvent): P
1415

1516
if (!extrinsic) return;
1617

17-
const args = extrinsic.args[0]?.toHuman() as unknown as string;
18+
if (!isJsonStringArgs(extrinsic)) return;
1819

19-
if (args.indexOf('{') === -1) return;
20+
const args = extrinsic.args[0]?.toHuman() as unknown as string;
2021

2122
let parsedArgs: MultisigRemarkArgs;
2223
try {

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)