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

    Class EsploraProvider

    Implementation of the onchain provider interface for esplora REST API.

    const provider = new EsploraProvider("https://mempool.space/api");
    const outputs = await provider.getCoins("bcrt1q679zsd45msawvr7782r0twvmukns3drlstjt77");

    Implements

    Index

    Constructors

    • Parameters

      • baseUrl: string
      • Optionalopts: { forcePolling?: boolean; pollingInterval?: number }
        • OptionalforcePolling?: boolean

          Force polling even when websocket transport is available.

        • OptionalpollingInterval?: number

          Polling interval in milliseconds.

      Returns EsploraProvider

    Properties

    forcePolling: boolean
    pollingInterval: number

    Methods

    • Broadcast a single transaction or a 1P1C package.

      Parameters

      • ...txs: string[]

        One or more raw transaction hex strings

      Returns Promise<string>

      Broadcast transaction id

      Error if the broadcast request fails or the package shape is invalid

    • Fetch the current chain tip.

      Returns Promise<{ hash: string; height: number; time: number }>

      Current chain height, block time, and block hash

    • Fetch spendable onchain outputs for an address.

      Parameters

      • address: string

        Bitcoin address to query

      Returns Promise<Coin[]>

      Spendable onchain outputs for the address

      Coin

    • Fetch the current fastest fee rate estimate.

      Returns Promise<number | undefined>

      Fee rate in sats/vB, if available

      Implementations may return undefined when the backing service does not expose a usable fee estimate.

    • Fetch outspend information for every output in a transaction.

      Parameters

      • txid: string

        Transaction id to inspect

      Returns Promise<{ spent: boolean; txid: string }[]>

      Per-output spend status information

      getTxStatus

    • Fetch confirmation status for a transaction.

      Parameters

      • txid: string

        Transaction id to inspect

      Returns Promise<
          | { confirmed: false }
          | { blockHeight: number; blockTime: number; confirmed: true },
      >

      Confirmation status and block metadata when confirmed

      getTxOutspends

    • Watch a set of addresses and invoke the callback when transactions are observed.

      Parameters

      Returns Promise<() => void>

      Stop function that cancels the watch

      Implementations may use websockets, server-sent events, polling, or a hybrid strategy.

      getTransactions