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.

When created, UtxoContext 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.

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

Constructors

Properties

balance: Balance

Current Balance of the UtxoContext.

Methods

  • Clear the UtxoContext. Unregisters all addresses and clears all UTXO entries.

    Returns Promise<void>

  • Returns void

  • Returns all mature UTXO entries that are currently managed by the UtxoContext and are available for spending.

    Returns any[]

  • Returns pending UTXO entries that are currently managed by the UtxoContext.

    Returns any[]

    • Return copy of self without private attributes.

    Returns Object

  • Return stringified version of self.

    Returns string

  • Performs a scan of the given addresses and registers them in the context for event notifications.

    Parameters

    • addresses: string[] | Address[]
    • Optional optional_current_daa_score: bigint

    Returns Promise<void>

  • Unregister a list of addresses from the context. This will stop tracking of these addresses.

    Parameters

    Returns Promise<void>

Generated using TypeDoc