fromAccountId method

KeyPair fromAccountId (
  1. String accountId
)

Creates a new KeyPair object from a stellar accountId.

Implementation

static KeyPair fromAccountId(String accountId) {
  if (accountId.startsWith('M')) {
    Uint8List bytes = StrKey.decodeStellarMuxedAccountId(accountId);
    XdrMuxedAccountMed25519 muxMed25519 =
        XdrMuxedAccountMed25519.decode(XdrDataInputStream(bytes));
    return fromPublicKey(muxMed25519.ed25519.uint256);
  }
  Uint8List decoded = StrKey.decodeStellarAccountId(accountId);
  return fromPublicKey(decoded);
}