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)
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);
}
}
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
./check/ethereum.tsand remove the code.sendMatic()function to check if any errors. Please report if any errors found related to ethers or bitcoinjs