cns 0.1.8 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc5b551cbe1640989e78c17c34c848e288c2e4f4362728b80f1f66b105b37330
4
- data.tar.gz: 2dc4fa72a53d44b8414e22c5e823de2536acfdf2d44ba4f91ab13819264db712
3
+ metadata.gz: 9a70e8085779d5be20a45b77233bbd04bda60b4d22ccda0e61cc13fdd582b3a9
4
+ data.tar.gz: fb49057ca707701b388da3021f54b8ad71156ddd56cb7eaa8c2922c5a9c726cc
5
5
  SHA512:
6
- metadata.gz: 338cefa7800ece67c7b846a14b14aae3613cf510362a68fb41c3684216c7cc09108ca5386f94b423731435787c2de5c6bca8318ff30ff8b9ff860c76dec52f44
7
- data.tar.gz: 9541c7a135edfb7a272b3118083714c4629b5ef46b065db710f32c41791f9385a3b75188521b123db6a699605b00ec3c27de71b9cdfaf8f398f70e3419ad7c70
6
+ metadata.gz: db35460753d91513de88101fc89b331cbfea04abf06d7e350287b8be3022fb5cca2056d773dc2a4de4979eadb21b7b54157a76291c524473c911477d8c454566
7
+ data.tar.gz: b3874d81594d8f1a26162a1348d3c4e502ced917e277385b8da6ce813c4303281c4c087cd4ed5b72e69282eb7a8c759e558fc6be5a59e8f2eb15b405ef74e93f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cns (0.1.8)
4
+ cns (0.2.4)
5
5
  curb
6
6
  faraday
7
7
  google-cloud-bigquery
@@ -12,10 +12,10 @@ GEM
12
12
  specs:
13
13
  addressable (2.7.0)
14
14
  public_suffix (>= 2.0.2, < 5.0)
15
- ast (2.4.1)
15
+ ast (2.4.2)
16
16
  backport (1.1.2)
17
17
  benchmark (0.1.1)
18
- concurrent-ruby (1.1.7)
18
+ concurrent-ruby (1.1.8)
19
19
  curb (0.9.11)
20
20
  declarative (0.0.20)
21
21
  declarative-option (0.1.0)
@@ -24,19 +24,22 @@ GEM
24
24
  faraday-net_http (~> 1.0)
25
25
  multipart-post (>= 1.2, < 3)
26
26
  ruby2_keywords
27
- faraday-net_http (1.0.0)
28
- google-api-client (0.52.0)
27
+ faraday-net_http (1.0.1)
28
+ google-apis-bigquery_v2 (0.2.0)
29
+ google-apis-core (~> 0.1)
30
+ google-apis-core (0.2.1)
29
31
  addressable (~> 2.5, >= 2.5.1)
30
- googleauth (~> 0.9)
32
+ googleauth (~> 0.14)
31
33
  httpclient (>= 2.8.1, < 3.0)
32
34
  mini_mime (~> 1.0)
33
35
  representable (~> 3.0)
34
36
  retriable (>= 2.0, < 4.0)
35
37
  rexml
36
- signet (~> 0.12)
37
- google-cloud-bigquery (1.25.0)
38
+ signet (~> 0.14)
39
+ webrick
40
+ google-cloud-bigquery (1.26.0)
38
41
  concurrent-ruby (~> 1.0)
39
- google-api-client (~> 0.47)
42
+ google-apis-bigquery_v2 (~> 0.1)
40
43
  google-cloud-core (~> 1.2)
41
44
  googleauth (~> 0.9)
42
45
  mini_mime (~> 1.0)
@@ -46,7 +49,7 @@ GEM
46
49
  google-cloud-env (1.4.0)
47
50
  faraday (>= 0.17.3, < 2.0)
48
51
  google-cloud-errors (1.0.1)
49
- googleauth (0.14.0)
52
+ googleauth (0.15.1)
50
53
  faraday (>= 0.17.3, < 2.0)
51
54
  jwt (>= 1.4, < 3.0)
52
55
  memoist (~> 0.16)
@@ -71,16 +74,16 @@ GEM
71
74
  racc (~> 1.4)
72
75
  os (1.1.1)
73
76
  parallel (1.20.1)
74
- parser (2.7.2.0)
77
+ parser (3.0.0.0)
75
78
  ast (~> 2.4.1)
76
79
  psych (3.3.0)
77
80
  public_suffix (4.0.6)
78
81
  racc (1.5.2)
79
82
  rainbow (3.0.0)
80
83
  rake (12.3.3)
81
- reek (6.0.2)
84
+ reek (6.0.3)
82
85
  kwalify (~> 0.7.0)
83
- parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
86
+ parser (~> 3.0.0)
84
87
  psych (~> 3.1)
85
88
  rainbow (>= 2.0, < 4.0)
86
89
  regexp_parser (2.0.3)
@@ -92,27 +95,27 @@ GEM
92
95
  reverse_markdown (2.0.0)
93
96
  nokogiri
94
97
  rexml (3.2.4)
