lib/sibit/cryptoapis.rb in sibit-0.17.0 vs lib/sibit/cryptoapis.rb in sibit-0.18.0
- old
+ new
@@ -43,11 +43,19 @@
@log = log
@dry = dry
end
# Current price of BTC in USD (float returned).
- def price(_currency)
+ def price(_currency = 'USD')
raise Sibit::Error, 'Cryptoapis doesn\'t provide BTC price'
+ end
+
+ # Get hash of the block after this one.
+ def next_of(hash)
+ Sibit::Json.new(http: @http, log: @log).get(
+ URI("https://api.cryptoapis.io/v1/bc/btc/mainnet/blocks/#{hash}"),
+ headers: headers
+ )['payload']['hash']
end
# The height of the block.
def height(hash)
json = Sibit::Json.new(http: @http, log: @log).get(