From 749d1696f26ab0c85ec1ecb06972ff63ba0f95fb Mon Sep 17 00:00:00 2001 From: Galaxy <30950645+GalaxySciTech@users.noreply.github.com> Date: Thu, 30 Nov 2023 13:01:20 +0400 Subject: [PATCH] feature xdc zero (#33) feature xdc zero --- .example.env | 6 +- .github/workflows/pr_deploy.yml | 2 + README.md | 5 +- package.json | 2 +- patches/web3-utils+1.8.2.patch | 466 +------------------------------- src/config.ts | 4 +- src/server.ts | 4 +- src/service/zero/index.ts | 10 +- 8 files changed, 31 insertions(+), 468 deletions(-) diff --git a/.example.env b/.example.env index 9529ae5..8ff8437 100644 --- a/.example.env +++ b/.example.env @@ -6,7 +6,7 @@ NODE_ENV=development SUBNET_URL=https://devnetstats.apothem.network/subnet -PARENTCHAIN_URL=https://devnetstats.apothem.network/devnet +PARENTNET_URL=https://devnetstats.apothem.network/devnet CHECKPOINT_CONTRACT=0x16da2C7caf46D0d7270d68e590A992A90DfcF7ee @@ -14,8 +14,8 @@ SUBNET_ZERO_CONTRACT=0x0000000 PARENTNET_ZERO_CONTRACT=0x0000000 -PARENTCHAIN_WALLET_PK=0x123 +PARENTNET_WALLET_PK=0x123 -ZERO_WALLET_PK=0x123 +PARENTNET_ZERO_WALLET_PK=0x123 SLACK_WEBHOOK=https://hooks.slack.com/services/blablabla diff --git a/.github/workflows/pr_deploy.yml b/.github/workflows/pr_deploy.yml index 58496e7..6ce9ae9 100644 --- a/.github/workflows/pr_deploy.yml +++ b/.github/workflows/pr_deploy.yml @@ -29,6 +29,8 @@ jobs: run: npm install && npm run postinstall - name: Unit tests run: npm run test + - name: Build test + run: npm run build - name: Record branch env id: branch diff --git a/README.md b/README.md index b990cd1..352d9fb 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ To build and run this app locally you will need: npm install ``` + - Set up .env Copy over the .example.env file and override the values to appropriate ones The new file name shall be `.env` @@ -68,9 +69,9 @@ Create a .env file (or just rename the .example.env) containing all the env vari ### Find the value for important envs 1. `SUBNET_URL` : This is the URL to your subnet with RPC port specified. e.g http://66.94.121.151:8545 -2. `PARENTCHAIN_URL` : This is the XDC parent chain URL with RPC port specified. +2. `PARENTNET_URL` : This is the XDC parent chain URL with RPC port specified. 3. `CHECKPOINT_CONTRACT` : This is the smart contract address for this subnet that has been uploaded in the parent chain. -4. `PARENTCHAIN_WALLET_PK` : This is the wallet key that will be used for submit subnet data into parent chain. You will need to have credits in it first. +4. `PARENTNET_WALLET_PK` : This is the wallet key that will be used for submit subnet data into parent chain. You will need to have credits in it first. 5. `SLACK_WEBHOOK` : (Optional) If relayer detected forking of your subnet, this is the URL where we will push alerting message to. You are required to set up slack bot and install it in the relevant channel first. For details, see slack doc: https://api.slack.com/messaging/webhooks \n Once you are done with the slack setup, find the slack webhook url and put it here. It shall look like `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` We only need the ones after `https://hooks.slack.com/services/` diff --git a/package.json b/package.json index 6c63722..5c33d96 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "patch-package": "^6.5.1", "pg": "^8.5.1", "viem": "^1.18.9", - "web3": "^1.8.2" + "web3": "1.8.2" }, "jest": { "roots": [ diff --git a/patches/web3-utils+1.8.2.patch b/patches/web3-utils+1.8.2.patch index 631cf0c..4d8550b 100644 --- a/patches/web3-utils+1.8.2.patch +++ b/patches/web3-utils+1.8.2.patch @@ -1,465 +1,25 @@ diff --git a/node_modules/web3-utils/lib/index.js b/node_modules/web3-utils/lib/index.js -index f33a432..2f1f190 100644 +index f33a432..d91dba7 100644 --- a/node_modules/web3-utils/lib/index.js +++ b/node_modules/web3-utils/lib/index.js -@@ -36,7 +36,7 @@ var BN = require('bn.js'); - * @param {any} optionalData - * @return {Object} the emitter - */ --var _fireError = function (error, emitter, reject, callback, optionalData) { -+var _fireError = function(error, emitter, reject, callback, optionalData) { - /*jshint maxcomplexity: 10 */ - // add data if given - if (!!error && typeof error === 'object' && !(error instanceof Error) && error.data) { -@@ -57,16 +57,16 @@ var _fireError = function (error, emitter, reject, callback, optionalData) { - if (emitter && - (typeof emitter.listeners === 'function' && - emitter.listeners('error').length) || typeof callback === 'function') { -- emitter.catch(function () { }); -+ emitter.catch(function() {}); - } - // reject later, to be able to return emitter -- setTimeout(function () { -+ setTimeout(function() { - reject(error); - }, 1); - } - if (emitter && typeof emitter.emit === 'function') { - // emit later, to be able to return emitter -- setTimeout(function () { -+ setTimeout(function() { - emitter.emit('error', error, optionalData); - emitter.removeAllListeners(); - }, 1); -@@ -80,7 +80,7 @@ var _fireError = function (error, emitter, reject, callback, optionalData) { - * @param {Object} json - * @return {String} full function/event name - */ --var _jsonInterfaceMethodToString = function (json) { -+var _jsonInterfaceMethodToString = function(json) { - if (!!json && typeof json === 'object' && json.name && json.name.indexOf('(') !== -1) { - return json.name; - } -@@ -94,10 +94,10 @@ var _jsonInterfaceMethodToString = function (json) { - * @param {Object} puts - * @return {Array} parameters as strings - */ --var _flattenTypes = function (includeTuple, puts) { -+var _flattenTypes = function(includeTuple, puts) { - // console.info("entered _flattenTypes. inputs/outputs: " + puts) - var types = []; -- puts.forEach(function (param) { -+ puts.forEach(function(param) { - if (typeof param.components === 'object') { - if (param.type.substring(0, 5) !== 'tuple') { - throw new Error('components found but type is not tuple; report on GitHub'); -@@ -112,17 +112,14 @@ var _flattenTypes = function (includeTuple, puts) { - if (Array.isArray(result) && includeTuple) { - // console.info("include tuple word, and its an array. joining...: " + result.types) - types.push('tuple(' + result.join(',') + ')' + suffix); -- } -- else if (!includeTuple) { -+ } else if (!includeTuple) { - // console.info("don't include tuple, but its an array. joining...: " + result) - types.push('(' + result.join(',') + ')' + suffix); -- } -- else { -+ } else { - // console.info("its a single type within a tuple: " + result.types) - types.push('(' + result + ')'); - } -- } -- else { -+ } else { - // console.info("its a type and not directly in a tuple: " + param.type) - types.push(param.type); - } -@@ -135,7 +132,7 @@ var _flattenTypes = function (includeTuple, puts) { - * @param {Number} size - * @returns {string} - */ --var randomHex = function (size) { -+var randomHex = function(size) { - return '0x' + randombytes(size).toString('hex'); - }; - /** -@@ -145,11 +142,12 @@ var randomHex = function (size) { - * @param {String} hex - * @returns {String} ascii string representation of hex value - */ --var hexToAscii = function (hex) { -+var hexToAscii = function(hex) { - if (!utils.isHexStrict(hex)) - throw new Error('The parameter must be a valid HEX string.'); - var str = ""; -- var i = 0, l = hex.length; -+ var i = 0, -+ l = hex.length; - if (hex.substring(0, 2) === '0x') { - i = 2; - } -@@ -166,7 +164,7 @@ var hexToAscii = function (hex) { - * @param {String} str - * @returns {String} hex representation of input string - */ --var asciiToHex = function (str) { -+var asciiToHex = function(str) { - if (!str) - return "0x00"; - var hex = ""; -@@ -185,7 +183,7 @@ var asciiToHex = function (str) { - * @returns {BN} value of the unit (in Wei) - * @throws error if the unit is not correct:w - */ --var getUnitValue = function (unit) { -+var getUnitValue = function(unit) { - unit = unit ? unit.toLowerCase() : 'ether'; - if (!ethjsUnit.unitMap[unit]) { - throw new Error('This unit "' + unit + '" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); -@@ -213,7 +211,7 @@ var getUnitValue = function (unit) { - * @param {String} unit the unit to convert to, default ether - * @return {String|Object} When given a BN object it returns one as well, otherwise a number - */ --var fromWei = function (number, unit) { -+var fromWei = function(number, unit) { - unit = getUnitValue(unit); - if (!utils.isBN(number) && !(typeof number === 'string')) { - throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); -@@ -242,7 +240,7 @@ var fromWei = function (number, unit) { - * @param {String} unit the unit to convert from, default ether - * @return {String|Object} When given a BN object it returns one as well, otherwise a number - */ --var toWei = function (number, unit) { -+var toWei = function(number, unit) { - unit = getUnitValue(unit); - if (!utils.isBN(number) && !(typeof number === 'string')) { - throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); -@@ -256,20 +254,26 @@ var toWei = function (number, unit) { - * @param {String} address the given HEX address - * @return {String} - */ --var toChecksumAddress = function (address) { -+var toChecksumAddress = function(address) { +@@ -259,10 +259,16 @@ var toWei = function (number, unit) { + var toChecksumAddress = function (address) { if (typeof address === 'undefined') return ''; - if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) - throw new Error('Given address "' + address + '" is not a valid Ethereum address.'); - address = address.toLowerCase().replace(/^0x/i, ''); - var addressHash = utils.sha3(address).replace(/^0x/i, ''); -+ var addressHash; -+ if (/^(xdc)?[0-9a-f]{40}$/i.test(address)) { -+ address = address.toLowerCase().replace(/^xdc/i, ''); -+ addressHash = utils.sha3(address).replace(/^xdc/i, ''); -+ } else if (/^(0x)?[0-9a-f]{40}$/i.test(address)) { -+ address = address.toLowerCase().replace(/^0x/i, ''); -+ addressHash = utils.sha3(address).replace(/^0x/i, ''); -+ } else { -+ throw new Error('Given address "' + address + '" is not a valid XDC address.'); -+ } -+ ++ var addressHash; ++ if (/^(xdc)?[0-9a-f]{40}$/i.test(address)) { ++ address = address.toLowerCase().replace(/^xdc/i, ''); ++ addressHash = utils.sha3(address).replace(/^xdc/i, ''); ++ } else if (/^(0x)?[0-9a-f]{40}$/i.test(address)) { ++ address = address.toLowerCase().replace(/^0x/i, ''); ++ addressHash = utils.sha3(address).replace(/^0x/i, ''); ++ } else { ++ throw new Error('Given address "' + address + '" is not a valid XDC address.'); ++ } var checksumAddress = '0x'; for (var i = 0; i < address.length; i++) { // If ith character is 8 to f then make it uppercase - if (parseInt(addressHash[i], 16) > 7) { - checksumAddress += address[i].toUpperCase(); -- } -- else { -+ } else { - checksumAddress += address[i]; - } - } -@@ -288,62 +292,49 @@ var toChecksumAddress = function (address) { - * - * @returns {Number} -1, 0, or 1 - */ --var compareBlockNumbers = function (a, b) { -+var compareBlockNumbers = function(a, b) { - // Increasing order: (genesis = earliest), safe, (finalized ~ latest), pending - // safe vs block-num cant be compared as block number provided can be on left or right side of safe tag, until safe tag block number is extracted and compared - if (a === b) { - return 0; -- } -- else if (("genesis" === a || "earliest" === a || 0 === a) && ("genesis" === b || "earliest" === b || 0 === b)) { -+ } else if (("genesis" === a || "earliest" === a || 0 === a) && ("genesis" === b || "earliest" === b || 0 === b)) { - return 0; -- } -- else if ("genesis" === a || "earliest" === a || a === 0) { -+ } else if ("genesis" === a || "earliest" === a || a === 0) { - // b !== a, thus a < b - return -1; -- } -- else if ("genesis" === b || "earliest" === b || b === 0) { -+ } else if ("genesis" === b || "earliest" === b || b === 0) { - // b !== a, thus a > b - return 1; -- } -- else if (a === "latest" || a === "finalized") { -+ } else if (a === "latest" || a === "finalized") { - if (b === "pending") { - return -1; -- } -- else { -+ } else { - // b !== ("pending" OR "latest"), thus a > b - return 1; - } -- } -- else if (b === "latest" || b === "finalized") { -+ } else if (b === "latest" || b === "finalized") { - if (a === "pending") { - return 1; -- } -- else { -+ } else { - // b !== ("pending" OR "latest"), thus a > b - return -1; - } -- } -- else if (a === "pending") { -+ } else if (a === "pending") { - // b (== OR <) "latest", thus a > b - return 1; -- } -- else if (b === "pending") { -+ } else if (b === "pending") { - return -1; -- } -- else if (a === "safe" || b === "safe") { -+ } else if (a === "safe" || b === "safe") { - // either a or b is "safe" and the other one did not fall into any of the conditions above, so the other one is a number - return undefined; -- } -- else { -+ } else { - let bnA = new BN(a); - let bnB = new BN(b); - if (bnA.lt(bnB)) { - return -1; -- } -- else if (bnA.eq(bnB)) { -+ } else if (bnA.eq(bnB)) { - return 0; -- } -- else { -+ } else { - return 1; - } - } -diff --git a/node_modules/web3-utils/src/index.js b/node_modules/web3-utils/src/index.js -index c3b2ded..93a5857 100644 ---- a/node_modules/web3-utils/src/index.js -+++ b/node_modules/web3-utils/src/index.js -@@ -39,19 +39,19 @@ var BN = require('bn.js'); - * @param {any} optionalData - * @return {Object} the emitter - */ --var _fireError = function (error, emitter, reject, callback, optionalData) { -+var _fireError = function(error, emitter, reject, callback, optionalData) { - /*jshint maxcomplexity: 10 */ - - // add data if given -- if(!!error && typeof error === 'object' && !(error instanceof Error) && error.data) { -- if(!!error.data && typeof error.data === 'object' || Array.isArray(error.data)) { -+ if (!!error && typeof error === 'object' && !(error instanceof Error) && error.data) { -+ if (!!error.data && typeof error.data === 'object' || Array.isArray(error.data)) { - error.data = JSON.stringify(error.data, null, 2); - } - -- error = error.message +"\n"+ error.data; -+ error = error.message + "\n" + error.data; - } - -- if(typeof error === 'string') { -+ if (typeof error === 'string') { - error = new Error(error); - } - -@@ -64,19 +64,19 @@ var _fireError = function (error, emitter, reject, callback, optionalData) { - if ( - emitter && - (typeof emitter.listeners === 'function' && -- emitter.listeners('error').length) || typeof callback === 'function' -+ emitter.listeners('error').length) || typeof callback === 'function' - ) { -- emitter.catch(function(){}); -+ emitter.catch(function() {}); - } - // reject later, to be able to return emitter -- setTimeout(function () { -+ setTimeout(function() { - reject(error); - }, 1); - } - -- if(emitter && typeof emitter.emit === 'function') { -+ if (emitter && typeof emitter.emit === 'function') { - // emit later, to be able to return emitter -- setTimeout(function () { -+ setTimeout(function() { - emitter.emit('error', error, optionalData); - emitter.removeAllListeners(); - }, 1); -@@ -92,7 +92,7 @@ var _fireError = function (error, emitter, reject, callback, optionalData) { - * @param {Object} json - * @return {String} full function/event name - */ --var _jsonInterfaceMethodToString = function (json) { -+var _jsonInterfaceMethodToString = function(json) { - if (!!json && typeof json === 'object' && json.name && json.name.indexOf('(') !== -1) { - return json.name; - } -@@ -109,8 +109,7 @@ var _jsonInterfaceMethodToString = function (json) { - * @param {Object} puts - * @return {Array} parameters as strings - */ --var _flattenTypes = function(includeTuple, puts) --{ -+var _flattenTypes = function(includeTuple, puts) { - // console.info("entered _flattenTypes. inputs/outputs: " + puts) - var types = []; - -@@ -124,15 +123,13 @@ var _flattenTypes = function(includeTuple, puts) - if (arrayBracket >= 0) { suffix = param.type.substring(arrayBracket); } - var result = _flattenTypes(includeTuple, param.components); - // console.info("result should have things: " + result) -- if(Array.isArray(result) && includeTuple) { -+ if (Array.isArray(result) && includeTuple) { - // console.info("include tuple word, and its an array. joining...: " + result.types) - types.push('tuple(' + result.join(',') + ')' + suffix); -- } -- else if(!includeTuple) { -+ } else if (!includeTuple) { - // console.info("don't include tuple, but its an array. joining...: " + result) - types.push('(' + result.join(',') + ')' + suffix); -- } -- else { -+ } else { - // console.info("its a single type within a tuple: " + result.types) - types.push('(' + result + ')'); - } -@@ -143,8 +140,7 @@ var _flattenTypes = function(includeTuple, puts) - }); - - return types; --}; --  -+};  - - /** - * Returns a random hex string by the given bytes size -@@ -168,11 +164,12 @@ var hexToAscii = function(hex) { - throw new Error('The parameter must be a valid HEX string.'); - - var str = ""; -- var i = 0, l = hex.length; -+ var i = 0, -+ l = hex.length; - if (hex.substring(0, 2) === '0x') { - i = 2; - } -- for (; i < l; i+=2) { -+ for (; i < l; i += 2) { - var code = parseInt(hex.slice(i, i + 2), 16); - str += String.fromCharCode(code); - } -@@ -188,10 +185,10 @@ var hexToAscii = function(hex) { - * @returns {String} hex representation of input string - */ - var asciiToHex = function(str) { -- if(!str) -+ if (!str) - return "0x00"; - var hex = ""; -- for(var i = 0; i < str.length; i++) { -+ for (var i = 0; i < str.length; i++) { - var code = str.charCodeAt(i); - var n = code.toString(16); - hex += n.length < 2 ? '0' + n : n; -@@ -210,10 +207,10 @@ var asciiToHex = function(str) { - * @returns {BN} value of the unit (in Wei) - * @throws error if the unit is not correct:w - */ --var getUnitValue = function (unit) { -+var getUnitValue = function(unit) { - unit = unit ? unit.toLowerCase() : 'ether'; - if (!ethjsUnit.unitMap[unit]) { -- throw new Error('This unit "'+ unit +'" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); -+ throw new Error('This unit "' + unit + '" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); - } - return unit; - }; -@@ -242,7 +239,7 @@ var getUnitValue = function (unit) { - var fromWei = function(number, unit) { - unit = getUnitValue(unit); - -- if(!utils.isBN(number) && !(typeof number === 'string')) { -+ if (!utils.isBN(number) && !(typeof number === 'string')) { - throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); - } - -@@ -274,7 +271,7 @@ var fromWei = function(number, unit) { - var toWei = function(number, unit) { - unit = getUnitValue(unit); - -- if(!utils.isBN(number) && !(typeof number === 'string')) { -+ if (!utils.isBN(number) && !(typeof number === 'string')) { - throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); - } - -@@ -291,19 +288,17 @@ var toWei = function(number, unit) { - * @param {String} address the given HEX address - * @return {String} - */ --var toChecksumAddress = function (address) { -+var toChecksumAddress = function(address) { - if (typeof address === 'undefined') return ''; - -- if(!/^(0x)?[0-9a-f]{40}$/i.test(address)) -- throw new Error('Given address "'+ address +'" is not a valid Ethereum address.'); -+ if (!/^(xdc)?[0-9a-f]{40}$/i.test(address)) -+ throw new Error('Given address "' + address + '" is not a valid XDC address.'); - -+ address = address.toLowerCase().replace(/^xdc/i, ''); -+ var addressHash = utils.sha3(address).replace(/^xdc/i, ''); -+ var checksumAddress = 'xdc'; - -- -- address = address.toLowerCase().replace(/^0x/i,''); -- var addressHash = utils.sha3(address).replace(/^0x/i,''); -- var checksumAddress = '0x'; -- -- for (var i = 0; i < address.length; i++ ) { -+ for (var i = 0; i < address.length; i++) { - // If ith character is 8 to f then make it uppercase - if (parseInt(addressHash[i], 16) > 7) { - checksumAddress += address[i].toUpperCase(); -@@ -332,7 +327,7 @@ var compareBlockNumbers = function(a, b) { - // safe vs block-num cant be compared as block number provided can be on left or right side of safe tag, until safe tag block number is extracted and compared - if (a === b) { - return 0; -- } else if (("genesis" === a || "earliest" === a || 0 === a) && ("genesis" === b || "earliest" === b || 0 === b)) { -+ } else if (("genesis" === a || "earliest" === a || 0 === a) && ("genesis" === b || "earliest" === b || 0 === b)) { - return 0; - } else if ("genesis" === a || "earliest" === a || a === 0) { - // b !== a, thus a < b -@@ -359,16 +354,15 @@ var compareBlockNumbers = function(a, b) { - return 1; - } else if (b === "pending") { - return -1; -- } else if(a === "safe" || b === "safe") { -+ } else if (a === "safe" || b === "safe") { - // either a or b is "safe" and the other one did not fall into any of the conditions above, so the other one is a number - return undefined; -- } -- else { -+ } else { - let bnA = new BN(a); - let bnB = new BN(b); -- if(bnA.lt(bnB)) { -+ if (bnA.lt(bnB)) { - return -1; -- } else if(bnA.eq(bnB)) { -+ } else if (bnA.eq(bnB)) { - return 0; - } else { - return 1; diff --git a/src/config.ts b/src/config.ts index b136587..48f23aa 100644 --- a/src/config.ts +++ b/src/config.ts @@ -49,11 +49,11 @@ const config: Config = { }, mainnet: { url: - process.env.PARENTCHAIN_URL || + process.env.PARENTNET_URL || "https://devnetstats.apothem.network/mainnet", smartContractAddress: process.env.CHECKPOINT_CONTRACT || "", accountPK: - process.env.PARENTCHAIN_WALLET_PK || + process.env.PARENTNET_WALLET_PK || "0xa6538b992365dd26bbc2391ae6639bac0ed8599f8b45bca7c28c105959f02af4", // Default to a dummy key submitTransactionWaitingTime: +process.env.MN_TX_SUBMIT_WAITING_TIME || 100, }, diff --git a/src/server.ts b/src/server.ts index 014e900..b696222 100644 --- a/src/server.ts +++ b/src/server.ts @@ -19,7 +19,7 @@ const worker = new Worker(config, logger); app.use(bodyParser()); app.listen(config.port, async () => { - if (!process.env.PARENTCHAIN_WALLET_PK) { + if (!process.env.PARENTNET_WALLET_PK) { logger.error("csc pk not found ,will dont running csc relayer"); return; } @@ -28,7 +28,7 @@ app.listen(config.port, async () => { }); app.listen(config.port + 1, async () => { - if (!process.env.ZERO_WALLET_PK) { + if (!process.env.PARENTNET_ZERO_WALLET_PK) { logger.error("zero pk not found ,will dont running zero relayer"); return; } diff --git a/src/service/zero/index.ts b/src/service/zero/index.ts index 652f374..7b40021 100644 --- a/src/service/zero/index.ts +++ b/src/service/zero/index.ts @@ -12,8 +12,8 @@ import { sleep } from "../../utils"; import Web3 from "web3"; let account: PrivateKeyAccount = null; -if (process.env.ZERO_WALLET_PK) { - account = privateKeyToAccount(`0x${process.env.ZERO_WALLET_PK}`); +if (process.env.PARENTNET_ZERO_WALLET_PK) { + account = privateKeyToAccount(process.env.PARENTNET_ZERO_WALLET_PK as any); } const csc = process.env.CHECKPOINT_CONTRACT; @@ -34,7 +34,7 @@ const parentnetEndpointContract = { }; const xdcparentnet = async () => { return { - id: await getChainId(process.env.PARENTCHAIN_URL), + id: await getChainId(process.env.PARENTNET_URL), name: "XDC Devnet", network: "XDC Devnet", nativeCurrency: { @@ -43,8 +43,8 @@ const xdcparentnet = async () => { symbol: "XDC", }, rpcUrls: { - public: { http: [process.env.PARENTCHAIN_URL] }, - default: { http: [process.env.PARENTCHAIN_URL] }, + public: { http: [process.env.PARENTNET_URL] }, + default: { http: [process.env.PARENTNET_URL] }, }, }; };