Add support for XLS-81 Permissioned DEX (#5404)

Modified transactions:
- OfferCreate
- Payment

Modified RPCs:
- book_changes
- subscribe
- book_offers
- ripple_path_find
- path_find

Spec: https://github.com/XRPLF/XRPL-Standards/pull/281
This commit is contained in:
Shawn Xie
2025-05-30 13:24:48 -04:00
committed by GitHub
parent e0bc3dd51f
commit 0a34b5c691
73 changed files with 4591 additions and 308 deletions

View File

@@ -1300,6 +1300,60 @@ public:
}
}
void
testSubBookChanges()
{
testcase("SubBookChanges");
using namespace jtx;
using namespace std::chrono_literals;
FeatureBitset const all{
jtx::supported_amendments() | featurePermissionedDomains |
featureCredentials | featurePermissionedDEX};
Env env(*this, all);
PermissionedDEX permDex(env);
auto const alice = permDex.alice;
auto const bob = permDex.bob;
auto const carol = permDex.carol;
auto const domainID = permDex.domainID;
auto const gw = permDex.gw;
auto const USD = permDex.USD;
auto wsc = makeWSClient(env.app().config());
Json::Value streams;
streams[jss::streams] = Json::arrayValue;
streams[jss::streams][0u] = "book_changes";
auto jv = wsc->invoke("subscribe", streams);
if (!BEAST_EXPECT(jv[jss::status] == "success"))
return;
env(offer(alice, XRP(10), USD(10)),
domain(domainID),
txflags(tfHybrid));
env.close();
env(pay(bob, carol, USD(5)),
path(~USD),
sendmax(XRP(5)),
domain(domainID));
env.close();
BEAST_EXPECT(wsc->findMsg(5s, [&](auto const& jv) {
if (jv[jss::changes].size() != 1)
return false;
auto const jrOffer = jv[jss::changes][0u];
return (jv[jss::changes][0u][jss::domain]).asString() ==
strHex(domainID) &&
jrOffer[jss::currency_a].asString() == "XRP_drops" &&
jrOffer[jss::volume_a].asString() == "5000000" &&
jrOffer[jss::currency_b].asString() ==
"rHUKYAZyUFn8PCZWbPfwHfbVQXTYrYKkHb/USD" &&
jrOffer[jss::volume_b].asString() == "5";
}));
}
void
run() override
{
@@ -1318,6 +1372,7 @@ public:
testSubErrors(false);
testSubByUrl();
testHistoryTxStream();
testSubBookChanges();
}
};