@clonegod/ttd-sol-common 1.0.59 → 1.0.61

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.
@@ -2,6 +2,7 @@ import { OrderMessageType, PriceMessageType, StandardPoolInfoType, TradeRuntimeT
2
2
  import { CHAIN_ID, DEX_ID } from "@clonegod/ttd-common/dist";
3
3
  import { Connection } from "@solana/web3.js";
4
4
  import { SolanaTradeRuntimeType } from "../../types";
5
+ import { AppConfig } from "../appconfig";
5
6
  export declare class TradeContext {
6
7
  connection: Connection;
7
8
  trade_runtime: TradeRuntimeType;
@@ -18,5 +19,5 @@ export declare class TradeContext {
18
19
  aToB: boolean;
19
20
  slippage_bps: number;
20
21
  constructor(price_msg: PriceMessageType, order_msg: OrderMessageType);
21
- init(connection: Connection, trade_runtime: TradeRuntimeType): Promise<void>;
22
+ init(appConfig: AppConfig): Promise<void>;
22
23
  }
@@ -18,10 +18,10 @@ class TradeContext {
18
18
  this.order_msg = order_msg;
19
19
  this.order_trace_id = order_msg.order_trace_id;
20
20
  }
21
- init(connection, trade_runtime) {
21
+ init(appConfig) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
- this.connection = connection;
24
- this.trade_runtime = trade_runtime;
23
+ this.connection = appConfig.connection;
24
+ this.trade_runtime = appConfig.trade_runtime;
25
25
  let { group_id, unique_orderbook_id } = this.order_msg;
26
26
  this.group_id = group_id;
27
27
  let unique_orderbook_id_obj = (0, dist_1.parse_unique_orderbook_id)(unique_orderbook_id);
@@ -29,7 +29,7 @@ class TradeContext {
29
29
  this.dex_id = dist_1.DEX_ID[unique_orderbook_id_obj.dex_id];
30
30
  this.pool_id = unique_orderbook_id_obj.pool_id;
31
31
  this.fee_rate = unique_orderbook_id_obj.fee_rate;
32
- this.pool_info = this.trade_runtime.pair_dex.pool_info_list.find(e => e.pool_address === this.pool_id);
32
+ this.pool_info = yield appConfig.arb_cache.get_one_pool_info(this.pool_id);
33
33
  if (!this.pool_info) {
34
34
  throw new Error(`Not found pool_info! pool_id=${this.pool_id}, pool_info_list=${JSON.stringify(this.trade_runtime.pair_dex.pool_info_list)}`);
35
35
  }
@@ -13,7 +13,7 @@ function create_solana_trade_runtime(connection, trade_runtime, pool_info) {
13
13
  let cu_price = Math.ceil(priority_fee * constants_1.ONE_MILLION / cu_limit);
14
14
  let jito_plugin_url = '';
15
15
  if (use_jito_plugin) {
16
- jito_plugin_url = process.env.QUICKNODE_JITO_PLUGIN_URL;
16
+ jito_plugin_url = process.env.JITO_PLUGIN_URL;
17
17
  }
18
18
  (0, dist_1.log_info)(`trade_strategy & gas`, {
19
19
  trade_strategy,
@@ -84,9 +84,9 @@ const handle_order_message = (appConfig, trade, message) => __awaiter(void 0, vo
84
84
  let txid = '';
85
85
  let order_submit_result;
86
86
  try {
87
- let { env_args, trade_runtime, connection } = appConfig;
88
87
  context = new common_1.TradeContext(price_msg, order_msg);
89
- yield context.init(connection, trade_runtime);
88
+ let { env_args } = appConfig;
89
+ yield context.init(appConfig);
90
90
  txid = yield trade.execute(context);
91
91
  order_msg.order_submit_time = Date.now();
92
92
  order_submit_result = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "push": "npm run build && npm publish"
14
14
  },
15
15
  "dependencies": {
16
- "@clonegod/ttd-common": "^1.0.150",
16
+ "@clonegod/ttd-common": "^1.0.151",
17
17
  "@irys/sdk": "^0.2.10",
18
18
  "@metaplex-foundation/mpl-token-metadata": "^2.5.2",
19
19
  "@solana/web3.js": "1.91.6",