Skip to content

policy.useModifyWhitelist ​

Modifies the whitelist for a whitelist-type transfer policy. Requires policy admin role.

Usage ​

ts
import {  } from 'wagmi/tempo'

const  = ..()

// Call `mutate` in response to user action (e.g. button click, form submission)
.({
  : '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  : true,
  : 1n,
})

.('Transaction hash:', .?..)
Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
ts
import { createConfig, http } from 'wagmi'
import { tempoTestnet } from 'wagmi/chains'
import { KeyManager, webAuthn } from 'wagmi/tempo'

export const config = createConfig({
  connectors: [
    webAuthn({
      keyManager: KeyManager.localStorage(),
    }),
  ],
  chains: [tempoTestnet],
  multiInjectedProviderDiscovery: false,
  transports: {
    [tempoTestnet.id]: http(),
  },
})

Asynchronous 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 policy.modifyWhitelist action and wait for inclusion manually:

ts
import { Hooks } from 'wagmi/tempo'
import { Actions } from 'viem/tempo'
import { useWaitForTransactionReceipt } from 'wagmi'

const modifyWhitelist = Hooks.policy.useModifyWhitelist()
const { data: receipt } = useWaitForTransactionReceipt({ hash: modifyWhitelist.data })

// Call `mutate` in response to user action (e.g. button click, form submission)
modifyWhitelist.mutate({
  address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  allowed: true,
  policyId: 1n,
})

if (receipt) {
  const { args } 
    = Actions.policy.modifyWhitelist.extractEvent(receipt.logs)

Return Type ​

See TanStack Query mutation docs for more info hook return types.

data ​

See Wagmi Action policy.modifyWhitelist Return Type

mutate/mutateAsync ​

See Wagmi Action policy.modifyWhitelist Parameters

Parameters ​

config ​

Config | undefined

Config to use instead of retrieving from the nearest WagmiProvider.

mutation ​

See the TanStack Query mutation docs for more info hook parameters.

Action ​

Released under the MIT License.