-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: add full support for all objects in ledger_entry #6319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
42b10c7
87514f1
363a9e4
b7237ac
1936c34
c072da3
33def13
97c3f8a
ba2eaa5
5b8286d
df573fe
83aca74
b8617e6
ea0fc2b
864e900
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -160,7 +160,21 @@ parseCheck( | |||||
| Json::StaticString const fieldName, | ||||||
| [[maybe_unused]] unsigned const apiVersion) | ||||||
| { | ||||||
| return parseObjectID(params, fieldName, "hex string"); | ||||||
| if (!params.isObject()) | ||||||
| { | ||||||
| return parseObjectID(params, fieldName); | ||||||
| } | ||||||
|
|
||||||
| auto const account = | ||||||
| LedgerEntryHelpers::requiredAccountID(params, jss::account, "malformedAddress"); | ||||||
| if (!account) | ||||||
| return Unexpected(account.error()); | ||||||
|
|
||||||
| auto const sequence = LedgerEntryHelpers::requiredUInt32(params, jss::seq, "malformedRequest"); | ||||||
| if (!sequence) | ||||||
| return Unexpected(sequence.error()); | ||||||
|
|
||||||
| return keylet::check(*account, *sequence).key; | ||||||
| } | ||||||
|
|
||||||
| static Expected<uint256, Json::Value> | ||||||
|
|
@@ -544,7 +558,20 @@ parseNFTokenOffer( | |||||
| Json::StaticString const fieldName, | ||||||
| [[maybe_unused]] unsigned const apiVersion) | ||||||
| { | ||||||
| return parseObjectID(params, fieldName, "hex string"); | ||||||
| if (!params.isObject()) | ||||||
| { | ||||||
| return parseObjectID(params, fieldName); | ||||||
| } | ||||||
|
|
||||||
| auto const owner = LedgerEntryHelpers::requiredAccountID(params, jss::owner, "malformedOwner"); | ||||||
| if (!owner) | ||||||
| return Unexpected(owner.error()); | ||||||
|
|
||||||
| auto const sequence = LedgerEntryHelpers::requiredUInt32(params, jss::seq, "malformedRequest"); | ||||||
| if (!sequence) | ||||||
| return Unexpected(sequence.error()); | ||||||
|
|
||||||
| return keylet::nftoffer(*owner, *sequence).key; | ||||||
| } | ||||||
|
|
||||||
| static Expected<uint256, Json::Value> | ||||||
|
|
@@ -609,7 +636,26 @@ parsePayChannel( | |||||
| Json::StaticString const fieldName, | ||||||
| [[maybe_unused]] unsigned const apiVersion) | ||||||
| { | ||||||
| return parseObjectID(params, fieldName, "hex string"); | ||||||
| if (!params.isObject()) | ||||||
| { | ||||||
| return parseObjectID(params, fieldName); | ||||||
| } | ||||||
|
|
||||||
| auto const account = | ||||||
| LedgerEntryHelpers::requiredAccountID(params, jss::account, "malformedAddress"); | ||||||
| if (!account) | ||||||
| return Unexpected(account.error()); | ||||||
|
|
||||||
| auto const destination = | ||||||
| LedgerEntryHelpers::requiredAccountID(params, jss::destination, "malformedDestination"); | ||||||
|
||||||
| LedgerEntryHelpers::requiredAccountID(params, jss::destination, "malformedDestination"); | |
| LedgerEntryHelpers::requiredAccountID(params, jss::destination, "malformedAddress"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test expects the new error code
malformedDestinationfor invalidpayment_channel.destination. If the handler switches to an existing error code (e.g.malformedAddress) for consistency with other AccountID fields, adjust this expectation accordingly so the negative tests match the API contract.