scale.rb 0.2.2 → 0.2.3

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: fbef01ecfbfc09507b09b752afc0793307e9f50612617f3ea980ff0d4e0b6c2c
4
- data.tar.gz: d5f7bb9770ea5aeceb06fc688ee19948a91692da4f88e5451c091d3694b509a4
3
+ metadata.gz: 57a926d8c88b0299b3aa8c24ab8452b6e02b65e540017ea208c2cef029a9dd66
4
+ data.tar.gz: 28f3039ccd89246f9613f46ecd442a7a10a4dd750d3ffdd55a24ed8bd246cb83
5
5
  SHA512:
6
- metadata.gz: 04a161f198cae8f79f2233044f61f66d1346397a685b7fd8f029c22e1fba83d41b388e4bcebf292d5cb168f657a79253353d9f864e7002bcb8f4c351640b38f3
7
- data.tar.gz: 5f70fe07b0d1280ac2ffb710c71f7c16d70ae3f9a1b08562e3d34741059dc79eafe5086f5e19a542489eb0827ce28da54646cdcd6a6eb71693e27b955ce93e53
6
+ metadata.gz: e685ed147def9c29297934e1a805856c19a397527842cd2e61c6422219228b569a18cc6837c98592f3ce47b12db7d8f28f8bcc547dbaad2d41a58cb45d5419c6
7
+ data.tar.gz: d1645de7d187cdcd2e68157f5907a63229241be265eca0d05332fabc402b94156bc86fb7ab7146475b47fcdb92e2f7d4ef7561c8004c861c82517437feb5a57d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scale.rb (0.2.2)
4
+ scale.rb (0.2.3)
5
5
  activesupport (>= 4.0.0)
6
6
  json (~> 2.3.0)
7
7
  substrate_common.rb (~> 0.1.8)
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
@@ -37,7 +37,7 @@ module Scale
37
37
 
38
38
  if m[:events]
39
39
  m[:events].each_with_index do |event, index|
40
- event[:lookup] = "%02x%02x" % [call_module_index, index]
40
+ event[:lookup] = "%02x%02x" % [event_module_index, index]
41
41
  result.event_index[event[:lookup]] = [m, event]
42
42
  end
43
43
  event_module_index += 1
data/lib/scale/block.rb CHANGED
@@ -104,10 +104,40 @@ module Scale
104
104
  result[:extrinsic_length] = extrinsic_length
105
105
  result[:version_info] = version_info
106
106
 
107
- result
107
+ Extrinsic.new result
108
+ end
109
+
110
+ def encode(metadata)
111
+ puts metadata.value.value["modules"]
112
+ result = "04" + self.value[:call_index]
113
+
114
+ result = result +
115
+ self.value[:params].map do |param|
116
+ param[:type].constantize.new(param[:value]).encode
117
+ end.join
118
+
119
+ result = "0x" + Compact.new(result.length / 2).encode + result
120
+ return result
121
+ end
122
+ end
123
+
124
+ class EventRecord
125
+ include SingleValue
126
+
127
+ def self.decode(scale_bytes, metadata)
128
+ phase = scale_bytes.get_next_bytes(1).first
129
+
130
+ if phase == 0
131
+ extrinsic_idx = U32.decode(scale_bytes).value
132
+ end
133
+
134
+ type = scale_bytes.get_next_bytes(2).bytes_to_hex
135
+
136
+
108
137
  end
109
138
 
110
139
  def encode
140
+
111
141
  end
112
142
  end
113
143
 
data/lib/scale/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Scale
2
- VERSION = "0.2.2".freeze
2
+ VERSION = "0.2.3".freeze
3
3
  end
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.2
4
+ version: 0.2.3
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-08 00:00:00.000000000 Z
11
+ date: 2020-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: substrate_common.rb