@btc-stamps/tx-builder - v0.1.7
    Preparing search index...

    Class ElectrumXProvider

    ElectrumX provider for interacting with Bitcoin network via ElectrumX servers

    ElectrumXProvider implements a robust connection to ElectrumX servers with:

    • Automatic server failover and retry logic
    • WebSocket connection management
    • Full ElectrumX protocol support
    • Built-in caching for performance
    • Address validation and script hash conversion

    Features:

    • Multiple server endpoints with automatic failover
    • Configurable retry attempts and timeouts
    • UTXO fetching with mempool awareness
    • Transaction broadcasting and monitoring
    • Balance queries with confirmed/unconfirmed breakdown
    • Fee estimation support
    const provider = new ElectrumXProvider({
    endpoints: [
    { host: 'electrum.blockstream.info', port: 50002, ssl: true }
    ],
    network: networks.bitcoin,
    maxRetries: 3
    });

    const utxos = await provider.getUTXOs('bc1q...');
    const balance = await provider.getBalance('bc1q...');

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    maxRetryDelay: number
    network: Network
    retries: number
    retryDelay: number
    timeout: number

    Methods

    • Get address transaction history

      Parameters

      • address: string
      • Optionaloptions: AddressHistoryOptions

      Returns Promise<AddressHistory[]>

    • Get comprehensive fee estimates for multiple confirmation targets

      Returns Promise<ElectrumXFeeEstimate>

    • Get normalized fee rate ensuring it's within acceptable bounds

      Parameters

      • priority: "low" | "medium" | "high" = 'medium'

      Returns Promise<NormalizedFeeRate>

    • Get all priority levels with normalized rates

      Returns Promise<
          {
              high: NormalizedFeeRate;
              low: NormalizedFeeRate;
              medium: NormalizedFeeRate;
              urgent?: NormalizedFeeRate;
          },
      >

    • Normalize fee rate from provider response to consistent satsPerVB

      Parameters

      • rate: any
      • source: FeeSource

      Returns null | NormalizedFeeRate

    • Test connection to all configured endpoints

      Returns Promise<{ endpoint: ElectrumXEndpoint; error?: string; success: boolean }[]>