Skip to main content

CardanoClientHelper

export interface CardanoClientHelper {
  calcBalance(addr: Address): Promise<Value>
  client: C
  getUtxo(
    id: TxOutputId,
    addr: Address<SC>
  ): Promise<TxInput<SC>>
  getUtxos(addr: Address<SC>): Promise<TxInput<SC>[]>
  getUtxosWithAssetClass(
    addr: Address<SC>,
    assetClass: AssetClass
  ): Promise<TxInput<SC>[]>
  isMainnet(): boolean
  now: number
  options: CardanoClientHelperOptions
  parameters: Promise<NetworkParams>
  selectUtxo(
    addr: Address<SC>,
    value: Value
  ): Promise<TxInput<SC>>
  selectUtxos(
    addr: Address<SC>,
    value: Value,
    coinSelection: CoinSelection<SC>
  ): Promise<TxInput<SC>[]>
  submitTx: unknown
}

Properties

calcBalance

cardanoClientHelper.calcBalance satisfies (addr: Address) => Promise<Value>

client

cardanoClientHelper.client satisfies C

getUtxo

cardanoClientHelper.getUtxo satisfies (
  id: TxOutputId,
  addr: Address<SC>
) => Promise<TxInput<SC>>

getUtxos

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

getUtxosWithAssetClass

cardanoClientHelper.getUtxosWithAssetClass satisfies (
  addr: Address<SC>,
  assetClass: AssetClass
) => Promise<TxInput<SC>[]>

isMainnet

cardanoClientHelper.isMainnet satisfies () => boolean

now

cardanoClientHelper.now satisfies number

options

cardanoClientHelper.options satisfies CardanoClientHelperOptions

parameters

cardanoClientHelper.parameters satisfies Promise<NetworkParams>

selectUtxo

This method is used to select very specific UTxOs that contain known tokens/NFTs If the UTxO isn't found that usually means something is wrong with the network synchronization The onSelectUtxoFail callback can be used to trigger a synchronization action if the UTxO isn' foun

cardanoClientHelper.selectUtxo satisfies (
  addr: Address<SC>,
  value: Value
) => Promise<TxInput<SC>>

selectUtxos

coinSelection defaults to selectSmallestFirst

cardanoClientHelper.selectUtxos satisfies (
  addr: Address<SC>,
  value: Value,
  coinSelection: CoinSelection<SC>
) => Promise<TxInput<SC>[]>

submitTx

Only available if the underlying client isn't a ReadonlyCardanoClient

cardanoClientHelper.submitTx satisfies unknown