Why is my JavaScript Magic SDK front end integration unable to confirm transactions?

36 views Asked by At

Magic RPC Error, unable to confirm transaction after 20 attempts

Two months ago, I wrote some JavaScript code for a front end integration of the Magic SDK to the Harmony testnet. I was able to send a transaction to a smart contract with the sendTransaction function.

However, I came back to the code today and found that I was unable to replicate what I did on the Harmony Mainnet. For whatever reason, the RPC is unable to confirm any transactions that I send through.

I can confirm that the RPC itself is working, because I am able to send transactions to the same smart contract on the Harmony Mainnet. I can also confirm that the gasLimit (1 million) and gasPrice (5000 gwei) are way above what is necessary, and that I have enough funds in the Magic wallet for the transaction.

I appreciate any help I can get on this, thanks in advance.

Below is an excerpt of the Magic implementation

const tx = await deployedContract.methods.addBid(
    props.smartContractPayload.numBids,
    props.smartContractPayload.numCT,
    props.smartContractPayload.insuranceChoice
  );

  let { txPayload } = tx.transaction;

  txPayload.from = props.smartContractPayload.selectedAccount;
  txPayload.gasLimit = "1000000";

  const gasPrice = await provider.getGasPrice();
  
  txPayload.gasPrice = String(
    Number(ethers.utils.formatEther(gasPrice)) * 1000000000000000000 * 5
  );



  const txSend = await props.smartContractPayload.magic.harmony.sendTransaction(
    txPayload
  );

  const txReceipt = await provider.getTransactionReceipt(
    txSend.transactionHash
  );
0

There are 0 answers