I'm trying to send a token transaction using a useDApp useContractFunction hook.
This is how I setup the hook.
const interface = new utils.Interface(tokenAbi.abi) // abi is located at tokenAbi.abi
const contract = new Contract(
'0x5FbDB2315678afecb367f032d93F642f64180aa3',
interface
) as any
const { state, send } = useContractFunction(contract, 'transfer')
and then, I'm calling the send function on a button click as follows
void (await send({
recipient: '0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199',
amount: 1 * 1e18 // test amount
}))
calling this then resolves into a Exception with missing argument: passed to contract message.
The ABI definition for the transfer function is ⬇️
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
Any ideas how to fix it?
Thanks!