xrpld
Loading...
Searching...
No Matches
xrpl::test::jtx::proposal Namespace Reference

Helpers for constructing TransactionProposal test transactions. More...

Namespaces

namespace  verify
 Conditions that check what a proposal transaction did to the ledger.

Functions

json::Value create (Account const &proposer, json::Value const &proposedTx, std::uint32_t expiration)
 Build a TransactionProposalCreate carrying an unsigned proposed transaction.
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, with the fee the target account will pay fixed now.
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 for an ordinary Batch.
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=std::nullopt)
 An unsigned outer Batch payload holding inners.
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.
std::uint32_t createTicket (Env &env, Account const &account, std::uint32_t count=1)
 Create tickets for a proposal to be built against, and close the ledger.
std::uint32_t expiration (Env &env, NetClock::duration delta)
 An absolute expiration delta past the environment's current time.
SLE::const_pointer entry (Env const &env, AccountID const &target, std::uint32_t ticketSeq)
 The proposal stored against a target account's ticket.
SLE::const_pointer entry (Env const &env, Account const &target, std::uint32_t ticketSeq)

Variables

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.

Detailed Description

Helpers for constructing TransactionProposal test transactions.

Function Documentation

◆ create()

json::Value xrpl::test::jtx::proposal::create ( Account const & proposer,
json::Value const & proposedTx,
std::uint32_t expiration )

Build a TransactionProposalCreate carrying an unsigned proposed transaction.

Parameters
proposerThe account creating and paying the reserve for the proposal.
proposedTxThe proposed transaction, in unsigned canonical form; see unsignedPayload().
expirationAbsolute time after which the proposal may no longer be completed.
Returns
The TransactionProposalCreate JSON object.

Definition at line 40 of file proposal.cpp.

◆ unsignedPayload()

json::Value xrpl::test::jtx::proposal::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, with the fee the target account will pay fixed now.

This takes whatever any jtx generator produces — pay(), loan::set(), sponsor::transfer(), an outer Batch — and applies only what the proposal itself demands of the payload, so a test never hand-rolls those fields. It leaves the rest of tx untouched, which is what lets a test build one valid payload and then break exactly one rule of it.

The payload is ticket-based so unrelated activity on the target account cannot invalidate it while signatures are collected. A Fee already set on tx is left alone, so a payload whose fee is not the base fee — a Batch, say — can carry its own; otherwise the fee is filled in the same way as for an ordinary submission.

Parameters
envThe test environment providing ledger fee settings.
txThe transaction to propose.
ticketSeqA ticket sequence owned by tx's account.
Returns
The proposed transaction JSON object.

Definition at line 51 of file proposal.cpp.

◆ innerTx()

json::Value xrpl::test::jtx::proposal::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 for an ordinary Batch.

Parameters
txThe transaction to nest.
seqThe sequence number of tx's own account.
Returns
The inner transaction JSON object.

Definition at line 70 of file proposal.cpp.

◆ unsignedBatch()

json::Value xrpl::test::jtx::proposal::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 = std::nullopt )

An unsigned outer Batch payload holding inners.

A proposed Batch stores no BatchSigners — the participants' signatures are collected on-ledger afterwards — but its fee is fixed now and must already cover them. By default one signer is assumed for each inner account other than target, which is what those participants will contribute.

Parameters
envThe test environment providing ledger fee settings.
targetThe outer account of the Batch, and the proposal's target.
ticketSeqA ticket sequence owned by target.
flagsThe Batch mode flags, e.g. tfAllOrNothing.
innersThe inner transactions; see innerTx().
numSignersOverrides the number of signatures the fee accounts for.
Returns
The proposed Batch JSON object.

Definition at line 76 of file proposal.cpp.

◆ authorizeProposer()

void xrpl::test::jtx::proposal::authorizeProposer ( Env & env,
Account const & target,
Account const & proposer )

Give proposer a place on target's SignerList, so it may create proposals against target.

Only the target account itself, or an account on its SignerList, may create a TransactionProposalCreate against it (On-Chain Cosigner V1 authorization). Sets a minimal one-signer, quorum-1 list; the quorum itself is irrelevant here since it only governs the proposed transaction's own completion, not who may propose it.

Parameters
envThe test environment.
targetThe account whose SignerList is set.
proposerThe account to add to it.

Definition at line 111 of file proposal.cpp.

◆ createTicket()

std::uint32_t xrpl::test::jtx::proposal::createTicket ( Env & env,
Account const & account,
std::uint32_t count = 1 )

Create tickets for a proposal to be built against, and close the ledger.

Parameters
envThe test environment.
accountThe account that will own the tickets, i.e. the target of the proposals to come.
countHow many tickets to create.
Returns
The first ticket sequence created; the rest follow it.

Definition at line 118 of file proposal.cpp.

◆ expiration()

std::uint32_t xrpl::test::jtx::proposal::expiration ( Env & env,
NetClock::duration delta )

An absolute expiration delta past the environment's current time.

expiration(env, 0s) is an expiration that has already passed.

Definition at line 129 of file proposal.cpp.

◆ entry() [1/2]

SLE::const_pointer xrpl::test::jtx::proposal::entry ( Env const & env,
AccountID const & target,
std::uint32_t ticketSeq )
nodiscard

The proposal stored against a target account's ticket.

Returns
empty if no such proposal exists.

Definition at line 135 of file proposal.cpp.

◆ entry() [2/2]

SLE::const_pointer xrpl::test::jtx::proposal::entry ( Env const & env,
Account const & target,
std::uint32_t ticketSeq )
nodiscard

Definition at line 141 of file proposal.cpp.

Variable Documentation

◆ kBatchProposalOwnerCount

Owner-reserve increments held by a proposal of a Batch transaction.

A proposed Batch stores up to eight inner transactions plus multi-account signatures, so it reserves more than an ordinary proposed transaction.

Definition at line 21 of file ProposalHelpers.h.

◆ kProposalOwnerCount

Owner-reserve increments held by a proposal of an ordinary transaction.

Definition at line 14 of file ProposalHelpers.h.