eost 0.1.7 → 0.1.8

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: f79eb35d883b871bbd370682b429b7ba9d1c896a920cae2fbd4e41a7c9fc2efb
4
- data.tar.gz: 19222f4fb970eda3a9c613aeb3c5c018021b25185b017f244f3f0bdba8b24bef
3
+ metadata.gz: 687e12616155b4451efb922e845a2453e7faf4c40d9256b4276aa694af26caf8
4
+ data.tar.gz: 6351df02bb6e4b34aec4fb644b53ddd7613b2541c2a4ba41134e00ba66572f0b
5
5
  SHA512:
6
- metadata.gz: eecc576af4854d0c8aedccf074a28312d7d6c40bbc8d7228242b7bd10b815088857fb562f940fca7b7dc6ba516ea6fcf9974d5152a320ba3b109a5df585abfb5
7
- data.tar.gz: 70085889413a588a8b75c34b634b547b3549dbe5290bddf407eaf6eda0af95df03cf8ddfce8b25974744833cd49a651f96223b12f351d296b502b024a7479865
6
+ metadata.gz: ae002efa0379cf084560a1a6e835d9777291bb35c499748bdb1506fea26b2cb36524179d1919b068bfdc9534c79830072b3de1fa371b8a58098f94ccfd242223
7
+ data.tar.gz: 276a420aefee6ac02c4b6a624757a19971d14ef759f2b4887b608f787d0aa7c3d337ad6ec91bc8166696e888456bb03e5725d0b9c45e904a17066d0e54ba91b9
@@ -0,0 +1,12 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.7
3
+ EnabledByDefault: true
4
+
5
+ Style/Copyright:
6
+ Enabled: false
7
+
8
+ Lint/ConstantResolution:
9
+ Enabled: false
10
+
11
+ Style/ConstantVisibility:
12
+ Enabled: false
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eost (0.1.7)
4
+ eost (0.1.8)
5
5
  google-cloud-bigquery
6
6
  roo
7
7
  thor
@@ -12,12 +12,12 @@ GEM
12
12
  specs:
13
13
  addressable (2.7.0)
14
14
  public_suffix (>= 2.0.2, < 5.0)
15
- concurrent-ruby (1.1.6)
16
- declarative (0.0.10)
15
+ concurrent-ruby (1.1.7)
16
+ declarative (0.0.20)
17
17
  declarative-option (0.1.0)
18
18
  faraday (1.0.1)
19
19
  multipart-post (>= 1.2, < 3)
20
- google-api-client (0.38.0)
20
+ google-api-client (0.43.0)
21
21
  addressable (~> 2.5, >= 2.5.1)
22
22
  googleauth (~> 0.9)
23
23
  httpclient (>= 2.8.1, < 3.0)
@@ -25,7 +25,7 @@ GEM
25
25
  representable (~> 3.0)
26
26
  retriable (>= 2.0, < 4.0)
27
27
  signet (~> 0.12)
28
- google-cloud-bigquery (1.21.0)
28
+ google-cloud-bigquery (1.21.2)
29
29
  concurrent-ruby (~> 1.0)
30
30
  google-api-client (~> 0.33)
31
31
  google-cloud-core (~> 1.2)
@@ -34,10 +34,10 @@ GEM
34
34
  google-cloud-core (1.5.0)
35
35
  google-cloud-env (~> 1.0)
36
36
  google-cloud-errors (~> 1.0)
37
- google-cloud-env (1.3.1)
37
+ google-cloud-env (1.3.3)
38
38
  faraday (>= 0.17.3, < 2.0)
39
- google-cloud-errors (1.0.0)
40
- googleauth (0.12.0)
39
+ google-cloud-errors (1.0.1)
40
+ googleauth (0.13.1)
41
41
  faraday (>= 0.17.3, < 2.0)
42
42
  jwt (>= 1.4, < 3.0)
43
43
  memoist (~> 0.16)
@@ -45,16 +45,16 @@ GEM
45
45
  os (>= 0.9, < 2.0)
46
46
  signet (~> 0.14)
47
47
  httpclient (2.8.3)
48
- jwt (2.2.1)
48
+ jwt (2.2.2)
49
49
  memoist (0.16.2)
50
50
  mini_mime (1.0.2)
51
51
  mini_portile2 (2.4.0)
52
- multi_json (1.14.1)
52
+ multi_json (1.15.0)
53
53
  multipart-post (2.1.1)
54
- nokogiri (1.10.9)
54
+ nokogiri (1.10.10)
55
55
  mini_portile2 (~> 2.4.0)
56
- os (1.1.0)
57
- public_suffix (4.0.4)
56
+ os (1.1.1)
57
+ public_suffix (4.0.5)
58
58
  rake (12.3.3)
59
59
  representable (3.0.4)
60
60
  declarative (< 0.1.0)
@@ -72,7 +72,7 @@ GEM
72
72
  multi_json (~> 1.10)
73
73
  thor (1.0.1)
74
74
  uber (0.1.0)
75
- yard (0.9.24)
75
+ yard (0.9.25)
76
76
 
77
77
  PLATFORMS
78
78
  ruby
data/README.md CHANGED
@@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
32
 
33
33
  ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/eost. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/eost/blob/master/CODE_OF_CONDUCT.md).
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hernanirvaz/eost. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/hernanirvaz/eost/blob/master/CODE_OF_CONDUCT.md).
36
36
 
37
37
 
38
38
  ## License
@@ -41,4 +41,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
41
41
 
42
42
  ## Code of Conduct
43
43
 
44
- Everyone interacting in the Eost project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/eost/blob/master/CODE_OF_CONDUCT.md).
44
+ Everyone interacting in the Eost project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hernanirvaz/eost/blob/master/CODE_OF_CONDUCT.md).
@@ -11,8 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.license = 'MIT'
12
12
 
13
13
  spec.summary = 'Arquiva eos-transactions.csv no bigquery.'
14
- spec.description = spec.summary +
15
- ' Pode apagar movimentos existentes ja no bigquery.'
14
+ spec.description = spec.summary + ' Pode apagar movimentos existentes ja no bigquery.'
16
15
 
17
16
  spec.metadata['homepage_uri'] = spec.homepage
18
17
  spec.metadata['yard.run'] = 'yard'
@@ -22,8 +21,7 @@ Gem::Specification.new do |spec|
22
21
  # Specify which files should be added to the gem when it is released.
23
22
  # The `git ls-files -z` loads files in RubyGem that have been added into git.
24
23
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0")
26
- .reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
25
  end
28
26
  spec.bindir = 'exe'
