Skip to main content
Version: 0.2.38

sdk.blockfrost

Home > @blaze-cardano/sdk > Blockfrost

Blockfrost class​

Signature:

declare class Blockfrost extends Provider 

Extends: Provider

Constructors​

Constructor

Modifiers

Description

(constructor)({ network, projectId, withScriptRefCaching, })

Constructs a new instance of the Blockfrost class

Properties​

Property

Modifiers

Type

Description

url

string

withScriptRefCaching

boolean

Methods​

Method

Modifiers

Description

awaitTransactionConfirmation(txId, timeout)

This method awaits confirmation of the transaction given as argument. The response is parsed into a boolean, which is then returned. If tx is not confirmed at first and no value for timeout is provided, then false is returned. If tx is not confirmed at first and a value for timeout (in ms) is given, then subsequent checks will be performed at a 20 second interval until timeout is reached.

evaluateTransaction(tx, additionalUtxos)

This method evaluates how much execution units a transaction requires. Optionally, additional outputs can be provided. These are added to the evaluation without checking for their presence on-chain. This is useful when performing transaction chaining, where some outputs used as inputs to a transaction will have not yet been submitted to the network.

getParameters()

This method fetches the protocol parameters from the Blockfrost API. It constructs the query URL, sends a GET request with the appropriate headers, and processes the response. The response is parsed into a ProtocolParameters object, which is then returned. If the response is not in the expected format, an error is thrown.

getUnspentOutputByNFT(nft)

This method fetches the UTxO that holds a particular NFT given as argument. The response is parsed into a TransactionUnspentOutput type, which is then returned. If the response is not in the expected format, an error is thrown.

getUnspentOutputs(address, filter)

This method fetches the UTxOs under a given address. The response is parsed into a TransactionUnspentOutput[] type, which is then returned. If the response is not in the expected format, an error is thrown.

getUnspentOutputsWithAsset(address, unit)

This method fetches the UTxOs under a given address that hold a particular asset. The response is parsed into a TransactionUnspentOutput[] type, which is then returned. If the response is not in the expected format, an error is thrown.

headers()

postTransactionToChain(tx)

This method submits a transaction to the chain.

resolveDatum(datumHash)

This method returns the datum for the datum hash given as argument. The response is parsed into a PlutusData type, which is then returned. If the response is not in the expected format, an error is thrown.

resolveScriptRef(script, address)

resolveUnspentOutputs(txIns)

This method resolves transaction outputs from a list of transaction inputs given as argument. The response is parsed into a TransactionUnspentOutput[] type, which is then returned. If the response is not in the expected format, an error is thrown.