@clonegod/ttd-sol-common 2.0.46 → 2.0.47

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.
@@ -85,7 +85,7 @@ const sendBundleWithJito = async (mainTxBase64, tipTxBase64) => {
85
85
  id: 1,
86
86
  method: 'sendBundle',
87
87
  params: [
88
- [tipTxBase64, mainTxBase64],
88
+ [mainTxBase64, tipTxBase64],
89
89
  {
90
90
  "encoding": "base64"
91
91
  }
@@ -116,7 +116,7 @@ const sendBundleWithJitoMultiIps = async (mainTxHash, mainTxBase64, tipTxBase64)
116
116
  trace_id: '',
117
117
  txid: mainTxHash,
118
118
  encoding: 'base64',
119
- encoded_tx: [tipTxBase64, mainTxBase64].join(','),
119
+ encoded_tx: [mainTxBase64, tipTxBase64].join(','),
120
120
  max_retry: 3
121
121
  };
122
122
  Promise.all(urls.map(async (url) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sol-common",
3
- "version": "2.0.46",
3
+ "version": "2.0.47",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -54,12 +54,17 @@ export const sendBundleWithJito = async (mainTxBase64: string, tipTxBase64: stri
54
54
  // 使用共享的 axios 实例,复用连接池
55
55
  const client = getHttpClient(url)
56
56
 
57
+ // Bundle 顺序: [mainTx, tipTx]
58
+ // 根据 Jito Sandwich Mitigation 规则 (https://docs.jito.wtf/lowlatencytxnsend/#sandwich-mitigation):
59
+ // - 如果主交易包含 jitodontfront 账户,它必须在 bundle 的第一个位置(索引 0)
60
+ // - 允许的模式: [tx_with_dont_front, tip]
61
+ // - 不允许的模式: [tip, tx_with_dont_front]
57
62
  const requestData = {
58
63
  jsonrpc: '2.0',
59
64
  id: 1,
60
65
  method: 'sendBundle',
61
66
  params: [
62
- [tipTxBase64, mainTxBase64],
67
+ [mainTxBase64, tipTxBase64],
63
68
  {
64
69
  "encoding": "base64"
65
70
  }
@@ -96,11 +101,13 @@ export const sendBundleWithJitoMultiIps = async (mainTxHash: string, mainTxBase6
96
101
  let ips = (process.env.JITO_SEND_BUNDLE_SERVER_IPS || '127.0.0.1').split(',')
97
102
  let urls = ips.map(ip => `http://${ip}:10001/solana/send_tx`)
98
103
 
104
+ // Bundle 顺序: [mainTx, tipTx]
105
+ // 与 sendBundleWithJito 保持一致,符合 Jito Sandwich Mitigation 规则
99
106
  const body = {
100
107
  trace_id: '',
101
108
  txid: mainTxHash,
102
109
  encoding: 'base64', // base64
103
- encoded_tx: [tipTxBase64, mainTxBase64].join(','), // main tx
110
+ encoded_tx: [mainTxBase64, tipTxBase64].join(','), // bundle: mainTx, tipTx
104
111
  max_retry: 3
105
112
  }
106
113