rippled
Loading...
Searching...
No Matches
multisign.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 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#ifndef RIPPLE_TEST_JTX_MULTISIGN_H_INCLUDED
21#define RIPPLE_TEST_JTX_MULTISIGN_H_INCLUDED
22
23#include <test/jtx/Account.h>
24#include <test/jtx/SignerUtils.h>
25#include <test/jtx/amount.h>
26#include <test/jtx/owners.h>
27#include <test/jtx/tags.h>
28
29#include <concepts>
30#include <cstdint>
31#include <optional>
32
33namespace ripple {
34namespace test {
35namespace jtx {
36
38struct signer
39{
43
45 Account account_,
46 std::uint32_t weight_ = 1,
47 std::optional<uint256> tag_ = std::nullopt)
48 : weight(weight_), account(std::move(account_)), tag(std::move(tag_))
49 {
50 }
51};
52
55 Account const& account,
56 std::uint32_t quorum,
57 std::vector<signer> const& v);
58
61signers(Account const& account, none_t);
62
63//------------------------------------------------------------------------------
64
66class msig
67{
68public:
70
71 msig(std::vector<Reg> signers_) : signers(std::move(signers_))
72 {
74 }
75
76 template <class AccountType, class... Accounts>
77 requires std::convertible_to<AccountType, Reg>
78 explicit msig(AccountType&& a0, Accounts&&... aN)
79 : signers{std::forward<AccountType>(a0), std::forward<Accounts>(aN)...}
80 {
82 }
83
84 void
85 operator()(Env&, JTx& jt) const;
86};
87
88//------------------------------------------------------------------------------
89
92
93} // namespace jtx
94} // namespace test
95} // namespace ripple
96
97#endif
Represents a JSON value.
Definition: json_value.h:149
Immutable cryptographic account descriptor.
Definition: Account.h:39
A transaction testing environment.
Definition: Env.h:121
Set a multisignature on a JTx.
Definition: multisign.h:67
void operator()(Env &, JTx &jt) const
Definition: multisign.cpp:69
msig(std::vector< Reg > signers_)
Definition: multisign.h:71
msig(AccountType &&a0, Accounts &&... aN)
Definition: multisign.h:78
std::vector< Reg > signers
Definition: multisign.h:69
Json::Value signers(Account const &account, std::uint32_t quorum, std::vector< signer > const &v)
Definition: multisign.cpp:34
void sortSigners(std::vector< Reg > &signers)
Definition: SignerUtils.h:44
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:25
STL namespace.
Execution context for applying a JSON transaction.
Definition: JTx.h:45
A signer in a SignerList.
Definition: multisign.h:39
std::optional< uint256 > tag
Definition: multisign.h:42
signer(Account account_, std::uint32_t weight_=1, std::optional< uint256 > tag_=std::nullopt)
Definition: multisign.h:44
std::uint32_t weight
Definition: multisign.h:40