Skip to main content
1 vote
Accepted

How can I properly use scale::Decode to get consistent results?

return_value() returns the value wrapped in Result and this is why it is prepended with 0 - Ok(1)
dastansam's user avatar
  • 591
1 vote
Accepted

How to construct the data structure with correct values for their attributes within a Pallet for data submitted by a polkadotJS app

JS encode: const registry = new TypeRegistry(); const someNameInstance = registry.createType('{"current_fraction":"u32"}', { current_fraction: 123 }); const encoded = ...
AurevoirXavier's user avatar
  • 10.7k
1 vote

Is there any way to extract "method" and "params" of unchecked extrinsic using ScaleCode/TypeInfo traits?

I'm not sure of the context in which you want this information, but if you're just keen to connect to a node/chain, download blocks and decode extrinsics, then have a look at Subxt, which is a Rust ...
jsdw's user avatar
  • 1,335
1 vote
Accepted

How to properly decode a SCALE-encoded string using polkadot-js?

You want to follow the same steps you took to generate the hex to get back. In your example generating the hex you do: String: "aabbcc" toU8a: Uint8Array(7) [ 24, 97, 97, 98, 98, 99, 99 ] ...
Shawn Tabrizi's user avatar
  • 16.1k
1 vote
Accepted

Scalecodec: How can I get the equivalent of Decode in Python, instead of DecodeAll?

There is kwarg you can pass to the decode() function, so it won't check the remaining bytes: decode(check_remaining=False). I don't have much context of your use-case, but I assume you have added a ...
Arjan's user avatar
  • 151
1 vote
Accepted

What is the purpose of the `contracts_runtime.scale` file in the `cargo-contracts` repository?

The metadata was downloaded from a running substrate-contracts-node and is used to generate the APIs and types required for constructing contract extrinsics and querying storage from a compatible node....
Andrew Jones's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible