@usherlabs/cex-broker 0.2.11 → 0.2.13

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.
Files changed (46) hide show
  1. package/README.md +206 -14
  2. package/dist/commands/cli.js +9950 -7975
  3. package/dist/handlers/execute-action/context.d.ts +40 -0
  4. package/dist/handlers/execute-action/deposit.d.ts +2 -0
  5. package/dist/handlers/execute-action/handler.d.ts +14 -0
  6. package/dist/handlers/execute-action/index.d.ts +10 -0
  7. package/dist/handlers/execute-action/internal-transfer.d.ts +2 -0
  8. package/dist/handlers/execute-action/order-book-call.d.ts +3 -0
  9. package/dist/handlers/execute-action/orders.d.ts +2 -0
  10. package/dist/handlers/execute-action/pass-through.d.ts +2 -0
  11. package/dist/handlers/execute-action/perp-config.d.ts +2 -0
  12. package/dist/handlers/execute-action/registry.d.ts +5 -0
  13. package/dist/handlers/execute-action/treasury-call.d.ts +2 -0
  14. package/dist/handlers/execute-action/withdraw.d.ts +2 -0
  15. package/dist/handlers/subscribe/handler.d.ts +12 -0
  16. package/dist/handlers/subscribe/index.d.ts +1 -0
  17. package/dist/handlers/types.d.ts +23 -0
  18. package/dist/helpers/auth.d.ts +5 -0
  19. package/dist/helpers/binance-user-data-stream.d.ts +28 -0
  20. package/dist/helpers/broker.d.ts +38 -0
  21. package/dist/helpers/constants.d.ts +7 -2
  22. package/dist/helpers/deposit.d.ts +5 -0
  23. package/dist/helpers/exchange-credentials.d.ts +10 -0
  24. package/dist/helpers/grpc/broker.d.ts +5 -0
  25. package/dist/helpers/grpc/callbacks.d.ts +9 -0
  26. package/dist/helpers/grpc/payload.d.ts +9 -0
  27. package/dist/helpers/grpc/status.d.ts +8 -0
  28. package/dist/helpers/index.d.ts +8 -41
  29. package/dist/helpers/market-type.d.ts +16 -0
  30. package/dist/helpers/order-book.d.ts +79 -0
  31. package/dist/helpers/order-telemetry.d.ts +48 -0
  32. package/dist/helpers/shared/errors.d.ts +2 -0
  33. package/dist/helpers/shared/guards.d.ts +2 -0
  34. package/dist/helpers/transfer-network.d.ts +12 -0
  35. package/dist/helpers/treasury-discovery.d.ts +17 -0
  36. package/dist/helpers/verity.d.ts +5 -0
  37. package/dist/index.js +9738 -7763
  38. package/dist/index.js.map +78 -46
  39. package/dist/proto/node.descriptor.d.ts +127 -0
  40. package/dist/proto/node.descriptor.ts +3 -1
  41. package/dist/proto/node.proto +2 -0
  42. package/dist/proto-loader-options.d.ts +7 -0
  43. package/dist/proto-package-definition.d.ts +2 -0
  44. package/dist/schemas/action-payloads.d.ts +22 -0
  45. package/dist/server.d.ts +1 -1
  46. package/package.json +3 -2
@@ -0,0 +1,127 @@
1
+ declare const descriptor: {
2
+ readonly nested: {
3
+ readonly cex_broker: {
4
+ readonly nested: {
5
+ readonly ActionRequest: {
6
+ readonly fields: {
7
+ readonly action: {
8
+ readonly type: "Action";
9
+ readonly id: 1;
10
+ };
11
+ readonly payload: {
12
+ readonly keyType: "string";
13
+ readonly type: "string";
14
+ readonly id: 2;
15
+ };
16
+ readonly cex: {
17
+ readonly type: "string";
18
+ readonly id: 3;
19
+ };
20
+ readonly symbol: {
21
+ readonly type: "string";
22
+ readonly id: 4;
23
+ };
24
+ };
25
+ };
26
+ readonly ActionResponse: {
27
+ readonly fields: {
28
+ readonly result: {
29
+ readonly type: "string";
30
+ readonly id: 1;
31
+ };
32
+ readonly proof: {
33
+ readonly type: "string";
34
+ readonly id: 2;
35
+ };
36
+ };
37
+ };
38
+ readonly SubscribeRequest: {
39
+ readonly fields: {
40
+ readonly cex: {
41
+ readonly type: "string";
42
+ readonly id: 1;
43
+ };
44
+ readonly symbol: {
45
+ readonly type: "string";
46
+ readonly id: 2;
47
+ };
48
+ readonly type: {
49
+ readonly type: "SubscriptionType";
50
+ readonly id: 3;
51
+ };
52
+ readonly options: {
53
+ readonly keyType: "string";
54
+ readonly type: "string";
55
+ readonly id: 4;
56
+ };
57
+ };
58
+ };
59
+ readonly SubscribeResponse: {
60
+ readonly fields: {
61
+ readonly data: {
62
+ readonly type: "string";
63
+ readonly id: 1;
64
+ };
65
+ readonly timestamp: {
66
+ readonly type: "int64";
67
+ readonly id: 2;
68
+ };
69
+ readonly symbol: {
70
+ readonly type: "string";
71
+ readonly id: 3;
72
+ };
73
+ readonly type: {
74
+ readonly type: "SubscriptionType";
75
+ readonly id: 4;
76
+ };
77
+ };
78
+ };
79
+ readonly SubscriptionType: {
80
+ readonly values: {
81
+ readonly NO_ACTION: 0;
82
+ readonly ORDERBOOK: 1;
83
+ readonly TRADES: 2;
84
+ readonly TICKER: 3;
85
+ readonly OHLCV: 4;
86
+ readonly BALANCE: 5;
87
+ readonly ORDERS: 6;
88
+ };
89
+ };
90
+ readonly cex_service: {
91
+ readonly methods: {
92
+ readonly ExecuteAction: {
93
+ readonly requestType: "ActionRequest";
94
+ readonly responseType: "ActionResponse";
95
+ };
96
+ readonly Subscribe: {
97
+ readonly requestType: "SubscribeRequest";
98
+ readonly responseType: "SubscribeResponse";
99
+ readonly responseStream: true;
100
+ };
101
+ };
102
+ };
103
+ readonly Action: {
104
+ readonly values: {
105
+ readonly NoAction: 0;
106
+ readonly Deposit: 1;
107
+ readonly Withdraw: 2;
108
+ readonly CreateOrder: 3;
109
+ readonly GetOrderDetails: 4;
110
+ readonly CancelOrder: 5;
111
+ readonly FetchBalances: 6;
112
+ readonly FetchDepositAddresses: 7;
113
+ readonly FetchTicker: 8;
114
+ readonly FetchCurrency: 9;
115
+ readonly Call: 10;
116
+ readonly FetchAccountId: 11;
117
+ readonly FetchFees: 12;
118
+ readonly InternalTransfer: 13;
119
+ readonly GetPerpConfigState: 14;
120
+ readonly SetPerpConfigState: 15;
121
+ };
122
+ };
123
+ };
124
+ };
125
+ };
126
+ };
127
+ export default descriptor;
@@ -116,7 +116,9 @@ const descriptor = {
116
116
  "Call": 10,
117
117
  "FetchAccountId": 11,
118
118
  "FetchFees": 12,
119
- "InternalTransfer": 13
119
+ "InternalTransfer": 13,
120
+ "GetPerpConfigState": 14,
121
+ "SetPerpConfigState": 15
120
122
  }
121
123
  }
122
124
  }
@@ -58,4 +58,6 @@ enum Action {
58
58
  FetchAccountId=11;
59
59
  FetchFees= 12;
60
60
  InternalTransfer= 13;
61
+ GetPerpConfigState = 14;
62
+ SetPerpConfigState = 15;
61
63
  }
@@ -0,0 +1,7 @@
1
+ export declare const PROTO_LOADER_OPTIONS: {
2
+ keepCase: true;
3
+ longs: StringConstructor;
4
+ enums: StringConstructor;
5
+ defaults: true;
6
+ oneofs: true;
7
+ };
@@ -0,0 +1,2 @@
1
+ import * as protoLoader from "@grpc/proto-loader";
2
+ export declare const CEX_BROKER_PACKAGE_DEFINITION: protoLoader.PackageDefinition;
@@ -35,8 +35,28 @@ export declare const CreateOrderPayloadSchema: z.ZodObject<{
35
35
  fromToken: z.ZodString;
36
36
  toToken: z.ZodString;
37
37
  price: z.ZodCoercedNumber<unknown>;
38
+ marketType: z.ZodOptional<z.ZodEnum<{
39
+ spot: "spot";
40
+ swap: "swap";
41
+ future: "future";
42
+ perp: "perp";
43
+ futures: "futures";
44
+ }>>;
38
45
  params: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>;
39
46
  }, z.core.$strip>;
47
+ export declare const GetPerpConfigStatePayloadSchema: z.ZodObject<{
48
+ symbol: z.ZodOptional<z.ZodString>;
49
+ params: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
50
+ }, z.core.$strip>;
51
+ export declare const SetPerpConfigStatePayloadSchema: z.ZodObject<{
52
+ symbol: z.ZodString;
53
+ leverage: z.ZodCoercedNumber<unknown>;
54
+ marginMode: z.ZodOptional<z.ZodEnum<{
55
+ cross: "cross";
56
+ isolated: "isolated";
57
+ }>>;
58
+ params: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
59
+ }, z.core.$strip>;
40
60
  export declare const GetOrderDetailsPayloadSchema: z.ZodObject<{
41
61
  orderId: z.ZodString;
42
62
  params: z.ZodDefault<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>>;
@@ -55,6 +75,8 @@ export type FetchDepositAddressesPayload = z.infer<typeof FetchDepositAddressesP
55
75
  export type WithdrawPayload = z.infer<typeof WithdrawPayloadSchema>;
56
76
  export type InternalTransferPayload = z.infer<typeof InternalTransferPayloadSchema>;
57
77
  export type CreateOrderPayload = z.infer<typeof CreateOrderPayloadSchema>;
78
+ export type GetPerpConfigStatePayload = z.infer<typeof GetPerpConfigStatePayloadSchema>;
79
+ export type SetPerpConfigStatePayload = z.infer<typeof SetPerpConfigStatePayloadSchema>;
58
80
  export type GetOrderDetailsPayload = z.infer<typeof GetOrderDetailsPayloadSchema>;
59
81
  export type CancelOrderPayload = z.infer<typeof CancelOrderPayloadSchema>;
60
82
  export type FetchFeesPayload = z.infer<typeof FetchFeesPayloadSchema>;
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as grpc from "@grpc/grpc-js";
2
- import { type BrokerPoolEntry } from "./helpers";
2
+ import type { BrokerPoolEntry } from "./helpers";
3
3
  import type { OtelMetrics } from "./helpers/otel";
4
4
  import type { PolicyConfig } from "./types";
5
5
  export declare function getServer(policy: PolicyConfig, brokers: Record<string, BrokerPoolEntry>, whitelistIps: string[], useVerity: boolean, verityProverUrl: string, otelMetrics?: OtelMetrics): grpc.Server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usherlabs/cex-broker",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "Unified gRPC API to CEXs by Usher Labs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "main": "dist/index.js",
15
15
  "types": "dist/index.d.ts",
16
16
  "devDependencies": {
17
- "@biomejs/biome": "2.0.6",
17
+ "@biomejs/biome": "^2.4.16",
18
18
  "@types/bun": "latest",
19
19
  "bun-plugin-dts": "latest",
20
20
  "bun-types": "latest",
@@ -43,6 +43,7 @@
43
43
  "lint:fix": "bunx biome lint --write",
44
44
  "check": "bunx biome check",
45
45
  "check:fix": "bunx biome check --write",
46
+ "check:server-lines": "bash scripts/check-server-line-budget.sh",
46
47
  "copy:dts": "cpx \"build/**/*.d.ts\" ./dist/",
47
48
  "copy:proto": "cpx \"src/proto/*.proto\" ./dist/proto",
48
49
  "prepare": "bunx husky"