@arkade-os/sdk Documentation - v0.4.0-next.8
    Preparing search index...

    Class ReadonlyWallet

    Readonly wallet interface for Bitcoin transactions with Ark protocol support.

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

    Hierarchy (View Summary)

    Implements

    Index

    Properties

    arkServerPublicKey: Bytes
    boardingTapscript: DefaultVtxo.Script
    contractRepository: ContractRepository
    delegatorProvider?: DelegatorProvider
    dustAmount: bigint
    indexerProvider: IndexerProvider
    network: Network
    offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script
    onchainProvider: OnchainProvider
    walletRepository: WalletRepository

    Accessors

    • get defaultContractScript(): string

      Get the contract script for the wallet's default address. This is the pkScript hex, used to identify the wallet in ContractManager.

      Returns string

    Methods

    • 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). Falls back to only the current script if ContractManager is not yet initialized.

      Returns Promise<string[]>