tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
388 stars 259 forks source link

I am getting OUT OF ENERGY Error #509

Open Emirhan-Cavusoglu-sftw opened 2 months ago

Emirhan-Cavusoglu-sftw commented 2 months ago

this is my code I have faced this error before and fixed it with changing isConstant to false but now I am getting the same error

async function createTSD(proofName, proofDescription, ipfsUrl) {
    try {
      const result = await tronWeb.transactionBuilder.triggerSmartContract(
        tsdFactoryAddress,
        "createTSD(string,string,string,string)",
        { _isConstant: false },
        [
          {
            type: "string",
            value: "EC",
          },
          {
            type: "string",
            value: proofName,
          },
          {
            type: "string",
            value: proofDescription,
          },
          {
            type: "string",
            value: ipfsUrl,
          },
        ]
      );
      console.log(result);
      const signedTransaction = await sign(result);
      const transaction = await sendRawTransaction(signedTransaction);
      console.log(transaction);
    } catch (error) {
      console.log(error);
    }

    setresult(result);
  }
laurenceja commented 2 months ago

@Emirhan-Cavusoglu-sftw For out of energy issue, please set a larger feelimit, and ensure the account has enough TRX or energy. Energy can be obtained by staking TRX.