Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getpara.com/llms.txt

Use this file to discover all available pages before exploring further.

The useParaSolanaSigner hook returns a Solana signer for the user’s Solana wallet. It supports both embedded Para wallets and external wallets. If the user has multiple Solana wallets, pass address or walletId to select one. When omitted, the active wallet is used automatically.
Requires @getpara/solana-signers-v2-integration as a peer dependency.
Use the companion mutation hook useParaSolanaSignAndSend to sign and send transactions.

Import

import { useParaSolanaSigner } from "@getpara/react-sdk";
import { createSolanaRpc } from "@solana/kit";

Usage

import { useParaSolanaSigner } from "@getpara/react-sdk";
import { createSolanaRpc, getUtf8Encoder } from "@solana/kit";
import bs58 from "bs58";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");

function SignMessage() {
  const { solanaSigner, isLoading } = useParaSolanaSigner({ rpc });

  const handleSign = async () => {
    if (!solanaSigner) return;

    const messageBytes = new Uint8Array(getUtf8Encoder().encode("Hello"));

    const signatureResult = await solanaSigner.signMessages([
      { content: messageBytes, signatures: {} },
    ]);

    const signatureBytes = signatureResult[0][solanaSigner.address];
    console.log("Signature:", bs58.encode(signatureBytes));
  };

  if (isLoading) return <p>Loading...</p>;

  return (
    <div>
      <p>Address: {solanaSigner?.address}</p>
      <button onClick={handleSign}>Sign Message</button>
    </div>
  );
}