class Rbsx::Client

Public Class Methods

new(config={}) click to toggle source
# File lib/rbsx/client.rb, line 6
def initialize(config={})
  Rbsx::CONFIG_ATTRS.each do |attr|
    self.send :"#{attr}=", config[attr]
  end
end

Public Instance Methods

bci_fetch_last_height() click to toggle source
# File lib/rbsx/client.rb, line 12
def bci_fetch_last_height
  sx("bci-fetch-last-height").to_i
end
generate_address(n) click to toggle source
# File lib/rbsx/client.rb, line 16
def generate_address(n)
  sx("echo #{master_public_key} | sx genaddr #{n}").chomp
end
sx(command) click to toggle source
# File lib/rbsx/client.rb, line 20
def sx(command)
  full_command = [sx_path, command].join(" ")
  `#{full_command}`
rescue Errno::ENOENT
  fail(
    SxNotFound, [
      "sx path `#{sx_path}` does not seem to exist.",
      "Please make sure that you can execute `#{full_command}`.",
    ].join(" ")
  )
end