ledger-core
Public Member Functions | List of all members
ledger::core::BitcoinLikeTransactionBuilder Class Reference
+ Inheritance diagram for ledger::core::BitcoinLikeTransactionBuilder:
+ Collaboration diagram for ledger::core::BitcoinLikeTransactionBuilder:

Public Member Functions

 BitcoinLikeTransactionBuilder (const std::shared_ptr< api::ExecutionContext > &context, const api::Currency &params, const std::shared_ptr< spdlog::logger > &logger, const BitcoinLikeTransactionBuildFunction &buildFunction)
 
 BitcoinLikeTransactionBuilder (const BitcoinLikeTransactionBuilder &cpy)
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderaddInput (const std::string &transactionHash, int32_t index, int32_t sequence) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderaddOutput (const std::shared_ptr< api::Amount > &amount, const std::shared_ptr< api::BitcoinLikeScript > &script) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderaddChangePath (const std::string &path) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderexcludeUtxo (const std::string &transactionHash, int32_t outputIndex) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuildersetNumberOfChangeAddresses (int32_t count) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderpickInputs (api::BitcoinLikePickingStrategy strategy, int32_t sequence) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuildersendToAddress (const std::shared_ptr< api::Amount > &amount, const std::string &address) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderwipeToAddress (const std::string &address) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuildersetFeesPerByte (const std::shared_ptr< api::Amount > &fees) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuildersetMaxAmountOnChange (const std::shared_ptr< api::Amount > &amount) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuildersetMinAmountOnChange (const std::shared_ptr< api::Amount > &amount) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderclone () override
 
void reset () override
 
void build (const std::shared_ptr< api::BitcoinLikeTransactionCallback > &callback) override
 
Future< std::shared_ptr< api::BitcoinLikeTransaction > > build ()
 
- Public Member Functions inherited from ledger::core::api::BitcoinLikeTransactionBuilder
virtual std::shared_ptr< BitcoinLikeTransactionBuilderaddOutput (const std::shared_ptr< Amount > &amount, const std::shared_ptr< BitcoinLikeScript > &script)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuildersetMaxAmountOnChange (const std::shared_ptr< Amount > &amount)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuildersetMinAmountOnChange (const std::shared_ptr< Amount > &amount)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuildersendToAddress (const std::shared_ptr< Amount > &amount, const std::string &address)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuildersetFeesPerByte (const std::shared_ptr< Amount > &fees)=0
 
virtual void build (const std::shared_ptr< BitcoinLikeTransactionCallback > &callback)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from ledger::core::api::BitcoinLikeTransactionBuilder
static std::shared_ptr< BitcoinLikeTransactionparseRawUnsignedTransaction (const Currency &currency, const std::vector< uint8_t > &rawTransaction, std::experimental::optional< int32_t > currentBlockHeight)
 

Member Function Documentation

◆ addChangePath()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::addChangePath ( const std::string &  path)
overridevirtual

If needed the transaction will send its change to the given path. It is possible to add multiple change path.

Returns
A reference on the same builder in order to chain calls.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ addInput()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::addInput ( const std::string &  transactionHash,
int32_t  index,
int32_t  sequence 
)
overridevirtual

Add the given input to the final transaction.

Parameters
transactionhashThe hash of the transaction in where the UTXO can be located. index Index of the UTXO in the previous transaction sequence Sequence number to add at the end of the input serialization. This can be used for RBF transaction
Returns
A reference on the same builder in order to chain calls.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ clone()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::clone ( )
overridevirtual

Creates a clone of this builder.

Returns
A copy of the current builder instance.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ excludeUtxo()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::excludeUtxo ( const std::string &  transactionHash,
int32_t  outputIndex 
)
overridevirtual

Exclude UTXO from the coin selection (alias UTXO picking). You can call this method multiple times to exclude multiple UTXO.

Parameters
transactionHashThe hash of the transaction in which this UTXO can be found.
outputIndexThe position of the output in the previous transaction,
Returns
A reference on the same builder in order to chain calls.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ pickInputs()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::pickInputs ( api::BitcoinLikePickingStrategy  strategy,
int32_t  sequence 
)
overridevirtual

Set the UTXO picking strategy (see [[BitcoinLikePickingStrategy]]).

Parameters
strategyThe strategy to adopt in order to select which input to use in the transaction.
sequenceThe sequence value serialized at the end of the raw transaction. If you don't know what to put here just use 0xFFFFFF
Returns
A reference on the same builder in order to chain calls.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ reset()

void ledger::core::BitcoinLikeTransactionBuilder::reset ( )
overridevirtual

Reset the current instance to its initial state.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ setNumberOfChangeAddresses()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::setNumberOfChangeAddresses ( int32_t  count)
overridevirtual

Set the the number of change addresses in the transaction builder.

Returns
A reference on the same builder in order to chain calls.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.

◆ wipeToAddress()

std::shared_ptr< api::BitcoinLikeTransactionBuilder > ledger::core::BitcoinLikeTransactionBuilder::wipeToAddress ( const std::string &  address)
overridevirtual

Send all available funds to the given address.

Parameters
addressAddress of the recipient
Returns
A reference on the same builder in order to chain calls.

Implements ledger::core::api::BitcoinLikeTransactionBuilder.


The documentation for this class was generated from the following files: