@clonegod/ttd-sol-common 2.0.39 → 2.0.40

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.
@@ -4,5 +4,6 @@ export declare class SolanaTradeAppConfig extends AbstractTradeAppConfig {
4
4
  connection: Connection;
5
5
  keypair: Keypair;
6
6
  constructor();
7
+ init(): Promise<void>;
7
8
  subscribe_wallet_raw_txn_event(): void;
8
9
  }
@@ -5,7 +5,11 @@ const dist_1 = require("@clonegod/ttd-core/dist");
5
5
  class SolanaTradeAppConfig extends dist_1.AbstractTradeAppConfig {
6
6
  constructor() {
7
7
  super();
8
+ }
9
+ async init() {
10
+ await super.init();
8
11
  this.subscribe_wallet_raw_txn_event();
12
+ (0, dist_1.log_info)('SolanaTradeAppConfig init ...');
9
13
  }
10
14
  subscribe_wallet_raw_txn_event() {
11
15
  const transactionHandler = async (messageStr) => {
@@ -18,7 +22,7 @@ class SolanaTradeAppConfig extends dist_1.AbstractTradeAppConfig {
18
22
  this.emit(dist_1.LOCAL_EVENT_NAME.EVENT_WALLET_TRANSACTION + '#' + tx_id, messageObj);
19
23
  };
20
24
  const ws_port = process.env.STREAM_WS_TRADE_PORT || 10002;
21
- const ws = new dist_1.WebSocketClient(`ws://localhost:${ws_port}`);
25
+ const ws = new dist_1.WebSocketClient(`ws://127.0.0.1:${ws_port}`);
22
26
  ws.onMessage(transactionHandler);
23
27
  ws.connect();
24
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "2.0.39",
3
+ "version": "2.0.40",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -6,12 +6,16 @@ export class SolanaTradeAppConfig extends AbstractTradeAppConfig {
6
6
  // 子类需要设置的属性
7
7
  public connection: Connection;
8
8
  public keypair: Keypair;
9
-
9
+
10
10
  constructor() {
11
11
  super();
12
- this.subscribe_wallet_raw_txn_event();
13
12
  }
14
13
 
14
+ async init() {
15
+ await super.init();
16
+ this.subscribe_wallet_raw_txn_event();
17
+ log_info('SolanaTradeAppConfig init ...');
18
+ }
15
19
 
16
20
  // 订阅 Wallet 在链上发生的tx data
17
21
  subscribe_wallet_raw_txn_event(): void {
@@ -30,7 +34,7 @@ export class SolanaTradeAppConfig extends AbstractTradeAppConfig {
30
34
  };
31
35
 
32
36
  const ws_port = process.env.STREAM_WS_TRADE_PORT || 10002;
33
- const ws = new WebSocketClient(`ws://localhost:${ws_port}`)
37
+ const ws = new WebSocketClient(`ws://127.0.0.1:${ws_port}`)
34
38
  ws.onMessage(transactionHandler);
35
39
  ws.connect();
36
40
 
@@ -39,7 +43,6 @@ export class SolanaTradeAppConfig extends AbstractTradeAppConfig {
39
43
  }
40
44
 
41
45
 
42
-
43
46
  }
44
47
 
45
48