Utils
compileMemo
Compile memo.
Parameters
memo
string The memo to be compiled.
Returns Buffer The compiled memo.
getFee
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.
arrayAverage
Get the average value of an array.
Parameters
Returns number The average value.
dogeNetwork
Get Dogecoin network to be used with bitcoinjs.
Parameters
network
Network
Returns Dogecoin.networks.Network The Doge network.
getBalance
Get the balances of an address.
Parameters
params
Returns Array<Balance> The balances of the given address.
validateAddress
Validate the Doge address.
Parameters
address
stringnetwork
Network
Returns boolean true
or false
.
getTxHex
Helper to get hex
of Tx
It will try to get it from cache before requesting it from Sochain
Parameters
$0
Object$0.txHash
$0.sochainUrl
$0.network
scanUTXOs
Scan UTXOs from sochain.
Parameters
params
Objectparams.sochainUrl
params.network
params.address
params.withTxHex
Returns Array<UTXO> The UTXOs of the given address.
buildTx
Build transcation.
Parameters
params
BuildParams The transaction build options.params.amount
params.recipient
params.memo
params.feeRate
params.sender
params.network
params.sochainUrl
params.withTxHex
(optional, defaultfalse
)
Returns Transaction
broadcastTx
Broadcast the transaction.
Parameters
params
BroadcastTxParams The transaction broadcast options.
Returns TxHash The transaction hash.
calcFee
Calculate fees based on fee rate and memo.
Parameters
feeRate
FeeRatememo
string
Returns BaseAmount The calculated fees based on fee rate and the memo.
getDefaultFeesWithRates
Get the default fees with rates.
Returns FeesWithRates The default fees and rates.
getDefaultFees
Get the default fees.
Returns Fees The default fees.
getPrefix
Get address prefix based on the network.
Parameters
network
Network
Returns string The address prefix based on the network.*