lib/sibit/btc.rb in sibit-0.18.4 vs lib/sibit/btc.rb in sibit-0.18.5
- old
+ new
@@ -45,11 +45,11 @@
@dry = dry
end
# Current price of BTC in USD (float returned).
def price(_currency = 'USD')
- raise Sibit::Error, 'Btc.com API doesn\'t provide prices'
+ raise Sibit::NotSupportedError, 'Btc.com API doesn\'t provide prices'
end
# Gets the balance of the address, in satoshi.
def balance(address)
uri = URI("https://chain.api.btc.com/v3/address/#{address}/unspent")
@@ -69,11 +69,12 @@
head = Sibit::Json.new(http: @http, log: @log).get(
URI("https://chain.api.btc.com/v3/block/#{hash}")
)
nxt = head['data']['next_block_hash']
nxt = nil if nxt == '0000000000000000000000000000000000000000000000000000000000000000'
- @log.info("The next block of #{hash} is #{nxt}")
+ @log.info("The block #{hash} is the latest, there is no next block") if nxt.nil?
+ @log.info("The next block of #{hash} is #{nxt}") unless nxt.nil?
nxt
end
# The height of the block.
def height(hash)
@@ -85,11 +86,11 @@
h
end
# Get recommended fees, in satoshi per byte.
def fees
- raise Sibit::Error, 'Btc.com doesn\'t provide recommended fees'
+ raise Sibit::NotSupportedError, 'Btc.com doesn\'t provide recommended fees'
end
# Gets the hash of the latest block.
def latest
uri = URI('https://chain.api.btc.com/v3/block/latest')
@@ -125,10 +126,10 @@
txns
end
# Push this transaction (in hex format) to the network.
def push(_hex)
- raise Sibit::Error, 'Btc.com doesn\'t provide payment gateway'
+ raise Sibit::NotSupportedError, 'Btc.com doesn\'t provide payment gateway'
end
# This method should fetch a Blockchain block and return as a hash.
def block(hash)
head = Sibit::Json.new(http: @http, log: @log).get(