29
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -1,9 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
4
- require 'eost/bigquery'
5
- require 'eost/folhacalculo'
6
- require 'eost/version'
3
+ require('thor')
4
+ require('eost/bigquery')
5
+ require('eost/carteiras')
6
+ require('eost/eosscan')
7
+ require('eost/folhacalculo')
8
+ require('eost/formatar')
9
+ require('eost/version')
7
10
 
8
11
  # @author Hernani Rodrigues Vaz
9
12
  module Eost
@@ -13,34 +16,43 @@ module Eost
13
16
 
14
17
  # CLI para carregar folhas calculo comuns no bigquery
15
18
  class CLI < Thor
16
- desc 'load', 'carrega dados da folha calculo no bigquery'
17
- option :d, banner: 'DIR', default: "/home/#{ID}/Downloads",
18
- desc: 'Onde procurar folhas calculo'
19
- option :x, banner: 'EXT', default: '.csv',
20
- desc: 'Extensao das folhas calculo'
21
- option :e, type: :boolean, default: false,
22
- desc: 'apaga linha igual no bigquery'
23
- option :m, type: :boolean, default: false,
24
- desc: 'apaga linhas existencia multipla no bigquery'
25
- # processa csv
26
- def load
19
+ desc 'workfc', 'carrega/apaga dados da folha calculo'
20
+ option :d, banner: 'DIR', default: "/home/#{ID}/Downloads", desc: 'Onde procurar folhas calculo'
21
+ option :x, banner: 'EXT', default: '.csv', desc: 'Extensao das folhas calculo'
22
+ option :e, type: :boolean, default: false, desc: 'apaga linha igual'
23
+ option :m, type: :boolean, default: false, desc: 'apaga linhas existencia multipla'
24
+ # processa folha calculo
25
+ def workfc
27
26
  Dir.glob("#{options[:d]}/*#{options[:x]}").sort.each do |f|
28
- Bigquery.new(f, { e: options[:e], m: options[:m], i: true }).processa
27
+ Bigquery.new(f, { e: options[:e], m: options[:m], i: true }).processa_csv
29
28
  end
30
29
  end
31
30
 
32
- desc 'mostra', 'mostra dados da folha calculo'
33
- option :d, banner: 'DIR', default: "/home/#{ID}/Downloads",
34
- desc: 'Onde procurar folhas calculo'
35
- option :x, banner: 'EXT', default: '.csv',
36
- desc: 'Extensao das folhas calculo'
37
- # mostra csv
38
- def mostra
31
+ desc 'showfc', 'mostra dados da folha calculo'
32
+ option :d, banner: 'DIR', default: "/home/#{ID}/Downloads", desc: 'Onde procurar folhas calculo'
33
+ option :x, banner: 'EXT', default: '.csv', desc: 'Extensao das folhas calculo'
34
+ # show folha calculo
35
+ def showfc
39
36
  Dir.glob("#{options[:d]}/*#{options[:x]}").sort.each do |f|
40
- Bigquery.new(f).processa
37
+ Bigquery.new(f).processa_csv
41
38
  end
42
39
  end
43
40
 
44
- default_task :mostra
41
+ desc 'work', 'carrega transacoes novas no bigquery'
42
+ option :h, type: :hash, default: {}, desc: 'configuracao ajuste reposicionamento temporal'
43
+ # carrega transacoes novas no bigquery
44
+ def work
45
+ Bigquery.new('', options).processa
46
+ end
47
+
48
+ desc 'show', 'mostra reumo carteiras & transacoes'
49
+ option :v, type: :boolean, default: false, desc: 'mostra transacoes'
50
+ option :t, type: :boolean, default: false, desc: 'mostra transacoes todas ou somente novas'
51
+ # mostra reumo carteiras & transacoes
52
+ def show
53
+ Bigquery.new('', options).carteiras.mostra_resumo
54
+ end
55
+
56
+ default_task :show
45
57
  end
46
58
  end
@@ -1,100 +1,166 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'roo'
4
- require 'google/cloud/bigquery'
3
+ require('roo')
4
+ require('google/cloud/bigquery')
5
5
 
6
6
  module Eost
7
+ BD = 'hernanirvaz.coins'
7
8
  DF = '%Y-%m-%d'
8
9
  DI = '%Y-%m-%d %H:%M:%S'
9
10
 
10
11
  # (see Bigquery)
11
12
  class Bigquery
12
- # @return [Google::Cloud::Bigquery] API bigquery
13
- attr_reader :apibq
14
13
  # @return [Roo::CSV] folha calculo a processar
15
14
  attr_reader :folha
16
15
  # @return [Hash<Symbol, Boolean>] opcoes trabalho com linhas
17
16
  attr_reader :linha
18
17
 
18
+ # @return [Google::Cloud::Bigquery] API bigquery
19
+ attr_reader :api
19
20
  # @return [Array] row folha calculo em processamento
20
21
  attr_reader :row
21
22
  # @return [Google::Cloud::Bigquery::QueryJob] job bigquery
22
23
  attr_reader :job
23
- # @return (see sql_select)
24
- attr_reader :sql
24
+ # @return (see sql)
25
+ attr_reader :sqr
25
26
 
26
27
  # @param [String] csv folha calculo para processar
27
28
  # @param [Hash<Symbol, Boolean>] ops opcoes trabalho com linhas
28
29
  # @option ops [Boolean] :e (false) apaga linha igual?
29
30
  # @option ops [Boolean] :m (false) apaga linhas existencia multipla?
30
31
  # @option ops [Boolean] :i (false) insere linha nova?
31
- # @return [Bigquery] acesso folhas calculo bloks.io
32
- # & correspondente bigquery dataset
32
+ # @return [Bigquery] acesso folhas calculo bloks.io & correspondente bigquery dataset
33
33
  def initialize(csv = '', ops = { e: false, m: false, i: false })
34
- # usa env GOOGLE_APPLICATION_CREDENTIALS para obter credentials
35
- # @see https://cloud.google.com/bigquery/docs/authentication/getting-started
36
- @apibq = Google::Cloud::Bigquery.new
37
34
  @folha = Roo::CSV.new(csv) if csv.size.positive?
38
35
  @linha = ops
36
+
37
+ # usa env GOOGLE_APPLICATION_CREDENTIALS para obter credentials
38
+ # @see https://cloud.google.com/bigquery/docs/authentication/getting-started
39
+ @api = Google::Cloud::Bigquery.new
39
40
  end
40
41
 
