eost 0.1.4 → 0.1.10
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/.rubocop.yml +12 -0
- data/Gemfile.lock +14 -14
- data/README.md +2 -2
- data/eost.gemspec +2 -4
- data/lib/eost.rb +38 -24
- data/lib/eost/bigquery.rb +128 -55
- data/lib/eost/carteiras.rb +109 -0
- data/lib/eost/eosscan.rb +214 -0
- data/lib/eost/folhacalculo.rb +49 -53
- data/lib/eost/formatar.rb +66 -0
- data/lib/eost/version.rb +1 -1
- data/specs/chain.json +256 -0
- data/specs/history.json +54 -0
- data/specs/wallet.json +12 -0
- metadata +10 -3
data/lib/eost/eosscan.rb
ADDED
@@ -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
|
data/lib/eost/folhacalculo.rb
CHANGED
@@ -1,83 +1,79 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Eost
|
4
|
-
HT = %w[block_num block_time contract action
|
5
|
-
|
6
|
-
|
7
|
-
R2 = '%<v7>10.5f %<v8>-10.10s'
|
4
|
+
HT = %w[block_num block_time contract action from to amount symbol memo data].freeze
|
5
|
+
R1 = '%<v5>-12.12s %<v6>-12.12s'
|
6
|
+
R2 = '%<v7>10.5f %<v8>-8.8s'
|
8
7
|
|
9
|
-
# folhas calculo
|
8
|
+
# trabalhar com folhas calculo bloks.io & dados no bigquery
|
10
9
|
class Bigquery
|
11
|
-
#
|
12
|
-
def
|
13
|
-
"#{row[0]} #{DateTime.parse(row[1]).strftime(DF)} " + row_r1 + row_r2
|
14
|
-
end
|
15
|
-
|
16
|
-
# @return [String] linha folha calculo formatada
|
17
|
-
def row_r1
|
18
|
-
format(R1, v3: row[2], v4: row[3], v5: row[4], v6: row[5])
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [String] linha folha calculo formatada
|
22
|
-
def row_r2
|
23
|
-
format(R2, v7: row[6], v8: row[7])
|
24
|
-
end
|
25
|
-
|
26
|
-
# processa linhas folha calculo
|
27
|
-
def processa
|
10
|
+
# processa folha calculo
|
11
|
+
def processa_csv
|
28
12
|
n = 0
|
29
|
-
|
30
|
-
book.sheet(0).parse(header_search: HT) do |r|
|
13
|
+
folha.sheet(0).parse(header_search: HT) do |r|
|
31
14
|
n += 1
|
32
|
-
puts n == 1 ? "\n
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# mostra linhas folha calculo
|
37
|
-
def show
|
38
|
-
n = 0
|
39
|
-
# usada somente a primeira sheet
|
40
|
-
book.sheet(0).parse(header_search: HT) do |r|
|
41
|
-
n += 1
|
42
|
-
puts n == 1 ? "\n" + book.info : show_row(r)
|
15
|
+
puts n == 1 ? "\n#{folha.info}" : processa_row(r)
|
43
16
|
end
|
44
17
|
end
|
45
18
|
|
46
19
|
# processa linha folha calculo para arquivo
|
47
20
|
#
|
48
|
-
# @param
|
49
|
-
# @return [String]
|
21
|
+
# @param [Hash] has da linha em processamento
|
22
|
+
# @return [String] texto informativo do processamento
|
50
23
|
def processa_row(has)
|
51
24
|
@row = has.values
|
52
|
-
|
53
|
-
|
54
|
-
|
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')
|
31
|
+
elsif row_existe? then row_existente
|
32
|
+
else row_multiplas
|
55
33
|
end
|
56
34
|
end
|
57
35
|
|
58
|
-
#
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
36
|
+
# @return [String] linha folha calculo formatada
|
37
|
+
def row_str
|
38
|
+
"#{row[0]} #{Time.parse(row[1]).strftime(DF)} " + row_r1 + row_r2
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String] linha folha calculo formatada
|
42
|
+
def row_r1
|
43
|
+
format(R1, v5: row[4], v6: row[5])
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [String] linha folha calculo formatada
|
47
|
+
def row_r2
|
48
|
+
format(R2, v7: Float(row[6]), v8: row[7])
|
65
49
|
end
|
66
50
|
|
67
51
|
# @return [String] linha folha calculo existente
|
68
52
|
def row_existente
|
69
|
-
d =
|
70
|
-
row_str
|
53
|
+
d = linha[:e] ? dml("delete #{sql_where}") : 0
|
54
|
+
"#{row_str} EXISTENTE#{str_apagadas(d)}"
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [String] linha folha calculo existencia multipla
|
58
|
+
def row_multiplas
|
59
|
+
d = linha[:m] ? dml("delete #{sql_where}") : 0
|
60
|
+
"#{row_str} MULTIPLAS #{sql.count}#{str_apagadas(d)}"
|
61
|
+
end
|
62
|
+
|
63
|
+
# @param [Integer] num numero linhas apagadas
|
64
|
+
# @return [String] texto formatado linhas apagadas
|
65
|
+
def str_apagadas(num)
|
66
|
+
num.positive? ? " & #{num} APAGADA(S) " : ' '
|
71
67
|
end
|
72
68
|
|
73
69
|
# @return [Boolean] linha folha calculo nao existe no bigquery?
|
74
|
-
def
|
75
|
-
|
70
|
+
def row_naoexiste?
|
71
|
+
sqr.count.zero?
|
76
72
|
end
|
77
73
|
|
78
74
|
# @return [Boolean] linha folha calculo existe no bigquery?
|
79
|
-
def
|
80
|
-
|
75
|
+
def row_existe?
|
76
|
+
sqr.count == 1
|
81
77
|
end
|
82
78
|
end
|
83
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
|
data/lib/eost/version.rb
CHANGED
data/specs/chain.json
ADDED
@@ -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
|
+
}
|