diff --git a/packages/app/src/composables/useContractInteraction.ts b/packages/app/src/composables/useContractInteraction.ts index dea7b67cf..e87c434ea 100644 --- a/packages/app/src/composables/useContractInteraction.ts +++ b/packages/app/src/composables/useContractInteraction.ts @@ -45,16 +45,19 @@ export default (context = useContext()) => { const signer = await getL2Signer(); const contract = new Contract(address, [abiFragment], signer!); const method = contract[abiFragment.name]; - const methodArguments = Object.entries(params) - .filter(([key]) => key !== PAYABLE_AMOUNT_PARAM_NAME) - .map(([, inputValue]) => { - if (inputValue === "true") { - inputValue = true; - } else if (inputValue === "false") { - inputValue = false; - } - return inputValue; - }); + const abiFragmentNames = abiFragment.inputs.map((abiInput) => abiInput.name); + const filteredParams = Object.fromEntries( + Object.entries(params).filter(([key]) => key !== PAYABLE_AMOUNT_PARAM_NAME) + ); + const methodArguments = abiFragmentNames.map((abiFragmentName) => { + if (filteredParams[abiFragmentName] === "true") { + return true; + } else if (filteredParams[abiFragmentName] === "false") { + return false; + } else { + return filteredParams[abiFragmentName]; + } + }); const valueMethodOption = { value: parseEther((params[PAYABLE_AMOUNT_PARAM_NAME] as string) ?? "0"), };