Class: WavesRubyClient::Asset

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/waves_ruby_client/asset.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/waves_ruby_client/asset.rb', line 6

def id
  @id
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/waves_ruby_client/asset.rb', line 6

def name
  @name
end

#url_idObject

Returns the value of attribute url_id.



6
7
8
# File 'lib/waves_ruby_client/asset.rb', line 6

def url_id
  @url_id
end

Class Method Details

.btcObject



12
13
14
15
# File 'lib/waves_ruby_client/asset.rb', line 12

def self.btc
  new(name: 'BTC', id: WavesRubyClient::BTC_ASSET_ID,
      url_id: WavesRubyClient::BTC_ASSET_ID)
end

.wavesObject



8
9
10
# File 'lib/waves_ruby_client/asset.rb', line 8

def self.waves
  new(name: 'WAVES', id: '', url_id: WavesRubyClient::WAVES_ASSET_ID)
end

Instance Method Details

#to_bytesObject



17
18
19
20
21
22
23
# File 'lib/waves_ruby_client/asset.rb', line 17

def to_bytes
  if name == WavesRubyClient::WAVES_ASSET_ID
    [0]
  else
    [1].concat(WavesRubyClient::Conversion.base58_to_bytes(id))
  end
end