channel.signVoucher
Signs a TIP-20 channel reserve voucher with the client account.
Usage
import { parseUnits } from 'viem'
import { client, channel } from './viem.config'
const signature = await client.channel.signVoucher({
channel,
cumulativeAmount: parseUnits('40', 6),
})
console.log('Signature:', signature)import { Account, createClient } from 'viem/tempo'
export const client = createClient({
account: Account.fromSecp256k1('0x...'),
})
import { Channel } from 'viem/tempo'
export const channel = Channel.from({
expiringNonceHash:
'0x0000000000000000000000000000000000000000000000000000000000000000',
payee: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
payer: client.account.address,
salt: '0x0000000000000000000000000000000000000000000000000000000000000000',
token: '0x20c0000000000000000000000000000000000001',
})Channel ID Input
Pass a channel ID when you already have one.
import { parseUnits } from 'viem'
import { client } from './viem.config'
const signature = await client.channel.signVoucher({
channel:
'0x0000000000000000000000000000000000000000000000000000000000000000',
cumulativeAmount: parseUnits('40', 6),
})Return Type
type ReturnType = HexThe voucher signature.
Parameters
channel
- Type:
Hex | Channel.from.Value
Channel ID or channel.
cumulativeAmount
- Type:
bigint
Total voucher amount signed for the channel.
account
- Type:
Account - Default:
client.account
Account to sign the voucher.
chainId
- Type:
number | bigint - Default:
client.chain.id
Chain ID used for the EIP-712 voucher payload and channel-derived IDs.