Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

useWriteContract

Usage

import { useWriteContract } from '@ivem/kit-vue'
 
const writeContract = useWriteContract()
await writeContract.mutateAsync({
  contract: 'token.iost',
  action: 'transfer',
  args: ['iost', 'alice', 'bob', '1.00000000', 'memo'],
})

Parameters

Write params:

  • contract: string
  • action: string
  • args: any[]
  • gasRatio?: number
  • gasLimit?: number
  • approves?: Array<{ token: string; amount: string }>

Return Type

  • mutate(params, options?) => void
  • mutateAsync(params) => Promise<{ hash: string }>
  • isPending: Ref<boolean>
  • error: Ref<Error | null>
  • data: Ref<{ hash: string } | null>

Examples

const tx = await writeContract.mutateAsync({
  contract: 'token.iost',
  action: 'transfer',
  args: ['iost', 'alice', 'bob', '1.00000000', 'memo'],
  gasRatio: 1,
  gasLimit: 2000000,
})

Related