Skip to content

Commit

Permalink
feat: add checkL2TxStatus for base
Browse files Browse the repository at this point in the history
  • Loading branch information
zkbenny committed Sep 18, 2024
1 parent 46b3d69 commit 4c49d1f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion examples/base/.env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ L2RPC="https://sepolia.base.org"
L1RPC=""

# Base chain name
BASE="BASETEST"
BASE="BASESEPOLIA"

# Ethereum chain name
ETHEREUM="SEPOLIA"
27 changes: 9 additions & 18 deletions examples/base/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.0.0",
"scripts": {},
"devDependencies": {
"@eth-optimism/sdk": "^3.2.3",
"@eth-optimism/sdk": "^3.3.2",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"ethers": "^5.7.2",
"hardhat": "^2.9.1"
Expand Down
22 changes: 22 additions & 0 deletions examples/base/scripts/baseTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
encodeChangeFeeParams,
encodeL1ToL2Calldata,
checkL1TxStatus,
checkL2TxStatus,
} = require('../../optimism/scripts/opstack-utils');
const { task, types } = require('hardhat/config');
require('dotenv').config();
Expand All @@ -22,12 +23,23 @@ async function initMessenger() {
const l1Wallet = new ethers.Wallet(walletPrivateKey, l1Provider);
const l2Wallet = new ethers.Wallet(walletPrivateKey, l2Provider);

let contracts = undefined;
if (ethereumName === 'SEPOLIA') {
contracts = {
l1: {
OptimismPortal2: '0x49f53e41452C74589E85cA1677426Ba426459e85',
DisputeGameFactory: '0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1',
},
};
}

const messenger = new base.CrossChainMessenger({
l1ChainId: await l1Wallet.getChainId(),
l2ChainId: await l2Wallet.getChainId(),
l1SignerOrProvider: l1Wallet,
l2SignerOrProvider: l2Wallet,
bedrock: true,
contracts,
});

return { messenger, ethereumName, baseName };
Expand Down Expand Up @@ -151,3 +163,13 @@ task('checkL1TxStatus', 'Check the l1 tx status')
const { messenger, ethereumName, baseName } = await initMessenger();
await checkL1TxStatus(hre, messenger, ethereumName, baseName, l1TxHash);
});

task('checkL2TxStatus', 'Check the l2 tx status')
.addParam('l2TxHash', 'The l2 tx hash', undefined, types.string)
.setAction(async (taskArgs, hre) => {
const l2TxHash = taskArgs.l2TxHash;
console.log(`The l2 tx hash: ${l2TxHash}`);

const { messenger, ethereumName, optimismName } = await initMessenger();
await checkL2TxStatus(hre, messenger, ethereumName, optimismName, l2TxHash);
});

0 comments on commit 4c49d1f

Please sign in to comment.