Skip to content

@liquality.bitcoin.BitcoinHDWalletProvider

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

Class: BitcoinHDWalletProvider

@liquality/bitcoin.BitcoinHDWalletProvider

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new BitcoinHDWalletProvider(options, chainProvider)

Parameters

Name Type
options BitcoinHDWalletProviderOptions
chainProvider Chain<BitcoinBaseChainProvider, Network>

Overrides

BitcoinBaseWalletProvider.constructor

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:17

Properties

_addressType

Protected _addressType: AddressType

Inherited from

BitcoinBaseWalletProvider._addressType

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:36


_baseDerivationPath

Protected _baseDerivationPath: string

Inherited from

BitcoinBaseWalletProvider._baseDerivationPath

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:34


_derivationCache

Protected _derivationCache: DerivationCache

Inherited from

BitcoinBaseWalletProvider._derivationCache

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:37


_network

Protected _network: BitcoinNetwork

Inherited from

BitcoinBaseWalletProvider._network

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:35


chainProvider

Protected chainProvider: Chain<any, Network>

Implementation of

IBitcoinWallet.chainProvider

Inherited from

BitcoinBaseWalletProvider.chainProvider

Defined in

client/dist/lib/Wallet.d.ts:4

Methods

_getUsedUnusedAddresses

Protected _getUsedUnusedAddresses(numAddressPerCall?, addressType): Promise<{ unusedAddress: { change: Address ; external: Address } = unusedAddressMap; usedAddresses: Address[] }>

Parameters

Name Type Default value
numAddressPerCall number 100
addressType AddressSearchType undefined

Returns

Promise<{ unusedAddress: { change: Address ; external: Address } = unusedAddressMap; usedAddresses: Address[] }>

Inherited from

BitcoinBaseWalletProvider._getUsedUnusedAddresses

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:211


_sendTransaction

Protected _sendTransaction(transactions, feePerByte?): Promise<Transaction<Transaction>>

Parameters

Name Type
transactions OutputTarget[]
feePerByte? number

Returns

Promise<Transaction<Transaction>>

Inherited from

BitcoinBaseWalletProvider._sendTransaction

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:157


baseDerivationNode

Protected baseDerivationNode(): Promise<BIP32Interface>

Returns

Promise<BIP32Interface>

Overrides

BitcoinBaseWalletProvider.baseDerivationNode

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:64


buildSweepTransaction

Protected buildSweepTransaction(externalChangeAddress, feePerByte): Promise<{ fee: number ; hex: string }>

Parameters

Name Type
externalChangeAddress string
feePerByte number

Returns

Promise<{ fee: number ; hex: string }>

Overrides

BitcoinBaseWalletProvider.buildSweepTransaction

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:144


buildTransaction

Protected buildTransaction(targets, feePerByte?, fixedInputs?): Promise<{ fee: number ; hex: string }>

Parameters

Name Type
targets OutputTarget[]
feePerByte? number
fixedInputs? Input[]

Returns

Promise<{ fee: number ; hex: string }>

Overrides

BitcoinBaseWalletProvider.buildTransaction

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:73


canUpdateFee

canUpdateFee(): boolean

Returns

boolean

Implementation of

IBitcoinWallet.canUpdateFee

Overrides

BitcoinBaseWalletProvider.canUpdateFee

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:27


exportPrivateKey

exportPrivateKey(): Promise<string>

Exports the private key for the account for BTC, https://en.bitcoin.it/wiki/Wallet_import_format for ETH, the privateKey for NEAR, the secretKey

Returns

Promise<string>

Implementation of

IBitcoinWallet.exportPrivateKey

Overrides

BitcoinBaseWalletProvider.exportPrivateKey

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:52


findAddress

Protected findAddress(addresses, change?): Promise<Address>

Parameters

Name Type Default value
addresses string[] undefined
change boolean false

Returns

Promise<Address>

Inherited from

BitcoinBaseWalletProvider.findAddress

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:163


getAddress

getAddress(): Promise<AddressType>

Returns

Promise<AddressType>

Implementation of

IBitcoinWallet.getAddress

Overrides

BitcoinBaseWalletProvider.getAddress

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:35


getAddressFromPublicKey

Protected getAddressFromPublicKey(publicKey): string

Parameters

