Skip to main content
Mutation hook for sending transactions using an ethers signer from useParaEthersSigner.
Requires @getpara/ethers-v6-integration and ethers as peer dependencies.
Get the signer parameter from useParaEthersSigner.

Import

import { useParaEthersSendTransaction } from "@getpara/react-native-wallet/evm/ethers";

Usage

import { useParaEthersSigner, useParaEthersSendTransaction } from "@getpara/react-native-wallet/evm/ethers";
import { JsonRpcProvider, parseEther } from "ethers";

const provider = new JsonRpcProvider("https://ethereum-sepolia-rpc.publicnode.com");

function SendTransaction() {
  const { ethersSigner } = useParaEthersSigner({ provider });
  const { sendTransactionAsync, isPending } = useParaEthersSendTransaction(ethersSigner);

  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.