Module: WavesRubyClient::Conversion::ClassMethods

Included in:
WavesRubyClient::Conversion, WavesRubyClient::Conversion
Defined in:
lib/waves_ruby_client/conversion.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#base58_to_bytes(input) ⇒ Object



21
22
23
# File 'lib/waves_ruby_client/conversion.rb', line 21

def base58_to_bytes(input)
  BTC::Base58.data_from_base58(input).bytes
end

#bytes_to_base58(bytes) ⇒ Object



17
18
19
# File 'lib/waves_ruby_client/conversion.rb', line 17

def bytes_to_base58(bytes)
  BTC::Base58.base58_from_data(bytes.map(&:chr).join)
end

#long_to_bytes(long) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/waves_ruby_client/conversion.rb', line 7

def long_to_bytes(long)
  long = long.to_i
  bytes = []
  8.times do
    bytes << (long & 255)
    long /= 256
  end
  bytes.reverse
end