diff --git a/scripts/testSetup.ts b/scripts/testSetup.ts index 2cf3ea7f79..c3b1762844 100644 --- a/scripts/testSetup.ts +++ b/scripts/testSetup.ts @@ -25,7 +25,7 @@ import { ParentChain as L1Network, ChildChain as L2Network, getParentChain as getL1Network, - getChain as getL2Network, + getChildChain as getL2Network, addCustomNetwork, } from '../src/lib/dataEntities/networks' import { Signer } from 'ethers' @@ -171,8 +171,8 @@ export const setupNetworks = async ( } addCustomNetwork({ - customL1Network: l1Network, - customChainNetwork: l2Network, + customParentChain: l1Network, + customChildChain: l2Network, }) // also register the weth gateway @@ -245,7 +245,7 @@ export const testSetup = async (): Promise<{ } addCustomNetwork({ customParentChain: l1Network, - customChain: l2Network, + customChildChain: l2Network, }) setL1Network = l1Network setL2Network = l2Network diff --git a/src/lib/dataEntities/networks.ts b/src/lib/dataEntities/networks.ts index 620af314ae..bda1cff8af 100644 --- a/src/lib/dataEntities/networks.ts +++ b/src/lib/dataEntities/networks.ts @@ -397,10 +397,10 @@ export const getEthBridgeInformation = async ( export const addCustomNetwork = ({ customParentChain, - customChain, + customChildChain, }: { customParentChain?: ParentChain - customChain: ChildChain + customChildChain: ChildChain }): void => { if (customParentChain) { if (parentChains[customParentChain.chainID]) { @@ -416,24 +416,28 @@ export const addCustomNetwork = ({ } } - if (childChains[customChain.chainID]) - throw new ArbSdkError(`Network ${customChain.chainID} already included`) - else if (!customChain.isCustom) { + if (childChains[customChildChain.chainID]) throw new ArbSdkError( - `Custom network ${customChain.chainID} must have isCustom flag set to true` + `Network ${customChildChain.chainID} already included` + ) + else if (!customChildChain.isCustom) { + throw new ArbSdkError( + `Custom network ${customChildChain.chainID} must have isCustom flag set to true` ) } - childChains[customChain.chainID] = customChain + childChains[customChildChain.chainID] = customChildChain - const parentChainPartnerChain = parentChains[customChain.partnerChainID] + const parentChainPartnerChain = parentChains[customChildChain.partnerChainID] if (!parentChainPartnerChain) throw new ArbSdkError( - `Network ${customChain.chainID}'s partner network, ${customChain.partnerChainID}, not recognized` + `Network ${customChildChain.chainID}'s partner network, ${customChildChain.partnerChainID}, not recognized` ) - if (!parentChainPartnerChain.partnerChainIDs.includes(customChain.chainID)) { - parentChainPartnerChain.partnerChainIDs.push(customChain.chainID) + if ( + !parentChainPartnerChain.partnerChainIDs.includes(customChildChain.chainID) + ) { + parentChainPartnerChain.partnerChainIDs.push(customChildChain.chainID) } } @@ -495,7 +499,7 @@ export const addDefaultLocalNetwork = (): { addCustomNetwork({ customParentChain: defaultLocalParentChain, - customChain: defaultLocalChain, + customChildChain: defaultLocalChain, }) return { diff --git a/src/lib/inbox/inbox.ts b/src/lib/inbox/inbox.ts index 71463e3f14..801233d09f 100644 --- a/src/lib/inbox/inbox.ts +++ b/src/lib/inbox/inbox.ts @@ -70,7 +70,7 @@ export class InboxTools { this.parentChain = parentChains[childChain.partnerChainID] if (!this.parentChain) throw new ArbSdkError( - `ParentChainNetwork not found for chain id: ${childChain.partnerChainID}.` + `ParentChain not found for chain id: ${childChain.partnerChainID}.` ) } diff --git a/tests/fork/inbox.test.ts b/tests/fork/inbox.test.ts index f5b0772019..7ed76a4790 100644 --- a/tests/fork/inbox.test.ts +++ b/tests/fork/inbox.test.ts @@ -31,7 +31,7 @@ import { InboxTools } from '../../src' import { ethers, network } from 'hardhat' import { hexZeroPad } from '@ethersproject/bytes' import { - ChainNetwork as L2Network, + ChildChain as L2Network, getChildChain as getL2Network, } from '../../src/lib/dataEntities/networks' import { solidityKeccak256 } from 'ethers/lib/utils' diff --git a/tests/integration/sendL2msg.test.ts b/tests/integration/sendL2msg.test.ts index 2fe9fc62ac..591d4f994c 100644 --- a/tests/integration/sendL2msg.test.ts +++ b/tests/integration/sendL2msg.test.ts @@ -21,7 +21,7 @@ import { BigNumber, ethers, Signer } from 'ethers' import { InboxTools } from '../../src/lib/inbox/inbox' import { getChildChain as getL2Network, - ChainNetwork as L2Network, + ChildChain as L2Network, } from '../../src/lib/dataEntities/networks' import { testSetup } from '../../scripts/testSetup' import { greeter } from './helper/greeter' diff --git a/tests/integration/testHelpers.ts b/tests/integration/testHelpers.ts index dc6453590f..dea1b93d19 100644 --- a/tests/integration/testHelpers.ts +++ b/tests/integration/testHelpers.ts @@ -31,7 +31,7 @@ import { L1ToL2MessageStatus, L2ToL1MessageStatus, } from '../../src' -import { ChainNetwork as L2Network } from '../../src/lib/dataEntities/networks' +import { ChildChain as L2Network } from '../../src/lib/dataEntities/networks' import { GasOverrides } from '../../src/lib/message/L1ToL2MessageGasEstimator' import { ArbSdkError } from '../../src/lib/dataEntities/errors' import { ERC20 } from '../../src/lib/abi/ERC20'