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

tronAdapter OKX Bug #64

Open
minsooTestMan opened this issue May 27, 2024 · 1 comment
Open

tronAdapter OKX Bug #64

minsooTestMan opened this issue May 27, 2024 · 1 comment

Comments

@minsooTestMan
Copy link

I'm using tronAdapter with OKX Wallet. There's something really strange happening. In the mobile OKX DApp browser, when I call await sendRawTransaction, the code does not proceed to the next line. I don't know the reason for this.

When I call sendRawTransaction, it transitions to the contract interaction screen of the OKX Wallet, but even after accepting, the code does not move to the next line. This code works fine in the PC web extension.

`const functionSelector = 'transfer(address,uint256)';
const parameter = [{type: 'address', value: to}, {type: 'uint256', value: amount}]//to Address
// @ts-expect-error:test
const tx = await tronweb.transactionBuilder.triggerSmartContract('-------', functionSelector, {}, parameter);//Contract Address
const signedTx = await tronweb.trx.sign(tx.transaction);

  // @ts-expect-error:test
  const result = await tronweb.trx.sendRawTransaction(signedTx)
  //???????????????????????????????????????????????????????????????????????????????????????
  //It does not proceed past this line.

//???????????????????????????????????????????????????????????????????????????????????????
return result.transaction.txID;`

@way2ex
Copy link
Contributor

way2ex commented May 28, 2024

According to the Okx Development Document , you should use okxwallet.tronLink.tronWeb to create transaction:

const tronWeb = okxwallet.tronLink.tronWeb;
const tradeobj = await tronWeb.transactionBuilder.sendTrx("TNo9e8MWQpGVqdyySxLSTw3gjgFQWE3vfg", 100,"TM2TmqauSEiRf16CyFgzHV2BVxBejY9iyR",1);
const signedtxn = await tronWeb.trx.sign(tradeobj, privateKey);
const receipt = await tronWeb.trx.sendRawTransaction(signedtxn);
console.log(receipt)

Also you can use vConsole or something else to debug your website and see if there are some errors.

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

2 participants