ledger-core
Public Member Functions | Static Public Member Functions | List of all members
ledger::core::api::BitcoinLikeTransactionBuilder Class Referenceabstract
+ Inheritance diagram for ledger::core::api::BitcoinLikeTransactionBuilder:

Public Member Functions

virtual std::shared_ptr< BitcoinLikeTransactionBuilderaddInput (const std::string &transactionHash, int32_t index, int32_t sequence)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuilderaddOutput (const std::shared_ptr< Amount > &amount, const std::shared_ptr< BitcoinLikeScript > &script)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuilderaddChangePath (const std::string &path)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuilderexcludeUtxo (const std::string &transactionHash, int32_t outputIndex)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuildersetNumberOfChangeAddresses (int32_t count)=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< BitcoinLikeTransactionBuilderpickInputs (BitcoinLikePickingStrategy strategy, int32_t sequence)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuildersendToAddress (const std::shared_ptr< Amount > &amount, const std::string &address)=0
 
virtual std::shared_ptr< BitcoinLikeTransactionBuilderwipeToAddress (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
 
virtual std::shared_ptr< BitcoinLikeTransactionBuilderclone ()=0
 
virtual void reset ()=0
 

Static Public Member Functions

static std::shared_ptr< BitcoinLikeTransactionparseRawUnsignedTransaction (const Currency &currency, const std::vector< uint8_t > &rawTransaction, std::experimental::optional< int32_t > currentBlockHeight)
 

Member Function Documentation

◆ addChangePath()

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

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.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ addInput()

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

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.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ addOutput()

virtual std::shared_ptr<BitcoinLikeTransactionBuilder> ledger::core::api::BitcoinLikeTransactionBuilder::addOutput ( const std::shared_ptr< Amount > &  amount,
const std::shared_ptr< BitcoinLikeScript > &  script 
)
pure virtual

Add the given output to the final transaction.

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

◆ build()

virtual void ledger::core::api::BitcoinLikeTransactionBuilder::build ( const std::shared_ptr< BitcoinLikeTransactionCallback > &  callback)
pure virtual

Build a transaction from the given builder parameters.

◆ clone()

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

Creates a clone of this builder.

Returns
A copy of the current builder instance.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ excludeUtxo()

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

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.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ parseRawUnsignedTransaction()

std::shared_ptr< api::BitcoinLikeTransaction > ledger::core::api::BitcoinLikeTransactionBuilder::parseRawUnsignedTransaction ( const Currency currency,
const std::vector< uint8_t > &  rawTransaction,
std::experimental::optional< int32_t >  currentBlockHeight 
)
static

Parsing unsigned transaction. parsing a tx might change depending on block height we are on (if an update is effective starting from a given hight)

◆ pickInputs()

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

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.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ reset()

virtual void ledger::core::api::BitcoinLikeTransactionBuilder::reset ( )
pure virtual

Reset the current instance to its initial state.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ sendToAddress()

virtual std::shared_ptr<BitcoinLikeTransactionBuilder> ledger::core::api::BitcoinLikeTransactionBuilder::sendToAddress ( const std::shared_ptr< Amount > &  amount,
const std::string &  address 
)
pure virtual

Send funds to the given address. This method can be called multiple times to send to multiple addresses.

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

◆ setFeesPerByte()

virtual std::shared_ptr<BitcoinLikeTransactionBuilder> ledger::core::api::BitcoinLikeTransactionBuilder::setFeesPerByte ( const std::shared_ptr< Amount > &  fees)
pure virtual

Set the amount of fees per byte (of the raw transaction).

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

◆ setMaxAmountOnChange()

virtual std::shared_ptr<BitcoinLikeTransactionBuilder> ledger::core::api::BitcoinLikeTransactionBuilder::setMaxAmountOnChange ( const std::shared_ptr< Amount > &  amount)
pure virtual

Set the maximum amount per change output. By default there is no max amount.

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

◆ setMinAmountOnChange()

virtual std::shared_ptr<BitcoinLikeTransactionBuilder> ledger::core::api::BitcoinLikeTransactionBuilder::setMinAmountOnChange ( const std::shared_ptr< Amount > &  amount)
pure virtual

Set the minimum amount per change output. By default this value is the dust value of the currency.

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

◆ setNumberOfChangeAddresses()

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

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

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

Implemented in ledger::core::BitcoinLikeTransactionBuilder.

◆ wipeToAddress()

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

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.

Implemented in ledger::core::BitcoinLikeTransactionBuilder.


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