41
- # cria job bigquery & verifica execucao
42
- #
43
- # @param [String] sql a executar
44
- # @return [Boolean] job ok?
45
- def job_bigquery?(sql)
46
- @job = apibq.query_job(sql)
47
- @job.wait_until_done!
48
- puts @job.error['message'] if @job.failed?
49
- @job.failed?
42
+ # @return [Carteiras] API eosscan - processar transacoes
43
+ def transacoes
44
+ @transacoes ||= Carteiras.new(
45
+ {
46
+ wb: sql("select * from #{BD}.walletEos order by 1").map { |e| { ax: e[:weos], sl: e[:eos].to_d } },
47
+ nt: sql("select blocknumber,iax from #{BD}.eostx order by 1")
48
+ },
49
+ linha
50
+ )
50
51
  end
51
52
 
52
- # cria Data Manipulation Language (DML) job bigquery
53
- #
54
- # @param (see job_bigquery?)
55
- # @return [Integer] numero linhas afetadas
56
- def dml(sql)
57
- job_bigquery?(sql) ? 0 : job.num_dml_affected_rows
53
+ # @return [Carteiras] API eosscan - processar carteiras & transacoes
54
+ def carteiras
55
+ transacoes
58
56
  end
59
57
 
60
- # pesquisa existencia linha folha calculo no bigquery
61
- #
62
- # @return [Google::Cloud::Bigquery::Data] resultado do sql num array<hash>
63
- def sql_select
64
- # array.count = 0 ==> pode carregar esta linha
65
- # array.count >= 1 ==> nao carregar esta linha
66
- @sql = job_bigquery?('select * ' + sql_where) ? [{}, {}] : job.data
58
+ # insere transacoes novas na tabela eos
59
+ def processa
60
+ puts(format("%<n>2i LINHAS INSERIDAS #{BD}.eos", n: transacoes.novas.count.positive? ? eos_insert_api : 0))
61
+ end
62
+
63
+ # @return [String] campos da tabela eos no bigquery
64
+ def eos_fields
65
+ 'blocknumber,time,contract,action,acfrom,acto,amount,symbol,memo,data,dias'
67
66
  end
68
67
 
69
68
  # @return [String] parte sql para processamento linhas existentes
70
69
  def sql_where
71
- "from hernanirvaz.coins.eos where blocknumber=#{row[0]}"
70
+ "from #{BD}.eos where blocknumber=#{row[0]}"
72
71
  end
73
72
 
74
73
  # @return [Integer] numero linhas inseridas
75
- def sql_insert
74
+ def eos_insert_csv
76
75
  return 1 unless linha[:i]
77
76
 
78
- dml('insert hernanirvaz.coins.eos(blocknumber,time,contract,' \
79
- 'action,acfrom,acto,amount,symbol,memo,data,dias) VALUES(' +
80
- str_insert1)
77
+ dml("INSERT #{BD}.eos(#{eos_fields}) VALUES(#{eos_csv_val1})")
78
+ end
79
+
80
+ # @return [String] valores formatados para insert eos (parte1)
81
+ def eos_csv_val1
82
+ "#{row[0]}," \
83
+ "'#{Time.parse(row[1]).strftime(DI)}'," \
84
+ "'#{row[2]}'," \
85
+ "#{eos_csv_val2}"
86
+ end
87
+
88
+ # @return [String] valores formatados para insert eos (parte2)
89
+ def eos_csv_val2
90
+ "'#{row[3]}'," \
91
+ "'#{row[4]}'," \
92
+ "'#{row[5]}'," \
93
+ "#{Float(row[6])}," \
94
+ "'#{row[7]}'," \
95
+ "'#{row[8]}'," \
96
+ "'#{row[9]}',0"
97
+ end
98
+
99
+ # @return [Integer] numero linhas inseridas
100
+ def eos_insert_api
101
+ dml("INSERT #{BD}.eos(#{eos_fields}) VALUES#{transacoes.novas.map { |e| eos_api_val1(e) }.join(',')}")
102
+ end
103
+
104
+ # @param [Hash] htx transacao ligadas a uma carteira - sem elementos irrelevantes
105
+ # @return [String] valores formatados para insert eos (parte1)
106
+ def eos_api_val1(htx)
107
+ "(#{Integer(htx['block_num'])}," \
108
+ "DATETIME(TIMESTAMP('#{htx['block_time']}'))," \
109
+ "'#{act(htx)['account']}'," \
110
+ "'#{act(htx)['name']}'," \
111
+ "'#{act_data(htx)['from']}'," \
112
+ "'#{act_data(htx)['to']}'," \
113
+ "#{eos_api_val2(htx)}"
81
114
  end
82
115
 
83
- # @return [String] campos insert da linha bigquery
84
- def str_insert1
85
- "#{row[0]},'#{DateTime.parse(row[1]).strftime(DI)}','#{row[2]}'," +
86
- str_insert2
116
+ # @param [Hash] htx transacao ligadas a uma carteira - sem elementos irrelevantes
117
+ # @return [String] valores formatados para insert eos (parte2)
118
+ def eos_api_val2(htx)
119
+ "#{act_data(htx)['quantity'].to_d}," \
120
+ "'#{act_data(htx)['quantity'][/[[:upper:]]+/]}'," \
121
+ "'#{act_data(htx)['memo']}'," \
122
+ "'#{act_data(htx)}'," \
123
+ "#{Integer(linha[:h][String(htx['block_num'])] || 0)})"
87
124
  end
88
125
 
89
- # @return [String] campos insert da linha bigquery
90
- def str_insert2
91
- "'#{row[3]}','#{row[4]}','#{row[5]}',#{row[6].to_f}," \
92
- "'#{row[7]}','#{row[8]}','#{row[9]}',0)"
126
+ # @param [Hash] htx transacao normal
127
+ # @return [Hash] dados da acao
128
+ def act(htx)
129
+ htx['action_trace']['act']
93
130
  end
94
131
 
95
- # @return [Integer] numero linhas apagadas
96
- def sql_delete
97
- dml('delete ' + sql_where)
132
+ # @param [Hash] htx transacao normal
133
+ # @return [Hash] dados da acao
134
+ def act_data(htx)
135
+ act(htx)['data']
136
+ end
137
+
138
+ # cria job bigquery & verifica execucao
139
+ #
140
+ # @param cmd (see sql)
141
+ # @return [Boolean] job ok?
142
+ def job?(cmd)
143
+ @job = api.query_job(cmd)
144
+ @job.wait_until_done!
145
+ puts(@job.error['message']) if @job.failed?
146
+ @job.failed?
147
+ end
148
+
149
+ # cria Structured Query Language (SQL) job bigquery
150
+ #
151
+ # @param [String] cmd comando SQL a executar
152
+ # @param [Array<Hash>] red resultado quando SQL tem erro
153
+ # @return [Google::Cloud::Bigquery::Data] resultado do SQL
154
+ def sql(cmd, red = [])
155
+ @sqr = job?(cmd) ? red : job.data
156
+ end
157
+
158
+ # cria Data Manipulation Language (DML) job bigquery
159
+ #
160
+ # @param cmd (see sql)
161
+ # @return [Integer] numero linhas afetadas
162
+ def dml(cmd)
163
+ job?(cmd) ? 0 : job.num_dml_affected_rows
98
164
  end
99
165
  end
100
166
  end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require('bigdecimal/util')
4
+
5
+ # @author Hernani Rodrigues Vaz
6
+ module Eost
7
+ # classe para processar carteiras & transacoes
8
+ class Carteiras
9
+ # @return [Eosscan] API eosscan
10
+ attr_reader :api
11
+ # @return [Array<Hash>] todos os dados bigquery
12
+ attr_reader :dbq
13
+ # @return [Thor::CoreExt::HashWithIndifferentAccess] opcoes trabalho
14
+ attr_reader :ops
15
+ # @return [Array<Integer>] lista blocknumbers transacoes no bigquery - condicionados por opcoes iniciais
16
+ attr_reader :abn
17
+
18
+ # @param [Hash] dad todos os dados bigquery
19
+ # @param [Thor::CoreExt::HashWithIndifferentAccess] pop opcoes trabalho
20
+ # @option pop [Hash] :h ({}) configuracao dias ajuste reposicionamento temporal
21
+ # @option pop [Boolean] :v (false) mostra dados transacoes?
22
+ # @option pop [Boolean] :t (false) mostra transacoes todas ou somente novas?
23
+ # @return [Carteiras] API eosscan - processar transacoes
24
+ def initialize(dad, pop)
25
+ @api = Eosscan.new
26
+ @dbq = dad
27
+ @ops = pop
28
+ @abn = (ops[:t] ? [] : dbq[:nt].map { |t| t[:blocknumber] })
29
+ end
30
+
31
+ # @return [Array<Hash>] todos os dados eosscan - saldos & transacoes
32
+ def des
33
+ @des ||= dbq[:wb].map { |e| base_eosscan(e) }
34
+ end
35
+
36
+ # @return [Array<Hash>] todos os dados juntos bigquery & eosscan
37
+ def djn
38
+ @djn ||= dbq[:wb].map { |b| bigquery_eosscan(b, des.select { |s| b[:ax] == s[:ax] }.first) }
39
+ end
40
+
41
+ # @return [Array<Integer>] lista blocknumbers de transacoes novas
42
+ def bnn
43
+ @bnn ||= (des.map { |e| e[:tx].map { |n| Integer(n['block_num']) } }.flatten - abn)
44
+ end
45
+
46
+ # @return [Array<Hash>] lista transacoes novas
47
+ def novas
48
+ @novas ||= des.map { |e| e[:tx].select { |s| bnn.include?(Integer(s['block_num'])) } }.flatten.uniq
49
+ end
50
+
51
+ # @return [Array<Hash>] lista ordenada transacoes novas
52
+ def novas_sort
53
+ novas.sort { |a, b| Integer(a['block_num']) <=> Integer(b['block_num']) }
54
+ end
55
+
56
+ # @param [Hash] hwb wallet bigquery eos
57
+ # @return [Hash] dados eosscan - address, saldo & transacoes
58
+ def base_eosscan(hwb)
59
+ {
60
+ ax: hwb[:ax],
61
+ sl: eosscan_sl(hwb[:ax]).inject(:+),
62
+ tx: eosscan_tx(hwb[:ax])
63
+ }
64
+ end
65
+
66
+ # @param (see bigquery_eosscan)
67
+ # @return [Hash<Array, Boolean>] lista blocknumbers novos & carteira ok?
68
+ def novas_ok(hwb, hes)
69
+ # quando todas as transacoes obtidas da api vao ser inseridas,
70
+ # entao podem ficar transacoes por inserir - api consegue apenas um maximo de 100 transacoes
71
+ n = hes[:tx].map { |v| Integer(v['block_num']) } - abn
72
+ { nn: n, ok: hwb[:sl] == hes[:sl] && n.count < hes[:tx].count }
73
+ end
74
+
75
+ # @param hwb (see base_eosscan)
76
+ # @param [Hash] hes dados eosscan
77
+ # @return [Hash] dados juntos bigquery & eosscan
78
+ def bigquery_eosscan(hwb, hes)
79
+ {
80
+ id: hwb[:id],
81
+ ax: hwb[:ax],
82
+ bs: hwb[:sl],
83
+ bt: dbq[:nt].select { |t| t[:iax] == hwb[:ax] },
84
+ es: hes[:sl],
85
+ et: hes[:tx]
86
+ }.merge(novas_ok(hwb, hes))
87
+ end
88
+
89
+ # @param [String] add endereco carteira EOS
90
+ # @return [Array<BigDecimal>] lista recursos - liquido, net, spu
91
+ def eosscan_sl(add)
92
+ v = api.chain_get_account(account_name: add)
93
+ [
94
+ v['core_liquid_balance'].to_d,
95
+ v['total_resources']['net_weight'].to_d,
96
+ v['total_resources']['cpu_weight'].to_d
97
+ ]
98
+ end
99
+
100
+ # @param (see eosscan_sl)
101
+ # @return [Array<Hash>] lista ultimas 100 transacoes ligadas a uma carteira - sem elementos irrelevantes
102
+ def eosscan_tx(add)
103
+ api.history_get_actions(account_name: add, offset: -100)['actions'].map do |e|
104
+ e.delete('global_action_seq')
105
+ e
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,214 @@
1
+ # frozen_string_literal: true
2
+
3
+ require('faraday')
4
+ require('json')
5
+
6
+ module Eost
7
+ # classe para acesso dados blockchain EOS
8
+ class Eosscan
9
+ # @return [String] endereco da API blockchain EOS
10
+ attr_reader :url
11
+
12
+ # attr_reader :spec, :api, :edp
13
+
14
+ # @return [Eosscan] acesso dados blockchain EOS
15
+ def initialize(www: 'https://eos.greymass.com')
16
+ @url = www
17
+ # load_specs
18
+ end
19
+
20
+ # @return [<Symbol>] adapter for the connection - default :net_http
21
+ def adapter
22
+ @adapter ||= Faraday.default_adapter
23
+ end
24
+
25
+ # manage the default properties and the middleware stack for fulfilling an HTTP request
26
+ #
27
+ # @return [<Faraday::Connection>] connection object with an URL & adapter
28
+ def conn
29
+ @conn ||=
30
+ Faraday.new(url: url) do |c|
31
+ c.request(:url_encoded)
32
+ c.adapter(adapter)
33
+ end
34
+ end
35
+
36
+ # @example chain_get_account
37
+ # {
38
+ # 'account_name': '...',
39
+ # 'head_block_num': 138_586_631,
40
+ # 'head_block_time': '2020-08-26T10:16:05.500',
41
+ # 'privileged': false,
42
+ # 'last_code_update': '1970-01-01T00:00:00.000',
43
+ # 'created': '2018-06-09T13:14:37.000',
44
+ # # DEVOLVIDO 'core_liquid_balance': '1232.0226 EOS',
45
+ # 'ram_quota': 9548,
46
+ # 'net_weight': 10_001_142,
47
+ # 'cpu_weight': 10_001_144,
48
+ # 'total_resources': {
49
+ # 'owner': '...',
50
+ # # DEVOLVIDO 'net_weight': '1000.1142 EOS',
51
+ # # DEVOLVIDO 'cpu_weight': '1000.1144 EOS',
52
+ # 'ram_bytes': 8148
53
+ # },
54
+ # 'net_limit': { 'used': 0, 'available': 1_068_152_841, 'max': 1_068_152_841 },
55
+ # 'cpu_limit': { 'used': 338, 'available': 90_856, 'max': 91_194 },
56
+ # 'ram_usage': 3574,
57
+ # 'permissions': [
58
+ # {
59
+ # 'perm_name': 'active',
60
+ # 'parent': 'owner',
61
+ # 'required_auth': {
62
+ # 'threshold': 1,
63
+ # 'keys': [{ 'key': '...', 'weight': 1 }],
64
+ # 'accounts': [],
65
+ # 'waits': []
66
+ # }
67
+ # },
68
+ # {
69
+ # 'perm_name': 'owner',
70
+ # 'parent': '',
71
+ # 'required_auth': {
72
+ # 'threshold': 1,
73
+ # 'keys': [{ 'key': '...', 'weight': 1 }],
74
+ # 'accounts': [],
75
+ # 'waits': []
76
+ # }
77
+ # }
78
+ # ],
79
+ # 'self_delegated_bandwidth': {
80
+ # 'from': '...', 'to': '...', 'net_weight': '1000.1142 EOS', 'cpu_weight': '1000.1144 EOS'
81
+ # },
82
+ # 'refund_request': nil,
83
+ # 'voter_info': {
84
+ # 'owner': '...',
85
+ # 'proxy': '...',
86
+ # 'producers': [],
87
+ # 'staked': 20_002_286,
88
+ # 'last_vote_weight': '17172913021904.12109375000000000',
89
+ # 'proxied_vote_weight': '0.00000000000000000',
90
+ # 'is_proxy': 0,
91
+ # 'flags1': 0,
92
+ # 'reserved2': 0,
93
+ # 'reserved3': '0.0000 EOS'
94
+ # },
95
+ # 'rex_info': nil
96
+ # }
97
+ # @return [Hash] dados numa carteira EOS
98
+ def chain_get_account(**args)
99
+ JSON.parse(conn.post('/v1/chain/get_account', args.to_json, content_type: 'application/json').body)
100
+ end
101
+
102
+ # @example history_get_actions
103
+ # {
104
+ # 'actions' => [
105
+ # {
106
+ # 'account_action_seq': 937,
107
+ # 'action_trace': {
108
+ # 'account_ram_deltas': [],
109
+ # 'act': {
110
+ # 'account': 'newsblockone',
111
+ # 'authorization': [
112
+ # { 'actor': 'blockonenews', 'permission': 'active' },
113
+ # { 'actor': 'newsblockone', 'permission': 'active' }
114
+ # ],
115
+ # 'data': {
116
+ # 'from': 'newsblockone',
117
+ # 'memo': '100 million EOS tokens released on the network - EOS Reallocation Program @ get-eos.io',
118
+ # 'quantity': '1.0000 NEWS',
119
+ # 'to': '...'
120
+ # },
121
+ # 'hex_data': 'a02685',
122
+ # 'name': 'transfer'
123
+ # },
124
+ # 'action_ordinal': 20,
125
+ # 'block_num': 135_581_543,
126
+ # 'block_time': '2020-08-09T00:45:41.000',
127
+ # 'closest_unnotified_ancestor_action_ordinal': 10,
128
+ # 'context_free': false,
129
+ # 'creator_action_ordinal': 10,
130
+ # 'elapsed': 17,
131
+ # 'producer_block_id': '0814cf67c5dfe81e8647be1ddec70a8c84c45e1d65779132ace3561be044a12c',
132
+ # 'receipt': {
133
+ # 'abi_sequence': 2,
134
+ # 'act_digest': '8b2a534341229734f1532430ffcd40c30c7b82da30c3f23446f248c2e1209a68',
135
+ # 'auth_sequence': [['blockonenews', 485_788], ['newsblockone', 368_458]],
136
+ # 'code_sequence': 2,
137
+ # 'global_sequence': 204_352_530_651,
138
+ # 'receiver': '...',
139
+ # 'recv_sequence': 900
140
+ # },
141
+ # 'receiver': '...',
142
+ # 'trx_id': 'de327b9ba02f2fbca9eb2ee3a4e26f8ead6198248b52d184e1f480c578705ba9'
143
+ # },
144
+ # 'block_num': 135_581_543,
145
+ # 'block_time': '2020-08-09T00:45:41.000',
146
+ # # DELETED 'global_action_seq': 204_352_530_651,
147
+ # 'irreversible': true
148
+ # }
149
+ # ],
150
+ # 'head_block_num' => 138_936_528,
151
+ # 'last_irreversible_block' => 138_936_194
152
+ # }
153
+ # @return [Hash] dados das transacoes ligadas a uma carteira EOS
154
+ def history_get_actions(**args)
155
+ JSON.parse(conn.post('/v1/history/get_actions', args.to_json, content_type: 'application/json').body)
156
+ end
157
+
158
+ # private
159
+ # Load API specification from spec files
160
+ # def load_specs
161
+ # @spec = {}
162
+ # Dir["#{spec_path}*"].map { |f| File.basename(f, '.json') }.compact.each { |n| @spec[n] = read_spec(n) }
163
+ # end
164
+ #
165
+ # def spec_path
166
+ # "#{File.dirname(__dir__)}/../specs/"
167
+ # end
168
+ #
169
+ # def read_spec(name)
170
+ # JSON.parse(File.read("#{spec_path}#{name}.json"))
171
+ # end
172
+ #
173
+ # Add API methods to class for seamless usage - this used for undefined methods
174
+ # def method_missing(method_name, *args)
175
+ # return super(method_name, *args) unless respond_to_missing?(method_name)
176
+ #
177
+ # api_call(args.first)
178
+ # end
179
+ #
180
+ # def respond_to_missing?(method_name)
181
+ # @api, @edp = extract_endpoint(method_name)
182
+ # return super(endpoint, *args) unless rtm?
183
+ #
184
+ # rtm?
185
+ # end
186
+ #
187
+ # def rtm?
188
+ # spec.key?(api) && spec[api].key?(edp)
189
+ # end
190
+ #
191
+ # def extract_endpoint(name)
192
+ # name.to_s.split('_', 2)
193
+ # end
194
+ #
195
+ # def known_params
196
+ # # api, endpoint = extract_endpoint(method_name)
197
+ # return {} unless rtm?
198
+ #
199
+ # spec[api][edp]['params'] || {}
200
+ # end
201
+ #
202
+ # # The actual http call
203
+ # def api_call(args)
204
+ # args ||= {}
205
+ # known = known_params
206
+ # r = conn.post(
207
+ # "/v1/#{api}/#{edp}",
208
+ # args.select { |k, _| known.include?(k.to_s) }.to_json,
209
+ # content_type: 'application/json'
210
+ # )
211
+ # JSON.parse(r.body)
212
+ # end
213
+ end
214
+ end
@@ -1,19 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eost
4
- HT = %w[block_num block_time contract action
5
- from to amount symbol memo data].freeze
4
+ HT = %w[block_num block_time contract action from to amount symbol memo data].freeze
6
5
  R1 = '%<v5>-12.12s %<v6>-12.12s'
7
6
  R2 = '%<v7>10.5f %<v8>-8.8s'
8
7
 
9
8
  # trabalhar com folhas calculo bloks.io & dados no bigquery
10
9
  class Bigquery
11
- # processa linhas folha calculo
12
- def processa
10
+ # processa folha calculo
11
+ def processa_csv
13
12
  n = 0
14
13
  folha.sheet(0).parse(header_search: HT) do |r|
15
14
  n += 1
16
- puts n == 1 ? "\n" + folha.info : processa_row(r)
15
+ puts n == 1 ? "\n#{folha.info}" : processa_row(r)
17
16
  end
18
17
  end
19
18
 
@@ -23,8 +22,12 @@ module Eost
23
22
  # @return [String] texto informativo do processamento
24
23
  def processa_row(has)
25
24
  @row = has.values
26
- sql_select
27
- if row_naoexiste? then row_str + (sql_insert == 1 ? ' NOVA' : ' ERRO')
25
+
26
+ # array.count = 0 ==> pode carregar esta linha
27
+ # array.count >= 1 ==> nao carregar esta linha
28
+ sql("select #{eos_fields} #{sql_where}", [{}, {}])
29
+
30
+ if row_naoexiste? then row_str + (eos_insert_csv == 1 ? ' NOVA' : ' ERRO')
28
31
  elsif row_existe? then row_existente
