@usherlabs/cex-broker 0.2.12 → 0.2.14

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 (44) hide show
  1. package/README.md +206 -14
  2. package/dist/commands/cli.js +10115 -8160
  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 +46 -0
  20. package/dist/helpers/broker.d.ts +38 -0
  21. package/dist/helpers/constants.d.ts +2 -0
  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 +9867 -7911
  38. package/dist/index.js.map +78 -49
  39. package/dist/proto/node.descriptor.d.ts +2 -0
  40. package/dist/proto/node.descriptor.ts +3 -1
  41. package/dist/proto/node.proto +2 -0
  42. package/dist/schemas/action-payloads.d.ts +22 -0
  43. package/dist/server.d.ts +1 -1
  44. package/package.json +5 -2
@@ -116,6 +116,8 @@ declare const descriptor: {
116
116
  readonly FetchAccountId: 11;
117
117
  readonly FetchFees: 12;
118
118
  readonly InternalTransfer: 13;
119
+ readonly GetPerpConfigState: 14;
120
+ readonly SetPerpConfigState: 15;
119
121
  };
120
122
  };
121
123
  };
@@ -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
  }
@@ -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.12",
3
+ "version": "0.2.14",
4
4
  "description": "Unified gRPC API to CEXs by Usher Labs.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,8 +14,9 @@
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
+ "@types/ws": "^8.18.1",
19
20
  "bun-plugin-dts": "latest",
20
21
  "bun-types": "latest",
21
22
  "cpx": "^1.5.0",
@@ -43,6 +44,7 @@
43
44
  "lint:fix": "bunx biome lint --write",
44
45
  "check": "bunx biome check",
45
46
  "check:fix": "bunx biome check --write",
47
+ "check:server-lines": "bash scripts/check-server-line-budget.sh",
46
48
  "copy:dts": "cpx \"build/**/*.d.ts\" ./dist/",
47
49
  "copy:proto": "cpx \"src/proto/*.proto\" ./dist/proto",
48
50
  "prepare": "bunx husky"
@@ -71,6 +73,7 @@
71
73
  "protobufjs": "^7.4.0",
72
74
  "serialize-error": "^13.0.1",
73
75
  "tslog": "^4.9.3",
76
+ "ws": "8.18.3",
74
77
  "zod": "^4.3.6"
75
78
  },
76
79
  "publishConfig": {