@usherlabs/cex-broker 0.0.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ import { type ExchangeCredentials, type PolicyConfig } from "./types";
2
+ export default class CEXBroker {
3
+ #private;
4
+ port: number;
5
+ private policy;
6
+ private brokers;
7
+ private whitelistIps;
8
+ private server;
9
+ private useVerity;
10
+ /**
11
+ * Loads environment variables prefixed with CEX_BROKER_
12
+ * Expected format:
13
+ * CEX_BROKER_<BROKER_NAME>_API_KEY
14
+ * CEX_BROKER_<BROKER_NAME>_API_SECRET
15
+ */
16
+ loadEnvConfig(): void;
17
+ /**
18
+ * Validates an exchange credential object structure.
19
+ */
20
+ loadExchangeCredentials(creds: unknown): asserts creds is ExchangeCredentials;
21
+ constructor(apiCredentials: ExchangeCredentials, policies: string | PolicyConfig, config?: {
22
+ port?: number;
23
+ whitelistIps?: string[];
24
+ useVerity?: boolean;
25
+ verityProverUrl?: string;
26
+ });
27
+ /**
28
+ * Watches the policy JSON file for changes, reloads policies, and reruns broker.
29
+ * @param filePath
30
+ */
31
+ private watchPolicyFile;
32
+ /**
33
+ * Stops Server and Stop watching the policy file, if applicable.
34
+ */
35
+ stop(): void;
36
+ /**
37
+ * Starts the broker, applying policies then running appropriate tasks.
38
+ */
39
+ run(): Promise<CEXBroker>;
40
+ }