Optional
withThis 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.
The hash of a transaction
Optional
timeout: numberAn optional timeout for waiting for confirmation. This value should be greater than average block time of 20000 ms
A Promise that resolves to a boolean
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.
The Transaction
Optional
additionalUtxos: TransactionUnspentOutput[]Optional utxos to be added to the evaluation.
A Promise that resolves to a Redeemers type
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.
A Promise that resolves to a ProtocolParameters object.
Get the slot config, which describes how to translate between slots and unix timestamps TODO: this is brittle; in theory this should work with the era histories; also, networkName is awkward
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.
The AssetId for the NFT
A Promise that resolves to TransactionUnspentOutput.
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.
The Address or Payment Credential
Optional
filter: ((utxo: BlockfrostUTxO) => boolean)A Promise that resolves to TransactionUnspentOutput[].
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.
Address or Payment Credential.
The AssetId
A Promise that resolves to TransactionUnspentOutput[].
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.
The hash of a datum
A Promise that resolves to PlutusData
Resolves the script deployment by finding a UTxO containing the script reference.
The script or its hash to resolve.
Optional
address: AddressThe address to search for the script deployment. Defaults to a burn address.
This is a default implementation that works but may not be optimal. Subclasses of Provider should implement their own version for better performance.
The method searches for a UTxO at the given address (or a burn address by default) that contains a script reference matching the provided script or script hash.
const scriptUtxo = await provider.resolveScriptRef(myScript);
if (scriptUtxo) {
console.log("Script found in UTxO:", scriptUtxo.input().toCore());
} else {
console.log("Script not found");
}
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.
A list of TransactionInput
A Promise that resolves to TransactionUnspentOutput[].
Abstract class for the Provider. This class provides an interface for interacting with the blockchain.