@@ -10,7 +10,7 @@ import {
10
10
waitTillCompleted ,
11
11
} from "@nilfoundation/niljs" ;
12
12
import "dotenv/config" ;
13
- import { L2NetworkConfig , loadNilNetworkConfig , saveNilNetworkConfig } from "../deploy/config/config-helper" ;
13
+ import { L2NetworkConfig , loadL1NetworkConfig , loadNilNetworkConfig , saveNilNetworkConfig } from "../deploy/config/config-helper" ;
14
14
import { getCheckSummedAddress } from '../scripts/utils/validate-config' ;
15
15
16
16
let smartAccount : SmartAccountV1 | null = null ;
@@ -74,10 +74,9 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
74
74
PRIVATE_KEY : privateKey ,
75
75
SMART_ACCOUNT_ADDRESS : smartAccount . address ,
76
76
} ) ) ;
77
- console . log ( "🆕 New Smart Account Generated:" , smartAccount . address ) ;
77
+ console . log ( "🆕 owner Smart Account Generated:" , smartAccount . address ) ;
78
78
}
79
79
80
- //DEPOSIT_RECIPIENT_PRIVATE_KEY = "0xe4d6ddfd7479614249381d4bd240fa2408efc53dad5f7f31cb7ae7e5962fc1d0"
81
80
const depositRecipientPrivateKey = process . env . DEPOSIT_RECIPIENT_PRIVATE_KEY as `0x${string } `;
82
81
let signer = new LocalECDSAKeySigner ( { privateKey : depositRecipientPrivateKey } ) ;
83
82
const depositRecipientSmartAccount = new SmartAccountV1 ( {
@@ -88,11 +87,11 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
88
87
pubkey : signer . getPublicKey ( ) ,
89
88
} ) ;
90
89
const depositRecipientSmartAccountAddress = depositRecipientSmartAccount . address ;
91
- console . log ( "🆕 New Smart Account Generated:" , depositRecipientSmartAccountAddress ) ;
90
+ console . log ( "🆕 depositRecipient Smart Account Generated:" , depositRecipientSmartAccountAddress ) ;
92
91
93
92
94
93
const nilFeeRefundAddressPrivateKey = process . env . NIL_FEE_REFUND_PRIVATE_KEY as `0x${string } `;
95
- signer = new LocalECDSAKeySigner ( { privateKey : depositRecipientPrivateKey } ) ;
94
+ signer = new LocalECDSAKeySigner ( { privateKey : nilFeeRefundAddressPrivateKey } ) ;
96
95
const feeRefundSmartAccount = new SmartAccountV1 ( {
97
96
signer,
98
97
client,
@@ -101,13 +100,17 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
101
100
pubkey : signer . getPublicKey ( ) ,
102
101
} ) ;
103
102
const feeRefundSmartAccountAddress = feeRefundSmartAccount . address ;
103
+ console . log ( "🆕 feeRefund Smart Account Generated:" , feeRefundSmartAccountAddress ) ;
104
104
105
+ console . log ( `about to topup owner via faucet` ) ;
105
106
const topUpFaucet = await faucetClient . topUp ( {
106
107
smartAccountAddress : smartAccount . address ,
107
108
amount : convertEthToWei ( 0.1 ) ,
108
109
faucetAddress : process . env . NIL as `0x${string } `,
109
110
} ) ;
110
111
112
+ console . log ( `faucet topup initiation done` ) ;
113
+
111
114
await waitTillCompleted ( client , topUpFaucet ) ;
112
115
113
116
if ( ( await smartAccount . checkDeploymentStatus ( ) ) === false ) {
@@ -121,8 +124,11 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
121
124
122
125
config . l2CommonConfig . owner = getCheckSummedAddress ( smartAccountAddress ) ;
123
126
config . l2CommonConfig . admin = getCheckSummedAddress ( smartAccountAddress ) ;
124
- config . l2CommonConfig . depositRecipient = getCheckSummedAddress ( depositRecipientSmartAccountAddress ) ;
125
- config . l2CommonConfig . feeRefundRecipient = getCheckSummedAddress ( feeRefundSmartAccountAddress ) ;
127
+
128
+ const l1Config = loadL1NetworkConfig ( networkName ) ;
129
+
130
+ l1Config . l1TestConfig . l2DepositRecipient = getCheckSummedAddress ( depositRecipientSmartAccountAddress ) ;
131
+ l1Config . l1TestConfig . l2FeeRefundRecipient = getCheckSummedAddress ( feeRefundSmartAccountAddress ) ;
126
132
127
133
// Save the updated config
128
134
saveNilNetworkConfig ( networkName , config ) ;
0 commit comments