import { Effect } from "effect";
import * as KoiosEffect from "./internal/KoiosEffect.js";
/**
 * Koios provider for Cardano blockchain data access.
 * Provides support for interacting with the Koios API across multiple environments.
 * Supports optional bearer token authentication.
 *
 * @since 2.0.0
 * @category constructors
 */
export class Koios {
  baseUrl;
  token;
  effect;
  constructor(baseUrl, token) {
    this.baseUrl = baseUrl;
    this.token = token;
    this.effect = {
      getProtocolParameters: () => KoiosEffect.getProtocolParameters(this.baseUrl, this.token),
      getUtxos: KoiosEffect.getUtxos(this.baseUrl, this.token),
      getUtxosWithUnit: KoiosEffect.getUtxosWithUnit(this.baseUrl, this.token),
      getUtxoByUnit: KoiosEffect.getUtxoByUnit(this.baseUrl, this.token),
      getUtxosByOutRef: KoiosEffect.getUtxosByOutRef(this.baseUrl, this.token),
      getDelegation: KoiosEffect.getDelegation(this.baseUrl, this.token),
      getDatum: KoiosEffect.getDatum(this.baseUrl, this.token),
      awaitTx: KoiosEffect.awaitTx(this.baseUrl, this.token),
      submitTx: KoiosEffect.submitTx(this.baseUrl, this.token),
      evaluateTx: KoiosEffect.evaluateTx(this.baseUrl, this.token)
    };
  }
  getProtocolParameters = () => Effect.runPromise(this.effect.getProtocolParameters());
  getUtxos = addressOrCredential => Effect.runPromise(this.effect.getUtxos(addressOrCredential));
  getUtxosWithUnit = (addressOrCredential, unit) => Effect.runPromise(this.effect.getUtxosWithUnit(addressOrCredential, unit));
  getUtxoByUnit = unit => Effect.runPromise(this.effect.getUtxoByUnit(unit));
  getUtxosByOutRef = outRefs => Effect.runPromise(this.effect.getUtxosByOutRef(outRefs));
  getDelegation = rewardAddress => Effect.runPromise(this.effect.getDelegation(rewardAddress));
  getDatum = datumHash => Effect.runPromise(this.effect.getDatum(datumHash));
  awaitTx = (txHash, checkInterval, timeout) => Effect.runPromise(this.effect.awaitTx(txHash, checkInterval, timeout));
  submitTx = tx => Effect.runPromise(this.effect.submitTx(tx));
  evaluateTx = (tx, additionalUTxOs) => Effect.runPromise(this.effect.evaluateTx(tx, additionalUTxOs));
}
//# sourceMappingURL=Koios.js.map