trustwallet / trust-web3-provider

Web3 javascript wrapper provider for iOS and Android platforms.
https://trustwallet.com
725 stars 412 forks source link

Error is not returned in promise upon cancelling transaction in desk and mobile. #492

Open IDontLikeOpen opened 5 months ago

IDontLikeOpen commented 5 months ago

When users submits transaction - we get a result and it is returned in then, but when transaction is rejected catch is not triggered, even though we get the error in the console.

image

The line mentioned in the error is this, but it is hard to figure out why it work the way it does.

image

I am using "web3": "^4.2.2"

const transferData = {
    method: 'transfer',
    types: ['address', 'uint256'],
    inputs: [
      '0x090.....',
      {
        type: 'BigNumber',
        hex: '0x0f4240',
      },
    ],
    names: ['_recipient', '_value'],
  }

 const transferMethod = () =>
        contract.methods.transfer(toAddress, `${amountToPay}`);

transferMethod()
      .send({
        from: senderAddress,
        gasPrice,
        data,
      })
      .then((result) => result)
      .catch((errorString) => errorString);

Pancake.swap handles it somehow, so there must be a way. Thanks for your tme!