@clonegod/ttd-sol-common 2.0.71 → 2.0.73

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.
@@ -60,7 +60,7 @@ class SolanaTradeAppConfig extends dist_1.AbstractTradeAppConfig {
60
60
  (0, dist_1.log_info)(`Received transaction result via WebSocket: ${tx_id}`);
61
61
  this.emit(dist_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + tx_id, messageObj);
62
62
  };
63
- const ws_port = process.env.STREAM_WS_TRADE_PORT || 10002;
63
+ const ws_port = dist_1.SERVICE_PORT.STREAM_TRADE_WS;
64
64
  const ws_url = `ws://127.0.0.1:${ws_port}`;
65
65
  this.ws_client = new dist_1.WebSocketClient(ws_url);
66
66
  this.ws_client.onMessage(transactionHandler);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.subscribe_pool_account_update = subscribe_pool_account_update;
4
4
  const dist_1 = require("@clonegod/ttd-core/dist");
5
5
  function subscribe_pool_account_update(dex_id, pool_list, callback) {
6
- const port = process.env.STREAM_WS_QUOTE_PORT || 10000;
6
+ const port = dist_1.SERVICE_PORT.STREAM_QUOTE_WS;
7
7
  const ws_url = `ws://127.0.0.1:${port}`;
8
8
  const ws_client = new dist_1.WebSocketClient(ws_url);
9
9
  ws_client.onOpen(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "2.0.71",
3
+ "version": "2.0.73",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "push": "npm run build && npm publish"
14
14
  },
15
15
  "dependencies": {
16
- "@clonegod/ttd-core": "3.1.86",
16
+ "@clonegod/ttd-core": "3.1.87",
17
17
  "@solana/web3.js": "1.91.6",
18
18
  "rpc-websockets": "7.10.0",
19
19
  "axios": "^1.2.3",
@@ -16,6 +16,7 @@ import {
16
16
  LOCAL_EVENT_NAME,
17
17
  log_error,
18
18
  log_info,
19
+ SERVICE_PORT,
19
20
  sleep,
20
21
  WebSocketClient,
21
22
  } from '@clonegod/ttd-core/dist'
@@ -106,7 +107,7 @@ export class SolanaTradeAppConfig extends AbstractTradeAppConfig {
106
107
  this.emit(LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + tx_id, messageObj)
107
108
  }
108
109
 
109
- const ws_port = process.env.STREAM_WS_TRADE_PORT || 10002
110
+ const ws_port = SERVICE_PORT.STREAM_TRADE_WS
110
111
  const ws_url = `ws://127.0.0.1:${ws_port}`
111
112
  this.ws_client = new WebSocketClient(ws_url)
112
113
  this.ws_client.onMessage(transactionHandler)
@@ -1,5 +1,5 @@
1
1
  import { StandardPoolInfoType } from "@clonegod/ttd-core";
2
- import { DEX_ID, log_warn, WebSocketClient } from "@clonegod/ttd-core/dist";
2
+ import { DEX_ID, log_warn, SERVICE_PORT, WebSocketClient } from "@clonegod/ttd-core/dist";
3
3
  import { SolanaPoolAccountUpdateEventData } from "../types";
4
4
 
5
5
  /**
@@ -8,7 +8,7 @@ import { SolanaPoolAccountUpdateEventData } from "../types";
8
8
  * - 交易使用:交易中需要池子的最新状态
9
9
  */
10
10
  export function subscribe_pool_account_update(dex_id: DEX_ID, pool_list: StandardPoolInfoType[], callback: (eventData: SolanaPoolAccountUpdateEventData) => void) {
11
- const port = process.env.STREAM_WS_QUOTE_PORT || 10000;
11
+ const port = SERVICE_PORT.STREAM_QUOTE_WS;
12
12
  const ws_url = `ws://127.0.0.1:${port}`;
13
13
  const ws_client = new WebSocketClient(ws_url)
14
14
  ws_client.onOpen(() => {
@@ -9,7 +9,7 @@ import { TokenPriceCache } from './pricing/token_price_cache'
9
9
  *
10
10
  * 把「询价流程不变、链能力可换」收成一个对象:同一套 AbstractDexQuote 模板,Solana 注入 SolanaChainOps。
11
11
  * 与 SUI 的差异:
12
- * - 池事件源是 stream-quote 的 **WS 通道**(subscribe_pool_account_update,port STREAM_WS_QUOTE_PORT),
12
+ * - 池事件源是 stream-quote 的 **WS 通道**(subscribe_pool_account_update,port SERVICE_PORT.STREAM_QUOTE_WS),
13
13
  * 推送的是**账户原始快照**(base64),非结构化 swap 事件(详见 pool_event.ts)。
14
14
  * - assertProgramDeployed 用 connection.getAccountInfo + executable 校验(Solana 无 eth_getCode)。
15
15
  * - Solana 地址是 base58 **大小写敏感**,loadTokenPrices 用原地址作 key(不可 lowercase)。