Class BlockfrostProvider

BlockfrostProvider is a provider for interacting with the Blockfrost API.

It extends the BaseProvider class and implements methods to fetch protocol parameters, unspent outputs, resolve datums, confirm transactions, and submit transactions.

Implements

Constructors

Properties

url: string

Methods

  • Confirms a transaction by its ID.

    Parameters

    • txId: string

      The transaction ID to confirm.

    • Optionaltimeout: number

      Optional timeout in milliseconds. If omitted, uses a default.

    Returns Promise<boolean>

    A promise that resolves to true if the transaction is confirmed, otherwise false.

  • Evaluates a transaction by its CBOR representation.

    Parameters

    • tx: string

      The hex-encoded CBOR of the transaction to evaluate.

    • OptionaladditionalUtxos: UTxO[] = []

      Optional additional UTxOs to include in the evaluation.

    Returns Promise<Redeemer[]>

    A promise that resolves to an array of Redeemer objects with execution units.

  • Retrieves the unspent output (UTxO) that holds a specific NFT asset.

    Parameters

    • assetId: string

      The asset identifier of the NFT (policyId + asset name in hex).

    Returns Promise<UTxO>

    A promise that resolves to the UTxO containing the NFT.

  • List all UTxOs for an address that contain a specific asset.

    Parameters

    • address: string | Address

      Payment address. Address object or bech32 string.

    • assetId: string

      Asset identifier (policyId + asset name hex).

    Returns Promise<UTxO[]>

    A promise that resolves to matching UTxOs.

  • Returns the headers required for Blockfrost API requests.

    Returns { Origin: string; project_id: string }

    An object containing the project ID header.

  • Resolves a datum by its hash.

    Parameters

    • datumHash: string

      The hex-encoded hash of the datum.

    Returns Promise<string>

    A promise that resolves to the CBOR-encoded datum.

  • Submits a signed transaction to the Blockfrost API.

    Parameters

    • tx: string

      The hex-encoded transaction payload.

    Returns Promise<string>

    A promise that resolves to the submitted transaction ID (hash).