Class: WavesRubyClient::Wallet

Inherits:
Object
  • Object
show all
Defined in:
lib/waves_ruby_client/wallet.rb

Overview

get waves and btc balance

Class Method Summary collapse

Class Method Details

.balance_btcObject



6
7
8
9
10
11
12
13
# File 'lib/waves_ruby_client/wallet.rb', line 6

def self.balance_btc
  WavesRubyClient.try_many_times do
    url = ['/assets/balance', WavesRubyClient::WAVES_ADDRESS,
           WavesRubyClient::PRICE_ASSET.url_id].join('/')
    res = WavesRubyClient::Api.instance.call_node(url)
    res['balance'].to_f / WavesRubyClient::NUMBER_MULTIPLIKATOR
  end
end

.balance_wavesObject



15
16
17
18
19
20
21
# File 'lib/waves_ruby_client/wallet.rb', line 15

def self.balance_waves
  WavesRubyClient.try_many_times do
    url = ['/addresses/balance', WavesRubyClient::WAVES_ADDRESS].join('/')
    res = WavesRubyClient::Api.instance.call_node(url)
    res['balance'].to_f / WavesRubyClient::NUMBER_MULTIPLIKATOR
  end
end