From fea6ec0bb5c9f727c0f4913e43c2bfcd9b19dbca Mon Sep 17 00:00:00 2001 From: Galaxy <30950645+GalaxySciTech@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:28:42 +0400 Subject: [PATCH] Update index.ts --- src/service/zero/index.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/service/zero/index.ts b/src/service/zero/index.ts index ff29007..855e30f 100644 --- a/src/service/zero/index.ts +++ b/src/service/zero/index.ts @@ -9,6 +9,7 @@ import endpointABI from "../../abi/endpointABI.json"; import cscABI from "../../abi/cscABI.json"; import fetch from "node-fetch"; import { sleep } from "../../utils"; +import Web3 from "web3"; const account = privateKeyToAccount(`0x${process.env.ZERO_WALLET_PK}`); @@ -62,18 +63,8 @@ const xdcsubnet = async () => { }; const getChainId = async (url: string) => { - const res = await fetch(url, { - method: "POST", - body: JSON.stringify({ - jsonrpc: "2.0", - id: 1, - method: "eth_chainId", - params: [], - }), - headers: { "Content-Type": "application/json" }, - }); - const json = await res.json(); - return Number(json?.result); + const web3 = new Web3(url); + return web3.eth.getChainId(); }; const createParentnetWalletClient = async () => {