scale_rb 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/client/http_client.rb +38 -0
- data/lib/scale_rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e442bed63503c0e8c7210753df2fa8a293a094c4df6e095f649997923a4d65c6
|
4
|
+
data.tar.gz: 97c1bc3b28346baf2f28a93a5a302240d327b663fc7acad7f0bdbd5c558a8e2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b233f131d753ca6bb5f632523da0d09be97d2f721a9933c63c6def842ea55de30fd6a7f46081c0113b114b48ce15ed1193b5b834e382379e2406a8eb3416c012
|
7
|
+
data.tar.gz: 7f97fd3d9927fd3873717226e1294209af285062314850af0d9000e46cdb657b033c3536d19da6cd1bbc6baaeed6f39d729ea7ec3bfcd0c381e75bcfcf1afd5b
|
data/Gemfile.lock
CHANGED
data/lib/client/http_client.rb
CHANGED
@@ -178,6 +178,44 @@ module ScaleRb
|
|
178
178
|
end
|
179
179
|
get_storage(url, pallet_name, item_name, key, value, registry, at)
|
180
180
|
end
|
181
|
+
|
182
|
+
# get_storage3 is a more ruby style function
|
183
|
+
#
|
184
|
+
# pallet_name and storage_name is pascal style like 'darwinia_staking'
|
185
|
+
def get_storage3(url, metadata, pallet_name, storage_name, key_part1: nil, key_part2: nil, at: nil)
|
186
|
+
pallet_name = to_pascal pallet_name
|
187
|
+
storage_name = to_pascal storage_name
|
188
|
+
ScaleRb.logger.debug "#{pallet_name}.#{storage_name}(#{[key_part1, key_part2].compact.join(', ')})"
|
189
|
+
|
190
|
+
key = [key_part1, key_part2].compact.map { |part_of_key| c(part_of_key) }
|
191
|
+
ScaleRb.logger.debug "converted key: #{key}"
|
192
|
+
|
193
|
+
get_storage2(
|
194
|
+
url,
|
195
|
+
pallet_name,
|
196
|
+
storage_name,
|
197
|
+
key,
|
198
|
+
metadata,
|
199
|
+
at
|
200
|
+
)
|
201
|
+
end
|
202
|
+
|
203
|
+
private
|
204
|
+
|
205
|
+
def to_pascal(str)
|
206
|
+
str.split('_').collect(&:capitalize).join
|
207
|
+
end
|
208
|
+
|
209
|
+
# convert key to byte array
|
210
|
+
def c(key)
|
211
|
+
if key.start_with?('0x')
|
212
|
+
key.to_bytes
|
213
|
+
elsif key.to_i.to_s == key # check if key is a number
|
214
|
+
key.to_i
|
215
|
+
else
|
216
|
+
key
|
217
|
+
end
|
218
|
+
end
|
181
219
|
end
|
182
220
|
end
|
183
221
|
end
|
data/lib/scale_rb/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aki Wu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blake2b_rs
|