I have a commit-reveal pattern implemented in my Solidity smart contract. I use the keccak256 encryption function to secure the player's commitment.
How can I convert the return value of solidityPackedKeccak256 to bytes32 in order to pass it as an argument when deploying my smart contract from the interface?
So far I've been only getting errors like this: AbiEncodingBytesSizeMismatchError: Size of bytes "3" (bytesundefined) does not match expected size (bytes32).
const encodedSalt = solidityPackedKeccak256([ "int8", "uint256" ], [ currentMove, salt ]);
console.log({encodedSalt})
// @ts-ignore
const hash = await walletClient.deployContract({
...rpsContract,
account,
args: [3, new String(encodedSalt).valueOf()]
});
Please help me figure that out. Any advice is really really welcome!
Thanks!!
P.S. I generate the salt this way const salt = new Array(30).fill(0).map(() => Math.round(Math.random() * 16)).join('');