Add AMM types to AccountTx filter (#954)

This commit is contained in:
Sergey Kuznetsov
2023-10-30 16:36:28 +00:00
committed by GitHub
parent 1ec5d3e5a3
commit 200d97f0de
3 changed files with 52 additions and 6 deletions

View File

@@ -5,14 +5,15 @@ exec 1>&2
# paths to check and re-format
sources="src unittests"
formatter="clang-format -i"
version=$($formatter --version | awk -F'[[:space:]]' '{print $4}')
version=$($formatter --version | grep -o '[0-9\.]*')
if [[ "16.0.0" > "$version" ]]; then
cat <<\EOF
cat <<EOF
ERROR
-----------------------------------------------------------------------------
A minimum of version 16 of `clang-format` is required.
Your version is $version.
Please fix paths and run again.
-----------------------------------------------------------------------------

View File

@@ -24,10 +24,15 @@
namespace rpc {
// found here : https://xrpl.org/transaction-types.html
// TODO [https://github.com/XRPLF/clio/issues/856]: add AMMBid, AMMCreate, AMMDelete, AMMDeposit, AMMVote, AMMWithdraw
std::unordered_map<std::string, ripple::TxType> const AccountTxHandler::TYPESMAP{
{JSL(AccountSet), ripple::ttACCOUNT_SET},
{JSL(AccountDelete), ripple::ttACCOUNT_DELETE},
{JSL(AMMBid), ripple::ttAMM_BID},
{JSL(AMMCreate), ripple::ttAMM_CREATE},
{JSL(AMMDelete), ripple::ttAMM_DELETE},
{JSL(AMMDeposit), ripple::ttAMM_DEPOSIT},
{JSL(AMMVote), ripple::ttAMM_VOTE},
{JSL(AMMWithdraw), ripple::ttAMM_WITHDRAW},
{JSL(CheckCancel), ripple::ttCHECK_CANCEL},
{JSL(CheckCash), ripple::ttCHECK_CASH},
{JSL(CheckCreate), ripple::ttCHECK_CREATE},

View File

@@ -351,7 +351,7 @@ TEST_P(AccountTxParameterTest, CheckParams)
{
mockBackendPtr->updateRange(MINSEQ); // min
mockBackendPtr->updateRange(MAXSEQ); // max
auto const testBundle = GetParam();
auto const& testBundle = GetParam();
auto* rawBackendPtr = dynamic_cast<MockBackend*>(mockBackendPtr.get());
ASSERT_NE(rawBackendPtr, nullptr);
auto const req = json::parse(testBundle.testJson);
@@ -1502,6 +1502,46 @@ generateTransactionTypeTestValues()
"tx_type": "AccountDelete"
})",
"[]"},
AccountTxTransactionBundle{
"AMMBid",
R"({
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"ledger_index": "validated",
"tx_type": "AMMBid"
})",
"[]"},
AccountTxTransactionBundle{
"AMMCreate",
R"({
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"ledger_index": "validated",
"tx_type": "AMMCreate"
})",
"[]"},
AccountTxTransactionBundle{
"AMMDelete",
R"({
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"ledger_index": "validated",
"tx_type": "AMMDelete"
})",
"[]"},
AccountTxTransactionBundle{
"AMMDeposit",
R"({
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"ledger_index": "validated",
"tx_type": "AMMDeposit"
})",
"[]"},
AccountTxTransactionBundle{
"AMMVote",
R"({
"account": "rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w",
"ledger_index": "validated",
"tx_type": "AMMVote"
})",
"[]"},
AccountTxTransactionBundle{
"CheckCancel",
R"({