scale.rb 0.2.17 → 0.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/scale/types.rb CHANGED
@@ -6,10 +6,13 @@ module Scale
6
6
  BYTES_LENGTH = 1
7
7
 
8
8
  def self.decode(scale_bytes)
9
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
9
10
  bytes = scale_bytes.get_next_bytes(self::BYTES_LENGTH)
10
11
  if bytes == [0]
12
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
11
13
  Bool.new(false)
12
14
  elsif bytes == [1]
15
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
13
16
  Bool.new(true)
14
17
  else
15
18
  raise "Bad data"
@@ -80,6 +83,7 @@ module Scale
80
83
  include SingleValue
81
84
 
82
85
  def self.decode(scale_bytes)
86
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
83
87
  first_byte = scale_bytes.get_next_bytes(1)[0]
84
88
  first_byte_in_bin = first_byte.to_s(2).rjust(8, "0")
85
89
 
@@ -113,6 +117,7 @@ module Scale
113
117
  .to_i(16)
114
118
  end
115
119
 
120
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
116
121
  Compact.new(value)
117
122
  end
118
123
 
@@ -141,6 +146,7 @@ module Scale
141
146
  include SingleValue
142
147
 
143
148
  def self.decode(scale_bytes)
149
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
144
150
  length = Scale::Types::Compact.decode(scale_bytes).value
145
151
  bytes = scale_bytes.get_next_bytes(length)
146
152
 
@@ -148,8 +154,10 @@ module Scale
148
154
  # => "Café"
149
155
  str = bytes.pack("C*").force_encoding("utf-8")
150
156
  if str.valid_encoding?
157
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
151
158
  Bytes.new str
152
159
  else
160
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
153
161
  Bytes.new bytes.bytes_to_hex
154
162
  end
155
163
  end
@@ -171,8 +179,10 @@ module Scale
171
179
  include SingleValue
172
180
 
173
181
  def self.decode(scale_bytes)
182
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
174
183
  length = Scale::Types::Compact.decode(scale_bytes).value
175
184
  hex_string = scale_bytes.get_next_bytes(length).bytes_to_hex
185
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
176
186
  Hex.new(hex_string)
177
187
  end
178
188
  end
@@ -180,8 +190,10 @@ module Scale
180
190
  class String
181
191
  include SingleValue
182
192
  def self.decode(scale_bytes)
193
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
183
194
  length = Scale::Types::Compact.decode(scale_bytes).value
184
195
  bytes = scale_bytes.get_next_bytes(length)
196
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
185
197
  String.new bytes.pack("C*").force_encoding("utf-8")
186
198
  end
187
199
  end
@@ -189,7 +201,9 @@ module Scale
189
201
  class H160
190
202
  include SingleValue
191
203
  def self.decode(scale_bytes)
204
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
192
205
  bytes = scale_bytes.get_next_bytes(20)
206
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
193
207
  H160.new(bytes.bytes_to_hex)
194
208
  end
195
209
 
@@ -202,7 +216,9 @@ module Scale
202
216
  class H256
203
217
  include SingleValue
204
218
  def self.decode(scale_bytes)
219
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
205
220
  bytes = scale_bytes.get_next_bytes(32)
221
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
206
222
  H256.new(bytes.bytes_to_hex)
207
223
  end
208
224
 
@@ -215,7 +231,9 @@ module Scale
215
231
  class H512
216
232
  include SingleValue
217
233
  def self.decode(scale_bytes)
234
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
218
235
  bytes = scale_bytes.get_next_bytes(64)
236
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
219
237
  H512.new(bytes.bytes_to_hex)
220
238
  end
221
239
 
@@ -234,12 +252,14 @@ module Scale
234
252
  # the <address> is 32 byte account id or 1, 2, 4, 8 byte account index
235
253
  # scale_bytes: account length byte + <address>'s bytes
236
254
  def self.decode(scale_bytes)
255
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
237
256
  account_length = scale_bytes.get_next_bytes(1).first
238
257
 
239
258
  if account_length == 0xff # 32 bytes address(Public key)
240
259
  account_id = scale_bytes.get_next_bytes(32).bytes_to_hex
241
260
  account_length = [account_length].bytes_to_hex
242
261
 
