@usherlabs/cex-broker 0.2.0 → 0.2.1

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,17 @@
1
+ export declare const Action: {
2
+ readonly NoAction: 0;
3
+ readonly Deposit: 1;
4
+ readonly Withdraw: 2;
5
+ readonly CreateOrder: 3;
6
+ readonly GetOrderDetails: 4;
7
+ readonly CancelOrder: 5;
8
+ readonly FetchBalances: 6;
9
+ readonly FetchDepositAddresses: 7;
10
+ readonly FetchTicker: 8;
11
+ readonly FetchCurrency: 9;
12
+ readonly Call: 10;
13
+ readonly FetchAccountId: 11;
14
+ readonly FetchFees: 12;
15
+ };
16
+ export type Action = 'NoAction' | 0 | 'Deposit' | 1 | 'Withdraw' | 2 | 'CreateOrder' | 3 | 'GetOrderDetails' | 4 | 'CancelOrder' | 5 | 'FetchBalances' | 6 | 'FetchDepositAddresses' | 7 | 'FetchTicker' | 8 | 'FetchCurrency' | 9 | 'Call' | 10 | 'FetchAccountId' | 11 | 'FetchFees' | 12;
17
+ export type Action__Output = typeof Action[keyof typeof Action];
@@ -0,0 +1,17 @@
1
+ import type { Action as _cex_broker_Action, Action__Output as _cex_broker_Action__Output } from '../cex_broker/Action';
2
+ export interface ActionRequest {
3
+ 'action'?: (_cex_broker_Action);
4
+ 'payload'?: ({
5
+ [key: string]: string;
6
+ });
7
+ 'cex'?: (string);
8
+ 'symbol'?: (string);
9
+ }
10
+ export interface ActionRequest__Output {
11
+ 'action'?: (_cex_broker_Action__Output);
12
+ 'payload'?: ({
13
+ [key: string]: string;
14
+ });
15
+ 'cex'?: (string);
16
+ 'symbol'?: (string);
17
+ }
@@ -0,0 +1,8 @@
1
+ export interface ActionResponse {
2
+ 'result'?: (string);
3
+ 'proof'?: (string);
4
+ }
5
+ export interface ActionResponse__Output {
6
+ 'result'?: (string);
7
+ 'proof'?: (string);
8
+ }
@@ -0,0 +1,17 @@
1
+ import type { SubscriptionType as _cex_broker_SubscriptionType, SubscriptionType__Output as _cex_broker_SubscriptionType__Output } from '../cex_broker/SubscriptionType';
2
+ export interface SubscribeRequest {
3
+ 'cex'?: (string);
4
+ 'symbol'?: (string);
5
+ 'type'?: (_cex_broker_SubscriptionType);
6
+ 'options'?: ({
7
+ [key: string]: string;
8
+ });
9
+ }
10
+ export interface SubscribeRequest__Output {
11
+ 'cex'?: (string);
12
+ 'symbol'?: (string);
13
+ 'type'?: (_cex_broker_SubscriptionType__Output);
14
+ 'options'?: ({
15
+ [key: string]: string;
16
+ });
17
+ }
@@ -0,0 +1,14 @@
1
+ import type { SubscriptionType as _cex_broker_SubscriptionType, SubscriptionType__Output as _cex_broker_SubscriptionType__Output } from '../cex_broker/SubscriptionType';
2
+ import type { Long } from '@grpc/proto-loader';
3
+ export interface SubscribeResponse {
4
+ 'data'?: (string);
5
+ 'timestamp'?: (number | string | Long);
6
+ 'symbol'?: (string);
7
+ 'type'?: (_cex_broker_SubscriptionType);
8
+ }
9
+ export interface SubscribeResponse__Output {
10
+ 'data'?: (string);
11
+ 'timestamp'?: (Long);
12
+ 'symbol'?: (string);
13
+ 'type'?: (_cex_broker_SubscriptionType__Output);
14
+ }
@@ -0,0 +1,11 @@
1
+ export declare const SubscriptionType: {
2
+ readonly NO_ACTION: 0;
3
+ readonly ORDERBOOK: 1;
4
+ readonly TRADES: 2;
5
+ readonly TICKER: 3;
6
+ readonly OHLCV: 4;
7
+ readonly BALANCE: 5;
8
+ readonly ORDERS: 6;
9
+ };
10
+ export type SubscriptionType = 'NO_ACTION' | 0 | 'ORDERBOOK' | 1 | 'TRADES' | 2 | 'TICKER' | 3 | 'OHLCV' | 4 | 'BALANCE' | 5 | 'ORDERS' | 6;
11
+ export type SubscriptionType__Output = typeof SubscriptionType[keyof typeof SubscriptionType];
@@ -0,0 +1,28 @@
1
+ import type * as grpc from '@grpc/grpc-js';
2
+ import type { MethodDefinition } from '@grpc/proto-loader';
3
+ import type { ActionRequest as _cex_broker_ActionRequest, ActionRequest__Output as _cex_broker_ActionRequest__Output } from '../cex_broker/ActionRequest';
4
+ import type { ActionResponse as _cex_broker_ActionResponse, ActionResponse__Output as _cex_broker_ActionResponse__Output } from '../cex_broker/ActionResponse';
5
+ import type { SubscribeRequest as _cex_broker_SubscribeRequest, SubscribeRequest__Output as _cex_broker_SubscribeRequest__Output } from '../cex_broker/SubscribeRequest';
6
+ import type { SubscribeResponse as _cex_broker_SubscribeResponse, SubscribeResponse__Output as _cex_broker_SubscribeResponse__Output } from '../cex_broker/SubscribeResponse';
7
+ export interface cex_serviceClient extends grpc.Client {
8
+ ExecuteAction(argument: _cex_broker_ActionRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
9
+ ExecuteAction(argument: _cex_broker_ActionRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
10
+ ExecuteAction(argument: _cex_broker_ActionRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
11
+ ExecuteAction(argument: _cex_broker_ActionRequest, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
12
+ executeAction(argument: _cex_broker_ActionRequest, metadata: grpc.Metadata, options: grpc.CallOptions, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
13
+ executeAction(argument: _cex_broker_ActionRequest, metadata: grpc.Metadata, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
14
+ executeAction(argument: _cex_broker_ActionRequest, options: grpc.CallOptions, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
15
+ executeAction(argument: _cex_broker_ActionRequest, callback: grpc.requestCallback<_cex_broker_ActionResponse__Output>): grpc.ClientUnaryCall;
16
+ Subscribe(argument: _cex_broker_SubscribeRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_cex_broker_SubscribeResponse__Output>;
17
+ Subscribe(argument: _cex_broker_SubscribeRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_cex_broker_SubscribeResponse__Output>;
18
+ subscribe(argument: _cex_broker_SubscribeRequest, metadata: grpc.Metadata, options?: grpc.CallOptions): grpc.ClientReadableStream<_cex_broker_SubscribeResponse__Output>;
19
+ subscribe(argument: _cex_broker_SubscribeRequest, options?: grpc.CallOptions): grpc.ClientReadableStream<_cex_broker_SubscribeResponse__Output>;
20
+ }
21
+ export interface cex_serviceHandlers extends grpc.UntypedServiceImplementation {
22
+ ExecuteAction: grpc.handleUnaryCall<_cex_broker_ActionRequest__Output, _cex_broker_ActionResponse>;
23
+ Subscribe: grpc.handleServerStreamingCall<_cex_broker_SubscribeRequest__Output, _cex_broker_SubscribeResponse>;
24
+ }
25
+ export interface cex_serviceDefinition extends grpc.ServiceDefinition {
26
+ ExecuteAction: MethodDefinition<_cex_broker_ActionRequest, _cex_broker_ActionResponse, _cex_broker_ActionRequest__Output, _cex_broker_ActionResponse__Output>;
27
+ Subscribe: MethodDefinition<_cex_broker_SubscribeRequest, _cex_broker_SubscribeResponse, _cex_broker_SubscribeRequest__Output, _cex_broker_SubscribeResponse__Output>;
28
+ }
@@ -0,0 +1,20 @@
1
+ import type * as grpc from '@grpc/grpc-js';
2
+ import type { EnumTypeDefinition, MessageTypeDefinition } from '@grpc/proto-loader';
3
+ import type { cex_serviceClient as _cex_broker_cex_serviceClient, cex_serviceDefinition as _cex_broker_cex_serviceDefinition } from './cex_broker/cex_service';
4
+ type SubtypeConstructor<Constructor extends new (...args: any) => any, Subtype> = {
5
+ new (...args: ConstructorParameters<Constructor>): Subtype;
6
+ };
7
+ export interface ProtoGrpcType {
8
+ cex_broker: {
9
+ Action: EnumTypeDefinition;
10
+ ActionRequest: MessageTypeDefinition;
11
+ ActionResponse: MessageTypeDefinition;
12
+ SubscribeRequest: MessageTypeDefinition;
13
+ SubscribeResponse: MessageTypeDefinition;
14
+ SubscriptionType: EnumTypeDefinition;
15
+ cex_service: SubtypeConstructor<typeof grpc.Client, _cex_broker_cex_serviceClient> & {
16
+ service: _cex_broker_cex_serviceDefinition;
17
+ };
18
+ };
19
+ }
20
+ export {};
@@ -0,0 +1,124 @@
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
+ };
119
+ };
120
+ };
121
+ };
122
+ };
123
+ };
124
+ export default descriptor;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@usherlabs/cex-broker",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Unified gRPC API to CEXs by Usher Labs.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/usherlabs/cex-broker"
8
8
  },
9
9
  "homepage": "https://usher.so/",
10
- "author": "Oki Ayobami <oki@usher.so>",
11
- "module": "src/index.ts",
10
+ "author": "Usher Labs <labs@usher.so>",
11
+ "module": "dist/index.js",
12
12
  "type": "module",
13
13
  "license": "MIT",
14
14
  "main": "dist/index.js",
@@ -32,6 +32,7 @@
32
32
  "proto-gen": "./proto-gen.sh",
33
33
  "start": "bun run ./src/index.ts",
34
34
  "build": "bun run proto-gen && bun run ./build.ts && bun run build:ts && bun run copy:dts && bun run copy:proto",
35
+ "prepack": "bun run build",
35
36
  "start-broker": "bun run ./src/cli.ts",
36
37
  "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'",
37
38
  "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'",
@@ -42,10 +43,9 @@
42
43
  "lint:fix": "bunx biome lint --write",
43
44
  "check": "bunx biome check",
44
45
  "check:fix": "bunx biome check --write",
45
- "copy:dts": "cpx \"build/*.d.ts\" ./dist/",
46
+ "copy:dts": "cpx \"build/**/*.d.ts\" ./dist/",
46
47
  "copy:proto": "cpx \"src/proto/*.proto\" ./dist/proto",
47
- "prepare": "bunx husky",
48
- "postinstall": "./proto-gen.sh"
48
+ "prepare": "bunx husky"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "typescript": "^5"