29
32
  else row_multiplas
30
33
  end
@@ -32,7 +35,7 @@ module Eost
32
35
 
33
36
  # @return [String] linha folha calculo formatada
34
37
  def row_str
35
- "#{row[0]} #{DateTime.parse(row[1]).strftime(DF)} " + row_r1 + row_r2
38
+ "#{row[0]} #{Time.parse(row[1]).strftime(DF)} " + row_r1 + row_r2
36
39
  end
37
40
 
38
41
  # @return [String] linha folha calculo formatada
@@ -42,35 +45,35 @@ module Eost
42
45
 
43
46
  # @return [String] linha folha calculo formatada
44
47
  def row_r2
45
- format(R2, v7: row[6].to_f, v8: row[7])
48
+ format(R2, v7: Float(row[6]), v8: row[7])
46
49
  end
47
50
 
48
51
  # @return [String] linha folha calculo existente
49
52
  def row_existente
50
- d = linha[:e] ? sql_delete : 0
51
- row_str + ' EXISTENTE' + str_apagadas(d)
53
+ d = linha[:e] ? dml("delete #{sql_where}") : 0
54
+ "#{row_str} EXISTENTE#{str_apagadas(d)}"
52
55
  end
53
56
 
54
57
  # @return [String] linha folha calculo existencia multipla
55
58
  def row_multiplas
56
- d = linha[:m] ? sql_delete : 0
57
- row_str + ' MULTIPLAS ' + sql.count.to_s + str_apagadas(d)
59
+ d = linha[:m] ? dml("delete #{sql_where}") : 0
60
+ "#{row_str} MULTIPLAS #{sql.count}#{str_apagadas(d)}"
58
61
  end
59
62
 
60
- # @param [Integer] numero linhas apagadas
63
+ # @param [Integer] num numero linhas apagadas
61
64
  # @return [String] texto formatado linhas apagadas
62
65
  def str_apagadas(num)
63
- num.positive? ? ' & ' + num.to_s + ' APAGADA(S) ' : ' '
66
+ num.positive? ? " & #{num} APAGADA(S) " : ' '
64
67
  end
65
68
 
66
69
  # @return [Boolean] linha folha calculo nao existe no bigquery?
67
70
  def row_naoexiste?
68
- sql.count.zero?
71
+ sqr.count.zero?
69
72
  end
70
73
 
71
74
  # @return [Boolean] linha folha calculo existe no bigquery?
72
75
  def row_existe?
73
- sql.count == 1
76
+ sqr.count == 1
74
77
  end
75
78
  end
