scale.rb 0.2.8 → 0.2.9

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: a1efdbfb5ae89e2d4ff5abf3ca77717b3c95df5fbcd0e196066d813a03b80c7b
4
- data.tar.gz: d8ce883df1522681efa389822fadd93da861685dbe5bc9e16206d2a97bd4a0de
3
+ metadata.gz: 5a2cf612b6cd7c832ee28aec4da8fcec7ebeac8dc393ba1af41b1aecd96aa484
4
+ data.tar.gz: 2035bde19211e78f604fcdd51a95cb3b653fc278024326787545655fa09b88da
5
5
  SHA512:
6
- metadata.gz: ff7098aca9829ed818bcfe59a9a9cbeed492aead969619ab9acb62c47b6f6fce85d5519dc30a2e4d4816658528d0c9c1db2f4ff1c653b15646d2c1a4929d0435
7
- data.tar.gz: 1034c3b87ffcbf8516cc23c4bcb5f524c096f78e6343901a10864ac4c94832f569c935807a70181fcb43b2ddbabc268b41902a649b5e45868377d5fe55b695a5
6
+ metadata.gz: b1e10fd308c6f38525a2150e2bba0da42966e3c67dd9ca5f299133fd16a1c59e4988fb33841b194b3437bdae71f3dbea43cd2e4102e39f24b0bb7de9fd54f6dd
7
+ data.tar.gz: fadad4fd7fd8ba14f02574bc594e2cc815b905fc75008f0735f38ba2381b87aff8ec7e2f5fa1b878e9d7658b88e34d861ccb8481fa82e5369c0bfb68af154d5a
data/.DS_Store CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scale.rb (0.2.8)
4
+ scale.rb (0.2.9)
5
5
  activesupport (>= 4.0.0)
6
6
  json (~> 2.3.0)
7
7
  substrate_common.rb (~> 0.1.9)
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
 
@@ -1,3 +1,3 @@
1
1
  module Scale
2
- VERSION = "0.2.8".freeze
2
+ VERSION = "0.2.9".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
  }
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.8
4
+ version: 0.2.9
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-10-14 00:00:00.000000000 Z
11
+ date: 2020-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: substrate_common.rb
@@ -179,7 +179,6 @@ files:
179
179
  - lib/scale/block.rb
180
180
  - lib/scale/types.rb
181
181
  - lib/scale/version.rb
182
- - lib/type_registry/certifybook-chain.json
183
182
  - lib/type_registry/darwinia.json
184
183
  - lib/type_registry/default.json
185
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
- }