Skip to content

useCallContract

Composable for calling a Sophia contract function as an on-chain transaction.

Import

typescript
import { useCallContract } from '@growae/reactive-vue'

Usage

vue
<script setup lang="ts">
import { useCallContract } from '@growae/reactive-vue'

const { mutate: call, isPending } = useCallContract()
</script>

<template>
  <button
    @click="call({
      address: 'ct_token...',
      aci: tokenAci,
      fn: 'transfer',
      args: ['ak_recipient...', 1000n],
    })"
    :disabled="isPending"
  >
    Transfer Tokens
  </button>
</template>

Parameters

See callContract Parameters.

Key parameters include ttl which defaults to 300 blocks.

Default TTL

All transactions default to a TTL of 300 blocks (~15 hours). This prevents stale transactions from lingering indefinitely. Override with ttl: 0 for no expiration.

Action