class Radiator::SSC::Contracts
The “contracts” endpoint
Public Class Methods
@param options [::Hash] The attributes @option options [String] :url Specify the full node end-point. Default: api.steem-engine.com/rpc/contracts
Radiator::SSC::BaseSteemSmartContractRPC::new
# File lib/radiator/ssc/contracts.rb, line 9 def initialize(options = {}) super @url = options[:url] || "#{@root_url}/contracts" end
Public Instance Methods
Example using the defaults, backed by Steem Engine:
rpc = Radiator::SSC::Contracts.new rpc.contract('tokens')
@param [String] name @return the contract specified from the database
# File lib/radiator/ssc/contracts.rb, line 21 def contract(name) request(method: 'getContract', params: {name: name}) end
Example using the defaults, backed by Steem Engine:
rpc = Radiator::SSC::Contracts.new rpc.find( contract: "tokens", table: "balances", query: { symbol: "STINGY" } )
@param options [::Hash] The attributes @option options [String] :contract @option options [String] :table @option options [String] :query @option options [Integer] :limit default: 1000 @option options [Integer] :offset default: 0 @option options [Boolean] :descending @option options [::Hash] indexes default: empty, an index is an object { index: string, descending: boolean } @return array of objects that match the query from the table of the specified contract
# File lib/radiator/ssc/contracts.rb, line 66 def find(options = {}) request(method: 'find', params: options) end
Example using the defaults, backed by Steem Engine:
rpc = Radiator::SSC::Contracts.new rpc.find_one( contract: "tokens", table: "balances", query: { symbol: "STINGY", account: "inertia" } )
@param options [::Hash] The attributes @option options [String] :contract @option options [String] :table @option options [String] :query @return the object that matches the query from the table of the specified contract
# File lib/radiator/ssc/contracts.rb, line 42 def find_one(options = {}) request(method: 'findOne', params: options) end
Protected Instance Methods
# File lib/radiator/ssc/contracts.rb, line 70 def healthy? begin request(method: 'find', params: { contract: 'tokens', table: 'transfers', query: { symbol: '' }, limit: 0 }, skip_health_check: true).nil? rescue => e warn("Health check for #{uri.inspect} failed: #{e.inspect}") !!shutdown end end