xDomain Transaction Monitoring
How to monitor transaction status
1. Blockexplorer
2. Running a watcher
import { Watcher } from '@eth-optimism/core-utils'
this.watcher = new Watcher({
l1: {
provider: this.L1Provider,
messengerAddress: this.L1MessengerAddress,
},
l2: {
provider: this.L2Provider,
messengerAddress: this.L2MessengerAddress,
},
})
//Move ETH from L1 to L2 using the standard deposit system
depositETHL2 = async (value_Wei_String) => {
try {
const depositTxStatus = await this.L1StandardBridgeContract.depositETH(
this.L2GasLimit,
utils.formatBytes32String(new Date().getTime().toString()),
{
value: value_Wei_String
}
)
//at this point the tx has been submitted, and we are waiting...
await depositTxStatus.wait()
const [l1ToL2msgHash] = await this.watcher.getMessageHashesFromL1Tx(
depositTxStatus.hash
)
console.log(' got L1->L2 message hash', l1ToL2msgHash)
const l2Receipt = await this.watcher.getL2TransactionReceipt(
l1ToL2msgHash
)
console.log(' completed Deposit! L2 tx hash:', l2Receipt.transactionHash)
return l2Receipt
} catch(error) {
console.log("NS: depositETHL2 error:",error)
return error
}
}3. Using the Habtor Transaction API
get.l2.transactions
4. Using Third Party Analytics
Last updated