@@ -12,41 +12,49 @@ import {
1212import { generatePrivateKey , privateKeyToAccount } from 'viem/accounts' ;
1313
1414import { nitroTestnodeL1 , nitroTestnodeL2 } from './chains' ;
15- import { getNitroTestnodePrivateKeyAccounts } from './testHelpers' ;
15+ import { getNitroTestnodePrivateKeyAccounts , PrivateKeyAccountWithPrivateKey } from './testHelpers' ;
1616import { feeRouterDeployChildToParentRewardRouter } from './feeRouterDeployChildToParentRewardRouter' ;
1717import { feeRouterDeployRewardDistributor } from './feeRouterDeployRewardDistributor' ;
18+ import { getAnvilTestStack , isAnvilTestMode } from './integrationTestHelpers/injectedMode' ;
1819
19- const testnodeAccounts = getNitroTestnodePrivateKeyAccounts ( ) ;
20- const deployer = testnodeAccounts . deployer ;
20+ const env = isAnvilTestMode ( ) ? getAnvilTestStack ( ) : undefined ;
2121const randomAccount = privateKeyToAccount ( generatePrivateKey ( ) ) ;
2222const randomAccount2 = privateKeyToAccount ( generatePrivateKey ( ) ) ;
2323
24- const nitroTestnodeL1Client = createPublicClient ( {
25- chain : nitroTestnodeL1 ,
26- transport : http ( nitroTestnodeL1 . rpcUrls . default . http [ 0 ] ) ,
24+ let deployer : PrivateKeyAccountWithPrivateKey ;
25+ if ( env ) {
26+ deployer = env . l2 . accounts . deployer ;
27+ } else {
28+ deployer = getNitroTestnodePrivateKeyAccounts ( ) . deployer ;
29+ }
30+
31+ const l1Client = createPublicClient ( {
32+ chain : env ? env . l1 . chain : nitroTestnodeL1 ,
33+ transport : http ( ) ,
2734} ) ;
2835
29- const nitroTestnodeL2Client = createPublicClient ( {
30- chain : nitroTestnodeL2 ,
31- transport : http ( nitroTestnodeL2 . rpcUrls . default . http [ 0 ] ) ,
36+ const l2Client = createPublicClient ( {
37+ chain : env ? env . l2 . chain : nitroTestnodeL2 ,
38+ transport : http ( ) ,
3239} ) ;
33- const nitroTestnodeL2WalletClient = createWalletClient ( {
34- chain : nitroTestnodeL2 ,
35- transport : http ( nitroTestnodeL2 . rpcUrls . default . http [ 0 ] ) ,
40+
41+ const l2WalletClient = createWalletClient ( {
42+ chain : env ? env . l2 . chain : nitroTestnodeL2 ,
43+ transport : http ( ) ,
3644 account : deployer ,
3745} ) ;
3846
3947describe ( 'Fee routing tests' , ( ) => {
4048 it ( `successfully deploys and configures an ArbChildToParentRewardRouter` , async ( ) => {
4149 const childToParentRewardRouterDeploymentTransactionHash =
4250 await feeRouterDeployChildToParentRewardRouter ( {
43- parentChainPublicClient : nitroTestnodeL1Client ,
44- orbitChainWalletClient : nitroTestnodeL2WalletClient ,
51+ parentChainPublicClient : l1Client ,
52+ orbitChainWalletClient : l2WalletClient ,
4553 parentChainTargetAddress : randomAccount . address ,
4654 } ) ;
4755
4856 const childToParentRewardRouterDeploymentTransactionReceipt =
49- await nitroTestnodeL2Client . waitForTransactionReceipt ( {
57+ await l2Client . waitForTransactionReceipt ( {
5058 hash : childToParentRewardRouterDeploymentTransactionHash ,
5159 } ) ;
5260
@@ -59,7 +67,7 @@ describe('Fee routing tests', () => {
5967 ) ;
6068
6169 // reading the parentChainTarget
62- const parentChainTarget = await nitroTestnodeL2Client . readContract ( {
70+ const parentChainTarget = await l2Client . readContract ( {
6371 address : childToParentRewardRouterAddress ,
6472 abi : parseAbi ( [ 'function parentChainTarget() view returns (address)' ] ) ,
6573 functionName : 'parentChainTarget' ,
@@ -80,14 +88,13 @@ describe('Fee routing tests', () => {
8088 } ,
8189 ] ;
8290 const rewardDistributorDeploymentTransactionHash = await feeRouterDeployRewardDistributor ( {
83- orbitChainWalletClient : nitroTestnodeL2WalletClient ,
91+ orbitChainWalletClient : l2WalletClient ,
8492 recipients,
8593 } ) ;
8694
87- const rewardDistributorDeploymentTransactionReceipt =
88- await nitroTestnodeL2Client . waitForTransactionReceipt ( {
89- hash : rewardDistributorDeploymentTransactionHash ,
90- } ) ;
95+ const rewardDistributorDeploymentTransactionReceipt = await l2Client . waitForTransactionReceipt ( {
96+ hash : rewardDistributorDeploymentTransactionHash ,
97+ } ) ;
9198
9299 expect ( rewardDistributorDeploymentTransactionReceipt ) . to . have . property ( 'contractAddress' ) ;
93100
@@ -117,13 +124,13 @@ describe('Fee routing tests', () => {
117124 const recipientWeights = keccak256 ( encodePacked ( [ 'uint256' , 'uint256' ] , [ 9000n , 1000n ] ) ) ;
118125
119126 // reading the currentRecipientGroup and currentRecipientWeights
120- const currentRecipientGroup = await nitroTestnodeL2Client . readContract ( {
127+ const currentRecipientGroup = await l2Client . readContract ( {
121128 address : rewardDistributorAddress ,
122129 abi : parseAbi ( [ 'function currentRecipientGroup() view returns (bytes32)' ] ) ,
123130 functionName : 'currentRecipientGroup' ,
124131 } ) ;
125132
126- const currentRecipientWeights = await nitroTestnodeL2Client . readContract ( {
133+ const currentRecipientWeights = await l2Client . readContract ( {
127134 address : rewardDistributorAddress ,
128135 abi : parseAbi ( [ 'function currentRecipientWeights() view returns (bytes32)' ] ) ,
129136 functionName : 'currentRecipientWeights' ,
0 commit comments