95
- rubocop (1.7.0)
98
+ rubocop (1.9.1)
96
99
  parallel (~> 1.10)
97
- parser (>= 2.7.1.5)
100
+ parser (>= 3.0.0.0)
98
101
  rainbow (>= 2.2.2, < 4.0)
99
102
  regexp_parser (>= 1.8, < 3.0)
100
103
  rexml
101
104
  rubocop-ast (>= 1.2.0, < 2.0)
102
105
  ruby-progressbar (~> 1.7)
103
- unicode-display_width (>= 1.4.0, < 2.0)
104
- rubocop-ast (1.4.0)
106
+ unicode-display_width (>= 1.4.0, < 3.0)
107
+ rubocop-ast (1.4.1)
105
108
  parser (>= 2.7.1.5)
106
109
  rubocop-rake (0.5.1)
107
110
  rubocop
108
111
  ruby-progressbar (1.11.0)
109
- ruby2_keywords (0.0.2)
110
- signet (0.14.0)
112
+ ruby2_keywords (0.0.4)
113
+ signet (0.14.1)
111
114
  addressable (~> 2.3)
112
115
  faraday (>= 0.17.3, < 2.0)
113
116
  jwt (>= 1.5, < 3.0)
114
117
  multi_json (~> 1.10)
115
- solargraph (0.40.1)
118
+ solargraph (0.40.3)
116
119
  backport (~> 1.1)
117
120
  benchmark
118
121
  bundler (>= 1.17.2)
@@ -120,16 +123,17 @@ GEM
120
123
  jaro_winkler (~> 1.5)
121
124
  kramdown (~> 2.3)
122
125
  kramdown-parser-gfm (~> 1.1)
123
- parser (~> 2.3)
126
+ parser (~> 3.0)
124
127
  reverse_markdown (>= 1.0.5, < 3)
125
128
  rubocop (>= 0.52)
126
129
  thor (~> 1.0)
127
130
  tilt (~> 2.0)
128
131
  yard (~> 0.9, >= 0.9.24)
129
- thor (1.0.1)
132
+ thor (1.1.0)
130
133
  tilt (2.0.10)
131
134
  uber (0.1.0)
132
- unicode-display_width (1.7.0)
135
+ unicode-display_width (2.0.0)
136
+ webrick (1.7.0)
133
137
  yard (0.9.26)
134
138
 
135
139
  PLATFORMS
data/lib/cns/apibc.rb CHANGED
@@ -12,7 +12,7 @@ module Cns
12
12
  def data_bc(uri)
13
13
  res = JSON.parse(conn_bc.get(uri).body, symbolize_names: true)[:data] || []
14
14
  # calls are rate limited to 10 requests/minute/IP
15
- sleep(1.5)
15
+ sleep(3)
16
16
  res.is_a?(Array) ? res : [res]
17
17
  rescue StandardError
18
18
  []
data/lib/cns/bigquery1.rb CHANGED
@@ -55,38 +55,38 @@ module Cns
55
55
 
56
56
  # insere transacoes exchange kraken novas nas tabelas ust (trades), usl (ledger)
57
57
  def processa_us
58
- puts(format("%<n>2i TRADES KRAKEN INSERIDAS #{BD}.ust", n: apius.trades.empty? ? 0 : dml(ust_ins)))
59
- puts(format("%<n>2i LEDGER KRAKEN INSERIDAS #{BD}.usl", n: apius.ledger.empty? ? 0 : dml(usl_ins)))
58
+ puts(format("%<n>4i TRADES\tKRAKEN\t\tINSERIDAS ust", n: apius.trades.empty? ? 0 : dml(ust_ins)))
59
+ puts(format("%<n>4i LEDGER\tKRAKEN\t\tINSERIDAS usl", n: apius.ledger.empty? ? 0 : dml(usl_ins)))
60
60
  end
61
61
 
62
62
  # insere transacoes exchange bitcoinde novas nas tabelas det (trades), del (ledger)
63
63
  def processa_de
64
- puts(format("%<n>2i TRADES BITCOINDE INSERIDAS #{BD}.det", n: apide.trades.empty? ? 0 : dml(det_ins)))
65
- puts(format("%<n>2i LEDGER BITCOINDE INSERIDAS #{BD}.del", n: apide.ledger.empty? ? 0 : dml(del_ins)))
64
+ puts(format("%<n>4i TRADES\tBITCOINDE\tINSERIDAS det", n: apide.trades.empty? ? 0 : dml(det_ins)))
65
+ puts(format("%<n>4i LEDGER\tBITCOINDE\tINSERIDAS del", n: apide.ledger.empty? ? 0 : dml(del_ins)))
66
66
  end
67
67
 
68
68
  # insere transacoes exchange paymium/therock novas na tabela fr/mt (ledger)
69
69
  def processa_frmt
