-
Notifications
You must be signed in to change notification settings - Fork 57
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
Amm info handler new #857
Amm info handler new #857
Conversation
I implemented this in my last commit, thanks for looking into it carefully. |
{ | ||
using namespace ripple; | ||
|
||
if (!input.ammAccount && (input.issue1 == ripple::noIssue() || input.issue2 == ripple::noIssue())) |
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.
we need to check :
1 ammAccount and issue1/2 can not be set at the same time
2 ammAccount or issue1/2 must be set
|
||
auto const amm = SLE{SerialIter{ammBlob->data(), ammBlob->size()}, ammKeylet.key}; | ||
auto const ammAccountID = amm.getAccountID(sfAccount); | ||
auto const accBlob = |
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.
do we need to check the existence of ammAccountID which is from the amm ledger object 🤔
static auto const rpcSpec = RpcSpec{ | ||
{JS(ledger_hash), validation::Uint256HexStringValidator}, | ||
{JS(ledger_index), validation::LedgerIndexValidator}, | ||
{JS(asset), validation::ammAssetValidator}, |
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.
I understand the ammAssetValidator is from ledger_entry . You may need to bespoke the error code here.
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.
I removed the ammAssetValidator from ledger_entry and added it to validators. What do you mean by "bespoke the error code" ?
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.
Try to input invalid asset , you will see rippled raises different error for the ledger_entry and amm_info.
Some example payloads that might be useful:
|
I have pushed the amm_info unit tests but they are really incomplete. This is the only thing that is incomplete in the PR. |
Closing this one in favour of #1060 |
amm_info
handler to clio