Skip to content
docs

WalletAccountReadOnlyBtc

Defined in: wallet-btc/src/read-only-account.ts:26

Watch-only Bitcoin account: balances, quotes, receipts, BIP-137 verification. No key.

  • IWalletAccountReadOnly

new WalletAccountReadOnlyBtc(address, config?): WalletAccountReadOnlyBtc

Defined in: wallet-btc/src/read-only-account.ts:43

string

BtcConfig = {}

WalletAccountReadOnlyBtc

protected readonly _client: BtcClient | undefined

Defined in: wallet-btc/src/read-only-account.ts:39


protected readonly _config: BtcConfig

Defined in: wallet-btc/src/read-only-account.ts:38


protected readonly _network: BTC_NETWORK

Defined in: wallet-btc/src/read-only-account.ts:40


protected readonly _networkName: BtcNetwork

Defined in: wallet-btc/src/read-only-account.ts:41


readonly address: string

Defined in: wallet-btc/src/read-only-account.ts:28

The address.


readonly addressType: BtcAddressType | undefined

Defined in: wallet-btc/src/read-only-account.ts:35

p2wpkh / p2tr when the address is one we know how to spend from; undefined for other script types.


readonly chain: string

Defined in: wallet-btc/src/read-only-account.ts:29

CAIP-2 chain id, e.g. “eip155:1”, “solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp”, “ton:-239”, “tron:0x2b6653dc”, “bip122:000000000019d6689c085ae165831e93”.

IWalletAccountReadOnly.chain


readonly dustLimit: bigint

Defined in: wallet-btc/src/read-only-account.ts:37

Smallest output this address type may create, in satoshis.


readonly scriptKind: ScriptKind

Defined in: wallet-btc/src/read-only-account.ts:33

Script type of the address.


readonly scriptPubKey: Uint8Array

Defined in: wallet-btc/src/read-only-account.ts:31

Output script of address.

get maxFeeRate(): number

Defined in: wallet-btc/src/read-only-account.ts:63

Fee-rate ceiling in sat/vB: BtcConfig.maxFeeRate or DEFAULT_MAX_FEE_RATE.

number

getAddress(): Promise<string>

Defined in: wallet-btc/src/read-only-account.ts:68

The address.

Promise<string>

IWalletAccountReadOnly.getAddress


getBalance(): Promise<bigint>

Defined in: wallet-btc/src/read-only-account.ts:71

Confirmed minus pending outgoing (Bitcoin Core wallet semantics).

Promise<bigint>

IWalletAccountReadOnly.getBalance


getMaxSpendable(opts?): Promise<BtcMaxSpendableResult>

Defined in: wallet-btc/src/read-only-account.ts:136

Everything spendable in ONE transaction to a single output of our own address type, no change.

number

number | bigint

string

Promise<BtcMaxSpendableResult>


getTokenBalance(_token): Promise<bigint>

Defined in: wallet-btc/src/read-only-account.ts:77

Always throws: Bitcoin has no tokens.

string

Promise<bigint>

IWalletAccountReadOnly.getTokenBalance


getTransactionReceipt(hash): Promise<BtcReceipt | undefined>

Defined in: wallet-btc/src/read-only-account.ts:147

Undefined until the transaction is mined.

string

Promise<BtcReceipt | undefined>

IWalletAccountReadOnly.getTransactionReceipt


protected inputWeight(): number

Defined in: wallet-btc/src/read-only-account.ts:82

Weight one of OUR inputs adds; throws for address types we cannot spend from.

number


protected lockTimeHeight(): Promise<number>

Defined in: wallet-btc/src/read-only-account.ts:167

Chain tip for anti-fee-sniping; undefined when disabled or the transport cannot tell.

Promise<number>


protected planSpend(spend): Promise<SpendPlan>

Defined in: wallet-btc/src/read-only-account.ts:97

Coin selection for a spend (see coinselect.ts). Validates the recipient and the dust floor first.

BtcSpend

Promise<SpendPlan>


quoteSendTransaction(tx): Promise<{ fee: bigint; }>

Defined in: wallet-btc/src/read-only-account.ts:120

Fee of a spend in satoshis, from a coin selection at the current fee rate.

BtcSpend

Promise<{ fee: bigint; }>

IWalletAccountReadOnly.quoteSendTransaction


quoteTransfer(o): Promise<{ fee: bigint; }>

Defined in: wallet-btc/src/read-only-account.ts:130

Fee of a transfer in satoshis.

BtcTransferOptions

Promise<{ fee: bigint; }>

Error when token is set.

IWalletAccountReadOnly.quoteTransfer


protected requireClient(what): BtcClient

Defined in: wallet-btc/src/read-only-account.ts:57

string

BtcClient


protected resolveFeeRate(spend): Promise<bigint>

Defined in: wallet-btc/src/read-only-account.ts:87

number

number | bigint

Promise<bigint>


verify(message, signature): Promise<boolean>

Defined in: wallet-btc/src/read-only-account.ts:159

BIP-137: recover the key and compare its p2wpkh address with ours. Taproot addresses have no BIP-137 form.

string | Uint8Array<ArrayBufferLike>

string

Promise<boolean>

IWalletAccountReadOnly.verify