zone.requestVerifiableWithdrawal
Requests a verifiable withdrawal from a zone to the parent Tempo chain.
This variant includes a revealTo public key so the sequencer can encrypt the withdrawal details for the recipient.
Requires viem >=2.48.0
Zone actions and hooks require viem >=2.48.0.
Usage
import { createConfig } from 'wagmi'
import { http as zoneHttp, zone } from 'viem/tempo/zones'
const zoneChain = zone(7)
const config = createConfig({
chains: [zoneChain],
transports: {
[zoneChain.id]: zoneHttp(),
},
})
import { Actions } from 'wagmi/tempo'
const result = await Actions.zone.requestVerifiableWithdrawalSync(config, {
amount: 1_000_000n,
chainId: zoneChain.id,
revealTo:
'0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
token: '0x20c0000000000000000000000000000000000001',
})
console.log('Transaction hash:', result.receipt.transactionHash)
// @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdefAsynchronous Usage
The example above uses a *Sync variant of the action, that will wait for the transaction to be included before returning.
If you are optimizing for performance, you should use the non-sync zone.requestVerifiableWithdrawal action and wait for inclusion manually:
import { Actions } from 'wagmi/tempo'
import { waitForTransactionReceipt } from 'wagmi/actions'
const hash = await Actions.zone.requestVerifiableWithdrawal(config, {
amount: 1_000_000n,
chainId: zoneChain.id,
revealTo:
'0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
token: '0x20c0000000000000000000000000000000000001',
})
const receipt = await waitForTransactionReceipt(config, { hash })
console.log(receipt.status)Return Type
type ReturnType = {
/** Transaction receipt */
receipt: TransactionReceipt
}Returns the transaction receipt from zone.requestVerifiableWithdrawalSync.
Parameters
amount
- Type:
bigint
Amount of tokens to withdraw.
revealTo
- Type:
Hex
33-byte compressed secp256k1 public key used for the encrypted reveal payload.
token
- Type:
Address | bigint
Address or ID of the TIP-20 token to withdraw.
to (optional)
- Type:
Address
Recipient address on the parent Tempo chain. Defaults to the connected account address.
data (optional)
- Type:
Hex
Optional callback data for the parent-chain recipient.
fallbackRecipient (optional)
- Type:
Address
Fallback recipient if the callback fails. Defaults to to.
gas (optional)
- Type:
bigint
Gas limit reserved for the withdrawal callback on the parent chain.
memo (optional)
- Type:
Hex
Optional withdrawal memo.
account (optional)
- Type:
Account | Address
Account that will be used to send the transaction. Defaults to connected Wagmi account.
feeToken (optional)
- Type:
Address | bigint
Fee token for the transaction.
Can be a TIP-20 token address or ID.
feePayer (optional)
- Type:
Account | true
Fee payer for the transaction.
Can be a Viem Account, or true if a Fee Payer Service will be used.
gas (optional)
- Type:
bigint
Gas limit for the transaction.
maxFeePerGas (optional)
- Type:
bigint
Max fee per gas for the transaction.
maxPriorityFeePerGas (optional)
- Type:
bigint
Max priority fee per gas for the transaction.
nonce (optional)
- Type:
number
Nonce for the transaction.
nonceKey (optional)
- Type:
'expiring' | bigint
Nonce key for the transaction.
validBefore (optional)
- Type:
number
Unix timestamp before which the transaction must be included.
validAfter (optional)
- Type:
number
Unix timestamp after which the transaction can be included.
throwOnReceiptRevert (optional)
- Type:
boolean - Default:
true
Whether to throw an error if the transaction receipt indicates a revert. Only applicable to *Sync actions.