scale.rb 0.2.6 → 0.2.12
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.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +5 -5
- data/README.md +1 -1
- data/lib/metadata/metadata.rb +1 -1
- data/lib/metadata/metadata_v12.rb +87 -0
- data/lib/scale.rb +4 -6
- data/lib/scale/types.rb +43 -31
- data/lib/scale/version.rb +1 -1
- data/lib/type_registry/darwinia.json +246 -65
- data/lib/type_registry/default.json +0 -1
- data/scale.gemspec +1 -1
- metadata +5 -5
- data/lib/type_registry/certifybook-chain.json +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcfbe30b0f6a51793d9e977e362c34b213e04ee040f7d6961cde355b1e6cb8d0
|
4
|
+
data.tar.gz: 310f9fcab5186b0366e4a12da5790f77bfe81aa148684d1946d3a7f07ef57c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14545046f43e403d84a492905b9aa9928024b0310aa2ae8dca927dd98e9d0b4415dcffa5a3364e85af2e13ef1ef4808fdb704462c8687fcb30336fa631a2ca9f
|
7
|
+
data.tar.gz: 23224a2ff2578fb4c49a12bc1317ae645fb5a2237f4f8f9f312585a53b849abd78ca455c86c68f9f6c2f22c3e6dd837638e6644245c66e25674b701e39de08e5
|
data/.DS_Store
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
scale.rb (0.2.
|
4
|
+
scale.rb (0.2.12)
|
5
5
|
activesupport (>= 4.0.0)
|
6
6
|
json (~> 2.3.0)
|
7
|
-
substrate_common.rb (~> 0.1.
|
7
|
+
substrate_common.rb (~> 0.1.9)
|
8
8
|
thor (~> 0.19.0)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (6.0.3.
|
13
|
+
activesupport (6.0.3.4)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 0.7, < 2)
|
16
16
|
minitest (~> 5.1)
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
45
|
rspec-support (~> 3.9.0)
|
46
46
|
rspec-support (3.9.0)
|
47
|
-
substrate_common.rb (0.1.
|
47
|
+
substrate_common.rb (0.1.9)
|
48
48
|
base58
|
49
49
|
blake2b
|
50
50
|
xxhash
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
tzinfo (1.2.7)
|
54
54
|
thread_safe (~> 0.1)
|
55
55
|
xxhash (0.4.0)
|
56
|
-
zeitwerk (2.
|
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/
|
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
|
|
data/lib/metadata/metadata.rb
CHANGED
@@ -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,87 @@
|
|
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 do |m|
|
30
|
+
if m[:calls]
|
31
|
+
m[:calls].each_with_index do |call, index|
|
32
|
+
call[:lookup] = "%02x%02x" % [call_module_index, index]
|
33
|
+
result.call_index[call[:lookup]] = [m, call]
|
34
|
+
end
|
35
|
+
call_module_index += 1
|
36
|
+
end
|
37
|
+
|
38
|
+
if m[:events]
|
39
|
+
m[:events].each_with_index do |event, index|
|
40
|
+
event[:lookup] = "%02x%02x" % [event_module_index, index]
|
41
|
+
result.event_index[event[:lookup]] = [m, event]
|
42
|
+
end
|
43
|
+
event_module_index += 1
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
result
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class MetadataV12Module
|
52
|
+
include SingleValue
|
53
|
+
def self.decode(scale_bytes)
|
54
|
+
name = String.decode(scale_bytes).value
|
55
|
+
|
56
|
+
result = {
|
57
|
+
name: name
|
58
|
+
}
|
59
|
+
|
60
|
+
has_storage = Bool.decode(scale_bytes).value
|
61
|
+
if has_storage
|
62
|
+
storage = MetadataV7ModuleStorage.decode(scale_bytes).value
|
63
|
+
result[:storage] = storage
|
64
|
+
result[:prefix] = storage[:prefix]
|
65
|
+
end
|
66
|
+
|
67
|
+
has_calls = Bool.decode(scale_bytes).value
|
68
|
+
if has_calls
|
69
|
+
calls = Scale::Types.type_of("Vec<MetadataModuleCall>").decode(scale_bytes).value
|
70
|
+
result[:calls] = calls.map(&:value)
|
71
|
+
end
|
72
|
+
|
73
|
+
has_events = Bool.decode(scale_bytes).value
|
74
|
+
if has_events
|
75
|
+
events = Scale::Types.type_of("Vec<MetadataModuleEvent>").decode(scale_bytes).value
|
76
|
+
result[:events] = events.map(&:value)
|
77
|
+
end
|
78
|
+
|
79
|
+
result[:constants] = Scale::Types.type_of("Vec<MetadataV7ModuleConstants>").decode(scale_bytes).value.map(&:value)
|
80
|
+
result[:errors] = Scale::Types.type_of("Vec<MetadataModuleError>").decode(scale_bytes).value.map(&:value)
|
81
|
+
|
82
|
+
result[:index] = U8.decode(scale_bytes).value
|
83
|
+
MetadataV12Module.new(result)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/lib/scale.rb
CHANGED
@@ -23,6 +23,7 @@ require "metadata/metadata_v8"
|
|
23
23
|
require "metadata/metadata_v9"
|
24
24
|
require "metadata/metadata_v10"
|
25
25
|
require "metadata/metadata_v11"
|
26
|
+
require "metadata/metadata_v12"
|
26
27
|
|
27
28
|
module Scale
|
28
29
|
class Error < StandardError; end
|
@@ -91,14 +92,11 @@ module Scale
|
|
91
92
|
end
|
92
93
|
|
93
94
|
def type_traverse(type, types)
|
94
|
-
|
95
|
+
type = rename(type) if type.class == ::String
|
96
|
+
if types.has_key?(type) && types[type] != type
|
95
97
|
type_traverse(types[type], types)
|
96
98
|
else
|
97
|
-
|
98
|
-
rename(type)
|
99
|
-
else
|
100
|
-
type
|
101
|
-
end
|
99
|
+
type
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
data/lib/scale/types.rb
CHANGED
@@ -225,59 +225,71 @@ module Scale
|
|
225
225
|
end
|
226
226
|
end
|
227
227
|
|
228
|
-
class
|
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 #
|
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.
|
238
|
-
|
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.
|
252
|
-
|
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
|
257
|
-
if value
|
258
|
-
|
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
|
-
|
272
|
+
"#{self.value[:account_length][2..]}#{self.value[:account_index][2..]}"
|
276
273
|
end
|
277
274
|
end
|
278
275
|
end
|
279
276
|
|
280
|
-
class
|
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
|
|
data/lib/scale/version.rb
CHANGED
@@ -1,119 +1,300 @@
|
|
1
1
|
{
|
2
2
|
"types": {
|
3
|
-
"
|
4
|
-
"
|
5
|
-
"
|
6
|
-
"RingBalanceOf": "u128",
|
7
|
-
"KtonBalanceOf": "u128",
|
8
|
-
"ExtendedBalance": "u128",
|
9
|
-
"Keys": {
|
3
|
+
"Address": "AccountId",
|
4
|
+
"LookupSource": "AccountId",
|
5
|
+
"BalanceLock": {
|
10
6
|
"type": "struct",
|
11
7
|
"type_mapping": [
|
12
|
-
|
13
|
-
|
8
|
+
["id", "LockIdentifier"],
|
9
|
+
["lock_for", "LockFor"],
|
10
|
+
["lock_reasons", "LockReasons"]
|
14
11
|
]
|
15
12
|
},
|
16
|
-
"
|
17
|
-
"StakingBalance": {
|
13
|
+
"LockFor": {
|
18
14
|
"type": "enum",
|
19
15
|
"type_mapping": [
|
20
|
-
|
21
|
-
|
16
|
+
["Common", "Common"],
|
17
|
+
["Staking", "StakingLock"]
|
18
|
+
]
|
19
|
+
},
|
20
|
+
"Common": {
|
21
|
+
"type": "struct",
|
22
|
+
"type_mapping": [
|
23
|
+
["amount", "Balance"]
|
24
|
+
]
|
25
|
+
},
|
26
|
+
"StakingLock": {
|
27
|
+
"type": "struct",
|
28
|
+
"type_mapping": [
|
29
|
+
["staking_amount", "Balance"],
|
30
|
+
["unbondings", "Vec<Unbonding>"]
|
31
|
+
]
|
32
|
+
},
|
33
|
+
"LockReasons": {
|
34
|
+
"type": "enum",
|
35
|
+
"type_mapping": [
|
36
|
+
["Fee", "Null"],
|
37
|
+
["Misc", "Null"],
|
38
|
+
["All", "Null"]
|
39
|
+
]
|
40
|
+
},
|
41
|
+
"Unbonding": {
|
42
|
+
"type": "struct",
|
43
|
+
"type_mapping": [
|
44
|
+
["amount", "Balance"],
|
45
|
+
["until", "BlockNumber"]
|
46
|
+
]
|
47
|
+
},
|
48
|
+
"AccountData": {
|
49
|
+
"type": "struct",
|
50
|
+
"type_mapping": [
|
51
|
+
["free", "Balance"],
|
52
|
+
["reserved", "Balance"],
|
53
|
+
["free_kton", "Balance"],
|
54
|
+
["reserved_kton", "Balance"]
|
55
|
+
]
|
56
|
+
},
|
57
|
+
"RingBalance": "Balance",
|
58
|
+
"KtonBalance": "Balance",
|
59
|
+
"TsInMs": "u64",
|
60
|
+
"Power": "u32",
|
61
|
+
"DepositId": "U256",
|
62
|
+
"StakingBalanceT": {
|
63
|
+
"type": "enum",
|
64
|
+
"type_mapping": [
|
65
|
+
["RingBalance", "Balance"],
|
66
|
+
["KtonBalance", "Balance"]
|
67
|
+
]
|
68
|
+
},
|
69
|
+
"StakingLedgerT": {
|
70
|
+
"type": "struct",
|
71
|
+
"type_mapping": [
|
72
|
+
["stash", "AccountId"],
|
73
|
+
["active_ring", "Compact<Balance>"],
|
74
|
+
["active_deposit_ring", "Compact<Balance>"],
|
75
|
+
["active_kton", "Compact<Balance>"],
|
76
|
+
["deposit_items", "Vec<TimeDepositItem>"],
|
77
|
+
["ring_staking_lock", "StakingLock"],
|
78
|
+
["kton_staking_lock", "StakingLock"],
|
79
|
+
["claimed_rewards", "Vec<EraIndex>"]
|
22
80
|
]
|
23
81
|
},
|
24
82
|
"TimeDepositItem": {
|
25
83
|
"type": "struct",
|
26
84
|
"type_mapping": [
|
27
|
-
|
28
|
-
|
29
|
-
|
85
|
+
["value", "Compact<Balance>"],
|
86
|
+
["start_time", "Compact<TsInMs>"],
|
87
|
+
["expire_time", "Compact<TsInMs>"]
|
88
|
+
]
|
89
|
+
},
|
90
|
+
"ExposureT": {
|
91
|
+
"type": "struct",
|
92
|
+
"type_mapping": [
|
93
|
+
["own_ring_balance", "Compact<Balance>"],
|
94
|
+
["own_kton_balance", "Compact<Balance>"],
|
95
|
+
["own_power", "Power"],
|
96
|
+
["total_power", "Power"],
|
97
|
+
["others", "Vec<IndividualExposure>"]
|
30
98
|
]
|
31
99
|
},
|
32
|
-
"
|
100
|
+
"IndividualExposure": {
|
33
101
|
"type": "struct",
|
34
102
|
"type_mapping": [
|
35
|
-
|
36
|
-
|
37
|
-
|
103
|
+
["who", "AccountId"],
|
104
|
+
["ring_balance", "Compact<Balance>"],
|
105
|
+
["kton_balance", "Compact<Balance>"],
|
106
|
+
["power", "Power"]
|
38
107
|
]
|
39
108
|
},
|
40
|
-
"
|
109
|
+
"ElectionResultT": {
|
41
110
|
"type": "struct",
|
42
111
|
"type_mapping": [
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
["active_ring", "Compact<RingBalanceOf>"],
|
47
|
-
["active_deposit_ring", "Compact<RingBalanceOf>"],
|
48
|
-
["total_kton", "Compact<KtonBalanceOf>"],
|
49
|
-
["active_kton", "Compact<KtonBalanceOf>"],
|
50
|
-
["deposit_items", "Vec<TimeDepositItem>"],
|
51
|
-
["unlocking", "Vec<UnlockChunk>"]
|
112
|
+
["elected_stashes", "Vec<AccountId>"],
|
113
|
+
["exposures", "Vec<(AccountId, ExposureT)>"],
|
114
|
+
["compute", "ElectionCompute"]
|
52
115
|
]
|
53
116
|
},
|
54
|
-
"
|
117
|
+
"RKT": {
|
55
118
|
"type": "struct",
|
56
119
|
"type_mapping": [
|
57
|
-
|
58
|
-
|
120
|
+
["r", "Balance"],
|
121
|
+
["k", "Balance"]
|
59
122
|
]
|
60
123
|
},
|
61
|
-
"
|
124
|
+
"SpanRecord": {
|
62
125
|
"type": "struct",
|
63
126
|
"type_mapping": [
|
64
|
-
|
65
|
-
|
66
|
-
["others", "Vec<IndividualExpo>"]
|
127
|
+
["slashed", "RKT"],
|
128
|
+
["paid_out", "RKT"]
|
67
129
|
]
|
68
130
|
},
|
69
|
-
"
|
70
|
-
"Currency": "u128",
|
71
|
-
"CurrencyOf": "u128",
|
72
|
-
"Auction": {
|
131
|
+
"UnappliedSlash": {
|
73
132
|
"type": "struct",
|
74
133
|
"type_mapping": [
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
["lastRecord", "TokenBalance"],
|
81
|
-
["lastBidder", "AccountId"],
|
82
|
-
["lastBidStartAt", "Moment"]
|
134
|
+
["validator", "AccountId"],
|
135
|
+
["own", "RKT"],
|
136
|
+
["others", "Vec<(AccountId, RKT)>"],
|
137
|
+
["reporters", "Vec<AccountId>"],
|
138
|
+
["payout", "RKT"]
|
83
139
|
]
|
84
140
|
},
|
85
|
-
"
|
141
|
+
"TreasuryProposal": {
|
86
142
|
"type": "struct",
|
87
143
|
"type_mapping": [
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
144
|
+
["proposer", "AccountId"],
|
145
|
+
["beneficiary", "AccountId"],
|
146
|
+
["ring_value", "Balance"],
|
147
|
+
["kton_value", "Balance"],
|
148
|
+
["ring_bond", "Balance"],
|
149
|
+
["kton_bond", "Balance"]
|
93
150
|
]
|
94
151
|
},
|
95
|
-
"
|
152
|
+
"MappedRing": "u128",
|
153
|
+
"EthereumTransactionIndex": "(H256, u64)",
|
154
|
+
"EthereumHeaderBrief": {
|
96
155
|
"type": "struct",
|
97
156
|
"type_mapping": [
|
98
|
-
|
99
|
-
|
157
|
+
["total_difficulty", "U256"],
|
158
|
+
["parent_hash", "H256"],
|
159
|
+
["number", "EthereumBlockNumber"],
|
160
|
+
["relayer", "AccountId"]
|
100
161
|
]
|
101
162
|
},
|
102
|
-
"
|
163
|
+
"EthereumBlockNumber": "u64",
|
164
|
+
"EthereumHeaderThingWithProof": {
|
103
165
|
"type": "struct",
|
104
166
|
"type_mapping": [
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
167
|
+
["header", "EthereumHeader"],
|
168
|
+
["ethash_proof", "Vec<EthashProof>"],
|
169
|
+
["mmr_root", "H256"],
|
170
|
+
["mmr_proof", "Vec<H256>"]
|
109
171
|
]
|
110
172
|
},
|
111
|
-
"
|
173
|
+
"EthereumHeaderThing": {
|
112
174
|
"type": "struct",
|
113
175
|
"type_mapping": [
|
114
|
-
["
|
176
|
+
["header", "EthereumHeader"],
|
177
|
+
["mmr_root", "H256"]
|
178
|
+
]
|
179
|
+
},
|
180
|
+
"EthereumHeader": {
|
181
|
+
"type": "struct",
|
182
|
+
"type_mapping": [
|
183
|
+
["parent_hash", "H256"],
|
184
|
+
["timestamp", "u64"],
|
185
|
+
["number", "EthereumBlockNumber"],
|
186
|
+
["author", "EthereumAddress"],
|
187
|
+
["transactions_root", "H256"],
|
188
|
+
["uncles_hash", "H256"],
|
189
|
+
["extra_data", "Bytes"],
|
190
|
+
["state_root", "H256"],
|
191
|
+
["receipts_root", "H256"],
|
192
|
+
["log_bloom", "Bloom"],
|
193
|
+
["gas_used", "U256"],
|
194
|
+
["gas_limit", "U256"],
|
195
|
+
["difficulty", "U256"],
|
196
|
+
["seal", "Vec<Bytes>"],
|
197
|
+
["hash", "Option<H256>"]
|
198
|
+
]
|
199
|
+
},
|
200
|
+
"EthereumAddress": "H160",
|
201
|
+
"Bloom": "[u8; 256]",
|
202
|
+
"H128": "[u8; 16]",
|
203
|
+
"EthashProof": {
|
204
|
+
"type": "struct",
|
205
|
+
"type_mapping": [
|
206
|
+
["dag_nodes", "(H512, H512)"],
|
115
207
|
["proof", "Vec<H128>"]
|
116
208
|
]
|
209
|
+
},
|
210
|
+
"EthereumReceipt": {
|
211
|
+
"type": "struct",
|
212
|
+
"type_mapping": [
|
213
|
+
["gas_used", "U256"],
|
214
|
+
["log_bloom", "Bloom"],
|
215
|
+
["logs", "Vec<LogEntry>"],
|
216
|
+
["outcome", "TransactionOutcome"]
|
217
|
+
]
|
218
|
+
},
|
219
|
+
"EthereumNetworkType": {
|
220
|
+
"type": "enum",
|
221
|
+
"type_mapping": [
|
222
|
+
["Mainnet", "Null"],
|
223
|
+
["Ropsten", "Null"]
|
224
|
+
]
|
225
|
+
},
|
226
|
+
"RedeemFor": {
|
227
|
+
"type": "enum",
|
228
|
+
"type_mapping": [
|
229
|
+
["Token", "Null"],
|
230
|
+
["Deposit", "Null"]
|
231
|
+
]
|
232
|
+
},
|
233
|
+
"EthereumReceiptProof": {
|
234
|
+
"type": "struct",
|
235
|
+
"type_mapping": [
|
236
|
+
["index", "u64"],
|
237
|
+
["proof", "Bytes"],
|
238
|
+
["header_hash", "H256"]
|
239
|
+
]
|
240
|
+
},
|
241
|
+
"EthereumReceiptProofThing": "(EthereumHeader, EthereumReceiptProof, MMRProof)",
|
242
|
+
"MMRProof": {
|
243
|
+
"type": "struct",
|
244
|
+
"type_mapping": [
|
245
|
+
["member_leaf_index", "u64"],
|
246
|
+
["last_leaf_index", "u64"],
|
247
|
+
["proof", "Vec<H256>"]
|
248
|
+
]
|
249
|
+
},
|
250
|
+
"OtherSignature": {
|
251
|
+
"type": "enum",
|
252
|
+
"type_mapping": [
|
253
|
+
["Eth", "EcdsaSignature"],
|
254
|
+
["Tron", "EcdsaSignature"]
|
255
|
+
]
|
256
|
+
},
|
257
|
+
"EcdsaSignature": "[u8; 65]",
|
258
|
+
"OtherAddress": {
|
259
|
+
"type": "enum",
|
260
|
+
"type_mapping": [
|
261
|
+
["Eth", "[u8; 20]"],
|
262
|
+
["Tron", "[u8; 20]"]
|
263
|
+
]
|
264
|
+
},
|
265
|
+
"AddressT": "[u8; 20]",
|
266
|
+
"MerkleMountainRangeRootLog": {
|
267
|
+
"type": "struct",
|
268
|
+
"type_mapping": [
|
269
|
+
["prefix", "[u8; 4]"],
|
270
|
+
["mmr_root", "Hash"]
|
271
|
+
]
|
272
|
+
},
|
273
|
+
"Round": "u64",
|
274
|
+
"TcHeaderThingWithProof": "EthereumHeaderThingWithProof",
|
275
|
+
"TcHeaderThing": "EthereumHeaderThing",
|
276
|
+
"TcBlockNumber": "u64",
|
277
|
+
"TcHeaderHash": "H256",
|
278
|
+
"GameId": "TcBlockNumber",
|
279
|
+
"RelayProposalT": {
|
280
|
+
"type": "struct",
|
281
|
+
"type_mapping": [
|
282
|
+
["relayer", "AccountId"],
|
283
|
+
["bonded_proposal", "Vec<(Balance, TcHeaderThing)>"],
|
284
|
+
["extend_from_header_hash", "Option<TcHeaderHash>"]
|
285
|
+
]
|
286
|
+
},
|
287
|
+
"BalancesRuntimeDispatchInfo": {
|
288
|
+
"type": "struct",
|
289
|
+
"type_mapping": [
|
290
|
+
["usable_balance", "Balance"]
|
291
|
+
]
|
292
|
+
},
|
293
|
+
"StakingRuntimeDispatchInfo": {
|
294
|
+
"type": "struct",
|
295
|
+
"type_mapping": [
|
296
|
+
["power", "Power"]
|
297
|
+
]
|
117
298
|
}
|
118
299
|
}
|
119
300
|
}
|
data/scale.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
|
36
|
-
spec.add_dependency "substrate_common.rb", "~> 0.1.
|
36
|
+
spec.add_dependency "substrate_common.rb", "~> 0.1.9"
|
37
37
|
spec.add_dependency "json", "~> 2.3.0"
|
38
38
|
spec.add_dependency "activesupport", ">= 4.0.0"
|
39
39
|
spec.add_dependency "thor", "~> 0.19.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scale.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wu Minzhe
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: substrate_common.rb
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.9
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- lib/metadata/metadata_v1.rb
|
166
166
|
- lib/metadata/metadata_v10.rb
|
167
167
|
- lib/metadata/metadata_v11.rb
|
168
|
+
- lib/metadata/metadata_v12.rb
|
168
169
|
- lib/metadata/metadata_v2.rb
|
169
170
|
- lib/metadata/metadata_v3.rb
|
170
171
|
- lib/metadata/metadata_v4.rb
|
@@ -178,7 +179,6 @@ files:
|
|
178
179
|
- lib/scale/block.rb
|
179
180
|
- lib/scale/types.rb
|
180
181
|
- lib/scale/version.rb
|
181
|
-
- lib/type_registry/certifybook-chain.json
|
182
182
|
- lib/type_registry/darwinia.json
|
183
183
|
- lib/type_registry/default.json
|
184
184
|
- lib/type_registry/edgeware.json
|