scale.rb 0.2.6 → 0.2.12

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: 201e89b117a429345fb44cc4e9da4c77b99284e8cbf42622c96548f76777ebde
4
- data.tar.gz: 5f534ca2a026903a3bc74bad4bcf58c1d683bd2e7d24988a4710709733636dba
3
+ metadata.gz: fcfbe30b0f6a51793d9e977e362c34b213e04ee040f7d6961cde355b1e6cb8d0
4
+ data.tar.gz: 310f9fcab5186b0366e4a12da5790f77bfe81aa148684d1946d3a7f07ef57c60
5
5
  SHA512:
6
- metadata.gz: '0039c3cff40a7d34da5099e1b27fd6091d30213fdcc4578ee4a091496ab5bbb6048bab1e881ea0657fd8a9f3e1db6a8be7d986dc0998caa2772273ee52028568'
7
- data.tar.gz: ba948fe866b16470b02c03d726a445d8fc55a19b59d15f2a6f0d9cd48822fcf17f682dc18905047f9ba83c1627dc31d1d3169f026176b61ad19aeed75c5c05e7
6
+ metadata.gz: 14545046f43e403d84a492905b9aa9928024b0310aa2ae8dca927dd98e9d0b4415dcffa5a3364e85af2e13ef1ef4808fdb704462c8687fcb30336fa631a2ca9f
7
+ data.tar.gz: 23224a2ff2578fb4c49a12bc1317ae645fb5a2237f4f8f9f312585a53b849abd78ca455c86c68f9f6c2f22c3e6dd837638e6644245c66e25674b701e39de08e5
data/.DS_Store CHANGED
Binary file
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scale.rb (0.2.6)
4
+ scale.rb (0.2.12)
5
5
  activesupport (>= 4.0.0)
6
6
  json (~> 2.3.0)
7
- substrate_common.rb (~> 0.1.8)
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.1)
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.8)
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.3.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,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
@@ -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
- if types.has_key?(type)
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
- if type.class == ::String
98
- rename(type)
99
- else
100
- type
101
- end
99
+ type
102
100
  end
103
101
  end
104
102
  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.6".freeze
2
+ VERSION = "0.2.12".freeze
3
3
  end
@@ -1,119 +1,300 @@
1
1
  {
2
2
  "types": {
3
- "EpochDuration": "u64",
4
- "EraIndex": "u32",
5
- "Index": "U64",
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
- ["grandpa", "AccountId"],
13
- ["babe", "AccountId"]
8
+ ["id", "LockIdentifier"],
9
+ ["lock_for", "LockFor"],
10
+ ["lock_reasons", "LockReasons"]
14
11
  ]
15
12
  },
