@nktkas/hyperliquid
Version:
Hyperliquid API SDK for all major JS runtimes, written in TypeScript.
25 lines • 821 B
JavaScript
/**
* Nonce manager for generating unique nonces per wallet address and network.
* Uses lazy cleanup: removes entries when Date.now() > lastNonce.
*/
class NonceManager {
getNonce(key) {
const now = Date.now();
this.
const lastNonce = this.
const nonce = now > lastNonce ? now : lastNonce + 1;
this.
return nonce;
}
for (const [key, lastNonce] of this.
if (now > lastNonce) {
this.
}
}
}
}
/** Default nonce manager, used when custom nonceManager is not provided in config. */
export const defaultNonceManager = /* @__PURE__ */ new NonceManager();
//# sourceMappingURL=_nonce.js.map