Skip to content

Decode unsigned extrinsic hex #63

@dwickwire

Description

@dwickwire

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions