xrpld
Loading...
Searching...
No Matches
xrpl::Transaction Class Reference

#include <Transaction.h>

Inheritance diagram for xrpl::Transaction:
Collaboration diagram for xrpl::Transaction:

Classes

struct  SubmitResult
struct  CurrentLedgerState
struct  Locator

Public Types

using pointer = std::shared_ptr<Transaction>
using ref = pointer const&

Public Member Functions

 Transaction (std::shared_ptr< STTx const > const &, std::string &, Application &) noexcept
std::shared_ptr< STTx const > const & getSTransaction ()
uint256 const & getID () const
LedgerIndex getLedger () const
bool isValidated () const
TransStatus getStatus () const
TER getResult ()
void setResult (TER terResult)
void setStatus (TransStatus status, std::uint32_t ledgerSeq, std::optional< uint32_t > transactionSeq=std::nullopt, std::optional< uint32_t > networkID=std::nullopt)
void setStatus (TransStatus status)
void setLedger (LedgerIndex ledger)
void setApplying ()
 Set this flag once added to a batch.
bool getApplying () const
 Detect if transaction is being batched.
void clearApplying ()
 Indicate that transaction application has been attempted.
SubmitResult getSubmitResult () const
 getSubmitResult Return submit result
void clearSubmitResult ()
 clearSubmitResult Clear all flags in SubmitResult
void setApplied ()
 setApplied Set this flag once was applied to open ledger
void setQueued ()
 setQueued Set this flag once was put into held-txns queue
void setBroadcast ()
 setBroadcast Set this flag once was broadcasted via network
void setKept ()
 setKept Set this flag once was put to localtxns queue
std::optional< CurrentLedgerStategetCurrentLedgerState () const
 getCurrentLedgerState Get current ledger state of transaction
void setCurrentLedgerState (LedgerIndex validatedLedger, XRPAmount fee, std::uint32_t accountSeq, std::uint32_t availableSeq)
 setCurrentLedgerState Set current ledger state of transaction
json::Value getJson (JsonOptions options, bool binary=false) const
shared_from_this (T... args)
weak_from_this (T... args)

Static Public Member Functions

static Transaction::pointer transactionFromSQL (boost::optional< std::uint64_t > const &ledgerSeq, boost::optional< std::string > const &status, Blob const &rawTxn, Application &app)
static TransStatus sqlTransactionStatus (boost::optional< std::string > const &status)
static Locator locate (uint256 const &id, Application &app)
static std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearchedload (uint256 const &id, Application &app, ErrorCodeI &ec)
static std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearchedload (uint256 const &id, Application &app, ClosedInterval< uint32_t > const &range, ErrorCodeI &ec)

Public Attributes

friend Object

Static Private Member Functions

static std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearchedload (uint256 const &id, Application &app, std::optional< ClosedInterval< uint32_t > > const &range, ErrorCodeI &ec)
static auto & getCounter () noexcept

Private Attributes

uint256 transactionID_
LedgerIndex ledgerIndex_ = 0
std::optional< uint32_t > txnSeq_
std::optional< uint32_t > networkID_
TransStatus status_ = TransStatus::INVALID
TER result_ = temUNCERTAIN
bool applying_ = false
SubmitResult submitResult_
 different ways for transaction to be accepted
std::optional< CurrentLedgerStatecurrentLedgerState_
std::shared_ptr< STTx const > transaction_
Applicationapp_
beast::Journal j_

Detailed Description

Definition at line 53 of file Transaction.h.

Member Typedef Documentation

◆ pointer

◆ ref

Definition at line 58 of file Transaction.h.

Constructor & Destructor Documentation

◆ Transaction()

xrpl::Transaction::Transaction ( std::shared_ptr< STTx const > const & stx,
std::string & reason,
Application & app )
noexcept

Definition at line 35 of file Transaction.cpp.

Member Function Documentation

◆ transactionFromSQL()

Transaction::pointer xrpl::Transaction::transactionFromSQL ( boost::optional< std::uint64_t > const & ledgerSeq,
boost::optional< std::string > const & status,
Blob const & rawTxn,
Application & app )
static

Definition at line 100 of file Transaction.cpp.

◆ sqlTransactionStatus()

TransStatus xrpl::Transaction::sqlTransactionStatus ( boost::optional< std::string > const & status)
static

Definition at line 74 of file Transaction.cpp.

◆ getSTransaction()

std::shared_ptr< STTx const > const & xrpl::Transaction::getSTransaction ( )

Definition at line 77 of file Transaction.h.

◆ getID()

uint256 const & xrpl::Transaction::getID ( ) const

Definition at line 83 of file Transaction.h.

◆ getLedger()

LedgerIndex xrpl::Transaction::getLedger ( ) const

Definition at line 89 of file Transaction.h.

◆ isValidated()

bool xrpl::Transaction::isValidated ( ) const

Definition at line 95 of file Transaction.h.

◆ getStatus()

TransStatus xrpl::Transaction::getStatus ( ) const

Definition at line 101 of file Transaction.h.

◆ getResult()

TER xrpl::Transaction::getResult ( )

Definition at line 107 of file Transaction.h.

◆ setResult()

void xrpl::Transaction::setResult ( TER terResult)

Definition at line 113 of file Transaction.h.

◆ setStatus() [1/2]

void xrpl::Transaction::setStatus ( TransStatus status,
std::uint32_t ledgerSeq,
std::optional< uint32_t > transactionSeq = std::nullopt,
std::optional< uint32_t > networkID = std::nullopt )

◆ setStatus() [2/2]

void xrpl::Transaction::setStatus ( TransStatus status)

Definition at line 126 of file Transaction.h.

◆ setLedger()

void xrpl::Transaction::setLedger ( LedgerIndex ledger)

Definition at line 132 of file Transaction.h.

◆ setApplying()

void xrpl::Transaction::setApplying ( )

Set this flag once added to a batch.

Definition at line 141 of file Transaction.h.

◆ getApplying()

bool xrpl::Transaction::getApplying ( ) const

Detect if transaction is being batched.

Returns
Whether transaction is being applied within a batch.

Definition at line 154 of file Transaction.h.

◆ clearApplying()

void xrpl::Transaction::clearApplying ( )

Indicate that transaction application has been attempted.

Definition at line 165 of file Transaction.h.

◆ getSubmitResult()

SubmitResult xrpl::Transaction::getSubmitResult ( ) const

getSubmitResult Return submit result

Returns
SubmitResult struct

Definition at line 207 of file Transaction.h.

◆ clearSubmitResult()

void xrpl::Transaction::clearSubmitResult ( )

clearSubmitResult Clear all flags in SubmitResult

Definition at line 216 of file Transaction.h.

◆ setApplied()

void xrpl::Transaction::setApplied ( )

setApplied Set this flag once was applied to open ledger

Definition at line 225 of file Transaction.h.

◆ setQueued()

void xrpl::Transaction::setQueued ( )

setQueued Set this flag once was put into held-txns queue

Definition at line 234 of file Transaction.h.

◆ setBroadcast()

void xrpl::Transaction::setBroadcast ( )

setBroadcast Set this flag once was broadcasted via network

Definition at line 243 of file Transaction.h.

◆ setKept()

void xrpl::Transaction::setKept ( )

setKept Set this flag once was put to localtxns queue

Definition at line 252 of file Transaction.h.

◆ getCurrentLedgerState()

std::optional< CurrentLedgerState > xrpl::Transaction::getCurrentLedgerState ( ) const

getCurrentLedgerState Get current ledger state of transaction

Returns
Current ledger state

Definition at line 284 of file Transaction.h.

◆ setCurrentLedgerState()

void xrpl::Transaction::setCurrentLedgerState ( LedgerIndex validatedLedger,
XRPAmount fee,
std::uint32_t accountSeq,
std::uint32_t availableSeq )

setCurrentLedgerState Set current ledger state of transaction

Parameters
validatedLedgerNumber of last validated ledger
feeminimum Fee required for the transaction
accountSeqFirst valid account sequence in current ledger
availableSeqFirst available sequence for the transaction

Definition at line 297 of file Transaction.h.

◆ getJson()

json::Value xrpl::Transaction::getJson ( JsonOptions options,
bool binary = false ) const

Definition at line 150 of file Transaction.cpp.

◆ locate()

Locator xrpl::Transaction::locate ( uint256 const & id,
Application & app )
static

◆ load() [1/3]

std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > xrpl::Transaction::load ( uint256 const & id,
Application & app,
ErrorCodeI & ec )
static

Definition at line 119 of file Transaction.cpp.

◆ load() [2/3]

std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > xrpl::Transaction::load ( uint256 const & id,
Application & app,
ClosedInterval< uint32_t > const & range,
ErrorCodeI & ec )
static

Definition at line 125 of file Transaction.cpp.

◆ load() [3/3]

std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > xrpl::Transaction::load ( uint256 const & id,
Application & app,
std::optional< ClosedInterval< uint32_t > > const & range,
ErrorCodeI & ec )
staticprivate

Definition at line 137 of file Transaction.cpp.

◆ getCounter()

auto & xrpl::CountedObject< Transaction >::getCounter ( )
staticprivatenoexceptinherited

Definition at line 113 of file CountedObject.h.

Member Data Documentation

◆ transactionID_

uint256 xrpl::Transaction::transactionID_
private

Definition at line 388 of file Transaction.h.

◆ ledgerIndex_

LedgerIndex xrpl::Transaction::ledgerIndex_ = 0
private

Definition at line 390 of file Transaction.h.

◆ txnSeq_

std::optional<uint32_t> xrpl::Transaction::txnSeq_
private

Definition at line 391 of file Transaction.h.

◆ networkID_

std::optional<uint32_t> xrpl::Transaction::networkID_
private

Definition at line 392 of file Transaction.h.

◆ status_

TransStatus xrpl::Transaction::status_ = TransStatus::INVALID
private

Definition at line 393 of file Transaction.h.

◆ result_

TER xrpl::Transaction::result_ = temUNCERTAIN
private

Definition at line 394 of file Transaction.h.

◆ applying_

bool xrpl::Transaction::applying_ = false
private

Definition at line 413 of file Transaction.h.

◆ submitResult_

SubmitResult xrpl::Transaction::submitResult_
private

different ways for transaction to be accepted

Definition at line 418 of file Transaction.h.

◆ currentLedgerState_

std::optional<CurrentLedgerState> xrpl::Transaction::currentLedgerState_
private

Definition at line 420 of file Transaction.h.

◆ transaction_

std::shared_ptr<STTx const> xrpl::Transaction::transaction_
private

Definition at line 422 of file Transaction.h.

◆ app_

Application& xrpl::Transaction::app_
private

Definition at line 423 of file Transaction.h.

◆ j_

beast::Journal xrpl::Transaction::j_
private

Definition at line 424 of file Transaction.h.

◆ Object

Definition at line 138 of file CountedObject.h.