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

Public Member Functions

 BitcoinLikeInputApi (const std::shared_ptr< OperationApi > &operation, int32_t inputIndex)
 
optional< std::string > getAddress () override
 
std::shared_ptr< api::AmountgetValue () override
 
bool isCoinbase () override
 
optional< std::string > getCoinbase () override
 
optional< std::string > getPreviousTxHash () override
 
optional< int32_t > getPreviousOutputIndex () override
 
std::vector< std::vector< uint8_t > > getPublicKeys () override
 
std::vector< std::shared_ptr< api::DerivationPath > > getDerivationPath () override
 
std::shared_ptr< api::BitcoinLikeOutputgetPreviousOuput () override
 
std::vector< uint8_t > getScriptSig () override
 
std::shared_ptr< api::BitcoinLikeScriptparseScriptSig () override
 
void setScriptSig (const std::vector< uint8_t > &scriptSig) override
 
void pushToScriptSig (const std::vector< uint8_t > &data) override
 
void setSequence (int32_t sequence) override
 
int64_t getSequence () override
 
void getPreviousTransaction (const std::shared_ptr< api::BinaryCallback > &callback) override
 
void setP2PKHSigScript (const std::vector< uint8_t > &signature) override
 
- Public Member Functions inherited from ledger::core::api::BitcoinLikeInput
virtual void getPreviousTransaction (const std::shared_ptr< BinaryCallback > &callback)=0
 

Member Function Documentation

◆ getAddress()

optional< std::string > ledger::core::BitcoinLikeInputApi::getAddress ( )
overridevirtual

Returns the address of the input (if an address can be computed).

Implements ledger::core::api::BitcoinLikeInput.

◆ getCoinbase()

optional< std::string > ledger::core::BitcoinLikeInputApi::getCoinbase ( )
overridevirtual

Stored data cointained in coinbase.

Returns
Optional String

Implements ledger::core::api::BitcoinLikeInput.

◆ getDerivationPath()

std::vector< std::shared_ptr< api::DerivationPath > > ledger::core::BitcoinLikeInputApi::getDerivationPath ( )
overridevirtual

Returns the derivation path of this input if the address is owned by the wallet.

Implements ledger::core::api::BitcoinLikeInput.

◆ getPreviousOuput()

std::shared_ptr< api::BitcoinLikeOutput > ledger::core::BitcoinLikeInputApi::getPreviousOuput ( )
overridevirtual

Retrieve the output spent by this input. Depending on the implementation this method may use a lock to fetch data from a database. Therefore it may have poor performance, use with caution.

Returns
The output spent by this input.

Implements ledger::core::api::BitcoinLikeInput.

◆ getPreviousOutputIndex()

optional< int32_t > ledger::core::BitcoinLikeInputApi::getPreviousOutputIndex ( )
overridevirtual

Get output index, it identifies which UTXO from tht transaction to spend.

Returns
Optional 32 bits integer, index of previous transaction

Implements ledger::core::api::BitcoinLikeInput.

◆ getPreviousTxHash()

optional< std::string > ledger::core::BitcoinLikeInputApi::getPreviousTxHash ( )
overridevirtual

Get the transaction hash of the output spent by this input. The result can be NULL if the output is not owned by the wallet.

Implements ledger::core::api::BitcoinLikeInput.

◆ getPublicKeys()

std::vector< std::vector< uint8_t > > ledger::core::BitcoinLikeInputApi::getPublicKeys ( )
overridevirtual

Returns the public associated with the address. This value can be NULL if you are building a transaction with an address which does not belong to your wallet.

Implements ledger::core::api::BitcoinLikeInput.

◆ getScriptSig()

std::vector< uint8_t > ledger::core::BitcoinLikeInputApi::getScriptSig ( )
overridevirtual

Get ScriptSig of this input. The scriptsig is the first half of a script necessary to spend a previous output.

Implements ledger::core::api::BitcoinLikeInput.

◆ getSequence()

int64_t ledger::core::BitcoinLikeInputApi::getSequence ( )
overridevirtual

Get the sequence number of this input.

Implements ledger::core::api::BitcoinLikeInput.

◆ getValue()

std::shared_ptr< api::Amount > ledger::core::BitcoinLikeInputApi::getValue ( )
overridevirtual

Returns the value of the amount. Depending on the backend this value may not exist if the input is not owned by the wallet.

Implements ledger::core::api::BitcoinLikeInput.

◆ isCoinbase()

bool ledger::core::BitcoinLikeInputApi::isCoinbase ( )
overridevirtual

Check whether input is for a coinbase.

Returns
Boolean, true if input belongs to coinbase transaction (reward for mining a block)

Implements ledger::core::api::BitcoinLikeInput.

◆ parseScriptSig()

std::shared_ptr< api::BitcoinLikeScript > ledger::core::BitcoinLikeInputApi::parseScriptSig ( )
overridevirtual

Parse the script sig to a [[BitcoinLikeScript]].

Implements ledger::core::api::BitcoinLikeInput.

◆ pushToScriptSig()

void ledger::core::BitcoinLikeInputApi::pushToScriptSig ( const std::vector< uint8_t > &  data)
overridevirtual

Push data to the end of the current ScriptSig.

Implements ledger::core::api::BitcoinLikeInput.

◆ setP2PKHSigScript()

void ledger::core::BitcoinLikeInputApi::setP2PKHSigScript ( const std::vector< uint8_t > &  signature)
overridevirtual

Easy way to set the P2PKH script signature. Shorthand for input.pushToScriptSig(input.getPublicKeys()[0], signature).

Implements ledger::core::api::BitcoinLikeInput.

◆ setScriptSig()

void ledger::core::BitcoinLikeInputApi::setScriptSig ( const std::vector< uint8_t > &  scriptSig)
overridevirtual

Set the ScriptS to the given value.

Parameters
scriptSigThe ScriptSig to use for this input

Implements ledger::core::api::BitcoinLikeInput.

◆ setSequence()

void ledger::core::BitcoinLikeInputApi::setSequence ( int32_t  sequence)
overridevirtual

Set the sequence number of this input.

Implements ledger::core::api::BitcoinLikeInput.


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