Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing the functionality of ethers #1

Open
theDevSoham opened this issue May 31, 2023 · 0 comments
Open

Testing the functionality of ethers #1

theDevSoham opened this issue May 31, 2023 · 0 comments

Comments

@theDevSoham
Copy link
Owner

theDevSoham commented May 31, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant