Skip to content

Latest commit

 

History

History
2527 lines (1445 loc) · 60 KB

Wallet.md

File metadata and controls

2527 lines (1445 loc) · 60 KB

beignet / Wallet

Class: Wallet

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

Private new Wallet(«destructured»)

Parameters

Name Type
«destructured» IWallet

Defined in

wallet/index.ts:153

Properties

_customGetAddress

Private Optional _customGetAddress: (data: ICustomGetAddress) => Promise<Result<IGetAddressResponse>>

Type declaration

▸ (data): Promise<Result<IGetAddressResponse>>

Parameters
Name Type
data ICustomGetAddress
Returns

Promise<Result<IGetAddressResponse>>

Defined in

wallet/index.ts:121


_customGetScriptHash

Private Optional _customGetScriptHash: (data: ICustomGetScriptHash) => Promise<string>

Type declaration

▸ (data): Promise<string>

Parameters
Name Type
data ICustomGetScriptHash
Returns

Promise<string>

Defined in

wallet/index.ts:124


_data

Private _data: IWalletData

Defined in

wallet/index.ts:118


_disableMessagesOnCreate

Private _disableMessagesOnCreate: boolean

Defined in

wallet/index.ts:130


_getData

Private _getData: TGetData

Defined in

wallet/index.ts:119


_mnemonic

Private Readonly _mnemonic: string

Defined in

wallet/index.ts:114


_network

Private _network: EAvailableNetworks

Defined in

wallet/index.ts:113


_passphrase

Private Readonly _passphrase: string

Defined in

wallet/index.ts:115


_pendingRefreshPromises

Private _pendingRefreshPromises: (result: Result<IWalletData>) => void[] = []

Defined in

wallet/index.ts:127


_root

Private Readonly _root: BIP32Interface

Defined in

wallet/index.ts:117


_seed

Private Readonly _seed: Buffer

Defined in

wallet/index.ts:116


_setData

Private Optional _setData: TSetData

Defined in

wallet/index.ts:120


addressType

addressType: EAddressType

Defined in

wallet/index.ts:145


addressTypesToMonitor

addressTypesToMonitor: EAddressType[]

Defined in

wallet/index.ts:132


disableMessages

disableMessages: boolean

Defined in

wallet/index.ts:151


electrum

electrum: Electrum

Defined in

wallet/index.ts:144


electrumOptions

Optional electrumOptions: Object

Type declaration

Name Type
batchDelay? number
batchLimit? number
net? Server
servers? TServer | TServer[]
tls? TLSSocket

Defined in

wallet/index.ts:137


feeEstimates

feeEstimates: IOnchainFees

Defined in

wallet/index.ts:148


gapLimitOptions

gapLimitOptions: TGapLimitOptions

Defined in

wallet/index.ts:152


id

Readonly id: string

Defined in

wallet/index.ts:135


isRefreshing

isRefreshing: boolean

Defined in

wallet/index.ts:133


isSwitchingNetworks

isSwitchingNetworks: boolean

Defined in

wallet/index.ts:134


name

Readonly name: string

Defined in

wallet/index.ts:136


rbf

rbf: boolean

Defined in

wallet/index.ts:149


savingOperations

Private savingOperations: Record<string, Promise<string>> = {}

Saves the wallet data object to storage if able.

Async

Param

Param

Defined in

wallet/index.ts:1759


selectedFeeId

selectedFeeId: EFeeId

Defined in

wallet/index.ts:150


sendMessage

sendMessage: TOnMessage

Defined in

wallet/index.ts:146


transaction

transaction: Transaction

Defined in

wallet/index.ts:147

Accessors

balance

get balance(): number

Returns

number

Defined in

wallet/index.ts:249


data

get data(): IWalletData

Returns

IWalletData

Defined in

wallet/index.ts:233


network

get network(): EAvailableNetworks

Returns

EAvailableNetworks

Defined in

wallet/index.ts:253


transactions

get transactions(): IFormattedTransactions

Returns

IFormattedTransactions

Defined in

wallet/index.ts:237


unconfirmedTransactions

get unconfirmedTransactions(): IFormattedTransactions

Returns

IFormattedTransactions

Defined in

