Hello. With the 1inch plugin before calling the swap function I am calling the hasAllowance function to check if approval is needed. I’m getting a response of “missing parameters.” Looking at the plugin, I have all of the required parameters in place. Can you spot something wrong here?
I have a variable nativeAmount that is a react useState hook component that the user inputs above this code.
const hasAllowance = async(userAddress) => {
const number = Number(Moralis.Units.ETH(nativeAmount));
const allowance = await Moralis.Plugins.oneInch.hasAllowance({
chain: "eth", // The blockchain you want to use (eth/bsc/polygon)
tokenAddress: "0x6B175474E89094C44Da98b954EedeAC495271d0F", // The token you want to swap
fromAddress: userAddress, // Your wallet address
amount: number,
});
console.log(allowance);
console.log(`The user has enough allowance: ${allowance}`);
}