Send ETH and ERC-20 token transfers securely using Para’s wallet infrastructure.

Prerequisites

You need Web3 libraries configured with Para authentication.

Setup Web3 Libraries

Send ETH

import { ethers } from "ethers";
import { ParaEthersSigner } from "@getpara/ethers-v6-integration@alpha";

async function sendETH(
  signer: ParaEthersSigner,
  toAddress: string,
  amountInEther: string
) {
  try {
    const tx = await signer.sendTransaction({
      to: toAddress,
      value: ethers.parseEther(amountInEther)
    });
    
    console.log("Transaction hash:", tx.hash);
    
    const receipt = await tx.wait();
    console.log("Transaction confirmed in block:", receipt.blockNumber);
    
    return {
      hash: tx.hash,
      blockNumber: receipt.blockNumber,
      gasUsed: receipt.gasUsed.toString()
    };
  } catch (error) {
    console.error("Transaction failed:", error);
    throw error;
  }
}

Send ERC-20 Tokens

import { ethers } from "ethers";

const ERC20_ABI = [
  "function transfer(address to, uint256 amount) returns (bool)"
];

async function sendToken(
  signer: any,
  tokenAddress: string,
  toAddress: string,
  amount: string,
  decimals: number
) {
  try {
    const contract = new ethers.Contract(
      tokenAddress, 
      ERC20_ABI, 
      signer
    );
    
    const parsedAmount = ethers.parseUnits(amount, decimals);
    
    const tx = await contract.transfer(toAddress, parsedAmount);
    console.log("Transaction hash:", tx.hash);
    
    const receipt = await tx.wait();
    console.log("Transaction confirmed");
    
    return {
      hash: tx.hash,
      blockNumber: receipt.blockNumber,
      gasUsed: receipt.gasUsed.toString()
    };
  } catch (error) {
    console.error("Token transfer failed:", error);
    throw error;
  }
}

Next Steps