class IostRuby::Api

Public Class Methods

new(options = {}) click to toggle source
# File lib/iost_ruby/api.rb, line 3
def initialize(options = {})
  @client ||= IostRuby::Client.new(options)
end

Public Instance Methods

account(name, by_longest_chain = true) click to toggle source

true: 最長のチェーンからデータを取得、false: 不可逆ブロックからデータを取得

# 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() click to toggle source
# File lib/iost_ruby/api.rb, line 68
def batch_contract_storage
  @client.request :post, "getBatchContractStorage"
end
block_by_hash(hash, complete = false) click to toggle source

true: ブロック内のトランザクションの詳細情報を表示、false: 表示しない

# 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) click to toggle source
# File lib/iost_ruby/api.rb, line 36
def block_by_number(number, complete = false)
  @client.request :get, "getBlockByNumber/#{number}/#{complete}"
end
chain_info() click to toggle source
# File lib/iost_ruby/api.rb, line 11
def chain_info
  @client.request :get, 'getChainInfo'
end
contract(id, by_longest_chain = true) click to toggle source

true - get data from longest chain; false - get data from irreversible blocks

# 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) click to toggle source

true - get data from the longest chain; false - get data from irreversible blocks

# 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) click to toggle source
# 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() click to toggle source
# File lib/iost_ruby/api.rb, line 15
def gas_ratio
  @client.request :get, 'getGasRatio'
end
node_info() click to toggle source
# File lib/iost_ruby/api.rb, line 7
def node_info
  @client.request :get, 'getNodeInfo'
end
producer_vote_info(name, by_longest_chain = true) click to toggle source
# 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() click to toggle source
# File lib/iost_ruby/api.rb, line 19
def ram_info
  @client.request :get, 'getRAMInfo'
end
token_balance(account, token, by_longest_chain = true) click to toggle source

true: 最長のチェーンからデータを取得、false: 不可逆ブロックからデータを取得

# 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) click to toggle source
# 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) click to toggle source
# File lib/iost_ruby/api.rb, line 27
def tx_receipt_by_tx_hash(hash)
  @client.request :get, "getTxReceiptByTxHash/#{hash}"
end