boost::optional<AccountID> parseHex (std::string const& s) { if (s.size() != 40) return boost::none; AccountID id; if (! id.SetHex(s, true)) return boost::none; return id; }
bool to_issuer (AccountID& issuer, std::string const& s) { if (s.size () == (160 / 4)) { issuer.SetHex (s); return true; } auto const account = parseBase58<AccountID>(s); if (! account) return false; issuer = *account; return true; }