magic-js icon indicating copy to clipboard operation
magic-js copied to clipboard

Blockchain Erc20 transfer function is not returning response or error in React-Native

Open EktaAlphait opened this issue 3 years ago • 0 comments

✅ Prerequisites

  • [ ] Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
  • [x] Are you running the latest SDK version?
  • [x] Are you reporting to the correct repository (magic-sdk)?

🐛 Description

 when i try to transfer token to other wallet, transfer function is not returning an error or response. 

🧩 Steps to Reproduce

  1. include magic sdk, web3.
  2. add transfer function to code. (function is given in Code Sample).
  3. pass parameter (toaddress, amount, fromaddress).
  4. run function.
  5. check getting response or error or not

🤔 Expected behavior

I expect that the function should return error or response.

😮 Actual behavior

currently the function is not returning response or error.

💻 Code Sample

const transferAnyErc20 = async (userAddress, amount, toAddress) => {
  try {
    var Contract = new web3.eth.Contract(erc20Abi, TokenAddress);
    const tx = await Contract.methods.transfer(toAddress, web3.utils.toWei(amount)).send({ from: userAddress });
    return tx;
  } catch (err) {
    throw new Error(" :fish_cake: err from depositToken ", err);
  }
};

as shown in above transfer function we pass every required value " toaddress, amount, fromaddress " but not getting response or error.

🌎 Environment

Software Version(s)
magic-sdk "^8.2.0"
web3 "^1.6.1"
React Native "^0.66.0"
Browser
yarn
Operating System ubuntu & android

EktaAlphait avatar Jun 14 '22 13:06 EktaAlphait