16
- "ValidatorPrefs": "ValidatorPrefsLegacy",
17
- "StakingBalance": {
13
+ "LockFor": {
18
14
  "type": "enum",
19
15
  "type_mapping": [
20
- ["Ring", "RingBalanceOf"],
21
- ["Kton", "KtonBalanceOf"]
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
- ["value", "Compact<RingBalanceOf>"],
28
- ["start_time", "Compact<Moment>"],
29
- ["expire_time", "Compact<Moment>"]
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
- "UnlockChunk": {
100
+ "IndividualExposure": {
33
101
  "type": "struct",
34
102
  "type_mapping": [
35
- ["value", "StakingBalance"],
36
- ["era", "Compact<EraIndex>"],
37
- ["is_time_deposit", "bool"]
103
+ ["who", "AccountId"],
104
+ ["ring_balance", "Compact<Balance>"],
105
+ ["kton_balance", "Compact<Balance>"],
106
+ ["power", "Power"]
38
107
  ]
39
108
  },
40
- "StakingLedgers": {
109
+ "ElectionResultT": {
41
110
  "type": "struct",
42
111
  "type_mapping": [
43
- ["stash", "AccountId"],
44
- ["total_ring", "Compact<RingBalanceOf>"],
45
- ["total_deposit_ring", "Compact<RingBalanceOf>"],
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
- "IndividualExpo": {
117
+ "RKT": {
55
118
  "type": "struct",
56
119
  "type_mapping": [
57
- ["who", "AccountId"],
58
- ["value", "ExtendedBalance"]
120
+ ["r", "Balance"],
121
+ ["k", "Balance"]
59
122
  ]
60
123
  },
61
- "Exposures": {
124
+ "SpanRecord": {
62
125
  "type": "struct",
63
126
  "type_mapping": [
64
- ["total", "ExtendedBalance"],
65
- ["own", "ExtendedBalance"],
66
- ["others", "Vec<IndividualExpo>"]
127
+ ["slashed", "RKT"],
128
+ ["paid_out", "RKT"]
67
129
  ]
68
130
  },
69
- "TokenBalance": "u128",
70
- "Currency": "u128",
71
- "CurrencyOf": "u128",
72
- "Auction": {
131
+ "UnappliedSlash": {
73
132
  "type": "struct",
74
133
  "type_mapping": [
75
- ["seller", "AccountId"],
76
- ["startAt", "Moment"],
77
- ["duration", "u64"],
78
- ["startingPrice", "TokenBalance"],
79
- ["endingPrice", "TokenBalance"],
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
- "DepositInfo": {
141
+ "TreasuryProposal": {
86
142
  "type": "struct",
87
143
  "type_mapping": [
88
- ["month", "Moment"],
89
- ["start_at", "Moment"],
90
- ["value", "CurrencyOf"],
91
- ["unit_interest", "u64"],
92
- ["claimed", "bool"]
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
- "Deposit": {
152
+ "MappedRing": "u128",
153
+ "EthereumTransactionIndex": "(H256, u64)",
154
+ "EthereumHeaderBrief": {
96
155
  "type": "struct",
97
156
  "type_mapping": [
98
- ["total_deposit", "CurrencyOf"],
99
- ["deposit_list", "Vec<DepositInfo>"]
157
+ ["total_difficulty", "U256"],
158
+ ["parent_hash", "H256"],
159
+ ["number", "EthereumBlockNumber"],
160
+ ["relayer", "AccountId"]
100
161
  ]
101
162
  },
102
- "Revenue": {
163
+ "EthereumBlockNumber": "u64",
164
+ "EthereumHeaderThingWithProof": {
103
165
  "type": "struct",
104
166
  "type_mapping": [
105
- ["team", "TokenBalance"],
106
- ["contribution", "TokenBalance"],
107
- ["ktoner", "TokenBalance"],
108
- ["lottery", "TokenBalance"]
167
+ ["header", "EthereumHeader"],
168
+ ["ethash_proof", "Vec<EthashProof>"],
169
+ ["mmr_root", "H256"],
170
+ ["mmr_proof", "Vec<H256>"]
109
171
  ]
110
172
  },
111
- "DoubleNodeWithMerkleProof": {
173
+ "EthereumHeaderThing": {
112
174
  "type": "struct",
113
175
  "type_mapping": [
114
- ["dag_nodes", "VecH512Length2"],
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
  }
@@ -12,7 +12,6 @@
12
12
  "CallHashOf": "CallHash",
13
13
  "Fixed64": "u64",
14
14
  "Fixed128": "u128",
15
- "AccountId": "GenericAccountId",
16
15
  "AccountIdOf": "AccountId",
17
16
  "AccountVoteSplit": {
18
17
  "type": "struct",
@@ -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.8"
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.6
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-09-29 00:00:00.000000000 Z
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.8
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.8
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
@@ -1,10 +0,0 @@
1
- {
2
- "types": {
3
- "Address": "AccountId",
4
- "LookupSource": "AccountId",
5
- "Entity": {
6
- "id": "H256",
7
- "status": "u8"
8
- }
9
- }
10
- }