Skip to content

Commit 6841363

Browse files
authored
update fees to work with different L1s
1 parent 7c643b6 commit 6841363

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.env-example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
L1_URL=""
2+
BOOTNODE=""
3+
4+
L1_CHAIN_ID="1337" # Devent
5+
# L1_CHAIN_ID="11155111" # Sepolia

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ log/
55
.vscode
66
.DS_Store
77
codegenCache.json
8+
.env

scripts/fees.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createLogger, FeeJuicePaymentMethodWithClaim, Fr, L1FeeJuicePortalManager, PXE, waitForPXE , createPXEClient, Logger, FeeJuicePaymentMethod, PrivateFeePaymentMethod, PublicFeePaymentMethod } from "@aztec/aztec.js";
22
import {
3+
Chain,
34
createPublicClient,
45
createWalletClient,
56
http,
@@ -18,6 +19,8 @@ import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
1819
import { deploySchnorrAccount } from "./deploy-account.js";
1920
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
2021
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
22+
import * as dotenv from 'dotenv';
23+
dotenv.config();
2124

2225
const setupSandbox = async () => {
2326
const { PXE_URL = 'http://localhost:8081' } = process.env;
@@ -29,11 +32,11 @@ const setupSandbox = async () => {
2932
const MNEMONIC = 'test test test test test test test test test test test junk';
3033
const FEE_FUNDING_FOR_TESTER_ACCOUNT = 1000000000000000000n;
3134

32-
let walletClient = getL1WalletClient(foundry.rpcUrls.default.http[0], 0);
35+
let walletClient = getL1WalletClient(process.env.L1_URL!, 0);
3336

3437
const publicClient = createPublicClient({
3538
chain: foundry,
36-
transport: http("http://127.0.0.1:8545"),
39+
transport: http(process.env.L1_URL),
3740
});
3841

3942
async function main() {
@@ -140,9 +143,19 @@ main();
140143
// from here: https://github.com/AztecProtocol/aztec-packages/blob/ecbd59e58006533c8885a8b2fadbd9507489300c/yarn-project/end-to-end/src/fixtures/utils.ts#L534
141144
function getL1WalletClient(rpcUrl: string, index: number) {
142145
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+
}
143156
return createWalletClient({
144157
account: hdAccount,
145-
chain: foundry,
158+
chain,
146159
transport: http(rpcUrl),
147160
});
148161
}

0 commit comments

Comments
 (0)