cns 0.7.7 → 0.7.9

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: daa2f08ad64618d371bd4a5d0af2b481f9ad2e33760d10262ecf11b1581824a8
4
- data.tar.gz: f8128a31e98e12afdfdd8e7705548f9c1bc51d3b7f39131c5bb16389ac9e5954
3
+ metadata.gz: 2877c747c139b72d545038365090e1fbcb59c81765fa1148d8df42fad5e41b1d
4
+ data.tar.gz: c41981db14030be80f42b0e0ab6854029bf17a6139252b8b54327e5322dada49
5
5
  SHA512:
6
- metadata.gz: 449ae96de20bd33e218ec16e2ddc72460a2c5f603cd0a7b1c376c2fc89a0a8da6cabc5b5e22b8e44d18e24ea756ccdb55394034a27454e87bb400c2419bc867b
7
- data.tar.gz: cec6b5f69081f1e5f1840dfd6af2f10576835041d1a434af18e21282df16f90377edd568ae9e404f022ee3dc127178026f8982132efa2c556df21c2ff95d219a
6
+ metadata.gz: 78c94bf76ba9186e059ea685cb8f7f2dc60b977f4c006b9f220bdd7872c34864f676e3e429f21f3f0482c40af4288deaba3540bd860e54cfb1eff91cef720d23
7
+ data.tar.gz: d40243a18acc0c830f30bbbea36ad2f86b948cee06527a378bde11848db21fc19d17a1bd8de36ce63c6f8fb269dc59e26145e7e47da573b63b514243746657ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cns (0.7.7)
4
+ cns (0.7.9)
5
5
  curb
6
6
  faraday
7
7
  google-cloud-bigquery
@@ -20,7 +20,36 @@ GEM
20
20
  concurrent-ruby (1.3.5)
21
21
  curb (1.0.8)
22
22
  declarative (0.0.20)
23
- e2mmap (0.1.0)
23
+ diff-lcs (1.5.1)
24
+ dry-configurable (1.3.0)
25
+ dry-core (~> 1.1)
26
+ zeitwerk (~> 2.6)
27
+ dry-core (1.1.0)
28
+ concurrent-ruby (~> 1.0)
29
+ logger
30
+ zeitwerk (~> 2.6)
31
+ dry-inflector (1.2.0)
32
+ dry-initializer (3.2.0)
33
+ dry-logic (1.6.0)
34
+ bigdecimal
35
+ concurrent-ruby (~> 1.0)
36
+ dry-core (~> 1.1)
37
+ zeitwerk (~> 2.6)
38
+ dry-schema (1.13.4)
39
+ concurrent-ruby (~> 1.0)
40
+ dry-configurable (~> 1.0, >= 1.0.1)
41
+ dry-core (~> 1.0, < 2)
42
+ dry-initializer (~> 3.0)
43
+ dry-logic (>= 1.4, < 2)
44
+ dry-types (>= 1.7, < 2)
45
+ zeitwerk (~> 2.6)
46
+ dry-types (1.8.2)
47
+ bigdecimal (~> 3.0)
48
+ concurrent-ruby (~> 1.0)
49
+ dry-core (~> 1.0)
50
+ dry-inflector (~> 1.0)
51
+ dry-logic (~> 1.4)
52
+ zeitwerk (~> 2.6)
24
53
  faraday (2.12.2)
25
54
  faraday-net_http (>= 2.0, < 3.5)
26
55
  json
@@ -69,7 +98,7 @@ GEM
69
98
  rexml (>= 3.3.9)
70
99
  kramdown-parser-gfm (1.1.0)
71
100
  kramdown (~> 2.0)
72
- kwalify (0.7.2)
101
+ language_server-protocol (3.17.0.4)
73
102
  logger (1.6.5)
74
103
  mini_mime (1.1.5)
75
104
  mini_portile2 (2.8.8)
@@ -80,45 +109,48 @@ GEM
80
109
  nokogiri (1.18.2)
