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

Decode unsigned extrinsic hex #63

Open
dwickwire opened this issue Oct 29, 2024 · 0 comments
Open

Decode unsigned extrinsic hex #63

dwickwire opened this issue Oct 29, 2024 · 0 comments

Comments

@dwickwire
Copy link

Hello, given an unsigned extrinsic hex, is it possible with this library to decode that?

for instance, I have this expected data hex, for westend, v14:

0xa4040300d9eb398a5d93d65999b94284df5abb9cbf3c7358d961a9e34a73b4ee4344bb3f070010a5d4e8000c0000c0800f001a000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00

How might I use this library to decode the meta detail of that? I've managed to get an extrinsic with the below, but not sure how to get sender address, nonce, amount, recipient etc., whereas I can get these in the typescript library with the same hash.

        let expected = try Data(hexString: "0xa4040300d9eb398a5d93d65999b94284df5abb9cbf3c7358d961a9e34a73b4ee4344bb3f070010a5d4e8000c0000c0800f001a000000e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423ee143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e00")
        let registry = try ScaleInfoHelper.createTypeRegistryWithoutVersioning(from: "westend-metadata")
        let decoder = try DynamicScaleDecoder(data: expected,
                                              registry: registry,
                                              version: 4)
        let encoder = DynamicScaleEncoder(registry: registry, version: 4)
        let extrinsic: Extrinsic = try decoder.read(of: GenericType.extrinsic.name)

Any input about how to use this SDK for that use-case would be great, thanks!

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

No branches or pull requests

1 participant