Method: Neb::Address#encode
- Defined in:
- lib/neb/address.rb
#encode(fmt) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/neb/address.rb', line 24 def encode(fmt) case fmt when :decimal raw when :bin BaseConvert.encode(value, 256, 22) when :bin_extended "#{BaseConvert.encode(value, 256, 22)}#{checksum}" when :hex Utils.binary_to_base58(BaseConvert.encode(value, 256, 22)) when :hex_extended Utils.binary_to_base58("#{BaseConvert.encode(value, 256, 22)}#{checksum}") else raise ArgumentError, "invalid format: #{fmt}" end end |