Skip to content

@liquality.bitcoin.BitcoinUtils

Krasimir Raykov edited this page Mar 30, 2022 · 3 revisions

Namespace: BitcoinUtils

@liquality/bitcoin.BitcoinUtils

Table of contents

Type aliases

Variables

Functions

Type aliases

CoinSelectTarget

Ƭ CoinSelectTarget: Object

Type declaration

Name Type
id? string
script? Buffer
value number

Defined in

bitcoin/lib/utils.ts:30

Variables

AddressTypes

Const AddressTypes: string[]

Defined in

bitcoin/lib/utils.ts:10

Functions

calculateFee

calculateFee(numInputs, numOutputs, feePerByte): number

Parameters

Name Type
numInputs number
numOutputs number
feePerByte number

Returns

number

Defined in

bitcoin/lib/utils.ts:12


compressPubKey

compressPubKey(pubKey): string

Get compressed pubKey from pubKey.

Parameters

Name Type Description
pubKey string 65 byte string with prefix, x, y.

Returns

string

the compressed pubKey of uncompressed pubKey.

Defined in

bitcoin/lib/utils.ts:21


decodeRawTransaction

decodeRawTransaction(hex, network): Transaction

Parameters

Name Type
hex string
network BitcoinNetwork

Returns

Transaction

Defined in

bitcoin/lib/utils.ts:74


getPubKeyHash

getPubKeyHash(address, network): Buffer

Parameters

Name Type
address string
network BitcoinNetwork

Returns

Buffer

Defined in

bitcoin/lib/utils.ts:194


normalizeTransactionObject

normalizeTransactionObject(tx, fee, block?): Transaction<Transaction>

Parameters

Name Type
tx Transaction
fee number
block? Object
block.hash string
block.number number

Returns

Transaction<Transaction>

Defined in

bitcoin/lib/utils.ts:129


selectCoins

selectCoins(utxos, targets, feePerByte, fixedInputs?): Object

Parameters

Name Type Default value
utxos UTXO[] undefined
targets CoinSelectTarget[] undefined
feePerByte number undefined
fixedInputs UTXO[] []

Returns

Object

Name Type
change CoinSelectTarget
fee number
inputs UTXO[]
outputs CoinSelectTarget[]

Defined in

bitcoin/lib/utils.ts:45


validateAddress

validateAddress(_address, network): void

Parameters

Name Type
_address AddressType
network BitcoinNetwork

Returns

void

Defined in

bitcoin/lib/utils.ts:210


witnessStackToScriptWitness

witnessStackToScriptWitness(witness): Buffer

Parameters

Name Type
witness Buffer[]

Returns

Buffer

Defined in

bitcoin/lib/utils.ts:164

Clone this wiki locally