Sha256: 424b8e40224df344b89f5d97e3a02223c008f71235daee9c7a917db84c54b970

Contents?: true

Size: 706 Bytes

Versions: 6

Compression:

Stored size: 706 Bytes

Contents

require 'jsonclient'

module Bitcoin
  module Grpc
    module OapService
      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

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

      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bitcoinrb-grpc-0.1.9 lib/bitcoin/grpc/oap_service.rb
bitcoinrb-grpc-0.1.8 lib/bitcoin/grpc/oap_service.rb
bitcoinrb-grpc-0.1.7 lib/bitcoin/grpc/oap_service.rb
bitcoinrb-grpc-0.1.6 lib/bitcoin/grpc/oap_service.rb
bitcoinrb-grpc-0.1.5 lib/bitcoin/grpc/oap_service.rb
bitcoinrb-grpc-0.1.4 lib/bitcoin/grpc/oap_service.rb