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"));
}
}