20 #include <ripple/protocol/STXChainBridge.h>
22 #include <ripple/protocol/Indexes.h>
23 #include <ripple/protocol/Issue.h>
24 #include <ripple/protocol/PublicKey.h>
25 #include <ripple/protocol/SField.h>
26 #include <ripple/protocol/STAccount.h>
27 #include <ripple/protocol/STObject.h>
28 #include <ripple/protocol/STXChainBridge.h>
29 #include <ripple/protocol/Serializer.h>
30 #include <ripple/protocol/UintTypes.h>
31 #include <ripple/protocol/jss.h>
32 #include <ripple/protocol/tokens.h>
34 #include <boost/format.hpp>
48 Issue const& srcChainIssue,
50 Issue const& dstChainIssue)
78 Throw<std::runtime_error>(
79 "STXChainBridge can only be specified with a 'object' Json value");
83 static auto const jbridge =
85 for (
auto it = v.begin(); it != v.end(); ++it)
88 if (!jbridge.isMember(name))
90 Throw<std::runtime_error>(
91 "STXChainBridge extra field detected: " + name);
105 if (!lockingChainDoorStr.
isString())
107 Throw<std::runtime_error>(
108 "STXChainBridge LockingChainDoor must be a string Json value");
110 if (!issuingChainDoorStr.
isString())
112 Throw<std::runtime_error>(
113 "STXChainBridge IssuingChainDoor must be a string Json value");
116 auto const lockingChainDoor =
117 parseBase58<AccountID>(lockingChainDoorStr.
asString());
118 auto const issuingChainDoor =
119 parseBase58<AccountID>(issuingChainDoorStr.
asString());
120 if (!lockingChainDoor)
122 Throw<std::runtime_error>(
123 "STXChainBridge LockingChainDoor must be a valid account");
125 if (!issuingChainDoor)
127 Throw<std::runtime_error>(
128 "STXChainBridge IssuingChainDoor must be a valid account");
172 boost::format(
"{ %s = %s, %s = %s, %s = %s, %s = %s }") %
200 return v && (*v == *
this);
213 return std::make_unique<STXChainBridge>(sit, name);
225 return emplace(n, buf, std::move(*
this));
void add(Serializer &s) const override
STIssue issuingChainIssue_
A currency issued by an account.
const SF_ACCOUNT sfLockingChainDoor
SerializedTypeID getSType() const override
STAccount issuingChainDoor_
Json::StaticString const & getJsonName() const
bool isDefault() const override
STObject toSTObject() const
STBase * move(std::size_t n, void *buf) override
STIssue lockingChainIssue_
static std::unique_ptr< STXChainBridge > construct(SerialIter &, SField const &name)
Json::Value getJson(JsonOptions) const override
static STBase * emplace(std::size_t n, void *buf, T &&val)
std::string getText() const override
const SF_ISSUE sfLockingChainIssue
Issue issueFromJson(Json::Value const &v)
STAccount lockingChainDoor_
void add(Serializer &s) const override
bool isDefault() const override
STBase * copy(std::size_t n, void *buf) const override
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string getText() const override
A type which can be exported to a well known binary format.
std::string const & getName() const
bool isEquivalent(const STBase &t) const override
const SF_ACCOUNT sfIssuingChainDoor
std::string getText() const override
const SF_ISSUE sfIssuingChainIssue
bool isDefault() const override
const SF_XCHAIN_BRIDGE sfXChainBridge
virtual Json::Value getJson(JsonOptions) const
void add(Serializer &s) const override
std::string asString() const
Returns the unquoted string value.
Json::Value getJson(JsonOptions) const override