kuber-client
Version:
Javascript client library for kuber server
54 lines (53 loc) • 2.94 kB
TypeScript
import { AxiosInstance } from "axios";
import { CommonProtocolParameters, CommonTxObject } from "libcardano-wallet/utils/types";
import { Commit, RetryConfig } from "../utils/type";
import { HexString, UTxO } from "libcardano/cardano/serialization";
import { KuberProvider } from "./KuberProvider";
import { KuberApiProvider } from "./KuberApiProvider";
import { HydraHeadState, HydraHead, DecommitResult } from "../utils/hydraTypes";
export declare class KuberHydraApiProvider extends KuberProvider {
axios: AxiosInstance;
retry?: RetryConfig;
readonly l1Api: KuberApiProvider;
constructor(kuberHydraBaseURL: string, retry?: RetryConfig);
queryUTxOByAddress(address: string): Promise<UTxO[]>;
queryUTxOByTxIn(txIn: string): Promise<UTxO[]>;
queryUtxos(): Promise<UTxO[]>;
queryProtocolParameters(): Promise<CommonProtocolParameters>;
queryHead(): Promise<HydraHead>;
queryHeadState(): Promise<{
state: HydraHeadState;
}>;
initialize(wait?: boolean): Promise<any>;
close(wait?: boolean): Promise<any>;
fanout(wait?: boolean): Promise<any>;
abort(wait?: boolean): Promise<any>;
contest(wait?: boolean): Promise<any>;
commit(utxos: Commit, submit?: boolean): Promise<CommonTxObject>;
queryCommits(): Promise<Record<string, any>[]>;
decommit(tx: HexString, wait?: boolean): Promise<DecommitResult>;
createDecommitTx(txIn: string): Promise<CommonTxObject>;
buildTx(tx: any, submit?: boolean): Promise<CommonTxObject>;
submitTx(cborString: HexString): Promise<CommonTxObject>;
/**
* Waits for the head state to reach a specific state.
*
* @param expectedState - The expected head state (e.g., "Initializing", "Open").
* @param timeoutMs - Timeout in milliseconds.
* @param pollIntervalMs - Polling interval in milliseconds (default: 4000ms).
* @param logPoll - If true, logs the polling status.
* @returns A Promise that resolves with the total time spent waiting in milliseconds if the head state matches, or rejects on timeout.
*/
waitForHeadState(expectedState: HydraHeadState, timeoutMs?: number, logPoll?: boolean, pollIntervalMs?: number): Promise<number>;
/**
* Waits until a condition is met by repeatedly polling the HydraHead.
*
* @param predicate - A function that takes a HydraHead and returns true if the condition is met.
* If the function returns false, the wait continues.
* If the function returns true, the wait ends.
* @param timeoutMs - Timeout in milliseconds (default: 80000ms).
* @param pollIntervalMs - Polling interval in milliseconds (default: 4000ms).
* @returns A Promise that resolves when the predicate returns true, or rejects on timeout.
*/
waitWhile(predicate: (head: HydraHead) => (boolean | Promise<boolean>), timeoutMs?: number, pollIntervalMs?: number): Promise<void>;
}