Client
Extends xchain_utxo_1.Client
Custom Bitcoin Cash client
Parameters
params
UtxoClientParams (optional, defaultexports.defaultBchParams
)
getAddress
Parameters
index
(optional, default0
)
Meta
- deprecated: this function eventually will be removed use getAddressAsync instead
getAddressAsync
Get the current address.
Generates a network-specific key-pair by first converting the buffer to a Wallet-Import-Format (WIF) The address is then decoded into type P2WPKH and returned.
Parameters
-
index
(optional, default0
) - Throws
"Phrase must be provided"
Thrown if phrase has not been set before. - Throws
"Address not defined"
Thrown if failed creating account from phrase.
Returns Address The current address.
getAssetInfo
Returns any BCH asset info
validateAddress
Validate the given address.
Parameters
address
Address
Returns boolean true
or false
transfer
Transfer BCH.
Parameters
params
TxParams&FeeRate The transfer options.
Returns TxHash The transaction hash.
buildTx
Parameters
params
BuildParams The transaction build options.params.amount
params.recipient
params.memo
params.feeRate
params.sender
Returns Transaction
Meta
- deprecated: This is deprecated.
prepareTx
Prepare transfer.
Parameters
params
TxParams&Address&FeeRate The transfer options.params.sender
params.memo
params.amount
params.recipient
params.feeRate
Returns PreparedTx The raw unsigned transaction.
compileMemo
Compile memo.
Parameters
memo
string The memo to be compiled.
Returns Buffer The compiled memo.
getFeeFromUtxos
Get the transaction fee.
Parameters
inputs
Array<UTXO> The UTXOs.feeRate
FeeRate The fee rate.data
Buffer The compiled memo (Optional). (optional, defaultnull
)
Returns number The fee amount.