@usherlabs/cex-broker 0.2.10 → 0.2.11
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.
- package/dist/commands/cli.js +63 -177
- package/dist/helpers/constants.d.ts +30 -0
- package/dist/index.js +64 -178
- package/dist/index.js.map +5 -8
- package/package.json +1 -1
- package/dist/proto/cex_broker/Action.d.ts +0 -18
- package/dist/proto/cex_broker/ActionRequest.d.ts +0 -17
- package/dist/proto/cex_broker/ActionResponse.d.ts +0 -8
- package/dist/proto/cex_broker/SubscribeRequest.d.ts +0 -17
- package/dist/proto/cex_broker/SubscribeResponse.d.ts +0 -14
- package/dist/proto/cex_broker/SubscriptionType.d.ts +0 -11
- package/dist/proto/cex_broker/cex_service.d.ts +0 -28
- package/dist/proto/node.d.ts +0 -20
- package/dist/proto/node.descriptor.d.ts +0 -125
package/dist/commands/cli.js
CHANGED
|
@@ -310995,6 +310995,45 @@ var CCXT_METHODS_WITH_VERITY = [
|
|
|
310995
310995
|
"fetchWithdrawal",
|
|
310996
310996
|
"fetchAccountId"
|
|
310997
310997
|
];
|
|
310998
|
+
var Action = {
|
|
310999
|
+
NoAction: 0,
|
|
311000
|
+
Deposit: 1,
|
|
311001
|
+
Withdraw: 2,
|
|
311002
|
+
CreateOrder: 3,
|
|
311003
|
+
GetOrderDetails: 4,
|
|
311004
|
+
CancelOrder: 5,
|
|
311005
|
+
FetchBalances: 6,
|
|
311006
|
+
FetchDepositAddresses: 7,
|
|
311007
|
+
FetchTicker: 8,
|
|
311008
|
+
FetchCurrency: 9,
|
|
311009
|
+
Call: 10,
|
|
311010
|
+
FetchAccountId: 11,
|
|
311011
|
+
FetchFees: 12,
|
|
311012
|
+
InternalTransfer: 13
|
|
311013
|
+
};
|
|
311014
|
+
var SubscriptionType = {
|
|
311015
|
+
NO_ACTION: 0,
|
|
311016
|
+
ORDERBOOK: 1,
|
|
311017
|
+
TRADES: 2,
|
|
311018
|
+
TICKER: 3,
|
|
311019
|
+
OHLCV: 4,
|
|
311020
|
+
BALANCE: 5,
|
|
311021
|
+
ORDERS: 6
|
|
311022
|
+
};
|
|
311023
|
+
function createEnumNameMap(enumValues) {
|
|
311024
|
+
return Object.fromEntries(Object.entries(enumValues).map(([name, value]) => [value, name]));
|
|
311025
|
+
}
|
|
311026
|
+
var actionNames = createEnumNameMap(Action);
|
|
311027
|
+
var subscriptionTypeNames = createEnumNameMap(SubscriptionType);
|
|
311028
|
+
function getActionName(action) {
|
|
311029
|
+
return typeof action === "number" ? actionNames[action] ?? `unknown_${action}` : `unknown_${action ?? "undefined"}`;
|
|
311030
|
+
}
|
|
311031
|
+
function getSubscriptionTypeName(subscriptionType) {
|
|
311032
|
+
return subscriptionTypeNames[subscriptionType] ?? `unknown_${subscriptionType}`;
|
|
311033
|
+
}
|
|
311034
|
+
function resolveSubscriptionType(type2) {
|
|
311035
|
+
return type2 === undefined || type2 === SubscriptionType.NO_ACTION ? SubscriptionType.ORDERBOOK : type2;
|
|
311036
|
+
}
|
|
310998
311037
|
|
|
310999
311038
|
// node_modules/@loglayer/plugin-opentelemetry/dist/index.mjs
|
|
311000
311039
|
var import_api = __toESM(require_src5(), 1);
|
|
@@ -314339,162 +314378,8 @@ function createOtelLogsFromEnv() {
|
|
|
314339
314378
|
// src/server.ts
|
|
314340
314379
|
var grpc = __toESM(require_src3(), 1);
|
|
314341
314380
|
var protoLoader = __toESM(require_src2(), 1);
|
|
314342
|
-
|
|
314343
|
-
|
|
314344
|
-
var Action = {
|
|
314345
|
-
NoAction: 0,
|
|
314346
|
-
Deposit: 1,
|
|
314347
|
-
Withdraw: 2,
|
|
314348
|
-
CreateOrder: 3,
|
|
314349
|
-
GetOrderDetails: 4,
|
|
314350
|
-
CancelOrder: 5,
|
|
314351
|
-
FetchBalances: 6,
|
|
314352
|
-
FetchDepositAddresses: 7,
|
|
314353
|
-
FetchTicker: 8,
|
|
314354
|
-
FetchCurrency: 9,
|
|
314355
|
-
Call: 10,
|
|
314356
|
-
FetchAccountId: 11,
|
|
314357
|
-
FetchFees: 12,
|
|
314358
|
-
InternalTransfer: 13
|
|
314359
|
-
};
|
|
314360
|
-
|
|
314361
|
-
// src/proto/cex_broker/SubscriptionType.ts
|
|
314362
|
-
var SubscriptionType = {
|
|
314363
|
-
NO_ACTION: 0,
|
|
314364
|
-
ORDERBOOK: 1,
|
|
314365
|
-
TRADES: 2,
|
|
314366
|
-
TICKER: 3,
|
|
314367
|
-
OHLCV: 4,
|
|
314368
|
-
BALANCE: 5,
|
|
314369
|
-
ORDERS: 6
|
|
314370
|
-
};
|
|
314371
|
-
|
|
314372
|
-
// src/proto/node.descriptor.ts
|
|
314373
|
-
var descriptor = {
|
|
314374
|
-
nested: {
|
|
314375
|
-
cex_broker: {
|
|
314376
|
-
nested: {
|
|
314377
|
-
ActionRequest: {
|
|
314378
|
-
fields: {
|
|
314379
|
-
action: {
|
|
314380
|
-
type: "Action",
|
|
314381
|
-
id: 1
|
|
314382
|
-
},
|
|
314383
|
-
payload: {
|
|
314384
|
-
keyType: "string",
|
|
314385
|
-
type: "string",
|
|
314386
|
-
id: 2
|
|
314387
|
-
},
|
|
314388
|
-
cex: {
|
|
314389
|
-
type: "string",
|
|
314390
|
-
id: 3
|
|
314391
|
-
},
|
|
314392
|
-
symbol: {
|
|
314393
|
-
type: "string",
|
|
314394
|
-
id: 4
|
|
314395
|
-
}
|
|
314396
|
-
}
|
|
314397
|
-
},
|
|
314398
|
-
ActionResponse: {
|
|
314399
|
-
fields: {
|
|
314400
|
-
result: {
|
|
314401
|
-
type: "string",
|
|
314402
|
-
id: 1
|
|
314403
|
-
},
|
|
314404
|
-
proof: {
|
|
314405
|
-
type: "string",
|
|
314406
|
-
id: 2
|
|
314407
|
-
}
|
|
314408
|
-
}
|
|
314409
|
-
},
|
|
314410
|
-
SubscribeRequest: {
|
|
314411
|
-
fields: {
|
|
314412
|
-
cex: {
|
|
314413
|
-
type: "string",
|
|
314414
|
-
id: 1
|
|
314415
|
-
},
|
|
314416
|
-
symbol: {
|
|
314417
|
-
type: "string",
|
|
314418
|
-
id: 2
|
|
314419
|
-
},
|
|
314420
|
-
type: {
|
|
314421
|
-
type: "SubscriptionType",
|
|
314422
|
-
id: 3
|
|
314423
|
-
},
|
|
314424
|
-
options: {
|
|
314425
|
-
keyType: "string",
|
|
314426
|
-
type: "string",
|
|
314427
|
-
id: 4
|
|
314428
|
-
}
|
|
314429
|
-
}
|
|
314430
|
-
},
|
|
314431
|
-
SubscribeResponse: {
|
|
314432
|
-
fields: {
|
|
314433
|
-
data: {
|
|
314434
|
-
type: "string",
|
|
314435
|
-
id: 1
|
|
314436
|
-
},
|
|
314437
|
-
timestamp: {
|
|
314438
|
-
type: "int64",
|
|
314439
|
-
id: 2
|
|
314440
|
-
},
|
|
314441
|
-
symbol: {
|
|
314442
|
-
type: "string",
|
|
314443
|
-
id: 3
|
|
314444
|
-
},
|
|
314445
|
-
type: {
|
|
314446
|
-
type: "SubscriptionType",
|
|
314447
|
-
id: 4
|
|
314448
|
-
}
|
|
314449
|
-
}
|
|
314450
|
-
},
|
|
314451
|
-
SubscriptionType: {
|
|
314452
|
-
values: {
|
|
314453
|
-
NO_ACTION: 0,
|
|
314454
|
-
ORDERBOOK: 1,
|
|
314455
|
-
TRADES: 2,
|
|
314456
|
-
TICKER: 3,
|
|
314457
|
-
OHLCV: 4,
|
|
314458
|
-
BALANCE: 5,
|
|
314459
|
-
ORDERS: 6
|
|
314460
|
-
}
|
|
314461
|
-
},
|
|
314462
|
-
cex_service: {
|
|
314463
|
-
methods: {
|
|
314464
|
-
ExecuteAction: {
|
|
314465
|
-
requestType: "ActionRequest",
|
|
314466
|
-
responseType: "ActionResponse"
|
|
314467
|
-
},
|
|
314468
|
-
Subscribe: {
|
|
314469
|
-
requestType: "SubscribeRequest",
|
|
314470
|
-
responseType: "SubscribeResponse",
|
|
314471
|
-
responseStream: true
|
|
314472
|
-
}
|
|
314473
|
-
}
|
|
314474
|
-
},
|
|
314475
|
-
Action: {
|
|
314476
|
-
values: {
|
|
314477
|
-
NoAction: 0,
|
|
314478
|
-
Deposit: 1,
|
|
314479
|
-
Withdraw: 2,
|
|
314480
|
-
CreateOrder: 3,
|
|
314481
|
-
GetOrderDetails: 4,
|
|
314482
|
-
CancelOrder: 5,
|
|
314483
|
-
FetchBalances: 6,
|
|
314484
|
-
FetchDepositAddresses: 7,
|
|
314485
|
-
FetchTicker: 8,
|
|
314486
|
-
FetchCurrency: 9,
|
|
314487
|
-
Call: 10,
|
|
314488
|
-
FetchAccountId: 11,
|
|
314489
|
-
FetchFees: 12,
|
|
314490
|
-
InternalTransfer: 13
|
|
314491
|
-
}
|
|
314492
|
-
}
|
|
314493
|
-
}
|
|
314494
|
-
}
|
|
314495
|
-
}
|
|
314496
|
-
};
|
|
314497
|
-
var node_descriptor_default = descriptor;
|
|
314381
|
+
import path from "path";
|
|
314382
|
+
import { fileURLToPath } from "url";
|
|
314498
314383
|
|
|
314499
314384
|
// node_modules/zod/v4/classic/external.js
|
|
314500
314385
|
var exports_external = {};
|
|
@@ -315437,9 +315322,9 @@ function createTransparentProxy(getter) {
|
|
|
315437
315322
|
target ?? (target = getter());
|
|
315438
315323
|
return Reflect.getOwnPropertyDescriptor(target, prop3);
|
|
315439
315324
|
},
|
|
315440
|
-
defineProperty(_, prop3,
|
|
315325
|
+
defineProperty(_, prop3, descriptor) {
|
|
315441
315326
|
target ?? (target = getter());
|
|
315442
|
-
return Reflect.defineProperty(target, prop3,
|
|
315327
|
+
return Reflect.defineProperty(target, prop3, descriptor);
|
|
315443
315328
|
}
|
|
315444
315329
|
});
|
|
315445
315330
|
}
|
|
@@ -328102,7 +327987,15 @@ var FetchFeesPayloadSchema = exports_external.object({
|
|
|
328102
327987
|
});
|
|
328103
327988
|
|
|
328104
327989
|
// src/server.ts
|
|
328105
|
-
var
|
|
327990
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
327991
|
+
var __dirname2 = path.dirname(__filename2);
|
|
327992
|
+
var protoPath = path.join(__dirname2, "proto", "node.proto");
|
|
327993
|
+
var packageDef = protoLoader.loadSync(protoPath, {
|
|
327994
|
+
keepCase: true,
|
|
327995
|
+
longs: String,
|
|
327996
|
+
defaults: true,
|
|
327997
|
+
oneofs: true
|
|
327998
|
+
});
|
|
328106
327999
|
var grpcObj = grpc.loadPackageDefinition(packageDef);
|
|
328107
328000
|
var cexNode = grpcObj.cex_broker;
|
|
328108
328001
|
function parsePayload(schema, rawPayload) {
|
|
@@ -328111,10 +328004,10 @@ function parsePayload(schema, rawPayload) {
|
|
|
328111
328004
|
return { success: true, data: parsed.data };
|
|
328112
328005
|
}
|
|
328113
328006
|
const firstIssue = parsed.error.issues[0];
|
|
328114
|
-
const
|
|
328007
|
+
const path2 = firstIssue && firstIssue.path.length > 0 ? `${firstIssue.path.join(".")}: ` : "";
|
|
328115
328008
|
return {
|
|
328116
328009
|
success: false,
|
|
328117
|
-
message: `ValidationError: ${
|
|
328010
|
+
message: `ValidationError: ${path2}${firstIssue?.message ?? "Invalid payload"}`
|
|
328118
328011
|
};
|
|
328119
328012
|
}
|
|
328120
328013
|
function getErrorMessage(error48) {
|
|
@@ -328163,7 +328056,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
328163
328056
|
if (!actionCompleted) {
|
|
328164
328057
|
actionCompleted = true;
|
|
328165
328058
|
const latency = Date.now() - startTime;
|
|
328166
|
-
const actionName = action
|
|
328059
|
+
const actionName = getActionName(action);
|
|
328167
328060
|
otelMetrics?.recordHistogram("execute_action_duration_ms", latency, {
|
|
328168
328061
|
action: actionName,
|
|
328169
328062
|
cex: cex3 || "unknown"
|
|
@@ -328189,7 +328082,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
328189
328082
|
cex: cex3,
|
|
328190
328083
|
symbol: symbol2
|
|
328191
328084
|
});
|
|
328192
|
-
const actionName = action
|
|
328085
|
+
const actionName = getActionName(action);
|
|
328193
328086
|
otelMetrics?.recordCounter("execute_action_requests_total", 1, {
|
|
328194
328087
|
action: actionName,
|
|
328195
328088
|
cex: cex3 || "unknown"
|
|
@@ -328845,20 +328738,13 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
328845
328738
|
try {
|
|
328846
328739
|
const request = call.request;
|
|
328847
328740
|
const { cex: cex3, symbol: symbol2, type: type2, options } = request;
|
|
328848
|
-
const subscriptionType = type2
|
|
328741
|
+
const subscriptionType = resolveSubscriptionType(type2);
|
|
328849
328742
|
log.info(`Request - Subscribe:`, {
|
|
328850
328743
|
cex: request.cex,
|
|
328851
328744
|
symbol: request.symbol,
|
|
328852
328745
|
type: subscriptionType
|
|
328853
328746
|
});
|
|
328854
|
-
const subscriptionTypeName = (
|
|
328855
|
-
for (const [key, value] of Object.entries(SubscriptionType)) {
|
|
328856
|
-
if (value === subscriptionType && Number.isNaN(Number(key))) {
|
|
328857
|
-
return key;
|
|
328858
|
-
}
|
|
328859
|
-
}
|
|
328860
|
-
return `unknown_${subscriptionType}`;
|
|
328861
|
-
})();
|
|
328747
|
+
const subscriptionTypeName = getSubscriptionTypeName(subscriptionType);
|
|
328862
328748
|
otelMetrics?.recordCounter("subscribe_requests_total", 1, {
|
|
328863
328749
|
cex: cex3 || "unknown",
|
|
328864
328750
|
symbol: symbol2 || "unknown",
|
|
@@ -328946,7 +328832,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
328946
328832
|
data: JSON.stringify(ticker),
|
|
328947
328833
|
timestamp: Date.now(),
|
|
328948
328834
|
symbol: symbol2,
|
|
328949
|
-
type:
|
|
328835
|
+
type: subscriptionType
|
|
328950
328836
|
});
|
|
328951
328837
|
}
|
|
328952
328838
|
} catch (error48) {
|
|
@@ -328971,7 +328857,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
328971
328857
|
data: JSON.stringify(ohlcv),
|
|
328972
328858
|
timestamp: Date.now(),
|
|
328973
328859
|
symbol: symbol2,
|
|
328974
|
-
type:
|
|
328860
|
+
type: subscriptionType
|
|
328975
328861
|
});
|
|
328976
328862
|
}
|
|
328977
328863
|
} catch (error48) {
|
|
@@ -328995,7 +328881,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
328995
328881
|
data: JSON.stringify(balance),
|
|
328996
328882
|
timestamp: Date.now(),
|
|
328997
328883
|
symbol: symbol2,
|
|
328998
|
-
type:
|
|
328884
|
+
type: subscriptionType
|
|
328999
328885
|
});
|
|
329000
328886
|
}
|
|
329001
328887
|
} catch (error48) {
|
|
@@ -329019,7 +328905,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
329019
328905
|
data: JSON.stringify(orders),
|
|
329020
328906
|
timestamp: Date.now(),
|
|
329021
328907
|
symbol: symbol2,
|
|
329022
|
-
type:
|
|
328908
|
+
type: subscriptionType
|
|
329023
328909
|
});
|
|
329024
328910
|
}
|
|
329025
328911
|
} catch (error48) {
|
|
@@ -329040,7 +328926,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
329040
328926
|
data: JSON.stringify({ error: "Invalid subscription type" }),
|
|
329041
328927
|
timestamp: Date.now(),
|
|
329042
328928
|
symbol: symbol2,
|
|
329043
|
-
type:
|
|
328929
|
+
type: subscriptionType
|
|
329044
328930
|
});
|
|
329045
328931
|
}
|
|
329046
328932
|
} catch (error48) {
|
|
@@ -1 +1,31 @@
|
|
|
1
1
|
export declare const CCXT_METHODS_WITH_VERITY: string[];
|
|
2
|
+
export declare const Action: {
|
|
3
|
+
readonly NoAction: 0;
|
|
4
|
+
readonly Deposit: 1;
|
|
5
|
+
readonly Withdraw: 2;
|
|
6
|
+
readonly CreateOrder: 3;
|
|
7
|
+
readonly GetOrderDetails: 4;
|
|
8
|
+
readonly CancelOrder: 5;
|
|
9
|
+
readonly FetchBalances: 6;
|
|
10
|
+
readonly FetchDepositAddresses: 7;
|
|
11
|
+
readonly FetchTicker: 8;
|
|
12
|
+
readonly FetchCurrency: 9;
|
|
13
|
+
readonly Call: 10;
|
|
14
|
+
readonly FetchAccountId: 11;
|
|
15
|
+
readonly FetchFees: 12;
|
|
16
|
+
readonly InternalTransfer: 13;
|
|
17
|
+
};
|
|
18
|
+
export declare const SubscriptionType: {
|
|
19
|
+
readonly NO_ACTION: 0;
|
|
20
|
+
readonly ORDERBOOK: 1;
|
|
21
|
+
readonly TRADES: 2;
|
|
22
|
+
readonly TICKER: 3;
|
|
23
|
+
readonly OHLCV: 4;
|
|
24
|
+
readonly BALANCE: 5;
|
|
25
|
+
readonly ORDERS: 6;
|
|
26
|
+
};
|
|
27
|
+
export type Action = (typeof Action)[keyof typeof Action];
|
|
28
|
+
export type SubscriptionType = (typeof SubscriptionType)[keyof typeof SubscriptionType];
|
|
29
|
+
export declare function getActionName(action: unknown): string;
|
|
30
|
+
export declare function getSubscriptionTypeName(subscriptionType: number): string;
|
|
31
|
+
export declare function resolveSubscriptionType(type: SubscriptionType | undefined): SubscriptionType;
|
package/dist/index.js
CHANGED
|
@@ -270118,6 +270118,45 @@ var CCXT_METHODS_WITH_VERITY = [
|
|
|
270118
270118
|
"fetchWithdrawal",
|
|
270119
270119
|
"fetchAccountId"
|
|
270120
270120
|
];
|
|
270121
|
+
var Action = {
|
|
270122
|
+
NoAction: 0,
|
|
270123
|
+
Deposit: 1,
|
|
270124
|
+
Withdraw: 2,
|
|
270125
|
+
CreateOrder: 3,
|
|
270126
|
+
GetOrderDetails: 4,
|
|
270127
|
+
CancelOrder: 5,
|
|
270128
|
+
FetchBalances: 6,
|
|
270129
|
+
FetchDepositAddresses: 7,
|
|
270130
|
+
FetchTicker: 8,
|
|
270131
|
+
FetchCurrency: 9,
|
|
270132
|
+
Call: 10,
|
|
270133
|
+
FetchAccountId: 11,
|
|
270134
|
+
FetchFees: 12,
|
|
270135
|
+
InternalTransfer: 13
|
|
270136
|
+
};
|
|
270137
|
+
var SubscriptionType = {
|
|
270138
|
+
NO_ACTION: 0,
|
|
270139
|
+
ORDERBOOK: 1,
|
|
270140
|
+
TRADES: 2,
|
|
270141
|
+
TICKER: 3,
|
|
270142
|
+
OHLCV: 4,
|
|
270143
|
+
BALANCE: 5,
|
|
270144
|
+
ORDERS: 6
|
|
270145
|
+
};
|
|
270146
|
+
function createEnumNameMap(enumValues) {
|
|
270147
|
+
return Object.fromEntries(Object.entries(enumValues).map(([name, value]) => [value, name]));
|
|
270148
|
+
}
|
|
270149
|
+
var actionNames = createEnumNameMap(Action);
|
|
270150
|
+
var subscriptionTypeNames = createEnumNameMap(SubscriptionType);
|
|
270151
|
+
function getActionName(action) {
|
|
270152
|
+
return typeof action === "number" ? actionNames[action] ?? `unknown_${action}` : `unknown_${action ?? "undefined"}`;
|
|
270153
|
+
}
|
|
270154
|
+
function getSubscriptionTypeName(subscriptionType) {
|
|
270155
|
+
return subscriptionTypeNames[subscriptionType] ?? `unknown_${subscriptionType}`;
|
|
270156
|
+
}
|
|
270157
|
+
function resolveSubscriptionType(type2) {
|
|
270158
|
+
return type2 === undefined || type2 === SubscriptionType.NO_ACTION ? SubscriptionType.ORDERBOOK : type2;
|
|
270159
|
+
}
|
|
270121
270160
|
|
|
270122
270161
|
// node_modules/@loglayer/plugin-opentelemetry/dist/index.mjs
|
|
270123
270162
|
var import_api = __toESM(require_src2(), 1);
|
|
@@ -277292,162 +277331,8 @@ function createOtelLogsFromEnv() {
|
|
|
277292
277331
|
// src/server.ts
|
|
277293
277332
|
import * as grpc from "@grpc/grpc-js";
|
|
277294
277333
|
import * as protoLoader from "@grpc/proto-loader";
|
|
277295
|
-
|
|
277296
|
-
|
|
277297
|
-
var Action = {
|
|
277298
|
-
NoAction: 0,
|
|
277299
|
-
Deposit: 1,
|
|
277300
|
-
Withdraw: 2,
|
|
277301
|
-
CreateOrder: 3,
|
|
277302
|
-
GetOrderDetails: 4,
|
|
277303
|
-
CancelOrder: 5,
|
|
277304
|
-
FetchBalances: 6,
|
|
277305
|
-
FetchDepositAddresses: 7,
|
|
277306
|
-
FetchTicker: 8,
|
|
277307
|
-
FetchCurrency: 9,
|
|
277308
|
-
Call: 10,
|
|
277309
|
-
FetchAccountId: 11,
|
|
277310
|
-
FetchFees: 12,
|
|
277311
|
-
InternalTransfer: 13
|
|
277312
|
-
};
|
|
277313
|
-
|
|
277314
|
-
// src/proto/cex_broker/SubscriptionType.ts
|
|
277315
|
-
var SubscriptionType = {
|
|
277316
|
-
NO_ACTION: 0,
|
|
277317
|
-
ORDERBOOK: 1,
|
|
277318
|
-
TRADES: 2,
|
|
277319
|
-
TICKER: 3,
|
|
277320
|
-
OHLCV: 4,
|
|
277321
|
-
BALANCE: 5,
|
|
277322
|
-
ORDERS: 6
|
|
277323
|
-
};
|
|
277324
|
-
|
|
277325
|
-
// src/proto/node.descriptor.ts
|
|
277326
|
-
var descriptor = {
|
|
277327
|
-
nested: {
|
|
277328
|
-
cex_broker: {
|
|
277329
|
-
nested: {
|
|
277330
|
-
ActionRequest: {
|
|
277331
|
-
fields: {
|
|
277332
|
-
action: {
|
|
277333
|
-
type: "Action",
|
|
277334
|
-
id: 1
|
|
277335
|
-
},
|
|
277336
|
-
payload: {
|
|
277337
|
-
keyType: "string",
|
|
277338
|
-
type: "string",
|
|
277339
|
-
id: 2
|
|
277340
|
-
},
|
|
277341
|
-
cex: {
|
|
277342
|
-
type: "string",
|
|
277343
|
-
id: 3
|
|
277344
|
-
},
|
|
277345
|
-
symbol: {
|
|
277346
|
-
type: "string",
|
|
277347
|
-
id: 4
|
|
277348
|
-
}
|
|
277349
|
-
}
|
|
277350
|
-
},
|
|
277351
|
-
ActionResponse: {
|
|
277352
|
-
fields: {
|
|
277353
|
-
result: {
|
|
277354
|
-
type: "string",
|
|
277355
|
-
id: 1
|
|
277356
|
-
},
|
|
277357
|
-
proof: {
|
|
277358
|
-
type: "string",
|
|
277359
|
-
id: 2
|
|
277360
|
-
}
|
|
277361
|
-
}
|
|
277362
|
-
},
|
|
277363
|
-
SubscribeRequest: {
|
|
277364
|
-
fields: {
|
|
277365
|
-
cex: {
|
|
277366
|
-
type: "string",
|
|
277367
|
-
id: 1
|
|
277368
|
-
},
|
|
277369
|
-
symbol: {
|
|
277370
|
-
type: "string",
|
|
277371
|
-
id: 2
|
|
277372
|
-
},
|
|
277373
|
-
type: {
|
|
277374
|
-
type: "SubscriptionType",
|
|
277375
|
-
id: 3
|
|
277376
|
-
},
|
|
277377
|
-
options: {
|
|
277378
|
-
keyType: "string",
|
|
277379
|
-
type: "string",
|
|
277380
|
-
id: 4
|
|
277381
|
-
}
|
|
277382
|
-
}
|
|
277383
|
-
},
|
|
277384
|
-
SubscribeResponse: {
|
|
277385
|
-
fields: {
|
|
277386
|
-
data: {
|
|
277387
|
-
type: "string",
|
|
277388
|
-
id: 1
|
|
277389
|
-
},
|
|
277390
|
-
timestamp: {
|
|
277391
|
-
type: "int64",
|
|
277392
|
-
id: 2
|
|
277393
|
-
},
|
|
277394
|
-
symbol: {
|
|
277395
|
-
type: "string",
|
|
277396
|
-
id: 3
|
|
277397
|
-
},
|
|
277398
|
-
type: {
|
|
277399
|
-
type: "SubscriptionType",
|
|
277400
|
-
id: 4
|
|
277401
|
-
}
|
|
277402
|
-
}
|
|
277403
|
-
},
|
|
277404
|
-
SubscriptionType: {
|
|
277405
|
-
values: {
|
|
277406
|
-
NO_ACTION: 0,
|
|
277407
|
-
ORDERBOOK: 1,
|
|
277408
|
-
TRADES: 2,
|
|
277409
|
-
TICKER: 3,
|
|
277410
|
-
OHLCV: 4,
|
|
277411
|
-
BALANCE: 5,
|
|
277412
|
-
ORDERS: 6
|
|
277413
|
-
}
|
|
277414
|
-
},
|
|
277415
|
-
cex_service: {
|
|
277416
|
-
methods: {
|
|
277417
|
-
ExecuteAction: {
|
|
277418
|
-
requestType: "ActionRequest",
|
|
277419
|
-
responseType: "ActionResponse"
|
|
277420
|
-
},
|
|
277421
|
-
Subscribe: {
|
|
277422
|
-
requestType: "SubscribeRequest",
|
|
277423
|
-
responseType: "SubscribeResponse",
|
|
277424
|
-
responseStream: true
|
|
277425
|
-
}
|
|
277426
|
-
}
|
|
277427
|
-
},
|
|
277428
|
-
Action: {
|
|
277429
|
-
values: {
|
|
277430
|
-
NoAction: 0,
|
|
277431
|
-
Deposit: 1,
|
|
277432
|
-
Withdraw: 2,
|
|
277433
|
-
CreateOrder: 3,
|
|
277434
|
-
GetOrderDetails: 4,
|
|
277435
|
-
CancelOrder: 5,
|
|
277436
|
-
FetchBalances: 6,
|
|
277437
|
-
FetchDepositAddresses: 7,
|
|
277438
|
-
FetchTicker: 8,
|
|
277439
|
-
FetchCurrency: 9,
|
|
277440
|
-
Call: 10,
|
|
277441
|
-
FetchAccountId: 11,
|
|
277442
|
-
FetchFees: 12,
|
|
277443
|
-
InternalTransfer: 13
|
|
277444
|
-
}
|
|
277445
|
-
}
|
|
277446
|
-
}
|
|
277447
|
-
}
|
|
277448
|
-
}
|
|
277449
|
-
};
|
|
277450
|
-
var node_descriptor_default = descriptor;
|
|
277334
|
+
import path from "path";
|
|
277335
|
+
import { fileURLToPath } from "url";
|
|
277451
277336
|
|
|
277452
277337
|
// node_modules/zod/v4/classic/external.js
|
|
277453
277338
|
var exports_external = {};
|
|
@@ -278390,9 +278275,9 @@ function createTransparentProxy(getter) {
|
|
|
278390
278275
|
target ?? (target = getter());
|
|
278391
278276
|
return Reflect.getOwnPropertyDescriptor(target, prop3);
|
|
278392
278277
|
},
|
|
278393
|
-
defineProperty(_, prop3,
|
|
278278
|
+
defineProperty(_, prop3, descriptor) {
|
|
278394
278279
|
target ?? (target = getter());
|
|
278395
|
-
return Reflect.defineProperty(target, prop3,
|
|
278280
|
+
return Reflect.defineProperty(target, prop3, descriptor);
|
|
278396
278281
|
}
|
|
278397
278282
|
});
|
|
278398
278283
|
}
|
|
@@ -291055,7 +290940,15 @@ var FetchFeesPayloadSchema = exports_external.object({
|
|
|
291055
290940
|
});
|
|
291056
290941
|
|
|
291057
290942
|
// src/server.ts
|
|
291058
|
-
var
|
|
290943
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
290944
|
+
var __dirname2 = path.dirname(__filename2);
|
|
290945
|
+
var protoPath = path.join(__dirname2, "proto", "node.proto");
|
|
290946
|
+
var packageDef = protoLoader.loadSync(protoPath, {
|
|
290947
|
+
keepCase: true,
|
|
290948
|
+
longs: String,
|
|
290949
|
+
defaults: true,
|
|
290950
|
+
oneofs: true
|
|
290951
|
+
});
|
|
291059
290952
|
var grpcObj = grpc.loadPackageDefinition(packageDef);
|
|
291060
290953
|
var cexNode = grpcObj.cex_broker;
|
|
291061
290954
|
function parsePayload(schema, rawPayload) {
|
|
@@ -291064,10 +290957,10 @@ function parsePayload(schema, rawPayload) {
|
|
|
291064
290957
|
return { success: true, data: parsed.data };
|
|
291065
290958
|
}
|
|
291066
290959
|
const firstIssue = parsed.error.issues[0];
|
|
291067
|
-
const
|
|
290960
|
+
const path2 = firstIssue && firstIssue.path.length > 0 ? `${firstIssue.path.join(".")}: ` : "";
|
|
291068
290961
|
return {
|
|
291069
290962
|
success: false,
|
|
291070
|
-
message: `ValidationError: ${
|
|
290963
|
+
message: `ValidationError: ${path2}${firstIssue?.message ?? "Invalid payload"}`
|
|
291071
290964
|
};
|
|
291072
290965
|
}
|
|
291073
290966
|
function getErrorMessage(error48) {
|
|
@@ -291116,7 +291009,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291116
291009
|
if (!actionCompleted) {
|
|
291117
291010
|
actionCompleted = true;
|
|
291118
291011
|
const latency = Date.now() - startTime;
|
|
291119
|
-
const actionName = action
|
|
291012
|
+
const actionName = getActionName(action);
|
|
291120
291013
|
otelMetrics?.recordHistogram("execute_action_duration_ms", latency, {
|
|
291121
291014
|
action: actionName,
|
|
291122
291015
|
cex: cex3 || "unknown"
|
|
@@ -291142,7 +291035,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291142
291035
|
cex: cex3,
|
|
291143
291036
|
symbol: symbol2
|
|
291144
291037
|
});
|
|
291145
|
-
const actionName = action
|
|
291038
|
+
const actionName = getActionName(action);
|
|
291146
291039
|
otelMetrics?.recordCounter("execute_action_requests_total", 1, {
|
|
291147
291040
|
action: actionName,
|
|
291148
291041
|
cex: cex3 || "unknown"
|
|
@@ -291798,20 +291691,13 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291798
291691
|
try {
|
|
291799
291692
|
const request = call.request;
|
|
291800
291693
|
const { cex: cex3, symbol: symbol2, type: type2, options } = request;
|
|
291801
|
-
const subscriptionType = type2
|
|
291694
|
+
const subscriptionType = resolveSubscriptionType(type2);
|
|
291802
291695
|
log.info(`Request - Subscribe:`, {
|
|
291803
291696
|
cex: request.cex,
|
|
291804
291697
|
symbol: request.symbol,
|
|
291805
291698
|
type: subscriptionType
|
|
291806
291699
|
});
|
|
291807
|
-
const subscriptionTypeName = (
|
|
291808
|
-
for (const [key, value] of Object.entries(SubscriptionType)) {
|
|
291809
|
-
if (value === subscriptionType && Number.isNaN(Number(key))) {
|
|
291810
|
-
return key;
|
|
291811
|
-
}
|
|
291812
|
-
}
|
|
291813
|
-
return `unknown_${subscriptionType}`;
|
|
291814
|
-
})();
|
|
291700
|
+
const subscriptionTypeName = getSubscriptionTypeName(subscriptionType);
|
|
291815
291701
|
otelMetrics?.recordCounter("subscribe_requests_total", 1, {
|
|
291816
291702
|
cex: cex3 || "unknown",
|
|
291817
291703
|
symbol: symbol2 || "unknown",
|
|
@@ -291899,7 +291785,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291899
291785
|
data: JSON.stringify(ticker),
|
|
291900
291786
|
timestamp: Date.now(),
|
|
291901
291787
|
symbol: symbol2,
|
|
291902
|
-
type:
|
|
291788
|
+
type: subscriptionType
|
|
291903
291789
|
});
|
|
291904
291790
|
}
|
|
291905
291791
|
} catch (error48) {
|
|
@@ -291924,7 +291810,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291924
291810
|
data: JSON.stringify(ohlcv),
|
|
291925
291811
|
timestamp: Date.now(),
|
|
291926
291812
|
symbol: symbol2,
|
|
291927
|
-
type:
|
|
291813
|
+
type: subscriptionType
|
|
291928
291814
|
});
|
|
291929
291815
|
}
|
|
291930
291816
|
} catch (error48) {
|
|
@@ -291948,7 +291834,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291948
291834
|
data: JSON.stringify(balance),
|
|
291949
291835
|
timestamp: Date.now(),
|
|
291950
291836
|
symbol: symbol2,
|
|
291951
|
-
type:
|
|
291837
|
+
type: subscriptionType
|
|
291952
291838
|
});
|
|
291953
291839
|
}
|
|
291954
291840
|
} catch (error48) {
|
|
@@ -291972,7 +291858,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291972
291858
|
data: JSON.stringify(orders),
|
|
291973
291859
|
timestamp: Date.now(),
|
|
291974
291860
|
symbol: symbol2,
|
|
291975
|
-
type:
|
|
291861
|
+
type: subscriptionType
|
|
291976
291862
|
});
|
|
291977
291863
|
}
|
|
291978
291864
|
} catch (error48) {
|
|
@@ -291993,7 +291879,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl, ot
|
|
|
291993
291879
|
data: JSON.stringify({ error: "Invalid subscription type" }),
|
|
291994
291880
|
timestamp: Date.now(),
|
|
291995
291881
|
symbol: symbol2,
|
|
291996
|
-
type:
|
|
291882
|
+
type: subscriptionType
|
|
291997
291883
|
});
|
|
291998
291884
|
}
|
|
291999
291885
|
} catch (error48) {
|
|
@@ -292324,4 +292210,4 @@ export {
|
|
|
292324
292210
|
CEXBroker as default
|
|
292325
292211
|
};
|
|
292326
292212
|
|
|
292327
|
-
//# debugId=
|
|
292213
|
+
//# debugId=EC06775BC83A508D64756E2164756E21
|