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

callback is not defined #429

Closed
vanodevium opened this issue Oct 3, 2023 · 6 comments
Closed

callback is not defined #429

vanodevium opened this issue Oct 3, 2023 · 6 comments

Comments

@vanodevium
Copy link

Hi!

I have a function:

const fee = process.env.FEE_LIMIT || 30000000;

async function payTRC20(toAddress, amount, fromAddress, tronWeb, contract) {
  const options = {
    feeLimit: fee,
    callValue: 0,
  };
  const tx = await tronWeb.transactionBuilder.triggerSmartContract(
    contract,
    "transfer(address,uint256)",
    options,
    [
      {
        type: "address",
        value: toAddress,
      },
      {
        type: "uint256",
        value: amount * 1000000,
      },
    ],
    tronWeb.address.toHex(fromAddress),
  );
  const signedTx = await tronWeb.trx.sign(tx.transaction);
  return tronWeb.trx.sendRawTransaction(signedTx);
}

module.exports = payTRC20;

This function works fine, but for some wallets it throws an error with the text:

callback is not defined

Version:
"tronweb": "5.3.0"


Please tell me what the problem might be and how to fix it.

An important clarification: if you repeat on such an "incorrect" wallet, the error will be the same. If you transfer money to such a wallet through a mobile application, everything goes without errors.

@vanodevium
Copy link
Author

As far as I could figure it out, problem is in two places:

This variable callback is not defined really.


But still, I'm really asking you to tell me why only on some wallets I see this error, even though the function code is the same for all.

@start940315
Copy link
Contributor

We have known this bug and it would not be a problem in v6. For now, I recommend you to console.log the toAddress and amount variable to check if there are some error data.

@vanodevium
Copy link
Author

Thanx! But main question is: why some wallets have this error?

@start940315
Copy link
Contributor

Maybe they are using different version. Previous versions don't have this problem.

@Ar1stotele
Copy link

Ar1stotele commented Dec 6, 2023

Hello, have you been able to resolve this issue?
If not - you might have an error in this line value: amount * 1000000,. I had something similar.

Good luck.

@start940315
Copy link
Contributor

Fixed in TronWeb v6.0.0-beta.0. Welcome to try.

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

3 participants