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

Add an example with the new metadata hash input #391

Open
IkerAlus opened this issue Jun 26, 2024 · 1 comment
Open

Add an example with the new metadata hash input #391

IkerAlus opened this issue Jun 26, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@IkerAlus
Copy link
Collaborator

Since Polkadot 1.2.5 release, signers can add the metadata hash to a transaction as specified in RFC 78.

Although txwrapper is not a signer, it is supposed to be used in conjunction with signers to construct transactions offline. Hence it will be good to add an example, for example similar to this one, where the metadata hash is added to the transaction before being signed. The open question is how to compute this hash value. My recommendation is not to add extra dependencies to the example and query it from the exposed testing API or similar

@IkerAlus IkerAlus added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Jun 26, 2024
@IkerAlus IkerAlus changed the title Add example metadata hash Add an example with the new metadata hash input Jun 26, 2024
@bee344
Copy link
Collaborator

bee344 commented Aug 27, 2024

If anyone wishes to make a PR for this, you are more than welcome to do so! The changes to the example would basically be adding an extra step to building the transaction:

  • First you would need to build the payload in a regular way, very much as it is set now, but then you would need to use the payload and the metadata to build the proof.
  • Then you'd have to build the new payload with the same values as before but with mode set to 1 and the metadataHash to the proof you got in the previous step.

This is not as straightforward of a change as it would seem on a first look, since it needs to add the metadata proof building step along with the corresponding PAPI package, but it's interesting to understand how the new SignedExtension works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants