xrpld
Loading...
Searching...
No Matches
proposal.h
1#pragma once
2
3#include <test/jtx/Account.h>
4#include <test/jtx/Env.h>
5#include <test/jtx/JTx.h>
6
7#include <xrpl/basics/base_uint.h>
8#include <xrpl/basics/chrono.h>
9#include <xrpl/json/json_value.h>
10#include <xrpl/ledger/helpers/ProposalHelpers.h>
11#include <xrpl/protocol/AccountID.h>
12#include <xrpl/protocol/STLedgerEntry.h>
13
14#include <cstdint>
15#include <optional>
16#include <vector>
17
22
23// The owner-reserve increments a proposal holds against its proposer. Tests
24// spend these rather than repeating their values, so they follow the transactor
25// instead of checking it; TransactionProposalCreate_test pins the values
26// themselves, so a change to them has to be a deliberate one.
29
41json::Value
42create(Account const& proposer, json::Value const& proposedTx, std::uint32_t expiration);
43
51json::Value
52cancel(Account const& account, uint256 const& proposalID);
53
61namespace verify {
62
66class Create
67{
68public:
72 void
73 operator()(Env&, JTx&) const;
74};
75
88[[nodiscard]] inline Create
90{
91 return Create{};
92}
93
94} // namespace verify
95
119unsignedPayload(Env const& env, json::Value tx, std::uint32_t ticketSeq);
120
131
150 Env const& env,
151 Account const& target,
152 std::uint32_t ticketSeq,
153 std::uint32_t flags,
154 std::vector<json::Value> const& inners,
155 std::optional<std::uint32_t> numSigners = std::nullopt);
156
171void
172authorizeProposer(Env& env, Account const& target, Account const& proposer);
173
185createTicket(Env& env, Account const& account, std::uint32_t count = 1);
186
194
199[[nodiscard]] SLE::const_pointer
200entry(Env const& env, AccountID const& target, std::uint32_t ticketSeq);
201[[nodiscard]] SLE::const_pointer
202entry(Env const& env, Account const& target, std::uint32_t ticketSeq);
203
204} // namespace xrpl::test::jtx::proposal
Represents a JSON value.
Definition json_value.h:121
std::chrono::duration< rep, period > duration
Definition chrono.h:47
std::shared_ptr< STLedgerEntry const > const_pointer
Immutable cryptographic account descriptor.
Definition jtx/Account.h:21
A transaction testing environment.
Definition Env.h:161
The condition returned by create(); see it for what is checked.
Definition proposal.h:67
void operator()(Env &, JTx &) const
Definition proposal.cpp:208
constexpr std::uint32_t kBatchProposalOwnerCount
Owner-reserve increments held by a proposal of a Batch transaction.
constexpr std::uint32_t kProposalOwnerCount
Owner-reserve increments held by a proposal of an ordinary transaction.
Conditions that check what a proposal transaction did to the ledger.
Definition proposal.h:61
Create create()
Check the ledger effects a TransactionProposalCreate must have, whatever its outcome: on tesSUCCESS a...
Definition proposal.h:89
Helpers for constructing TransactionProposal test transactions.
Definition proposal.cpp:37
json::Value innerTx(json::Value tx, std::uint32_t seq)
Put a transaction into the form an inner transaction of a proposed Batch takes, as batch::Inner does ...
Definition proposal.cpp:80
std::uint32_t createTicket(Env &env, Account const &account, std::uint32_t count)
Create tickets for a proposal to be built against, and close the ledger.
Definition proposal.cpp:128
json::Value unsignedPayload(Env const &env, json::Value tx, std::uint32_t ticketSeq)
Put a transaction of any type into the form a proposal stores it in: unsigned and ticket-based,...
Definition proposal.cpp:61
SLE::const_pointer entry(Env const &env, AccountID const &target, std::uint32_t ticketSeq)
The proposal stored against a target account's ticket.
Definition proposal.cpp:145
json::Value create(Account const &proposer, json::Value const &proposedTx, std::uint32_t expiration)
Build a TransactionProposalCreate carrying an unsigned proposed transaction.
Definition proposal.cpp:40
void authorizeProposer(Env &env, Account const &target, Account const &proposer)
Give proposer a place on target's SignerList, so it may create proposals against target.
Definition proposal.cpp:121
json::Value unsignedBatch(Env const &env, Account const &target, std::uint32_t ticketSeq, std::uint32_t flags, std::vector< json::Value > const &inners, std::optional< std::uint32_t > numSigners)
An unsigned outer Batch payload holding inners.
Definition proposal.cpp:86
std::uint32_t expiration(Env &env, NetClock::duration delta)
An absolute expiration delta past the environment's current time.
Definition proposal.cpp:139
json::Value cancel(Account const &account, uint256 const &proposalID)
Build a TransactionProposalCancel naming the proposal to delete.
Definition proposal.cpp:51
BaseUInt< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
Definition AccountID.h:34
UInt256 uint256
Definition base_uint.h:587
Execution context for applying a JSON transaction.
Definition JTx.h:27