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

feat: factor out parseFrameMessage #29

Merged
merged 2 commits into from
Jan 28, 2024
Merged

feat: factor out parseFrameMessage #29

merged 2 commits into from
Jan 28, 2024

Conversation

cnasc
Copy link
Contributor

@cnasc cnasc commented Jan 28, 2024

What changed? Why?
While working with frames, it's beneficial to be able to get the whole validated message. Since we parse and validate the message as part of getFrameAccountAddress, I pulled the relevant code out into a new function.

Notes to reviewers

How has it been tested?
yolo'd this, would love to hear any strategies for testing
edit: did manually test in a frame by copying code over and it appears to work

if (result.isOk() && result.value.valid && result.value.message) {
validatedMessage = result.value.message;
}
const validatedMessage = await parseFrameMessage(body);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we want to make this a param? That way if you're parsing the message to get other data anyway you can just pass the result in to this function rather than loading same data twice. Could do this with an overload

@Zizzamia
Copy link
Contributor

Ciao @cnasc, after merging #28 form @robpolak we got some conflic. Love your idea of parseFrameMessage, please resolve the conflict and go ahead with it.

@cnasc cnasc force-pushed the cjn/parseFrameMessage branch from cdd1d6e to 6650977 Compare January 28, 2024 19:27
Copy link
Contributor

@Zizzamia Zizzamia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DOOOPE!!!

As follow up would you mind add this in the README with a nice example on how to use it.

After that I will cut a new release.

@Zizzamia Zizzamia merged commit ef014d4 into main Jan 28, 2024
4 checks passed
@Zizzamia Zizzamia deleted the cjn/parseFrameMessage branch January 28, 2024 19:51
@cnasc
Copy link
Contributor Author

cnasc commented Jan 28, 2024

Ehm @robpolak's tests are broken in this PR

edit: actually maybe they were already broken? Looks like the mock always returns a user from Neynar so the second test will always fail?

@Zizzamia
Copy link
Contributor

😅 @cnasc can you help us get on a solid testing case, so that we can add it in CI, and than deploy, please.

Ideally would be dope to release a new OnchainKit version in the next couple of hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants