scale.rb 0.2.7 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f61b15677d177f1c1ee76f1c77e8cc0ecabd1df98b50685eff13574bffeda29
4
- data.tar.gz: 6e4eb45f8fbc1d67330c80948c7cee056e2f62fd4281610a69d40d9406d0b26d
3
+ metadata.gz: f37a51e33372d5c51aa45cf538fba59a4094becf5c50c40df6a5e2700f0c89a6
4
+ data.tar.gz: 5ff9199c46a0f0a51096b3a1acda708664d71ddb755b93e6c2096534ade5c6a4
5
5
  SHA512:
6
- metadata.gz: 4dca6ff3b87b3071a82453bb8e66d0cb33f00615a0844baace80d84ad02e8e4f1ce7c53f1d90ce193ab5b8957fb41d975dce3d67128813a47f01894e2daf99d5
7
- data.tar.gz: 8f783a33623ac5fb63d6384f4b58b17e97c90ee57815af8e7efd2556fc9a58bcc4955f171f9da6e1704431a3883cb4e967eadb010c4cb691806f72042e6b8004
6
+ metadata.gz: 2fe1f22eb8928b9986d6a8d2223f023f568c8afbb9e8dc3eea36f45705f540f9324e478b05cb916409303d75c9831622643adaade346134cd22665361989624c
7
+ data.tar.gz: 2cdbadcbf36cc61e04964b76581c41ccf76ca44aa72cf9241b18e73be115f2b183ef863ec32794fd71039fa264404bb56e5eb90d57c5fc243a8caf5f0df98d0f
data/.DS_Store CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scale.rb (0.2.7)
4
+ scale.rb (0.2.13)
5
5
  activesupport (>= 4.0.0)
6
6
  json (~> 2.3.0)
7
7
  substrate_common.rb (~> 0.1.9)
@@ -50,10 +50,10 @@ GEM
50
50
  xxhash
51
51
  thor (0.19.4)
52
52
  thread_safe (0.3.6)
53
- tzinfo (1.2.7)
53
+ tzinfo (1.2.8)
54
54
  thread_safe (~> 0.1)
55
55
  xxhash (0.4.0)
56
- zeitwerk (2.4.0)
56
+ zeitwerk (2.4.1)
57
57
 
58
58
  PLATFORMS
59
59
  ruby
data/README.md CHANGED
@@ -10,7 +10,7 @@ This is a SCALE codec library implemented in ruby language for general use. It c
10
10
 
11
11
  This work is the prerequisite of our subsequent series of projects. We hope to familiarize and quickly access Polkadot and Substrate through ruby. We plan to develop the back end of our applications in ruby language, and then interact with nodes or synchronize data through this library.
12
12
 
