Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use options bag parameters rather than MsgParams type #204

Merged
merged 1 commit into from
Sep 13, 2021

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Sep 10, 2021

The signing and encryption functions all accepted a MsgParams parameter that included just a single property (data, the data to be signed). This pointless wrapper object around this single parameter complicated the type signatures of these functions.

Instead, these functions now accept all parameters as one "options bag" parameter, and the MsgParams type has been removed. This makes the functions easier to use, as now it's not possible to enter the parameters in the wrong order.

The related SignedMsgParams type has also been replaced in the same manner, for the same reasons.

The signing and encryptuon functions all accepted a `MsgParams`
parameter that included just a single property (`data`, the data to be
signed). This pointless wrapper object around this single parameter
complicated the type signatures of these functions.

Instead, these functions now accept all parameters as one "options bag"
parameter, and the `MsgParams` type has been removed. This makes the
functions easier to use, as now it's not possible to enter the
parameters in the wrong order.

The related `SignedMsgParams` type has also been replaced in the same
manner, for the same reasons.
@Gudahtt Gudahtt requested a review from a team as a code owner September 10, 2021 05:22
@Gudahtt
Copy link
Member Author

Gudahtt commented Sep 10, 2021

The MsgParams options didn't make a lot of sense, so the options were to use the "options bag" pattern or positional arguments. These are functions where getting the arguments in the wrong order could be pretty bad, and the team seems to like the "options bag" pattern and has introduced it in many places lately, so I went with that.

@shanejonas
Copy link

Looks good. thats a lot of test fixin 😅

would be nice to get rid of the _expect and _it and just disable that lint rule, but not with to this PR.

@Gudahtt
Copy link
Member Author

Gudahtt commented Sep 13, 2021

would be nice to get rid of the _expect and _it and just disable that lint rule, but not with to this PR.

Yep! It's awful. I'll have a second look for a workaround then remove it.

@Gudahtt Gudahtt merged commit c442c50 into main Sep 13, 2021
@Gudahtt Gudahtt deleted the replace-msg-params branch September 13, 2021 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants