fix: pass arguments for the contract functions in the correct order #347
+15
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What ❔
This PR fixes the bug where the contract function arguments are not passed in the correct order.
Why ❔
In order to call the contract functions correctly, we need to pass the arguments in the right order.
Explanation
The issue was that we were trying to get
Object.entries(params)
without actually sorting it, so, for example, contract 0xE1D6A50E7101c8f8db77352897Ee3f1AC53f782B, therevokeRole
function asks for[role, account]
arguments to be passed.In the form object, it looks like this:
and when we run
Object.entries(params)
we always get it like this:and later after we map it, it becomes
["0x969Bb8Ae65602B4F8f9B459a11084e591c4491C7", "0x03c321230b026fb61a5a21f62c5f618751ec6d8435327f673bae5bfa570e5879"]
- swapping the arguments from their intended places.This issue was happening when someone types the account first, therefore forms become
instead of
thus messing up the order of the arguments in the function call.
Checklist