Module: Bitcoin::Grpc::OapService

Defined in:
lib/bitcoin/grpc/oap_service.rb

Class Method Summary collapse

Class Method Details

.load_configObject



21
22
23
24
25
26
27
# File 'lib/bitcoin/grpc/oap_service.rb', line 21

def self.load_config
  file = 'config.yml'
  yml = YAML.load_file(file)
  config = yml['open_assets_explorer']
  raise "config.yml should contain 'open_assets_explorer' section." unless config
  config
end

.oae_urlObject



16
17
18
19
# File 'lib/bitcoin/grpc/oap_service.rb', line 16

def self.oae_url
  @@config ||= load_config
  @@config['url']
end

.outputs_with_open_asset_id(tx_hash) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/bitcoin/grpc/oap_service.rb', line 6

def self.outputs_with_open_asset_id(tx_hash)
  client = JSONClient.new
  client.debug_dev = STDOUT

  response = client.get("#{oae_url}#{tx_hash.rhex}?format=json")
  response.body['outputs']
rescue RuntimeError => _
  nil
end