paritytech / txwrapper-core

Tools for FRAME chain builders to publish chain specific offline transaction generation libraries.
https://paritytech.github.io/txwrapper-core/
Apache License 2.0
77 stars 28 forks source link

Add an example with the new metadata hash input #391

Open IkerAlus opened 2 months ago

IkerAlus commented 2 months ago

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

bee344 commented 3 weeks ago

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:

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.