Skip to main content

BlockfrostV0Client

export interface BlockfrostV0Client {
  dumpMempool(): Promise<void>
  getAddressesWithAssetClass(assetClass: AssetClass): Promise<{
    address: Address
    quantity: bigint
  }[]>
  getAddressTxs(address: Address): Promise<TxBlockInfo[]>
  getTx(id: TxId): Promise<Tx>
  getTxInfo(txId: TxId): Promise<ExtendedTxInfo>
  getUtxo(id: TxOutputId): Promise<TxInput>
  getUtxos(addr: Address): Promise<TxInput[]>
  getUtxosWithAssetClass(
    address: Address,
    assetClass: AssetClass
  ): Promise<TxInput[]>
  hasTx(txId: TxId): Promise<boolean>
  hasUtxo(utxoId: TxOutputId): Promise<boolean>
  isMainnet(): boolean
  latestEpoch: Promise<any>
  networkName: NetworkName
  now: number
  parameters: Promise<NetworkParams>
  projectId: string
  submitTx(tx: Tx): Promise<TxId>
}

Properties

dumpMempool

dumpMempool(): Promise<void>
Dumps the live Blockfrost mempool to console.

getAddressesWithAssetClass

getAddressesWithAssetClass(assetClass: AssetClass): Promise<{
  address: Address
  quantity: bigint
}[]>
Returns a list of addresses containing the given asset class.

getAddressTxs

getAddressTxs(address: Address): Promise<TxBlockInfo[]>
Returns all transactions which spend inputs from, or return UTxOs to, the given address

getTx

getTx(id: TxId): Promise<Tx>
Note: only works for Conway era onward. If you need to get Txs from previous eras use getTxInfo() instead

getTxInfo

getTxInfo(txId: TxId): Promise<ExtendedTxInfo>
Simplified version of getTx() that works for all eras

getUtxo

getUtxo(id: TxOutputId): Promise<TxInput>
If the UTxO isn't found a UtxoNotFoundError is thrown If the UTxO is already spent a UtxoAlreadySpentError is thrown

getUtxos

getUtxos(addr: Address): Promise<TxInput[]>
Gets a complete list of UTxOs at a given Address. Returns oldest UTxOs first, newest last.

getUtxosWithAssetClass

getUtxosWithAssetClass(
  address: Address,
  assetClass: AssetClass
): Promise<TxInput[]>

hasTx

hasTx(txId: TxId): Promise<boolean>

hasUtxo

hasUtxo(utxoId: TxOutputId): Promise<boolean>

isMainnet

isMainnet(): boolean

latestEpoch

latestEpoch: Promise<any>

networkName

networkName: NetworkName

now

now: number
ms since 1970 Note: the emulator uses an arbitrary reference, so to be able to treat all Networks equally this must be implemented for each CardanoClient

parameters

parameters: Promise<NetworkParams>
Note: this requires two API calls to blockfrost, because we also need information about the tip

projectId

projectId: string

submitTx

submitTx(tx: Tx): Promise<TxId>
Submits a transaction to the blockchain.