cryptoiz-mcp 4.15.3 → 4.15.4
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 +12 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprot
|
|
|
9
9
|
import { Connection, Keypair, PublicKey, Transaction, SystemProgram, VersionedTransaction, TransactionMessage } from '@solana/web3.js';
|
|
10
10
|
import bs58 from 'bs58';
|
|
11
11
|
|
|
12
|
-
var VERSION = 'v4.15.
|
|
12
|
+
var VERSION = 'v4.15.4';
|
|
13
13
|
var GATEWAY = 'https://rehqwsypjnjirhuiapqh.supabase.co/functions/v1/mcp-x402-gateway';
|
|
14
14
|
var RECIPIENT = 'DsKmdkYx49Xc1WhqMUAztwhdYPTqieyC98VmnnJdgpXX';
|
|
15
15
|
var USDC_MINT = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
|
|
@@ -75,19 +75,26 @@ async function buildV2PaymentPayload(amount, feePayerAddr) {
|
|
|
75
75
|
data: setPriceData,
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
-
// Instruction 3: SPL Token Transfer
|
|
78
|
+
// Instruction 3: SPL Token TransferChecked (NOT Transfer!)
|
|
79
|
+
// x402 SVM spec requires TransferChecked (instruction index 12)
|
|
80
|
+
// Accounts: [source_ata, mint, destination_ata, authority]
|
|
81
|
+
// Data: [12, amount_u64_LE, decimals_u8]
|
|
79
82
|
var tokenProgramPk = new PublicKey(TOKEN_PROGRAM);
|
|
83
|
+
var usdcMintPk = new PublicKey(USDC_MINT);
|
|
80
84
|
var transferKeys = [
|
|
81
85
|
{ pubkey: userATA, isSigner: false, isWritable: true },
|
|
86
|
+
{ pubkey: usdcMintPk, isSigner: false, isWritable: false },
|
|
82
87
|
{ pubkey: recipientATA, isSigner: false, isWritable: true },
|
|
83
88
|
{ pubkey: kp.publicKey, isSigner: true, isWritable: false },
|
|
84
89
|
];
|
|
85
|
-
|
|
86
|
-
transferData.
|
|
90
|
+
// TransferChecked data: instruction_index(1) + amount_u64(8) + decimals(1) = 10 bytes
|
|
91
|
+
var transferData = Buffer.alloc(10);
|
|
92
|
+
transferData.writeUInt8(12, 0); // TransferChecked instruction index
|
|
87
93
|
var lo = amount & 0xFFFFFFFF;
|
|
88
94
|
var hi = Math.floor(amount / 0x100000000) & 0xFFFFFFFF;
|
|
89
95
|
transferData.writeUInt32LE(lo, 1);
|
|
90
96
|
transferData.writeUInt32LE(hi, 5);
|
|
97
|
+
transferData.writeUInt8(6, 9); // USDC decimals = 6
|
|
91
98
|
var transferIx = {
|
|
92
99
|
programId: tokenProgramPk,
|
|
93
100
|
keys: transferKeys,
|
|
@@ -112,7 +119,7 @@ async function buildV2PaymentPayload(amount, feePayerAddr) {
|
|
|
112
119
|
var serialized = vtx.serialize();
|
|
113
120
|
var txB64 = Buffer.from(serialized).toString('base64');
|
|
114
121
|
|
|
115
|
-
console.error('[cryptoiz-mcp] V2 tx built: 3
|
|
122
|
+
console.error('[cryptoiz-mcp] V2 tx built: 3 ix (ComputeLimit + ComputePrice + TransferChecked), feePayer=' + feePayerAddr.substring(0, 8) + '...');
|
|
116
123
|
return txB64;
|
|
117
124
|
}
|
|
118
125
|
|
package/package.json
CHANGED