14 jv[sfTransactionType] = jss::PermissionedDomainSet;
20 for (
auto const& credential : credentials)
23 object[sfCredential] = credential.toJson();
24 acceptedCredentials.
append(std::move(
object));
27 jv[sfAcceptedCredentials] = acceptedCredentials;
36 jv[sfTransactionType] = jss::PermissionedDomainDelete;
48 params[jss::account] = account.human();
50 params[jss::type] = jss::permissioned_domain;
52 auto const& resp = env.
rpc(
"json",
"account_objects",
to_string(params));
54 objects = resp[jss::result][jss::account_objects];
55 for (
auto const&
object : objects)
57 if (
object[
"LedgerEntryType"] !=
"PermissionedDomain")
61 Throw<std::runtime_error>(
62 "Invalid object type: " +
object[
"LedgerEntryType"].asString());
68 std::ignore = index.
parseHex(
object[jss::index].asString());
82 auto const result = env.
rpc(
"json",
"ledger_entry",
to_string(params))[
"result"];
84 if ((result[
"status"] ==
"error") && (result[
"error"] ==
"entryNotFound"))
87 if ((result[
"node"][
"LedgerEntryType"] != jss::PermissionedDomain))
90 if (result[
"status"] ==
"success")
102 credentials =
object[
"AcceptedCredentials"];
103 for (
auto const& credential : credentials)
106 obj = credential[jss::Credential];
107 auto const& issuer = obj[jss::Issuer];
108 auto const& credentialType = obj[
"CredentialType"];
109 auto blob =
strUnHex(credentialType.asString()).value();
121 for (
auto const& credential : input)
122 credentialsSet.
insert(credential);
123 return {credentialsSet.
begin(), credentialsSet.
end()};
132 a = metaJson[
"AffectedNodes"];
134 for (
auto const& node : a)
136 if (!node.isMember(
"CreatedNode") || node[
"CreatedNode"][
"LedgerEntryType"] !=
"PermissionedDomain")
140 std::ignore = 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).
std::vector< Credential > Credentials
Credentials credentialsFromJson(Json::Value const &object, std::unordered_map< std::string, Account > const &human2Acc)
Json::Value setTx(AccountID const &account, Credentials const &credentials, std::optional< uint256 > domain)
Json::Value deleteTx(AccountID const &account, uint256 const &domain)
uint256 getNewDomain(std::shared_ptr< STObject const > const &meta)
Credentials sortCredentials(Credentials const &input)
std::map< uint256, Json::Value > getObjects(Account const &account, Env &env, bool withType)
bool objectExists(uint256 const &objID, Env &env)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string to_string(base_uint< Bits, Tag > const &a)
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)