Skip to content
LogoLogo

receivePolicy.validate

Checks whether a transfer or mint to a receiver is allowed by the receiver's receive policy. Learn more about transfer policies

Usage

import { client } from './viem.config'
 
const { authorized, blockedReason } = await client.receivePolicy.validate({
  token: '0x20c0000000000000000000000000000000000001',
  sender: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  receiver: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
})
 
console.log('Authorized:', authorized)
Authorized: false
console.log('Blocked reason:', blockedReason)
Blocked reason: tokenFilter

Return Type

type ReturnType = {
  /** Whether the transfer is authorized. */
  authorized: boolean
  /** Reason the transfer would be blocked. */
  blockedReason: 'none' | 'tokenFilter' | 'receivePolicy'
}

Parameters

token

  • Type: Address

The TIP-20 token being transferred or minted.

sender

  • Type: Address

The originator of the transfer (or issuer of the mint).

receiver

  • Type: Address

The intended recipient whose receive policy is evaluated.