getWithdrawalStatus
Returns the current status of a withdrawal. Used for the Withdrawal flow.
Usage
import { account, publicClientL1, publicClientL2 } from './config'
const receipt = await publicClientL2.getTransactionReceipt({
hash: '0x7b5cedccfaf9abe6ce3d07982f57bcb9176313b019ff0fc602a0b70342fe3147',
})
const status = await publicClientL1.getWithdrawalStatus({
receipt,
targetChain: publicClientL2.chain,
})
// "ready-to-prove" //Returns
"waiting-to-prove" | "ready-to-prove" | "waiting-to-finalize" | "ready-to-finalize" | "finalized"
Parameters
receipt
- Type:
TransactionReceipt
The transaction receipt.
const status = await publicClientL1.getWithdrawalStatus({
receipt,
targetchain: mantle,
})targetChain
- Type:
Chain
The L2 chain.
const status = await publicClientL1.getWithdrawalStatus({
receipt,
targetchain: mantle,
})l2OutputOracleAddress (optional)
- Type:
Address - Default:
targetChain.contracts.l2OutputOracle[chainId].address
The address of the L2 Output Oracle contract. Defaults to the L2 Output Oracle contract specified on the targetChain.
If a l2OutputOracleAddress is provided, the targetChain parameter becomes optional.
const status = await publicClientL1.getWithdrawalStatus({
receipt,
l2OutputOracleAddress: '0xbEb5Fc579115071764c7423A4f12eDde41f106Ed'
portalAddress: '0xbEb5Fc579115071764c7423A4f12eDde41f106Ed'
})portalAddress (optional)
- Type:
Address - Default:
targetChain.contracts.portal[chainId].address
The address of the Portal contract. Defaults to the L2 Output Oracle contract specified on the targetChain.
If a portalAddress is provided, the targetChain parameter becomes optional.
const status = await publicClientL1.getWithdrawalStatus({
receipt,
l2OutputOracleAddress: '0xbEb5Fc579115071764c7423A4f12eDde41f106Ed',
portalAddress: '0xbEb5Fc579115071764c7423A4f12eDde41f106Ed',
})withdrawal (optional)
- Type:
Withdrawal
The withdrawal to check. Only needed for migrated / pre-Tectonic withdrawals: their transaction receipt has no MessagePassed event, so the withdrawal cannot be parsed from receipt. Reconstruct it with buildMigratedWithdrawal and pass it here. For normal withdrawals it is parsed from the receipt and can be omitted.
const withdrawal = await publicClientL2.buildMigratedWithdrawal({ legacyTxHash })
const status = await publicClientL1.getWithdrawalStatus({
receipt,
withdrawal,
targetChain: mantle,
})