@usherlabs/cex-broker 0.1.3 → 0.1.5
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 +452 -26
- package/dist/index.js +666 -3082
- package/dist/proto/node.proto +53 -0
- package/dist/server.d.ts +7 -0
- package/package.json +5 -2
package/dist/commands/cli.js
CHANGED
|
@@ -14985,7 +14985,7 @@ var require_src2 = __commonJS((exports) => {
|
|
|
14985
14985
|
|
|
14986
14986
|
// node_modules/@grpc/grpc-js/build/src/channelz.js
|
|
14987
14987
|
var require_channelz = __commonJS((exports) => {
|
|
14988
|
-
var __dirname = "/home/
|
|
14988
|
+
var __dirname = "/home/runner/work/cex-broker/cex-broker/node_modules/@grpc/grpc-js/build/src";
|
|
14989
14989
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14990
14990
|
exports.registerChannelzSocket = exports.registerChannelzServer = exports.registerChannelzSubchannel = exports.registerChannelzChannel = exports.ChannelzCallTrackerStub = exports.ChannelzCallTracker = exports.ChannelzChildrenTrackerStub = exports.ChannelzChildrenTracker = exports.ChannelzTrace = exports.ChannelzTraceStub = undefined;
|
|
14991
14991
|
exports.unregisterChannelzRef = unregisterChannelzRef;
|
|
@@ -37287,13 +37287,429 @@ var require_proxy_from_env = __commonJS((exports) => {
|
|
|
37287
37287
|
exports.getProxyForUrl = getProxyForUrl;
|
|
37288
37288
|
});
|
|
37289
37289
|
|
|
37290
|
-
// node_modules/
|
|
37290
|
+
// node_modules/ms/index.js
|
|
37291
|
+
var require_ms = __commonJS((exports, module) => {
|
|
37292
|
+
var s = 1000;
|
|
37293
|
+
var m = s * 60;
|
|
37294
|
+
var h = m * 60;
|
|
37295
|
+
var d = h * 24;
|
|
37296
|
+
var y = d * 365.25;
|
|
37297
|
+
module.exports = function(val, options) {
|
|
37298
|
+
options = options || {};
|
|
37299
|
+
var type2 = typeof val;
|
|
37300
|
+
if (type2 === "string" && val.length > 0) {
|
|
37301
|
+
return parse(val);
|
|
37302
|
+
} else if (type2 === "number" && isNaN(val) === false) {
|
|
37303
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
37304
|
+
}
|
|
37305
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
37306
|
+
};
|
|
37307
|
+
function parse(str) {
|
|
37308
|
+
str = String(str);
|
|
37309
|
+
if (str.length > 100) {
|
|
37310
|
+
return;
|
|
37311
|
+
}
|
|
37312
|
+
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
|
|
37313
|
+
if (!match) {
|
|
37314
|
+
return;
|
|
37315
|
+
}
|
|
37316
|
+
var n2 = parseFloat(match[1]);
|
|
37317
|
+
var type2 = (match[2] || "ms").toLowerCase();
|
|
37318
|
+
switch (type2) {
|
|
37319
|
+
case "years":
|
|
37320
|
+
case "year":
|
|
37321
|
+
case "yrs":
|
|
37322
|
+
case "yr":
|
|
37323
|
+
case "y":
|
|
37324
|
+
return n2 * y;
|
|
37325
|
+
case "days":
|
|
37326
|
+
case "day":
|
|
37327
|
+
case "d":
|
|
37328
|
+
return n2 * d;
|
|
37329
|
+
case "hours":
|
|
37330
|
+
case "hour":
|
|
37331
|
+
case "hrs":
|
|
37332
|
+
case "hr":
|
|
37333
|
+
case "h":
|
|
37334
|
+
return n2 * h;
|
|
37335
|
+
case "minutes":
|
|
37336
|
+
case "minute":
|
|
37337
|
+
case "mins":
|
|
37338
|
+
case "min":
|
|
37339
|
+
case "m":
|
|
37340
|
+
return n2 * m;
|
|
37341
|
+
case "seconds":
|
|
37342
|
+
case "second":
|
|
37343
|
+
case "secs":
|
|
37344
|
+
case "sec":
|
|
37345
|
+
case "s":
|
|
37346
|
+
return n2 * s;
|
|
37347
|
+
case "milliseconds":
|
|
37348
|
+
case "millisecond":
|
|
37349
|
+
case "msecs":
|
|
37350
|
+
case "msec":
|
|
37351
|
+
case "ms":
|
|
37352
|
+
return n2;
|
|
37353
|
+
default:
|
|
37354
|
+
return;
|
|
37355
|
+
}
|
|
37356
|
+
}
|
|
37357
|
+
function fmtShort(ms) {
|
|
37358
|
+
if (ms >= d) {
|
|
37359
|
+
return Math.round(ms / d) + "d";
|
|
37360
|
+
}
|
|
37361
|
+
if (ms >= h) {
|
|
37362
|
+
return Math.round(ms / h) + "h";
|
|
37363
|
+
}
|
|
37364
|
+
if (ms >= m) {
|
|
37365
|
+
return Math.round(ms / m) + "m";
|
|
37366
|
+
}
|
|
37367
|
+
if (ms >= s) {
|
|
37368
|
+
return Math.round(ms / s) + "s";
|
|
37369
|
+
}
|
|
37370
|
+
return ms + "ms";
|
|
37371
|
+
}
|
|
37372
|
+
function fmtLong(ms) {
|
|
37373
|
+
return plural(ms, d, "day") || plural(ms, h, "hour") || plural(ms, m, "minute") || plural(ms, s, "second") || ms + " ms";
|
|
37374
|
+
}
|
|
37375
|
+
function plural(ms, n2, name) {
|
|
37376
|
+
if (ms < n2) {
|
|
37377
|
+
return;
|
|
37378
|
+
}
|
|
37379
|
+
if (ms < n2 * 1.5) {
|
|
37380
|
+
return Math.floor(ms / n2) + " " + name;
|
|
37381
|
+
}
|
|
37382
|
+
return Math.ceil(ms / n2) + " " + name + "s";
|
|
37383
|
+
}
|
|
37384
|
+
});
|
|
37385
|
+
|
|
37386
|
+
// node_modules/debug/src/debug.js
|
|
37291
37387
|
var require_debug = __commonJS((exports, module) => {
|
|
37388
|
+
exports = module.exports = createDebug.debug = createDebug["default"] = createDebug;
|
|
37389
|
+
exports.coerce = coerce;
|
|
37390
|
+
exports.disable = disable;
|
|
37391
|
+
exports.enable = enable;
|
|
37392
|
+
exports.enabled = enabled;
|
|
37393
|
+
exports.humanize = require_ms();
|
|
37394
|
+
exports.names = [];
|
|
37395
|
+
exports.skips = [];
|
|
37396
|
+
exports.formatters = {};
|
|
37397
|
+
var prevTime;
|
|
37398
|
+
function selectColor(namespace) {
|
|
37399
|
+
var hash3 = 0, i2;
|
|
37400
|
+
for (i2 in namespace) {
|
|
37401
|
+
hash3 = (hash3 << 5) - hash3 + namespace.charCodeAt(i2);
|
|
37402
|
+
hash3 |= 0;
|
|
37403
|
+
}
|
|
37404
|
+
return exports.colors[Math.abs(hash3) % exports.colors.length];
|
|
37405
|
+
}
|
|
37406
|
+
function createDebug(namespace) {
|
|
37407
|
+
function debug() {
|
|
37408
|
+
if (!debug.enabled)
|
|
37409
|
+
return;
|
|
37410
|
+
var self2 = debug;
|
|
37411
|
+
var curr = +new Date;
|
|
37412
|
+
var ms = curr - (prevTime || curr);
|
|
37413
|
+
self2.diff = ms;
|
|
37414
|
+
self2.prev = prevTime;
|
|
37415
|
+
self2.curr = curr;
|
|
37416
|
+
prevTime = curr;
|
|
37417
|
+
var args = new Array(arguments.length);
|
|
37418
|
+
for (var i2 = 0;i2 < args.length; i2++) {
|
|
37419
|
+
args[i2] = arguments[i2];
|
|
37420
|
+
}
|
|
37421
|
+
args[0] = exports.coerce(args[0]);
|
|
37422
|
+
if (typeof args[0] !== "string") {
|
|
37423
|
+
args.unshift("%O");
|
|
37424
|
+
}
|
|
37425
|
+
var index2 = 0;
|
|
37426
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
37427
|
+
if (match === "%%")
|
|
37428
|
+
return match;
|
|
37429
|
+
index2++;
|
|
37430
|
+
var formatter2 = exports.formatters[format];
|
|
37431
|
+
if (typeof formatter2 === "function") {
|
|
37432
|
+
var val = args[index2];
|
|
37433
|
+
match = formatter2.call(self2, val);
|
|
37434
|
+
args.splice(index2, 1);
|
|
37435
|
+
index2--;
|
|
37436
|
+
}
|
|
37437
|
+
return match;
|
|
37438
|
+
});
|
|
37439
|
+
exports.formatArgs.call(self2, args);
|
|
37440
|
+
var logFn = debug.log || exports.log || console.log.bind(console);
|
|
37441
|
+
logFn.apply(self2, args);
|
|
37442
|
+
}
|
|
37443
|
+
debug.namespace = namespace;
|
|
37444
|
+
debug.enabled = exports.enabled(namespace);
|
|
37445
|
+
debug.useColors = exports.useColors();
|
|
37446
|
+
debug.color = selectColor(namespace);
|
|
37447
|
+
if (typeof exports.init === "function") {
|
|
37448
|
+
exports.init(debug);
|
|
37449
|
+
}
|
|
37450
|
+
return debug;
|
|
37451
|
+
}
|
|
37452
|
+
function enable(namespaces) {
|
|
37453
|
+
exports.save(namespaces);
|
|
37454
|
+
exports.names = [];
|
|
37455
|
+
exports.skips = [];
|
|
37456
|
+
var split2 = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
|
|
37457
|
+
var len = split2.length;
|
|
37458
|
+
for (var i2 = 0;i2 < len; i2++) {
|
|
37459
|
+
if (!split2[i2])
|
|
37460
|
+
continue;
|
|
37461
|
+
namespaces = split2[i2].replace(/\*/g, ".*?");
|
|
37462
|
+
if (namespaces[0] === "-") {
|
|
37463
|
+
exports.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
|
|
37464
|
+
} else {
|
|
37465
|
+
exports.names.push(new RegExp("^" + namespaces + "$"));
|
|
37466
|
+
}
|
|
37467
|
+
}
|
|
37468
|
+
}
|
|
37469
|
+
function disable() {
|
|
37470
|
+
exports.enable("");
|
|
37471
|
+
}
|
|
37472
|
+
function enabled(name) {
|
|
37473
|
+
var i2, len;
|
|
37474
|
+
for (i2 = 0, len = exports.skips.length;i2 < len; i2++) {
|
|
37475
|
+
if (exports.skips[i2].test(name)) {
|
|
37476
|
+
return false;
|
|
37477
|
+
}
|
|
37478
|
+
}
|
|
37479
|
+
for (i2 = 0, len = exports.names.length;i2 < len; i2++) {
|
|
37480
|
+
if (exports.names[i2].test(name)) {
|
|
37481
|
+
return true;
|
|
37482
|
+
}
|
|
37483
|
+
}
|
|
37484
|
+
return false;
|
|
37485
|
+
}
|
|
37486
|
+
function coerce(val) {
|
|
37487
|
+
if (val instanceof Error)
|
|
37488
|
+
return val.stack || val.message;
|
|
37489
|
+
return val;
|
|
37490
|
+
}
|
|
37491
|
+
});
|
|
37492
|
+
|
|
37493
|
+
// node_modules/debug/src/browser.js
|
|
37494
|
+
var require_browser = __commonJS((exports, module) => {
|
|
37495
|
+
exports = module.exports = require_debug();
|
|
37496
|
+
exports.log = log;
|
|
37497
|
+
exports.formatArgs = formatArgs;
|
|
37498
|
+
exports.save = save;
|
|
37499
|
+
exports.load = load;
|
|
37500
|
+
exports.useColors = useColors;
|
|
37501
|
+
exports.storage = typeof chrome != "undefined" && typeof chrome.storage != "undefined" ? chrome.storage.local : localstorage();
|
|
37502
|
+
exports.colors = [
|
|
37503
|
+
"lightseagreen",
|
|
37504
|
+
"forestgreen",
|
|
37505
|
+
"goldenrod",
|
|
37506
|
+
"dodgerblue",
|
|
37507
|
+
"darkorchid",
|
|
37508
|
+
"crimson"
|
|
37509
|
+
];
|
|
37510
|
+
function useColors() {
|
|
37511
|
+
if (typeof window !== "undefined" && window.process && window.process.type === "renderer") {
|
|
37512
|
+
return true;
|
|
37513
|
+
}
|
|
37514
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
37515
|
+
}
|
|
37516
|
+
exports.formatters.j = function(v) {
|
|
37517
|
+
try {
|
|
37518
|
+
return JSON.stringify(v);
|
|
37519
|
+
} catch (err2) {
|
|
37520
|
+
return "[UnexpectedJSONParseError]: " + err2.message;
|
|
37521
|
+
}
|
|
37522
|
+
};
|
|
37523
|
+
function formatArgs(args) {
|
|
37524
|
+
var useColors2 = this.useColors;
|
|
37525
|
+
args[0] = (useColors2 ? "%c" : "") + this.namespace + (useColors2 ? " %c" : " ") + args[0] + (useColors2 ? "%c " : " ") + "+" + exports.humanize(this.diff);
|
|
37526
|
+
if (!useColors2)
|
|
37527
|
+
return;
|
|
37528
|
+
var c = "color: " + this.color;
|
|
37529
|
+
args.splice(1, 0, c, "color: inherit");
|
|
37530
|
+
var index2 = 0;
|
|
37531
|
+
var lastC = 0;
|
|
37532
|
+
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
37533
|
+
if (match === "%%")
|
|
37534
|
+
return;
|
|
37535
|
+
index2++;
|
|
37536
|
+
if (match === "%c") {
|
|
37537
|
+
lastC = index2;
|
|
37538
|
+
}
|
|
37539
|
+
});
|
|
37540
|
+
args.splice(lastC, 0, c);
|
|
37541
|
+
}
|
|
37542
|
+
function log() {
|
|
37543
|
+
return typeof console === "object" && console.log && Function.prototype.apply.call(console.log, console, arguments);
|
|
37544
|
+
}
|
|
37545
|
+
function save(namespaces) {
|
|
37546
|
+
try {
|
|
37547
|
+
if (namespaces == null) {
|
|
37548
|
+
exports.storage.removeItem("debug");
|
|
37549
|
+
} else {
|
|
37550
|
+
exports.storage.debug = namespaces;
|
|
37551
|
+
}
|
|
37552
|
+
} catch (e) {}
|
|
37553
|
+
}
|
|
37554
|
+
function load() {
|
|
37555
|
+
var r;
|
|
37556
|
+
try {
|
|
37557
|
+
r = exports.storage.debug;
|
|
37558
|
+
} catch (e) {}
|
|
37559
|
+
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
37560
|
+
r = process.env.DEBUG;
|
|
37561
|
+
}
|
|
37562
|
+
return r;
|
|
37563
|
+
}
|
|
37564
|
+
exports.enable(load());
|
|
37565
|
+
function localstorage() {
|
|
37566
|
+
try {
|
|
37567
|
+
return window.localStorage;
|
|
37568
|
+
} catch (e) {}
|
|
37569
|
+
}
|
|
37570
|
+
});
|
|
37571
|
+
|
|
37572
|
+
// node_modules/debug/src/node.js
|
|
37573
|
+
var require_node = __commonJS((exports, module) => {
|
|
37574
|
+
var tty = __require("tty");
|
|
37575
|
+
var util = __require("util");
|
|
37576
|
+
exports = module.exports = require_debug();
|
|
37577
|
+
exports.init = init;
|
|
37578
|
+
exports.log = log;
|
|
37579
|
+
exports.formatArgs = formatArgs;
|
|
37580
|
+
exports.save = save;
|
|
37581
|
+
exports.load = load;
|
|
37582
|
+
exports.useColors = useColors;
|
|
37583
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
37584
|
+
exports.inspectOpts = Object.keys(process.env).filter(function(key) {
|
|
37585
|
+
return /^debug_/i.test(key);
|
|
37586
|
+
}).reduce(function(obj, key) {
|
|
37587
|
+
var prop3 = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) {
|
|
37588
|
+
return k.toUpperCase();
|
|
37589
|
+
});
|
|
37590
|
+
var val = process.env[key];
|
|
37591
|
+
if (/^(yes|on|true|enabled)$/i.test(val))
|
|
37592
|
+
val = true;
|
|
37593
|
+
else if (/^(no|off|false|disabled)$/i.test(val))
|
|
37594
|
+
val = false;
|
|
37595
|
+
else if (val === "null")
|
|
37596
|
+
val = null;
|
|
37597
|
+
else
|
|
37598
|
+
val = Number(val);
|
|
37599
|
+
obj[prop3] = val;
|
|
37600
|
+
return obj;
|
|
37601
|
+
}, {});
|
|
37602
|
+
var fd2 = parseInt(process.env.DEBUG_FD, 10) || 2;
|
|
37603
|
+
if (fd2 !== 1 && fd2 !== 2) {
|
|
37604
|
+
util.deprecate(function() {}, "except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();
|
|
37605
|
+
}
|
|
37606
|
+
var stream = fd2 === 1 ? process.stdout : fd2 === 2 ? process.stderr : createWritableStdioStream(fd2);
|
|
37607
|
+
function useColors() {
|
|
37608
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(fd2);
|
|
37609
|
+
}
|
|
37610
|
+
exports.formatters.o = function(v) {
|
|
37611
|
+
this.inspectOpts.colors = this.useColors;
|
|
37612
|
+
return util.inspect(v, this.inspectOpts).split(`
|
|
37613
|
+
`).map(function(str) {
|
|
37614
|
+
return str.trim();
|
|
37615
|
+
}).join(" ");
|
|
37616
|
+
};
|
|
37617
|
+
exports.formatters.O = function(v) {
|
|
37618
|
+
this.inspectOpts.colors = this.useColors;
|
|
37619
|
+
return util.inspect(v, this.inspectOpts);
|
|
37620
|
+
};
|
|
37621
|
+
function formatArgs(args) {
|
|
37622
|
+
var name = this.namespace;
|
|
37623
|
+
var useColors2 = this.useColors;
|
|
37624
|
+
if (useColors2) {
|
|
37625
|
+
var c = this.color;
|
|
37626
|
+
var prefix = " \x1B[3" + c + ";1m" + name + " " + "\x1B[0m";
|
|
37627
|
+
args[0] = prefix + args[0].split(`
|
|
37628
|
+
`).join(`
|
|
37629
|
+
` + prefix);
|
|
37630
|
+
args.push("\x1B[3" + c + "m+" + exports.humanize(this.diff) + "\x1B[0m");
|
|
37631
|
+
} else {
|
|
37632
|
+
args[0] = new Date().toUTCString() + " " + name + " " + args[0];
|
|
37633
|
+
}
|
|
37634
|
+
}
|
|
37635
|
+
function log() {
|
|
37636
|
+
return stream.write(util.format.apply(util, arguments) + `
|
|
37637
|
+
`);
|
|
37638
|
+
}
|
|
37639
|
+
function save(namespaces) {
|
|
37640
|
+
if (namespaces == null) {
|
|
37641
|
+
delete process.env.DEBUG;
|
|
37642
|
+
} else {
|
|
37643
|
+
process.env.DEBUG = namespaces;
|
|
37644
|
+
}
|
|
37645
|
+
}
|
|
37646
|
+
function load() {
|
|
37647
|
+
return process.env.DEBUG;
|
|
37648
|
+
}
|
|
37649
|
+
function createWritableStdioStream(fd3) {
|
|
37650
|
+
var stream2;
|
|
37651
|
+
var tty_wrap = process.binding("tty_wrap");
|
|
37652
|
+
switch (tty_wrap.guessHandleType(fd3)) {
|
|
37653
|
+
case "TTY":
|
|
37654
|
+
stream2 = new tty.WriteStream(fd3);
|
|
37655
|
+
stream2._type = "tty";
|
|
37656
|
+
if (stream2._handle && stream2._handle.unref) {
|
|
37657
|
+
stream2._handle.unref();
|
|
37658
|
+
}
|
|
37659
|
+
break;
|
|
37660
|
+
case "FILE":
|
|
37661
|
+
var fs = __require("fs");
|
|
37662
|
+
stream2 = new fs.SyncWriteStream(fd3, { autoClose: false });
|
|
37663
|
+
stream2._type = "fs";
|
|
37664
|
+
break;
|
|
37665
|
+
case "PIPE":
|
|
37666
|
+
case "TCP":
|
|
37667
|
+
var net = __require("net");
|
|
37668
|
+
stream2 = new net.Socket({
|
|
37669
|
+
fd: fd3,
|
|
37670
|
+
readable: false,
|
|
37671
|
+
writable: true
|
|
37672
|
+
});
|
|
37673
|
+
stream2.readable = false;
|
|
37674
|
+
stream2.read = null;
|
|
37675
|
+
stream2._type = "pipe";
|
|
37676
|
+
if (stream2._handle && stream2._handle.unref) {
|
|
37677
|
+
stream2._handle.unref();
|
|
37678
|
+
}
|
|
37679
|
+
break;
|
|
37680
|
+
default:
|
|
37681
|
+
throw new Error("Implement me. Unknown stream file type!");
|
|
37682
|
+
}
|
|
37683
|
+
stream2.fd = fd3;
|
|
37684
|
+
stream2._isStdio = true;
|
|
37685
|
+
return stream2;
|
|
37686
|
+
}
|
|
37687
|
+
function init(debug) {
|
|
37688
|
+
debug.inspectOpts = {};
|
|
37689
|
+
var keys2 = Object.keys(exports.inspectOpts);
|
|
37690
|
+
for (var i2 = 0;i2 < keys2.length; i2++) {
|
|
37691
|
+
debug.inspectOpts[keys2[i2]] = exports.inspectOpts[keys2[i2]];
|
|
37692
|
+
}
|
|
37693
|
+
}
|
|
37694
|
+
exports.enable(load());
|
|
37695
|
+
});
|
|
37696
|
+
|
|
37697
|
+
// node_modules/debug/src/index.js
|
|
37698
|
+
var require_src4 = __commonJS((exports, module) => {
|
|
37699
|
+
if (typeof process !== "undefined" && process.type === "renderer") {
|
|
37700
|
+
module.exports = require_browser();
|
|
37701
|
+
} else {
|
|
37702
|
+
module.exports = require_node();
|
|
37703
|
+
}
|
|
37704
|
+
});
|
|
37705
|
+
|
|
37706
|
+
// node_modules/follow-redirects/debug.js
|
|
37707
|
+
var require_debug2 = __commonJS((exports, module) => {
|
|
37292
37708
|
var debug;
|
|
37293
37709
|
module.exports = function() {
|
|
37294
37710
|
if (!debug) {
|
|
37295
37711
|
try {
|
|
37296
|
-
debug = (
|
|
37712
|
+
debug = require_src4()("follow-redirects");
|
|
37297
37713
|
} catch (error) {}
|
|
37298
37714
|
if (typeof debug !== "function") {
|
|
37299
37715
|
debug = function() {};
|
|
@@ -37311,7 +37727,7 @@ var require_follow_redirects = __commonJS((exports, module) => {
|
|
|
37311
37727
|
var https = __require("https");
|
|
37312
37728
|
var Writable = __require("stream").Writable;
|
|
37313
37729
|
var assert4 = __require("assert");
|
|
37314
|
-
var debug =
|
|
37730
|
+
var debug = require_debug2();
|
|
37315
37731
|
(function detectUnsupportedEnvironment() {
|
|
37316
37732
|
var looksLikeNode = typeof process !== "undefined";
|
|
37317
37733
|
var looksLikeBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -289725,9 +290141,8 @@ function validateOrder(policy, fromToken, toToken, amount, broker) {
|
|
|
289725
290141
|
// src/server.ts
|
|
289726
290142
|
var grpc = __toESM(require_src3(), 1);
|
|
289727
290143
|
var protoLoader = __toESM(require_src2(), 1);
|
|
289728
|
-
import path from "path";
|
|
289729
290144
|
|
|
289730
|
-
// proto/
|
|
290145
|
+
// proto/cex_broker/Action.ts
|
|
289731
290146
|
var Action = {
|
|
289732
290147
|
NoAction: 0,
|
|
289733
290148
|
Deposit: 1,
|
|
@@ -289739,7 +290154,7 @@ var Action = {
|
|
|
289739
290154
|
FetchDepositAddresses: 7
|
|
289740
290155
|
};
|
|
289741
290156
|
|
|
289742
|
-
// proto/
|
|
290157
|
+
// proto/cex_broker/SubscriptionType.ts
|
|
289743
290158
|
var SubscriptionType = {
|
|
289744
290159
|
ORDERBOOK: 0,
|
|
289745
290160
|
TRADES: 1,
|
|
@@ -289751,14 +290166,13 @@ var SubscriptionType = {
|
|
|
289751
290166
|
|
|
289752
290167
|
// src/server.ts
|
|
289753
290168
|
var import_joi2 = __toESM(require_lib4(), 1);
|
|
289754
|
-
var
|
|
289755
|
-
var
|
|
289756
|
-
var packageDef = protoLoader.loadSync(path.resolve(__dirname, PROTO_FILE));
|
|
290169
|
+
var PROTO_FILE = "./proto/node.proto";
|
|
290170
|
+
var packageDef = protoLoader.loadSync(PROTO_FILE);
|
|
289757
290171
|
var grpcObj = grpc.loadPackageDefinition(packageDef);
|
|
289758
|
-
var cexNode = grpcObj.
|
|
290172
|
+
var cexNode = grpcObj.cex_broker;
|
|
289759
290173
|
function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
289760
290174
|
const server = new grpc.Server;
|
|
289761
|
-
server.addService(cexNode.
|
|
290175
|
+
server.addService(cexNode.cex_service.service, {
|
|
289762
290176
|
ExecuteAction: async (call, callback) => {
|
|
289763
290177
|
if (!authenticateRequest(call, whitelistIps)) {
|
|
289764
290178
|
return callback({
|
|
@@ -289786,7 +290200,9 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289786
290200
|
const transactionSchema = import_joi2.default.object({
|
|
289787
290201
|
recipientAddress: import_joi2.default.string().required(),
|
|
289788
290202
|
amount: import_joi2.default.number().positive().required(),
|
|
289789
|
-
transactionHash: import_joi2.default.string().required()
|
|
290203
|
+
transactionHash: import_joi2.default.string().required(),
|
|
290204
|
+
since: import_joi2.default.number(),
|
|
290205
|
+
params: import_joi2.default.object().pattern(import_joi2.default.string(), import_joi2.default.string()).default({})
|
|
289790
290206
|
});
|
|
289791
290207
|
const { value, error } = transactionSchema.validate(call.request.payload ?? {});
|
|
289792
290208
|
if (error) {
|
|
@@ -289796,7 +290212,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289796
290212
|
}, null);
|
|
289797
290213
|
}
|
|
289798
290214
|
try {
|
|
289799
|
-
const deposits = await broker.fetchDeposits(symbol, 50);
|
|
290215
|
+
const deposits = await broker.fetchDeposits(symbol, value.since, 50, { ...value.params ?? {} });
|
|
289800
290216
|
const deposit = deposits.find((deposit2) => deposit2.id === value.transactionHash || deposit2.txid === value.transactionHash);
|
|
289801
290217
|
if (deposit) {
|
|
289802
290218
|
log.info(`Amount ${value.amount} at ${value.transactionHash} . Paid to ${value.recipientAddress}`);
|
|
@@ -289819,7 +290235,8 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289819
290235
|
}
|
|
289820
290236
|
case Action.FetchDepositAddresses: {
|
|
289821
290237
|
const fetchDepositAddressesSchema = import_joi2.default.object({
|
|
289822
|
-
chain: import_joi2.default.string().required()
|
|
290238
|
+
chain: import_joi2.default.string().required(),
|
|
290239
|
+
params: import_joi2.default.object().pattern(import_joi2.default.string(), import_joi2.default.string()).default({})
|
|
289823
290240
|
});
|
|
289824
290241
|
const {
|
|
289825
290242
|
value: fetchDepositAddresses,
|
|
@@ -289833,9 +290250,11 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289833
290250
|
}
|
|
289834
290251
|
try {
|
|
289835
290252
|
const depositAddresses = broker.has.fetchDepositAddress === true ? await broker.fetchDepositAddress(symbol, {
|
|
289836
|
-
network: fetchDepositAddresses.chain
|
|
290253
|
+
network: fetchDepositAddresses.chain,
|
|
290254
|
+
...fetchDepositAddresses.params ?? {}
|
|
289837
290255
|
}) : await broker.fetchDepositAddressesByNetwork(symbol, {
|
|
289838
|
-
network: fetchDepositAddresses.chain
|
|
290256
|
+
network: fetchDepositAddresses.chain,
|
|
290257
|
+
...fetchDepositAddresses.params ?? {}
|
|
289839
290258
|
});
|
|
289840
290259
|
if (depositAddresses) {
|
|
289841
290260
|
return callback(null, {
|
|
@@ -289860,7 +290279,8 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289860
290279
|
const transferSchema = import_joi2.default.object({
|
|
289861
290280
|
recipientAddress: import_joi2.default.string().required(),
|
|
289862
290281
|
amount: import_joi2.default.number().positive().required(),
|
|
289863
|
-
chain: import_joi2.default.string().required()
|
|
290282
|
+
chain: import_joi2.default.string().required(),
|
|
290283
|
+
params: import_joi2.default.object().pattern(import_joi2.default.string(), import_joi2.default.string()).default({})
|
|
289864
290284
|
});
|
|
289865
290285
|
const { value: transferValue, error: transferError } = transferSchema.validate(call.request.payload ?? {});
|
|
289866
290286
|
if (transferError) {
|
|
@@ -289905,7 +290325,8 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289905
290325
|
amount: import_joi2.default.number().positive().required(),
|
|
289906
290326
|
fromToken: import_joi2.default.string().required(),
|
|
289907
290327
|
toToken: import_joi2.default.string().required(),
|
|
289908
|
-
price: import_joi2.default.number().positive().required()
|
|
290328
|
+
price: import_joi2.default.number().positive().required(),
|
|
290329
|
+
params: import_joi2.default.object().pattern(import_joi2.default.string(), import_joi2.default.string()).default({})
|
|
289909
290330
|
});
|
|
289910
290331
|
const { value: orderValue, error: orderError } = createOrderSchema.validate(call.request.payload ?? {});
|
|
289911
290332
|
if (orderError) {
|
|
@@ -289931,7 +290352,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289931
290352
|
message: `Invalid CEX key: ${cex3}. Supported keys: ${Object.keys(brokers).join(", ")}`
|
|
289932
290353
|
}, null);
|
|
289933
290354
|
}
|
|
289934
|
-
const order = await broker.createOrder(symbol2, orderValue.orderType, from === orderValue.fromToken ? "sell" : "buy", Number(orderValue.amount), Number(orderValue.price));
|
|
290355
|
+
const order = await broker.createOrder(symbol2, orderValue.orderType, from === orderValue.fromToken ? "sell" : "buy", Number(orderValue.amount), Number(orderValue.price), orderValue.params ?? {});
|
|
289935
290356
|
callback(null, { result: JSON.stringify({ ...order }) });
|
|
289936
290357
|
} catch (error) {
|
|
289937
290358
|
log.error({ error });
|
|
@@ -289944,7 +290365,8 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289944
290365
|
}
|
|
289945
290366
|
case Action.GetOrderDetails: {
|
|
289946
290367
|
const getOrderSchema = import_joi2.default.object({
|
|
289947
|
-
orderId: import_joi2.default.string().required()
|
|
290368
|
+
orderId: import_joi2.default.string().required(),
|
|
290369
|
+
params: import_joi2.default.object().pattern(import_joi2.default.string(), import_joi2.default.string()).default({})
|
|
289948
290370
|
});
|
|
289949
290371
|
const { value: getOrderValue, error: getOrderError } = getOrderSchema.validate(call.request.payload ?? {});
|
|
289950
290372
|
if (getOrderError) {
|
|
@@ -289960,7 +290382,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289960
290382
|
message: `Invalid CEX key: ${cex3}. Supported keys: ${Object.keys(brokers).join(", ")}`
|
|
289961
290383
|
}, null);
|
|
289962
290384
|
}
|
|
289963
|
-
const orderDetails = await broker.fetchOrder(getOrderValue.orderId);
|
|
290385
|
+
const orderDetails = await broker.fetchOrder(getOrderValue.orderId, { ...getOrderValue.params });
|
|
289964
290386
|
callback(null, {
|
|
289965
290387
|
result: JSON.stringify({
|
|
289966
290388
|
orderId: orderDetails.id,
|
|
@@ -289983,7 +290405,8 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289983
290405
|
}
|
|
289984
290406
|
case Action.CancelOrder: {
|
|
289985
290407
|
const cancelOrderSchema = import_joi2.default.object({
|
|
289986
|
-
orderId: import_joi2.default.string().required()
|
|
290408
|
+
orderId: import_joi2.default.string().required(),
|
|
290409
|
+
params: import_joi2.default.object().pattern(import_joi2.default.string(), import_joi2.default.string()).default({})
|
|
289987
290410
|
});
|
|
289988
290411
|
const { value: cancelOrderValue, error: cancelOrderError } = cancelOrderSchema.validate(call.request.payload ?? {});
|
|
289989
290412
|
if (cancelOrderError) {
|
|
@@ -289992,7 +290415,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
289992
290415
|
message: `ValidationError: ${cancelOrderError.message}`
|
|
289993
290416
|
}, null);
|
|
289994
290417
|
}
|
|
289995
|
-
const cancelledOrder = await broker.cancelOrder(cancelOrderValue.orderId);
|
|
290418
|
+
const cancelledOrder = await broker.cancelOrder(cancelOrderValue.orderId, cancelOrderValue.params ?? {});
|
|
289996
290419
|
callback(null, {
|
|
289997
290420
|
result: JSON.stringify({ ...cancelledOrder })
|
|
289998
290421
|
});
|
|
@@ -290000,7 +290423,9 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
|
|
|
290000
290423
|
}
|
|
290001
290424
|
case Action.FetchBalance:
|
|
290002
290425
|
try {
|
|
290003
|
-
const balance = await broker.fetchFreeBalance(
|
|
290426
|
+
const balance = await broker.fetchFreeBalance({
|
|
290427
|
+
...call.request.payload ?? {}
|
|
290428
|
+
});
|
|
290004
290429
|
const currencyBalance = balance[symbol];
|
|
290005
290430
|
callback(null, {
|
|
290006
290431
|
result: useVerity ? broker.last_proof : JSON.stringify({
|
|
@@ -290426,7 +290851,7 @@ class CEXBroker {
|
|
|
290426
290851
|
apiKey: sec.apiKey,
|
|
290427
290852
|
apiSecret: sec.apiSecret
|
|
290428
290853
|
};
|
|
290429
|
-
|
|
290854
|
+
const exchange = new ExchangeClass({
|
|
290430
290855
|
apiKey: sec.apiKey,
|
|
290431
290856
|
secret: sec.apiSecret,
|
|
290432
290857
|
enableRateLimit: true,
|
|
@@ -290439,6 +290864,7 @@ class CEXBroker {
|
|
|
290439
290864
|
recvWindow: 60000
|
|
290440
290865
|
}
|
|
290441
290866
|
});
|
|
290867
|
+
secondaryBrokers[+index2] = exchange;
|
|
290442
290868
|
} else {
|
|
290443
290869
|
log.warn(`⚠️ Incomplete secondary credentials for broker "${broker}" at index ${index2}`);
|
|
290444
290870
|
}
|