UNPKG

@drift-labs/common

Version:

Common functions for Drift

27 lines (26 loc) 1.1 kB
import { DriftEnv } from '@drift-labs/sdk'; import { Opaque } from './utility'; export type UIEnvKey = Opaque<'UIEnvKey', string>; /** * Utility class to handle environment configs in the Drift UI. Note that these environments don't exactly align with the SDK environment (SDK can only be mainnet or devnet, but UI can be devnet, staging, mainnet) so there is a `sdkEnv` getter utility to convert the UI env to SDK env (UI staging => SDK mainnet). */ export declare class UIEnv { readonly env: DriftEnv | 'staging'; constructor(env: DriftEnv | 'staging'); static createMainnet(): UIEnv; static createDevnet(): UIEnv; static createStaging(): UIEnv; static getUIEnvIdFromKey(key: UIEnvKey): UIEnv; get isMainnet(): boolean; get isDevnet(): boolean; get isStaging(): boolean; /** * Returns the SDK environment type. Note that 'staging' maps to 'mainnet-beta' for SDK purposes. */ get sdkEnv(): DriftEnv; /** * Returns a unique string that can be used as a key in a map. */ get key(): UIEnvKey; equals(other: UIEnv): boolean; }