Skip to content

Testing the functionality of ethers #1

@theDevSoham

Description

@theDevSoham

The template is currently functional but not tested for robust functionality. There might be some errors which are yet to be handled. We'll check by transaction from one wallet to another for polygon network (mumbai testnet)

Note: Please create your own wallets for testing purposes.

Steps to test Ethersjs

  1. Clone and install using yarn (npm not suggested).
  2. Navigate to ./check/ethereum.ts and remove the code.
  3. Paste the following code
import ethers from "ethers";

const rpcEndpoint =
  "RPC_MATICVIGIL_ENDPOINT";

const privateKey =
  "SENDER_PRIVATE_KEY";
const recipientAddress = "RECEIVER_ADDRESS";

const provider = new ethers.providers.JsonRpcProvider(rpcEndpoint);

const wallet = new ethers.Wallet(privateKey, provider);

const amount = ethers.utils.parseEther("0.0001"); // Example: 0.1 MATIC

export async function sendMatic() {
  try {
    const tx = await wallet.sendTransaction({
      to: recipientAddress,
      value: amount,
    });

    console.log("Transaction sent:", tx.hash);
  } catch (error) {
    console.error("Error sending transaction:", error);
  }
}
  1. Now in App.tsx call the sendMatic() function to check if any errors. Please report if any errors found related to ethers or bitcoinjs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions