Add a or `string ToJson(Metadata metadata)` method to `Method` class
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:
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.
It would lead to something like this where the parameters would be an array of ITypes at best
you would have to cast it back into the main class, could use reflection.
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?
Yes, depending on what you exactly get, it should be doable to decode it back into the specific Type, format https://github.com/SubstrateGaming/Substrate.NET.API/blob/cafdc160cbcde077fa3f42c0b3168a1b08c448e4/Substrate.NetApi/Model/Extrinsics/Extrinsic.cs#L68