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: snapshot votePoll relay #2797

Merged
merged 6 commits into from
May 4, 2023
Merged

feat: snapshot votePoll relay #2797

merged 6 commits into from
May 4, 2023

Conversation

bigint
Copy link
Member

@bigint bigint commented May 4, 2023

What does this PR do?

πŸ€– Generated by Copilot at 182034f

This pull request adds a new feature to create and vote on snapshot polls in the web app and the extension. It implements new components, handlers, helpers, types, and queries to support the feature. It also fixes some typos and issues in the existing code and updates the dependencies of some packages.

Related issues

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking small changes to existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Explanation of the changes

πŸ€– Generated by Copilot at 182034f

  • Add a new component NewPublication that allows users to create and publish a new publication with a snapshot poll (link)
  • Define a function handlePublish that validates the input fields, generates a snapshot account, signs and sends the poll data to the snapshot sequencer, and creates a new publication document in the database (link)
  • Define a function handleCancel that resets the input fields and redirects the user to the home page (link)
  • Define a function handleInputChange that updates the state of the input fields based on the user's input (link)
  • Add a new handler votePoll that handles the request to vote on a poll from the extension (link)
    • Add a new route /votePoll to the itty-router instance in the index.ts module of the snapshot-relay package, which handles the POST requests to vote on a poll from the extension using the votePoll handler (link,link)
  • Add a new function generateSnapshotAccount that generates a snapshot account from the given parameters (link)
    • Import and use the function in the NewPublication component and the Snapshot component (link,link)
  • Add a new query hook useSpaceQuery that queries the space of a proposal by its id using the Apollo client (link)
    • Add a new GraphQL document Space that queries the space of a proposal by its id (link)
    • Add a new type definition for the SpaceQuery and its variables to the generated.ts module, which is generated by the graphql-codegen tool based on the GraphQL documents in the snapshot package (link)
    • Import and use the query hook in the Snapshot component (link,link)
  • Fix a typo in the Snapshot component's props from propsalId to proposalId (link,link)
  • Replace the snapshotClient.vote method with an axios request to the snapshot relay worker's /votePoll endpoint in the Choices component (link)
    • Add an import of axios to the Choices component (link)
  • Change the type of the timestamp property in the typedData object from BigInt to number in the createPoll handler (link)
  • Change the order and casing of the headers in the fetch request to the sequencer in the createPoll handler (link)
  • Add a new helper function validateLensAccount that validates the access token of a Lens account by sending a request to the Lens API and checking the verify field in the response (link)
    • Use the function in the votePoll handler to verify the access token (link)
  • Add a new dependency @tsndr/cloudflare-worker-jwt to the snapshot-relay package, which is used to decode and verify JWT tokens in the worker handlers (link,link,link)
  • Remove the unused dependency react from the lib package and add a new dependency viem that provides some utilities for working with Ethereum accounts and signatures (link,link)
  • Remove unused imports and variables from the Choices component and the stopEventPropagation module (link,link,link,link)

Emoji

πŸ“πŸš€πŸ› οΈ

@vercel
Copy link

vercel bot commented May 4, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated (UTC)
prerender βœ… Ready (Inspect) Visit Preview May 4, 2023 0:55am
ui βœ… Ready (Inspect) Visit Preview May 4, 2023 0:55am
web βœ… Ready (Inspect) Visit Preview May 4, 2023 0:55am

@vercel vercel bot temporarily deployed to Preview – ui May 4, 2023 12:37 Inactive
@socket-security
Copy link

New dependency changes detected. Learn more about Socket for GitHub β†—οΈŽ


πŸ‘ No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts βœ… 0 issues
Native code βœ… 0 issues
Bin script shell injection βœ… 0 issues
Unresolved require βœ… 0 issues
Invalid package.json βœ… 0 issues
HTTP dependency βœ… 0 issues
Git dependency βœ… 0 issues
Potential typo squat βœ… 0 issues
Known Malware βœ… 0 issues
Telemetry βœ… 0 issues
Protestware/Troll package βœ… 0 issues

πŸ“Š Modified Dependency Overview:

βž• Added Package Capability Access +/- Transitive Count Publisher
@tsndr/cloudflare-worker-jwt@2.2.1 None +0 tsndr

@vercel vercel bot temporarily deployed to Preview – ui May 4, 2023 12:44 Inactive
@vercel vercel bot temporarily deployed to Preview – prerender May 4, 2023 12:45 Inactive
@vercel vercel bot temporarily deployed to Preview – ui May 4, 2023 12:53 Inactive
@vercel vercel bot temporarily deployed to Preview – prerender May 4, 2023 12:53 Inactive
@bigint bigint merged commit aa89577 into main May 4, 2023
3 checks passed
@bigint bigint deleted the snapshot-address-generator branch May 4, 2023 12:53
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.

None yet

1 participant