Skip to main content
Mutation hook for signing Stellar transactions using a signer from useParaStellarSigner.
Requires @getpara/stellar-sdk-v14-integration and @stellar/stellar-sdk as peer dependencies.
Get the signer parameter from useParaStellarSigner.

Import

import { useParaStellarSignTransaction } from "@getpara/react-native-wallet/stellar";

Usage

import { useParaStellarSigner, useParaStellarSignTransaction } from "@getpara/react-native-wallet/stellar";
import { Networks } from "@stellar/stellar-sdk";

function SignTransaction() {
  const { stellarSigner } = useParaStellarSigner({ networkPassphrase: Networks.PUBLIC });
  const { signTransactionAsync, isPending } = useParaStellarSignTransaction(stellarSigner);

  const handleSign = async () => {
    if (!stellarSigner) return;
    const { signedTxXdr } = await signTransactionAsync(transaction.toXDR());
    console.log("Signed XDR:", signedTxXdr);
  };

  return (
    <button onClick={handleSign} disabled={isPending}>
      {isPending ? "Signing..." : "Sign Transaction"}
    </button>
  );
}
mutate/mutateAsync are also available alongside the named aliases. All other UseMutationResult fields (data, error, isSuccess, isError, reset, etc.) work as expected.