Skip to content
LogoLogo

Get Zone Withdrawal Fee

zone.getWithdrawalFee

Returns the fee required for a withdrawal from a zone, given a callback gas limit.

Usage

import {  } from './zones.config'
 
const  = await ..()
 
.('Fee:', )
Fee: 0n

Callback Gas

import {  } from './zones.config'
 
const  = await ..({
  : 100_000n,
})

Recipes

Check the Balance Covers Amount plus Fee

Combine the fee with token.getBalance before calling zone.requestWithdrawal, so a withdrawal that cannot cover its fee never reaches the sequencer.

import {  } from './zones.config'
 
const  = 250_000_000n
const  = '0x20c0000000000000000000000000000000000001'
 
const  = await ..()
const  = await ..({  })
 
if (. >=  + )
  await ..({ ,  })

Return Value

type ReturnType = bigint

The withdrawal fee.

Parameters

callbackGas

  • Type: bigint
  • Default: 0n

Gas limit reserved for the withdrawal callback on the parent chain.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.