@gbozee/ultimate 0.0.2-26 → 0.0.2-27

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/index.d.ts CHANGED
@@ -801,10 +801,17 @@ declare class ExchangeAccount$1 {
801
801
  }
802
802
  declare class App {
803
803
  app_db: AppDatabase;
804
+ proxyOptions?: {
805
+ proxy?: any;
806
+ ignore_proxy?: boolean;
807
+ };
804
808
  private getCredentials;
805
809
  constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) => {
806
810
  api_key: string;
807
811
  api_secret: string;
812
+ }, proxyOptions?: {
813
+ proxy?: any;
814
+ ignore_proxy?: boolean;
808
815
  });
809
816
  getExchangeAccount(account: ExchangeType): Promise<ExchangeAccount$1>;
810
817
  syncAccount(payload: {
@@ -921,8 +928,14 @@ export declare function initApp(payload: {
921
928
  api_key: string;
922
929
  api_secret: string;
923
930
  };
931
+ proxy?: any;
932
+ ignore_proxy?: boolean;
933
+ }): Promise<App>;
934
+ export declare function initialize(payload: {
935
+ password?: string;
936
+ proxy?: any;
937
+ ignore_proxy?: boolean;
924
938
  }): Promise<App>;
925
- export declare function initialize(password?: string): Promise<App>;
926
939
 
927
940
  export {
928
941
  ExchangeAccount$1 as ExchangeAccount,
package/dist/index.js CHANGED
@@ -33799,16 +33799,20 @@ function createGapPairs(arr, gap, item) {
33799
33799
  async function initClient(credentials, options) {
33800
33800
  const { proxyAgent, type = "future" } = options || {};
33801
33801
  try {
33802
+ const axiosOptions = proxyAgent ? {
33803
+ httpAgent: proxyAgent,
33804
+ httpsAgent: proxyAgent
33805
+ } : undefined;
33806
+ if (!proxyAgent) {
33807
+ console.log("using no proxy");
33808
+ }
33802
33809
  const Klass = type === "future" ? import_binance.USDMClient : type === "spot" ? import_binance.MainClient : import_binance.MainClient;
33803
33810
  const client = new Klass({
33804
33811
  api_key: credentials.api_key,
33805
33812
  api_secret: credentials.api_secret,
33806
33813
  recvWindow: 1e4,
33807
33814
  beautifyResponses: true
33808
- }, {
33809
- httpAgent: proxyAgent,
33810
- httpsAgent: proxyAgent
33811
- });
33815
+ }, axiosOptions);
33812
33816
  return client;
33813
33817
  } catch (e2) {
33814
33818
  console.log(e2);
@@ -34628,14 +34632,15 @@ var import_bybit_api = __toESM(require_lib2(), 1);
34628
34632
  async function initClient2(credentials, options) {
34629
34633
  const { proxyAgent } = options;
34630
34634
  try {
34635
+ const axiosOptions = proxyAgent ? {
34636
+ httpAgent: proxyAgent,
34637
+ httpsAgent: proxyAgent
34638
+ } : undefined;
34631
34639
  const client = new import_bybit_api.RestClientV5({
34632
34640
  key: credentials.api_key,
34633
34641
  secret: credentials.api_secret,
34634
34642
  recv_window: 1e4
34635
- }, {
34636
- httpAgent: proxyAgent,
34637
- httpsAgent: proxyAgent
34638
- });
34643
+ }, axiosOptions);
34639
34644
  return client;
34640
34645
  } catch (e2) {
34641
34646
  console.log(e2);
@@ -37501,8 +37506,9 @@ function getExchangeKlass(exchange) {
37501
37506
  };
37502
37507
  }
37503
37508
  async function getExchangeAccount(payload) {
37504
- const { account, app_db } = payload;
37505
- const proxyAgent = await app_db.getProxyForAccount(account);
37509
+ const { account, app_db, proxyOptions = {} } = payload;
37510
+ const _proxyAgent = await app_db.getProxyForAccount(account);
37511
+ const proxyAgent = proxyOptions?.ignore_proxy ? null : proxyOptions?.proxy || _proxyAgent;
37506
37512
  const exchange_instance = await getExchangeKlass(account.exchange)({
37507
37513
  account: account.owner,
37508
37514
  getCredentials: payload.getCredentials,
@@ -37517,16 +37523,19 @@ async function getExchangeAccount(payload) {
37517
37523
  // src/app.ts
37518
37524
  class App {
37519
37525
  app_db;
37526
+ proxyOptions;
37520
37527
  getCredentials;
37521
- constructor(app_db, getCredentials) {
37528
+ constructor(app_db, getCredentials, proxyOptions) {
37522
37529
  this.app_db = app_db;
37523
37530
  this.getCredentials = getCredentials;
37531
+ this.proxyOptions = proxyOptions;
37524
37532
  }
37525
37533
  async getExchangeAccount(account) {
37526
37534
  return await getExchangeAccount({
37527
37535
  account,
37528
37536
  app_db: this.app_db,
37529
- getCredentials: this.getCredentials
37537
+ getCredentials: this.getCredentials,
37538
+ proxyOptions: this.proxyOptions
37530
37539
  });
37531
37540
  }
37532
37541
  async syncAccount(payload) {
@@ -37913,7 +37922,10 @@ async function initApp(payload) {
37913
37922
  console.log("error", error);
37914
37923
  }
37915
37924
  }
37916
- const app = new App(app_db, _getCredentials);
37925
+ const app = new App(app_db, _getCredentials, {
37926
+ proxy: payload.proxy,
37927
+ ignore_proxy: payload.ignore_proxy
37928
+ });
37917
37929
  return app;
37918
37930
  }
37919
37931
  function getCredentials(account, exchange) {
@@ -37951,7 +37963,8 @@ function getCredentials(account, exchange) {
37951
37963
  api_secret: apiSecret
37952
37964
  };
37953
37965
  }
37954
- async function initialize(password) {
37966
+ async function initialize(payload) {
37967
+ const { password, proxy, ignore_proxy } = payload;
37955
37968
  const app = await initApp({
37956
37969
  db: {
37957
37970
  host: process.env.POCKETBASE_HOST,
@@ -37959,7 +37972,9 @@ async function initialize(password) {
37959
37972
  password: process.env.POCKETBASE_PASSWORD
37960
37973
  },
37961
37974
  password,
37962
- getCredentials
37975
+ getCredentials,
37976
+ proxy,
37977
+ ignore_proxy
37963
37978
  });
37964
37979
  return app;
37965
37980
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-26",
4
+ "version": "0.0.2-27",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",