17 jv[sfTransactionType] = jss::PermissionedDomainSet;
27 acceptedCredentials.
append(std::move(
object));
30 jv[sfAcceptedCredentials] = acceptedCredentials;
39 jv[sfTransactionType] = jss::PermissionedDomainDelete;
51 params[jss::account] = account.human();
53 params[jss::type] = jss::permissioned_domain;
55 auto const& resp = env.
rpc(
"json",
"account_objects",
to_string(params));
57 objects = resp[jss::result][jss::account_objects];
58 for (
auto const&
object : objects)
60 if (
object[
"LedgerEntryType"] !=
"PermissionedDomain")
64 Throw<std::runtime_error>(
65 "Invalid object type: " +
66 object[
"LedgerEntryType"].asString());
72 std::ignore = index.
parseHex(
object[jss::index].asString());
87 env.
rpc(
"json",
"ledger_entry",
to_string(params))[
"result"];
89 if ((result[
"status"] ==
"error") && (result[
"error"] ==
"entryNotFound"))
92 if ((result[
"node"][
"LedgerEntryType"] != jss::PermissionedDomain))
95 if (result[
"status"] ==
"success")
109 credentials =
object[
"AcceptedCredentials"];
114 auto const& issuer = obj[jss::Issuer];
115 auto const& credentialType = obj[
"CredentialType"];
116 auto blob =
strUnHex(credentialType.asString()).value();
118 {human2Acc.
at(issuer.asString()),
132 return {credentialsSet.
begin(), credentialsSet.
end()};
141 a = metaJson[
"AffectedNodes"];
143 for (
auto const& node : a)
145 if (!node.isMember(
"CreatedNode") ||
146 node[
"CreatedNode"][
"LedgerEntryType"] !=
"PermissionedDomain")
151 ret.
parseHex(node[
"CreatedNode"][
"LedgerIndex"].asString());
Value & append(Value const &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.