Class: IostRuby::Api
- Inherits:
-
Object
- Object
- IostRuby::Api
- Defined in:
- lib/iost_ruby/api.rb
Instance Method Summary collapse
-
#account(name, by_longest_chain = true) ⇒ Object
true: 最長のチェーンからデータを取得、false: 不可逆ブロックからデータを取得.
- #batch_contract_storage ⇒ Object
-
#block_by_hash(hash, complete = false) ⇒ Object
true: ブロック内のトランザクションの詳細情報を表示、false: 表示しない.
- #block_by_number(number, complete = false) ⇒ Object
- #chain_info ⇒ Object
-
#contract(id, by_longest_chain = true) ⇒ Object
true - get data from longest chain; false - get data from irreversible blocks.
-
#contract_storage(id, key, field, by_longest_chain = true) ⇒ Object
true - get data from the longest chain; false - get data from irreversible blocks.
- #contract_storage_field(id, key, by_longest_chain = true) ⇒ Object
- #gas_ratio ⇒ Object
-
#initialize(options = {}) ⇒ Api
constructor
A new instance of Api.
- #node_info ⇒ Object
- #producer_vote_info(name, by_longest_chain = true) ⇒ Object
- #ram_info ⇒ Object
-
#token_balance(account, token, by_longest_chain = true) ⇒ Object
true: 最長のチェーンからデータを取得、false: 不可逆ブロックからデータを取得.
- #tx_by_hash(hash) ⇒ Object
- #tx_receipt_by_tx_hash(hash) ⇒ Object
Constructor Details
Instance Method Details
#account(name, by_longest_chain = true) ⇒ Object
true: 最長のチェーンからデータを取得、false: 不可逆ブロックからデータを取得
41 42 43 |
# File 'lib/iost_ruby/api.rb', line 41 def account(name, by_longest_chain = true) @client.request :get, "getAccount/#{name}/#{by_longest_chain}" end |
#batch_contract_storage ⇒ Object
68 69 70 |
# File 'lib/iost_ruby/api.rb', line 68 def batch_contract_storage @client.request :post, "getBatchContractStorage" end |
#block_by_hash(hash, complete = false) ⇒ Object
true: ブロック内のトランザクションの詳細情報を表示、false: 表示しない
32 33 34 |
# File 'lib/iost_ruby/api.rb', line 32 def block_by_hash(hash, complete = false) @client.request :get, "getBlockByHash/#{hash}/#{complete}" end |
#block_by_number(number, complete = false) ⇒ Object
36 37 38 |
# File 'lib/iost_ruby/api.rb', line 36 def block_by_number(number, complete = false) @client.request :get, "getBlockByNumber/#{number}/#{complete}" end |
#chain_info ⇒ Object
11 12 13 |
# File 'lib/iost_ruby/api.rb', line 11 def chain_info @client.request :get, 'getChainInfo' end |
#contract(id, by_longest_chain = true) ⇒ Object
true - get data from longest chain; false - get data from irreversible blocks
55 56 57 |
# File 'lib/iost_ruby/api.rb', line 55 def contract(id, by_longest_chain = true) @client.request :get, "getContract/#{id}/#{by_longest_chain}" end |
#contract_storage(id, key, field, by_longest_chain = true) ⇒ Object
true - get data from the longest chain; false - get data from irreversible blocks
60 61 62 |
# File 'lib/iost_ruby/api.rb', line 60 def contract_storage(id, key, field, by_longest_chain = true) @client.request :post, "getContractStorage", "{\"id\":\"#{id}\",\"key\":\"#{key}\",\"field\":\"#{field}\",\"by_longest_chain\":#{by_longest_chain}}" end |
#contract_storage_field(id, key, by_longest_chain = true) ⇒ Object
64 65 66 |
# File 'lib/iost_ruby/api.rb', line 64 def contract_storage_field(id, key, by_longest_chain = true) @client.request :post, "getContractStorageFields", "{\"id\":\"#{id}\",\"key\":\"#{key}\",\"by_longest_chain\":#{by_longest_chain}}" end |
#gas_ratio ⇒ Object
15 16 17 |
# File 'lib/iost_ruby/api.rb', line 15 def gas_ratio @client.request :get, 'getGasRatio' end |
#node_info ⇒ Object
7 8 9 |
# File 'lib/iost_ruby/api.rb', line 7 def node_info @client.request :get, 'getNodeInfo' end |
#producer_vote_info(name, by_longest_chain = true) ⇒ Object
50 51 52 |
# File 'lib/iost_ruby/api.rb', line 50 def producer_vote_info(name, by_longest_chain = true) @client.request :get, "GetProducerVoteInfo/#{name}/#{by_longest_chain}" end |
#ram_info ⇒ Object
19 20 21 |
# File 'lib/iost_ruby/api.rb', line 19 def ram_info @client.request :get, 'getRAMInfo' end |
#token_balance(account, token, by_longest_chain = true) ⇒ Object
true: 最長のチェーンからデータを取得、false: 不可逆ブロックからデータを取得
46 47 48 |
# File 'lib/iost_ruby/api.rb', line 46 def token_balance(account, token, by_longest_chain = true) @client.request :get, "getTokenBalance/#{account}/#{token}/#{by_longest_chain}" end |
#tx_by_hash(hash) ⇒ Object
23 24 25 |
# File 'lib/iost_ruby/api.rb', line 23 def tx_by_hash(hash) @client.request :get, "getTxByHash/#{hash}" end |
#tx_receipt_by_tx_hash(hash) ⇒ Object
27 28 29 |
# File 'lib/iost_ruby/api.rb', line 27 def tx_receipt_by_tx_hash(hash) @client.request :get, "getTxReceiptByTxHash/#{hash}" end |