scale.rb 0.2.3 → 0.2.8

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.
@@ -1,6 +1,15 @@
1
1
  {
2
- "runtime_id": 2,
2
+ "runtime_id": 3,
3
3
  "types": {
4
- "Weight": "u16"
4
+ "BlockNumber": "U32",
5
+ "Weight": "u64",
6
+ "DispatchInfo": {
7
+ "type": "struct",
8
+ "type_mapping": [
9
+ ["weight", "Weight"],
10
+ ["class", "DispatchClass"],
11
+ ["paysFee", "Pays"]
12
+ ]
13
+ }
5
14
  }
6
15
  }
@@ -1,9 +1,10 @@
1
1
  {
2
- "runtime_id": 1054,
2
+ "runtime_id": 2023,
3
3
  "types": {
4
4
  "Address": "AccountIdAddress",
5
5
  "BlockNumber": "U32",
6
6
  "LeasePeriod": "BlockNumber",
7
+ "Weight": "u64",
7
8
  "SessionKeysPolkadot": {
8
9
  "type": "struct",
9
10
  "type_mapping": [
@@ -14,7 +15,26 @@
14
15
  ["parachains", "AccountId"]
15
16
  ]
16
17
  },
17
- "Keys": "SessionKeysPolkadot"
18
+ "Keys": "SessionKeysPolkadot",
19
+ "DispatchInfo": {
20
+ "type": "struct",
21
+ "type_mapping": [
22
+ ["weight", "Weight"],
23
+ ["class", "DispatchClass"],
24
+ ["paysFee", "Pays"]
25
+ ]
26
+ },
27
+ "ProxyType": {
28
+ "type": "enum",
29
+ "value_list": [
30
+ "Any",
31
+ "NonTransfer",
32
+ "Governance",
33
+ "Staking",
34
+ "IdentityJudgement"
35
+ ]
36
+ },
37
+ "CompactAssignments": "CompactAssignmentsFrom258"
18
38
  },
19
39
  "versioning": [
20
40
  {
@@ -111,38 +131,60 @@
111
131
  "runtime_range": [1019, 1045],
112
132
  "types": {
113
133
  "Address": "RawAddress",
114
- "StakingLedger<AccountId, BalanceOf>": {
134
+ "StakingLedger": "StakingLedgerTo223",
135
+ "BalanceLock": {
115
136
  "type": "struct",
116
137
  "type_mapping": [
117
- ["stash", "AccountId"],
118
- ["total", "Compact<Balance>"],
119
- ["active", "Compact<Balance>"],
120
- ["unlocking", "Vec<UnlockChunk<Balance>>"]
138
+ ["id", "LockIdentifier"],
139
+ ["amount", "Balance"],
140
+ ["until", "BlockNumber"],
141
+ ["reasons", "WithdrawReasons"]
121
142
  ]
122
- },
143
+ }
144
+ }
145
+ },
146
+ {
147
+ "runtime_range": [1050, 1056],
148
+ "types": {
149
+ "Address": "AccountIdAddress",
150
+ "StakingLedger": "StakingLedgerTo240",
123
151
  "BalanceLock": {
124
152
  "type": "struct",
125
153
  "type_mapping": [
126
154
  ["id", "LockIdentifier"],
127
155
  ["amount", "Balance"],
128
- ["until", "BlockNumber"],
129
- ["reasons", "WithdrawReasons"]
156
+ ["reasons", "Reasons"]
130
157
  ]
131
158
  }
132
159
  }
133
160
  },
134
161
  {
135
- "runtime_range": [1050, null],
162
+ "runtime_range": [1057, null],
136
163
  "types": {
137
164
  "Address": "AccountIdAddress",
138
- "StakingLedger<AccountId, BalanceOf>": {
165
+ "StakingLedger": {
139
166
  "type": "struct",
140
167
  "type_mapping": [
141
- ["stash", "AccountId"],
142
- ["total", "Compact<Balance>"],
143
- ["active", "Compact<Balance>"],
144
- ["unlocking", "Vec<UnlockChunk<Balance>>"],
145
- ["lastReward", "Option<EraIndex>"]
168
+ [
169
+ "stash",
170
+ "AccountId"
171
+ ],
172
+ [
173
+ "total",
174
+ "Compact<Balance>"
175
+ ],
176
+ [
177
+ "active",
178
+ "Compact<Balance>"
179
+ ],
180
+ [
181
+ "unlocking",
182
+ "Vec<UnlockChunk>"
183
+ ],
184
+ [
185
+ "claimedRewards",
186
+ "Vec<EraIndex>"
187
+ ]
146
188
  ]
147
189
  },
148
190
  "BalanceLock": {
@@ -180,7 +222,107 @@
180
222
  ]
181
223
  }
182
224
  }
225
+ },
226
+ {
227
+ "runtime_range": [1019, 1056],
228
+ "types": {
229
+ "Weight": "u32"
230
+ }
231
+ },
232
+ {
233
+ "runtime_range": [1057, null],
234
+ "types": {
235
+ "Weight": "u64"
236
+ }
237
+ },
238
+ {
239
+ "runtime_range": [1019, 1061],
240
+ "types": {
241
+ "Heartbeat": {
242
+ "type": "struct",
243
+ "type_mapping": [
244
+ ["blockNumber", "BlockNumber"],
245
+ ["networkState", "OpaqueNetworkState"],
246
+ ["sessionIndex", "SessionIndex"],
247
+ ["authorityIndex", "AuthIndex"]
248
+ ]
249
+ },
250
+ "DispatchInfo": {
251
+ "type": "struct",
252
+ "type_mapping": [
253
+ ["weight", "Weight"],
254
+ ["class", "DispatchClass"],
255
+ ["paysFee", "bool"]
256
+ ]
257
+ }
258
+ }
259
+ },
260
+ {
261
+ "runtime_range": [1062, null],
262
+ "types": {
263
+ "Heartbeat": {
264
+ "type": "struct",
265
+ "type_mapping": [
266
+ ["blockNumber", "BlockNumber"],
267
+ ["networkState", "OpaqueNetworkState"],
268
+ ["sessionIndex", "SessionIndex"],
269
+ ["authorityIndex", "AuthIndex"],
270
+ ["validatorsLen", "u32"]
271
+ ]
272
+ },
273
+ "DispatchInfo": {
274
+ "type": "struct",
275
+ "type_mapping": [
276
+ ["weight", "Weight"],
277
+ ["class", "DispatchClass"],
278
+ ["paysFee", "Pays"]
279
+ ]
280
+ }
281
+ }
282
+ },
283
+ {
284
+ "runtime_range": [1019, 2012],
285
+ "types": {
286
+ "OpenTip": {
287
+ "type": "struct",
288
+ "type_mapping": [
289
+ ["reason", "Hash"],
290
+ ["who", "AccountId"],
291
+ ["finder", "Option<OpenTipFinder>"],
292
+ ["closes", "Option<BlockNumber>"],
293
+ ["tips", "Vec<OpenTipTip>"]
294
+ ]
295
+ }
296
+ }
297
+ },
298
+ {
299
+ "runtime_range": [2013, null],
300
+ "types": {
301
+ "OpenTip": {
302
+ "type": "struct",
303
+ "type_mapping": [
304
+ ["reason", "Hash"],
305
+ ["who", "AccountId"],
306
+ ["finder", "AccountId"],
307
+ ["deposit", "Balance"],
308
+ ["closes", "Option<BlockNumber>"],
309
+ ["tips", "Vec<OpenTipTip>"],
310
+ ["findersFee", "bool"]
311
+ ]
312
+ }
313
+ }
314
+ },
315
+ {
316
+ "runtime_range": [1019, 2022],
317
+ "types": {
318
+ "CompactAssignments": "CompactAssignmentsTo257"
319
+ }
320
+ },
321
+ {
322
+ "runtime_range": [2023, null],
323
+ "types": {
324
+ "CompactAssignments": "CompactAssignmentsFrom258"
325
+ }
183
326
  }
184
-
185
327
  ]
186
328
  }
