WalletAccountReadOnlyBtc
Defined in: wallet-btc/src/read-only-account.ts:26
Watch-only Bitcoin account: balances, quotes, receipts, BIP-137 verification. No key.
Extended by
Section titled “Extended by”Implements
Section titled “Implements”IWalletAccountReadOnly
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WalletAccountReadOnlyBtc(
address,config?):WalletAccountReadOnlyBtc
Defined in: wallet-btc/src/read-only-account.ts:43
Parameters
Section titled “Parameters”address
Section titled “address”string
config?
Section titled “config?”BtcConfig = {}
Returns
Section titled “Returns”WalletAccountReadOnlyBtc
Properties
Section titled “Properties”_client
Section titled “_client”
protectedreadonly_client:BtcClient|undefined
Defined in: wallet-btc/src/read-only-account.ts:39
_config
Section titled “_config”
protectedreadonly_config:BtcConfig
Defined in: wallet-btc/src/read-only-account.ts:38
_network
Section titled “_network”
protectedreadonly_network:BTC_NETWORK
Defined in: wallet-btc/src/read-only-account.ts:40
_networkName
Section titled “_networkName”
protectedreadonly_networkName:BtcNetwork
Defined in: wallet-btc/src/read-only-account.ts:41
address
Section titled “address”
readonlyaddress:string
Defined in: wallet-btc/src/read-only-account.ts:28
The address.
addressType
Section titled “addressType”
readonlyaddressType: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.
readonlychain: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”.
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.chain
dustLimit
Section titled “dustLimit”
readonlydustLimit:bigint
Defined in: wallet-btc/src/read-only-account.ts:37
Smallest output this address type may create, in satoshis.
scriptKind
Section titled “scriptKind”
readonlyscriptKind:ScriptKind
Defined in: wallet-btc/src/read-only-account.ts:33
Script type of the address.
scriptPubKey
Section titled “scriptPubKey”
readonlyscriptPubKey:Uint8Array
Defined in: wallet-btc/src/read-only-account.ts:31
Output script of address.
Accessors
Section titled “Accessors”maxFeeRate
Section titled “maxFeeRate”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”number
Methods
Section titled “Methods”getAddress()
Section titled “getAddress()”getAddress():
Promise<string>
Defined in: wallet-btc/src/read-only-account.ts:68
The address.
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getAddress
getBalance()
Section titled “getBalance()”getBalance():
Promise<bigint>
Defined in: wallet-btc/src/read-only-account.ts:71
Confirmed minus pending outgoing (Bitcoin Core wallet semantics).
Returns
Section titled “Returns”Promise<bigint>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getBalance
getMaxSpendable()
Section titled “getMaxSpendable()”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.
Parameters
Section titled “Parameters”confirmationTarget?
Section titled “confirmationTarget?”number
feeRate?
Section titled “feeRate?”number | bigint
string
Returns
Section titled “Returns”Promise<BtcMaxSpendableResult>
getTokenBalance()
Section titled “getTokenBalance()”getTokenBalance(
_token):Promise<bigint>
Defined in: wallet-btc/src/read-only-account.ts:77
Always throws: Bitcoin has no tokens.
Parameters
Section titled “Parameters”_token
Section titled “_token”string
Returns
Section titled “Returns”Promise<bigint>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getTokenBalance
getTransactionReceipt()
Section titled “getTransactionReceipt()”getTransactionReceipt(
hash):Promise<BtcReceipt|undefined>
Defined in: wallet-btc/src/read-only-account.ts:147
Undefined until the transaction is mined.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<BtcReceipt | undefined>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.getTransactionReceipt
inputWeight()
Section titled “inputWeight()”
protectedinputWeight():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.
Returns
Section titled “Returns”number
lockTimeHeight()
Section titled “lockTimeHeight()”
protectedlockTimeHeight():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.
Returns
Section titled “Returns”Promise<number>
planSpend()
Section titled “planSpend()”
protectedplanSpend(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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<SpendPlan>
quoteSendTransaction()
Section titled “quoteSendTransaction()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<{ fee: bigint; }>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.quoteSendTransaction
quoteTransfer()
Section titled “quoteTransfer()”quoteTransfer(
o):Promise<{fee:bigint; }>
Defined in: wallet-btc/src/read-only-account.ts:130
Fee of a transfer in satoshis.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<{ fee: bigint; }>
Throws
Section titled “Throws”Error when token is set.
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.quoteTransfer
requireClient()
Section titled “requireClient()”
protectedrequireClient(what):BtcClient
Defined in: wallet-btc/src/read-only-account.ts:57
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”resolveFeeRate()
Section titled “resolveFeeRate()”
protectedresolveFeeRate(spend):Promise<bigint>
Defined in: wallet-btc/src/read-only-account.ts:87
Parameters
Section titled “Parameters”confirmationTarget?
Section titled “confirmationTarget?”number
feeRate?
Section titled “feeRate?”number | bigint
Returns
Section titled “Returns”Promise<bigint>
verify()
Section titled “verify()”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.
Parameters
Section titled “Parameters”message
Section titled “message”string | Uint8Array<ArrayBufferLike>
signature
Section titled “signature”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”IWalletAccountReadOnly.verify