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: create FrameAction message and add validation endpoint #1632

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

sanjayprabhu
Copy link
Contributor

@sanjayprabhu sanjayprabhu commented Jan 25, 2024

Motivation

Add support for a FrameAction message type. And add a validateMessage endpoint that can use used to validate them. FrameActions are not stored on the hub and submitMessage will reject them.

Change Summary

Support Farcaster Frames

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review

Additional Context

If this is a relatively large or complex change, provide more details here that will help reviewers


PR-Codex overview

This PR focuses on adding support for FrameAction messages and introducing a new validation method for messages.

Detailed summary

  • Added FrameAction message type to the request_response.proto schema
  • Implemented validateMessage method in util.ts and hubble.ts
  • Added FrameActionBody message type to the message.proto schema
  • Added makeFrameAction and makeFrameActionData functions in builders.ts
  • Implemented validateFrameActionBody function in validations.ts
  • Updated index.ts and index.test.ts to handle FrameAction messages
  • Updated server.ts to handle validateMessage RPC call in the Hub server
  • Added ValidationResponse message type to the server.ts schema
  • Updated httpServer.ts to handle validateMessage API endpoint

The following files were skipped due to too many changes: apps/hubble/src/rpc/httpServer.ts, packages/core/src/factories.ts, apps/hubble/src/rpc/test/httpServer.test.ts, packages/hub-nodejs/src/generated/rpc.ts, packages/hub-web/src/generated/rpc.ts, packages/hub-web/src/generated/request_response.ts, packages/hub-nodejs/src/generated/request_response.ts, packages/core/src/protobufs/generated/request_response.ts, apps/hubble/www/docs/docs/httpapi/submitmessage.md, apps/hubble/src/rpc/test/submitService.test.ts, packages/hub-web/src/generated/message.ts, packages/hub-nodejs/src/generated/message.ts, packages/core/src/protobufs/generated/message.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Jan 25, 2024

🦋 Changeset detected

Latest commit: bee38aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@farcaster/hub-nodejs Patch
@farcaster/hub-web Patch
@farcaster/replicator Patch
@farcaster/core Patch
@farcaster/hubble Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hub-monorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 25, 2024 11:51pm

@sanjayprabhu sanjayprabhu added the t-feat Add a new feature or protocol improvement label Jan 25, 2024
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: 25 lines in your changes are missing coverage. Please review.

Comparison is base (f385961) 0.00% compared to head (bee38aa) 73.81%.

Files Patch % Lines
apps/hubble/src/rpc/httpServer.ts 62.50% 6 Missing ⚠️
packages/core/src/factories.ts 33.33% 6 Missing ⚠️
packages/core/src/protobufs/typeguards.ts 28.57% 5 Missing ⚠️
packages/core/src/validations.ts 66.66% 5 Missing ⚠️
apps/hubble/src/hubble.ts 0.00% 2 Missing ⚠️
packages/core/src/builders.ts 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main    #1632       +/-   ##
=========================================
+ Coverage      0   73.81%   +73.81%     
=========================================
  Files         0       99       +99     
  Lines         0     9000     +9000     
  Branches      0     1998     +1998     
=========================================
+ Hits          0     6643     +6643     
- Misses        0     2239     +2239     
- Partials      0      118      +118     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

/** A Farcaster Frame action */
message FrameActionBody {
bytes url = 1; // URL of the Frame triggering the action
bytes button_id = 2; // The identifier of the button pressed
Copy link
Contributor Author

@sanjayprabhu sanjayprabhu Jan 25, 2024

Choose a reason for hiding this comment

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

This should be button_index for now

@sanjayprabhu sanjayprabhu merged commit 229ea16 into farcasterxyz:main Jan 26, 2024
10 checks passed
@sanjayprabhu sanjayprabhu deleted the frame_actions branch January 26, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-feat Add a new feature or protocol improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants