-
Notifications
You must be signed in to change notification settings - Fork 69
@liquality.bitcoin.BitcoinUtils
Krasimir Raykov edited this page Mar 30, 2022
·
3 revisions
@liquality/bitcoin.BitcoinUtils
- calculateFee
- compressPubKey
- decodeRawTransaction
- getPubKeyHash
- normalizeTransactionObject
- selectCoins
- validateAddress
- witnessStackToScriptWitness
Ƭ CoinSelectTarget: Object
Name | Type |
---|---|
id? |
string |
script? |
Buffer |
value |
number |
• Const
AddressTypes: string
[]
▸ calculateFee(numInputs
, numOutputs
, feePerByte
): number
Name | Type |
---|---|
numInputs |
number |
numOutputs |
number |
feePerByte |
number |
number
▸ compressPubKey(pubKey
): string
Get compressed pubKey from pubKey.
Name | Type | Description |
---|---|---|
pubKey |
string |
65 byte string with prefix, x, y. |
string
the compressed pubKey of uncompressed pubKey.
▸ decodeRawTransaction(hex
, network
): Transaction
Name | Type |
---|---|
hex |
string |
network |
BitcoinNetwork |
▸ getPubKeyHash(address
, network
): Buffer
Name | Type |
---|---|
address |
string |
network |
BitcoinNetwork |
Buffer
▸ normalizeTransactionObject(tx
, fee
, block?
): Transaction
<Transaction
>
Name | Type |
---|---|
tx |
Transaction |
fee |
number |
block? |
Object |
block.hash |
string |
block.number |
number |
▸ selectCoins(utxos
, targets
, feePerByte
, fixedInputs?
): Object
Name | Type | Default value |
---|---|---|
utxos |
UTXO [] |
undefined |
targets |
CoinSelectTarget [] |
undefined |
feePerByte |
number |
undefined |
fixedInputs |
UTXO [] |
[] |
Object
Name | Type |
---|---|
change |
CoinSelectTarget |
fee |
number |
inputs |
UTXO [] |
outputs |
CoinSelectTarget [] |
▸ validateAddress(_address
, network
): void
Name | Type |
---|---|
_address |
AddressType |
network |
BitcoinNetwork |
void
▸ witnessStackToScriptWitness(witness
): Buffer
Name | Type |
---|---|
witness |
Buffer [] |
Buffer