astroband/ruby-stellar-sdk

View on GitHub
base/lib/stellar/muxed_account.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
module Stellar
  class MuxedAccount
    def to_keypair
      case arm
      when :ed25519 then KeyPair.from_public_key(value)
      when :med25519 then KeyPair.from_public_key(value.ed25519)
      else
        raise "impossible"
      end
    end

    def address
      to_keypair.address
    end

    def account_id
      to_keypair.account_id
    end
  end
end