ERROR: "value is required"

I was trying to use Moralis Web3’s executeFunction but it logged some error


async function approve() {
        if (props.isAuthenticated) {
            const options = {
                contractAddress: addresses.sgaj,
                functionName: "approve",
                abi: abis.erc20,
                params: {
                    spender: addresses.migrate,
                    amount: props.Moralis.Units.Token("100000", "18")
            const receipt = await props.Moralis.executeFunction(options);

Screenshot 2021-10-10 at 12.14.17 AM

Why do you use props?

1 Like

Are you sure that error is because of this function?

@Yomoo is helping fast!!! :star_struck::clap:

the abi is spender and value
not spender and amount

Write value instead of amount as argument

So, I instead of doing
const { authenticate, Moralis, isAuthenticated, user } = useMoralis();
on every page, I am just adding it to props

1 Like

Usually it has amount. But Ivan is right, in your case it can be value

thanks @ivan. it’s working now :smile:

Thank you. I just wondered why :man_factory_worker:

Where did you get this ABI?

don’t remember. it was just lying in one of my old codes

1 Like