scale.rb 0.2.3 → 0.2.4
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/Gemfile.lock +1 -1
- data/lib/scale/block.rb +20 -7
- data/lib/scale/version.rb +1 -1
- data/lib/scale.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8538580b5cc0d84add3684e3af10bbbba86bc741abb66bc5d38594c7de17894
|
4
|
+
data.tar.gz: a652f2dd8b436840f8b4e004fdf3fe81c699200fb68a11ea2ca52ae4a3e64062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5a71617b20e22dc876b71414c6bdf78cfdc23b94444f010d902eb382bb8f26d92e06de9eedca805aca9ba408035a981a106fa1d944081a3426864d6351b6b58
|
7
|
+
data.tar.gz: 8a65c9e78531472b74f93eb48da5c0e54c7b05430342467afa03ead952643cc41901a4a8f6b908ba6e3e8721b9aa26e6e426d6664ffb8ab93390e7c0febfd74c
|
data/Gemfile.lock
CHANGED
data/lib/scale/block.rb
CHANGED
@@ -124,20 +124,33 @@ module Scale
|
|
124
124
|
class EventRecord
|
125
125
|
include SingleValue
|
126
126
|
|
127
|
-
|
127
|
+
# 0x0c000000000000001027000001010000010000000400be07e2c28688db5368445c33d32b3c7bcad15dab1ec802ba8cccc1c22b86574f6992da89ff412eaf9bafac4024
|
128
|
+
def self.decode(scale_bytes)
|
129
|
+
metadata = Scale::TypeRegistry.instance.metadata
|
130
|
+
|
131
|
+
result = {}
|
128
132
|
phase = scale_bytes.get_next_bytes(1).first
|
129
133
|
|
130
134
|
if phase == 0
|
131
|
-
extrinsic_idx = U32.decode(scale_bytes).value
|
135
|
+
result[:extrinsic_idx] = U32.decode(scale_bytes).value
|
132
136
|
end
|
133
137
|
|
134
|
-
type = scale_bytes.get_next_bytes(2).bytes_to_hex
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
+
type = scale_bytes.get_next_bytes(2).bytes_to_hex[2..]
|
139
|
+
event = metadata.event_index[type][1]
|
140
|
+
mod = metadata.event_index[type][0]
|
141
|
+
|
142
|
+
result[:params] = []
|
143
|
+
event[:args].each do |arg_type|
|
144
|
+
value = Scale::Types.get(arg_type).decode(scale_bytes).value
|
145
|
+
result[:params] << {
|
146
|
+
type: arg_type,
|
147
|
+
value: value
|
148
|
+
}
|
149
|
+
end
|
138
150
|
|
139
|
-
|
151
|
+
result[:topics] = Scale::Types.get('Vec<Hash>').decode(scale_bytes).value.map(&:value)
|
140
152
|
|
153
|
+
EventRecord.new(result)
|
141
154
|
end
|
142
155
|
end
|
143
156
|
|
data/lib/scale/version.rb
CHANGED
data/lib/scale.rb
CHANGED