finalizeWithdrawal
Proves the inclusion of the L2->L1 withdrawal message.
Usage
example.ts
import { account, walletClient, zksyncClient } from './config'
 
const hash = await walletClient.finalizeWithdrawal({
  account,
  client: zksyncClient,
  hash: '0x…',
})Account Hoisting
If you do not wish to pass an account to every finalizeWithdrawal, you can also hoist the Account on the Wallet Client (see config.ts).
example.ts
import { walletClient, zksyncClient } from './config'
 
const hash = await walletClient.finalizeWithdrawal({
  client: zksyncClient,
  hash: '0x…',
})Returns
The Transaction hash.
Parameters
client
- Type: Client
The L2 client for fetching data from L2 chain.
const hash = await walletClient.finalizeWithdrawal({
  client: zksyncClient, 
  hash: '0x…',
})hash
- Type: Hex
Hash of the L2 transaction where the withdrawal was initiated.
const hash = await walletClient.finalizeWithdrawal({
  client: zksyncClient,
  hash: '0x…',  
})index (optional)
- Type: number
- Default: 0
In case there were multiple withdrawals in one transaction, you may pass an index of the withdrawal you want to finalize.
const hash = await walletClient.finalizeWithdrawal({
  client: zksyncClient,
  hash: '0x…',
  index: 0n, 
})chain (optional)
- Type: Chain
- Default: walletClient.chain
The target chain. If there is a mismatch between the wallet's current chain & the target chain, an error will be thrown.
import { zksync } from 'viem/chains'
 
const hash = await walletClient.finalizeWithdrawal({
  chain: zksync, 
  client: zksyncClient,
  hash: '0x…',
})
