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

Can't approve erc20 token for swap. Error: the method eth_sendTransaction does not exist/is not available. Chain info: Ethereum ropsten #127

Open
OlegDO opened this issue Jun 3, 2022 · 3 comments

Comments

@OlegDO
Copy link

OlegDO commented Jun 3, 2022

Problem

Trying to approve before swap LINK (ERC-20 token) to ETH on Ethereum ropsten testnet.

Error msg

Error: Returned error: The method eth_sendTransaction does not exist/is not available

Logs

Source amount: 500000000000000000
User address: 0x57d91Eae4C6Db82f6D92BC2344eed7DB8cD4eA28
ERC-20 token address: 0xb4f7332ed719Eb4839f091EDDB2A3bA309739521

Code example:


private async approveToken(
    srcAmount: string,
    userAddress: string,
    erc20tokenAddress: string
  ): Promise<string> {
    try {
      /**
       * @Tx hash of approved token amount of user address with the particular amount
       */
      console.log("Source amount:", srcAmount);
      console.log("User address:", userAddress);
      console.log("ERC-20 token address:", erc20tokenAddress);
      return await this.paraSwap.approveToken(
        srcAmount,
        userAddress,
        erc20tokenAddress
      );
    } catch (error) {
      throw new Error(getErrorMessage(error, "Failed to approve token"));
    }
  }

@mounibec
Copy link
Member

mounibec commented Jun 4, 2022

It looks like an RPC node issue

@nmaddp1995
Copy link

@OlegDO I'm having the same issue. Have you fixed it yet?

@nmaddp1995
Copy link

@mounibec When I try to change RPC, it shows the error unknow account.
Could you please support me with the init paraswap SDK with provider that can call apporveToken function.
Currently I'm using wagmi but can change to ethers if needed

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