81
110
  mini_portile2 (~> 2.8.2)
82
111
  racc (~> 1.4)
112
+ observer (0.1.2)
83
113
  os (1.1.4)
114
+ ostruct (0.6.1)
84
115
  parallel (1.26.3)
85
- parser (2.7.2.0)
116
+ parser (3.3.7.1)
86
117
  ast (~> 2.4.1)
87
- psych (3.3.4)
118
+ racc
88
119
  public_suffix (6.0.1)
89
120
  racc (1.8.1)
90
121
  rainbow (3.1.1)
91
122
  rake (12.3.3)
92
- reek (6.0.2)
93
- kwalify (~> 0.7.0)
94
- parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
95
- psych (~> 3.1)
123
+ rbs (3.8.1)
124
+ logger
125
+ reek (6.4.0)
126
+ dry-schema (~> 1.13.0)
127
+ logger (~> 1.6)
128
+ parser (~> 3.3.0)
96
129
  rainbow (>= 2.0, < 4.0)
130
+ rexml (~> 3.1)
97
131
  regexp_parser (2.10.0)
98
132
  representable (3.2.0)
99
133
  declarative (< 0.1.0)
100
134
  trailblazer-option (>= 0.1.1, < 0.2.0)
101
135
  uber (< 0.2.0)
102
136
  retriable (3.1.2)
103
- reverse_markdown (2.1.1)
137
+ reverse_markdown (3.0.0)
104
138
  nokogiri
105
139
  rexml (3.4.0)
106
- rubocop (1.7.0)
140
+ rubocop (1.71.2)
141
+ json (~> 2.3)
142
+ language_server-protocol (>= 3.17.0)
107
143
  parallel (~> 1.10)
108
- parser (>= 2.7.1.5)
144
+ parser (>= 3.3.0.2)
109
145
  rainbow (>= 2.2.2, < 4.0)
110
- regexp_parser (>= 1.8, < 3.0)
111
- rexml
112
- rubocop-ast (>= 1.2.0, < 2.0)
146
+ regexp_parser (>= 2.9.3, < 3.0)
147
+ rubocop-ast (>= 1.38.0, < 2.0)
113
148
  ruby-progressbar (~> 1.7)
114
- unicode-display_width (>= 1.4.0, < 2.0)
115
- rubocop-ast (1.4.1)
116
- parser (>= 2.7.1.5)
149
+ unicode-display_width (>= 2.4.0, < 4.0)
150
+ rubocop-ast (1.38.0)
151
+ parser (>= 3.3.1.0)
117
152
  rubocop-rake (0.6.0)
118
153
  rubocop (~> 1.0)
119
- ruby-lint (2.3.1)
120
- parser (~> 2.2)
121
- slop (~> 3.4, >= 3.4.7)
122
154
  ruby-progressbar (1.13.0)
123
155
  rufo (0.18.0)
124
156
  signet (0.19.0)
@@ -126,18 +158,21 @@ GEM
126
158
  faraday (>= 0.17.5, < 3.a)
127
159
  jwt (>= 1.5, < 3.0)
128
160
  multi_json (~> 1.10)
129
- slop (3.6.0)
130
- solargraph (0.40.1)
131
- backport (~> 1.1)
161
+ solargraph (0.51.2)
162
+ backport (~> 1.2)
132
163
  benchmark
133
- bundler (>= 1.17.2)
134
- e2mmap
135
- jaro_winkler (~> 1.5)
164
+ bundler (~> 2.0)
165
+ diff-lcs (~> 1.4)
166
+ jaro_winkler (~> 1.6)
136
167
  kramdown (~> 2.3)
137
168
  kramdown-parser-gfm (~> 1.1)
