module Stellar::Convert
Generic format conversion module
Public Instance Methods
from_base64(base64_string)
click to toggle source
# File lib/stellar/convert.rb, line 20 def from_base64(base64_string) Base64.strict_decode64(base64_string) end
from_hex(hex_string)
click to toggle source
# File lib/stellar/convert.rb, line 12 def from_hex(hex_string) [hex_string].pack("H*") end
pk_to_address(pk)
click to toggle source
Converts a Stellar::PublicKey instance (or any typedef of it such as
Stellar::AccountID
) to an address
# File lib/stellar/convert.rb, line 26 def pk_to_address(pk) Stellar::Util::StrKey.check_encode(:account_id, pk.ed25519!) end
to_base64(string)
click to toggle source
# File lib/stellar/convert.rb, line 16 def to_base64(string) Base64.strict_encode64(string) end
to_hex(string)
click to toggle source
# File lib/stellar/convert.rb, line 8 def to_hex(string) string.unpack("H*").first end