13
- Please refer to the [official doc](https://substrate.dev/docs/en/overview/low-level-data-format) for more details about SCALE low-level data format.
13
+ Please refer to the [official doc](https://substrate.dev/docs/en/knowledgebase/advanced/codec) for more details about SCALE low-level data format.
14
14
 
15
15
  Because the feature of ruby 2.6 is used, the ruby version is required to be >= 2.6. it will be compatible with older ruby versions when released.
16
16
 
@@ -6,7 +6,7 @@ module Scale
6
6
  def self.decode(scale_bytes)
7
7
  bytes = scale_bytes.get_next_bytes(4)
8
8
  if bytes.bytes_to_utf8 == "meta"
9
- metadata_version = Scale::Types.type_of("Enum", %w[MetadataV0 MetadataV1 MetadataV2 MetadataV3 MetadataV4 MetadataV5 MetadataV6 MetadataV7 MetadataV8 MetadataV9 MetadataV10 MetadataV11]).decode(scale_bytes).value
9
+ metadata_version = Scale::Types.type_of("Enum", %w[MetadataV0 MetadataV1 MetadataV2 MetadataV3 MetadataV4 MetadataV5 MetadataV6 MetadataV7 MetadataV8 MetadataV9 MetadataV10 MetadataV11 MetadataV12]).decode(scale_bytes).value
10
10
  metadata = Metadata.new "Scale::Types::#{metadata_version}".constantize.decode(scale_bytes)
11
11
  metadata.version = metadata_version[9..].to_i
12
12
  else
@@ -0,0 +1,85 @@
1
+ module Scale
2
+ module Types
3
+ class MetadataV12
4
+ include SingleValue
5
+ attr_accessor :call_index, :event_index
6
+
7
+ def initialize(value)
8
+ @call_index = {}
9
+ @event_index = {}
10
+ super(value)
11
+ end
12
+
13
+ def self.decode(scale_bytes)
14
+ modules = Scale::Types.type_of("Vec<MetadataV12Module>").decode(scale_bytes).value
15
+
16
+ value = {
17
+ magicNumber: 1_635_018_093,
18
+ metadata: {
19
+ version: 12,
20
+ modules: modules.map(&:value)
21
+ }
22
+ }
23
+
24
+ result = MetadataV12.new(value)
25
+
26
+ call_module_index = 0
27
+ event_module_index = 0
28
+
29
+ modules.map(&:value).each_with_index do |m, module_index|
30
+ if m[:calls]
31
+ m[:calls].each_with_index do |call, index|
32
+ call[:lookup] = "%02x%02x" % [module_index, index]
33
+ result.call_index[call[:lookup]] = [m, call]
34
+ end
35
+ end
36
+
37
+ if m[:events]
38
+ m[:events].each_with_index do |event, index|
39
+ event[:lookup] = "%02x%02x" % [module_index, index]
40
+ result.event_index[event[:lookup]] = [m, event]
41
+ end
42
+ end
43
+ end
44
+
45
+ result
46
+ end
47
+ end
48
+
49
+ class MetadataV12Module
50
+ include SingleValue
51
+ def self.decode(scale_bytes)
52
+ name = String.decode(scale_bytes).value
53
+
54
+ result = {
55
+ name: name
56
+ }
57
+
58
+ has_storage = Bool.decode(scale_bytes).value
59
+ if has_storage
60
+ storage = MetadataV7ModuleStorage.decode(scale_bytes).value
61
+ result[:storage] = storage
62
+ result[:prefix] = storage[:prefix]
63
+ end
64
+
65
+ has_calls = Bool.decode(scale_bytes).value
66
+ if has_calls
67
+ calls = Scale::Types.type_of("Vec<MetadataModuleCall>").decode(scale_bytes).value
68
+ result[:calls] = calls.map(&:value)
69
+ end
70
+
71
+ has_events = Bool.decode(scale_bytes).value
72
+ if has_events
73
+ events = Scale::Types.type_of("Vec<MetadataModuleEvent>").decode(scale_bytes).value
74
+ result[:events] = events.map(&:value)
75
+ end
76
+
77
+ result[:constants] = Scale::Types.type_of("Vec<MetadataV7ModuleConstants>").decode(scale_bytes).value.map(&:value)
78
+ result[:errors] = Scale::Types.type_of("Vec<MetadataModuleError>").decode(scale_bytes).value.map(&:value)
79
+
80
+ result[:index] = U8.decode(scale_bytes).value
81
+ MetadataV12Module.new(result)
82
+ end
83
+ end
84
+ end
85
+ end
@@ -9,6 +9,7 @@ require "singleton"
9
9
  require "scale/base"
10
10
  require "scale/types"
11
11
  require "scale/block"
12
+ require "scale/trie"
12
13
 
13
14
  require "metadata/metadata"
14
15
  require "metadata/metadata_v0"
@@ -23,6 +24,7 @@ require "metadata/metadata_v8"
23
24
  require "metadata/metadata_v9"
24
25
  require "metadata/metadata_v10"
25
26
  require "metadata/metadata_v11"
27
+ require "metadata/metadata_v12"
26
28
 
27
29
  module Scale
28
30
  class Error < StandardError; end
@@ -91,14 +93,11 @@ module Scale
91
93
  end
92
94
 
93
95
  def type_traverse(type, types)
96
+ type = rename(type) if type.class == ::String
94
97
  if types.has_key?(type) && types[type] != type
95
98
  type_traverse(types[type], types)
96
99
  else
97
- if type.class == ::String
98
- rename(type)
99
- else
100
- type
101
- end
100
+ type
102
101
  end
103
102
  end
104
103
  end
@@ -0,0 +1,121 @@
1
+ module Scale
2
+ module Types
3
+
4
+ class TrieNode
5
+ include SingleValue
6
+ EMPTY = 0
7
+ NIBBLE_PER_BYTE = 2
8
+ BITMAP_LENGTH = 2
9
+ NIBBLE_LENGTH = 16
10
+ NIBBLE_SIZE_BOUND = 65535
11
+
12
+ def self.decode(scale_bytes)
13
+ first = scale_bytes.get_next_bytes(1).first
14
+ if first == EMPTY
15
+ TrieNode.new({})
16
+ else
17
+ v = first & (0b11 << 6)
18
+ decode_size = -> {
19
+ result = first & 255 >> 2
20
+ return result if result < 63
21
+ result -= 1
22
+ while result <= NIBBLE_SIZE_BOUND
23
+ n = scale_bytes.get_next_bytes(1).first
24
+ return (result + n + 1) if n < 255
25
+ result += 255
26
+ end
27
+ return NIBBLE_SIZE_BOUND
28
+ }
29
+
30
+ if v == 0b01 << 6 # leaf
31
+ nibble_count = decode_size.call
32
+ # if nibble_count is odd, the half of first byte of partial is 0
33
+ padding = (nibble_count % NIBBLE_PER_BYTE) != 0
34
+ first_byte_of_partial = scale_bytes.bytes[scale_bytes.offset]
35
+ if padding && (first_byte_of_partial & 0xf0) != 0
36
+ raise "bad format"
37
+ end
38
+
39
+ ### partial decoding
40
+ partial_bytes = scale_bytes.get_next_bytes((nibble_count + (NIBBLE_PER_BYTE - 1)) / NIBBLE_PER_BYTE)
41
+
42
+ ### value
43
+ count = Compact.decode(scale_bytes).value
44
+ value_bytes = scale_bytes.get_next_bytes(count)
45
+
46
+ return TrieNode.new({
47
+ node_type: "leaf",
48
+ partial: {
49
+ hex: partial_bytes.bytes_to_hex,
50
+ padding: padding
51
+ },
52
+ value: value_bytes.bytes_to_hex
53
+ })
54
+ elsif v == 0b10 << 6 || v == 0b11 << 6 # branch without mask || branch with mask
55
+ nibble_count = decode_size.call
56
+
57
+ ### check that the padding is valid (if any)
58
+ # if nibble_count is odd, the half of first byte of partial is 0
59
+ padding = nibble_count % NIBBLE_PER_BYTE != 0
60
+ first_byte_of_partial = scale_bytes.bytes[scale_bytes.offset]
61
+ if padding && (first_byte_of_partial & 0xf0) != 0
62
+ raise "bad format"
63
+ end
64
+
65
+ ### partial decoding
66
+ partial_bytes = scale_bytes.get_next_bytes((nibble_count + (NIBBLE_PER_BYTE - 1)) / NIBBLE_PER_BYTE)
67
+
68
+ ### value decoding
69
+ if v == 0b11 << 6 # has value
70
+ count = Compact.decode(scale_bytes).value
71
+ value_bytes = scale_bytes.get_next_bytes(count)
72
+ end
73
+
74
+ ### children decoding
75
+ children = []
76
+ bitmap = U16.decode(scale_bytes).value
77
+ NIBBLE_LENGTH.times do |i|
78
+ has_child = (bitmap & (1 << i)) != 0
79
+ children[i] = nil
80
+ if has_child
81
+ count = Compact.decode(scale_bytes).value
82
+ if count == 32
83
+ hash = H256.decode(scale_bytes).value
84
+ children[i] = hash
85
+ else
86
+ inline = scale_bytes.get_next_bytes count
87
+ children[i] = inline.bytes_to_hex
88
+ end
89
+ end
90
+ end
91
+ # debug
92
+ # children.each_with_index do |child, i|
93
+ # if child.nil?
94
+ # puts "#{i}: NULL"
95
+ # else
96
+ # puts "#{i}: #{child}"
97
+ # end
98
+ # end
99
+
100
+ result = TrieNode.new({
101
+ node_type: "branch",
102
+ partial: {
103
+ hex: partial_bytes.bytes_to_hex,
104
+ padding: padding
105
+ },
106
+ children: children
107
+ })
108
+
109
+ result[:value] = value_bytes.bytes_to_hex if value_bytes
110
+
111
+ return result
112
+ else
113
+ puts "Not support"
114
+ end
115
+
116
+ end
117
+ end
118
+ end
119
+
120
+ end
121
+ end
@@ -225,59 +225,71 @@ module Scale
225
225
  end
226
226
  end
227
227
 
228
- class Address
228
+ class GenericAddress
229
229
  include SingleValue
230
- attr_accessor :account_length, :account_index, :account_id, :account_idx
231
230
 
231
+ # https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58)
232
+ # base58encode ( concat ( <address-type>, <address>, <checksum> ) )
233
+ # ^^^^^^^^^
234
+ # the <address> is 32 byte account id or 1, 2, 4, 8 byte account index
235
+ # scale_bytes: account length byte + <address>'s bytes
232
236
  def self.decode(scale_bytes)
233
237
  account_length = scale_bytes.get_next_bytes(1).first
234
238
 
235
- if account_length == 0xff # 255
239
+ if account_length == 0xff # 32 bytes address(Public key)
236
240
  account_id = scale_bytes.get_next_bytes(32).bytes_to_hex
237
- account_length = account_length.to_s(16)
238
- Address.new(account_id)
241
+ account_length = [account_length].bytes_to_hex
242
+
243
+ Address.new({
244
+ account_id: account_id,
245
+ account_length: account_length
246
+ })
239
247
  else
240
248
  account_index =
241
- if account_length == 0xfc
249
+ if account_length == 0xfc # 2 bytes address(account index)
242
250
  scale_bytes.get_next_bytes(2).bytes_to_hex
243
- elsif account_length == 0xfd
251
+ elsif account_length == 0xfd # 4 bytes address(account index)
244
252
  scale_bytes.get_next_bytes(4).bytes_to_hex
245
- elsif account_length == 0xfe
253
+ elsif account_length == 0xfe # 8 bytes address(account index)
246
254
  scale_bytes.get_next_bytes(8).bytes_to_hex
247
255
  else
248
256
  [account_length].bytes_to_hex
249
257
  end
250
- # account_idx =
251
- account_length = account_length.to_s(16)
252
- Address.new(account_index)
258
+ # TODO: add account_idx
259
+ account_length = [account_length].bytes_to_hex
260
+
261
+ Address.new({
262
+ account_index: account_index,
263
+ account_length: account_length
264
+ })
253
265
  end
254
266
  end
255
267
 
256
- def encode(ss58=false, addr_type=42)
257
- if value.start_with?("0x")
258
- if ss58 === true
259
- ::Address.encode(value, addr_type)
260
- else
261
- prefix = if value.length == 66
262
- "ff"
263
- elsif value.length == 6
264
- "fc"
265
- elsif value.length == 10
266
- "fd"
267
- elsif value.length == 18
268
- "fe"
269
- else
270
- ""
271
- end
272
- "#{prefix}#{value[2..]}"
273
- end
268
+ def encode
269
+ if self.value[:account_id]
270
+ "#{self.value[:account_length][2..]}#{self.value[:account_id][2..]}"
274
271
  else
275
- raise "Format error"
272
+ "#{self.value[:account_length][2..]}#{self.value[:account_index][2..]}"
276
273
  end
277
274
  end
278
275
  end
279
276
 
280
- class RawAddress < Address; end
277
+ class Address < GenericAddress; end
278
+
279
+ class RawAddress < GenericAddress; end
280
+
281
+ class AccountIdAddress < GenericAddress
282
+ def self.decode(scale_bytes)
283
+ AccountIdAddress.new({
284
+ account_id: AccountId.decode(scale_bytes).value,
285
+ account_length: "0xff"
286
+ })
287
+ end
288
+
289
+ def encode
290
+ "ff#{self.value[:account_id][2..]}"
291
+ end
292
+ end
281
293
 
282
294
  class AccountId < H256; end
283
295
 
@@ -1,3 +1,3 @@
1
1
  module Scale
2
- VERSION = "0.2.7".freeze
2
+ VERSION = "0.2.13".freeze
3
3
  end
@@ -0,0 +1,662 @@
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
+ ]
43
+ },
44
+ "StakingLock": {
45
+ "type": "struct",
46
+ "type_mapping": [
47
+ [
48
+ "staking_amount",
49
+ "Balance"
50
+ ],
51
+ [
52
+ "unbondings",
53
+ "Vec<Unbonding>"
54
+ ]
55
+ ]
56
+ },
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
+ ]
73
+ },
74
+ "Unbonding": {
75
+ "type": "struct",
76
+ "type_mapping": [
77
+ [
78
+ "amount",
79
+ "Balance"
80
+ ],
81
+ [
82
+ "until",
83
+ "BlockNumber"
84
+ ]
85
+ ]
86
+ },
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
+ ]
107
+ },
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
+ ]
125
+ },
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
+ [
146
+ "deposit_items",
147
+ "Vec<TimeDepositItem>"
148
+ ],
149
+ [
150
+ "ring_staking_lock",
151
+ "StakingLock"
152
+ ],
153
+ [
154
+ "kton_staking_lock",
155
+ "StakingLock"
156
+ ],
157
+ [
158
+ "claimed_rewards",
159
+ "Vec<EraIndex>"
160
+ ]
161
+ ]
162
+ },
163
+ "TimeDepositItem": {
164
+ "type": "struct",
165
+ "type_mapping": [
166
+ [
167
+ "value",
168
+ "Compact<Balance>"
169
+ ],
170
+ [
171
+ "start_time",
172
+ "Compact<TsInMs>"
173
+ ],
174
+ [
175
+ "expire_time",
176
+ "Compact<TsInMs>"
177
+ ]
178
+ ]
179
+ },
180
+ "ExposureT": {
181
+ "type": "struct",
182
+ "type_mapping": [
183
+ [
184
+ "own_ring_balance",
185
+ "Compact<Balance>"
186
+ ],
187
+ [
188
+ "own_kton_balance",
189
+ "Compact<Balance>"
190
+ ],
191
+ [
192
+ "own_power",
193
+ "Power"
194
+ ],
195
+ [
196
+ "total_power",
197
+ "Power"
198
+ ],
199
+ [
200
+ "others",
201
+ "Vec<IndividualExposure>"
202
+ ]
203
+ ]
204
+ },
205
+ "IndividualExposure": {
206
+ "type": "struct",
207
+ "type_mapping": [
208
+ [
209
+ "who",
210
+ "AccountId"
211
+ ],
212
+ [
213
+ "ring_balance",
214
+ "Compact<Balance>"
215
+ ],
216
+ [
217
+ "kton_balance",
218
+ "Compact<Balance>"
219
+ ],
220
+ [
221
+ "power",
222
+ "Power"
223
+ ]
224
+ ]
225
+ },
226
+ "ElectionResultT": {
227
+ "type": "struct",
228
+ "type_mapping": [
229
+ [
230
+ "elected_stashes",
231
+ "Vec<AccountId>"
232
+ ],
233
+ [
234
+ "exposures",
235
+ "Vec<(AccountId, ExposureT)>"
236
+ ],
237
+ [
238
+ "compute",
239
+ "ElectionCompute"
240
+ ]
241
+ ]
242
+ },
243
+ "RKT": {
244
+ "type": "struct",
245
+ "type_mapping": [
246
+ [
247
+ "r",
248
+ "Balance"
249
+ ],
250
+ [
251
+ "k",
252
+ "Balance"
253
+ ]
254
+ ]
255
+ },
256
+ "SpanRecord": {
257
+ "type": "struct",
258
+ "type_mapping": [
259
+ [
260
+ "slashed",
261
+ "RKT"
262
+ ],
263
+ [
264
+ "paid_out",
265
+ "RKT"
266
+ ]
267
+ ]
268
+ },
269
+ "UnappliedSlash": {
270
+ "type": "struct",
271
+ "type_mapping": [
272
+ [
273
+ "validator",
274
+ "AccountId"
275
+ ],
276
+ [
277
+ "own",
278
+ "RKT"
279
+ ],
280
+ [
281
+ "others",
282
+ "Vec<(AccountId, RKT)>"
283
+ ],
284
+ [
285
+ "reporters",
286
+ "Vec<AccountId>"
287
+ ],
288
+ [
289
+ "payout",
290
+ "RKT"
291
+ ]
292
+ ]
293
+ },
294
+ "TreasuryProposal": {
295
+ "type": "struct",
296
+ "type_mapping": [
297
+ [
298
+ "proposer",
299
+ "AccountId"
300
+ ],
301
+ [
302
+ "beneficiary",
303
+ "AccountId"
304
+ ],
305
+ [
306
+ "ring_value",
307
+ "Balance"
308
+ ],
309
+ [
310
+ "kton_value",
311
+ "Balance"
312
+ ],
313
+ [
314
+ "ring_bond",
315
+ "Balance"
316
+ ],
317
+ [
318
+ "kton_bond",
319
+ "Balance"
320
+ ]
321
+ ]
322
+ },
323
+ "MappedRing": "u128",
324
+ "EthereumTransactionIndex": "(H256, u64)",
325
+ "EthereumBlockNumber": "u64",
326
+ "EthereumHeader": {
327
+ "type": "struct",
328
+ "type_mapping": [
329
+ [
330
+ "parent_hash",
331
+ "H256"
332
+ ],
333
+ [
334
+ "timestamp",
335
+ "u64"
336
+ ],
337
+ [
338
+ "number",
339
+ "EthereumBlockNumber"
340
+ ],
341
+ [
342
+ "author",
343
+ "EthereumAddress"
344
+ ],
345
+ [
346
+ "transactions_root",
347
+ "H256"
348
+ ],
349
+ [
350
+ "uncles_hash",
351
+ "H256"
352
+ ],
353
+ [
354
+ "extra_data",
355
+ "Bytes"
356
+ ],
357
+ [
358
+ "state_root",
359
+ "H256"
360
+ ],
361
+ [
362
+ "receipts_root",
363
+ "H256"
364
+ ],
365
+ [
366
+ "log_bloom",
367
+ "Bloom"
368
+ ],
369
+ [
370
+ "gas_used",
371
+ "U256"
372
+ ],
373
+ [
374
+ "gas_limit",
375
+ "U256"
376
+ ],
377
+ [
378
+ "difficulty",
379
+ "U256"
380
+ ],
381
+ [
382
+ "seal",
383
+ "Vec<Bytes>"
384
+ ],
385
+ [
386
+ "hash",
387
+ "Option<H256>"
388
+ ]
389
+ ]
390
+ },
391
+ "EthereumAddress": "H160",
392
+ "Bloom": "[u8; 256]",
393
+ "H128": "[u8; 16]",
394
+ "EthashProof": {
395
+ "type": "struct",
396
+ "type_mapping": [
397
+ [
398
+ "dag_nodes",
399
+ "(H512, H512)"
400
+ ],
401
+ [
402
+ "proof",
403
+ "Vec<H128>"
404
+ ]
405
+ ]
406
+ },
407
+ "EthereumReceipt": {
408
+ "type": "struct",
409
+ "type_mapping": [
410
+ [
411
+ "gas_used",
412
+ "U256"
413
+ ],
414
+ [
415
+ "log_bloom",
416
+ "Bloom"
417
+ ],
418
+ [
419
+ "logs",
420
+ "Vec<LogEntry>"
421
+ ],
422
+ [
423
+ "outcome",
424
+ "TransactionOutcome"
425
+ ]
426
+ ]
427
+ },
428
+ "EthereumNetworkType": {
429
+ "type": "enum",
430
+ "type_mapping": [
431
+ [
432
+ "Mainnet",
433
+ "Null"
434
+ ],
435
+ [
436
+ "Ropsten",
437
+ "Null"
438
+ ]
439
+ ]
440
+ },
441
+ "RedeemFor": {
442
+ "type": "enum",
443
+ "type_mapping": [
444
+ [
445
+ "Token",
446
+ "Null"
447
+ ],
448
+ [
449
+ "Deposit",
450
+ "Null"
451
+ ]
452
+ ]
453
+ },
454
+ "EthereumReceiptProof": {
455
+ "type": "struct",
456
+ "type_mapping": [
457
+ [
458
+ "index",
459
+ "u64"
460
+ ],
461
+ [
462
+ "proof",
463
+ "Bytes"
464
+ ],
465
+ [
466
+ "header_hash",
467
+ "H256"
468
+ ]
469
+ ]
470
+ },
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
+ "EthereumRelayHeaderParcel": {
490
+ "type": "struct",
491
+ "type_mapping": [
492
+ [
493
+ "header",
494
+ "EthereumHeader"
495
+ ],
496
+ [
497
+ "mmr_root",
498
+ "H256"
499
+ ]
500
+ ]
501
+ },
502
+ "EthereumRelayProofs": {
503
+ "type": "struct",
504
+ "type_mapping": [
505
+ [
506
+ "ethash_proof",
507
+ "Vec<EthashProof>"
508
+ ],
509
+ [
510
+ "mmr_proof",
511
+ "Vec<H256>"
512
+ ]
513
+ ]
514
+ },
515
+ "OtherSignature": {
516
+ "type": "enum",
517
+ "type_mapping": [
518
+ [
519
+ "Eth",
520
+ "EcdsaSignature"
521
+ ],
522
+ [
523
+ "Tron",
524
+ "EcdsaSignature"
525
+ ]
526
+ ]
527
+ },
528
+ "EcdsaSignature": "[u8; 65]",
529
+ "OtherAddress": {
530
+ "type": "enum",
531
+ "type_mapping": [
532
+ [
533
+ "Eth",
534
+ "[u8; 20]"
535
+ ],
536
+ [
537
+ "Tron",
538
+ "[u8; 20]"
539
+ ]
540
+ ]
541
+ },
542
+ "AddressT": "[u8; 20]",
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
+ "RelayHeaderId": "EthereumBlockNumber",
557
+ "RelayHeaderParcel": "EthereumRelayHeaderParcel",
558
+ "RelayProofs": "EthereumRelayProofs",
559
+ "RelayAffirmationId": {
560
+ "type": "struct",
561
+ "type_mapping": [
562
+ [
563
+ "game_id",
564
+ "EthereumBlockNumber"
565
+ ],
566
+ [
567
+ "round",
568
+ "u32"
569
+ ],
570
+ [
571
+ "index",
572
+ "u32"
573
+ ]
574
+ ]
575
+ },
576
+ "RelayAffirmationT": {
577
+ "type": "struct",
578
+ "type_mapping": [
579
+ [
580
+ "relayer",
581
+ "AccountId"
582
+ ],
583
+ [
584
+ "relay_header_parcels",
585
+ "EthereumRelayHeaderParcel"
586
+ ],
587
+ [
588
+ "bond",
589
+ "Balance"
590
+ ],
591
+ [
592
+ "maybe_extended_relay_affirmation_id",
593
+ "Option<RelayAffirmationId>"
594
+ ],
595
+ [
596
+ "verified",
597
+ "bool"
598
+ ]
599
+ ]
600
+ },
601
+ "RelayVotingState": {
602
+ "type": "struct",
603
+ "type_mapping": [
604
+ [
605
+ "ayes",
606
+ "Vec<AccountId>"
607
+ ],
608
+ [
609
+ "nays",
610
+ "Vec<AccountId>"
611
+ ]
612
+ ]
613
+ },
614
+ "ProxyType": {
615
+ "type": "enum",
616
+ "type_mapping": [
617
+ [
618
+ "Any",
619
+ "Null"
620
+ ],
621
+ [
622
+ "NonTransfer",
623
+ "Null"
624
+ ],
625
+ [
626
+ "Governance",
627
+ "Null"
628
+ ],
629
+ [
630
+ "Staking",
631
+ "Null"
632
+ ],
633
+ [
634
+ "IdentityJudgement",
635
+ "Null"
636
+ ],
637
+ [
638
+ "EthereumBridge",
639
+ "Null"
640
+ ]
641
+ ]
642
+ },
643
+ "BalancesRuntimeDispatchInfo": {
644
+ "type": "struct",
645
+ "type_mapping": [
646
+ [
647
+ "usable_balance",
648
+ "Balance"
649
+ ]
650
+ ]
651
+ },
652
+ "StakingRuntimeDispatchInfo": {
653
+ "type": "struct",
654
+ "type_mapping": [
655
+ [
656
+ "power",
657
+ "Power"
658
+ ]
659
+ ]
660
+ }
661
+ }
662
+ }