Utils

compileMemo

Compile memo.

Parameters

  • memo string The memo to be compiled.

Returns Buffer The compiled memo.

getFee

Get the transaction fee.

Parameters

  • inputs UTXOs The UTXOs.
  • feeRate FeeRate The fee rate.
  • data Buffer The compiled memo (Optional). (optional, default null)

Returns number The fee amount.

arrayAverage

Get the average value of an array.

Parameters

Returns number The average value.

isTestnet

Check if give network is a testnet.

Parameters

  • network Network

Returns boolean true or false

ltcNetwork

Get Litecoin network to be used with bitcoinjs.

Parameters

  • network Network

Returns Litecoin.Network The LTC network.

getBalance

Get the balances of an address.

Parameters

Returns Array<Balance> The balances of the given address.

getChange

Get the balance changes amount.

Parameters

Returns number The change amount.

validateAddress

Validate the LTC address.

Parameters

  • address string
  • network Network

Returns boolean true or false.

scanUTXOs

Scan UTXOs from sochain.

Parameters

  • nodeUrl string sochain Node URL.
  • network string
  • address Address

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.nodeUrl

Returns Transaction

broadcastTx

Broadcast the transaction.

Parameters

  • params BroadcastTxParams The transaction broadcast options.
    • params.network
    • params.txHex
    • params.nodeUrl

Returns TxHash The transaction hash.

getDerivePath

Get DerivePath.

Parameters

  • index number (optional) (optional, default 0)

Returns DerivePath The litecoin derivation path by the index. (both mainnet and testnet)

calcFee

Calculate fees based on fee rate and memo.

Parameters

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

Returns string The address prefix based on the network.*