diff --git a/GRPCHandlers_8h_source.html b/GRPCHandlers_8h_source.html index 576f5dd829..6c7d5ceb20 100644 --- a/GRPCHandlers_8h_source.html +++ b/GRPCHandlers_8h_source.html @@ -134,7 +134,7 @@ $(function() {
56#endif
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
ripple::doLedgerGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerResponse, grpc::Status > doLedgerGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerRequest > &context)
Definition: LedgerHandler.cpp:103
-
ripple::doLedgerEntryGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status > doLedgerEntryGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerEntryRequest > &context)
Definition: LedgerEntry.cpp:1004
+
ripple::doLedgerEntryGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status > doLedgerEntryGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerEntryRequest > &context)
Definition: LedgerEntry.cpp:1010
ripple::doLedgerDiffGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerDiffResponse, grpc::Status > doLedgerDiffGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerDiffRequest > &context)
Definition: LedgerDiff.cpp:6
ripple::doLedgerDataGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerDataResponse, grpc::Status > doLedgerDataGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerDataRequest > &context)
Definition: LedgerData.cpp:136
std::pair
diff --git a/GRPCServer_8cpp_source.html b/GRPCServer_8cpp_source.html index c74f7041b2..3c9e59fd45 100644 --- a/GRPCServer_8cpp_source.html +++ b/GRPCServer_8cpp_source.html @@ -801,7 +801,7 @@ $(function() {
ripple::rpcSUCCESS
@ rpcSUCCESS
Definition: ErrorCodes.h:44
ripple::isUnlimited
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Definition: Role.cpp:125
ripple::doLedgerGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerResponse, grpc::Status > doLedgerGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerRequest > &context)
Definition: LedgerHandler.cpp:103
-
ripple::doLedgerEntryGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status > doLedgerEntryGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerEntryRequest > &context)
Definition: LedgerEntry.cpp:1004
+
ripple::doLedgerEntryGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status > doLedgerEntryGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerEntryRequest > &context)
Definition: LedgerEntry.cpp:1010
ripple::erase
void erase(STObject &st, TypedField< U > const &f)
Remove a field in an STObject.
Definition: STExchange.h:172
ripple::Role
Role
Indicates the level of administrative permission to grant.
Definition: Role.h:44
ripple::Role::IDENTIFIED
@ IDENTIFIED
diff --git a/Handler_8cpp_source.html b/Handler_8cpp_source.html index e40e944ff7..bf40371b56 100644 --- a/Handler_8cpp_source.html +++ b/Handler_8cpp_source.html @@ -430,7 +430,7 @@ $(function() {
ripple::doValidationCreate
Json::Value doValidationCreate(RPC::JsonContext &)
Definition: ValidationCreate.cpp:45
ripple::doGetAggregatePrice
Json::Value doGetAggregatePrice(RPC::JsonContext &context)
oracles: array of {account, oracle_document_id} base_asset: is the asset to be priced quote_asset: is...
Definition: GetAggregatePrice.cpp:153
ripple::doSubmitMultiSigned
Json::Value doSubmitMultiSigned(RPC::JsonContext &)
Definition: SubmitMultiSigned.cpp:34
-
ripple::doLedgerEntry
Json::Value doLedgerEntry(RPC::JsonContext &)
Definition: LedgerEntry.cpp:865
+
ripple::doLedgerEntry
Json::Value doLedgerEntry(RPC::JsonContext &)
Definition: LedgerEntry.cpp:871
ripple::doNFTBuyOffers
Json::Value doNFTBuyOffers(RPC::JsonContext &)
Definition: NFTOffers.cpp:165
ripple::doChannelAuthorize
Json::Value doChannelAuthorize(RPC::JsonContext &)
Definition: PayChanClaim.cpp:41
ripple::doNoRippleCheck
Json::Value doNoRippleCheck(RPC::JsonContext &)
Definition: NoRippleCheck.cpp:62
diff --git a/Handlers_8h_source.html b/Handlers_8h_source.html index ce4739acd8..a8c8a4b610 100644 --- a/Handlers_8h_source.html +++ b/Handlers_8h_source.html @@ -259,7 +259,7 @@ $(function() {
ripple::doValidationCreate
Json::Value doValidationCreate(RPC::JsonContext &)
Definition: ValidationCreate.cpp:45
ripple::doGetAggregatePrice
Json::Value doGetAggregatePrice(RPC::JsonContext &context)
oracles: array of {account, oracle_document_id} base_asset: is the asset to be priced quote_asset: is...
Definition: GetAggregatePrice.cpp:153
ripple::doSubmitMultiSigned
Json::Value doSubmitMultiSigned(RPC::JsonContext &)
Definition: SubmitMultiSigned.cpp:34
-
ripple::doLedgerEntry
Json::Value doLedgerEntry(RPC::JsonContext &)
Definition: LedgerEntry.cpp:865
+
ripple::doLedgerEntry
Json::Value doLedgerEntry(RPC::JsonContext &)
Definition: LedgerEntry.cpp:871
ripple::doNFTBuyOffers
Json::Value doNFTBuyOffers(RPC::JsonContext &)
Definition: NFTOffers.cpp:165
ripple::doChannelAuthorize
Json::Value doChannelAuthorize(RPC::JsonContext &)
Definition: PayChanClaim.cpp:41
ripple::doNoRippleCheck
Json::Value doNoRippleCheck(RPC::JsonContext &)
Definition: NoRippleCheck.cpp:62
diff --git a/LedgerEntry_8cpp_source.html b/LedgerEntry_8cpp_source.html index c2c60577a4..7bb0a9e212 100644 --- a/LedgerEntry_8cpp_source.html +++ b/LedgerEntry_8cpp_source.html @@ -900,235 +900,241 @@ $(function() {
822 return std::nullopt;
823 }
824
-
825 if (!pd.isMember(jss::account) || !pd[jss::account].isString())
+
825 if (!pd.isMember(jss::account))
826 {
827 jvResult[jss::error] = "malformedRequest";
828 return std::nullopt;
829 }
830
-
831 if (!pd.isMember(jss::seq) ||
-
832 (pd[jss::seq].isInt() && pd[jss::seq].asInt() < 0) ||
-
833 (!pd[jss::seq].isInt() && !pd[jss::seq].isUInt()))
-
834 {
-
835 jvResult[jss::error] = "malformedRequest";
-
836 return std::nullopt;
-
837 }
-
838
-
839 auto const account = parseBase58<AccountID>(pd[jss::account].asString());
-
840 if (!account)
-
841 {
-
842 jvResult[jss::error] = "malformedAddress";
-
843 return std::nullopt;
-
844 }
-
845
-
846 return keylet::permissionedDomain(*account, pd[jss::seq].asUInt()).key;
-
847}
-
848
-
849using FunctionType =
-
850 std::function<std::optional<uint256>(Json::Value const&, Json::Value&)>;
+
831 if (!pd[jss::account].isString())
+
832 {
+
833 jvResult[jss::error] = "malformedAddress";
+
834 return std::nullopt;
+
835 }
+
836
+
837 if (!pd.isMember(jss::seq) ||
+
838 (pd[jss::seq].isInt() && pd[jss::seq].asInt() < 0) ||
+
839 (!pd[jss::seq].isInt() && !pd[jss::seq].isUInt()))
+
840 {
+
841 jvResult[jss::error] = "malformedRequest";
+
842 return std::nullopt;
+
843 }
+
844
+
845 auto const account = parseBase58<AccountID>(pd[jss::account].asString());
+
846 if (!account)
+
847 {
+
848 jvResult[jss::error] = "malformedAddress";
+
849 return std::nullopt;
+
850 }
851
-
852struct LedgerEntry
-
853{
-
854 Json::StaticString fieldName;
-
855 FunctionType parseFunction;
-
856 LedgerEntryType expectedType;
-
857};
-
858
-
859// {
-
860// ledger_hash : <ledger>
-
861// ledger_index : <ledger_index>
-
862// ...
-
863// }
-
864Json::Value
-
865doLedgerEntry(RPC::JsonContext& context)
-
866{
-
867 std::shared_ptr<ReadView const> lpLedger;
-
868 auto jvResult = RPC::lookupLedger(lpLedger, context);
-
869
-
870 if (!lpLedger)
-
871 return jvResult;
-
872
-
873 static auto ledgerEntryParsers = std::to_array<LedgerEntry>({
-
874 {jss::index, parseIndex, ltANY},
-
875 {jss::account_root, parseAccountRoot, ltACCOUNT_ROOT},
-
876 // TODO: add amendments
-
877 {jss::amm, parseAMM, ltAMM},
-
878 {jss::bridge, parseBridge, ltBRIDGE},
-
879 {jss::check, parseCheck, ltCHECK},
-
880 {jss::credential, parseCredential, ltCREDENTIAL},
-
881 {jss::deposit_preauth, parseDepositPreauth, ltDEPOSIT_PREAUTH},
-
882 {jss::did, parseDID, ltDID},
-
883 {jss::directory, parseDirectory, ltDIR_NODE},
-
884 {jss::escrow, parseEscrow, ltESCROW},
-
885 // TODO: add fee, hashes
-
886 {jss::mpt_issuance, parseMPTokenIssuance, ltMPTOKEN_ISSUANCE},
-
887 {jss::mptoken, parseMPToken, ltMPTOKEN},
-
888 // TODO: add NFT Offers
-
889 {jss::nft_page, parseNFTokenPage, ltNFTOKEN_PAGE},
-
890 // TODO: add NegativeUNL
-
891 {jss::offer, parseOffer, ltOFFER},
-
892 {jss::oracle, parseOracle, ltORACLE},
-
893 {jss::payment_channel, parsePaymentChannel, ltPAYCHAN},
-
894 {jss::permissioned_domain,
-
895 parsePermissionedDomains,
-
896 ltPERMISSIONED_DOMAIN},
-
897 {jss::ripple_state, parseRippleState, ltRIPPLE_STATE},
-
898 // This is an alias, since the `ledger_data` filter uses jss::state
-
899 {jss::state, parseRippleState, ltRIPPLE_STATE},
-
900 {jss::ticket, parseTicket, ltTICKET},
-
901 {jss::xchain_owned_claim_id,
-
902 parseXChainOwnedClaimID,
-
903 ltXCHAIN_OWNED_CLAIM_ID},
-
904 {jss::xchain_owned_create_account_claim_id,
-
905 parseXChainOwnedCreateAccountClaimID,
-
906 ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID},
-
907 });
-
908
-
909 uint256 uNodeIndex;
-
910 LedgerEntryType expectedType = ltANY;
-
911
-
912 try
-
913 {
-
914 bool found = false;
-
915 for (const auto& ledgerEntry : ledgerEntryParsers)
-
916 {
-
917 if (context.params.isMember(ledgerEntry.fieldName))
-
918 {
-
919 expectedType = ledgerEntry.expectedType;
-
920 // `Bridge` is the only type that involves two fields at the
-
921 // `ledger_entry` param level.
-
922 // So that parser needs to have the whole `params` field.
-
923 // All other parsers only need the one field name's info.
-
924 Json::Value const& params = ledgerEntry.fieldName == jss::bridge
-
925 ? context.params
-
926 : context.params[ledgerEntry.fieldName];
-
927 uNodeIndex = ledgerEntry.parseFunction(params, jvResult)
-
928 .value_or(beast::zero);
-
929 if (jvResult.isMember(jss::error))
-
930 {
-
931 return jvResult;
-
932 }
-
933 found = true;
-
934 break;
-
935 }
-
936 }
-
937
-
938 if (!found)
-
939 {
-
940 if (context.apiVersion < 2u)
-
941 jvResult[jss::error] = "unknownOption";
-
942 else
-
943 jvResult[jss::error] = "invalidParams";
-
944 return jvResult;
-
945 }
-
946 }
-
947 catch (Json::error& e)
-
948 {
-
949 if (context.apiVersion > 1u)
-
950 {
-
951 // For apiVersion 2 onwards, any parsing failures that throw this
-
952 // exception return an invalidParam error.
-
953 jvResult[jss::error] = "invalidParams";
-
954 return jvResult;
-
955 }
-
956 else
-
957 throw;
-
958 }
-
959
-
960 if (uNodeIndex.isZero())
-
961 {
-
962 jvResult[jss::error] = "entryNotFound";
-
963 return jvResult;
+
852 return keylet::permissionedDomain(*account, pd[jss::seq].asUInt()).key;
+
853}
+
854
+
855using FunctionType =
+
856 std::function<std::optional<uint256>(Json::Value const&, Json::Value&)>;
+
857
+
858struct LedgerEntry
+
859{
+
860 Json::StaticString fieldName;
+
861 FunctionType parseFunction;
+
862 LedgerEntryType expectedType;
+
863};
+
864
+
865// {
+
866// ledger_hash : <ledger>
+
867// ledger_index : <ledger_index>
+
868// ...
+
869// }
+
870Json::Value
+
871doLedgerEntry(RPC::JsonContext& context)
+
872{
+
873 std::shared_ptr<ReadView const> lpLedger;
+
874 auto jvResult = RPC::lookupLedger(lpLedger, context);
+
875
+
876 if (!lpLedger)
+
877 return jvResult;
+
878
+
879 static auto ledgerEntryParsers = std::to_array<LedgerEntry>({
+
880 {jss::index, parseIndex, ltANY},
+
881 {jss::account_root, parseAccountRoot, ltACCOUNT_ROOT},
+
882 // TODO: add amendments
+
883 {jss::amm, parseAMM, ltAMM},
+
884 {jss::bridge, parseBridge, ltBRIDGE},
+
885 {jss::check, parseCheck, ltCHECK},
+
886 {jss::credential, parseCredential, ltCREDENTIAL},
+
887 {jss::deposit_preauth, parseDepositPreauth, ltDEPOSIT_PREAUTH},
+
888 {jss::did, parseDID, ltDID},
+
889 {jss::directory, parseDirectory, ltDIR_NODE},
+
890 {jss::escrow, parseEscrow, ltESCROW},
+
891 // TODO: add fee, hashes
+
892 {jss::mpt_issuance, parseMPTokenIssuance, ltMPTOKEN_ISSUANCE},
+
893 {jss::mptoken, parseMPToken, ltMPTOKEN},
+
894 // TODO: add NFT Offers
+
895 {jss::nft_page, parseNFTokenPage, ltNFTOKEN_PAGE},
+
896 // TODO: add NegativeUNL
+
897 {jss::offer, parseOffer, ltOFFER},
+
898 {jss::oracle, parseOracle, ltORACLE},
+
899 {jss::payment_channel, parsePaymentChannel, ltPAYCHAN},
+
900 {jss::permissioned_domain,
+
901 parsePermissionedDomains,
+
902 ltPERMISSIONED_DOMAIN},
+
903 {jss::ripple_state, parseRippleState, ltRIPPLE_STATE},
+
904 // This is an alias, since the `ledger_data` filter uses jss::state
+
905 {jss::state, parseRippleState, ltRIPPLE_STATE},
+
906 {jss::ticket, parseTicket, ltTICKET},
+
907 {jss::xchain_owned_claim_id,
+
908 parseXChainOwnedClaimID,
+
909 ltXCHAIN_OWNED_CLAIM_ID},
+
910 {jss::xchain_owned_create_account_claim_id,
+
911 parseXChainOwnedCreateAccountClaimID,
+
912 ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID},
+
913 });
+
914
+
915 uint256 uNodeIndex;
+
916 LedgerEntryType expectedType = ltANY;
+
917
+
918 try
+
919 {
+
920 bool found = false;
+
921 for (const auto& ledgerEntry : ledgerEntryParsers)
+
922 {
+
923 if (context.params.isMember(ledgerEntry.fieldName))
+
924 {
+
925 expectedType = ledgerEntry.expectedType;
+
926 // `Bridge` is the only type that involves two fields at the
+
927 // `ledger_entry` param level.
+
928 // So that parser needs to have the whole `params` field.
+
929 // All other parsers only need the one field name's info.
+
930 Json::Value const& params = ledgerEntry.fieldName == jss::bridge
+
931 ? context.params
+
932 : context.params[ledgerEntry.fieldName];
+
933 uNodeIndex = ledgerEntry.parseFunction(params, jvResult)
+
934 .value_or(beast::zero);
+
935 if (jvResult.isMember(jss::error))
+
936 {
+
937 return jvResult;
+
938 }
+
939 found = true;
+
940 break;
+
941 }
+
942 }
+
943
+
944 if (!found)
+
945 {
+
946 if (context.apiVersion < 2u)
+
947 jvResult[jss::error] = "unknownOption";
+
948 else
+
949 jvResult[jss::error] = "invalidParams";
+
950 return jvResult;
+
951 }
+
952 }
+
953 catch (Json::error& e)
+
954 {
+
955 if (context.apiVersion > 1u)
+
956 {
+
957 // For apiVersion 2 onwards, any parsing failures that throw this
+
958 // exception return an invalidParam error.
+
959 jvResult[jss::error] = "invalidParams";
+
960 return jvResult;
+
961 }
+
962 else
+
963 throw;
964 }
965
-
966 auto const sleNode = lpLedger->read(keylet::unchecked(uNodeIndex));
-
967
-
968 bool bNodeBinary = false;
-
969 if (context.params.isMember(jss::binary))
-
970 bNodeBinary = context.params[jss::binary].asBool();
+
966 if (uNodeIndex.isZero())
+
967 {
+
968 jvResult[jss::error] = "entryNotFound";
+
969 return jvResult;
+
970 }
971
-
972 if (!sleNode)
-
973 {
-
974 // Not found.
-
975 jvResult[jss::error] = "entryNotFound";
-
976 return jvResult;
-
977 }
-
978
-
979 if ((expectedType != ltANY) && (expectedType != sleNode->getType()))
-
980 {
-
981 jvResult[jss::error] = "unexpectedLedgerType";
+
972 auto const sleNode = lpLedger->read(keylet::unchecked(uNodeIndex));
+
973
+
974 bool bNodeBinary = false;
+
975 if (context.params.isMember(jss::binary))
+
976 bNodeBinary = context.params[jss::binary].asBool();
+
977
+
978 if (!sleNode)
+
979 {
+
980 // Not found.
+
981 jvResult[jss::error] = "entryNotFound";
982 return jvResult;
983 }
984
-
985 if (bNodeBinary)
+
985 if ((expectedType != ltANY) && (expectedType != sleNode->getType()))
986 {
-
987 Serializer s;
-
988
-
989 sleNode->add(s);
+
987 jvResult[jss::error] = "unexpectedLedgerType";
+
988 return jvResult;
+
989 }
990
-
991 jvResult[jss::node_binary] = strHex(s.peekData());
-
992 jvResult[jss::index] = to_string(uNodeIndex);
-
993 }
-
994 else
-
995 {
-
996 jvResult[jss::node] = sleNode->getJson(JsonOptions::none);
-
997 jvResult[jss::index] = to_string(uNodeIndex);
-
998 }
-
999
-
1000 return jvResult;
-
1001}
-
1002
-
1003std::pair<org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status>
-
1004doLedgerEntryGrpc(
-
1005 RPC::GRPCContext<org::xrpl::rpc::v1::GetLedgerEntryRequest>& context)
-
1006{
-
1007 org::xrpl::rpc::v1::GetLedgerEntryRequest& request = context.params;
-
1008 org::xrpl::rpc::v1::GetLedgerEntryResponse response;
-
1009 grpc::Status status = grpc::Status::OK;
-
1010
-
1011 std::shared_ptr<ReadView const> ledger;
-
1012 if (auto const status = RPC::ledgerFromRequest(ledger, context))
-
1013 {
-
1014 grpc::Status errorStatus;
-
1015 if (status.toErrorCode() == rpcINVALID_PARAMS)
-
1016 {
-
1017 errorStatus = grpc::Status(
-
1018 grpc::StatusCode::INVALID_ARGUMENT, status.message());
-
1019 }
-
1020 else
-
1021 {
-
1022 errorStatus =
-
1023 grpc::Status(grpc::StatusCode::NOT_FOUND, status.message());
-
1024 }
-
1025 return {response, errorStatus};
-
1026 }
-
1027
-
1028 auto const key = uint256::fromVoidChecked(request.key());
-
1029 if (!key)
-
1030 {
-
1031 grpc::Status errorStatus{
-
1032 grpc::StatusCode::INVALID_ARGUMENT, "index malformed"};
-
1033 return {response, errorStatus};
-
1034 }
-
1035
-
1036 auto const sleNode = ledger->read(keylet::unchecked(*key));
-
1037 if (!sleNode)
-
1038 {
-
1039 grpc::Status errorStatus{
-
1040 grpc::StatusCode::NOT_FOUND, "object not found"};
-
1041 return {response, errorStatus};
-
1042 }
-
1043
-
1044 Serializer s;
-
1045 sleNode->add(s);
-
1046
-
1047 auto& stateObject = *response.mutable_ledger_object();
-
1048 stateObject.set_data(s.peekData().data(), s.getLength());
-
1049 stateObject.set_key(request.key());
-
1050 *(response.mutable_ledger()) = request.ledger();
-
1051 return {response, status};
-
1052}
-
1053} // namespace ripple
+
991 if (bNodeBinary)
+
992 {
+
993 Serializer s;
+
994
+
995 sleNode->add(s);
+
996
+
997 jvResult[jss::node_binary] = strHex(s.peekData());
+
998 jvResult[jss::index] = to_string(uNodeIndex);
+
999 }
+
1000 else
+
1001 {
+
1002 jvResult[jss::node] = sleNode->getJson(JsonOptions::none);
+
1003 jvResult[jss::index] = to_string(uNodeIndex);
+
1004 }
+
1005
+
1006 return jvResult;
+
1007}
+
1008
+
1009std::pair<org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status>
+
1010doLedgerEntryGrpc(
+
1011 RPC::GRPCContext<org::xrpl::rpc::v1::GetLedgerEntryRequest>& context)
+
1012{
+
1013 org::xrpl::rpc::v1::GetLedgerEntryRequest& request = context.params;
+
1014 org::xrpl::rpc::v1::GetLedgerEntryResponse response;
+
1015 grpc::Status status = grpc::Status::OK;
+
1016
+
1017 std::shared_ptr<ReadView const> ledger;
+
1018 if (auto const status = RPC::ledgerFromRequest(ledger, context))
+
1019 {
+
1020 grpc::Status errorStatus;
+
1021 if (status.toErrorCode() == rpcINVALID_PARAMS)
+
1022 {
+
1023 errorStatus = grpc::Status(
+
1024 grpc::StatusCode::INVALID_ARGUMENT, status.message());
+
1025 }
+
1026 else
+
1027 {
+
1028 errorStatus =
+
1029 grpc::Status(grpc::StatusCode::NOT_FOUND, status.message());
+
1030 }
+
1031 return {response, errorStatus};
+
1032 }
+
1033
+
1034 auto const key = uint256::fromVoidChecked(request.key());
+
1035 if (!key)
+
1036 {
+
1037 grpc::Status errorStatus{
+
1038 grpc::StatusCode::INVALID_ARGUMENT, "index malformed"};
+
1039 return {response, errorStatus};
+
1040 }
+
1041
+
1042 auto const sleNode = ledger->read(keylet::unchecked(*key));
+
1043 if (!sleNode)
+
1044 {
+
1045 grpc::Status errorStatus{
+
1046 grpc::StatusCode::NOT_FOUND, "object not found"};
+
1047 return {response, errorStatus};
+
1048 }
+
1049
+
1050 Serializer s;
+
1051 sleNode->add(s);
+
1052
+
1053 auto& stateObject = *response.mutable_ledger_object();
+
1054 stateObject.set_data(s.peekData().data(), s.getLength());
+
1055 stateObject.set_key(request.key());
+
1056 *(response.mutable_ledger()) = request.ledger();
+
1057 return {response, status};
+
1058}
+
1059} // namespace ripple
Json::StaticString
Lightweight wrapper to tag static string.
Definition: json_value.h:62
Json::Value
Represents a JSON value.
Definition: json_value.h:148
Json::Value::isArray
bool isArray() const
Definition: json_value.cpp:1034
@@ -1195,7 +1201,7 @@ $(function() {
ripple::parseIndex
static std::optional< uint256 > parseIndex(Json::Value const &params, Json::Value &jvResult)
Definition: LedgerEntry.cpp:72
ripple::parseAuthorizeCredentials
static STArray parseAuthorizeCredentials(Json::Value const &jv)
Definition: LedgerEntry.cpp:41
ripple::strUnHex
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
Definition: StringUtilities.h:52
-
ripple::doLedgerEntry
Json::Value doLedgerEntry(RPC::JsonContext &)
Definition: LedgerEntry.cpp:865
+
ripple::doLedgerEntry
Json::Value doLedgerEntry(RPC::JsonContext &)
Definition: LedgerEntry.cpp:871
ripple::parsePaymentChannel
static std::optional< uint256 > parsePaymentChannel(Json::Value const &params, Json::Value &jvResult)
Definition: LedgerEntry.cpp:306
ripple::rpcINVALID_PARAMS
@ rpcINVALID_PARAMS
Definition: ErrorCodes.h:84
ripple::parseAMM
static std::optional< uint256 > parseAMM(Json::Value const &params, Json::Value &jvResult)
Definition: LedgerEntry.cpp:405
@@ -1211,7 +1217,7 @@ $(function() {
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::parseEscrow
static std::optional< uint256 > parseEscrow(Json::Value const &params, Json::Value &jvResult)
Definition: LedgerEntry.cpp:242
ripple::maxCredentialsArraySize
std::size_t constexpr maxCredentialsArraySize
The maximum number of credentials can be passed in array.
Definition: Protocol.h:107
-
ripple::doLedgerEntryGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status > doLedgerEntryGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerEntryRequest > &context)
Definition: LedgerEntry.cpp:1004
+
ripple::doLedgerEntryGrpc
std::pair< org::xrpl::rpc::v1::GetLedgerEntryResponse, grpc::Status > doLedgerEntryGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetLedgerEntryRequest > &context)
Definition: LedgerEntry.cpp:1010
ripple::parseXChainOwnedCreateAccountClaimID
static std::optional< uint256 > parseXChainOwnedCreateAccountClaimID(Json::Value const &claim_id, Json::Value &jvResult)
Definition: LedgerEntry.cpp:561
ripple::maxCredentialTypeLength
std::size_t constexpr maxCredentialTypeLength
The maximum length of a CredentialType inside a Credential.
Definition: Protocol.h:104
ripple::getTicketIndex
uint256 getTicketIndex(AccountID const &account, std::uint32_t uSequence)
Definition: Indexes.cpp:147
@@ -1235,10 +1241,10 @@ $(function() {
ripple::JsonOptions::none
@ none
Definition: STBase.h:44
ripple::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:39
ripple::Keylet::key
uint256 key
Definition: Keylet.h:40
-
ripple::LedgerEntry
Definition: LedgerEntry.cpp:853
-
ripple::LedgerEntry::expectedType
LedgerEntryType expectedType
Definition: LedgerEntry.cpp:856
-
ripple::LedgerEntry::fieldName
Json::StaticString fieldName
Definition: LedgerEntry.cpp:854
-
ripple::LedgerEntry::parseFunction
FunctionType parseFunction
Definition: LedgerEntry.cpp:855
+
ripple::LedgerEntry
Definition: LedgerEntry.cpp:859
+
ripple::LedgerEntry::expectedType
LedgerEntryType expectedType
Definition: LedgerEntry.cpp:862
+
ripple::LedgerEntry::fieldName
Json::StaticString fieldName
Definition: LedgerEntry.cpp:860
+
ripple::LedgerEntry::parseFunction
FunctionType parseFunction
Definition: LedgerEntry.cpp:861
ripple::RPC::Context::apiVersion
unsigned int apiVersion
Definition: Context.h:49
ripple::RPC::GRPCContext
Definition: Context.h:70
ripple::RPC::GRPCContext::params
RequestType params
Definition: Context.h:71
diff --git a/LedgerRPC__test_8cpp_source.html b/LedgerRPC__test_8cpp_source.html index ebce781c43..971a32973c 100644 --- a/LedgerRPC__test_8cpp_source.html +++ b/LedgerRPC__test_8cpp_source.html @@ -3263,72 +3263,83 @@ $(function() {
3189 params[jss::permissioned_domain][jss::account] = 1;
3190 params[jss::permissioned_domain][jss::seq] = seq;
3191 auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
-
3192 checkErrorValue(jrr[jss::result], "malformedRequest", "");
+
3192 checkErrorValue(jrr[jss::result], "malformedAddress", "");
3193 }
3194
3195 {
-
3196 // Fail, no account
+
3196 // Fail, account is an object
3197 Json::Value params;
3198 params[jss::ledger_index] = jss::validated;
-
3199 params[jss::permissioned_domain][jss::account] = "";
-
3200 params[jss::permissioned_domain][jss::seq] = seq;
-
3201 auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
-
3202 checkErrorValue(jrr[jss::result], "malformedAddress", "");
-
3203 }
-
3204
-
3205 {
-
3206 // Fail, invalid sequence
-
3207 Json::Value params;
-
3208 params[jss::ledger_index] = jss::validated;
-
3209 params[jss::permissioned_domain][jss::account] = alice.human();
-
3210 params[jss::permissioned_domain][jss::seq] = "12g";
-
3211 auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
-
3212 checkErrorValue(jrr[jss::result], "malformedRequest", "");
-
3213 }
-
3214 }
+
3199 params[jss::permissioned_domain][jss::account] =
+
3200 Json::Value{Json::ValueType::objectValue};
+
3201 params[jss::permissioned_domain][jss::seq] = seq;
+
3202 auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
+
3203 checkErrorValue(jrr[jss::result], "malformedAddress", "");
+
3204 }
+
3205
+
3206 {
+
3207 // Fail, no account
+
3208 Json::Value params;
+
3209 params[jss::ledger_index] = jss::validated;
+
3210 params[jss::permissioned_domain][jss::account] = "";
+
3211 params[jss::permissioned_domain][jss::seq] = seq;
+
3212 auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
+
3213 checkErrorValue(jrr[jss::result], "malformedAddress", "");
+
3214 }
3215
-
3216public:
-
3217 void
-
3218 run() override
-
3219 {
-
3220 testLedgerRequest();
-
3221 testBadInput();
-
3222 testLedgerCurrent();
-
3223 testMissingLedgerEntryLedgerHash();
-
3224 testLedgerFull();
-
3225 testLedgerFullNonAdmin();
-
3226 testLedgerAccounts();
-
3227 testLedgerEntryAccountRoot();
-
3228 testLedgerEntryCheck();
-
3229 testLedgerEntryCredentials();
-
3230 testLedgerEntryDepositPreauth();
-
3231 testLedgerEntryDepositPreauthCred();
-
3232 testLedgerEntryDirectory();
-
3233 testLedgerEntryEscrow();
-
3234 testLedgerEntryOffer();
-
3235 testLedgerEntryPayChan();
-
3236 testLedgerEntryRippleState();
-
3237 testLedgerEntryTicket();
-
3238 testLookupLedger();
-
3239 testNoQueue();
-
3240 testQueue();
-
3241 testLedgerAccountsOption();
-
3242 testLedgerEntryDID();
-
3243 testInvalidOracleLedgerEntry();
-
3244 testOracleLedgerEntry();
-
3245 testLedgerEntryMPT();
-
3246 testLedgerEntryCLI();
-
3247 testLedgerEntryPermissionedDomain();
-
3248
-
3249 forAllApiVersions(std::bind_front(
-
3250 &LedgerRPC_test::testLedgerEntryInvalidParams, this));
-
3251 }
-
3252};
-
3253
-
3254BEAST_DEFINE_TESTSUITE(LedgerRPC, app, ripple);
-
3255BEAST_DEFINE_TESTSUITE(LedgerRPC_XChain, app, ripple);
-
3256
-
3257} // namespace ripple
+
3216 {
+
3217 // Fail, invalid sequence
+
3218 Json::Value params;
+
3219 params[jss::ledger_index] = jss::validated;
+
3220 params[jss::permissioned_domain][jss::account] = alice.human();
+
3221 params[jss::permissioned_domain][jss::seq] = "12g";
+
3222 auto const jrr = env.rpc("json", "ledger_entry", to_string(params));
+
3223 checkErrorValue(jrr[jss::result], "malformedRequest", "");
+
3224 }
+
3225 }
+
3226
+
3227public:
+
3228 void
+
3229 run() override
+
3230 {
+
3231 testLedgerRequest();
+
3232 testBadInput();
+
3233 testLedgerCurrent();
+
3234 testMissingLedgerEntryLedgerHash();
+
3235 testLedgerFull();
+
3236 testLedgerFullNonAdmin();
+
3237 testLedgerAccounts();
+
3238 testLedgerEntryAccountRoot();
+
3239 testLedgerEntryCheck();
+
3240 testLedgerEntryCredentials();
+
3241 testLedgerEntryDepositPreauth();
+
3242 testLedgerEntryDepositPreauthCred();
+
3243 testLedgerEntryDirectory();
+
3244 testLedgerEntryEscrow();
+
3245 testLedgerEntryOffer();
+
3246 testLedgerEntryPayChan();
+
3247 testLedgerEntryRippleState();
+
3248 testLedgerEntryTicket();
+
3249 testLookupLedger();
+
3250 testNoQueue();
+
3251 testQueue();
+
3252 testLedgerAccountsOption();
+
3253 testLedgerEntryDID();
+
3254 testInvalidOracleLedgerEntry();
+
3255 testOracleLedgerEntry();
+
3256 testLedgerEntryMPT();
+
3257 testLedgerEntryCLI();
+
3258 testLedgerEntryPermissionedDomain();
+
3259
+
3260 forAllApiVersions(std::bind_front(
+
3261 &LedgerRPC_test::testLedgerEntryInvalidParams, this));
+
3262 }
+
3263};
+
3264
+
3265BEAST_DEFINE_TESTSUITE(LedgerRPC, app, ripple);
+
3266BEAST_DEFINE_TESTSUITE(LedgerRPC_XChain, app, ripple);
+
3267
+
3268} // namespace ripple
std::any_of
T any_of(T... args)
std::string
std::string_view
@@ -3375,7 +3386,7 @@ $(function() {
ripple::LedgerRPC_test::testMissingLedgerEntryLedgerHash
void testMissingLedgerEntryLedgerHash()
Definition: LedgerRPC_test.cpp:529
ripple::LedgerRPC_test::testLedgerAccounts
void testLedgerAccounts()
Definition: LedgerRPC_test.cpp:587
ripple::LedgerRPC_test::testLedgerEntryDepositPreauthCred
void testLedgerEntryDepositPreauthCred()
Definition: LedgerRPC_test.cpp:1072
-
ripple::LedgerRPC_test::run
void run() override
Runs the suite.
Definition: LedgerRPC_test.cpp:3218
+
ripple::LedgerRPC_test::run
void run() override
Runs the suite.
Definition: LedgerRPC_test.cpp:3229
ripple::LedgerRPC_test::testLedgerEntryInvalidParams
void testLedgerEntryInvalidParams(unsigned int apiVersion)
Definition: LedgerRPC_test.cpp:2222
ripple::LedgerRPC_test::testLedgerEntryCLI
void testLedgerEntryCLI()
Definition: LedgerRPC_test.cpp:3074
ripple::LedgerRPC_test::testLedgerRequest
void testLedgerRequest()
Definition: LedgerRPC_test.cpp:383
diff --git a/classripple_1_1LedgerRPC__test.html b/classripple_1_1LedgerRPC__test.html index d8327e254c..5db7f8e91d 100644 --- a/classripple_1_1LedgerRPC__test.html +++ b/classripple_1_1LedgerRPC__test.html @@ -1169,7 +1169,7 @@ Private Attributes

Implements beast::unit_test::suite.

-

Definition at line 3218 of file LedgerRPC_test.cpp.

+

Definition at line 3229 of file LedgerRPC_test.cpp.

diff --git a/namespaceripple.html b/namespaceripple.html index 745689905c..f02e328d92 100644 --- a/namespaceripple.html +++ b/namespaceripple.html @@ -7780,7 +7780,7 @@ template<class T >
-

Definition at line 849 of file LedgerEntry.cpp.

+

Definition at line 855 of file LedgerEntry.cpp.

@@ -42172,7 +42172,7 @@ template<class T >
-

Definition at line 1004 of file LedgerEntry.cpp.

+

Definition at line 1010 of file LedgerEntry.cpp.

@@ -43278,7 +43278,7 @@ template<class T >
-

Definition at line 865 of file LedgerEntry.cpp.

+

Definition at line 871 of file LedgerEntry.cpp.

diff --git a/structripple_1_1LedgerEntry.html b/structripple_1_1LedgerEntry.html index 007d870634..ecc1e1a15a 100644 --- a/structripple_1_1LedgerEntry.html +++ b/structripple_1_1LedgerEntry.html @@ -101,7 +101,7 @@ Public Attributes

Detailed Description

-

Definition at line 852 of file LedgerEntry.cpp.

+

Definition at line 858 of file LedgerEntry.cpp.

Member Data Documentation

◆ fieldName

@@ -115,7 +115,7 @@ Public Attributes
-

Definition at line 854 of file LedgerEntry.cpp.

+

Definition at line 860 of file LedgerEntry.cpp.

@@ -131,7 +131,7 @@ Public Attributes
-

Definition at line 855 of file LedgerEntry.cpp.

+

Definition at line 861 of file LedgerEntry.cpp.

@@ -147,7 +147,7 @@ Public Attributes
-

Definition at line 856 of file LedgerEntry.cpp.

+

Definition at line 862 of file LedgerEntry.cpp.