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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9af24645257f5dc7c2028047ba01ef9a3d1fe4282581717cb62334a6f96f153
4
- data.tar.gz: 8d79a47702d593158680d4fe2f5a887962fd87bc19e51e2d57b4ea6ca2ec0a9b
3
+ metadata.gz: e442bed63503c0e8c7210753df2fa8a293a094c4df6e095f649997923a4d65c6
4
+ data.tar.gz: 97c1bc3b28346baf2f28a93a5a302240d327b663fc7acad7f0bdbd5c558a8e2e
5
5
  SHA512:
6
- metadata.gz: b573f530576618d07382f3b995cc5413a564e4bf95149882cc83b6cb0d885e2adee2f903b5db0c8a14fd5b6964683b6851f6105e0c53c6bcb98e625c2991a639
7
- data.tar.gz: efa796fe20f73749749bfd06de0f08c1d836268ddb99963775003f282eff60e15accd4d62556eaa1d01b0821447bdcb4bd8956e5445401ca562da2df1fc547f8
6
+ metadata.gz: b233f131d753ca6bb5f632523da0d09be97d2f721a9933c63c6def842ea55de30fd6a7f46081c0113b114b48ce15ed1193b5b834e382379e2406a8eb3416c012
7
+ data.tar.gz: 7f97fd3d9927fd3873717226e1294209af285062314850af0d9000e46cdb657b033c3536d19da6cd1bbc6baaeed6f39d729ea7ec3bfcd0c381e75bcfcf1afd5b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scale_rb (0.1.11)
4
+ scale_rb (0.1.13)
5
5
  base58
6
6
  blake2b_rs (~> 0.1.4)
7
7
  xxhash
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ScaleRb
2
- VERSION = '0.1.11'
2
+ VERSION = '0.1.13'
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.1.11
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-21 00:00:00.000000000 Z
11
+ date: 2023-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blake2b_rs