Name Type
publicKey Buffer

Returns

string

Inherited from

BitcoinBaseWalletProvider.getAddressFromPublicKey

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:464


getAddresses

getAddresses(startingIndex?, numAddresses?, change?): Promise<Address[]>

Get addresses/accounts of the user.

Parameters

Name Type Default value
startingIndex number 0
numAddresses number 1
change boolean false

Returns

Promise<Address[]>

Implementation of

IBitcoinWallet.getAddresses

Inherited from

BitcoinBaseWalletProvider.getAddresses

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:86


getBalance

getBalance(_assets): Promise<BigNumber[]>

Parameters

Name Type
_assets Asset[]

Returns

Promise<BigNumber[]>

Implementation of

IBitcoinWallet.getBalance

Overrides

BitcoinBaseWalletProvider.getBalance

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:40


getChainProvider

getChainProvider(): Chain<any, Network>

Returns

Chain<any, Network>

Implementation of

IBitcoinWallet.getChainProvider

Inherited from

BitcoinBaseWalletProvider.getChainProvider

Defined in

client/dist/lib/Wallet.d.ts:7


getConnectedNetwork

getConnectedNetwork(): Promise<BitcoinNetwork>

Retrieve the network connected to by the wallet

Returns

Promise<BitcoinNetwork>

Implementation of

IBitcoinWallet.getConnectedNetwork

Overrides

BitcoinBaseWalletProvider.getConnectedNetwork

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:56


getDerivationCache

getDerivationCache(): DerivationCache

Returns

DerivationCache

Inherited from

BitcoinBaseWalletProvider.getDerivationCache

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:70


getDerivationPathAddress

Protected getDerivationPathAddress(path): Promise<Address>

Parameters

Name Type
path string

Returns

Promise<Address>

Inherited from

BitcoinBaseWalletProvider.getDerivationPathAddress

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:192


getInputsForAmount

Protected getInputsForAmount(_targets, feePerByte?, fixedInputs?, numAddressPerCall?, sweep?): Promise<{ change: CoinSelectTarget ; fee: number ; inputs: UTXO[] ; outputs: CoinSelectTarget[] }>

Parameters

Name Type Default value
_targets OutputTarget[] undefined
feePerByte? number undefined
fixedInputs Input[] []
numAddressPerCall number 100
sweep boolean false

Returns

Promise<{ change: CoinSelectTarget ; fee: number ; inputs: UTXO[] ; outputs: CoinSelectTarget[] }>

Inherited from

BitcoinBaseWalletProvider.getInputsForAmount

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:317


getPaymentVariantFromPublicKey

Protected getPaymentVariantFromPublicKey(publicKey): Payment

Parameters

Name Type
publicKey Buffer

Returns

Payment

Inherited from

BitcoinBaseWalletProvider.getPaymentVariantFromPublicKey

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:468


getSigner

getSigner(): Promise<null>

Returns

Promise<null>

Implementation of

IBitcoinWallet.getSigner

Overrides

BitcoinBaseWalletProvider.getSigner

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:31


getTotalFee

Protected getTotalFee(opts, max): Promise<number>

Parameters

Name Type
opts TransactionRequest
max boolean

Returns

Promise<number>

Inherited from

BitcoinBaseWalletProvider.getTotalFee

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:300


getTotalFees

getTotalFees(transactions, max): Promise<any>

Parameters

Name Type
transactions TransactionRequest[]
max boolean

Returns

Promise<any>

Inherited from

BitcoinBaseWalletProvider.getTotalFees

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:145


getUnusedAddress

getUnusedAddress(change?, numAddressPerCall?): Promise<Address>

Get unused address/account of the user.

Parameters

Name Type Default value
change boolean false
numAddressPerCall number 100

Returns

Promise<Address>

Implementation of

IBitcoinWallet.getUnusedAddress

Inherited from

BitcoinBaseWalletProvider.getUnusedAddress

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:74


getUsedAddresses

getUsedAddresses(numAddressPerCall?): Promise<Address[]>

Get used addresses/accounts of the user.

Parameters

Name Type Default value
numAddressPerCall number 100

Returns

Promise<Address[]>

Implementation of

IBitcoinWallet.getUsedAddresses

Inherited from

BitcoinBaseWalletProvider.getUsedAddresses

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:80