138
- parser (~> 2.3)
139
- reverse_markdown (>= 1.0.5, < 3)
140
- rubocop (>= 0.52)
169
+ logger (~> 1.6)
170
+ observer (~> 0.1)
171
+ ostruct (~> 0.6)
172
+ parser (~> 3.0)
173
+ rbs (~> 3.0)
174
+ reverse_markdown (>= 2.0, < 4)
175
+ rubocop (~> 1.38)
141
176
  thor (~> 1.0)
142
177
  tilt (~> 2.0)
143
178
  yard (~> 0.9, >= 0.9.24)
@@ -145,9 +180,12 @@ GEM
145
180
  tilt (2.6.0)
146
181
  trailblazer-option (0.1.2)
147
182
  uber (0.1.0)
148
- unicode-display_width (1.8.0)
183
+ unicode-display_width (3.1.4)
184
+ unicode-emoji (~> 4.0, >= 4.0.4)
185
+ unicode-emoji (4.0.4)
149
186
  uri (1.0.2)
150
187
  yard (0.9.37)
188
+ zeitwerk (2.6.18)
151
189
 
152
190
  PLATFORMS
153
191
  x86_64-linux
@@ -159,7 +197,6 @@ DEPENDENCIES
159
197
  reek
160
198
  rubocop
161
199
  rubocop-rake
162
- ruby-lint
163
200
  rufo
164
201
  solargraph
165
202
  yard
data/cns.gemspec CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency('reek')
32
32
  spec.add_development_dependency('rubocop')
33
33
  spec.add_development_dependency('rubocop-rake')
34
- spec.add_development_dependency('ruby-lint')
35
34
  spec.add_development_dependency('rufo')
36
35
  spec.add_development_dependency('solargraph')
37
36
  spec.add_development_dependency('yard')
data/lib/cns/apibc.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require("faraday")
4
- require("json")
3
+ require('faraday')
4
+ require('json')
5
5
 
6
6
  # @author Hernani Rodrigues Vaz
7
7
  module Cns
@@ -11,15 +11,15 @@ module Cns
11
11
  # @param addresses [Array<String>] List of ETH addresses (max 20)
12
12
  # @return [Array<Hash>] List of addresses with balances
13
13
  def account_es(addresses)
14
- response = etherscan_req("balancemulti", addresses.join(","), 1, tag: "latest")
15
- response[:status] == "1" ? response.dig(:result) : []
14
+ response = etherscan_req('balancemulti', addresses.join(','), 1, tag: 'latest')
15
+ response[:status] == '1' ? response.dig(:result) : []
16
16
  end
17
17
 
18
18
  # Get EOS account information
19
19
  # @param address [String] EOS account name
20
20
  # @return [Hash] Account details with resources
21
21
  def account_gm(address)
22
- response = greymass_req("/v1/chain/get_account", { account_name: address })
22
+ response = greymass_req('/v1/chain/get_account', { account_name: address })
23
23
  response || { core_liquid_balance: 0, total_resources: { net_weight: 0, cpu_weight: 0 } }
24
24
  end
25
25
 
@@ -27,35 +27,35 @@ module Cns
27
27
  # @param [String] address endereco ETH
28
28
  # @return [Array<Hash>] lista transacoes normais etherscan
29
29
  def norml_es(address)
30
- pag_etherscan_req("txlist", address)
30
+ pag_etherscan_req('txlist', address)
31
31
  end
32
32
 
33
33
  # Get internal transactions for ETH address
34
34
  # @param (see norml_es)
35
35
  # @return [Array<Hash>] lista transacoes internas etherscan
36
36
  def inter_es(address)
37
- pag_etherscan_req("txlistinternal", address)
37
+ pag_etherscan_req('txlistinternal', address)
38
38
  end
39
39
 
40
40
  # Get mined blocks for ETH address
41
41
  # @param (see norml_es)
42
42
  # @return [Array<Hash>] lista blocos etherscan
43
43
  def block_es(address)
44
- pag_etherscan_req("getminedblocks", address, blocktype: "blocks")
44
+ pag_etherscan_req('getminedblocks', address, blocktype: 'blocks')
45
45
  end
