36 jv[sfTransactionType] = jss::PermissionedDomainSet;
46 acceptedCredentials.
append(std::move(
object));
49 jv[sfAcceptedCredentials] = acceptedCredentials;
58 jv[sfTransactionType] = jss::PermissionedDomainDelete;
70 params[jss::account] = account.human();
72 params[jss::type] = jss::permissioned_domain;
74 auto const& resp = env.
rpc(
"json",
"account_objects",
to_string(params));
76 objects = resp[jss::result][jss::account_objects];
77 for (
auto const&
object : objects)
79 if (
object[
"LedgerEntryType"] !=
"PermissionedDomain")
83 Throw<std::runtime_error>(
84 "Invalid object type: " +
85 object[
"LedgerEntryType"].asString());
91 std::ignore = index.
parseHex(
object[jss::index].asString());
106 env.
rpc(
"json",
"ledger_entry",
to_string(params))[
"result"];
108 if ((result[
"status"] ==
"error") && (result[
"error"] ==
"entryNotFound"))
111 if ((result[
"node"][
"LedgerEntryType"] != jss::PermissionedDomain))
114 if (result[
"status"] ==
"success")
128 credentials =
object[
"AcceptedCredentials"];
133 auto const& issuer = obj[jss::Issuer];
134 auto const& credentialType = obj[
"CredentialType"];
135 auto blob =
strUnHex(credentialType.asString()).value();
137 {human2Acc.
at(issuer.asString()),
151 return {credentialsSet.
begin(), credentialsSet.
end()};
160 a = metaJson[
"AffectedNodes"];
162 for (
auto const& node : a)
164 if (!node.isMember(
"CreatedNode") ||
165 node[
"CreatedNode"][
"LedgerEntryType"] !=
"PermissionedDomain")
170 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.