UNPKG

@nktkas/hyperliquid

Version:

Hyperliquid API SDK for all major JS runtimes, written in TypeScript.

14 lines (13 loc) 542 B
/** * Per-key semaphore registry for serializing async operations. * @module */ /// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/api/exchange/_methods/_base/_semaphore.ts" /> /** * Acquires a lock for the given key, executes the provided async function, and releases the lock. * * @param key The key to lock on. * @param fn The async function to execute while holding the lock. * @return The result of the async function. */ export declare function withLock<K, T>(key: K, fn: () => Promise<T>): Promise<T>;