Skip to main content
Mutation hook for sending transactions using a Viem WalletClient from useParaViemClient.
Requires @getpara/viem-v2-integration and viem as peer dependencies.
Get the viemClient parameter from useParaViemClient.

Import

import { useParaViemSendTransaction } from "@getpara/react-native-wallet/evm/viem";

Usage

import { useParaViemClient, useParaViemSendTransaction } from "@getpara/react-native-wallet/evm/viem";
import { sepolia } from "viem/chains";
import { http, parseEther } from "viem";

function SendTransaction() {
  const { viemClient } = useParaViemClient({
    walletClientConfig: { chain: sepolia, transport: http() },
  });

  const { sendTransactionAsync, isPending, data: txHash } = useParaViemSendTransaction(viemClient);

  return (
    <button onClick={() => sendTransactionAsync({ to: "0x...", value: parseEther("0.01") })} disabled={isPending}>
      {isPending ? "Sending..." : "Send ETH"}
    </button>
  );
}
mutate/mutateAsync are also available alongside the named aliases. All other UseMutationResult fields (data, error, isSuccess, isError, reset, etc.) work as expected.