@clonegod/ttd-sol-common 2.0.33 → 2.0.35

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.
@@ -6,8 +6,8 @@ function subscribe_pool_account_update(dex_id, pool_list, callback) {
6
6
  const ws_url = process.env.SUBSCIBE_MULTIPLE_PROVIDERS_WS_URL || 'ws://127.0.0.1:10000';
7
7
  const ws_client = new dist_1.WebSocketClient(ws_url);
8
8
  ws_client.onOpen(() => {
9
- pool_list.forEach(({ pair, pool_address }, _) => {
10
- ws_client.send(JSON.stringify({ dex_id, pair, pool_address }));
9
+ pool_list.forEach(({ pool_name, pool_address }, _) => {
10
+ ws_client.send(JSON.stringify({ dex_id, pool_name, pool_address }));
11
11
  });
12
12
  });
13
13
  ws_client.onMessage(((eventData) => {
@@ -1,3 +1,8 @@
1
+ export declare enum SolanaPoolAccountType {
2
+ POOL = "pool",
3
+ VAULT_A = "vaultA",
4
+ VAULT_B = "vaultB"
5
+ }
1
6
  export interface SolanaAccountUpdateEvent {
2
7
  recvTimeMs: number;
3
8
  providerId: string;
@@ -8,6 +13,7 @@ export interface SolanaAccountUpdateEvent {
8
13
  dexId: string;
9
14
  poolAddress: string;
10
15
  poolName: string;
16
+ accountType: SolanaPoolAccountType;
11
17
  accountData?: Buffer | string;
12
18
  }
13
19
  export interface SolanaBlockMetaUpdateEvent {
@@ -33,7 +39,7 @@ export interface SolanaPoolAccountUpdateEventData {
33
39
  pool_account_data: string;
34
40
  vaultA_account?: string;
35
41
  vaultA_account_data?: string;
36
- vaultB?: string;
42
+ vaultB_account?: string;
37
43
  vaultB_account_data?: string;
38
44
  };
39
45
  }
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolanaPoolAccountType = void 0;
4
+ var SolanaPoolAccountType;
5
+ (function (SolanaPoolAccountType) {
6
+ SolanaPoolAccountType["POOL"] = "pool";
7
+ SolanaPoolAccountType["VAULT_A"] = "vaultA";
8
+ SolanaPoolAccountType["VAULT_B"] = "vaultB";
9
+ })(SolanaPoolAccountType || (exports.SolanaPoolAccountType = SolanaPoolAccountType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "2.0.33",
3
+ "version": "2.0.35",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -11,8 +11,8 @@ export function subscribe_pool_account_update(dex_id: DEX_ID, pool_list: Standar
11
11
  const ws_url = process.env.SUBSCIBE_MULTIPLE_PROVIDERS_WS_URL || 'ws://127.0.0.1:10000';
12
12
  const ws_client = new WebSocketClient(ws_url)
13
13
  ws_client.onOpen(() => {
14
- pool_list.forEach(({ pair, pool_address }, _) => {
15
- ws_client.send(JSON.stringify({ dex_id, pair, pool_address }))
14
+ pool_list.forEach(({ pool_name, pool_address }, _) => {
15
+ ws_client.send(JSON.stringify({ dex_id, pool_name, pool_address }))
16
16
  })
17
17
  })
18
18
  ws_client.onMessage(((eventData: SolanaPoolAccountUpdateEventData): void => {
@@ -1,6 +1,12 @@
1
1
  /**
2
2
  * Solana 池子账户更新事件数据结构
3
3
  */
4
+ export enum SolanaPoolAccountType {
5
+ POOL='pool',
6
+ VAULT_A='vaultA',
7
+ VAULT_B='vaultB',
8
+ }
9
+
4
10
  export interface SolanaAccountUpdateEvent {
5
11
  recvTimeMs: number; // 接收时间戳(毫秒)
6
12
 
@@ -16,9 +22,13 @@ export interface SolanaAccountUpdateEvent {
16
22
  dexId: string; // DEX ID
17
23
  poolAddress: string; // 池子地址
18
24
  poolName: string; // 池子名称
25
+
26
+ // 账户类型
27
+ accountType: SolanaPoolAccountType;
19
28
 
20
29
  // 账户数据(原始数据,由客户端解析)
21
30
  accountData?: Buffer | string; // 账户原始数据
31
+
22
32
  }
23
33
 
24
34
  /**
@@ -55,7 +65,7 @@ export interface SolanaPoolAccountUpdateEventData {
55
65
  // AMM 池子的Vault
56
66
  vaultA_account?: string
57
67
  vaultA_account_data?: string
58
- vaultB?: string
68
+ vaultB_account?: string
59
69
  vaultB_account_data?: string
60
70
  }
61
71
  }