262
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
243
263
  Address.new({
244
264
  account_id: account_id,
245
265
  account_length: account_length
@@ -258,6 +278,7 @@ module Scale
258
278
  # TODO: add account_idx
259
279
  account_length = [account_length].bytes_to_hex
260
280
 
281
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
261
282
  Address.new({
262
283
  account_index: account_index,
263
284
  account_length: account_length
@@ -280,10 +301,14 @@ module Scale
280
301
 
281
302
  class AccountIdAddress < GenericAddress
282
303
  def self.decode(scale_bytes)
283
- AccountIdAddress.new({
304
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
305
+ result = AccountIdAddress.new({
284
306
  account_id: AccountId.decode(scale_bytes).value,
285
307
  account_length: "0xff"
286
308
  })
309
+
310
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
311
+ result
287
312
  end
288
313
 
289
314
  def encode
@@ -304,12 +329,15 @@ module Scale
304
329
  class Era
305
330
  include SingleValue
306
331
  def self.decode(scale_bytes)
332
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
307
333
  byte = scale_bytes.get_next_bytes(1).bytes_to_hex
308
- if byte == "0x00"
334
+ result = if byte == "0x00"
309
335
  Era.new byte
310
336
  else
311
337
  Era.new byte + scale_bytes.get_next_bytes(1).bytes_to_hex()[2..]
312
338
  end
339
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
340
+ result
313
341
  end
314
342
  end
315
343
 
@@ -320,12 +348,14 @@ module Scale
320
348
  class CompactMoment
321
349
  include SingleValue
322
350
  def self.decode(scale_bytes)
351
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
323
352
  value = Compact.decode(scale_bytes).value
324
353
  if value > 10000000000
325
354
  value /= 1000
326
355
  end
327
356
 
328
- CompactMoment.new Time.at(value).to_datetime.strftime("%F %T")
357
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
358
+ CompactMoment.new Time.at(value).strftime("%F %T")
329
359
  end
330
360
  end
331
361
 
@@ -632,7 +662,9 @@ module Scale
632
662
  include SingleValue
633
663
 
634
664
  def self.decode(scale_bytes)
665
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
635
666
  bytes = scale_bytes.get_next_bytes(20)
667
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
636
668
  EthereumAddress.new(bytes.bytes_to_hex)
637
669
  end
638
670
 
@@ -649,8 +681,10 @@ module Scale
649
681
  include SingleValue
650
682
 
651
683
  def self.decode(scale_bytes)
684
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
652
685
  bytes = scale_bytes.get_next_bytes(65)
653
686
  EcdsaSignature.new(bytes.bytes_to_hex)
687
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
654
688
  end
655
689
 
656
690
  def encode
@@ -758,7 +792,11 @@ module Scale
758
792
  class VoteOutcome
759
793
  include SingleValue
760
794
  def self.decode(scale_bytes)
761
- new(scale_bytes.get_next_bytes(32))
795
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
796
+ result = new(scale_bytes.get_next_bytes(32))
797
+
798
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
799
+ result
762
800
  end
763
801
  end
764
802
 
@@ -799,6 +837,7 @@ module Scale
799
837
  include SingleValue
800
838
 
801
839
  def self.decode(scale_bytes, metadata, chain_spec)
840
+ puts "BEGIN " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
802
841
  call_index = scale_bytes.get_next_bytes(2).bytes_to_hex[2..]
803
842
  call_module, call = metadata.value.call_index[call_index]
804
843
 
@@ -807,6 +846,7 @@ module Scale
807
846
  {name: arg[:name], type: arg[:type], value: arg_obj.encode, value_raw: arg_obj.value}
808
847
  end
809
848
 
849
+ puts " END " + self::TYPE_NAME + ": #{scale_bytes}" if Scale::Types.debug == true
810
850
  self.new({
811
851
  call_index: call_index,
812
852
  call_function: call[:name],
@@ -844,6 +884,15 @@ module Scale
844
884
  end
845
885
  end
846
886
 
887
+ class GenericBlock
888
+ include SingleValue
889
+
890
+ def self.decode(scale_bytes)
891
+ end
892
+
893
+ def encode
894
+ end
895
+ end
847
896
 
848
897
  end
849
898
  end
data/lib/scale/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scale
2
- VERSION = "0.2.17".freeze
2
+ VERSION = "0.2.18".freeze
3
3
  end
@@ -1,148 +1,606 @@
1
1
  {
2
- "types": {
3
- "Address": "AccountId",
4
- "LookupSource": "AccountId",
5
- "BalanceLock": {
6
- "type": "struct",
7
- "type_mapping": [
8
- [
9
- "id",
10
- "LockIdentifier"
11
- ],
12
- [
13
- "lock_for",
14
- "LockFor"
15
- ],
16
- [
17
- "lock_reasons",
18
- "LockReasons"
19
- ]
20
- ]
21
- },
22
- "LockFor": {
23
- "type": "enum",
24
- "type_mapping": [
25
- [
26
- "Common",
27
- "Common"
28
- ],
29
- [
30
- "Staking",
31
- "StakingLock"
32
- ]
33
- ]
34
- },
35
- "Common": {
36
- "type": "struct",
37
- "type_mapping": [
38
- [
39
- "amount",
40
- "Balance"
41
- ]
42
- ]
2
+ "versioning": [
3
+ {
4
+ "runtime_range": [
5
+ 35,
6
+ 41
7
+ ],
8
+ "types": {
9
+ "ScheduledAuthoritiesChangeT": {
10
+ "type": "struct",
11
+ "type_mapping": [
12
+ [
13
+ "next_authorities",
14
+ "Vec<RelayAuthorityT>"
15
+ ],
16
+ [
17
+ "deadline",
18
+ "BlockNumber"
19
+ ]
20
+ ]
21
+ }
22
+ }
43
23
  },
44
- "StakingLock": {
45
- "type": "struct",
46
- "type_mapping": [
47
- [
48
- "staking_amount",
49
- "Balance"
50
- ],
51
- [
52
- "unbondings",
53
- "Vec<Unbonding>"
54
- ]
55
- ]
24
+ {
25
+ "runtime_range": [
26
+ 34,
27
+ 41
28
+ ],
29
+ "types": {
30
+ "OpCode": "[u8; 4]",
31
+ "Term": "u32"
32
+ }
56
33
  },
57
- "LockReasons": {
58
- "type": "enum",
59
- "type_mapping": [
60
- [
61
- "Fee",
62
- "Null"
63
- ],
64
- [
65
- "Misc",
66
- "Null"
67
- ],
68
- [
69
- "All",
70
- "Null"
71
- ]
72
- ]
34
+ {
35
+ "runtime_range": [
36
+ 34,
37
+ 34
38
+ ],
39
+ "types": {
40
+ "ScheduledAuthoritiesChange": {
41
+ "type": "struct",
42
+ "type_mapping": [
43
+ [
44
+ "next_authorities",
45
+ "Vec<RelayAuthorityT>"
46
+ ],
47
+ [
48
+ "deadline",
49
+ "BlockNumber"
50
+ ]
51
+ ]
52
+ }
53
+ }
73
54
  },
74
- "Unbonding": {
75
- "type": "struct",
76
- "type_mapping": [
77
- [
78
- "amount",
79
- "Balance"
80
- ],
81
- [
82
- "until",
83
- "BlockNumber"
84
- ]
85
- ]
55
+ {
56
+ "runtime_range": [
57
+ 20,
58
+ 28
59
+ ],
60
+ "types": {
61
+ "MerkleMountainRangeRootLog": {
62
+ "type": "struct",
63
+ "type_mapping": [
64
+ [
65
+ "prefix",
66
+ "[u8; 4]"
67
+ ],
68
+ [
69
+ "mmr_root",
70
+ "Hash"
71
+ ]
72
+ ]
73
+ }
74
+ }
86
75
  },
87
- "AccountData": {
88
- "type": "struct",
89
- "type_mapping": [
90
- [
91
- "free",
92
- "Balance"
93
- ],
94
- [
95
- "reserved",
96
- "Balance"
97
- ],
98
- [
99
- "free_kton",
100
- "Balance"
101
- ],
102
- [
103
- "reserved_kton",
104
- "Balance"
105
- ]
106
- ]
76
+ {
77
+ "runtime_range": [
78
+ 29,
79
+ 41
80
+ ],
81
+ "types": {
82
+ "EcdsaMessage": "[u8; 32]",
83
+ "RelayAuthoritySigner": "EcdsaAddress",
84
+ "RelayAuthorityMessage": "EcdsaMessage",
85
+ "RelayAuthoritySignature": "EcdsaSignature",
86
+ "RelayAuthorityT": {
87
+ "type": "struct",
88
+ "type_mapping": [
89
+ [
90
+ "account_id",
91
+ "AccountId"
92
+ ],
93
+ [
94
+ "signer",
95
+ "Signer"
96
+ ],
97
+ [
98
+ "stake",
99
+ "Balance"
100
+ ],
101
+ [
102
+ "term",
103
+ "BlockNumber"
104
+ ]
105
+ ]
106
+ },
107
+ "MMRRoot": "Hash",
108
+ "MerkleMountainRangeRootLog": {
109
+ "type": "struct",
110
+ "type_mapping": [
111
+ [
112
+ "prefix",
113
+ "[u8; 4]"
114
+ ],
115
+ [
116
+ "parent_mmr_root",
117
+ "Hash"
118
+ ]
119
+ ]
120
+ },
121
+ "EthereumRelayHeaderParcel": {
122
+ "type": "struct",
123
+ "type_mapping": [
124
+ [
125
+ "header",
126
+ "EthereumHeader"
127
+ ],
128
+ [
129
+ "parent_mmr_root",
130
+ "H256"
131
+ ]
132
+ ]
133
+ }
134
+ }
107
135
  },
108
- "RingBalance": "Balance",
109
- "KtonBalance": "Balance",
110
- "TsInMs": "u64",
111
- "Power": "u32",
112
- "DepositId": "U256",
113
- "StakingBalanceT": {
114
- "type": "enum",
115
- "type_mapping": [
116
- [
117
- "RingBalance",
118
- "Balance"
119
- ],
120
- [
121
- "KtonBalance",
122
- "Balance"
123
- ]
124
- ]
136
+ {
137
+ "runtime_range": [
138
+ 25,
139
+ 41
140
+ ],
141
+ "types": {
142
+ "RelayProofs": "EthereumRelayProofs"
143
+ }
125
144
  },
126
- "StakingLedgerT": {
127
- "type": "struct",
128
- "type_mapping": [
129
- [
130
- "stash",
131
- "AccountId"
132
- ],
133
- [
134
- "active_ring",
135
- "Compact<Balance>"
136
- ],
137
- [
138
- "active_deposit_ring",
139
- "Compact<Balance>"
140
- ],
141
- [
142
- "active_kton",
143
- "Compact<Balance>"
144
- ],
145
- [
145
+ {
146
+ "runtime_range": [
147
+ 24,
148
+ 41
149
+ ],
150
+ "types": {
151
+ "RelayVotingState": {
152
+ "type": "struct",
153
+ "type_mapping": [
154
+ [
155
+ "ayes",
156
+ "Vec<AccountId>"
157
+ ],
158
+ [
159
+ "nays",
160
+ "Vec<AccountId>"
161
+ ]
162
+ ]
163
+ },
164
+ "ProxyType": {
165
+ "type": "enum",
166
+ "type_mapping": [
167
+ [
168
+ "Any",
169
+ "Null"
170
+ ],
171
+ [
172
+ "NonTransfer",
173
+ "Null"
174
+ ],
175
+ [
176
+ "Governance",
177
+ "Null"
178
+ ],
179
+ [
180
+ "Staking",
181
+ "Null"
182
+ ],
183
+ [
184
+ "IdentityJudgement",
185
+ "Null"
186
+ ],
187
+ [
188
+ "EthereumBridge",
189
+ "Null"
190
+ ]
191
+ ]
192
+ },
193
+ "RelayHeaderId": "EthereumBlockNumber",
194
+ "RelayHeaderParcel": "EthereumRelayHeaderParcel",
195
+ "RelayAffirmationId": {
196
+ "type": "struct",
197
+ "type_mapping": [
198
+ [
199
+ "game_id",
200
+ "EthereumBlockNumber"
201
+ ],
202
+ [
203
+ "round",
204
+ "u32"
205
+ ],
206
+ [
207
+ "index",
208
+ "u32"
209
+ ]
210
+ ]
211
+ },
212
+ "RelayAffirmationT": {
213
+ "type": "struct",
214
+ "type_mapping": [
215
+ [
216
+ "relayer",
217
+ "AccountId"
218
+ ],
219
+ [
220
+ "relay_header_parcels",
221
+ "EthereumRelayHeaderParcel"
222
+ ],
223
+ [
224
+ "bond",
225
+ "Balance"
226
+ ],
227
+ [
228
+ "maybe_extended_relay_affirmation_id",
229
+ "Option<RelayAffirmationId>"
230
+ ],
231
+ [
232
+ "verified",
233
+ "bool"
234
+ ]
235
+ ]
236
+ }
237
+ }
238
+ },
239
+ {
240
+ "runtime_range": [
241
+ 24,
242
+ 24
243
+ ],
244
+ "types": {
245
+ "RelayProofs": "EthereumRelayProof"
246
+ }
247
+ },
248
+ {
249
+ "runtime_range": [
250
+ 20,
251
+ 22
252
+ ],
253
+ "types": {
254
+ "EthereumHeaderBrief": {
255
+ "type": "struct",
256
+ "type_mapping": [
257
+ [
258
+ "total_difficulty",
259
+ "U256"
260
+ ],
261
+ [
262
+ "parent_hash",
263
+ "H256"
264
+ ],
265
+ [
266
+ "number",
267
+ "EthereumBlockNumber"
268
+ ],
269
+ [
270
+ "relayer",
271
+ "AccountId"
272
+ ]
273
+ ]
274
+ },
275
+ "EthereumHeaderThingWithProof": {
276
+ "type": "struct",
277
+ "type_mapping": [
278
+ [
279
+ "header",
280
+ "EthereumHeader"
281
+ ],
282
+ [
283
+ "ethash_proof",
284
+ "Vec<EthashProof>"
285
+ ],
286
+ [
287
+ "mmr_root",
288
+ "H256"
289
+ ],
290
+ [
291
+ "mmr_proof",
292
+ "Vec<H256>"
293
+ ]
294
+ ]
295
+ },
296
+ "ConfirmedEthereumHeaderInfo": {
297
+ "type": "struct",
298
+ "type_mapping": [
299
+ [
300
+ "header",
301
+ "EthereumHeader"
302
+ ],
303
+ [
304
+ "mmr_root",
305
+ "H256"
306
+ ]
307
+ ]
308
+ },
309
+ "EthereumHeaderThing": {
310
+ "type": "struct",
311
+ "type_mapping": [
312
+ [
313
+ "header",
314
+ "EthereumHeader"
315
+ ],
316
+ [
317
+ "mmr_root",
318
+ "H256"
319
+ ]
320
+ ]
321
+ },
322
+ "Round": "u64",
323
+ "TcHeaderThingWithProof": "EthereumHeaderThingWithProof",
324
+ "TcHeaderThing": "EthereumHeaderThing",
325
+ "TcBlockNumber": "u64",
326
+ "TcHeaderHash": "H256",
327
+ "GameId": "TcBlockNumber",
328
+ "RelayProposalT": {
329
+ "type": "struct",
330
+ "type_mapping": [
331
+ [
332
+ "relayer",
333
+ "AccountId"
334
+ ],
335
+ [
336
+ "bonded_proposal",
337
+ "Vec<(Balance, TcHeaderThing)>"
338
+ ],
339
+ [
340
+ "extend_from_header_hash",
341
+ "Option<TcHeaderHash>"
342
+ ]
343
+ ]
344
+ }
345
+ }
346
+ },
347
+ {
348
+ "runtime_range": [
349
+ 23,
350
+ 41
351
+ ],
352
+ "types": {
353
+ "EthereumRelayProofs": {
354
+ "type": "struct",
355
+ "type_mapping": [
356
+ [
357
+ "ethash_proof",
358
+ "Vec<EthashProof>"
359
+ ],
360
+ [
361
+ "mmr_proof",
362
+ "Vec<H256>"
363
+ ]
364
+ ]
365
+ }
366
+ }
367
+ },
368
+ {
369
+ "runtime_range": [
370
+ 23,
371
+ 28
372
+ ],
373
+ "types": {
374
+ "EthereumRelayHeaderParcel": {
375
+ "type": "struct",
376
+ "type_mapping": [
377
+ [
378
+ "header",
379
+ "EthereumHeader"
380
+ ],
381
+ [
382
+ "mmr_root",
383
+ "H256"
384
+ ]
385
+ ]
386
+ }
387
+ }
388
+ },
389
+ {
390
+ "runtime_range": [
391
+ 23,
392
+ 23
393
+ ],
394
+ "types": {
395
+ "RelayHeaderId": "Vec<u8>",
396
+ "RelayHeaderParcel": "Vec<u8>",
397
+ "RelayAffirmationId": {
398
+ "type": "struct",
399
+ "type_mapping": [
400
+ [
401
+ "relay_header_id",
402
+ "Vec<u8>"
403
+ ],
404
+ [
405
+ "round",
406
+ "u32"
407
+ ],
408
+ [
409
+ "index",
410
+ "u32"
411
+ ]
412
+ ]
413
+ },
414
+ "RelayAffirmationT": {
415
+ "type": "struct",
416
+ "type_mapping": [
417
+ [
418
+ "relayer",
419
+ "AccountId"
420
+ ],
421
+ [
422
+ "relay_header_parcels",
423
+ "Vec<u8>"
424
+ ],
425
+ [
426
+ "bond",
427
+ "Balance"
428
+ ],
429
+ [
430
+ "maybe_extended_relay_affirmation_id",
431
+ "Option<Vec<u8>>"
432
+ ],
433
+ [
434
+ "verified",
435
+ "bool"
436
+ ]
437
+ ]
438
+ },
439
+ "RelayProofs": "Vec<u8>"
440
+ }
441
+ }
442
+ ],
443
+ "types": {
444
+ "Balance": "u64",
445
+ "Address": "AccountId",
446
+ "LookupSource": "AccountId",
447
+ "BalanceLock": {
448
+ "type": "struct",
449
+ "type_mapping": [
450
+ [
451
+ "id",
452
+ "LockIdentifier"
453
+ ],
454
+ [
455
+ "lock_for",
456
+ "LockFor"
457
+ ],
458
+ [
459
+ "lock_reasons",
460
+ "LockReasons"
461
+ ],
462
+ [
463
+ "amount",
464
+ "Balance"
465
+ ],
466
+ [
467
+ "reasons",
468
+ "Reasons"
469
+ ]
470
+ ]
471
+ },
472
+ "LockFor": {
473
+ "type": "enum",
474
+ "type_mapping": [
475
+ [
476
+ "Common",
477
+ "Common"
478
+ ],
479
+ [
480
+ "Staking",
481
+ "StakingLock"
482
+ ]
483
+ ]
484
+ },
485
+ "Common": {
486
+ "type": "struct",
487
+ "type_mapping": [
488
+ [
489
+ "amount",
490
+ "Balance"
491
+ ]
492
+ ]
493
+ },
494
+ "StakingLock": {
495
+ "type": "struct",
496
+ "type_mapping": [
497
+ [
498
+ "staking_amount",
499
+ "Balance"
500
+ ],
501
+ [
502
+ "unbondings",
503
+ "Vec<Unbonding>"
504
+ ]
505
+ ]
506
+ },
507
+ "LockReasons": {
508
+ "type": "enum",
509
+ "type_mapping": [
510
+ [
511
+ "Fee",
512
+ "Null"
513
+ ],
514
+ [
515
+ "Misc",
516
+ "Null"
517
+ ],
518
+ [
519
+ "All",
520
+ "Null"
521
+ ]
522
+ ]
523
+ },
524
+ "Unbonding": {
525
+ "type": "struct",
526
+ "type_mapping": [
527
+ [
528
+ "amount",
529
+ "Balance"
530
+ ],
531
+ [
532
+ "until",
533
+ "BlockNumber"
534
+ ]
535
+ ]
536
+ },
537
+ "AccountData": {
538
+ "type": "struct",
539
+ "type_mapping": [
540
+ [
541
+ "free",
542
+ "Balance"
543
+ ],
544
+ [
545
+ "reserved",
546
+ "Balance"
547
+ ],
548
+ [
549
+ "free_kton",
550
+ "Balance"
551
+ ],
552
+ [
553
+ "reserved_kton",
554
+ "Balance"
555
+ ],
556
+ [
557
+ "misc_frozen",
558
+ "Balance"
559
+ ],
560
+ [
561
+ "fee_frozen",
562
+ "Balance"
563
+ ]
564
+ ]
565
+ },
566
+ "RingBalance": "Balance",
567
+ "KtonBalance": "Balance",
568
+ "TsInMs": "u64",
569
+ "Power": "u32",
570
+ "DepositId": "U256",
571
+ "StakingBalanceT": {
572
+ "type": "enum",
573
+ "type_mapping": [
574
+ [
575
+ "RingBalance",
576
+ "Balance"
577
+ ],
578
+ [
579
+ "KtonBalance",
580
+ "Balance"
581
+ ]
582
+ ]
583
+ },
584
+ "StakingLedgerT": {
585
+ "type": "struct",
586
+ "type_mapping": [
587
+ [
588
+ "stash",
589
+ "AccountId"
590
+ ],
591
+ [
592
+ "active_ring",
593
+ "Compact<Balance>"
594
+ ],
595
+ [
596
+ "active_deposit_ring",
597
+ "Compact<Balance>"
598
+ ],
599
+ [
600
+ "active_kton",
601
+ "Compact<Balance>"
602
+ ],
603
+ [
146
604
  "deposit_items",
147
605
  "Vec<TimeDepositItem>"
148
606
  ],
@@ -151,12 +609,24 @@
151
609
  "StakingLock"
152
610
  ],
153
611
  [
154
- "kton_staking_lock",
155
- "StakingLock"
612
+ "kton_staking_lock",
613
+ "StakingLock"
614
+ ],
615
+ [
616
+ "claimed_rewards",
617
+ "Vec<EraIndex>"
618
+ ],
619
+ [
620
+ "total",
621
+ "Compact<Balance>"
622
+ ],
623
+ [
624
+ "active",
625
+ "Compact<Balance>"
156
626
  ],
157
627
  [
158
- "claimed_rewards",
159
- "Vec<EraIndex>"
628
+ "unlocking",
629
+ "Vec<UnlockChunk>"
160
630
  ]
161
631
  ]
162
632
  },
@@ -220,6 +690,10 @@
220
690
  [
221
691
  "power",
222
692
  "Power"
693
+ ],
694
+ [
695
+ "value",
696
+ "Compact<Balance>"
223
697
  ]
224
698
  ]
225
699
  },
@@ -468,462 +942,69 @@
468
942
  ]
469
943
  ]
470
944
  },
471
- "EthereumReceiptProofThing": "(EthereumHeader, EthereumReceiptProof, MMRProof)",
472
- "MMRProof": {
473
- "type": "struct",
474
- "type_mapping": [
475
- [
476
- "member_leaf_index",
477
- "u64"
478
- ],
479
- [
480
- "last_leaf_index",
481
- "u64"
482
- ],
483
- [
484
- "proof",
485
- "Vec<H256>"
486
- ]
487
- ]
488
- },
489
- "OtherSignature": {
490
- "type": "enum",
491
- "type_mapping": [
492
- [
493
- "Eth",
494
- "EcdsaSignature"
495
- ],
496
- [
497
- "Tron",
498
- "EcdsaSignature"
499
- ]
500
- ]
501
- },
502
- "EcdsaSignature": "[u8; 65]",
503
- "OtherAddress": {
504
- "type": "enum",
505
- "type_mapping": [
506
- [
507
- "Eth",
508
- "[u8; 20]"
509
- ],
510
- [
511
- "Tron",
512
- "[u8; 20]"
513
- ]
514
- ]
515
- },
516
- "AddressT": "[u8; 20]",
517
- "BalancesRuntimeDispatchInfo": {
518
- "type": "struct",
519
- "type_mapping": [
520
- [
521
- "usable_balance",
522
- "Balance"
523
- ]
524
- ]
525
- },
526
- "StakingRuntimeDispatchInfo": {
527
- "type": "struct",
528
- "type_mapping": [
529
- [
530
- "power",
531
- "Power"
532
- ]
533
- ]
534
- }
535
- },
536
- "versioning": [
537
- {
538
- "runtime_range": [
539
- 20,
540
- 28
541
- ],
542
- "types": {
543
- "MerkleMountainRangeRootLog": {
544
- "type": "struct",
545
- "type_mapping": [
546
- [
547
- "prefix",
548
- "[u8; 4]"
549
- ],
550
- [
551
- "mmr_root",
552
- "Hash"
553
- ]
554
- ]
555
- }
556
- }
557
- },
558
- {
559
- "runtime_range": [
560
- 29,
561
- 30
562
- ],
563
- "types": {
564
- "EcdsaMessage": "[u8; 32]",
565
- "RelayAuthoritySigner": "EthereumAddress",
566
- "RelayAuthorityMessage": "EcdsaMessage",
567
- "RelayAuthoritySignature": "EcdsaSignature",
568
- "Term": "u32",
569
- "RelayAuthorityT": {
570
- "type": "struct",
571
- "type_mapping": [
572
- [
573
- "account_id",
574
- "AccountId"
575
- ],
576
- [
577
- "signer",
578
- "Signer"
579
- ],
580
- [
581
- "stake",
582
- "Balance"
583
- ],
584
- [
585
- "term",
586
- "BlockNumber"
587
- ]
588
- ]
589
- },
590
- "MMRRoot": "Hash",
591
- "MerkleMountainRangeRootLog": {
592
- "type": "struct",
593
- "type_mapping": [
594
- [
595
- "prefix",
596
- "[u8; 4]"
597
- ],
598
- [
599
- "parent_mmr_root",
600
- "Hash"
601
- ]
602
- ]
603
- },
604
- "EthereumRelayHeaderParcel": {
605
- "type": "struct",
606
- "type_mapping": [
607
- [
608
- "header",
609
- "EthereumHeader"
610
- ],
611
- [
612
- "parent_mmr_root",
613
- "H256"
614
- ]
615
- ]
616
- }
617
- }
618
- },
619
- {
620
- "runtime_range": [
621
- 25,
622
- 30
623
- ],
624
- "types": {
625
- "RelayProofs": "EthereumRelayProofs"
626
- }
627
- },
628
- {
629
- "runtime_range": [
630
- 24,
631
- 30
632
- ],
633
- "types": {
634
- "RelayVotingState": {
635
- "type": "struct",
636
- "type_mapping": [
637
- [
638
- "ayes",
639
- "Vec<AccountId>"
640
- ],
641
- [
642
- "nays",
643
- "Vec<AccountId>"
644
- ]
645
- ]
646
- },
647
- "ProxyType": {
648
- "type": "enum",
649
- "type_mapping": [
650
- [
651
- "Any",
652
- "Null"
653
- ],
654
- [
655
- "NonTransfer",
656
- "Null"
657
- ],
658
- [
659
- "Governance",
660
- "Null"
661
- ],
662
- [
663
- "Staking",
664
- "Null"
665
- ],
666
- [
667
- "IdentityJudgement",
668
- "Null"
669
- ],
670
- [
671
- "EthereumBridge",
672
- "Null"
673
- ]
674
- ]
675
- },
676
- "RelayHeaderId": "EthereumBlockNumber",
677
- "RelayHeaderParcel": "EthereumRelayHeaderParcel",
678
- "RelayAffirmationId": {
679
- "type": "struct",
680
- "type_mapping": [
681
- [
682
- "game_id",
683
- "EthereumBlockNumber"
684
- ],
685
- [
686
- "round",
687
- "u32"
688
- ],
689
- [
690
- "index",
691
- "u32"
692
- ]
693
- ]
694
- },
695
- "RelayAffirmationT": {
696
- "type": "struct",
697
- "type_mapping": [
698
- [
699
- "relayer",
700
- "AccountId"
701
- ],
702
- [
703
- "relay_header_parcels",
704
- "EthereumRelayHeaderParcel"
705
- ],
706
- [
707
- "bond",
708
- "Balance"
709
- ],
710
- [
711
- "maybe_extended_relay_affirmation_id",
712
- "Option<RelayAffirmationId>"
713
- ],
714
- [
715
- "verified",
716
- "bool"
717
- ]
718
- ]
719
- }
720
- }
721
- },
722
- {
723
- "runtime_range": [
724
- 24,
725
- 24
726
- ],
727
- "types": {
728
- "RelayProofs": "EthereumRelayProof"
729
- }
945
+ "EthereumReceiptProofThing": "(EthereumHeader, EthereumReceiptProof, MMRProof)",
946
+ "MMRProof": {
947
+ "type": "struct",
948
+ "type_mapping": [
949
+ [
950
+ "member_leaf_index",
951
+ "u64"
952
+ ],
953
+ [
954
+ "last_leaf_index",
955
+ "u64"
956
+ ],
957
+ [
958
+ "proof",
959
+ "Vec<H256>"
960
+ ]
961
+ ]
730
962
  },
731
- {
732
- "runtime_range": [
733
- 20,
734
- 22
735
- ],
736
- "types": {
737
- "EthereumHeaderBrief": {
738
- "type": "struct",
739
- "type_mapping": [
740
- [
741
- "total_difficulty",
742
- "U256"
743
- ],
744
- [
745
- "parent_hash",
746
- "H256"
747
- ],
748
- [
749
- "number",
750
- "EthereumBlockNumber"
751
- ],
752
- [
753
- "relayer",
754
- "AccountId"
755
- ]
756
- ]
757
- },
758
- "EthereumHeaderThingWithProof": {
759
- "type": "struct",
760
- "type_mapping": [
761
- [
762
- "header",
763
- "EthereumHeader"
764
- ],
765
- [
766
- "ethash_proof",
767
- "Vec<EthashProof>"
768
- ],
769
- [
770
- "mmr_root",
771
- "H256"
772
- ],
773
- [
774
- "mmr_proof",
775
- "Vec<H256>"
776
- ]
777
- ]
778
- },
779
- "ConfirmedEthereumHeaderInfo": {
780
- "type": "struct",
781
- "type_mapping": [
782
- [
783
- "header",
784
- "EthereumHeader"
785
- ],
786
- [
787
- "mmr_root",
788
- "H256"
789
- ]
790
- ]
791
- },
792
- "EthereumHeaderThing": {
793
- "type": "struct",
794
- "type_mapping": [
795
- [
796
- "header",
797
- "EthereumHeader"
798
- ],
799
- [
800
- "mmr_root",
801
- "H256"
802
- ]
803
- ]
804
- },
805
- "Round": "u64",
806
- "TcHeaderThingWithProof": "EthereumHeaderThingWithProof",
807
- "TcHeaderThing": "EthereumHeaderThing",
808
- "TcBlockNumber": "u64",
809
- "TcHeaderHash": "H256",
810
- "GameId": "TcBlockNumber",
811
- "RelayProposalT": {
812
- "type": "struct",
813
- "type_mapping": [
814
- [
815
- "relayer",
816
- "AccountId"
817
- ],
818
- [
819
- "bonded_proposal",
820
- "Vec<(Balance, TcHeaderThing)>"
821
- ],
822
- [
823
- "extend_from_header_hash",
824
- "Option<TcHeaderHash>"
825
- ]
826
- ]
827
- }
828
- }
963
+ "OtherSignature": {
964
+ "type": "enum",
965
+ "type_mapping": [
966
+ [
967
+ "Eth",
968
+ "EcdsaSignature"
969
+ ],
970
+ [
971
+ "Tron",
972
+ "EcdsaSignature"
973
+ ]
974
+ ]
829
975
  },
830
-
831
- {
832
- "runtime_range": [
833
- 23,
834
- 30
835
- ],
836
- "types": {
837
- "EthereumRelayProofs": {
838
- "type": "struct",
839
- "type_mapping": [
840
- [
841
- "ethash_proof",
842
- "Vec<EthashProof>"
843
- ],
844
- [
845
- "mmr_proof",
846
- "Vec<H256>"
847
- ]
848
- ]
849
- }
850
- }
976
+ "EcdsaSignature": "[u8; 65]",
977
+ "OtherAddress": {
978
+ "type": "enum",
979
+ "type_mapping": [
980
+ [
981
+ "Eth",
982
+ "[u8; 20]"
983
+ ],
984
+ [
985
+ "Tron",
986
+ "[u8; 20]"
987
+ ]
988
+ ]
851
989
  },
852
-
853
- {
854
- "runtime_range": [
855
- 23,
856
- 28
857
- ],
858
- "types": {
859
- "EthereumRelayHeaderParcel": {
860
- "type": "struct",
861
- "type_mapping": [
862
- [
863
- "header",
864
- "EthereumHeader"
865
- ],
866
- [
867
- "mmr_root",
868
- "H256"
869
- ]
870
- ]
871
- }
872
- }
990
+ "AddressT": "[u8; 20]",
991
+ "BalancesRuntimeDispatchInfo": {
992
+ "type": "struct",
993
+ "type_mapping": [
994
+ [
995
+ "usable_balance",
996
+ "Balance"
997
+ ]
998
+ ]
873
999
  },
874
-
875
- {
876
- "runtime_range": [
877
- 23,
878
- 23
879
- ],
880
- "types": {
881
- "RelayHeaderId": "Vec<u8>",
882
- "RelayHeaderParcel": "Vec<u8>",
883
- "RelayAffirmationId": {
884
- "type": "struct",
885
- "type_mapping": [
886
- [
887
- "relay_header_id",
888
- "Vec<u8>"
889
- ],
890
- [
891
- "round",
892
- "u32"
893
- ],
894
- [
895
- "index",
896
- "u32"
897
- ]
898
- ]
899
- },
900
- "RelayAffirmationT": {
901
- "type": "struct",
902
- "type_mapping": [
903
- [
904
- "relayer",
905
- "AccountId"
906
- ],
907
- [
908
- "relay_header_parcels",
909
- "Vec<u8>"
910
- ],
911
- [
912
- "bond",
913
- "Balance"
914
- ],
915
- [
916
- "maybe_extended_relay_affirmation_id",
917
- "Option<Vec<u8>>"
918
- ],
919
- [
920
- "verified",
921
- "bool"
922
- ]
923
- ]
924
- },
925
- "RelayProofs": "Vec<u8>"
926
- }
1000
+ "StakingRuntimeDispatchInfo": {
1001
+ "type": "struct",
1002
+ "type_mapping": [
1003
+ [
1004
+ "power",
1005
+ "Power"
1006
+ ]
1007
+ ]
927
1008
  }
928
- ]
1009
+ }
929
1010
  }