#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace xrpl { std::expected, NotTEC> SignerEntries::deserialize(STObject const& obj, beast::Journal journal, std::string_view annotation) { if (!obj.isFieldPresent(sfSignerEntries)) { JLOG(journal.trace()) << "Malformed " << annotation << ": Need signer entry array."; return std::unexpected(temMALFORMED); } std::vector accountVec; accountVec.reserve(STTx::kMaxMultiSigners); STArray const& sEntries(obj.getFieldArray(sfSignerEntries)); for (STObject const& sEntry : sEntries) { // Validate the SignerEntry. if (sEntry.getFName() != sfSignerEntry) { JLOG(journal.trace()) << "Malformed " << annotation << ": Expected SignerEntry."; return std::unexpected(temMALFORMED); } // Extract SignerEntry fields. AccountID const account = sEntry.getAccountID(sfAccount); std::uint16_t const weight = sEntry.getFieldU16(sfSignerWeight); std::optional const tag = sEntry.at(~sfWalletLocator); accountVec.emplace_back(account, weight, tag); } return accountVec; } } // namespace xrpl