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 a or string ToJson(Metadata metadata) method to Method class #74

Open
RostislavLitovkin opened this issue Jan 30, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@RostislavLitovkin
Copy link
Contributor

It would be good to show the Method contents so that the users can be sure what he is signing.

It would be able to Decode the pallet name, call name and parameter data according to the provided metadata.

This is an example from HydraDX:

Screenshot 2024-01-30 at 18 50 09
@darkfriend77
Copy link
Member

darkfriend77 commented Jan 31, 2024

If you are using the SignPayloadAsync you get most of the information, But I agree the important ones are encoded in the byte[] parameters. We could allow to use an object, that implements IEncode, which you might be able to cast into the right parameters call. So you would be able to get the necessary information, out of the payload, previous to signing.

@darkfriend77
Copy link
Member

It would lead to something like this where the parameters would be an array of ITypes at best

image

you would have to cast it back into the main class, could use reflection.

@RostislavLitovkin RostislavLitovkin added the enhancement New feature or request label Feb 2, 2024
@RostislavLitovkin
Copy link
Contributor Author

It would be best if it could be translated from the SCALE encoded Method bytes.

The workaround you are suggesting will not work if the Method bytes are sent from a javascript dApp, which is how I would like to use it.

It would be great to be able to Decode the bytes back into the ITypes. Do you think it would be doable?

@darkfriend77
Copy link
Member

Yes, depending on what you exactly get, it should be doable to decode it back into the specific Type, format

internal Extrinsic(Memory<byte> memory, ChargeType chargeType)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants