Class: Radiator::SSC::Blockchain

Inherits:
BaseSteemSmartContractRPC show all
Defined in:
lib/radiator/ssc/blockchain.rb

Overview

Direct Known Subclasses

Stream

Constant Summary

Constants inherited from BaseSteemSmartContractRPC

Radiator::SSC::BaseSteemSmartContractRPC::POST_HEADERS

Instance Method Summary collapse

Methods inherited from BaseSteemSmartContractRPC

#shutdown

Constructor Details

#initialize(options = {}) ⇒ Blockchain

Returns a new instance of Blockchain.

Parameters:

  • options (::Hash) (defaults to: {})

    The attributes

Options Hash (options):



9
10
11
12
# File 'lib/radiator/ssc/blockchain.rb', line 9

def initialize(options = {})
  super
  @url = options[:url] || "#{@root_url}/blockchain"
end

Instance Method Details

#block_info(block_num) ⇒ Object

Example using the defaults, backed by Steem Engine:

rpc = Radiator::SSC::Blockchain.new
rpc.block_info(1)

Parameters:

  • block_num (Integer)

Returns:

  • the block with the specified block number of the sidechain



31
32
33
# File 'lib/radiator/ssc/blockchain.rb', line 31

def block_info(block_num)
  request(method: 'getBlockInfo', params: {blockNumber: block_num})
end

#latest_block_infoObject

Example using the defaults, backed by Steem Engine:

rpc = Radiator::SSC::Blockchain.new
rpc.latest_block_info

Returns:

  • the latest block of the sidechain



20
21
22
# File 'lib/radiator/ssc/blockchain.rb', line 20

def latest_block_info
  request(method: 'getLatestBlockInfo')
end

#transaction_info(trx_id) ⇒ Object

Example using the defaults, backed by Steem Engine:

rpc = Radiator::SSC::Blockchain.new
rpc.transaction_info('9d288aab2eb66064dc0d4492cb281512386e2293')

Parameters:

  • trx_id (String)

Returns:

  • the specified transaction info of the sidechain



42
43
44
# File 'lib/radiator/ssc/blockchain.rb', line 42

def transaction_info(trx_id)
  request(method: 'getTransactionInfo', params: {txid: trx_id})
end