@usherlabs/cex-broker 0.1.18 → 0.1.19

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.
@@ -73684,6 +73684,7 @@ var urlToMethodMap = {
73684
73684
  "https://contract.mexc.com/api/v1/contract/funding_rate/": "fetchFundingInterval",
73685
73685
  "https://contract.mexc.com/api/v1/private/position/list/history_positions": "fetchPositionsHistory",
73686
73686
  "https://api.mexc.com/api/v3/capital/withdraw": "withdraw",
73687
+ "https://api.mexc.com/api/v3/uid": "fetchAccountId",
73687
73688
  "https://contract.mexc.com/api/v1/private/position/change_leverage": "setMarginMode"
73688
73689
  },
73689
73690
  onetrading: {
@@ -74451,6 +74452,7 @@ var urlToMethodMap = {
74451
74452
  "https://testnet.binancefuture.com/sapi/v1/lending/union/account": "fetchBalance",
74452
74453
  "https://testnet.binancefuture.com/sapi/v1/asset/get-funding-asset": "fetchBalance",
74453
74454
  "https://api.binance.com/sapi/v1/margin/isolated/account": "fetchBalance",
74455
+ "https://api.binance.com/api/v5/user/query-api": "fetchAccountId",
74454
74456
  "https://papi.binance.com/papi/v1/balance": "fetchBalance",
74455
74457
  "https://api.binance.com/api/v3/myTrades": "fetchOrderTrades",
74456
74458
  "https://testnet.binancefuture.com/fapi/v1/userTrades": "fetchMyTrades",
@@ -74877,7 +74879,9 @@ var urlToMethodMap = {
74877
74879
  "https://api-testnet.bybit.com/v5/spot-margin-trade/interest-rate-history": "fetchBorrowRateHistory",
74878
74880
  "https://api-testnet.bybit.com/v5/market/open-interest": "fetchOpenInterest",
74879
74881
  "https://api-testnet.bybit.com/v5/asset/deposit/query-address": "fetchDepositAddressesByNetwork",
74880
- "https://api.bybit.com/v5/asset/deposit/query-address": "fetchDepositAddressesByNetwork"
74882
+ "https://api.bybit.com/v5/asset/deposit/query-address": "fetchDepositAddressesByNetwork",
74883
+ "https://api.bybit.com/v5/user/query-api": "fetchAccountId",
74884
+ "https://api-testnet.bybit.com/v5/user/query-api": "fetchAccountId"
74881
74885
  },
74882
74886
  cryptomus: {
74883
74887
  "https://api.cryptomus.com/v2/user-api/exchange/account/tariffs": "fetchTradingFees",
@@ -203694,6 +203698,7 @@ class mexc extends mexc_default {
203694
203698
  account: 10,
203695
203699
  myTrades: 10,
203696
203700
  tradeFee: 10,
203701
+ uid: 1,
203697
203702
  "sub-account/list": 1,
203698
203703
  "sub-account/apiKey": 1,
203699
203704
  "capital/config/getall": 10,
@@ -291309,7 +291314,7 @@ class xt2 extends xt {
291309
291314
  }
291310
291315
 
291311
291316
  // node_modules/@usherlabs/ccxt/js/ccxt.js
291312
- var version2 = "0.0.12";
291317
+ var version2 = "0.0.13";
291313
291318
  Exchange.ccxtVersion = version2;
291314
291319
  var exchanges = {
291315
291320
  alpaca,
@@ -292083,7 +292088,8 @@ var CCXT_METHODS_WITH_VERITY = [
292083
292088
  "withdraw",
292084
292089
  "fetchFundingHistory",
292085
292090
  "fetchWithdrawals",
292086
- "fetchWithdrawal"
292091
+ "fetchWithdrawal",
292092
+ "fetchAccountId"
292087
292093
  ];
292088
292094
 
292089
292095
  // src/helpers/index.ts
@@ -292339,7 +292345,8 @@ var Action = {
292339
292345
  FetchDepositAddresses: 7,
292340
292346
  FetchTicker: 8,
292341
292347
  FetchCurrency: 9,
292342
- Call: 10
292348
+ Call: 10,
292349
+ FetchAccountId: 11
292343
292350
  };
292344
292351
 
292345
292352
  // src/proto/cex_broker/SubscriptionType.ts
@@ -292471,7 +292478,8 @@ var descriptor = {
292471
292478
  FetchDepositAddresses: 7,
292472
292479
  FetchTicker: 8,
292473
292480
  FetchCurrency: 9,
292474
- Call: 10
292481
+ Call: 10,
292482
+ FetchAccountId: 11
292475
292483
  }
292476
292484
  }
292477
292485
  }
@@ -292590,6 +292598,45 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
292590
292598
  }
292591
292599
  break;
292592
292600
  }
292601
+ case Action.FetchAccountId: {
292602
+ try {
292603
+ let accountId;
292604
+ let uid;
292605
+ const temp_broker = broker;
292606
+ if (typeof temp_broker.privateGetV5UserQueryApi === "function") {
292607
+ const query = await temp_broker.privateGetV5UserQueryApi();
292608
+ if (!query?.id || !query?.userID) {
292609
+ throw new Error("Invalid response structure from privateGetV5UserQueryApi");
292610
+ }
292611
+ accountId = query.id;
292612
+ uid = query.userID;
292613
+ } else if (typeof temp_broker.spotPrivateGetUid === "function") {
292614
+ const query = await temp_broker.spotPrivateGetUid();
292615
+ accountId = query.uid;
292616
+ uid = query.uid;
292617
+ } else if (typeof temp_broker.privateGetAccount === "function") {
292618
+ const query = await temp_broker.privateGetAccount();
292619
+ accountId = query.uid;
292620
+ uid = query.uid;
292621
+ } else {
292622
+ return callback({
292623
+ code: grpc.status.INTERNAL,
292624
+ message: "Error: fetching account ID not supported for this broker"
292625
+ }, null);
292626
+ }
292627
+ return callback(null, {
292628
+ proof: verityProof,
292629
+ result: JSON.stringify({ accountId, uid })
292630
+ });
292631
+ } catch (error) {
292632
+ log.error(`Error fetching account ID ${cex3}:`, error);
292633
+ callback({
292634
+ code: grpc.status.INTERNAL,
292635
+ message: `Error fetching account ID from ${cex3}`
292636
+ }, null);
292637
+ }
292638
+ break;
292639
+ }
292593
292640
  case Action.Call: {
292594
292641
  const callSchema = import_joi2.default.object({
292595
292642
  functionName: import_joi2.default.string().pattern(/^[A-Za-z][A-Za-z0-9]*$/).required(),
package/dist/index.js CHANGED
@@ -47157,6 +47157,7 @@ var urlToMethodMap = {
47157
47157
  "https://contract.mexc.com/api/v1/contract/funding_rate/": "fetchFundingInterval",
47158
47158
  "https://contract.mexc.com/api/v1/private/position/list/history_positions": "fetchPositionsHistory",
47159
47159
  "https://api.mexc.com/api/v3/capital/withdraw": "withdraw",
47160
+ "https://api.mexc.com/api/v3/uid": "fetchAccountId",
47160
47161
  "https://contract.mexc.com/api/v1/private/position/change_leverage": "setMarginMode"
47161
47162
  },
47162
47163
  onetrading: {
@@ -47924,6 +47925,7 @@ var urlToMethodMap = {
47924
47925
  "https://testnet.binancefuture.com/sapi/v1/lending/union/account": "fetchBalance",
47925
47926
  "https://testnet.binancefuture.com/sapi/v1/asset/get-funding-asset": "fetchBalance",
47926
47927
  "https://api.binance.com/sapi/v1/margin/isolated/account": "fetchBalance",
47928
+ "https://api.binance.com/api/v5/user/query-api": "fetchAccountId",
47927
47929
  "https://papi.binance.com/papi/v1/balance": "fetchBalance",
47928
47930
  "https://api.binance.com/api/v3/myTrades": "fetchOrderTrades",
47929
47931
  "https://testnet.binancefuture.com/fapi/v1/userTrades": "fetchMyTrades",
@@ -48350,7 +48352,9 @@ var urlToMethodMap = {
48350
48352
  "https://api-testnet.bybit.com/v5/spot-margin-trade/interest-rate-history": "fetchBorrowRateHistory",
48351
48353
  "https://api-testnet.bybit.com/v5/market/open-interest": "fetchOpenInterest",
48352
48354
  "https://api-testnet.bybit.com/v5/asset/deposit/query-address": "fetchDepositAddressesByNetwork",
48353
- "https://api.bybit.com/v5/asset/deposit/query-address": "fetchDepositAddressesByNetwork"
48355
+ "https://api.bybit.com/v5/asset/deposit/query-address": "fetchDepositAddressesByNetwork",
48356
+ "https://api.bybit.com/v5/user/query-api": "fetchAccountId",
48357
+ "https://api-testnet.bybit.com/v5/user/query-api": "fetchAccountId"
48354
48358
  },
48355
48359
  cryptomus: {
48356
48360
  "https://api.cryptomus.com/v2/user-api/exchange/account/tariffs": "fetchTradingFees",
@@ -177167,6 +177171,7 @@ class mexc extends mexc_default {
177167
177171
  account: 10,
177168
177172
  myTrades: 10,
177169
177173
  tradeFee: 10,
177174
+ uid: 1,
177170
177175
  "sub-account/list": 1,
177171
177176
  "sub-account/apiKey": 1,
177172
177177
  "capital/config/getall": 10,
@@ -264782,7 +264787,7 @@ class xt2 extends xt {
264782
264787
  }
264783
264788
 
264784
264789
  // node_modules/@usherlabs/ccxt/js/ccxt.js
264785
- var version2 = "0.0.12";
264790
+ var version2 = "0.0.13";
264786
264791
  Exchange.ccxtVersion = version2;
264787
264792
  var exchanges = {
264788
264793
  alpaca,
@@ -265556,7 +265561,8 @@ var CCXT_METHODS_WITH_VERITY = [
265556
265561
  "withdraw",
265557
265562
  "fetchFundingHistory",
265558
265563
  "fetchWithdrawals",
265559
- "fetchWithdrawal"
265564
+ "fetchWithdrawal",
265565
+ "fetchAccountId"
265560
265566
  ];
265561
265567
 
265562
265568
  // src/helpers/index.ts
@@ -265812,7 +265818,8 @@ var Action = {
265812
265818
  FetchDepositAddresses: 7,
265813
265819
  FetchTicker: 8,
265814
265820
  FetchCurrency: 9,
265815
- Call: 10
265821
+ Call: 10,
265822
+ FetchAccountId: 11
265816
265823
  };
265817
265824
 
265818
265825
  // src/proto/cex_broker/SubscriptionType.ts
@@ -265944,7 +265951,8 @@ var descriptor = {
265944
265951
  FetchDepositAddresses: 7,
265945
265952
  FetchTicker: 8,
265946
265953
  FetchCurrency: 9,
265947
- Call: 10
265954
+ Call: 10,
265955
+ FetchAccountId: 11
265948
265956
  }
265949
265957
  }
265950
265958
  }
@@ -266063,6 +266071,45 @@ function getServer(policy, brokers, whitelistIps, useVerity, verityProverUrl) {
266063
266071
  }
266064
266072
  break;
266065
266073
  }
266074
+ case Action.FetchAccountId: {
266075
+ try {
266076
+ let accountId;
266077
+ let uid;
266078
+ const temp_broker = broker;
266079
+ if (typeof temp_broker.privateGetV5UserQueryApi === "function") {
266080
+ const query = await temp_broker.privateGetV5UserQueryApi();
266081
+ if (!query?.id || !query?.userID) {
266082
+ throw new Error("Invalid response structure from privateGetV5UserQueryApi");
266083
+ }
266084
+ accountId = query.id;
266085
+ uid = query.userID;
266086
+ } else if (typeof temp_broker.spotPrivateGetUid === "function") {
266087
+ const query = await temp_broker.spotPrivateGetUid();
266088
+ accountId = query.uid;
266089
+ uid = query.uid;
266090
+ } else if (typeof temp_broker.privateGetAccount === "function") {
266091
+ const query = await temp_broker.privateGetAccount();
266092
+ accountId = query.uid;
266093
+ uid = query.uid;
266094
+ } else {
266095
+ return callback({
266096
+ code: grpc.status.INTERNAL,
266097
+ message: "Error: fetching account ID not supported for this broker"
266098
+ }, null);
266099
+ }
266100
+ return callback(null, {
266101
+ proof: verityProof,
266102
+ result: JSON.stringify({ accountId, uid })
266103
+ });
266104
+ } catch (error) {
266105
+ log.error(`Error fetching account ID ${cex3}:`, error);
266106
+ callback({
266107
+ code: grpc.status.INTERNAL,
266108
+ message: `Error fetching account ID from ${cex3}`
266109
+ }, null);
266110
+ }
266111
+ break;
266112
+ }
266066
266113
  case Action.Call: {
266067
266114
  const callSchema = import_joi2.default.object({
266068
266115
  functionName: import_joi2.default.string().pattern(/^[A-Za-z][A-Za-z0-9]*$/).required(),
@@ -266877,4 +266924,4 @@ export {
266877
266924
  CEXBroker as default
266878
266925
  };
266879
266926
 
266880
- //# debugId=1B9C01A9C184A6CB64756E2164756E21
266927
+ //# debugId=3851C5060DAE6B2364756E2164756E21