20#include <test/jtx/permissioned_domains.h>
37 jv[sfTransactionType] = jss::PermissionedDomainSet;
47 acceptedCredentials.
append(std::move(
object));
50 jv[sfAcceptedCredentials] = acceptedCredentials;
59 jv[sfTransactionType] = jss::PermissionedDomainDelete;
71 params[jss::account] = account.human();
73 params[jss::type] = jss::permissioned_domain;
75 auto const& resp = env.
rpc(
"json",
"account_objects",
to_string(params));
77 objects = resp[jss::result][jss::account_objects];
78 for (
auto const&
object : objects)
80 if (
object[
"LedgerEntryType"] !=
"PermissionedDomain")
84 Throw<std::runtime_error>(
85 "Invalid object type: " +
86 object[
"LedgerEntryType"].asString());
92 std::ignore = index.
parseHex(
object[jss::index].asString());
107 env.
rpc(
"json",
"ledger_entry",
to_string(params))[
"result"];
109 if ((result[
"status"] ==
"error") && (result[
"error"] ==
"entryNotFound"))
112 if ((result[
"node"][
"LedgerEntryType"] != jss::PermissionedDomain))
115 if (result[
"status"] ==
"success")
129 credentials =
object[
"AcceptedCredentials"];
134 auto const& issuer = obj[jss::Issuer];
135 auto const& credentialType = obj[
"CredentialType"];
136 auto blob =
strUnHex(credentialType.asString()).value();
138 {human2Acc.
at(issuer.asString()),
152 return {credentialsSet.
begin(), credentialsSet.
end()};
161 a = metaJson[
"AffectedNodes"];
163 for (
auto const& node : a)
165 if (!node.isMember(
"CreatedNode") ||
166 node[
"CreatedNode"][
"LedgerEntryType"] !=
"PermissionedDomain")
171 ret.
parseHex(node[
"CreatedNode"][
"LedgerIndex"].asString());
Value & append(const Value &value)
Append value to array at the end.
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Immutable cryptographic account descriptor.
A transaction testing environment.
Json::Value rpc(unsigned apiVersion, std::unordered_map< std::string, std::string > const &headers, std::string const &cmd, Args &&... args)
Execute an RPC command.
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
Credentials sortCredentials(Credentials const &input)
Credentials credentialsFromJson(Json::Value const &object, std::unordered_map< std::string, Account > const &human2Acc)
bool objectExists(uint256 const &objID, Env &env)
std::vector< Credential > Credentials
Json::Value deleteTx(AccountID const &account, uint256 const &domain)
Json::Value setTx(AccountID const &account, Credentials const &credentials, std::optional< uint256 > domain)
std::map< uint256, Json::Value > getObjects(Account const &account, Env &env, bool withType)
uint256 getNewDomain(std::shared_ptr< STObject const > const &meta)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
std::string to_string(base_uint< Bits, Tag > const &a)
@ credential
Credentials signature.