46
46
 
47
47
  # Get withdrawals for ETH address
48
48
  # @param (see norml_es)
49
49
  # @return [Array<Hash>] lista blocos etherscan
50
50
  def withw_es(address)
51
- pag_etherscan_req("txsBeaconWithdrawal", address)
51
+ pag_etherscan_req('txsBeaconWithdrawal', address)
52
52
  end
53
53
 
54
54
  # Get token transfers for ETH address
55
55
  # @param (see norml_es)
56
56
  # @return [Array<Hash>] lista token transfer events etherscan
57
57
  def token_es(address)
58
- pag_etherscan_req("tokentx", address)
58
+ pag_etherscan_req('tokentx', address)
59
59
  end
60
60
 
61
61
  # Get complete transaction history for EOS account
@@ -65,7 +65,7 @@ module Cns
65
65
  actions = []
66
66
  pos = 0
67
67
  loop do
68
- response = greymass_req("/v1/history/get_actions", { account_name: address, pos: pos, offset: 100 })
68
+ response = greymass_req('/v1/history/get_actions', { account_name: address, pos: pos, offset: 100 })
69
69
  batch = response[:actions] || []
70
70
  actions += batch
71
71
  break if batch.size < 100
@@ -80,23 +80,27 @@ module Cns
80
80
  # Reusable Faraday connection
81
81
  def connection(base_url)
82
82
  Faraday.new(base_url) do |conn|
83
- conn.headers = { content_type: "application/json", accept: "application/json", user_agent: "blockchain-api-client" }
84
- conn.adapter Faraday.default_adapter
83
+ conn.headers = {
84
+ content_type: 'application/json',
85
+ accept: 'application/json',
86
+ user_agent: 'blockchain-api-client'
87
+ }
88
+ conn.adapter(Faraday.default_adapter)
85
89
  end
86
90
  end
87
91
 
88
92
  # Generic Etherscan API request handler
89
93
  def etherscan_req(action, address, page = 1, params = {})
90
94
  params = {
91
- module: "account",
95
+ module: 'account',
92
96
  action: action,
93
97
  address: address,
94
98
  page: page,
95
- apikey: ENV.fetch("ETHERSCAN_API_KEY"),
99
+ apikey: ENV.fetch('ETHERSCAN_API_KEY')
96
100
  }.merge(params)
97
- parse_json(connection("https://api.etherscan.io").get("/api", params).body)
101
+ parse_json(connection('https://api.etherscan.io').get('/api', params).body)
98
102
  rescue Faraday::Error, JSON::ParserError
99
- { status: "0", result: [] }
103
+ { status: '0', result: [] }
100
104
  end
101
105
 
102
106
  # Generic method for paginated Etherscan requests
@@ -109,11 +113,11 @@ module Cns
109
113
  page = 1
110
114
  loop do
111
115
  response = etherscan_req(action, address, page, params)
112
- break unless response[:status] == "1"
116
+ break unless response[:status] == '1'
113
117
 
114
118
  batch = response[:result] || []
115
119
  results += batch
116
- break if batch.size < 10000
120
+ break if batch.size < 10_000
117
121
 
118
122
  page += 1
119
123
  end
@@ -122,7 +126,7 @@ module Cns
122
126
 
123
127
  # Generic Greymass API request handler
124
128
  def greymass_req(endpoint, payload)
125
- parse_json((connection("https://eos.greymass.com").post(endpoint) { |req| req.body = payload.to_json }).body)
129
+ parse_json((connection('https://eos.greymass.com').post(endpoint) { |req| req.body = payload.to_json }).body)
126
130
  rescue Faraday::Error, JSON::ParserError
127
131
  nil
128
132
  end
data/lib/cns/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cns
4
- VERSION = '0.7.7'
4
+ VERSION = '0.7.9'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: ruby-lint
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rufo
99
85
  requirement: !ruby/object:Gem::Requirement