@usherlabs/cex-broker 0.1.4 → 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.
@@ -290141,9 +290141,8 @@ function validateOrder(policy, fromToken, toToken, amount, broker) {
290141
290141
  // src/server.ts
290142
290142
  var grpc = __toESM(require_src3(), 1);
290143
290143
  var protoLoader = __toESM(require_src2(), 1);
290144
- import path from "path";
290145
290144
 
290146
- // proto/cexBroker/Action.ts
290145
+ // proto/cex_broker/Action.ts
290147
290146
  var Action = {
290148
290147
  NoAction: 0,
290149
290148
  Deposit: 1,
@@ -290155,7 +290154,7 @@ var Action = {
290155
290154
  FetchDepositAddresses: 7
290156
290155
  };
290157
290156
 
290158
- // proto/cexBroker/SubscriptionType.ts
290157
+ // proto/cex_broker/SubscriptionType.ts
290159
290158
  var SubscriptionType = {
290160
290159
  ORDERBOOK: 0,
290161
290160
  TRADES: 1,
@@ -290167,14 +290166,13 @@ var SubscriptionType = {
290167
290166
 
290168
290167
  // src/server.ts
290169
290168
  var import_joi2 = __toESM(require_lib4(), 1);
290170
- var __dirname = "/home/runner/work/cex-broker/cex-broker/src";
290171
- var PROTO_FILE = "../proto/node.proto";
290172
- var packageDef = protoLoader.loadSync(path.resolve(__dirname, PROTO_FILE));
290169
+ var PROTO_FILE = "./proto/node.proto";
290170
+ var packageDef = protoLoader.loadSync(PROTO_FILE);
290173
290171
  var grpcObj = grpc.loadPackageDefinition(packageDef);
290174
- var cexNode = grpcObj.cexBroker;
290172
+ var cexNode = grpcObj.cex_broker;
290175
290173
  function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
290176
290174
  const server = new grpc.Server;
290177
- server.addService(cexNode.CexService.service, {
290175
+ server.addService(cexNode.cex_service.service, {
290178
290176
  ExecuteAction: async (call, callback) => {
290179
290177
  if (!authenticateRequest(call, whitelistIps)) {
290180
290178
  return callback({
@@ -290354,9 +290352,7 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
290354
290352
  message: `Invalid CEX key: ${cex3}. Supported keys: ${Object.keys(brokers).join(", ")}`
290355
290353
  }, null);
290356
290354
  }
290357
- const order = await broker.createOrder(symbol2, orderValue.orderType, from === orderValue.fromToken ? "sell" : "buy", Number(orderValue.amount), Number(orderValue.price), {
290358
- ...orderValue.params
290359
- });
290355
+ const order = await broker.createOrder(symbol2, orderValue.orderType, from === orderValue.fromToken ? "sell" : "buy", Number(orderValue.amount), Number(orderValue.price), orderValue.params ?? {});
290360
290356
  callback(null, { result: JSON.stringify({ ...order }) });
290361
290357
  } catch (error) {
290362
290358
  log.error({ error });
@@ -290855,7 +290851,7 @@ class CEXBroker {
290855
290851
  apiKey: sec.apiKey,
290856
290852
  apiSecret: sec.apiSecret
290857
290853
  };
290858
- secondaryBrokers[+index2] = new ExchangeClass({
290854
+ const exchange = new ExchangeClass({
290859
290855
  apiKey: sec.apiKey,
290860
290856
  secret: sec.apiSecret,
290861
290857
  enableRateLimit: true,
@@ -290868,6 +290864,7 @@ class CEXBroker {
290868
290864
  recvWindow: 60000
290869
290865
  }
290870
290866
  });
290867
+ secondaryBrokers[+index2] = exchange;
290871
290868
  } else {
290872
290869
  log.warn(`⚠️ Incomplete secondary credentials for broker "${broker}" at index ${index2}`);
290873
290870
  }