1
1
import { createLogger , FeeJuicePaymentMethodWithClaim , Fr , L1FeeJuicePortalManager , PXE , waitForPXE , createPXEClient , Logger , FeeJuicePaymentMethod , PrivateFeePaymentMethod , PublicFeePaymentMethod } from "@aztec/aztec.js" ;
2
2
import {
3
+ Chain ,
3
4
createPublicClient ,
4
5
createWalletClient ,
5
6
http ,
@@ -18,6 +19,8 @@ import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
18
19
import { deploySchnorrAccount } from "./deploy-account.js" ;
19
20
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js" ;
20
21
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice' ;
22
+ import * as dotenv from 'dotenv' ;
23
+ dotenv . config ( ) ;
21
24
22
25
const setupSandbox = async ( ) => {
23
26
const { PXE_URL = 'http://localhost:8081' } = process . env ;
@@ -29,11 +32,11 @@ const setupSandbox = async () => {
29
32
const MNEMONIC = 'test test test test test test test test test test test junk' ;
30
33
const FEE_FUNDING_FOR_TESTER_ACCOUNT = 1000000000000000000n ;
31
34
32
- let walletClient = getL1WalletClient ( foundry . rpcUrls . default . http [ 0 ] , 0 ) ;
35
+ let walletClient = getL1WalletClient ( process . env . L1_URL ! , 0 ) ;
33
36
34
37
const publicClient = createPublicClient ( {
35
38
chain : foundry ,
36
- transport : http ( "http://127.0.0.1:8545" ) ,
39
+ transport : http ( process . env . L1_URL ) ,
37
40
} ) ;
38
41
39
42
async function main ( ) {
@@ -140,9 +143,19 @@ main();
140
143
// from here: https://github.com/AztecProtocol/aztec-packages/blob/ecbd59e58006533c8885a8b2fadbd9507489300c/yarn-project/end-to-end/src/fixtures/utils.ts#L534
141
144
function getL1WalletClient ( rpcUrl : string , index : number ) {
142
145
const hdAccount = mnemonicToAccount ( MNEMONIC , { addressIndex : index } ) ;
146
+ const chain : Chain = {
147
+ id : Number ( process . env . L1_CHAIN_ID ! ) ,
148
+ name : "test" ,
149
+ nativeCurrency : {
150
+ name : "ETH" ,
151
+ symbol : "ETH" ,
152
+ decimals : 18
153
+ } ,
154
+ rpcUrls : { default : { http : [ process . env . L1_URL ! ] } }
155
+ }
143
156
return createWalletClient ( {
144
157
account : hdAccount ,
145
- chain : foundry ,
158
+ chain,
146
159
transport : http ( rpcUrl ) ,
147
160
} ) ;
148
161
}
0 commit comments