@clonegod/ttd-sol-common 2.0.30 → 2.0.32

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.
@@ -1,43 +1,10 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
4
  };
38
5
  Object.defineProperty(exports, "__esModule", { value: true });
39
6
  exports.getHttpClient = getHttpClient;
40
- const axios_1 = __importStar(require("axios"));
7
+ const axios_1 = __importDefault(require("axios"));
41
8
  const https_1 = __importDefault(require("https"));
42
9
  class HttpClientManager {
43
10
  constructor() {
@@ -59,55 +26,6 @@ class HttpClientManager {
59
26
  'Content-Type': 'application/json',
60
27
  },
61
28
  });
62
- instance.interceptors.response.use((response) => response, (error) => {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
64
- if (error.response) {
65
- const simplifiedError = Object.create(axios_1.AxiosError.prototype);
66
- simplifiedError.name = error.name;
67
- simplifiedError.message = `Request failed: ${error.response.status} ${error.response.statusText} - ${(_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()} ${(_c = error.config) === null || _c === void 0 ? void 0 : _c.url}`;
68
- simplifiedError.code = error.code;
69
- simplifiedError.isAxiosError = true;
70
- simplifiedError.config = {
71
- method: (_d = error.config) === null || _d === void 0 ? void 0 : _d.method,
72
- url: (_e = error.config) === null || _e === void 0 ? void 0 : _e.url,
73
- baseURL: (_f = error.config) === null || _f === void 0 ? void 0 : _f.baseURL,
74
- };
75
- simplifiedError.response = {
76
- status: error.response.status,
77
- statusText: error.response.statusText,
78
- data: error.response.data,
79
- };
80
- simplifiedError.toJSON = function () {
81
- return {
82
- name: this.name,
83
- message: this.message,
84
- code: this.code,
85
- config: this.config,
86
- response: this.response,
87
- };
88
- };
89
- return Promise.reject(simplifiedError);
90
- }
91
- const simplifiedError = Object.create(axios_1.AxiosError.prototype);
92
- simplifiedError.name = error.name;
93
- simplifiedError.message = `Request error: ${error.message} - ${(_h = (_g = error.config) === null || _g === void 0 ? void 0 : _g.method) === null || _h === void 0 ? void 0 : _h.toUpperCase()} ${(_j = error.config) === null || _j === void 0 ? void 0 : _j.url}`;
94
- simplifiedError.code = error.code;
95
- simplifiedError.isAxiosError = true;
96
- simplifiedError.config = {
97
- method: (_k = error.config) === null || _k === void 0 ? void 0 : _k.method,
98
- url: (_l = error.config) === null || _l === void 0 ? void 0 : _l.url,
99
- baseURL: (_m = error.config) === null || _m === void 0 ? void 0 : _m.baseURL,
100
- };
101
- simplifiedError.toJSON = function () {
102
- return {
103
- name: this.name,
104
- message: this.message,
105
- code: this.code,
106
- config: this.config,
107
- };
108
- };
109
- return Promise.reject(simplifiedError);
110
- });
111
29
  return instance;
112
30
  }
