ren-js
ren-js copied to clipboard
Metamask RPC error while burning $testBTC on Kovan
Error - The $testBTC mint
is working fine but for some reason, the burn
function mentioned in the RenJS docs is giving a
MetaMask - RPC Error: The execution failed due to an exception. {code: -32016, message: 'The execution failed due to an exception.', data: 'Reverted'}.
error.
Steps to reproduce - After connecting to wallet, simply calling the renJS.burnAndRelease
gives the error. Here's the code for it.
const burn = async()=>{
const {ethereum} = window;
try{
if(ethereum){
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const address = await signer.getAddress();
const ethereumProvider = { provider, signer };
const value = 0.001* 1e18;
const renJS = new RenJS("testnet",{
useV2TransactionFormat: true,
});
const burnAndRelease = await renJS.burnAndRelease({
asset: "BTC",
to: Bitcoin().Address("0xtb1q8kfmt02l5q5fgpuuhc2prygm8jwsava9kd620l"),
from: Ethereum(ethereumProvider).Account({ value }),
});
let confirmations = 0;
await burnAndRelease
.burn()
.on("confirmation", (confs) => {
confirmations = confs;
})
.on("transactionHash", (txHash) => console.log(`txHash: ${String(txHash)}`));
await burnAndRelease
.release()
.on("status", (status) =>
status === "confirming"
? console.log(`${status} (${confirmations}/15)`)
: console.log(status)
)
.on("txHash", console.log);
console.log(`Withdrew ${value} BTC to ${"tb1q8kfmt02l5q5fgpuuhc2prygm8jwsava9kd620l"}.`);
}
}catch(e){
console.log(e);
}
}
I've tried to omit the useV2TransactionFormat
format as well, but it throws the same error.