cryptoiz-mcp 4.16.11 → 4.16.13
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.
- package/index.js +29 -14
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
var VERSION = 'v4.16.
|
|
2
|
+
var VERSION = 'v4.16.13';
|
|
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:
|
|
6
|
-
get_whale_divergence:
|
|
7
|
-
get_whale_accumulation:
|
|
8
|
-
get_whale_neutral:
|
|
9
|
-
get_whale_distribution:
|
|
10
|
-
get_btc_regime:
|
|
11
|
-
get_btc_futures_signal:
|
|
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
|
};
|
|
@@ -70,10 +73,13 @@ async function buildV2PaymentPayload(amount, feePayerAddr) {
|
|
|
70
73
|
var computeBudgetPk = new PublicKey(COMPUTE_BUDGET_PROGRAM);
|
|
71
74
|
var tokenProgramPk = new PublicKey(TOKEN_PROGRAM);
|
|
72
75
|
var usdcMintPk = new PublicKey(USDC_MINT);
|
|
73
|
-
// ComputeUnitLimit
|
|
76
|
+
// FIX v4.16.13: ComputeUnitLimit 20000 -> 30000.
|
|
77
|
+
// Memo program needs >13500 CU when content is 'x402:v2:'+32char hex; old (April 6-8)
|
|
78
|
+
// working code used just 32-char nonceHex which fit in 20000 budget. Bumping limit gives
|
|
79
|
+
// headroom for slightly longer memo content. Dexter spec allows up to 40000.
|
|
74
80
|
var setLimitData = Buffer.alloc(5);
|
|
75
81
|
setLimitData[0] = 0x02;
|
|
76
|
-
setLimitData.writeUInt32LE(
|
|
82
|
+
setLimitData.writeUInt32LE(30000, 1);
|
|
77
83
|
var setLimitIx = { programId: computeBudgetPk, keys: [], data: setLimitData };
|
|
78
84
|
// ComputeUnitPrice(1)
|
|
79
85
|
var setPriceData = Buffer.alloc(9);
|
|
@@ -93,18 +99,27 @@ async function buildV2PaymentPayload(amount, feePayerAddr) {
|
|
|
93
99
|
transferData.writeUInt32LE(Math.floor(amount / 0x100000000) & 0xFFFFFFFF, 5);
|
|
94
100
|
transferData[9] = 6;
|
|
95
101
|
var transferIx = { programId: tokenProgramPk, keys: transferKeys, data: transferData };
|
|
96
|
-
// FIX v4.16.
|
|
97
|
-
//
|
|
102
|
+
// FIX v4.16.12: RESTORE Memo instruction in V2 (4-ix tx: Limit+Price+TransferChecked+Memo).
|
|
103
|
+
// Empirical: April 6-8 logs prove V2 with memo accepted by Dexter. Removing memo (v4.16.10)
|
|
104
|
+
// didn't fix anything — the actual bug was Dexter key rotation, fixed in gateway v44.
|
|
105
|
+
// Memo also makes TX visible to x402scan (memo carries x402 nonce marker).
|
|
106
|
+
var memoProgramPk = new PublicKey(MEMO_PROGRAM);
|
|
107
|
+
var nonceBytes = new Uint8Array(16);
|
|
108
|
+
for (var i = 0; i < 16; i++) nonceBytes[i] = Math.floor(Math.random() * 256);
|
|
109
|
+
var nonceHex = Array.from(nonceBytes).map(function(b) { return b.toString(16).padStart(2,'0'); }).join('');
|
|
110
|
+
// FIX v4.16.13: memo = just nonceHex (matches April 6-8 working V2 format).
|
|
111
|
+
// Adding 'x402:v2:' prefix made memo too long for 20000 CU budget.
|
|
112
|
+
var memoIx = { programId: memoProgramPk, keys: [], data: Buffer.from(nonceHex, 'utf8') };
|
|
98
113
|
var bh = await conn.getLatestBlockhash('confirmed');
|
|
99
114
|
var message = new TransactionMessage({
|
|
100
115
|
payerKey: feePayerPk,
|
|
101
116
|
recentBlockhash: bh.blockhash,
|
|
102
|
-
instructions: [setLimitIx, setPriceIx, transferIx],
|
|
117
|
+
instructions: [setLimitIx, setPriceIx, transferIx, memoIx],
|
|
103
118
|
}).compileToV0Message();
|
|
104
119
|
var vtx = new VersionedTransaction(message);
|
|
105
120
|
vtx.sign([kp]);
|
|
106
121
|
var txB64 = Buffer.from(vtx.serialize()).toString('base64');
|
|
107
|
-
console.error('[cryptoiz-mcp] V2 tx built (Dexter gas-sponsored),
|
|
122
|
+
console.error('[cryptoiz-mcp] V2 tx built (Dexter gas-sponsored), 4 ix limit=30000');
|
|
108
123
|
return txB64;
|
|
109
124
|
}
|
|
110
125
|
|
package/package.json
CHANGED