@daml/hub-react
Version:
Daml React functions for Daml Hub
34 lines (33 loc) • 1.36 kB
TypeScript
export declare enum DomainType {
APP_DOMAIN = 0,
LOCALHOST = 1,
NON_HUB_DOMAIN = 2
}
export declare const detectAppDomainType: () => DomainType;
/**
* Fetch information about the Daml Hub environment that
* the library is running against. Includes hostname,
* baseURL, wsURL, and a ledgerId (if discoverable).
*
* Set 'nonHubDomain' to true if running your app on a hub ledger with a
* ledger not provided by Daml Hub.
*
* Returns undefined if not running on Hub
*/
export declare const damlHubEnvironment: (nonHubDomain?: boolean) => {
hostname: string;
baseURL: string | undefined;
wsURL: string | undefined;
ledgerId: string | undefined;
} | undefined;
/**
* Determine if the app is running on Daml Hub via domain detection. Set 'nonHubDomain' to
* true if running your app on a hub ledger with a ledger not provided by Daml Hub
* @returns boolean
*/
export declare const isRunningOnHub: (nonHubDomain?: boolean) => boolean;
export declare const deleteCookie: (name: string, domain?: string) => void;
export declare const getCookieValue: (name: string) => string | undefined;
export declare const delay: (ms: number) => Promise<unknown>;
export declare const asyncFileReader: (file: File) => Promise<string>;
export declare const usePolling: (fn: () => Promise<void>, interval: number, nonHubDomain?: boolean) => void;