Questions tagged [scale]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
69 views

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

When using the Python script: timestamp = ScaleDecoder.get_decoder_class('Timestamp', ScaleBytes(timestamp_bytes_array)).decode() it seems that the decoder expects the size of the array to be exactly ...
The Quantum Physicist's user avatar
4 votes
4 answers
110 views

Decoding Polkadot/Kusama transactions in Rust

I would like to inspect transactions (extrinsics) in a given block to potentially: Find different types of transactions and their parameters Look through all transactions included in the block and ...
Szymig's user avatar
  • 205
2 votes
1 answer
40 views

How to provide argument to storage call in subxt?

In polkadotjs I have following code: const opts = [{"UniqueIdenfier1":[0,"challengeprofile"]}] let data = api.query.templateModule.periodName( ...opts, ...
Amiya Behera's user avatar
2 votes
1 answer
76 views

Why SCALE vs RLP?

What are the differences between SCALE and RLP serialization beyond little-endian vs big-endian encoding? If both are length-encoded, what might make one better than the other?
Drew Stone's user avatar
  • 1,164
3 votes
1 answer
72 views

Decoding `democracy.Voted`

I'm having trouble decoding a democracy.Voted event on Polkadot - for example: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/explorer/query/...
csknk's user avatar
  • 227
2 votes
1 answer
67 views

Does changing an enum require a storage migration? What about `Error` and `Event`

Say I have instances of this enum stored on-chain: enum Enum { V0, V1, } And suppose now that I change the enum in some way: enum Enum { V0, V2, V1, } This is what the substrate ...
mkl's user avatar
  • 420
2 votes
3 answers
618 views

Convert any address to accountId (in hex)

How can i convert an address of the form "5DTNtGF2DmZ7QwGxg6n1xWzF6cEokNyNre7mUqpVuozrLxu3" to hex using polkadotjs packages? Here is the context: I have multiples array of datas, containing ...
Nathan's user avatar
  • 464
2 votes
1 answer
76 views

How to create a tuple type using polkadot.js api

I am trying to create a tuple. I know we can create an enum by defining the type as MyEnum: { _enum: { 'account': String, 'accountId': 'u128' ...
Emmanuel Thomas's user avatar
0 votes
1 answer
125 views

How to decode RPC results using Python's Scale library

I'm trying to get the chain state information from substrate using RPC for IdentityOf of any Accountid Upon succesfull request, I get the following result: { "jsonrpc": "2.0", ...
Faisal Ahmed's user avatar
3 votes
1 answer
62 views

Scale codec f64 support

What is the reason that the SCALE codec does not support Encode and Decode of f64 types?
Mathis Wellmann's user avatar
4 votes
1 answer
185 views

Compact SCALE decoding

In this answer the compact decoding for 1 byte and multi-byte versions have been detailed. I did a sample implementation based on that information and it does what it is supposed to, at least for the ...
Xiu Hung's user avatar
  • 497
2 votes
1 answer
61 views

Scale codec: Is there a way to extract an enum's arm's codec index value?

Using scale, an enum can be written like this: #[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] pub enum Block { #[codec(index = 101)] V1(BlockV1), } The #[codec(index = 101)], the 101 ...
The Quantum Physicist's user avatar
1 vote
1 answer
83 views

Scale Codec for Dart

There are a couple of packages that are outdated or do not have the features I need for Dart-lang. So, I decided to code my own. There are really good implementations coded in various languages that ...
Burak's user avatar
  • 893