@@ -0,0 +1,85 @@
1
+ {
2
+ "runtime_id": 18,
3
+ "types": {
4
+ "Address": "AccountIdAddress",
5
+ "BlockNumber": "U32",
6
+ "LeasePeriod": "BlockNumber",
7
+ "Weight": "u64",
8
+ "SessionKeysPolkadot": {
9
+ "type": "struct",
10
+ "type_mapping": [
11
+ ["grandpa", "AccountId"],
12
+ ["babe", "AccountId"],
13
+ ["im_online", "AccountId"],
14
+ ["authority_discovery", "AccountId"],
15
+ ["parachains", "AccountId"]
16
+ ]
17
+ },
18
+ "Keys": "SessionKeysPolkadot",
19
+ "DispatchInfo": {
20
+ "type": "struct",
21
+ "type_mapping": [
22
+ ["weight", "Weight"],
23
+ ["class", "DispatchClass"],
24
+ ["paysFee", "Pays"]
25
+ ]
26
+ },
27
+ "ProxyType": {
28
+ "type": "enum",
29
+ "value_list": [
30
+ "Any",
31
+ "NonTransfer",
32
+ "Governance",
33
+ "Staking",
34
+ "SudoBalances",
35
+ "IdentityJudgement"
36
+ ]
37
+ }
38
+ },
39
+ "versioning": [
40
+ {
41
+ "runtime_range": [0, 12],
42
+ "types": {
43
+ "OpenTip": {
44
+ "type": "struct",
45
+ "type_mapping": [
46
+ ["reason", "Hash"],
47
+ ["who", "AccountId"],
48
+ ["finder", "Option<OpenTipFinder>"],
49
+ ["closes", "Option<BlockNumber>"],
50
+ ["tips", "Vec<OpenTipTip>"]
51
+ ]
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "runtime_range": [13, null],
57
+ "types": {
58
+ "OpenTip": {
59
+ "type": "struct",
60
+ "type_mapping": [
61
+ ["reason", "Hash"],
62
+ ["who", "AccountId"],
63
+ ["finder", "AccountId"],
64
+ ["deposit", "Balance"],
65
+ ["closes", "Option<BlockNumber>"],
66
+ ["tips", "Vec<OpenTipTip>"],
67
+ ["findersFee", "bool"]
68
+ ]
69
+ }
70
+ }
71
+ },
72
+ {
73
+ "runtime_range": [0, 22],
74
+ "types": {
75
+ "CompactAssignments": "CompactAssignmentsTo257"
76
+ }
77
+ },
78
+ {
79
+ "runtime_range": [23, null],
80
+ "types": {
81
+ "CompactAssignments": "CompactAssignmentsFrom258"
82
+ }
83
+ }
84
+ ]
85
+ }
@@ -1,6 +1,7 @@
1
1
  {
2
- "runtime_id": 1000,
2
+ "runtime_id": 23,
3
3
  "types": {
4
+ "Address": "AccountIdAddress",
4
5
  "BlockNumber": "U32",
5
6
  "LeasePeriod": "BlockNumber",
6
7
  "SessionKeysPolkadot": {
@@ -13,6 +14,50 @@
13
14
  ["parachains", "AccountId"]
14
15
  ]
15
16
  },
16
- "Keys": "SessionKeysPolkadot"
17
- }
17
+ "Keys": "SessionKeysPolkadot",
18
+ "ProxyType": {
19
+ "type": "enum",
20
+ "value_list": [
21
+ "Any",
22
+ "NonTransfer",
23
+ "Staking",
24
+ "SudoBalances",
25
+ "IdentityJudgement"
26
+ ]
27
+ }
28
+ },
29
+ "versioning": [
30
+ {
31
+ "runtime_range": [3, 22],
32
+ "types": {
33
+ "OpenTip": {
34
+ "type": "struct",
35
+ "type_mapping": [
36
+ ["reason", "Hash"],
37
+ ["who", "AccountId"],
38
+ ["finder", "Option<OpenTipFinder>"],
39
+ ["closes", "Option<BlockNumber>"],
40
+ ["tips", "Vec<OpenTipTip>"]
41
+ ]
42
+ }
43
+ }
44
+ },
45
+ {
46
+ "runtime_range": [23, null],
47
+ "types": {
48
+ "OpenTip": {
49
+ "type": "struct",
50
+ "type_mapping": [
51
+ ["reason", "Hash"],
52
+ ["who", "AccountId"],
53
+ ["finder", "AccountId"],
54
+ ["deposit", "Balance"],
55
+ ["closes", "Option<BlockNumber>"],
56
+ ["tips", "Vec<OpenTipTip>"],
57
+ ["findersFee", "bool"]
58
+ ]
59
+ }
60
+ }
61
+ }
62
+ ]
18
63
  }
