@arkade-os/sdk Documentation - v0.4.36
    Preparing search index...

    Class ReadonlyWallet

    Readonly wallet interface for Bitcoin transactions with Arkade protocol support.

    This interface defines the contract that all wallet implementations must follow. It provides methods for address management, balance checking, virtual output operations, and transaction management including sending, settling, and unrolling.

    IWallet

    Hierarchy (View Summary)

    Implements

    Index

    Properties

    contractRepository: ContractRepository
    delegateProvider?: DelegateProvider
    dustAmount: bigint

    Readonly identity associated with the wallet.

    indexerProvider: IndexerProvider
    network: Network
    onchainProvider: OnchainProvider
    walletContractTimelocks: RelativeTimelock[]
    walletRepository: WalletRepository

    Accessors

    • get arkServerPublicKey(): Bytes

      The wallet's current active server signer (x-only, 32 bytes). Read-only from the outside; mutated only via Wallet.setArkServerPublicKeyForRotation during mid-session server-signer rotation (plan §4). Single-valued for wallets that never span a rotation.

      Returns Bytes

    • get defaultContractScript(): string

      Get the pkScript hex for the wallet's primary offchain address. For the full wallet-owned script set registered in ContractManager, use getWalletScripts().

      Returns string

    Methods

    • Async-dispose hook that forwards to dispose().

      Returns Promise<void>

    • Clear the global VTXO sync cursor, forcing a full re-bootstrap on next sync. Useful for recovery after indexer reprocessing or debugging.

      Returns Promise<void>

    • Dispose wallet-owned managers and release background resources.

      Returns Promise<void>

    • Fetch Arkade transaction ids that are still pending final settlement.

      Returns Promise<string[]>

    • The on-chain (P2TR) addresses of every boarding tapscript this wallet uses — the current address plus any historical rotated boarding addresses. The aggregating boarding readers (history, notifications) fan out over this set so deposits at previous boarding addresses are still surfaced (plan §6-IV); getBoardingAddress stays single-valued.

      Returns Promise<string[]>

    • Build a transaction history view across the wallet's boarding addresses (current + historical rotated; plan §6-IV.1).

      Returns Promise<{ boardingTxs: ArkTransaction[]; commitmentsToIgnore: Set<string> }>

    • Fetch and cache onchain inputs (UTXOs) received at the wallet's boarding addresses — the current address plus any historical rotated boarding addresses that still hold unspent UTXOs (plan §6-III.1). Each UTXO is annotated with the tapscript of the address it actually sits on, so the spending path forfeits / exits it with the correct per-index leaves.

      Current-signer only: a flatten of getBoardingUtxosForSigners over the wallet's current signer, so the two paths cannot drift. Old-signer boarding recovery goes through the deprecated-signer migration API instead (it would otherwise pull EXPIRED-signer inputs into a plain settle() that the server must reject).

      Returns Promise<ExtendedCoin[]>

    • Fetch and cache onchain inputs (UTXOs) received at the boarding addresses of the given signer set, grouped per boarding address so the caller keeps the address↔signer association that ExtendedCoin cannot carry (it retains only the encoded leaves/tapTree the spend needs, not the DefaultVtxo.Script and its serverPubKey/CSV delay).

      Per group it does exactly what getBoardingUtxos does per tapscript: getCoins → extendCoinWithTapscript → saveUtxos. Offline-first: it does not call getInfo(); the caller supplies the allowed signer set, so the only network calls are the per-address getCoins.

      Parameters

      • allowedSigners: Set<string>

        x-only-hex server keys whose boarding addresses to fetch (passed through to getBoardingTapscripts).

      Returns Promise<BoardingUtxoGroup[]>

    • Get the ContractManager for managing contracts including the wallet's default address.

      The ContractManager handles:

      • The wallet's default receiving address (as a "default" contract)
      • External contracts (Boltz swaps, HTLCs, etc.)
      • Multi-contract watching with resilient connections

      Returns Promise<ContractManager>

      const manager = await wallet.getContractManager();

      // Create a contract for a Boltz swap
      const contract = await manager.createContract({
      label: "Boltz Swap",
      type: "vhtlc",
      params: { ... },
      script: swapScript,
      address: swapAddress,
      });

      // Start watching for events (includes wallet's default address)
      const stop = await manager.onContractEvent((event) => {
      console.log(`${event.type} on ${event.contractScript}`);
      });
    • Get all pkScript hex strings for the wallet's own addresses (both delegate and non-delegate, current and historical).

      Returns Promise<string[]>

    • Subscribe to onchain and offchain notifications for newly received funds.

      The onchain watcher tracks the full boarding-address set (current + historical rotated). When boarding rotates after subscribing — e.g. rotate-on-board allocates a fresh address via getNewBoardingAddress — the watcher automatically re-subscribes to widen its set, so a deposit to the new address fires a notification within the same session (no watcher re-init required). The re-subscribe is driven by onBoardingRotation; static / auto / readonly wallets never rotate boarding, so it never fires for them.

      Parameters

      • eventCallback: (coins: IncomingFunds) => void

        Callback invoked when matching funds are detected

      Returns Promise<() => void>

      A function that stops the subscriptions

    • Outpoints of VTXOs whose deprecated signer is past its cutoff (EXPIRED) and which have not yet been swept — unspendable until they recover. Offline: classifies the repo's contracts against the cached signer set (active + _deprecatedSigners, cutoffs included). Empty fast-path when no signer is deprecated. Consumed by getBalance (the pendingRecovery bucket) and the send coin-selection path so neither counts nor spends them.

      Returns Promise<Set<string>>

    • Refresh the cached deprecated-signer set from a fresh server-info snapshot. Called by the create() factories at construction and by the server-info-change handler mid-session. Lenient: a malformed deprecated entry is skipped, never fatal to wallet creation.

      Parameters

      • info: { deprecatedSigners?: readonly { cutoffDate?: bigint; pubkey?: string }[] }

      Returns void