Class: BcashRubyExplorer::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/bcash_ruby_explorer/api.rb

Overview

Main class of this library, contains the following public methods: block_full_txs, address_full_txs and tx_info

Instance Method Summary collapse

Instance Method Details

#address_full_txs(address, page = 0) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/bcash_ruby_explorer/api.rb', line 17

def address_full_txs(address, page = 0)
  query = {
    address: address,
    pageNum: page
  }

  uri = URI('https://explorer.bitcoin.com/api/bch/txs')
  api_http_get(uri, query: query)
end

#block_full_txs(hash, page = 0) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/bcash_ruby_explorer/api.rb', line 7

def block_full_txs(hash, page = 0)
  query = {
    block: hash,
    pageNum: page
  }

  uri = URI('https://explorer.bitcoin.com/api/bch/txs')
  api_http_get(uri, query: query)
end

#tx_info(hash) ⇒ Object



27
28
29
30
# File 'lib/bcash_ruby_explorer/api.rb', line 27

def tx_info(hash)
  uri = URI("https://rest.bitcoin.com/v2/slp/txDetails/#{hash}")
  api_http_get(uri, query: {})
end