cns 0.5.0 → 0.5.2
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 +4 -4
- data/Gemfile.lock +26 -25
- data/lib/cns/bigquery.rb +74 -4
- data/lib/cns/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: 945dd20b4245b51bd2736cda926b78affcd6a94b6a55c9c6c99ff45b7920ed44
|
4
|
+
data.tar.gz: 0c343e3e1b3eab5e6c66e9e3680c7054440e694ba47fc0db80017424efc1f922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4dceeebc96a83d0074fa4b03c1c7b8e304d7d41c5ef1c78b138a238b25378c3958becf624946d79614c9cb3e0edf8e82e9f90429d0e41624bad75999852d8d30
|
7
|
+
data.tar.gz: 87b3a62bc1d9cb387ffa79a9eb6f0fc8a9832ed593596980a5743cd18fd2714d648e1caa788cded51cc3e0ab5c73fb0611f630e7a7db486d6b5f339976d34809
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cns (0.5.
|
4
|
+
cns (0.5.2)
|
5
5
|
curb
|
6
6
|
faraday
|
7
7
|
google-cloud-bigquery
|
@@ -16,39 +16,38 @@ GEM
|
|
16
16
|
backport (1.2.0)
|
17
17
|
base64 (0.2.0)
|
18
18
|
benchmark (0.3.0)
|
19
|
-
concurrent-ruby (1.2.
|
19
|
+
concurrent-ruby (1.2.3)
|
20
20
|
curb (1.0.5)
|
21
21
|
declarative (0.0.20)
|
22
22
|
e2mmap (0.1.0)
|
23
|
-
faraday (2.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
google-apis-core (0.11.2)
|
23
|
+
faraday (2.9.0)
|
24
|
+
faraday-net_http (>= 2.0, < 3.2)
|
25
|
+
faraday-net_http (3.1.0)
|
26
|
+
net-http
|
27
|
+
google-apis-bigquery_v2 (0.65.0)
|
28
|
+
google-apis-core (>= 0.14.0, < 2.a)
|
29
|
+
google-apis-core (0.14.0)
|
31
30
|
addressable (~> 2.5, >= 2.5.1)
|
32
|
-
googleauth (
|
31
|
+
googleauth (~> 1.9)
|
33
32
|
httpclient (>= 2.8.1, < 3.a)
|
34
33
|
mini_mime (~> 1.0)
|
35
34
|
representable (~> 3.0)
|
36
35
|
retriable (>= 2.0, < 4.a)
|
37
36
|
rexml
|
38
|
-
|
39
|
-
google-cloud-bigquery (1.45.0)
|
37
|
+
google-cloud-bigquery (1.48.1)
|
40
38
|
concurrent-ruby (~> 1.0)
|
41
|
-
google-apis-bigquery_v2 (~> 0.
|
39
|
+
google-apis-bigquery_v2 (~> 0.62)
|
40
|
+
google-apis-core (~> 0.13)
|
42
41
|
google-cloud-core (~> 1.6)
|
43
|
-
googleauth (
|
42
|
+
googleauth (~> 1.9)
|
44
43
|
mini_mime (~> 1.0)
|
45
44
|
google-cloud-core (1.6.1)
|
46
45
|
google-cloud-env (>= 1.0, < 3.a)
|
47
46
|
google-cloud-errors (~> 1.0)
|
48
|
-
google-cloud-env (2.1.
|
47
|
+
google-cloud-env (2.1.1)
|
49
48
|
faraday (>= 1.0, < 3.a)
|
50
49
|
google-cloud-errors (1.3.1)
|
51
|
-
googleauth (1.
|
50
|
+
googleauth (1.11.0)
|
52
51
|
faraday (>= 1.0, < 3.a)
|
53
52
|
google-cloud-env (~> 2.1)
|
54
53
|
jwt (>= 1.4, < 3.0)
|
@@ -57,7 +56,8 @@ GEM
|
|
57
56
|
signet (>= 0.16, < 2.a)
|
58
57
|
httpclient (2.8.3)
|
59
58
|
jaro_winkler (1.5.6)
|
60
|
-
jwt (2.
|
59
|
+
jwt (2.8.1)
|
60
|
+
base64
|
61
61
|
kramdown (2.4.0)
|
62
62
|
rexml
|
63
63
|
kramdown-parser-gfm (1.1.0)
|
@@ -65,7 +65,9 @@ GEM
|
|
65
65
|
kwalify (0.7.2)
|
66
66
|
mini_mime (1.1.5)
|
67
67
|
multi_json (1.15.0)
|
68
|
-
|
68
|
+
net-http (0.4.1)
|
69
|
+
uri
|
70
|
+
nokogiri (1.16.2-x86_64-linux)
|
69
71
|
racc (~> 1.4)
|
70
72
|
os (1.1.4)
|
71
73
|
parallel (1.24.0)
|
@@ -81,7 +83,7 @@ GEM
|
|
81
83
|
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
82
84
|
psych (~> 3.1)
|
83
85
|
rainbow (>= 2.0, < 4.0)
|
84
|
-
regexp_parser (2.
|
86
|
+
regexp_parser (2.9.0)
|
85
87
|
representable (3.2.0)
|
86
88
|
declarative (< 0.1.0)
|
87
89
|
trailblazer-option (>= 0.1.1, < 0.2.0)
|
@@ -107,8 +109,7 @@ GEM
|
|
107
109
|
parser (~> 2.2)
|
108
110
|
slop (~> 3.4, >= 3.4.7)
|
109
111
|
ruby-progressbar (1.13.0)
|
110
|
-
|
111
|
-
signet (0.18.0)
|
112
|
+
signet (0.19.0)
|
112
113
|
addressable (~> 2.8)
|
113
114
|
faraday (>= 0.17.5, < 3.a)
|
114
115
|
jwt (>= 1.5, < 3.0)
|
@@ -128,13 +129,13 @@ GEM
|
|
128
129
|
thor (~> 1.0)
|
129
130
|
tilt (~> 2.0)
|
130
131
|
yard (~> 0.9, >= 0.9.24)
|
131
|
-
thor (1.3.
|
132
|
+
thor (1.3.1)
|
132
133
|
tilt (2.3.0)
|
133
134
|
trailblazer-option (0.1.2)
|
134
135
|
uber (0.1.0)
|
135
136
|
unicode-display_width (1.8.0)
|
136
|
-
|
137
|
-
yard (0.9.
|
137
|
+
uri (0.13.0)
|
138
|
+
yard (0.9.36)
|
138
139
|
|
139
140
|
PLATFORMS
|
140
141
|
x86_64-linux
|
data/lib/cns/bigquery.rb
CHANGED
@@ -53,24 +53,33 @@ module Cns
|
|
53
53
|
apies.mostra_resumo
|
54
54
|
end
|
55
55
|
|
56
|
+
# @return [String] texto inicial transacoes
|
57
|
+
def trs_ini
|
58
|
+
Time.now.strftime("TRANSACOES %Y-%m-%d %H:%M:%S ")
|
59
|
+
end
|
60
|
+
|
56
61
|
# insere (caso existam) dados novos kraken/bitcoinde/paymium/therock/etherscan/greymass/beaconchain no bigquery
|
57
62
|
def processa_tudo
|
58
|
-
|
63
|
+
str = processa_us + ", " + processa_de + ", " + processa_eth + ", " + processa_eos
|
64
|
+
puts(trs_ini + str)
|
59
65
|
end
|
60
66
|
|
61
67
|
# insere (caso existam) dados novos kraken/etherscan no bigquery
|
62
68
|
def processa_wkrk
|
63
|
-
|
69
|
+
str = processa_us + ", " + processa_eth
|
70
|
+
puts(trs_ini + str)
|
64
71
|
end
|
65
72
|
|
66
73
|
# insere (caso existam) dados novos etherscan no bigquery
|
67
74
|
def processa_weth
|
68
|
-
|
75
|
+
str = processa_eth
|
76
|
+
puts(trs_ini + str)
|
69
77
|
end
|
70
78
|
|
71
79
|
# insere (caso existam) dados novos etherscan no bigquery (output to file)
|
72
80
|
def processa_ceth
|
73
|
-
|
81
|
+
str = processa_ethc
|
82
|
+
File.open(FO, mode: 'a') { |out| out.puts(trs_ini + str) }
|
74
83
|
end
|
75
84
|
|
76
85
|
private
|
@@ -88,6 +97,19 @@ module Cns
|
|
88
97
|
str
|
89
98
|
end
|
90
99
|
|
100
|
+
# insere transacoes blockchain novas nas tabelas etht (norml), ethi (internas), ethp (block), ethw (withdrawals), ethk (token)
|
101
|
+
#
|
102
|
+
# @return [String] linhas & tabelas afetadas
|
103
|
+
def processa_ethc
|
104
|
+
str = "ETH"
|
105
|
+
str += format(" %<n>i etht", n: dml(ethtc_ins)) if apiesc.novtx.count > 0
|
106
|
+
str += format(" %<n>i ethi", n: dml(ethic_ins)) if apiesc.novix.count > 0
|
107
|
+
str += format(" %<n>i ethp", n: dml(ethpc_ins)) if apiesc.novpx.count > 0
|
108
|
+
str += format(" %<n>i ethw", n: dml(ethwc_ins)) if apiesc.novwx.count > 0
|
109
|
+
str += format(" %<n>i ethk", n: dml(ethkc_ins)) if apiesc.novkx.count > 0
|
110
|
+
str
|
111
|
+
end
|
112
|
+
|
91
113
|
# insere transacoes exchange kraken novas nas tabelas ust (trades), usl (ledger)
|
92
114
|
#
|
93
115
|
# @return [String] linhas & tabelas afetadas
|
@@ -185,6 +207,21 @@ module Cns
|
|
185
207
|
)
|
186
208
|
end
|
187
209
|
|
210
|
+
# @return [Etherscan] API blockchain ETH
|
211
|
+
def apiesc
|
212
|
+
@apies ||= Etherscan.new(
|
213
|
+
{
|
214
|
+
wb: sql("select * from #{BD}.walletEthc order by 2"),
|
215
|
+
nt: sql("select itx,iax from #{BD}.ethtxc"),
|
216
|
+
ni: sql("select itx,iax from #{BD}.ethixc"),
|
217
|
+
np: sql("select itx,iax from #{BD}.ethpxc"),
|
218
|
+
nw: sql("select itx,iax from #{BD}.ethwxc"),
|
219
|
+
nk: sql("select itx,iax from #{BD}.ethkxc")
|
220
|
+
},
|
221
|
+
ops
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
188
225
|
# @return [Greymass] API blockchain EOS
|
189
226
|
def apigm
|
190
227
|
@apigm ||= Greymass.new(
|
@@ -286,6 +323,39 @@ module Cns
|
|
286
323
|
") VALUES#{apies.novkx.map { |obj| ethk_1val(obj) }.join(',')}"
|
287
324
|
end
|
288
325
|
|
326
|
+
# @return [String] comando insert SQL formatado etht (norml)
|
327
|
+
def ethtc_ins
|
328
|
+
"insert #{BD}.etht(blocknumber,timestamp,txhash,nonce,blockhash,transactionindex,axfrom,axto,iax," \
|
329
|
+
'value,gas,gasprice,gasused,iserror,txreceipt_status,input,contractaddress,dias' \
|
330
|
+
") VALUES#{apiesc.novtx.map { |obj| etht_1val(obj) }.join(',')}"
|
331
|
+
end
|
332
|
+
|
333
|
+
# @return [String] comando insert SQL formatado ethi (internas)
|
334
|
+
def ethic_ins
|
335
|
+
"insert #{BD}.ethi(blocknumber,timestamp,txhash,axfrom,axto,iax," \
|
336
|
+
'value,contractaddress,input,type,gas,gasused,traceid,iserror,errcode' \
|
337
|
+
") VALUES#{apiesc.novix.map { |obj| ethi_1val(obj) }.join(',')}"
|
338
|
+
end
|
339
|
+
|
340
|
+
# @return [String] comando insert SQL formatado ethp (block)
|
341
|
+
def ethpc_ins
|
342
|
+
"insert #{BD}.ethp(blocknumber,timestamp,blockreward,iax" \
|
343
|
+
") VALUES#{apiesc.novpx.map { |obj| ethp_1val(obj) }.join(',')}"
|
344
|
+
end
|
345
|
+
|
346
|
+
# @return [String] comando insert SQL formatado ethw (withdrawals)
|
347
|
+
def ethwc_ins
|
348
|
+
"insert #{BD}.ethw(withdrawalindex,validatorindex,address,amount,blocknumber,timestamp" \
|
349
|
+
") VALUES#{apiesc.novwx.map { |obj| ethw_1val(obj) }.join(',')}"
|
350
|
+
end
|
351
|
+
|
352
|
+
# @return [String] comando insert SQL formatado ethk (token)
|
353
|
+
def ethkc_ins
|
354
|
+
"insert #{BD}.ethk(blocknumber,timestamp,txhash,nonce,blockhash,transactionindex,axfrom,axto,iax," \
|
355
|
+
'value,tokenname,tokensymbol,tokendecimal,gas,gasprice,gasused,input,contractaddress,dias' \
|
356
|
+
") VALUES#{apiesc.novkx.map { |obj| ethk_1val(obj) }.join(',')}"
|
357
|
+
end
|
358
|
+
|
289
359
|
# @return [String] comando insert SQL formatado eos
|
290
360
|
def eost_ins
|
291
361
|
"insert #{BD}.eos(gseq,aseq,bnum,time,contract,action,acfrom,acto,iax,amount,moeda,memo,dias" \
|
data/lib/cns/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.2
|
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:
|
11
|
+
date: 2024-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|