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

Dumps the live Blockfrost mempool to console.

blockfrostV0Client.dumpMempool satisfies () => Promise<void>

getAddressesWithAssetClass

Returns a list of addresses containing the given asset class.

blockfrostV0Client.getAddressesWithAssetClass satisfies (assetClass: AssetClass) => Promise<{
  address: Address
  quantity: bigint
}[]>

getAddressTxs

Returns all transactions which spend inputs from, or return UTxOs to, the given address

blockfrostV0Client.getAddressTxs satisfies (address: Address) => Promise<TxBlockInfo[]>

getTx

Note: only works for Conway era onward. If you need to get Txs from previous eras use getTxInfo() instead

blockfrostV0Client.getTx satisfies (id: TxId) => Promise<Tx>

getTxInfo

Simplified version of getTx() that works for all eras

blockfrostV0Client.getTxInfo satisfies (txId: TxId) => Promise<ExtendedTxInfo>

getUtxo

If the UTxO isn't found a UtxoNotFoundError is thrown If the UTxO is already spent a UtxoAlreadySpentError is thrown

blockfrostV0Client.getUtxo satisfies (id: TxOutputId) => Promise<TxInput>

getUtxos

Gets a complete list of UTxOs at a given Address. Returns oldest UTxOs first, newest last.

blockfrostV0Client.getUtxos satisfies (addr: Address) => Promise<TxInput[]>

getUtxosWithAssetClass

blockfrostV0Client.getUtxosWithAssetClass satisfies (
  address: Address,
  assetClass: AssetClass
) => Promise<TxInput[]>

hasTx

blockfrostV0Client.hasTx satisfies (txId: TxId) => Promise<boolean>

hasUtxo

blockfrostV0Client.hasUtxo satisfies (utxoId: TxOutputId) => Promise<boolean>

isMainnet

blockfrostV0Client.isMainnet satisfies () => boolean

latestEpoch

blockfrostV0Client.latestEpoch satisfies Promise<any>

networkName

blockfrostV0Client.networkName satisfies NetworkName

now

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

blockfrostV0Client.now satisfies number

parameters

Note: this requires two API calls to blockfrost, because we also need information about the tip

blockfrostV0Client.parameters satisfies Promise<NetworkParams>

projectId

blockfrostV0Client.projectId satisfies string

submitTx

Submits a transaction to the blockchain.

blockfrostV0Client.submitTx satisfies (tx: Tx) => Promise<TxId>