113
31
  getInstance(url) {
@@ -1,13 +1,13 @@
1
1
  export interface SolanaAccountUpdateEvent {
2
2
  recv_ms: number;
3
3
  providerId: string;
4
+ account: string;
4
5
  slot: number;
5
6
  writeVersion: number;
6
7
  transactionHash: string;
7
- dexId: string;
8
- pair: string;
9
- poolAddress: string;
10
- poolName?: string;
8
+ dex_id: string;
9
+ pool_address: string;
10
+ pool_name: string;
11
11
  accountData?: Buffer | string;
12
12
  }
13
13
  export interface SolanaBlockMetaUpdateEvent {
@@ -21,17 +21,20 @@ export interface SolanaBlockMetaUpdateEvent {
21
21
  entriesCount: number;
22
22
  }
23
23
  export interface SolanaPoolAccountUpdateEventData {
24
- type: string;
25
24
  provider_id: string;
26
25
  event_time: number;
27
26
  dexId: string;
28
- pair: string;
29
27
  pool_address: string;
30
28
  pool_name: string;
31
29
  data: {
32
30
  slot: number;
33
31
  writeVersion: number;
34
32
  transactionHash: string;
35
- accountData: string;
33
+ pool_account: string;
34
+ pool_account_data: string;
35
+ vaultA_account?: string;
36
+ vaultA_account_data?: string;
37
+ vaultB?: string;
38
+ vaultB_account_data?: string;
36
39
  };
37
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -32,71 +32,71 @@ class HttpClientManager {
32
32
  })
33
33
 
34
34
  // 添加响应拦截器,简化错误信息
35
- instance.interceptors.response.use(
36
- (response) => response,
37
- (error: AxiosError) => {
38
- // 简化错误对象,只保留关键信息,避免打印过多内容
39
- if (error.response) {
40
- // 创建简化的错误对象
41
- const simplifiedError = Object.create(AxiosError.prototype)
42
- simplifiedError.name = error.name
43
- simplifiedError.message = `Request failed: ${error.response.status} ${error.response.statusText} - ${error.config?.method?.toUpperCase()} ${error.config?.url}`
44
- simplifiedError.code = error.code
45
- simplifiedError.isAxiosError = true
35
+ // instance.interceptors.response.use(
36
+ // (response) => response,
37
+ // (error: AxiosError) => {
38
+ // // 简化错误对象,只保留关键信息,避免打印过多内容
39
+ // if (error.response) {
40
+ // // 创建简化的错误对象
41
+ // const simplifiedError = Object.create(AxiosError.prototype)
42
+ // simplifiedError.name = error.name
43
+ // simplifiedError.message = `Request failed: ${error.response.status} ${error.response.statusText} - ${error.config?.method?.toUpperCase()} ${error.config?.url}`
44
+ // simplifiedError.code = error.code
45
+ // simplifiedError.isAxiosError = true
46
46
 
47
- // 只保留必要的配置信息
48
- simplifiedError.config = {
49
- method: error.config?.method,
50
- url: error.config?.url,
51
- baseURL: error.config?.baseURL,
52
- }
47
+ // // 只保留必要的配置信息
48
+ // simplifiedError.config = {
49
+ // method: error.config?.method,
50
+ // url: error.config?.url,
51
+ // baseURL: error.config?.baseURL,
52
+ // }
53
53
 
54
- // 只保留必要的响应信息
55
- simplifiedError.response = {
56
- status: error.response.status,
57
- statusText: error.response.statusText,
58
- data: error.response.data,
59
- }
54
+ // // 只保留必要的响应信息
55
+ // simplifiedError.response = {
56
+ // status: error.response.status,
57
+ // statusText: error.response.statusText,
58
+ // data: error.response.data,
59
+ // }
60
60
 
61
- // 自定义 toJSON 方法,控制序列化输出
62
- simplifiedError.toJSON = function() {
63
- return {
64
- name: this.name,
65
- message: this.message,
66
- code: this.code,
67
- config: this.config,
68
- response: this.response,
69
- }
70
- }
61
+ // // 自定义 toJSON 方法,控制序列化输出
62
+ // simplifiedError.toJSON = function() {
63
+ // return {
64
+ // name: this.name,
65
+ // message: this.message,
66
+ // code: this.code,
67
+ // config: this.config,
68
+ // response: this.response,
69
+ // }
70
+ // }
71
71
 
72
- return Promise.reject(simplifiedError as AxiosError)
73
- }
72
+ // return Promise.reject(simplifiedError as AxiosError)
73
+ // }
74
74
 
75
- // 网络错误等其他错误,简化处理
76
- const simplifiedError = Object.create(AxiosError.prototype)
77
- simplifiedError.name = error.name
78
- simplifiedError.message = `Request error: ${error.message} - ${error.config?.method?.toUpperCase()} ${error.config?.url}`
79
- simplifiedError.code = error.code
80
- simplifiedError.isAxiosError = true
81
- simplifiedError.config = {
82
- method: error.config?.method,
83
- url: error.config?.url,
84
- baseURL: error.config?.baseURL,
85
- }
75
+ // // 网络错误等其他错误,简化处理
76
+ // const simplifiedError = Object.create(AxiosError.prototype)
77
+ // simplifiedError.name = error.name
78
+ // simplifiedError.message = `Request error: ${error.message} - ${error.config?.method?.toUpperCase()} ${error.config?.url}`
79
+ // simplifiedError.code = error.code
80
+ // simplifiedError.isAxiosError = true
81
+ // simplifiedError.config = {
82
+ // method: error.config?.method,
83
+ // url: error.config?.url,
84
+ // baseURL: error.config?.baseURL,
85
+ // }
86
86
 
87
- // 自定义 toJSON 方法,控制序列化输出
88
- simplifiedError.toJSON = function() {
89
- return {
90
- name: this.name,
91
- message: this.message,
92
- code: this.code,
93
- config: this.config,
94
- }
95
- }
87
+ // // 自定义 toJSON 方法,控制序列化输出
88
+ // simplifiedError.toJSON = function() {
89
+ // return {
90
+ // name: this.name,
91
+ // message: this.message,
92
+ // code: this.code,
93
+ // config: this.config,
94
+ // }
95
+ // }
96
96
 
97
- return Promise.reject(simplifiedError as AxiosError)
98
- }
99
- )
97
+ // return Promise.reject(simplifiedError as AxiosError)
98
+ // }
99
+ // )
100
100
 
101
101
  return instance
102
102
  }
@@ -4,19 +4,18 @@
4
4
  export interface SolanaAccountUpdateEvent {
5
5
  recv_ms: number; // 接收时间戳(毫秒)
6
6
 
7
- // provider_id: 'helius-laserstream',
8
- providerId: string; // 提供者 ID
7
+ providerId: string; // 提供者 ID: 'helius-laserstream'
9
8
 
10
9
  // 公共字段
10
+ account: string; // 账户地址
11
11
  slot: number; // Solana slot 号
12
12
  writeVersion: number; // 账户写入版本
13
- transactionHash: string; // 交易哈希
13
+ transactionHash: string; // 导致账户变化的交易哈希
14
14
 
15
15
  // 池子信息
16
- dexId: string; // DEX ID
17
- pair: string; // 交易对名称
18
- poolAddress: string; // 池子地址
19
- poolName?: string; // 池子名称
16
+ dex_id: string; // DEX ID
17
+ pool_address: string; // 池子地址
18
+ pool_name: string; // 池子名称
20
19
 
21
20
  // 账户数据(原始数据,由客户端解析)
22
21
  accountData?: Buffer | string; // 账户原始数据
@@ -37,21 +36,28 @@ export interface SolanaBlockMetaUpdateEvent {
37
36
  }
38
37
 
39
38
  /**
40
- * 推送给询价、交易进程的Account Change Event 结构
39
+ * 推送给询价、交易进程的AccountData
40
+ * - AMM : pool_account_data, vaultA_account_data, vaultB_account_data
41
+ * - 其他 : account_data
41
42
  */
42
43
  export interface SolanaPoolAccountUpdateEventData {
43
- type: string
44
44
  provider_id: string
45
45
  event_time: number
46
46
  dexId: string
47
- pair: string
48
47
  pool_address: string
49
48
  pool_name: string
50
49
  data: {
51
50
  slot: number
52
51
  writeVersion: number
53
52
  transactionHash: string
54
- accountData: string
53
+ pool_account: string
54
+ pool_account_data: string
55
+
56
+ // AMM 池子的Vault
57
+ vaultA_account?: string
58
+ vaultA_account_data?: string
59
+ vaultB?: string
60
+ vaultB_account_data?: string
55
61
  }
56
62
  }
57
63