From 498615863808b7f009fca7b1b4c03b3934f6bc89 Mon Sep 17 00:00:00 2001 From: Doug <4741454+douglance@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:24:54 -0400 Subject: [PATCH] change checkParentChain/checkChildChain to network --- src/lib/assetBridger/assetBridger.ts | 8 +++--- src/lib/assetBridger/erc20Bridger.ts | 38 ++++++++++++++-------------- src/lib/assetBridger/ethBridger.ts | 8 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/lib/assetBridger/assetBridger.ts b/src/lib/assetBridger/assetBridger.ts index fa4e6fda5..6ef1d549d 100644 --- a/src/lib/assetBridger/assetBridger.ts +++ b/src/lib/assetBridger/assetBridger.ts @@ -43,10 +43,10 @@ export abstract class AssetBridger { } /** - * Check the signer/provider matches the parentChain, throws if not + * Check the signer/provider matches the parent network, throws if not * @param sop */ - protected async checkParentChain(sop: SignerOrProvider): Promise { + protected async checkParentNetwork(sop: SignerOrProvider): Promise { await SignerProviderUtils.checkNetworkMatches( sop, this.childNetwork.parentChainId @@ -54,10 +54,10 @@ export abstract class AssetBridger { } /** - * Check the signer/provider matches the childNetwork, throws if not + * Check the signer/provider matches the child network, throws if not * @param sop */ - protected async checkChildChain(sop: SignerOrProvider): Promise { + protected async checkChildNetwork(sop: SignerOrProvider): Promise { await SignerProviderUtils.checkNetworkMatches( sop, this.childNetwork.chainId diff --git a/src/lib/assetBridger/erc20Bridger.ts b/src/lib/assetBridger/erc20Bridger.ts index b46204c47..84ceed3b0 100644 --- a/src/lib/assetBridger/erc20Bridger.ts +++ b/src/lib/assetBridger/erc20Bridger.ts @@ -223,7 +223,7 @@ export class Erc20Bridger extends AssetBridger< erc20ParentAddress: string, parentProvider: Provider ): Promise { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) return await L1GatewayRouter__factory.connect( this.childNetwork.tokenBridge.parentGatewayRouter, @@ -241,7 +241,7 @@ export class Erc20Bridger extends AssetBridger< erc20ParentAddress: string, childProvider: Provider ): Promise { - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) return await L2GatewayRouter__factory.connect( this.childNetwork.tokenBridge.childGatewayRouter, @@ -276,7 +276,7 @@ export class Erc20Bridger extends AssetBridger< throw new Error('chain uses ETH as its native/gas token') } - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const approveGasTokenRequest = this.isApproveParams(params) ? await this.getApproveGasTokenRequest({ @@ -335,7 +335,7 @@ export class Erc20Bridger extends AssetBridger< public async approveToken( params: ApproveParamsOrTxRequest ): Promise { - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const approveRequest = this.isApproveParams(params) ? await this.getApproveTokenRequest({ @@ -368,7 +368,7 @@ export class Erc20Bridger extends AssetBridger< fromAddress?: string, toAddress?: string ): Promise<(EventArgs & { txHash: string })[]> { - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) const eventFetcher = new EventFetcher(childProvider) const events = ( @@ -488,7 +488,7 @@ export class Erc20Bridger extends AssetBridger< erc20ParentAddress: string, parentProvider: Provider ): Promise { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) const parentGatewayRouter = L1GatewayRouter__factory.connect( this.childNetwork.tokenBridge.parentGatewayRouter, @@ -511,7 +511,7 @@ export class Erc20Bridger extends AssetBridger< erc20ChildChainAddress: string, childProvider: Provider ): Promise { - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) // child network WETH contract doesn't have the parentAddress method on it if ( @@ -557,7 +557,7 @@ export class Erc20Bridger extends AssetBridger< parentTokenAddress: string, parentProvider: Provider ): Promise { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) const parentGatewayRouter = L1GatewayRouter__factory.connect( this.childNetwork.tokenBridge.parentGatewayRouter, @@ -647,8 +647,8 @@ export class Erc20Bridger extends AssetBridger< public async getDepositRequest( params: DepositRequest ): Promise { - await this.checkParentChain(params.parentProvider) - await this.checkChildChain(params.childProvider) + await this.checkParentNetwork(params.parentProvider) + await this.checkChildNetwork(params.childProvider) const defaultedParams = this.applyDefaults(params) const { amount, @@ -754,7 +754,7 @@ export class Erc20Bridger extends AssetBridger< public async deposit( params: Erc20DepositParams | ParentToChildTxReqAndSignerProvider ): Promise { - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) // Although the types prevent should alert callers that value is not // a valid override, it is possible that they pass it in anyway as it's a common override @@ -879,7 +879,7 @@ export class Erc20Bridger extends AssetBridger< if (!SignerProviderUtils.signerHasProvider(params.childSigner)) { throw new MissingProviderArbSdkError('childSigner') } - await this.checkChildChain(params.childSigner) + await this.checkChildNetwork(params.childSigner) const withdrawalRequest = isChildToParentTransactionRequest< OmitTyped & { childSigner: Signer } @@ -989,7 +989,7 @@ export class AdminErc20Bridger extends Erc20Bridger { throw new Error('chain uses ETH as its native/gas token') } - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const approveGasTokenRequest = this.isApproveParams(params) ? this.getApproveGasTokenForCustomTokenRegistrationRequest({ @@ -1024,8 +1024,8 @@ export class AdminErc20Bridger extends Erc20Bridger { if (!SignerProviderUtils.signerHasProvider(parentSigner)) { throw new MissingProviderArbSdkError('parentSigner') } - await this.checkParentChain(parentSigner) - await this.checkChildChain(childProvider) + await this.checkParentNetwork(parentSigner) + await this.checkChildNetwork(childProvider) const parentProvider = parentSigner.provider! const parentSenderAddress = await parentSigner.getAddress() @@ -1178,7 +1178,7 @@ export class AdminErc20Bridger extends Erc20Bridger { parentProvider: Provider, filter: { fromBlock: BlockTag; toBlock: BlockTag } ): Promise[]> { - await this.checkParentChain(parentProvider) + await this.checkParentNetwork(parentProvider) const parentGatewayRouterAddress = this.childNetwork.tokenBridge.parentGatewayRouter @@ -1208,7 +1208,7 @@ export class AdminErc20Bridger extends Erc20Bridger { 'Must supply customNetworkL2GatewayRouter for custom network ' ) } - await this.checkChildChain(childProvider) + await this.checkChildNetwork(childProvider) const childGatewayRouterAddress = customNetworkL2GatewayRouter || @@ -1240,8 +1240,8 @@ export class AdminErc20Bridger extends Erc20Bridger { if (!SignerProviderUtils.signerHasProvider(parentSigner)) { throw new MissingProviderArbSdkError('parentSigner') } - await this.checkParentChain(parentSigner) - await this.checkChildChain(childProvider) + await this.checkParentNetwork(parentSigner) + await this.checkChildNetwork(childProvider) const from = await parentSigner.getAddress() diff --git a/src/lib/assetBridger/ethBridger.ts b/src/lib/assetBridger/ethBridger.ts index 88caae160..61dd02bc1 100644 --- a/src/lib/assetBridger/ethBridger.ts +++ b/src/lib/assetBridger/ethBridger.ts @@ -287,7 +287,7 @@ export class EthBridger extends AssetBridger< public async deposit( params: EthDepositParams | ParentToChildTxReqAndSigner ): Promise { - await this.checkParentChain(params.parentSigner) + await this.checkParentNetwork(params.parentSigner) const ethDeposit = isParentToChildTransactionRequest(params) ? params @@ -341,8 +341,8 @@ export class EthBridger extends AssetBridger< | EthDepositToParams | (ParentToChildTxReqAndSigner & { childProvider: Provider }) ): Promise { - await this.checkParentChain(params.parentSigner) - await this.checkChildChain(params.childProvider) + await this.checkParentNetwork(params.parentSigner) + await this.checkChildNetwork(params.childProvider) const retryableTicketRequest = isParentToChildTransactionRequest(params) ? params @@ -413,7 +413,7 @@ export class EthBridger extends AssetBridger< if (!SignerProviderUtils.signerHasProvider(params.childSigner)) { throw new MissingProviderArbSdkError('childSigner') } - await this.checkChildChain(params.childSigner) + await this.checkChildNetwork(params.childSigner) const request = isChildToParentTransactionRequest< EthWithdrawParams & { childSigner: Signer }