Skip to main content

ReadonlyCardanoClient

Blockchain query interface without the ability to submit transactions.

export interface ReadonlyCardanoClient {
  getTx: (id: TxId) => Promise<Tx>
  getUtxo(id: TxOutputId): Promise<TxInput>
  getUtxos(address: Address): Promise<TxInput[]>
  getUtxosWithAssetClass: (
    address: Address,
    assetClass: AssetClass
  ) => Promise<TxInput[]>
  isMainnet(): boolean
  now: number
  parameters: Promise<NetworkParams>
}

Properties

getTx

Optionally more efficient method of getting a whole Tx

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

getUtxo

Returns a single TxInput (that might already have been spent).

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

getUtxos

Returns a complete list of UTxOs at a given address.

readonlyCardanoClient.getUtxos satisfies (address: Address) => Promise<TxInput[]>

getUtxosWithAssetClass

Optionally more efficient method to get a complete list of UTxOs at a given address, filtered to contain a given AssetClass

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

isMainnet

Returns true for mainnet

readonlyCardanoClient.isMainnet satisfies () => boolean

now

Returns the number of ms since some reference (for mainnet -> since 1970, for emulator -> arbitrary reference)

readonlyCardanoClient.now satisfies number

parameters

Returns the latest network parameters.

readonlyCardanoClient.parameters satisfies Promise<NetworkParams>