Skip to content

useSpend

Composable for sending AE tokens to a recipient.

Import

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

Usage

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

const { mutate: spend, isPending, isSuccess, data } = useSpend()
</script>

<template>
  <button
    @click="spend({ recipient: 'ak_2dA...', amount: '1.5' })"
    :disabled="isPending"
  >
    Send 1.5 AE
  </button>
  <p v-if="isSuccess">Tx: {{ data.hash }}</p>
</template>

Parameters

See spend Parameters.

Key parameters:

ParameterTypeDefaultDescription
recipientstringRequired. Recipient address or AENS name.
amountbigint | stringRequired. Amount to send.
ttlnumber300Transaction TTL in blocks relative to current height. Set to 0 for no expiration.

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