rippled
Loading...
Searching...
No Matches
dids.cpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2019 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#include <test/jtx/did.h>
21
22#include <xrpl/protocol/TxFlags.h>
23#include <xrpl/protocol/jss.h>
24
25namespace ripple {
26namespace test {
27namespace jtx {
28
30namespace did {
31
33set(jtx::Account const& account)
34{
35 Json::Value jv;
36 jv[jss::TransactionType] = jss::DIDSet;
37 jv[jss::Account] = to_string(account.id());
38 jv[jss::Flags] = tfUniversal;
39 return jv;
40}
41
43setValid(jtx::Account const& account)
44{
45 Json::Value jv;
46 jv[jss::TransactionType] = jss::DIDSet;
47 jv[jss::Account] = to_string(account.id());
48 jv[jss::Flags] = tfUniversal;
49 jv[sfURI.jsonName] = strHex(std::string{"uri"});
50 return jv;
51}
52
54del(jtx::Account const& account)
55{
56 Json::Value jv;
57 jv[jss::TransactionType] = jss::DIDDelete;
58 jv[jss::Account] = to_string(account.id());
59 jv[jss::Flags] = tfUniversal;
60 return jv;
61}
62
63} // namespace did
64
65} // namespace jtx
66
67} // namespace test
68} // namespace ripple
Represents a JSON value.
Definition: json_value.h:148
Immutable cryptographic account descriptor.
Definition: Account.h:39
Keylet did(AccountID const &account) noexcept
Definition: Indexes.cpp:506
Json::Value del(jtx::Account const &account)
Definition: dids.cpp:54
Json::Value setValid(jtx::Account const &account)
Definition: dids.cpp:43
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:315
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
constexpr std::uint32_t tfUniversal
Definition: TxFlags.h:61
std::string to_string(base_uint< Bits, Tag > const &a)
Definition: base_uint.h:630