70
- puts(format("%<n>2i LEDGER PAYMIUM INSERIDAS #{BD}.fr", n: apifr.ledger.empty? ? 0 : dml(frl_ins)))
71
- puts(format("%<n>2i LEDGER THEROCK INSERIDAS #{BD}.mt", n: apimt.ledger.empty? ? 0 : dml(mtl_ins)))
70
+ puts(format("%<n>4i LEDGER\tPAYMIUM\t\tINSERIDAS fr", n: apifr.ledger.empty? ? 0 : dml(frl_ins)))
71
+ puts(format("%<n>4i LEDGER\tTHEROCK\t\tINSERIDAS mt", n: apimt.ledger.empty? ? 0 : dml(mtl_ins)))
72
72
  end
73
73
 
74
74
  # insere transacoes blockchain novas nas tabelas etht (norml), ethk (token)
75
75
  def processa_eth
76
- puts(format("%<n>2i TRANSACOES ETH INSERIDAS #{BD}.etht", n: apies.novtx.empty? ? 0 : dml(etht_ins)))
77
- puts(format("%<n>2i TOKEN EVENTS ETH INSERIDAS #{BD}.ethk", n: apies.novkx.empty? ? 0 : dml(ethk_ins)))
76
+ puts(format("%<n>4i TRANSACOES\tETH\t\tINSERIDAS etht", n: apies.novtx.empty? ? 0 : dml(etht_ins)))
77
+ puts(format("%<n>4i TOKENS\tETH\t\tINSERIDAS ethk", n: apies.novkx.empty? ? 0 : dml(ethk_ins)))
78
78
  end
79
79
 
80
80
  # insere transacoes blockchain novas na tabela eos
81
81
  def processa_eos
82
- puts(format("%<n>2i TRANSACOES EOS INSERIDAS #{BD}.eos ", n: apigm.novax.empty? ? 0 : dml(eost_ins)))
82
+ puts(format("%<n>4i TRANSACOES\tEOS\t\tINSERIDAS eos ", n: apigm.novax.empty? ? 0 : dml(eost_ins)))
83
83
  end
84
84
 
85
85
  # insere historico sados novos na tabela eth2bh
86
86
  def processa_bc
87
- # puts(format("%<n>2i ATTESTATIONS INSERIDAS #{BD}.eth2at", n: apibc.novtx.empty? ? 0 : dml(eth2at_ins)))
88
- # puts(format("%<n>2i PROPOSALS INSERIDAS #{BD}.eth2pr", n: apibc.novkx.empty? ? 0 : dml(eth2pr_ins)))
89
- puts(format("%<n>2i BALANCES INSERIDOS #{BD}.eth2bh", n: apibc.nov.empty? ? 0 : dml(eth2bh_ins)))
87
+ # puts(format("%<n>4i ATTESTATIONS INSERIDAS #{BD}.eth2at", n: apibc.novtx.empty? ? 0 : dml(eth2at_ins)))
88
+ # puts(format("%<n>4i PROPOSALS INSERIDAS #{BD}.eth2pr", n: apibc.novkx.empty? ? 0 : dml(eth2pr_ins)))
89
+ puts(format("%<n>4i BALANCES\tETH2\t\tINSERIDOS eth2bh", n: apibc.nov.empty? ? 0 : dml(eth2bh_ins)))
90
90
  end
91
91
 
92
92
  # cria job bigquery & verifica execucao
data/lib/cns/bigquery2.rb CHANGED
@@ -15,7 +15,7 @@ module Cns
15
15
  # @return [String] comando insert SQL formatado eth2bh
16
16
  def eth2bh_ins
17
17
  "insert #{BD}.eth2bh(balance,effectivebalance,epoch,validatorindex" \
18
- ") VALUES#{apibc.nov[0..900].map { |obj| eth2bh_1val(obj) }.join(',')}"
18
+ ") VALUES#{apibc.nov[0..1300].map { |obj| eth2bh_1val(obj) }.join(',')}"
19
19
  end
20
20
 
21
21
  # @return [Etherscan] API blockchain ETH
@@ -68,7 +68,7 @@ module Cns
68
68
  # @param [Hash] abc account etherscan
69
69
  # @return [Hash] dados etherscan - address, saldo & transacoes
70
70
  def base_bc(abc)
71
- acc = abc[:account]
71
+ acc = abc[:account].downcase
72
72
  {
73
73
  ax: acc,
74
74
  sl: (abc[:balance].to_d / 10**18).round(10),
@@ -99,7 +99,7 @@ module Cns
99
99
  def filtrar_tx(add, ary)
100
100
  # elimina transferencia from: (lax) to: (add) - esta transferencia aparece em from: (add) to: (lax)
101
101
  # elimina chaves irrelevantes (DL) & adiciona chave indice itx & adiciona identificador da carteira iax
102
- ary.delete_if { |odl| odl[:to] == add && lax.include?(odl[:from]) }
102
+ ary.delete_if { |odl| add.casecmp?(odl[:to]) && lax.include?(odl[:from].downcase) }
103
103
  .map { |omp| omp.delete_if { |key, _| DL.include?(key) }.merge(itx: Integer(omp[:blockNumber]), iax: add) }
104
104
  end
105
105
 
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.1.8'
4
+ VERSION = '0.2.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler