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

Metamask RPC error while burning $testBTC on Kovan #182

Open
0xnaman1 opened this issue Oct 27, 2021 · 0 comments
Open

Metamask RPC error while burning $testBTC on Kovan #182

0xnaman1 opened this issue Oct 27, 2021 · 0 comments

Comments

@0xnaman1
Copy link

0xnaman1 commented Oct 27, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant