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: add getDataByMessageHash data endpoint #950

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

pscott
Copy link
Contributor

@pscott pscott commented Oct 29, 2024

Summary

  • Adds a getDataByMessageHash method that accepts a hash as params and returns all the information required for the user to re-compute his hash independently.
  • Modifies sx.js in order for the getProposeHash / getVoteHash / getUpdateProposalHash methods to accept an address instead of a Signer (required for the hash-verifier to work). Also upgrades the corresponding tests.

Closes: #949

How to test

  1. Build locally and use yarn link to link with the hash-verifier script.

Question: is getDataByMessageHash a proper name? Should we find a better name?

@pscott pscott requested a review from Sekhmet October 29, 2024 13:54
@pscott pscott force-pushed the feat_add_get_hash_data_endpoint branch 2 times, most recently from 413b273 to 87d6d39 Compare October 29, 2024 14:17
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

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

It works:
image

Note, make sure we are passing unpadded hash in the script.

@@ -223,7 +223,7 @@ export class EthereumTx {

async estimateProposeFee(signer: Signer, data: Propose) {
const address = await signer.getAddress();
const hash = await this.getProposeHash(signer, data);
const hash = await this.getProposeHash(address, data);
Copy link
Member

Choose a reason for hiding this comment

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

Can we extract those sx.js changes to separate PR? With yarn changeset to generate changelog for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pscott pscott force-pushed the feat_add_get_hash_data_endpoint branch from 996351d to 689a1cc Compare November 4, 2024 15:40
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

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

tACK

@Sekhmet Sekhmet enabled auto-merge (squash) November 4, 2024 15:42
@Sekhmet Sekhmet merged commit 8fb24bf into master Nov 4, 2024
2 of 4 checks passed
@Sekhmet Sekhmet deleted the feat_add_get_hash_data_endpoint branch November 4, 2024 15:43
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.

Add method to extract registered transaction data
2 participants