@@ -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"
@@ -0,0 +1,34 @@
1
+ require "scale"
2
+
3
+
4
+ client = SubstrateClient.new("ws://127.0.0.1:9944/")
5
+ client.init
6
+ metadata = client.get_metadata nil
7
+
8
+ the_module = metadata.get_module("CertificateModule")
9
+ puts ""
10
+ puts "CertificateModule calls:"
11
+ puts "---------------------------------------"
12
+ puts the_module[:calls]
13
+
14
+ the_call = metadata.get_module_call("CertificateModule", "create_entity")
15
+ puts ""
16
+ puts "create_entity call:"
17
+ puts "---------------------------------------"
18
+ puts the_call
19
+
20
+
21
+ puts ""
22
+ puts "CertificateModule storages:"
23
+ puts "---------------------------------------"
24
+ puts the_module[:storage][:items]
25
+
26
+ # Scale::TypeRegistry.instance.metadata = metadata.value
27
+ # puts metadata.value.event_index["0400"][1]
28
+ # puts metadata.value.event_index["0401"][1]
29
+ # puts metadata.value.event_index["0402"][1]
30
+ # hex_events = "0x0c000000000000001027000001010000010000000400be07e2c28688db5368445c33d32b3c7bcad15dab1ec802ba8cccc1c22b86574f6992da89ff412eaf9bafac4024ca23eea8c988a437fc96a1c6445148a8ebb4d2000001000000000010270000000100"
31
+ # scale_bytes = Scale::Bytes.new(hex_events)
32
+ # Scale::Types.get("Vec<EventRecord>").decode(scale_bytes).value.each do |er|
33
+ # puts er.value
34
+ # end
@@ -0,0 +1,4 @@
1
+ require "scale"
2
+
3
+ client = SubstrateClient.new("wss://kusama-rpc.polkadot.io/")
4
+ client.init
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.3
4
+ version: 0.2.8
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-04-15 00:00:00.000000000 Z
11
+ date: 2020-10-14 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
@@ -145,6 +145,7 @@ extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - ".DS_Store"
148
+ - ".dockerignore"
148
149
  - ".gitignore"
149
150
  - Cargo.lock
150
151
  - Cargo.toml
@@ -164,6 +165,7 @@ files:
164
165
  - lib/metadata/metadata_v1.rb
165
166
  - lib/metadata/metadata_v10.rb
166
167
  - lib/metadata/metadata_v11.rb
168
+ - lib/metadata/metadata_v12.rb
167
169
  - lib/metadata/metadata_v2.rb
168
170
  - lib/metadata/metadata_v3.rb
169
171
  - lib/metadata/metadata_v4.rb
@@ -185,10 +187,13 @@ files:
185
187
  - lib/type_registry/kulupu.json
186
188
  - lib/type_registry/kusama.json
187
189
  - lib/type_registry/plasm.json
190
+ - lib/type_registry/polkadot.json
188
191
  - lib/type_registry/robonomics.json
189
192
  - lib/type_registry/test.json
190
193
  - lib/type_registry/westend.json
191
194
  - scale.gemspec
195
+ - scripts/block_events.rb
196
+ - scripts/example.rb
192
197
  - src/lib.rs
193
198
  homepage: https://github.com/itering/scale.rb
194
199
  licenses: