Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
LayneHaber committed Nov 16, 2023
1 parent b64c11a commit a8fd192
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/helpers/propagate/linea.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import {BigNumber} from 'ethers';
import {InitialSetup, type ExtraPropagateParameters} from 'src/utils/types';
import {LineaSDK} from "@consensys/linea-sdk";
import {type InitialSetup, type ExtraPropagateParameters} from 'src/utils/types';
import {LineaSDK} from '@consensys/linea-sdk';

export const getPropagateParameters = async ({lineaProvider, provider, environment}: InitialSetup): Promise<ExtraPropagateParameters> => {
// Postman Fee = target layer gas price * (gas estimated + gas limit surplus) * margin
// where target layer gas price is eth_gasPrice on the target layer, gas estimated = 100,000, gas limit surplus = 6000, and margin = 2.
// Postman Fee = target layer gas price * (gas estimated + gas limit surplus) * margin.
// The target layer gas price is eth_gasPrice on the target layer, gas estimated = 100,000, gas limit surplus = 6000, and margin = 2.
const sdk = new LineaSDK({
l1RpcUrl: provider.connection.url, // L1 rpc url
l2RpcUrl: lineaProvider.connection.url, // L2 rpc url
network: environment === "mainnet" ? "linea-mainnet" : "linea-goerli", // network you want to interact with (either linea-mainnet or linea-goerli)
mode: "read-only", // contract wrapper class mode (read-only or read-write), read-only: only read contracts state, read-write: read contracts state and claim messages
network: environment === 'mainnet' ? 'linea-mainnet' : 'linea-goerli', // Network you want to interact with (either linea-mainnet or linea-goerli)
mode: 'read-only', // Contract wrapper class mode (read-only or read-write), read-only: only read contracts state, read-write: read contracts state and claim messages
});
const gasPrice = (await sdk.getL2Contract().get1559Fees()).maxFeePerGas;
const l2Messenger = sdk.getL2Contract();
const {maxFeePerGas: gasPrice} = await l2Messenger.get1559Fees();

// On linea-goerli claimMessage gasLimit was 83717
// https://goerli.lineascan.build/tx/0x4c477dfcbc22cd99b461cfe714a6ad60796331d3c13e55a74a6de51c3cd9aab6
const gasLimit = BigNumber.from("120000");
// Source: https://goerli.lineascan.build/tx/0x4c477dfcbc22cd99b461cfe714a6ad60796331d3c13e55a74a6de51c3cd9aab6
const gasLimit = BigNumber.from('120000');
const margin = BigNumber.from(1);

const fee = gasPrice.mul(gasLimit).mul(margin).toString();
Expand Down

0 comments on commit a8fd192

Please sign in to comment.