76
79
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @author Hernani Rodrigues Vaz
4
+ module Eost
5
+ # (see Carteiras)
6
+ class Carteiras
7
+ # @param [Hash] hjn dados juntos bigquery & eosscan
8
+ # @return [String] texto formatado duma carteira
9
+ def formata_carteira(hjn)
10
+ format(
11
+ '%<s1>-12.12s %<v1>12.4f %<v2>12.4f %<nn>3i %<ok>-3s',
12
+ s1: hjn[:ax],
13
+ v1: hjn[:bs],
14
+ v2: hjn[:es],
15
+ nn: hjn[:nn].count,
16
+ ok: hjn[:ok] ? 'OK' : 'NOK'
17
+ )
18
+ end
19
+
20
+ # @param [Hash] htx transacao
21
+ # @return [String] texto formatado transacao
22
+ def formata_transacao(htx)
23
+ format(
24
+ '%<bn>9i %<fr>-12.12s %<to>-12.12s %<ac>-12.12s %<dt>10.10s %<vl>13.4f %<sy>-6.6s',
25
+ bn: htx['block_num'],
26
+ fr: act_data(htx)['from'],
27
+ to: act_data(htx)['to'],
28
+ ac: htx['action_trace']['act']['name'],
29
+ dt: Date.parse(htx['block_time']),
30
+ vl: act_data(htx)['quantity'].to_d,
31
+ sy: act_data(htx)['quantity'][/[[:upper:]]+/]
32
+ )
33
+ end
34
+
35
+ # @param (see formata_transacao)
36
+ # @return [Hash] dados da acao
37
+ def act_data(htx)
38
+ htx['action_trace']['act']['data']
39
+ end
40
+
41
+ # @return [String] texto carteiras & transacoes & ajuste dias
42
+ def mostra_resumo
43
+ return unless djn.count.positive?
44
+
45
+ puts("\naddress --bigquery-- --eosscans-- new")
46
+ djn.each { |e| puts(formata_carteira(e)) }
47
+ mostra_transacoes_novas
48
+ mostra_configuracao_ajuste_dias
49
+ end
50
+
51
+ # @return [String] texto transacoes
52
+ def mostra_transacoes_novas
53
+ return unless ops[:v] && novas.count.positive?
54
+
55
+ puts("\nblock num add from add to accao ---data--- ----valor----")
56
+ novas_sort.each { |e| puts(formata_transacao(e)) }
57
+ end
58
+
59
+ # @return [String] texto configuracao ajuste dias das transacoes
60
+ def mostra_configuracao_ajuste_dias
61
+ return unless novas.count.positive?
62
+
63
+ puts("\nstring ajuste dias\n-h=#{novas_sort.map { |e| "#{e['block_num']}:0" }.join(' ')}")
64
+ end
65
+ end
66
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eost
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
@@ -0,0 +1,256 @@
1
+ {
2
+ "abi_bin_to_json": {
3
+ "brief": "Convert bin hex back into Abi json definition.",
4
+ "params": {
5
+ "code": "name",
6
+ "action": "name",
7
+ "binargs": "bytes"
8
+ },
9
+ "results": {
10
+ "args": "bytes",
11
+ "required_scope": "name[]",
12
+ "required_auth": "name[]"
13
+ }
14
+ },
15
+
16
+ "abi_json_to_bin": {
17
+ "brief": "Manually serialize json into binary hex. The binayargs is usually stored in Message.data.",
18
+ "params": {
19
+ "code": "name",
20
+ "action": "name",
21
+ "args": "bytes"
22
+ },
23
+ "results": {
24
+ "binargs": "bytes"
25
+ }
26
+ },
27
+
28
+ "get_abi": {
29
+ "params": {
30
+ "account_name": "name"
31
+ },
32
+ "results": {
33
+ "account_name": "name",
34
+ "abi": "abi_def?"
35
+ }
36
+ },
37
+
38
+ "get_account": {
39
+ "brief": "Fetch a blockchain account",
40
+ "params": {
41
+ "account_name": "name"
42
+ },
43
+ "results": {
44
+ "account_name": "name",
45
+ "privileged": "bool",
46
+ "last_code_update": "time_point",
47
+ "created": "time_point",
48
+ "ram_quota": "int64",
49
+ "net_weight": "int64",
50
+ "cpu_weight": "int64",
51
+ "net_limit": "int64",
52
+ "cpu_limit": "int64",
53
+ "ram_usage": "int64",
54
+ "permissions": "vector<permission>"
55
+ }
56
+ },
57
+
58
+ "get_block": {
59
+ "brief": "Fetch a block from the blockchain.",
60
+ "params": {
61
+ "block_num_or_id": "string"
62
+ },
63
+ "results": {
64
+ "previous":"block_id",
65
+ "timestamp":"time",
66
+ "transaction_mroot":"checksum256",
67
+ "action_mroot":"checksum256",
68
+ "producer": "account_name",
69
+ "schedule_version":"uint32",
70
+ "producer_signature":"signature",
71
+ "transactions": "transaction[]",
72
+ "id": "fixed_bytes33",
73
+ "block_num": "uint32",
74
+ "ref_block_prefix": "uint32"
75
+ },
76
+ "errors": {
77
+ "unknown block": null
78
+ }
79
+ },
80
+ "get_block_header_state": {
81
+ "brief": "Fetch the minimum state necessary to validate transaction headers.",
82
+ "params": {
83
+ "block_num_or_id": "string"
84
+ },
85
+ "results": "string",
86
+ "errors": {
87
+ "block_id_type_exception": "Invalid block ID",
88
+ "unknown_block_exception": "Could not find reversible block"
89
+ }
90
+ },
91
+ "get_code": {
92
+ "brief": "Fetch smart contract code",
93
+ "params": {
94
+ "account_name": "name"
95
+ },
96
+ "results": {
97
+ "account_name": "name",
98
+ "wast": "string",
99
+ "code_hash": "sha256",
100
+ "abi": "optional<abi_def>"
101
+ }
102
+ },
103
+
104
+ "get_currency_balance": {
105
+ "params": {
106
+ "code": "name",
107
+ "account": "name",
108
+ "symbol": "optional<string>"
109
+ },
110
+ "results": "asset[]"
111
+ },
112
+
113
+ "get_currency_stats": {
114
+ "params": {
115
+ "code": "name",
116
+ "symbol": "string"
117
+ },
118
+ "results": {
119
+ "supply": "asset",
120
+ "max_supply": "asset",
121
+ "issuer": "account_name"
122
+ }
123
+ },
124
+
125
+ "get_info": {
126
+ "brief": "Return general network information.",
127
+ "params": null,
128
+ "results": {
129
+ "server_version" : "string",
130
+ "head_block_num" : "uint32",
131
+ "last_irreversible_block_num" : "uint32",
132
+ "last_irreversible_block_id" : "block_id",
133
+ "head_block_id" : "block_id",
134
+ "head_block_time" : "time_point_sec",
135
+ "head_block_producer" : "account_name",
136
+ "virtual_block_cpu_limit" : "uint64",
137
+ "virtual_block_net_limit" : "uint64",
138
+ "block_cpu_limit" : "uint64",
139
+ "block_net_limit" : "uint64"
140
+ }
141
+ },
142
+ "get_producers": {
143
+ "brief": "Fetch smart contract data from producer.",
144
+ "params": {
145
+ "json": { "type": "bool", "default": false},
146
+ "lower_bound": "string",
147
+ "limit": {"type": "uint32", "default": "10"}
148
+ },
149
+ "results": {
150
+ "rows": {
151
+ "type": "vector",
152
+ "doc": "one row per item, either encoded as hex String or JSON object"
153
+ },
154
+ "total_producer_vote_weight": {
155
+ "type": "float64",
156
+ "doc": "total vote"
157
+ },
158
+ "more": {
159
+ "type": "string",
160
+ "doc": "fill lower_bound with this value to fetch more rows"
161
+ }
162
+ }
163
+ },
164
+ "get_producer_schedule": {
165
+ "brief": "",
166
+ "params": {},
167
+ "results": {
168
+ "vector": "active",
169
+ "vector": "pending",
170
+ "vector": "proposed"
171
+ }
172
+ },
173
+ "get_raw_code_and_abi": {
174
+ "params": {
175
+ "account_name": "name"
176
+ },
177
+ "results": {
178
+ "account_name": "name",
179
+ "wasm": "bytes",
180
+ "abi": "abi_def?"
181
+ }
182
+ },
183
+ "get_required_keys": {
184
+ "params": {
185
+ "transaction": "transaction",
186
+ "available_keys": "set[public_key]"
187
+ },
188
+ "results": "Set[public_key]"
189
+ },
190
+ "get_scheduled_transactions": {
191
+ "brief": "",
192
+ "params": {
193
+ "json": { "type": "bool", "default": false},
194
+ "lower_bound": {"type": "string", "doc": "timestamp OR transaction ID"},
195
+ "limit": {"type": "uint32", "default": "50"}
196
+ },
197
+ "results": {
198
+ "vector": "transactions",
199
+ "more": {
200
+ "type": "string",
201
+ "doc": "fill lower_bound with this to fetch next set of transactions"
202
+ }
203
+ }
204
+ },
205
+ "get_table_rows": {
206
+ "brief": "Fetch smart contract data from an account.",
207
+ "params": {
208
+ "json": { "type": "bool", "default": false},
209
+ "code": "name",
210
+ "scope": "name",
211
+ "table": "name",
212
+ "table_key": "string",
213
+ "lower_bound": {"type": "string", "default": "0"},
214
+ "upper_bound": {"type": "string", "default": "-1"},
215
+ "limit": {"type": "uint32", "default": "10"}
216
+ },
217
+ "results": {
218
+ "rows": {
219
+ "type": "vector",
220
+ "doc": "one row per item, either encoded as hex String or JSON object"
221
+ },
222
+ "more": {
223
+ "type": "bool",
224
+ "doc": "true if last element"
225
+ }
226
+ }
227
+ },
228
+
229
+ "push_block": {
230
+ "brief": "Append a block to the chain database.",
231
+ "params": {
232
+ "block": "signed_block"
233
+ },
234
+ "results": null
235
+ },
236
+
237
+ "push_transaction": {
238
+ "brief": "Attempts to push the transaction into the pending queue.",
239
+ "params": {
240
+ "signed_transaction": "signed_transaction"
241
+ },
242
+ "results": {
243
+ "transaction_id": "fixed_bytes32",
244
+ "processed": "bytes"
245
+ }
246
+ },
247
+
248
+ "push_transactions": {
249
+ "brief": "Attempts to push transactions into the pending queue.",
250
+ "params": {
251
+ "signed_transaction[]": "signed_transaction"
252
+ },
253
+ "results": "vector[push_transaction.results]"
254
+ }
255
+
256
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "get_actions": {
3
+ "params": {
4
+ "account_name": "account_name",
5
+ "pos": "int32?",
6
+ "offset": "int32?"
7
+ },
8
+ "results": {
9
+ "actions": "ordered_action_result[]",
10
+ "last_irreversible_block": "uint32",
11
+ "time_limit_exceeded_error": "bool?"
12
+ },
13
+ "structs": [{
14
+ "name": "ordered_action_result",
15
+ "fields": {
16
+ "global_action_seq": "uint64",
17
+ "account_action_seq": "int32",
18
+ "block_num": "uint32",
19
+ "block_time": "block_timestamp_type",
20
+ "action_trace": "variant"
21
+ }
22
+ }]
23
+ },
24
+ "get_transaction": {
25
+ "brief": "Retrieve a transaction from the blockchain.",
26
+ "params": {
27
+ "id": "transaction_id_type"
28
+ },
29
+ "results": {
30
+ "id": "transaction_id_type",
31
+ "trx": "variant",
32
+ "block_time": "block_timestamp_type",
33
+ "block_num": "uint32",
34
+ "last_irreversible_block": "uint32",
35
+ "traces": "variant[]"
36
+ }
37
+ },
38
+ "get_key_accounts": {
39
+ "params": {
40
+ "public_key": "public_key_type"
41
+ },
42
+ "results": {
43
+ "account_names": "account_name[]"
44
+ }
45
+ },
46
+ "get_controlled_accounts": {
47
+ "params": {
48
+ "controlling_account": "account_name"
49
+ },
50
+ "results": {
51
+ "controlled_accounts": "account_name[]"
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "create":{},
3
+ "get_public_keys":{},
4
+ "import_key":{},
5
+ "list":{},
6
+ "list_keys":{},
7
+ "lock":{},
8
+ "lock_all":{},
9
+ "open":{},
10
+ "set_timeout":{},
11
+ "sign_trx":{}
12
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
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: 2020-05-03 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -104,6 +104,7 @@ extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
106
  - ".gitignore"
107
+ - ".rubocop.yml"
107
108
  - ".travis.yml"
108
109
  - CODE_OF_CONDUCT.md
109
110
  - Gemfile
@@ -117,8 +118,14 @@ files:
117
118
  - exe/eost
118
119
  - lib/eost.rb
119
120
  - lib/eost/bigquery.rb
121
+ - lib/eost/carteiras.rb
122
+ - lib/eost/eosscan.rb
120
123
  - lib/eost/folhacalculo.rb
124
+ - lib/eost/formatar.rb
121
125
  - lib/eost/version.rb
126
+ - specs/chain.json
127
+ - specs/history.json
128
+ - specs/wallet.json
122
129
  homepage: https://github.com/hernanirvaz/abank
123
130
  licenses:
124
131
  - MIT
@@ -140,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
147
  - !ruby/object:Gem::Version
141
148
  version: '0'
142
149
  requirements: []
143
- rubygems_version: 3.0.3
150
+ rubygems_version: 3.1.2
144
151
  signing_key:
145
152
  specification_version: 4
146
153
  summary: Arquiva eos-transactions.csv no bigquery.