Skip to content

@liquality.bitcoin.BitcoinBaseWalletProvider

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

Class: BitcoinBaseWalletProvider<T, S>

@liquality/bitcoin.BitcoinBaseWalletProvider

Type parameters

Name Type
T extends BitcoinBaseChainProvider = any
S any

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new BitcoinBaseWalletProvider<T, S>(options, chainProvider)

Type parameters

Name Type
T extends BitcoinBaseChainProvider<T> = any
S any

Parameters

Name Type
options BitcoinWalletProviderOptions
chainProvider Chain<T, Network>

Overrides

Wallet.constructor

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:39

Properties

_addressType

Protected _addressType: AddressType

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:36


_baseDerivationPath

Protected _baseDerivationPath: string

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:34


_derivationCache

Protected _derivationCache: DerivationCache

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:37


_network

Protected _network: BitcoinNetwork

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:35


chainProvider

Protected chainProvider: Chain<T, Network>

Inherited from

Wallet.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[] }>

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

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:157


baseDerivationNode

Protected Abstract baseDerivationNode(): Promise<BIP32Interface>

Returns

Promise<BIP32Interface>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:54


buildSweepTransaction

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

Parameters

Name Type
externalChangeAddress string
feePerByte? number

Returns

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

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:60


buildTransaction

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

Parameters

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

Returns

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

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:55


canUpdateFee

Abstract canUpdateFee(): boolean

Returns

boolean

Inherited from

Wallet.canUpdateFee

Defined in

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


exportPrivateKey

Abstract 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>

Inherited from

Wallet.exportPrivateKey

Defined in

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


findAddress

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

Parameters

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

Returns

Promise<Address>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:163


getAddress

Abstract getAddress(): Promise<AddressType>

Returns

Promise<AddressType>

Inherited from

Wallet.getAddress

Defined in

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


getAddressFromPublicKey

Protected getAddressFromPublicKey(publicKey): string

Parameters

Name Type
publicKey Buffer

Returns

string

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[]>

Overrides

Wallet.getAddresses

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:86


getBalance

Abstract getBalance(assets): Promise<BigNumber[]>

Parameters

Name Type
assets Asset[]

Returns

Promise<BigNumber[]>

Inherited from

Wallet.getBalance

Defined in

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


getChainProvider

getChainProvider(): Chain<T, Network>

Returns

Chain<T, Network>

Inherited from

Wallet.getChainProvider

Defined in

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


getConnectedNetwork

Abstract getConnectedNetwork(): Promise<Network>

Retrieve the network connected to by the wallet

Returns

Promise<Network>

Inherited from

Wallet.getConnectedNetwork

Defined in

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


getDerivationCache

getDerivationCache(): DerivationCache

Returns

DerivationCache

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:70


getDerivationPathAddress

Protected getDerivationPathAddress(path): Promise<Address>

Parameters

Name Type
path string

Returns

Promise<Address>

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[] }>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:317


getPaymentVariantFromPublicKey

Protected getPaymentVariantFromPublicKey(publicKey): Payment

Parameters

Name Type
publicKey Buffer

Returns

Payment

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:468


getSigner

Abstract getSigner(): S

Returns

S

Inherited from

Wallet.getSigner

Defined in

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


getTotalFee

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

Parameters

Name Type
opts TransactionRequest
max boolean

Returns

Promise<number>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:300


getTotalFees

getTotalFees(transactions, max): Promise<any>

Parameters

Name Type
transactions TransactionRequest[]
max boolean

Returns

Promise<any>

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>

Overrides

Wallet.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[]>

Overrides

Wallet.getUsedAddresses

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:80


getWalletAddress

getWalletAddress(address): Promise<Address>

Parameters

Name Type
address string

Returns

Promise<Address>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:178


isWalletAvailable

Abstract isWalletAvailable(): Promise<boolean>

Retrieve the availability status of the wallet

Returns

Promise<boolean>

Inherited from

Wallet.isWalletAvailable

Defined in

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


sendBatchTransaction

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

Create, sign & broad a transaction with multiple outputs.

Parameters

Name Type
transactions TransactionRequest[]

Returns

Promise<Transaction<Transaction>[]>

Overrides

Wallet.sendBatchTransaction

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:111


sendOptionsToOutputs

Protected sendOptionsToOutputs(transactions): OutputTarget[]

Parameters

Name Type
transactions TransactionRequest[]

Returns

OutputTarget[]

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

Overrides

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

Overrides

Wallet.sendTransaction

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:107


setChainProvider

setChainProvider(chainProvider): void

Parameters

Name Type
chainProvider Chain<T, Network>

Returns

void

Inherited from

Wallet.setChainProvider

Defined in

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


signBatchP2SHTransaction

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

Parameters

Name Type
inputs P2SHInput[]
addresses string
tx any
lockTime? number
segwit? boolean

Returns

Promise<Buffer[]>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:62


signMessage

Abstract signMessage(message, from): Promise<string>

Sign a message.

Parameters

Name Type
message string
from AddressType

Returns

Promise<string>

Inherited from

Wallet.signMessage

Defined in

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


signPSBT

Abstract signPSBT(data, inputs): Promise<string>

Parameters

Name Type
data string
inputs PsbtInputTarget[]

Returns

Promise<string>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:61


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

Overrides

Wallet.updateTransactionFee

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:121


withCachedUtxos

Protected withCachedUtxos(func): Promise<any>

Parameters

Name Type
func () => any

Returns

Promise<any>

Defined in

bitcoin/lib/wallet/BitcoinBaseWallet.ts:280

Clone this wiki locally