@usherlabs/cex-broker 0.1.20 → 0.2.0

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.
@@ -114,7 +114,8 @@ const descriptor = {
114
114
  "FetchTicker": 8,
115
115
  "FetchCurrency": 9,
116
116
  "Call": 10,
117
- "FetchAccountId": 11
117
+ "FetchAccountId": 11,
118
+ "FetchFees": 12
118
119
  }
119
120
  }
120
121
  }
@@ -56,4 +56,5 @@ enum Action {
56
56
  FetchCurrency=9;
57
57
  Call=10;
58
58
  FetchAccountId=11;
59
+ FetchFees= 12;
59
60
  }
package/dist/server.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { PolicyConfig } from "./types";
2
2
  import * as grpc from "@grpc/grpc-js";
3
3
  import type { Exchange } from "@usherlabs/ccxt";
4
+ import type { OtelMetrics } from "./helpers/otel";
4
5
  export declare function getServer(policy: PolicyConfig, brokers: Record<string, {
5
6
  primary: Exchange;
6
7
  secondaryBrokers: Exchange[];
7
- }>, whitelistIps: string[], useVerity: boolean, verityProverUrl: string): grpc.Server;
8
+ }>, whitelistIps: string[], useVerity: boolean, verityProverUrl: string, otelMetrics?: OtelMetrics): grpc.Server;
package/dist/types.d.ts CHANGED
@@ -1,16 +1,12 @@
1
1
  import type ccxt from "@usherlabs/ccxt";
2
- export type WithdrawRule = {
3
- networks: string[];
2
+ export type WithdrawRuleEntry = {
3
+ exchange: string;
4
+ network: string;
4
5
  whitelist: string[];
5
- amounts: {
6
- ticker: string;
7
- max: number;
8
- min: number;
9
- }[];
10
6
  };
11
7
  export type OrderRule = {
12
8
  markets: string[];
13
- limits: Array<{
9
+ limits?: Array<{
14
10
  from: string;
15
11
  to: string;
16
12
  min: number;
@@ -19,29 +15,13 @@ export type OrderRule = {
19
15
  };
20
16
  export type PolicyConfig = {
21
17
  withdraw: {
22
- rule: WithdrawRule;
18
+ rule: WithdrawRuleEntry[];
23
19
  };
24
20
  deposit: Record<string, null>;
25
21
  order: {
26
22
  rule: OrderRule;
27
23
  };
28
24
  };
29
- export type Policy = {
30
- isActive: boolean;
31
- permissions: Array<"withdraw" | "transfer" | "convert">;
32
- limits: {
33
- dailyWithdrawLimit?: number;
34
- dailyTransferredAmount?: number;
35
- perTxTransferLimit?: number;
36
- };
37
- networks: string[];
38
- conversionLimits: Array<{
39
- from: string;
40
- to: string;
41
- min: number;
42
- max: number;
43
- }>;
44
- };
45
25
  type BrokerInstanceMap = {
46
26
  [K in ISupportedBroker]: InstanceType<(typeof ccxt)[K]>;
47
27
  };
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@usherlabs/cex-broker",
3
- "version": "0.1.20",
3
+ "version": "0.2.0",
4
4
  "description": "Unified gRPC API to CEXs by Usher Labs.",
5
- "repository": "git@gitlab.com:usherlabs/cex-broker.git",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/usherlabs/cex-broker"
8
+ },
6
9
  "homepage": "https://usher.so/",
7
10
  "author": "Oki Ayobami <oki@usher.so>",
8
11
  "module": "src/index.ts",
@@ -31,7 +34,7 @@
31
34
  "build": "bun run proto-gen && bun run ./build.ts && bun run build:ts && bun run copy:dts && bun run copy:proto",
32
35
  "start-broker": "bun run ./src/cli.ts",
33
36
  "start-broker-server": "bunx nodemon --watch src --watch policy --ext ts,js,json --exec 'bun run start-broker --policy policy/policy.json --port 8086 --whitelistAll'",
34
- "start-broker-server-with-verity": "bunx nodemon --watch src --watch policy --ext ts,js,json --exec 'bun run start-broker --policy policy/policy.json --port 8086 --whitelistAll --verityProverUrl http://localhost:8080'",
37
+ "start-broker-server-with-verity": "bunx nodemon --watch src --watch policy --ext ts,js,json --exec 'bun run start-broker --policy policy/policy.json --port 8086 --whitelistAll --verityProverUrl http://verity-prover:8080'",
35
38
  "build:ts": "bunx tsc",
36
39
  "test": "bun test",
37
40
  "format": "bunx biome format --write",
@@ -50,11 +53,23 @@
50
53
  "dependencies": {
51
54
  "@grpc/grpc-js": "^1.13.4",
52
55
  "@grpc/proto-loader": "^0.7.15",
56
+ "@loglayer/plugin-opentelemetry": "^3.0.2",
57
+ "@loglayer/transport-opentelemetry": "^4.0.2",
58
+ "@loglayer/transport-tslog": "^4.0.2",
59
+ "@opentelemetry/api": "^1.9.0",
60
+ "@opentelemetry/api-logs": "^0.212.0",
61
+ "@opentelemetry/exporter-logs-otlp-http": "^0.212.0",
62
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.212.0",
63
+ "@opentelemetry/resources": "^2.5.1",
64
+ "@opentelemetry/sdk-logs": "^0.212.0",
65
+ "@opentelemetry/sdk-metrics": "^2.5.1",
53
66
  "@usherlabs/ccxt": "^0.0.14",
54
67
  "@usherlabs/verity-client": "^0.1.1",
55
68
  "commander": "^14.0.0",
56
69
  "joi": "^17.13.3",
70
+ "loglayer": "^9.1.0",
57
71
  "protobufjs": "^7.4.0",
72
+ "serialize-error": "^13.0.1",
58
73
  "tslog": "^4.9.3"
59
74
  },
60
75
  "publishConfig": {