lib/stellar/util/strkey.rb in stellar-base-0.23.1 vs lib/stellar/util/strkey.rb in stellar-base-0.24.0.pre.1

- old
+ new

@@ -20,11 +20,11 @@ # SEP-23 says yes, but shit happens Base32.encode(payload + check).tr("=", "") end # Converts an Stellar::MuxedAccount to its string representation, forcing the ed25519 representation. - # @param [Stellar::MuxedAccount] muxed account + # @param muxed_account [Stellar::MuxedAccount] account # @return [String] "G.."-like address def self.encode_muxed_account(muxed_account) ed25519 = if muxed_account.switch == Stellar::CryptoKeyType.key_type_ed25519 muxed_account.ed25519! else @@ -34,21 +34,21 @@ check_encode(:account_id, ed25519) end # Returns a Stellar::MuxedAccount, forcing the ed25519 discriminant # - # @param [String] address to decode to XDR + # @param strkey [String] address string to decode # @return [Stellar::MuxedAccount] MuxedAccount with ed25519 discriminant def self.decode_muxed_account(strkey) Stellar::MuxedAccount.new(:key_type_ed25519, check_decode(:account_id, strkey)) end def self.check_decode(expected_version, str) decoded = begin - Base32.decode(str) - rescue - raise ArgumentError, "Invalid base32 string" - end + Base32.decode(str) + rescue + raise ArgumentError, "Invalid base32 string" + end version_byte = decoded[0] payload = decoded[1...-2] check = decoded[-2..-1] version = VERSION_BYTES.key(version_byte)