Questions tagged [scale]
The scale tag has no usage guidance.
13
questions
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 ...
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 ...
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,
...
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?
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/...
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 ...
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 ...
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'
...
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",
...
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?
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 ...
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 ...
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 ...