wallet/index.ts:241


utxos

get utxos(): IUtxo[]

Returns

IUtxo[]

Defined in

wallet/index.ts:245

Methods

_getAddress

Private _getAddress(path, addressType): Promise<Result<IGetAddressResponse>>

Returns the address for the specified path and address type.

Parameters

Name Type
path string
addressType EAddressType

Returns

Promise<Result<IGetAddressResponse>>

Defined in

wallet/index.ts:542


_handleRefreshError

Private _handleRefreshError(errorMessage): Result<IWalletData>

Parameters

Name Type
errorMessage string

Returns

Result<IWalletData>

Defined in

wallet/index.ts:369


_resolveAllPendingRefreshPromises

Private _resolveAllPendingRefreshPromises(result): void

Parameters

Name Type
result Result<IWalletData>

Returns

void

Defined in

wallet/index.ts:359


addAddresses

Private addAddresses(«destructured»?): Promise<Result<IGenerateAddressesResponse>>

This method will generate addresses as specified and return an object of filtered addresses to ensure no duplicates are returned.

Parameters

Name Type
«destructured» IGenerateAddresses

Returns

Promise<Result<IGenerateAddressesResponse>>

Async

Defined in

wallet/index.ts:1291


addBoostedTransaction

addBoostedTransaction(«destructured»): Promise<Result<IBoostedTransaction>>

Adds a boosted transaction id to the boostedTransactions object.

Parameters

Name Type
«destructured» Object
› fee number
› newTxId string
› oldTxId string
› type? EBoostType

Returns

Promise<Result<IBoostedTransaction>>

Defined in

wallet/index.ts:3259


addGhostTransaction

addGhostTransaction(txid): Promise<void>

Sets "exists" to false for a given on-chain transaction id.

Parameters

Name Type
txid Object
txid.txid string

Returns

Promise<void>

Defined in

wallet/index.ts:3244


addTxInput

addTxInput(input): Result<IUtxo[]>

Adds a specified input to the current transaction.

Parameters

Name Type
input Object
input.input IUtxo

Returns

Result<IUtxo[]>

Defined in

wallet/index.ts:3376


addTxTag

addTxTag(tag): Result<string>

Adds a specified tag to the current transaction.

Parameters

Name Type
tag Object
tag.tag string

Returns

Result<string>

Defined in

wallet/index.ts:3427


addUnconfirmedTransactions

Private addUnconfirmedTransactions(transactions): Promise<Result<string>>

Parses and adds unconfirmed transactions to the store.

Parameters

Name Type
transactions Object
transactions.transactions IFormattedTransactions

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:2292


blockHeightToConfirmations

blockHeightToConfirmations(«destructured»): number

Returns the number of confirmations for a given block height.

Parameters

Name Type
«destructured» Object
› blockHeight? number
› currentHeight? number

Returns

number

Defined in

wallet/index.ts:2334


checkElectrumConnection

checkElectrumConnection(): Promise<Result<string>>

Ensures the connection to Electrum is still available. Will attempt to reconnect if not initially available.

Returns

Promise<Result<string>>

Defined in

wallet/index.ts:880


checkUnconfirmedTransactions

Private checkUnconfirmedTransactions(reorgDetected?): Promise<Result<string>>

Checks existing unconfirmed transactions that have been received and removes any that have >= 6 confirmations. If the tx is reorg'd or bumped from the mempool and no longer exists, the transaction will be removed from the store and updated in the activity list.

Parameters

Name Type Default value
reorgDetected boolean false

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:1974


clearAddresses

Private clearAddresses(): Promise<string>

Clears the addresses and changeAddresses object for a given wallet and network.

Returns

Promise<string>

Async

Defined in

wallet/index.ts:2252


clearTransactions

Private clearTransactions(): Promise<string>

Clears the transactions object for a given wallet and network from storage.

Returns

Promise<string>

Defined in

wallet/index.ts:2240


clearUtxos

clearUtxos(): Promise<string>

Clears the UTXO array and balance from storage.

Returns

Promise<string>

Async

Defined in

wallet/index.ts:2225


confirmationsToBlockHeight

confirmationsToBlockHeight(«destructured»): number

Returns the block height for a given number of confirmations from storage.

Parameters

Name Type
«destructured» Object
› confirmations number
› currentHeight? number

Returns

number

Defined in

wallet/index.ts:2099


connectToElectrum

connectToElectrum(servers?): Promise<Result<string>>

Attempts to connect to the specified Electrum server(s).

Parameters

Name Type
servers? TServer | TServer[]

Returns

Promise<Result<string>>

Defined in

wallet/index.ts:641


deleteOnChainTransactionById

deleteOnChainTransactionById(txid): Promise<void>

Deletes a given on-chain transaction by id.

Parameters

Name Type
txid Object
txid.txid string

Returns

Promise<void>

Defined in

wallet/index.ts:3228


formatTransactions

formatTransactions(transactions): Promise<Result<IFormattedTransactions>>

Formats the provided transaction.

Parameters

Name Type
transactions Object
transactions.transactions ITransaction<IUtxo>[]

Returns

Promise<Result<IFormattedTransactions>>

Async

Defined in

wallet/index.ts:2360


generateAddresses

generateAddresses(«destructured»): Promise<Result<IGenerateAddressesResponse>>

Generates a series of addresses based on the specified params.

Parameters

Name Type
«destructured» IGenerateAddresses

Returns

Promise<Result<IGenerateAddressesResponse>>

Async

Defined in

wallet/index.ts:772


generateNewReceiveAddress

generateNewReceiveAddress(«destructured»?): Promise<Result<IAddress>>

Generate a new receive address for the provided addresstype up to the set gap limit.

Parameters

Name Type
«destructured» Object
› addressType? EAddressType
› keyDerivationPath? IKeyDerivationPath
› overrideGapLimit? boolean

Returns

Promise<Result<IAddress>>

Async

Defined in

wallet/index.ts:1571


getAddress

getAddress(«destructured»?): Promise<string>

Returns a single Bitcoin address based on the provided address type, index and whether it is a change address.

Parameters

Name Type
«destructured» IGetAddress

Returns

Promise<string>

Defined in

wallet/index.ts:581


getAddressBalance

getAddressBalance(address): Promise<Result<IGetAddressBalanceRes>>

Returns the address balance for the specified address.

Parameters

Name Type
address string

Returns

Promise<Result<IGetAddressBalanceRes>>

Defined in

wallet/index.ts:662


getAddressByPath

getAddressByPath(«destructured»): Promise<Result<IGetAddressResponse>>

Get address for a given keyPair, network and type.

Parameters

Name Type
«destructured» IGetAddressByPath

Returns

Promise<Result<IGetAddressResponse>>

Defined in

wallet/index.ts:615


getAddressFromScriptHash

getAddressFromScriptHash(scriptHash): undefined | IAddress

Returns the address from a provided script hash in storage.

Parameters

Name Type
scriptHash string

Returns

undefined | IAddress

Defined in

wallet/index.ts:2857


getAddressHistory

getAddressHistory(address): Promise<Result<TTxResult[]>>

Returns an array of tx_hashes and their height for a given address.

Parameters

Name Type
address string

Returns

Promise<Result<TTxResult[]>>

Defined in

wallet/index.ts:3722


getAddressIndexInfo

getAddressIndexInfo(): TAddressIndexInfo

Returns current address index information.

Returns

TAddressIndexInfo

Defined in

wallet/index.ts:2974


getAddressInfoFromScriptHash

getAddressInfoFromScriptHash(scriptHash): Result<{ address: IAddress ; addressType: EAddressType }>

Parameters

Name Type
scriptHash string

Returns

Result<{ address: IAddress ; addressType: EAddressType }>

Defined in

wallet/index.ts:3678


getAddressesBalance

getAddressesBalance(addresses?): Promise<Result<number>>

Returns combined balance of provided addresses.

Parameters

Name Type Default value
addresses string[] []

Returns

Promise<Result<number>>

Async

Defined in

wallet/index.ts:680


getAddressesFromPrivateKey

getAddressesFromPrivateKey(privateKey, _addressTypes?): Result<IGetAddressesFromPrivateKey>

Get addresses from a given private key.

Parameters

Name Type
privateKey string
_addressTypes? EAddressType[]

Returns

Result<IGetAddressesFromPrivateKey>

Defined in

wallet/index.ts:3551


getBalance

getBalance(): number

Returns the known balance from storage.

Returns

number

Defined in

wallet/index.ts:756


getBip32Interface

getBip32Interface(): Promise<Result<BIP32Interface>>

Creates a BIP32Interface from the selected wallet's mnemonic and passphrase

Returns

Promise<Result<BIP32Interface>>

Defined in

wallet/index.ts:3360


getBitcoinNetwork

Private getBitcoinNetwork(network?): Network

Returns the Network object of the currently selected network (bitcoin or testnet).

Parameters

Name Type
network? TAvailableNetworks

Returns

Network

Defined in

wallet/index.ts:521


getBoostableTransactions

getBoostableTransactions(): Object

Returns an array of transactions that can be boosted with cpfp and rbf.

Returns

Object

Name Type
cpfp IFormattedTransaction[]
rbf IFormattedTransaction[]

Defined in

wallet/index.ts:3343


getBoostedTransactionParents

getBoostedTransactionParents(«destructured»): string[]

Returns an array of parents for a boosted transaction id.

Parameters

Name Type
«destructured» Object
› boostedTransactions? IBoostedTransactions
› txid string

Returns

string[]

Defined in

wallet/index.ts:3306


getBoostedTransactions

getBoostedTransactions(): IBoostedTransactions

Returns boosted transactions object.

Returns

IBoostedTransactions

Defined in

wallet/index.ts:3327


getChangeAddress

getChangeAddress(addressType?): Promise<Result<IAddress>>

Retrieves the next available change address data.

Parameters

Name Type
addressType? EAddressType

Returns

Promise<Result<IAddress>>

Async

Defined in

wallet/index.ts:2584


getFeeEstimates

getFeeEstimates(network?): Promise<IOnchainFees>

Returns the current fee estimates for the provided network.

Parameters

Name Type
network EAvailableNetworks

Returns

Promise<IOnchainFees>

Async

Defined in

wallet/index.ts:2617


getFeeInfo

getFeeInfo(«destructured»?): Result<TGetTotalFeeObj>

Returns a fee object for the current transaction.

Parameters

Name Type
«destructured» Object
› fundingLightning? boolean
› message? string
› satsPerByte? number
› transaction? Partial<ISendTransaction>

Returns

Result<TGetTotalFeeObj>

Defined in

wallet/index.ts:2666


getGapLimit

Private getGapLimit(addressType?): Result<{ addressDelta: number ; changeAddressDelta: number }>

Returns the difference between the current address index and the last used address index.

Parameters

Name Type
addressType? Object
addressType.addressType? EAddressType

Returns

Result<{ addressDelta: number ; changeAddressDelta: number }>

Defined in

wallet/index.ts:1674


getHighestStoredAddressIndex

getHighestStoredAddressIndex(addressType): Result<{ addressIndex: IAddress ; changeAddressIndex: IAddress }>

Returns the highest address and change address index stored in the app for the specified wallet and network. Retrives the highest stored address index for the provided address type.

Parameters

Name Type
addressType Object
addressType.addressType EAddressType

Returns

Result<{ addressIndex: IAddress ; changeAddressIndex: IAddress }>

Defined in

wallet/index.ts:1251


getInputData

getInputData(inputs): Promise<Result<InputData>>

Returns formatted input data from the inputs array.

Parameters

Name Type
inputs Object
inputs.inputs { tx_hash: string ; vout: number }[]

Returns

Promise<Result<InputData>>

Async

Defined in

wallet/index.ts:2528


getNextAvailableAddress

getNextAvailableAddress(addressType?): Promise<Result<IGetNextAvailableAddressResponse>>

Returns the next available address for the given addresstype.

Parameters

Name Type
addressType? EAddressType

Returns

Promise<Result<IGetNextAvailableAddressResponse>>

Defined in

wallet/index.ts:896


getPrivateKey

getPrivateKey(path): string

Returns private key for the provided path.

Parameters

Name Type
path string

Returns

string

Defined in

wallet/index.ts:734


getPrivateKeyInfo

getPrivateKeyInfo(privateKey): Promise<Result<IPrivateKeyInfo>>

Returns the balance, utxos, and keyPair info for a given private key.

Parameters

Name Type
privateKey string

Returns

Promise<Result<IPrivateKeyInfo>>

Async

Defined in

wallet/index.ts:3573


getRbfData

getRbfData(txHash): Promise<Result<IRbfData>>

Using a tx_hash this method will return the necessary data to create a replace-by-fee transaction for any 0-conf, RBF-enabled tx.

Parameters

Name Type
txHash Object
txHash.txHash ITxHash

Returns

Promise<Result<IRbfData>>

Defined in

wallet/index.ts:3044


getReceiveAddress

getReceiveAddress(addressType?): Promise<Result<string>>

Returns the next available receive address.

Parameters

Name Type
addressType? Object
addressType.addressType? EAddressType

Returns

Promise<Result<string>>

Defined in

wallet/index.ts:2996


getScriptHash

getScriptHash(«destructured»): Promise<string>

Get scriptHash for a given address

Parameters

Name Type
«destructured» Object
› address string
› network EAvailableNetworks

Returns

Promise<string>

Defined in

wallet/index.ts:715


getScriptHashBalance

getScriptHashBalance(scriptHash): Promise<Result<IGetAddressBalanceRes>>

Returns the balance for the specified scriptHash.

Parameters

Name Type
scriptHash string

Returns

Promise<Result<IGetAddressBalanceRes>>

Defined in

wallet/index.ts:744


getTransactionDetails

getTransactionDetails(tx_hash): Promise<Result<TTxDetails>>

Returns the transaction details for a given tx_hash.

Parameters

Name Type
tx_hash string

Returns

Promise<Result<TTxDetails>>

Defined in

wallet/index.ts:3747


getUnconfirmedTransactions

getUnconfirmedTransactions(): IFormattedTransactions

Returns the current wallet's unconfirmed transactions from storage.

Returns

IFormattedTransactions

Defined in

wallet/index.ts:2087


getUtxos

getUtxos(«destructured»?): Promise<Result<IGetUtxosResponse>>

Retrieves and sets UTXO's for the current wallet from Electrum.

Parameters

Name Type
«destructured» Object
› addressIndex? number
› addressTypesToCheck? EAddressType[]
› changeAddressIndex? number
› scanningStrategy? EScanningStrategy

Returns

Promise<Result<IGetUtxosResponse>>

Defined in

wallet/index.ts:1710


getWalletData

getWalletData(): Promise<Result<IWalletData>>

Gets the wallet data object from storage if able. Otherwise, it falls back to the default wallet data object.

Returns

Promise<Result<IWalletData>>

Defined in

wallet/index.ts:437


getWalletDataKey

getWalletDataKey(key): string

Returns the key used for storing wallet data in the key/value pair.

Parameters

Name Type
key keyof IWalletData

Returns

string

Defined in

wallet/index.ts:428


isValid

isValid(mnemonic): boolean

Ensures the provided mnemonic matches the one stored in the wallet and is valid.

Parameters

Name Type
mnemonic any

Returns

boolean

Defined in

wallet/index.ts:531


listUtxos

listUtxos(): IUtxo[]

Returns the current wallet's UTXO's from storage.

Returns

IUtxo[]

Defined in

wallet/index.ts:1747


processUnconfirmedTransactions

Private processUnconfirmedTransactions(): Promise<Result<TProcessUnconfirmedTransactions>>

This method processes all transactions with less than 6 confirmations and returns the following:

  1. Transactions that still have less than 6 confirmations and can be considered unconfirmed. (unconfirmedTxs)
  2. Transactions that have fewer confirmations than before due to a reorg. (outdatedTxs)
  3. Transactions that have been removed from the mempool. (ghostTxs)

Returns

Promise<Result<TProcessUnconfirmedTransactions>>

Async

Defined in

wallet/index.ts:2017


refreshWallet

refreshWallet(scanAllAddresses?): Promise<Result<IWalletData>>

Refreshes/Syncs the wallet data.

Parameters

Name Type
scanAllAddresses? Object
scanAllAddresses.scanAllAddresses undefined | boolean

Returns

Promise<Result<IWalletData>>

Defined in

wallet/index.ts:326


removeDuplicateAddresses

Private removeDuplicateAddresses(«destructured»): Promise<Result<IGenerateAddressesResponse>>

This method will compare a set of specified addresses to the currently stored addresses and remove any duplicates.

Parameters

Name Type
«destructured» Object
› addresses? IAddresses
› changeAddresses? IAddresses

Returns

Promise<Result<IGenerateAddressesResponse>>

Async

Defined in

wallet/index.ts:1365


removeTxInput

removeTxInput(input): Result<IUtxo[]>

Removes the specified input from the current transaction.

Parameters

Name Type
input Object
input.input IUtxo

Returns

Result<IUtxo[]>

Defined in

wallet/index.ts:3401


removeTxTag

removeTxTag(tag): Result<string>

Removes a specified tag from the current transaction.

Parameters

Name Type
tag Object
tag.tag string

Returns

Result<string>

Defined in

wallet/index.ts:3450


rescanAddresses

rescanAddresses(«destructured»?): Promise<Result<IWalletData>>

This method will clear the utxo array for each address type and reset the address indexes back to the original/default app values. Once cleared & reset the app will rescan the wallet's addresses from index zero at the standard gap limit or higher (if previously set higher by the user).

Parameters

Name Type
«destructured» Object
› shouldClearAddresses? boolean
› shouldClearTransactions? boolean

Returns

Promise<Result<IWalletData>>

Async

Defined in

wallet/index.ts:2177


resetAddressIndexes

Private resetAddressIndexes(): Promise<void>

Resets address indexes back to the app's default/original state.

Returns

Promise<void>

Defined in

wallet/index.ts:1542


resetSendTransaction

resetSendTransaction(): Promise<Result<string>>

This completely resets the send transaction state.

Returns

Promise<Result<string>>

Defined in

wallet/index.ts:3335


saveWalletData

saveWalletData<K>(key, data): Promise<string>

Type parameters

Name Type
K extends keyof IWalletData

Parameters

Name Type
key keyof IWalletData
data IWalletData[K]

Returns

Promise<string>

Defined in

wallet/index.ts:1760


send

send(«destructured»): Promise<Result<string>>

Sets up and creates a transaction to a single output/recipient.

Parameters

Name Type
«destructured» Object
› address string
› amount number
› broadcast? boolean
› message? string
› rbf? boolean
› satsPerByte? number
› shuffleOutputs? boolean

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:2826


sendMany

sendMany(«destructured»): Promise<Result<string>>

Sets up and creates a transaction to multiple outputs.

Parameters

Name Type
«destructured» Object
› broadcast? boolean
› rbf? boolean
› satsPerByte? number
› shuffleOutputs? boolean
› txs ISendTx[]

Returns

Promise<Result<string>>

Defined in

wallet/index.ts:2694


sendMax

sendMax(«destructured»?): Promise<Result<string>>

Sends the maximum amount of sats to a given address at the specified satsPerByte.

Parameters

Name Type
«destructured» Object
› address? string
› broadcast? boolean
› rbf? boolean
› satsPerByte? number

Returns

Promise<Result<string>>

Defined in

wallet/index.ts:2770


setWalletData

Private setWalletData(): Promise<Result<boolean>>

Sets the wallet data object.

Returns

Promise<Result<boolean>>

Defined in

wallet/index.ts:380


setZeroIndexAddresses

Private setZeroIndexAddresses(): Promise<Result<string>>

Will ensure that both address and change address indexes are set at index 0. Will also generate and store address and changeAddress at index 0.

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:2877


setupFeeForOnChainTransaction

setupFeeForOnChainTransaction(«destructured»?): Result<string>

Updates the fee rate for the current transaction to the preferred value if none set.

Parameters

Name Type
«destructured» Object
› satsPerByte? number
› selectedFeeId? EFeeId

Returns

Result<string>

Defined in

wallet/index.ts:3475


setupTransaction

setupTransaction(params?): Promise<TSetupTransactionResponse>

Sets up the transaction object with existing inputs and change address information @async.

Parameters

Name Type
params ISetupTransaction

Returns

Promise<TSetupTransactionResponse>

Defined in

wallet/index.ts:2652


storageIdCheck

Private storageIdCheck(id): Promise<Result<string>>

Ensure we are not overwriting wallet data of a different wallet by checking that the wallet id's match.

Parameters

Name Type
id string

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:403


sweepPrivateKey

sweepPrivateKey(«destructured»): Promise<Result<ISweepPrivateKeyRes>>

Sweeps a private key to a given address.

Parameters

Name Type
«destructured» ISweepPrivateKey

Returns

Promise<Result<ISweepPrivateKeyRes>>

Async

Defined in

wallet/index.ts:3617


switchNetwork

switchNetwork(network, servers?): Promise<Result<Wallet>>

Parameters

Name Type
network EAvailableNetworks
servers? TServer | TServer[]

Returns

Promise<Result<Wallet>>

Defined in

wallet/index.ts:273


updateAddressIndex

Private updateAddressIndex(addressType, isChangeAddress, index?): Promise<void>

Updates the address index for a given address type.

Parameters

Name Type Default value
addressType EAddressType undefined
isChangeAddress boolean undefined
index? number 0

Returns

Promise<void>

Async

Defined in

wallet/index.ts:2927


updateAddressIndexes

Private updateAddressIndexes(): Promise<Result<string>>

This method updates the next available (zero-balance) address & changeAddress index.

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:1414


updateAddressType

updateAddressType(addressType): Promise<void>

Updates the address type for the current wallet.

Parameters

Name Type
addressType EAddressType

Returns

Promise<void>

Defined in

wallet/index.ts:312


updateAndSaveWalletData

Private updateAndSaveWalletData(key, data, addressType?): Promise<void>

Parameters

Name Type
key keyof IWalletData
data IWalletData
addressType? EAddressType

Returns

Promise<void>

Defined in

wallet/index.ts:1792


updateFeeEstimates

updateFeeEstimates(forceUpdate?): Promise<Result<IOnchainFees>>

Updates the fee estimates for the current network.

Parameters

Name Type Default value Description
forceUpdate? boolean false Ignores the timestamp if set true and forces the update

Returns

Promise<Result<IOnchainFees>>

Async

Defined in

wallet/index.ts:3528


updateGapLimit

updateGapLimit(gapLimitOptions): Result<TGapLimitOptions>

Allows the user to update the gap limit options.

Parameters

Name Type
gapLimitOptions TGapLimitOptions

Returns

Result<TGapLimitOptions>

Defined in

wallet/index.ts:3701


updateGhostTransactions

Private updateGhostTransactions(txIds): Promise<Result<string>>

Removes transactions from the store and activity list.

Parameters

Name Type
txIds Object
txIds.txIds string[]

Returns

Promise<Result<string>>

Async

Defined in

wallet/index.ts:2133


updateHeader

updateHeader(headerData): Promise<void>

Updates & Saves header information to storage.

Parameters

Name Type
headerData IHeader

Returns

Promise<void>

Defined in

wallet/index.ts:2121


updateTransactionHeights

Private updateTransactionHeights(txs): Promise<string>

Updates the confirmation state of activity item transactions that were reorg'd out.

Parameters

Name Type
txs IUtxo[]

Returns

Promise<string>

Async

Defined in

wallet/index.ts:2269


updateTransactions

updateTransactions(«destructured»?): Promise<Result<undefined | string>>

Retrieves, formats & stores the transaction history for the selected wallet/network.

Parameters

Name Type
«destructured» Object
› replaceStoredTransactions? boolean
› scanAllAddresses? boolean

Returns

Promise<Result<undefined | string>>

Defined in

wallet/index.ts:1813


updateWalletBalance

updateWalletBalance(balance): Result<string>

Used to temporarily update the balance until the Electrum server catches up after sending a transaction.

Parameters

Name Type
balance Object
balance.balance number

Returns

Result<string>

Defined in

wallet/index.ts:3511


validateAddress

validateAddress(address): boolean

Attempts to validate a given address.

Parameters

Name Type
address string

Returns

boolean

Defined in

wallet/index.ts:2574


create

Static create(params): Promise<Result<Wallet>>

Parameters

Name Type
params IWallet

Returns

Promise<Result<Wallet>>

Defined in

wallet/index.ts:257