@clonegod/ttd-sol-common 1.0.66 → 1.0.67

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.
@@ -80,16 +80,21 @@ const parse_tx_failed_error_code = (dex_id_list, tx_failed_error_msg) => {
80
80
  });
81
81
  let err_code = "";
82
82
  if (dex_id_list.includes(dist_1.DEX_ID.RAYDIUM_AMM)) {
83
- err_code = parse_raydium_failure(tx_failed_error_msg);
83
+ err_code = parse_raydium_amm_failure(tx_failed_error_msg);
84
84
  }
85
85
  else if (dex_id_list.includes(dist_1.DEX_ID.RAYDIUM_CLMM)) {
86
- err_code = parse_raydium_failure(tx_failed_error_msg);
86
+ err_code = parse_raydium_clmm_failure(tx_failed_error_msg);
87
87
  }
88
88
  else if (dex_id_list.includes(dist_1.DEX_ID.ORCA_CLMM)) {
89
89
  err_code = parse_orca_failure(tx_failed_error_msg);
90
90
  }
91
- if (tx_failed_error_msg.includes('exceeded CUs meter at BPF instruction')) {
92
- err_code = dist_1.TradeErrorCodeType.ExceededCUsLimit;
91
+ if (!err_code) {
92
+ if (tx_failed_error_msg.includes('exceeded CUs meter at BPF instruction')) {
93
+ err_code = dist_1.TradeErrorCodeType.ExceededCUsLimit;
94
+ }
95
+ if (tx_failed_error_msg.includes('insufficient funds')) {
96
+ return dist_1.TradeErrorCodeType.InsufficientFunds;
97
+ }
93
98
  }
94
99
  if (!err_code) {
95
100
  err_code = dist_1.TradeErrorCodeType.UNKOWN;
@@ -97,7 +102,7 @@ const parse_tx_failed_error_code = (dex_id_list, tx_failed_error_msg) => {
97
102
  return err_code;
98
103
  };
99
104
  exports.parse_tx_failed_error_code = parse_tx_failed_error_code;
100
- function parse_raydium_failure(error_msg) {
105
+ function parse_raydium_amm_failure(error_msg) {
101
106
  if (error_msg.includes('0x28')) {
102
107
  return dist_1.TradeErrorCodeType.InsufficientFunds;
103
108
  }
@@ -106,6 +111,18 @@ function parse_raydium_failure(error_msg) {
106
111
  }
107
112
  return null;
108
113
  }
114
+ function parse_raydium_clmm_failure(error_msg) {
115
+ if (error_msg.includes('Computational budget exceeded')) {
116
+ return dist_1.TradeErrorCodeType.ExceededCUsLimit;
117
+ }
118
+ if (error_msg.includes('0x1786') || error_msg.includes('Too little output received')) {
119
+ return dist_1.TradeErrorCodeType.AmountOutBelowMinimum;
120
+ }
121
+ if (error_msg.includes('0x178c') || error_msg.includes('Invaild first tick array account')) {
122
+ return dist_1.TradeErrorCodeType.InvalidTickArraySequence;
123
+ }
124
+ return null;
125
+ }
109
126
  function parse_orca_failure(error_msg) {
110
127
  if (error_msg.includes('0x1]') || error_msg.includes('insufficient funds')) {
111
128
  return dist_1.TradeErrorCodeType.InsufficientFunds;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",