Skip to content

Metamask RPC error while burning $testBTC on Kovan #182

Description

@0xnaman1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions