Readonly
balanceCurrent Balance of the UtxoContext.
Performs a scan of the given addresses and registers them in the context for event notifications.
Optional
optional_current_daa_score: bigintUnregister a list of addresses from the context. This will stop tracking of these addresses.
Generated using TypeDoc
UtxoContext is a class that provides a way to track addresses activity on the Kaspa network. When an address is registered with UtxoContext it aggregates all UTXO entries for that address and emits events when any activity against these addresses occurs.
UtxoContext constructor accepts IUtxoContextArgs interface that can contain an optional id parameter. If supplied, this
id
parameter will be included in all notifications emitted by the UtxoContext as well as included as a part of ITransactionRecord emitted when transactions occur. If not provided, a random id will be generated. This id typically represents an account id in the context of a wallet application. The integrated Wallet API uses UtxoContext to represent wallet accounts.UtxoContext maintains a real-time cumulative balance of all addresses registered against it and provides balance update notification events when the balance changes.
The UtxoContext balance is comprised of 3 values:
mature
: amount of funds available for spending.pending
: amount of funds that are being received.outgoing
: amount of funds that are being sent but are not yet accepted by the network.Please see IBalance interface for more details.
UtxoContext can be supplied as a UTXO source to the transaction Generator allowing the Generator to create transactions using the UTXO entries it manages.
IMPORTANT: UtxoContext is meant to represent a single account. It is not designed to be used as a global UTXO manager for all addresses in a very large wallet (such as an exchange wallet). For such use cases, it is recommended to perform manual UTXO management by subscribing to UTXO notifications using RpcClient.subscribeUtxosChanged and RpcClient.getUtxosByAddresses.
See
IUtxoContextArgs, UtxoProcessor, Generator, createTransactions, IBalance, IBalanceEvent, IPendingEvent, IReorgEvent, IStasisEvent, IMaturityEvent, IDiscoveryEvent, IBalanceEvent, ITransactionRecord