Skip to content

useSendTransaction

Hook for sending a signed transaction to the network.

Import

typescript
import { useSendTransaction } from '@growae/reactive-react'

Usage

tsx
import { useSendTransaction } from '@growae/reactive-react'

function SendTx() {
  const { mutate: send, data, isPending } = useSendTransaction()

  return (
    <button onClick={() => send({ tx: signedTx })} disabled={isPending}>
      Send Transaction
    </button>
  )
}

Return Type

See TanStack Query mutation docs for full return type.

data

See sendTransaction Return Type.

Parameters

tx

  • Type: string
  • Required

The signed transaction.

ttl

  • Type: number
  • Default: 300

Transaction 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.

mutation

See TanStack Query mutation docs for mutation options.

Action