Should it be like the example below(2,2 as two different parametres) Ex: const stackId = drizzle.contracts.SimpleStorage.methods.set.cacheSend(2,2, {from: '0x3f...'})
2 Answers
That is the correct way of doing multiple parameters. See here where somebody asked a similar question.
The easier way is sending them as parameters to cacheSend
:
cacheSend(
drizzleState.clientAccount,
toHex(parseAmountToToken(amountToSend, tokenDecimals))
);
Here, we are sending two parameters for the transfer
function: transfer(address, uint256)...
.
If you are using hooks you can use the send
function passing the parameters you need:
const { useCacheSend } = drizzleReactHooks.useDrizzle()
const { send, TXObjects } = useCacheSend('MyToken', 'transfer')
---
onSubmit={
// Use memoization to avoid unnecessary rerenders.
useCallback(({ to=drizzleState.clientAccount, value=toHex(parseAmountToToken(amountToSend, tokenDecimals)) }) => send(to, value), [amountToSend])
}
That's all.