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.

Execute complex transactions with custom data and manage their lifecycle using Para.
Wagmi is not available on React Native. Use Ethers.js or Viem for EVM operations.

Execute Raw Transactions

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

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

function ExecuteTransaction() {
  const { ethersSigner } = useParaEthersSigner({ provider });

  const { sendTransactionAsync, isPending, data: receipt } = useParaEthersSendTransaction(ethersSigner);

  return (
    <View>
      <TouchableOpacity
        onPress={() =>
          sendTransactionAsync({
            to: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
            data: "0x",
            value: ethers.parseEther("0.01"),
          })
        }
        disabled={isPending}
      >
        <Text>{isPending ? "Executing..." : "Execute Transaction"}</Text>
      </TouchableOpacity>
      {receipt && <Text>Transaction: {receipt.hash}</Text>}
    </View>
  );
}

Execute Contract Functions

import { useParaEthersSigner, useParaEthersWriteContract } from "@getpara/react-native-wallet/evm/ethers";
import { JsonRpcProvider } from "ethers";
import { View, Text, TouchableOpacity } from "react-native";

const CONTRACT_ABI = [
  "function setGreeting(string memory _greeting)",
  "function greet() view returns (string)"
];

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

function ContractInteraction({ contractAddress }: { contractAddress: string }) {
  const { ethersSigner } = useParaEthersSigner({ provider });

  const { writeContractAsync, isPending, data: receipt } = useParaEthersWriteContract(ethersSigner);

  return (
    <View>
      <TouchableOpacity
        onPress={() =>
          writeContractAsync({
            address: contractAddress,
            abi: CONTRACT_ABI,
            functionName: "setGreeting",
            args: ["Hello from Para!"],
          })
        }
        disabled={isPending}
      >
        <Text>{isPending ? "Updating..." : "Update Greeting"}</Text>
      </TouchableOpacity>
      {receipt && <Text>Transaction: {receipt.hash}</Text>}
    </View>
  );
}

Next Steps