scale_rb 0.2.0 → 0.2.2

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: 9857ea16c7327b90a598f40ce8afe919ee3db3a1fada67ba9e1a5ee768c50fdf
4
- data.tar.gz: 7bd319b972c1c4aa13f4f24c6af525294bcbd8b6361423db66ac6038e44ad990
3
+ metadata.gz: 204c629856c37264a38451c2655c36ea33aee9d97cb4220ab2d107dc692f1d79
4
+ data.tar.gz: 4e16a199f0d77c5a7fa4150e05a00204f3244cb33d64ec79604f7e19ff43fbc3
5
5
  SHA512:
6
- metadata.gz: db6452725e87b88cd0bdffe419588c8b9b8cfe892bdac01df226e9008bf02e45d56c9c25447a932d8ddf43bdfecf6ade0095710c9e056ee14ef2813f7b500b75
7
- data.tar.gz: 2c6d01fd6726cc7ff5ed7c303b5e3c7ffe48347267a7b6989a6cda032741c47cfe339fa4c51871166b78f794a999cf8b0e6104cf44d013912bf5dbac0599cb45
6
+ metadata.gz: 5de7ac76c8a4113b2ae965845b2d7a940eabce3b732fad370a6bd1be039f83c0f251525c35ebace750493c07d4372868bc82fefcbd215f19c30b8702cf2ab281
7
+ data.tar.gz: a5796129a92d7bfca3d00cbdccf56a7574e3486d9562ef088ef74b5a24135cdbe6a3ee014692df2ba1bfbc3140dcd97a5d96bf575d73310eacabbde3e8876229
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scale_rb (0.2.0)
4
+ scale_rb (0.2.2)
5
5
  base58
6
6
  blake2b_rs (~> 0.1.4)
7
7
  xxhash
@@ -13,7 +13,7 @@ module ScaleRb
13
13
  extend RpcRequestBuilder
14
14
 
15
15
  class << self
16
- def request(url, body)
16
+ def request(url, body, tries = 0)
17
17
  ScaleRb.logger.debug "url: #{url}"
18
18
  ScaleRb.logger.debug "body: #{body}"
19
19
  uri = URI(url)
@@ -31,10 +31,12 @@ module ScaleRb
31
31
 
32
32
  result['result']
33
33
  rescue StandardError => e
34
+ raise e unless tries < 5
35
+
34
36
  ScaleRb.logger.error e.message
35
- ScaleRb.logger.error 'retry...'
36
- sleep 2
37
- request(url, body)
37
+ ScaleRb.logger.error 'retry after 5 seconds...'
38
+ sleep 5
39
+ request(url, body, tries + 1)
38
40
  end
39
41
 
40
42
  def json_rpc_call(url, method, *params)
@@ -65,3 +67,31 @@ module ScaleRb
65
67
  end
66
68
  end
67
69
  end
70
+
71
+ # https://polkadot.js.org/docs/substrate/rpc/
72
+ #
73
+ # Examples:
74
+ # # Get all supported rpc methods
75
+ # ScaleRb::HttpClient.rpc_methods("https://rpc.darwinia.network")
76
+ #
77
+ # # eth_blockNumber
78
+ # ScaleRb::HttpClient.eth_blockNumber("https://rpc.darwinia.network")
79
+ #
80
+ # # system_name
81
+ # ScaleRb::HttpClient.system_name("https://rpc.darwinia.network")
82
+ #
83
+ # # chain_getHead
84
+ # ScaleRb::HttpClient.chain_getHead("https://rpc.darwinia.network")
85
+ #
86
+ # # state_getMetadata of darwinia block #1582
87
+ # ScaleRb::HttpClient.state_getMetadata(
88
+ # "https://rpc.darwinia.network",
89
+ # "0xb5a4f16d0feba7531e75315432b4d31a5b918987e026437890a2cbf5b8d9956d"
90
+ # )
91
+ #
92
+ # # eth_getBalance of address 0x0000000000000000000000000000000000000000 at block #1582
93
+ # ScaleRb::HttpClient.eth_getBalance(
94
+ # "https://rpc.darwinia.network",
95
+ # "0x0000000000000000000000000000000000000000",
96
+ # 1582
97
+ # )
@@ -1,3 +1,3 @@
1
1
  module ScaleRb
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.2'
3
3
  end
data/scale_rb.gemspec CHANGED
@@ -16,6 +16,11 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
 
19
+ spec.metadata = {
20
+ 'bug_tracker_uri' => 'https://github.com/wuminzhe/scale_rb/issues/',
21
+ 'source_code_uri' => 'https://github.com/wuminzhe/scale_rb.git'
22
+ }
23
+
19
24
  # Specify which files should be added to the gem when it is released.
20
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
26
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -26,7 +31,7 @@ Gem::Specification.new do |spec|
26
31
  spec.require_paths = ['lib']
27
32
 
28
33
  # for hashers
34
+ spec.add_dependency 'base58'
29
35
  spec.add_dependency 'blake2b_rs', '~> 0.1.4'
30
36
  spec.add_dependency 'xxhash'
31
- spec.add_dependency "base58"
32
37
  end
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scale_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
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-10-06 00:00:00.000000000 Z
11
+ date: 2024-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: blake2b_rs
14
+ name: base58
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.4
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.4
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: xxhash
28
+ name: blake2b_rs
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.1.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.1.4
41
41
  - !ruby/object:Gem::Dependency
42
- name: base58
42
+ name: xxhash
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -99,8 +99,8 @@ homepage: https://github.com/wuminzhe/scale_rb
99
99
  licenses:
100
100
  - MIT
101
101
  metadata:
102
- allowed_push_host: https://rubygems.org
103
- homepage_uri: https://github.com/wuminzhe/scale_rb
102
+ bug_tracker_uri: https://github.com/wuminzhe/scale_rb/issues/
103
+ source_code_uri: https://github.com/wuminzhe/scale_rb.git
104
104
  post_install_message:
105
105
  rdoc_options: []
106
106
  require_paths: