cryptoiz-mcp 4.16.10 → 4.16.12

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.
Files changed (2) hide show
  1. package/index.js +28 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,14 +1,17 @@
1
1
  'use strict';
2
- var VERSION = 'v4.16.10';
2
+ var VERSION = 'v4.16.12';
3
3
  var GATEWAY = 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-x402-gateway';
4
+ // FIX v4.16.12: route ALL paid tools to gateway. Per-tool endpoints (mcp-alpha-scanner etc.)
5
+ // have stale hardcoded fee payer that breaks after Dexter key rotation. Gateway has dynamic
6
+ // fee payer fetched from /supported. Single source of truth = no per-tool drift.
4
7
  var TOOL_ENDPOINTS = {
5
- get_whale_alpha: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-alpha-scanner',
6
- get_whale_divergence: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-divergence',
7
- get_whale_accumulation: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-accumulation',
8
- get_whale_neutral: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-neutral',
9
- get_whale_distribution: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-distribution',
10
- get_btc_regime: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-btc-regime',
11
- get_btc_futures_signal: 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-btc-futures',
8
+ get_whale_alpha: GATEWAY,
9
+ get_whale_divergence: GATEWAY,
10
+ get_whale_accumulation: GATEWAY,
11
+ get_whale_neutral: GATEWAY,
12
+ get_whale_distribution: GATEWAY,
13
+ get_btc_regime: GATEWAY,
14
+ get_btc_futures_signal: GATEWAY,
12
15
  get_token_ca: GATEWAY,
13
16
  get_status: GATEWAY,
14
17
  };
@@ -93,18 +96,25 @@ async function buildV2PaymentPayload(amount, feePayerAddr) {
93
96
  transferData.writeUInt32LE(Math.floor(amount / 0x100000000) & 0xFFFFFFFF, 5);
94
97
  transferData[9] = 6;
95
98
  var transferIx = { programId: tokenProgramPk, keys: transferKeys, data: transferData };
96
- // FIX v4.16.10: NO Memo instruction in V2 Dexter scheme_exact_svm whitelist
97
- // only allows ComputeBudget + SPL Token + Lighthouse. Memo would be rejected.
99
+ // FIX v4.16.12: RESTORE Memo instruction in V2 (4-ix tx: Limit+Price+TransferChecked+Memo).
100
+ // Empirical: April 6-8 logs prove V2 with memo accepted by Dexter. Removing memo (v4.16.10)
101
+ // didn't fix anything — the actual bug was Dexter key rotation, fixed in gateway v44.
102
+ // Memo also makes TX visible to x402scan (memo carries x402 nonce marker).
103
+ var memoProgramPk = new PublicKey(MEMO_PROGRAM);
104
+ var nonceBytes = new Uint8Array(16);
105
+ for (var i = 0; i < 16; i++) nonceBytes[i] = Math.floor(Math.random() * 256);
106
+ var nonceHex = Array.from(nonceBytes).map(function(b) { return b.toString(16).padStart(2,'0'); }).join('');
107
+ var memoIx = { programId: memoProgramPk, keys: [], data: Buffer.from('x402:v2:' + nonceHex, 'utf8') };
98
108
  var bh = await conn.getLatestBlockhash('confirmed');
99
109
  var message = new TransactionMessage({
100
110
  payerKey: feePayerPk,
101
111
  recentBlockhash: bh.blockhash,
102
- instructions: [setLimitIx, setPriceIx, transferIx],
112
+ instructions: [setLimitIx, setPriceIx, transferIx, memoIx],
103
113
  }).compileToV0Message();
104
114
  var vtx = new VersionedTransaction(message);
105
115
  vtx.sign([kp]);
106
116
  var txB64 = Buffer.from(vtx.serialize()).toString('base64');
107
- console.error('[cryptoiz-mcp] V2 tx built (Dexter gas-sponsored), 3 ix: limit+price+transferChecked');
117
+ console.error('[cryptoiz-mcp] V2 tx built (Dexter gas-sponsored), 4 ix: limit+price+transferChecked+memo');
108
118
  return txB64;
109
119
  }
110
120
 
@@ -162,13 +172,15 @@ async function callTool(toolName, args) {
162
172
  if (resp1.status !== 402) throw new Error('Server error ' + resp1.status + ': ' + (await resp1.text()).substring(0, 200));
163
173
 
164
174
  // Step 2: parse payment requirements
175
+ // FIX v4.16.11: detect V2 by extra.feePayer presence (Dexter sponsorship marker),
176
+ // not by header. Per-tool endpoints (mcp-alpha-scanner, mcp-btc-regime, etc.) only
177
+ // serve 402 in body, no payment-required header. Header check stays as fast path.
165
178
  var payReq = null;
166
- var useV2 = false;
167
179
  var prHeader = resp1.headers.get('payment-required');
168
180
  if (prHeader) {
169
181
  try {
170
182
  var arr = JSON.parse(Buffer.from(prHeader, 'base64').toString('utf8'));
171
- if (arr && arr[0]) { payReq = arr[0]; useV2 = true; }
183
+ if (arr && arr[0]) payReq = arr[0];
172
184
  } catch(_e) {}
173
185
  }
174
186
  if (!payReq) {
@@ -176,6 +188,8 @@ async function callTool(toolName, args) {
176
188
  if (b402 && b402.accepts && b402.accepts[0]) payReq = b402.accepts[0];
177
189
  }
178
190
  if (!payReq) throw new Error('No payment requirements in 402');
191
+ // V2 = Dexter sponsored gas = extra.feePayer field present (independent of transport)
192
+ var useV2 = !!(payReq.extra && payReq.extra.feePayer);
179
193
 
180
194
  var amount = parseInt(payReq.maxAmountRequired || payReq.amount || '10000');
181
195
  var hasFeePayer = payReq.extra && payReq.extra.feePayer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cryptoiz-mcp",
3
- "version": "4.16.10",
3
+ "version": "4.16.12",
4
4
  "description": "CryptoIZ MCP Server - Solana DEX whale intelligence via Claude Desktop with x402 USDC micropayments",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",