class Sibit::Cex
Btc.com API.
Public Class Methods
new(log: Sibit::Log.new, http: Sibit::Http.new, dry: false)
click to toggle source
Constructor.
# File lib/sibit/cex.rb, line 39 def initialize(log: Sibit::Log.new, http: Sibit::Http.new, dry: false) @http = http @log = log @dry = dry end
Public Instance Methods
balance(_address)
click to toggle source
Gets the balance of the address, in satoshi.
# File lib/sibit/cex.rb, line 61 def balance(_address) raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement balance()' end
block(_hash)
click to toggle source
# File lib/sibit/cex.rb, line 90 def block(_hash) raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement block()' end
fees()
click to toggle source
Get recommended fees, in satoshi per byte.
# File lib/sibit/cex.rb, line 71 def fees raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement fees()' end
height(_hash)
click to toggle source
The height of the block.
# File lib/sibit/cex.rb, line 66 def height(_hash) raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement height()' end
latest()
click to toggle source
Gets the hash of the latest block.
# File lib/sibit/cex.rb, line 76 def latest raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement latest()' end
next_of(_hash)
click to toggle source
Get hash of the block after this one.
# File lib/sibit/cex.rb, line 56 def next_of(_hash) raise Sibit::NotSupportedError, 'Cex.io API doesn\'t provide next_of()' end
price(currency = 'USD')
click to toggle source
Current price of BTC in USD (float returned).
# File lib/sibit/cex.rb, line 46 def price(currency = 'USD') json = Sibit::Json.new(http: @http, log: @log).get( Iri.new('https://cex.io/api/last_price/BTC').append(currency) ) p = json['lprice'].to_f @log.info("The price of BTC is #{p} #{currency}") p end
push(_hex)
click to toggle source
Push this transaction (in hex format) to the network.
# File lib/sibit/cex.rb, line 86 def push(_hex) raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement push()' end
utxos(_sources)
click to toggle source
Fetch all unspent outputs per address.
# File lib/sibit/cex.rb, line 81 def utxos(_sources) raise Sibit::NotSupportedError, 'Cex.io doesn\'t implement utxos()' end