Skip to content

Commit

Permalink
chore: update l1/2 name for dataEntities (#340)
Browse files Browse the repository at this point in the history
* chore: renames L1/2 to parentChain/chain  in inbox

* update to use new childChain name with ArbitrumChain type

* updates name of methods on inbox to use childChain

* Update childChainTransactionRequest

* remove `network`

* update names with from pr feedback

* chore: update l1/2 name for dataEntities

* removes network

* fix child renaming

* fix getChildChain

* fix integration test

* renames partner to parent/child
  • Loading branch information
douglance committed Nov 15, 2023
1 parent 3f8172f commit 612fff3
Show file tree
Hide file tree
Showing 23 changed files with 124 additions and 113 deletions.
6 changes: 2 additions & 4 deletions scripts/instantiate_bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ export const instantiateBridge = (
}

const l2Network = l2Networks[l2NetworkID]
const l1Network = l1Networks[l2Network.partnerChainID]
const l1Network = l1Networks[l2Network.parentChainId]

if (!l1Network) {
throw new Error(
`Unrecognised partner chain id: ${l2Network.partnerChainID}`
)
throw new Error(`Unrecognised parent chain id: ${l2Network.parentChainId}`)
}

const l1Rpc = (() => {
Expand Down
20 changes: 10 additions & 10 deletions scripts/testSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import { Wallet } from '@ethersproject/wallet'
import dotenv from 'dotenv'
import { EthBridger, InboxTools, Erc20Bridger } from '../src'
import {
L1Network,
L2Network,
getL1Network,
getL2Network,
ParentChain as L1Network,
ChildChain as L2Network,
getParentChain as getL1Network,
getChildChain as getL2Network,
addCustomNetwork,
} from '../src/lib/dataEntities/networks'
import { Signer } from 'ethers'
Expand Down Expand Up @@ -104,7 +104,7 @@ export const getCustomNetworks = async (
explorerUrl: '',
isCustom: true,
name: 'EthLocal',
partnerChainIDs: [l2NetworkInfo.chainId],
childChainIds: [l2NetworkInfo.chainId],
isArbitrum: false,
}

Expand All @@ -122,7 +122,7 @@ export const getCustomNetworks = async (
isArbitrum: true,
isCustom: true,
name: 'ArbLocal',
partnerChainID: l1NetworkInfo.chainId,
parentChainId: l1NetworkInfo.chainId,
retryableLifetimeSeconds: 7 * 24 * 60 * 60,
nitroGenesisBlock: 0,
nitroGenesisL1Block: 0,
Expand Down Expand Up @@ -171,8 +171,8 @@ export const setupNetworks = async (
}

addCustomNetwork({
customL1Network: l1Network,
customL2Network: l2Network,
customParentChain: l1Network,
customChildChain: l2Network,
})

// also register the weth gateway
Expand Down Expand Up @@ -244,8 +244,8 @@ export const testSetup = async (): Promise<{
l2Network: L2Network
}
addCustomNetwork({
customL1Network: l1Network,
customL2Network: l2Network,
customParentChain: l1Network,
customChildChain: l2Network,
})
setL1Network = l1Network
setL2Network = l2Network
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ export { L1ToL2MessageGasEstimator } from './lib/message/L1ToL2MessageGasEstimat
export { argSerializerConstructor } from './lib/utils/byte_serialize_params'
export { CallInput, MultiCaller } from './lib/utils/multicall'
export {
L1Networks,
L2Networks,
L1Network,
L2Network,
getL1Network,
getL2Network,
ParentChains as L1Networks,
ChildChains as L2Networks,
ParentChain as L1Network,
ChildChain as L2Network,
getParentChain as getL1Network,
getChildChain as getL2Network,
addCustomNetwork,
addDefaultLocalNetwork,
} from './lib/dataEntities/networks'
Expand Down
10 changes: 7 additions & 3 deletions src/lib/assetBridger/assetBridger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import { ArbSdkError } from '../dataEntities/errors'
import { L1ContractTransaction } from '../message/L1Transaction'
import { L2ContractTransaction } from '../message/L2Transaction'

import { l1Networks, L1Network, L2Network } from '../dataEntities/networks'
import {
parentChains as l1Networks,
ParentChain as L1Network,
ChildChain as L2Network,
} from '../dataEntities/networks'
import {
SignerOrProvider,
SignerProviderUtils,
Expand All @@ -33,10 +37,10 @@ export abstract class AssetBridger<DepositParams, WithdrawParams> {
public readonly l1Network: L1Network

public constructor(public readonly l2Network: L2Network) {
this.l1Network = l1Networks[l2Network.partnerChainID]
this.l1Network = l1Networks[l2Network.parentChainId]
if (!this.l1Network) {
throw new ArbSdkError(
`Unknown l1 network chain id: ${l2Network.partnerChainID}`
`Unknown l1 network chain id: ${l2Network.parentChainId}`
)
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/lib/assetBridger/erc20Bridger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ import {
L1ToL2MessageGasEstimator,
} from '../message/L1ToL2MessageGasEstimator'
import { SignerProviderUtils } from '../dataEntities/signerOrProvider'
import { L2Network, getL2Network } from '../dataEntities/networks'
import {
ChildChain as L2Network,
getChildChain as getL2Network,
} from '../dataEntities/networks'
import { ArbSdkError, MissingProviderArbSdkError } from '../dataEntities/errors'
import { DISABLED_GATEWAY } from '../dataEntities/constants'
import { EventFetcher } from '../utils/eventFetcher'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/assetBridger/ethBridger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
import { OmitTyped } from '../utils/types'
import { SignerProviderUtils } from '../dataEntities/signerOrProvider'
import { MissingProviderArbSdkError } from '../dataEntities/errors'
import { getL2Network } from '../dataEntities/networks'
import { getChildChain as getL2Network } from '../dataEntities/networks'

export interface EthWithdrawParams {
/**
Expand Down
Loading

0 comments on commit 612fff3

Please sign in to comment.