rippled
did.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 <ripple/protocol/TxFlags.h>
21 #include <ripple/protocol/jss.h>
22 #include <test/jtx/did.h>
23 
24 namespace ripple {
25 namespace test {
26 namespace jtx {
27 
29 namespace did {
30 
32 set(jtx::Account const& account)
33 {
34  Json::Value jv;
35  jv[jss::TransactionType] = jss::DIDSet;
36  jv[jss::Account] = to_string(account.id());
37  jv[jss::Flags] = tfUniversal;
38  return jv;
39 }
40 
42 setValid(jtx::Account const& account)
43 {
44  Json::Value jv;
45  jv[jss::TransactionType] = jss::DIDSet;
46  jv[jss::Account] = to_string(account.id());
47  jv[jss::Flags] = tfUniversal;
48  jv[sfURI.jsonName] = strHex(std::string{"uri"});
49  return jv;
50 }
51 
53 del(jtx::Account const& account)
54 {
55  Json::Value jv;
56  jv[jss::TransactionType] = jss::DIDDelete;
57  jv[jss::Account] = to_string(account.id());
58  jv[jss::Flags] = tfUniversal;
59  return jv;
60 }
61 
62 } // namespace did
63 
64 } // namespace jtx
65 
66 } // namespace test
67 } // namespace ripple
std::string
STL class.
ripple::test::jtx::did::setValid
Json::Value setValid(jtx::Account const &account)
Definition: did.cpp:42
ripple::keylet::did
Keylet did(AccountID const &account) noexcept
Definition: Indexes.cpp:442
ripple::SField::jsonName
const Json::StaticString jsonName
Definition: SField.h:163
ripple::test::jtx::did::set
Json::Value set(jtx::Account const &account)
Definition: did.cpp:32
ripple::test::jtx::did::del
Json::Value del(jtx::Account const &account)
Definition: did.cpp:53
ripple::sfURI
const SF_VL sfURI
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::test::jtx::Account
Immutable cryptographic account descriptor.
Definition: Account.h:37
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:30
ripple::tfUniversal
constexpr std::uint32_t tfUniversal
Definition: TxFlags.h:59
Json::Value
Represents a JSON value.
Definition: json_value.h:145