getWalletAddress

getWalletAddress(address): Promise<Address>

Parameters

Name Type
address string

Returns

Promise<Address>

Implementation of

IBitcoinWallet.getWalletAddress

Inherited from

BitcoinBaseWalletProvider.getWalletAddress

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:178


isWalletAvailable

isWalletAvailable(): Promise<boolean>

Retrieve the availability status of the wallet

Returns

Promise<boolean>

Implementation of

IBitcoinWallet.isWalletAvailable

Overrides

BitcoinBaseWalletProvider.isWalletAvailable

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:60


sendBatchTransaction

sendBatchTransaction(transactions): Promise<Transaction<Transaction>[]>

Create, sign & broad a transaction with multiple outputs.

Parameters

Name Type
transactions TransactionRequest[]

Returns

Promise<Transaction<Transaction>[]>

Implementation of

IBitcoinWallet.sendBatchTransaction

Inherited from

BitcoinBaseWalletProvider.sendBatchTransaction

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:111


sendOptionsToOutputs

Protected sendOptionsToOutputs(transactions): OutputTarget[]

Parameters

Name Type
transactions TransactionRequest[]

Returns

OutputTarget[]

Inherited from

BitcoinBaseWalletProvider.sendOptionsToOutputs

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:441


sendSweepTransaction

sendSweepTransaction(externalChangeAddress, _asset, feePerByte): Promise<Transaction<Transaction>>

Create, sign & broadcast a sweep transaction.

Parameters

Name Type
externalChangeAddress AddressType
_asset Asset
feePerByte number

Returns

Promise<Transaction<Transaction>>

Implementation of

IBitcoinWallet.sendSweepTransaction

Inherited from

BitcoinBaseWalletProvider.sendSweepTransaction

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:115


sendTransaction

sendTransaction(options): Promise<Transaction<Transaction>>

Create, sign & broadcast a transaction.

Parameters

Name Type
options TransactionRequest

Returns

Promise<Transaction<Transaction>>

Implementation of

IBitcoinWallet.sendTransaction

Inherited from

BitcoinBaseWalletProvider.sendTransaction

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:107


setChainProvider

setChainProvider(chainProvider): void

Parameters

Name Type
chainProvider Chain<any, Network>

Returns

void

Implementation of

IBitcoinWallet.setChainProvider

Inherited from

BitcoinBaseWalletProvider.setChainProvider

Defined in

client/dist/lib/Wallet.d.ts:6


signBatchP2SHTransaction

signBatchP2SHTransaction(inputs, addresses, tx, lockTime?, segwit?): Promise<Buffer[]>

Parameters

Name Type
inputs [{ index: number ; inputTxHex: string ; outputScript: Buffer ; txInputIndex?: number ; vout: any }]
addresses string
tx any
lockTime? number
segwit? boolean

Returns

Promise<Buffer[]>

Overrides

BitcoinBaseWalletProvider.signBatchP2SHTransaction

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:171


signMessage

signMessage(message, from): Promise<string>

Sign a message.

Parameters

Name Type
message string
from string

Returns

Promise<string>

Implementation of

IBitcoinWallet.signMessage

Overrides

BitcoinBaseWalletProvider.signMessage

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:45


signPSBT

signPSBT(data, inputs): Promise<string>

Parameters

Name Type
data string
inputs PsbtInputTarget[]

Returns

Promise<string>

Implementation of

IBitcoinWallet.signPSBT

Overrides

BitcoinBaseWalletProvider.signPSBT

Defined in

bitcoin/lib/wallet/BitcoinHDWallet.ts:162


updateTransactionFee

updateTransactionFee(tx, newFeePerByte): Promise<Transaction<Transaction>>

Update the fee of a transaction.

Parameters

Name Type
tx string | Transaction<Transaction>
newFeePerByte number

Returns

Promise<Transaction<Transaction>>

Implementation of

IBitcoinWallet.updateTransactionFee

Inherited from

BitcoinBaseWalletProvider.updateTransactionFee

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:121


withCachedUtxos

Protected withCachedUtxos(func): Promise<any>

Parameters

Name Type
func () => any

Returns

Promise<any>

Inherited from

BitcoinBaseWalletProvider.withCachedUtxos

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:280

Clone this wiki locally