Skip to content

Channel

TIP-20 channel reserve descriptor, constants, and deterministic hashing utilities.

Channel descriptors are emitted by Channel.open and then reused to settle, top up, close, request close, withdraw, or compute the channel ID. The channel reserve precompile exposes helper methods for channel identifiers, voucher sign payloads, and its EIP-712 domain separator. These utilities compute the same values locally when the chain id and channel fields are known.

Examples

import { Channel } from 'ox/tempo'
 
const channel = Channel.from({
  expiringNonceHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
  payee: '0x2222222222222222222222222222222222222222',
  payer: '0x1111111111111111111111111111111111111111',
  salt: '0x0000000000000000000000000000000000000000000000000000000000000001',
  token: 1n,
})
 
const channelId = Channel.computeId(channel, { chainId: 4217 })

Functions

NameDescription
Channel.computeIdComputes the canonical TIP-20 channel id for a descriptor.
Channel.domainSeparatorComputes the EIP-712 domain separator for the TIP-20 channel reserve.
Channel.fromInstantiates a TIP-20 channel reserve descriptor.
Channel.getVoucherSignPayloadComputes the EIP-712 sign payload for a TIP-20 channel voucher.

Types

NameDescription
Channel.ChannelTIP-20 channel descriptor.
Channel.ResolvedHex-address-normalized Channel.Channel.