@t402/mcp 2.4.0 → 2.5.0
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/bin/t402-mcp.js +13 -3
- package/dist/cjs/index.d.ts +3 -2
- package/dist/cjs/index.js +486 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/index.d.ts +31 -1
- package/dist/cjs/server/index.js +486 -1
- package/dist/cjs/server/index.js.map +1 -1
- package/dist/cjs/tools/index.d.ts +403 -3
- package/dist/cjs/tools/index.js +431 -2
- package/dist/cjs/tools/index.js.map +1 -1
- package/dist/cjs/{types-CWK2p9_n.d.ts → types-CwwW_c2B.d.ts} +5 -1
- package/dist/esm/{chunk-5IVOABVF.mjs → chunk-5UOBQKXW.mjs} +410 -2
- package/dist/esm/chunk-5UOBQKXW.mjs.map +1 -0
- package/dist/esm/{chunk-U2V6MOSU.mjs → chunk-KTG47TRY.mjs} +123 -4
- package/dist/esm/chunk-KTG47TRY.mjs.map +1 -0
- package/dist/esm/index.d.mts +3 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/server/index.d.mts +31 -1
- package/dist/esm/server/index.mjs +2 -2
- package/dist/esm/tools/index.d.mts +403 -3
- package/dist/esm/tools/index.mjs +45 -3
- package/dist/esm/{types-CWK2p9_n.d.mts → types-CwwW_c2B.d.mts} +5 -1
- package/package.json +16 -14
- package/dist/esm/chunk-5IVOABVF.mjs.map +0 -1
- package/dist/esm/chunk-U2V6MOSU.mjs.map +0 -1
package/dist/cjs/tools/index.js
CHANGED
|
@@ -32,24 +32,45 @@ var tools_exports = {};
|
|
|
32
32
|
__export(tools_exports, {
|
|
33
33
|
GASLESS_SUPPORTED_NETWORKS: () => GASLESS_SUPPORTED_NETWORKS,
|
|
34
34
|
TOOL_DEFINITIONS: () => TOOL_DEFINITIONS,
|
|
35
|
+
WDK_TOOL_DEFINITIONS: () => WDK_TOOL_DEFINITIONS,
|
|
36
|
+
autoPayInputSchema: () => autoPayInputSchema,
|
|
35
37
|
bridgeInputSchema: () => bridgeInputSchema,
|
|
38
|
+
executeAutoPay: () => executeAutoPay,
|
|
39
|
+
executeAutoPayDemo: () => executeAutoPayDemo,
|
|
36
40
|
executeBridge: () => executeBridge,
|
|
37
41
|
executeGetAllBalances: () => executeGetAllBalances,
|
|
38
42
|
executeGetBalance: () => executeGetBalance,
|
|
39
43
|
executeGetBridgeFee: () => executeGetBridgeFee,
|
|
40
44
|
executePay: () => executePay,
|
|
41
45
|
executePayGasless: () => executePayGasless,
|
|
46
|
+
executeWdkGetBalances: () => executeWdkGetBalances,
|
|
47
|
+
executeWdkGetBalancesDemo: () => executeWdkGetBalancesDemo,
|
|
48
|
+
executeWdkGetWallet: () => executeWdkGetWallet,
|
|
49
|
+
executeWdkGetWalletDemo: () => executeWdkGetWalletDemo,
|
|
50
|
+
executeWdkSwap: () => executeWdkSwap,
|
|
51
|
+
executeWdkSwapDemo: () => executeWdkSwapDemo,
|
|
52
|
+
executeWdkTransfer: () => executeWdkTransfer,
|
|
53
|
+
executeWdkTransferDemo: () => executeWdkTransferDemo,
|
|
42
54
|
formatAllBalancesResult: () => formatAllBalancesResult,
|
|
55
|
+
formatAutoPayResult: () => formatAutoPayResult,
|
|
43
56
|
formatBalanceResult: () => formatBalanceResult,
|
|
44
57
|
formatBridgeFeeResult: () => formatBridgeFeeResult,
|
|
45
58
|
formatBridgeResult: () => formatBridgeResult,
|
|
46
59
|
formatGaslessPaymentResult: () => formatGaslessPaymentResult,
|
|
47
60
|
formatPaymentResult: () => formatPaymentResult,
|
|
61
|
+
formatWdkBalancesResult: () => formatWdkBalancesResult,
|
|
62
|
+
formatWdkSwapResult: () => formatWdkSwapResult,
|
|
63
|
+
formatWdkTransferResult: () => formatWdkTransferResult,
|
|
64
|
+
formatWdkWalletResult: () => formatWdkWalletResult,
|
|
48
65
|
getAllBalancesInputSchema: () => getAllBalancesInputSchema,
|
|
49
66
|
getBalanceInputSchema: () => getBalanceInputSchema,
|
|
50
67
|
getBridgeFeeInputSchema: () => getBridgeFeeInputSchema,
|
|
51
68
|
payGaslessInputSchema: () => payGaslessInputSchema,
|
|
52
|
-
payInputSchema: () => payInputSchema
|
|
69
|
+
payInputSchema: () => payInputSchema,
|
|
70
|
+
wdkGetBalancesInputSchema: () => wdkGetBalancesInputSchema,
|
|
71
|
+
wdkGetWalletInputSchema: () => wdkGetWalletInputSchema,
|
|
72
|
+
wdkSwapInputSchema: () => wdkSwapInputSchema,
|
|
73
|
+
wdkTransferInputSchema: () => wdkTransferInputSchema
|
|
53
74
|
});
|
|
54
75
|
module.exports = __toCommonJS(tools_exports);
|
|
55
76
|
|
|
@@ -1161,6 +1182,289 @@ function formatBridgeResult(result) {
|
|
|
1161
1182
|
].join("\n");
|
|
1162
1183
|
}
|
|
1163
1184
|
|
|
1185
|
+
// src/tools/wdkGetWallet.ts
|
|
1186
|
+
var import_zod7 = require("zod");
|
|
1187
|
+
var wdkGetWalletInputSchema = import_zod7.z.object({});
|
|
1188
|
+
async function executeWdkGetWallet(_input, wdk) {
|
|
1189
|
+
const signer = await wdk.getSigner("ethereum");
|
|
1190
|
+
const chains6 = wdk.getConfiguredChains();
|
|
1191
|
+
return {
|
|
1192
|
+
evmAddress: signer.address,
|
|
1193
|
+
chains: chains6.length > 0 ? chains6 : ["ethereum"]
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
function executeWdkGetWalletDemo() {
|
|
1197
|
+
return {
|
|
1198
|
+
evmAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
|
|
1199
|
+
chains: ["ethereum", "arbitrum", "base", "optimism"]
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1202
|
+
function formatWdkWalletResult(info) {
|
|
1203
|
+
const lines = [
|
|
1204
|
+
"## WDK Wallet Info",
|
|
1205
|
+
"",
|
|
1206
|
+
`**EVM Address:** \`${info.evmAddress}\``,
|
|
1207
|
+
"",
|
|
1208
|
+
"### Supported Chains",
|
|
1209
|
+
...info.chains.map((c) => `- ${c}`)
|
|
1210
|
+
];
|
|
1211
|
+
return lines.join("\n");
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
// src/tools/wdkGetBalances.ts
|
|
1215
|
+
var import_zod8 = require("zod");
|
|
1216
|
+
var import_viem6 = require("viem");
|
|
1217
|
+
var wdkGetBalancesInputSchema = import_zod8.z.object({
|
|
1218
|
+
chains: import_zod8.z.array(import_zod8.z.string()).optional().describe("Optional list of chains to check. If not provided, checks all configured chains.")
|
|
1219
|
+
});
|
|
1220
|
+
function findTokenFormatted(tokens, symbol) {
|
|
1221
|
+
return tokens.find((t) => t.symbol === symbol)?.formatted ?? "0";
|
|
1222
|
+
}
|
|
1223
|
+
async function executeWdkGetBalances(input, wdk) {
|
|
1224
|
+
const balances = await wdk.getAggregatedBalances();
|
|
1225
|
+
const chains6 = balances.chains.filter((c) => !input.chains || input.chains.includes(c.chain)).map((c) => ({
|
|
1226
|
+
chain: c.chain,
|
|
1227
|
+
usdt0: findTokenFormatted(c.tokens, "USDT0"),
|
|
1228
|
+
usdc: findTokenFormatted(c.tokens, "USDC"),
|
|
1229
|
+
native: (0, import_viem6.formatUnits)(c.native, 18)
|
|
1230
|
+
}));
|
|
1231
|
+
return {
|
|
1232
|
+
chains: chains6,
|
|
1233
|
+
totalUsdt0: (0, import_viem6.formatUnits)(balances.totalUsdt0, 6),
|
|
1234
|
+
totalUsdc: (0, import_viem6.formatUnits)(balances.totalUsdc, 6)
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
function executeWdkGetBalancesDemo() {
|
|
1238
|
+
return {
|
|
1239
|
+
chains: [
|
|
1240
|
+
{ chain: "ethereum", usdt0: "100.00", usdc: "250.00", native: "0.5" },
|
|
1241
|
+
{ chain: "arbitrum", usdt0: "500.00", usdc: "0", native: "0.01" },
|
|
1242
|
+
{ chain: "base", usdt0: "200.00", usdc: "100.00", native: "0.02" }
|
|
1243
|
+
],
|
|
1244
|
+
totalUsdt0: "800.00",
|
|
1245
|
+
totalUsdc: "350.00"
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
function formatWdkBalancesResult(result) {
|
|
1249
|
+
const lines = [
|
|
1250
|
+
"## WDK Multi-Chain Balances",
|
|
1251
|
+
"",
|
|
1252
|
+
`**Total USDT0:** ${result.totalUsdt0}`,
|
|
1253
|
+
`**Total USDC:** ${result.totalUsdc}`,
|
|
1254
|
+
"",
|
|
1255
|
+
"### Per-Chain Breakdown",
|
|
1256
|
+
""
|
|
1257
|
+
];
|
|
1258
|
+
for (const chain of result.chains) {
|
|
1259
|
+
lines.push(`**${chain.chain}**`);
|
|
1260
|
+
lines.push(`- USDT0: ${chain.usdt0}`);
|
|
1261
|
+
lines.push(`- USDC: ${chain.usdc}`);
|
|
1262
|
+
lines.push(`- Native: ${chain.native}`);
|
|
1263
|
+
lines.push("");
|
|
1264
|
+
}
|
|
1265
|
+
return lines.join("\n");
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/tools/wdkTransfer.ts
|
|
1269
|
+
var import_zod9 = require("zod");
|
|
1270
|
+
var wdkTransferInputSchema = import_zod9.z.object({
|
|
1271
|
+
to: import_zod9.z.string().describe("Recipient address"),
|
|
1272
|
+
amount: import_zod9.z.string().regex(/^\d+(\.\d+)?$/).describe("Amount to send (e.g., '10.50')"),
|
|
1273
|
+
token: import_zod9.z.enum(["USDC", "USDT", "USDT0"]).describe("Token to transfer"),
|
|
1274
|
+
chain: import_zod9.z.string().describe('Chain to execute transfer on (e.g., "ethereum", "arbitrum")')
|
|
1275
|
+
});
|
|
1276
|
+
async function executeWdkTransfer(input, wdk) {
|
|
1277
|
+
const signer = await wdk.getSigner(input.chain);
|
|
1278
|
+
const result = await signer.sendTransaction({
|
|
1279
|
+
to: input.to
|
|
1280
|
+
});
|
|
1281
|
+
const txHash = result.hash;
|
|
1282
|
+
const explorerUrl = getExplorerTxUrl(input.chain, txHash);
|
|
1283
|
+
return {
|
|
1284
|
+
txHash,
|
|
1285
|
+
amount: input.amount,
|
|
1286
|
+
token: input.token,
|
|
1287
|
+
chain: input.chain,
|
|
1288
|
+
to: input.to,
|
|
1289
|
+
explorerUrl
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
function executeWdkTransferDemo(input) {
|
|
1293
|
+
const demoTxHash = "0xdemo" + Math.random().toString(16).slice(2, 10);
|
|
1294
|
+
return {
|
|
1295
|
+
txHash: demoTxHash,
|
|
1296
|
+
amount: input.amount,
|
|
1297
|
+
token: input.token,
|
|
1298
|
+
chain: input.chain,
|
|
1299
|
+
to: input.to,
|
|
1300
|
+
explorerUrl: `https://etherscan.io/tx/${demoTxHash}`
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
function formatWdkTransferResult(result) {
|
|
1304
|
+
return [
|
|
1305
|
+
"## WDK Transfer Complete",
|
|
1306
|
+
"",
|
|
1307
|
+
`**Amount:** ${result.amount} ${result.token}`,
|
|
1308
|
+
`**Chain:** ${result.chain}`,
|
|
1309
|
+
`**To:** \`${result.to}\``,
|
|
1310
|
+
`**Tx Hash:** \`${result.txHash}\``,
|
|
1311
|
+
`**Explorer:** [View Transaction](${result.explorerUrl})`
|
|
1312
|
+
].join("\n");
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
// src/tools/wdkSwap.ts
|
|
1316
|
+
var import_zod10 = require("zod");
|
|
1317
|
+
var import_viem7 = require("viem");
|
|
1318
|
+
var wdkSwapInputSchema = import_zod10.z.object({
|
|
1319
|
+
fromToken: import_zod10.z.string().describe('Token to swap from (e.g., "ETH", "USDC")'),
|
|
1320
|
+
toToken: import_zod10.z.string().describe('Token to swap to (e.g., "USDT0", "USDC")'),
|
|
1321
|
+
amount: import_zod10.z.string().regex(/^\d+(\.\d+)?$/).describe("Amount to swap (e.g., '1.0')"),
|
|
1322
|
+
chain: import_zod10.z.string().describe('Chain to execute swap on (e.g., "ethereum", "arbitrum")')
|
|
1323
|
+
});
|
|
1324
|
+
async function executeWdkSwap(input, wdk) {
|
|
1325
|
+
const decimals = ["USDC", "USDT", "USDT0"].includes(input.fromToken.toUpperCase()) ? 6 : 18;
|
|
1326
|
+
const amountBigInt = (0, import_viem7.parseUnits)(input.amount, decimals);
|
|
1327
|
+
const quote = await wdk.getSwapQuote(input.chain, input.fromToken, amountBigInt);
|
|
1328
|
+
const result = await wdk.swapAndPay({
|
|
1329
|
+
chain: input.chain,
|
|
1330
|
+
fromToken: input.fromToken,
|
|
1331
|
+
amount: amountBigInt
|
|
1332
|
+
});
|
|
1333
|
+
const outputDecimals = ["USDC", "USDT", "USDT0"].includes(input.toToken.toUpperCase()) ? 6 : 18;
|
|
1334
|
+
const toAmount = (0, import_viem7.formatUnits)(result?.outputAmount ?? quote.outputAmount, outputDecimals);
|
|
1335
|
+
return {
|
|
1336
|
+
fromAmount: input.amount,
|
|
1337
|
+
fromToken: input.fromToken,
|
|
1338
|
+
toAmount,
|
|
1339
|
+
toToken: input.toToken,
|
|
1340
|
+
chain: input.chain,
|
|
1341
|
+
txHash: result?.txHash
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
function executeWdkSwapDemo(input) {
|
|
1345
|
+
const inputAmount = parseFloat(input.amount);
|
|
1346
|
+
const outputAmount = (inputAmount * 0.997).toFixed(6);
|
|
1347
|
+
return {
|
|
1348
|
+
fromAmount: input.amount,
|
|
1349
|
+
fromToken: input.fromToken,
|
|
1350
|
+
toAmount: outputAmount,
|
|
1351
|
+
toToken: input.toToken,
|
|
1352
|
+
chain: input.chain,
|
|
1353
|
+
txHash: "0xdemo" + Math.random().toString(16).slice(2, 10)
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
function formatWdkSwapResult(result) {
|
|
1357
|
+
const lines = [
|
|
1358
|
+
"## WDK Swap Result",
|
|
1359
|
+
"",
|
|
1360
|
+
`**From:** ${result.fromAmount} ${result.fromToken}`,
|
|
1361
|
+
`**To:** ${result.toAmount} ${result.toToken}`,
|
|
1362
|
+
`**Chain:** ${result.chain}`
|
|
1363
|
+
];
|
|
1364
|
+
if (result.txHash) {
|
|
1365
|
+
lines.push(`**Tx Hash:** \`${result.txHash}\``);
|
|
1366
|
+
}
|
|
1367
|
+
return lines.join("\n");
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
// src/tools/autoPay.ts
|
|
1371
|
+
var import_zod11 = require("zod");
|
|
1372
|
+
var import_wdk_protocol = require("@t402/wdk-protocol");
|
|
1373
|
+
var autoPayInputSchema = import_zod11.z.object({
|
|
1374
|
+
url: import_zod11.z.string().url().describe("URL to fetch (may return 402 Payment Required)"),
|
|
1375
|
+
maxAmount: import_zod11.z.string().regex(/^\d+(\.\d+)?$/).optional().describe('Maximum amount willing to pay (e.g., "10.00"). If not set, pays any amount.'),
|
|
1376
|
+
preferredChain: import_zod11.z.string().optional().describe(
|
|
1377
|
+
'Preferred chain for payment (e.g., "arbitrum"). If not specified, uses first available.'
|
|
1378
|
+
)
|
|
1379
|
+
});
|
|
1380
|
+
async function executeAutoPay(input, wdk) {
|
|
1381
|
+
const chains6 = input.preferredChain ? [input.preferredChain] : ["ethereum", "arbitrum", "base"];
|
|
1382
|
+
const protocol = await import_wdk_protocol.T402Protocol.create(wdk, { chains: chains6 });
|
|
1383
|
+
const { response, receipt } = await protocol.fetch(input.url);
|
|
1384
|
+
if (receipt && input.maxAmount) {
|
|
1385
|
+
const paidAmount = parseFloat(receipt.amount) / 1e6;
|
|
1386
|
+
const maxAmount = parseFloat(input.maxAmount);
|
|
1387
|
+
if (paidAmount > maxAmount) {
|
|
1388
|
+
return {
|
|
1389
|
+
success: false,
|
|
1390
|
+
statusCode: 402,
|
|
1391
|
+
body: "",
|
|
1392
|
+
error: `Payment amount (${paidAmount}) exceeds max allowed (${maxAmount})`
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
const contentType = response.headers.get("content-type") ?? void 0;
|
|
1397
|
+
let body = "";
|
|
1398
|
+
try {
|
|
1399
|
+
body = await response.text();
|
|
1400
|
+
if (body.length > 1e4) {
|
|
1401
|
+
body = body.slice(0, 1e4) + "\n... (truncated)";
|
|
1402
|
+
}
|
|
1403
|
+
} catch {
|
|
1404
|
+
body = "[Could not read response body]";
|
|
1405
|
+
}
|
|
1406
|
+
return {
|
|
1407
|
+
success: response.ok,
|
|
1408
|
+
statusCode: response.status,
|
|
1409
|
+
body,
|
|
1410
|
+
contentType,
|
|
1411
|
+
payment: receipt ? {
|
|
1412
|
+
network: receipt.network,
|
|
1413
|
+
scheme: receipt.scheme,
|
|
1414
|
+
amount: receipt.amount,
|
|
1415
|
+
payTo: receipt.payTo
|
|
1416
|
+
} : void 0
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
function executeAutoPayDemo(input) {
|
|
1420
|
+
return {
|
|
1421
|
+
success: true,
|
|
1422
|
+
statusCode: 200,
|
|
1423
|
+
body: `[Demo] Premium content from ${input.url}
|
|
1424
|
+
|
|
1425
|
+
This is simulated content that would be returned after payment.`,
|
|
1426
|
+
contentType: "text/plain",
|
|
1427
|
+
payment: {
|
|
1428
|
+
network: "eip155:42161",
|
|
1429
|
+
scheme: "exact",
|
|
1430
|
+
amount: "1000000",
|
|
1431
|
+
payTo: "0xC88f67e776f16DcFBf42e6bDda1B82604448899B"
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
function formatAutoPayResult(result) {
|
|
1436
|
+
const lines = ["## AutoPay Result", ""];
|
|
1437
|
+
if (result.success) {
|
|
1438
|
+
lines.push(`**Status:** Success (${result.statusCode})`);
|
|
1439
|
+
} else {
|
|
1440
|
+
lines.push(`**Status:** Failed (${result.statusCode})`);
|
|
1441
|
+
}
|
|
1442
|
+
if (result.payment) {
|
|
1443
|
+
lines.push("");
|
|
1444
|
+
lines.push("### Payment Details");
|
|
1445
|
+
lines.push(`- **Network:** ${result.payment.network}`);
|
|
1446
|
+
lines.push(`- **Scheme:** ${result.payment.scheme}`);
|
|
1447
|
+
lines.push(`- **Amount:** ${result.payment.amount}`);
|
|
1448
|
+
lines.push(`- **Pay To:** \`${result.payment.payTo}\``);
|
|
1449
|
+
}
|
|
1450
|
+
if (result.error) {
|
|
1451
|
+
lines.push("");
|
|
1452
|
+
lines.push(`**Error:** ${result.error}`);
|
|
1453
|
+
}
|
|
1454
|
+
if (result.body) {
|
|
1455
|
+
lines.push("");
|
|
1456
|
+
lines.push("### Response Content");
|
|
1457
|
+
if (result.contentType) {
|
|
1458
|
+
lines.push(`_Content-Type: ${result.contentType}_`);
|
|
1459
|
+
}
|
|
1460
|
+
lines.push("");
|
|
1461
|
+
lines.push("```");
|
|
1462
|
+
lines.push(result.body);
|
|
1463
|
+
lines.push("```");
|
|
1464
|
+
}
|
|
1465
|
+
return lines.join("\n");
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1164
1468
|
// src/tools/index.ts
|
|
1165
1469
|
var TOOL_DEFINITIONS = {
|
|
1166
1470
|
"t402/getBalance": {
|
|
@@ -1361,27 +1665,152 @@ var TOOL_DEFINITIONS = {
|
|
|
1361
1665
|
}
|
|
1362
1666
|
}
|
|
1363
1667
|
};
|
|
1668
|
+
var WDK_TOOL_DEFINITIONS = {
|
|
1669
|
+
"wdk/getWallet": {
|
|
1670
|
+
name: "wdk/getWallet",
|
|
1671
|
+
description: "Get wallet information from the configured WDK wallet. Returns EVM address and supported chains. No parameters needed.",
|
|
1672
|
+
inputSchema: {
|
|
1673
|
+
type: "object",
|
|
1674
|
+
properties: {},
|
|
1675
|
+
required: []
|
|
1676
|
+
}
|
|
1677
|
+
},
|
|
1678
|
+
"wdk/getBalances": {
|
|
1679
|
+
name: "wdk/getBalances",
|
|
1680
|
+
description: "Get multi-chain token balances from the WDK wallet. Returns USDT0, USDC, and native token balances per chain plus aggregated totals.",
|
|
1681
|
+
inputSchema: {
|
|
1682
|
+
type: "object",
|
|
1683
|
+
properties: {
|
|
1684
|
+
chains: {
|
|
1685
|
+
type: "array",
|
|
1686
|
+
items: { type: "string" },
|
|
1687
|
+
description: 'Optional list of chains to check (e.g., ["ethereum", "arbitrum"]). If not provided, checks all configured chains.'
|
|
1688
|
+
}
|
|
1689
|
+
},
|
|
1690
|
+
required: []
|
|
1691
|
+
}
|
|
1692
|
+
},
|
|
1693
|
+
"wdk/transfer": {
|
|
1694
|
+
name: "wdk/transfer",
|
|
1695
|
+
description: "Send stablecoins (USDC, USDT, USDT0) from the WDK wallet to a recipient address on a specific chain.",
|
|
1696
|
+
inputSchema: {
|
|
1697
|
+
type: "object",
|
|
1698
|
+
properties: {
|
|
1699
|
+
to: {
|
|
1700
|
+
type: "string",
|
|
1701
|
+
description: "Recipient address"
|
|
1702
|
+
},
|
|
1703
|
+
amount: {
|
|
1704
|
+
type: "string",
|
|
1705
|
+
pattern: "^\\d+(\\.\\d+)?$",
|
|
1706
|
+
description: "Amount to send (e.g., '10.50')"
|
|
1707
|
+
},
|
|
1708
|
+
token: {
|
|
1709
|
+
type: "string",
|
|
1710
|
+
enum: ["USDC", "USDT", "USDT0"],
|
|
1711
|
+
description: "Token to transfer"
|
|
1712
|
+
},
|
|
1713
|
+
chain: {
|
|
1714
|
+
type: "string",
|
|
1715
|
+
description: 'Chain to execute transfer on (e.g., "ethereum", "arbitrum")'
|
|
1716
|
+
}
|
|
1717
|
+
},
|
|
1718
|
+
required: ["to", "amount", "token", "chain"]
|
|
1719
|
+
}
|
|
1720
|
+
},
|
|
1721
|
+
"wdk/swap": {
|
|
1722
|
+
name: "wdk/swap",
|
|
1723
|
+
description: "Swap tokens using the WDK Velora protocol. Supports swapping between stablecoins and native tokens.",
|
|
1724
|
+
inputSchema: {
|
|
1725
|
+
type: "object",
|
|
1726
|
+
properties: {
|
|
1727
|
+
fromToken: {
|
|
1728
|
+
type: "string",
|
|
1729
|
+
description: 'Token to swap from (e.g., "ETH", "USDC")'
|
|
1730
|
+
},
|
|
1731
|
+
toToken: {
|
|
1732
|
+
type: "string",
|
|
1733
|
+
description: 'Token to swap to (e.g., "USDT0", "USDC")'
|
|
1734
|
+
},
|
|
1735
|
+
amount: {
|
|
1736
|
+
type: "string",
|
|
1737
|
+
pattern: "^\\d+(\\.\\d+)?$",
|
|
1738
|
+
description: "Amount to swap (e.g., '1.0')"
|
|
1739
|
+
},
|
|
1740
|
+
chain: {
|
|
1741
|
+
type: "string",
|
|
1742
|
+
description: 'Chain to execute swap on (e.g., "ethereum", "arbitrum")'
|
|
1743
|
+
}
|
|
1744
|
+
},
|
|
1745
|
+
required: ["fromToken", "toToken", "amount", "chain"]
|
|
1746
|
+
}
|
|
1747
|
+
},
|
|
1748
|
+
"t402/autoPay": {
|
|
1749
|
+
name: "t402/autoPay",
|
|
1750
|
+
description: "Smart payment orchestrator. Fetches a URL, automatically handles HTTP 402 Payment Required responses by signing and submitting payment using the WDK wallet, and returns the paid content. The killer tool for AI agents.",
|
|
1751
|
+
inputSchema: {
|
|
1752
|
+
type: "object",
|
|
1753
|
+
properties: {
|
|
1754
|
+
url: {
|
|
1755
|
+
type: "string",
|
|
1756
|
+
description: "URL to fetch (may return 402 Payment Required)"
|
|
1757
|
+
},
|
|
1758
|
+
maxAmount: {
|
|
1759
|
+
type: "string",
|
|
1760
|
+
pattern: "^\\d+(\\.\\d+)?$",
|
|
1761
|
+
description: 'Maximum amount willing to pay (e.g., "10.00"). If not set, pays any amount.'
|
|
1762
|
+
},
|
|
1763
|
+
preferredChain: {
|
|
1764
|
+
type: "string",
|
|
1765
|
+
description: 'Preferred chain for payment (e.g., "arbitrum"). If not specified, uses first available.'
|
|
1766
|
+
}
|
|
1767
|
+
},
|
|
1768
|
+
required: ["url"]
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1364
1772
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1365
1773
|
0 && (module.exports = {
|
|
1366
1774
|
GASLESS_SUPPORTED_NETWORKS,
|
|
1367
1775
|
TOOL_DEFINITIONS,
|
|
1776
|
+
WDK_TOOL_DEFINITIONS,
|
|
1777
|
+
autoPayInputSchema,
|
|
1368
1778
|
bridgeInputSchema,
|
|
1779
|
+
executeAutoPay,
|
|
1780
|
+
executeAutoPayDemo,
|
|
1369
1781
|
executeBridge,
|
|
1370
1782
|
executeGetAllBalances,
|
|
1371
1783
|
executeGetBalance,
|
|
1372
1784
|
executeGetBridgeFee,
|
|
1373
1785
|
executePay,
|
|
1374
1786
|
executePayGasless,
|
|
1787
|
+
executeWdkGetBalances,
|
|
1788
|
+
executeWdkGetBalancesDemo,
|
|
1789
|
+
executeWdkGetWallet,
|
|
1790
|
+
executeWdkGetWalletDemo,
|
|
1791
|
+
executeWdkSwap,
|
|
1792
|
+
executeWdkSwapDemo,
|
|
1793
|
+
executeWdkTransfer,
|
|
1794
|
+
executeWdkTransferDemo,
|
|
1375
1795
|
formatAllBalancesResult,
|
|
1796
|
+
formatAutoPayResult,
|
|
1376
1797
|
formatBalanceResult,
|
|
1377
1798
|
formatBridgeFeeResult,
|
|
1378
1799
|
formatBridgeResult,
|
|
1379
1800
|
formatGaslessPaymentResult,
|
|
1380
1801
|
formatPaymentResult,
|
|
1802
|
+
formatWdkBalancesResult,
|
|
1803
|
+
formatWdkSwapResult,
|
|
1804
|
+
formatWdkTransferResult,
|
|
1805
|
+
formatWdkWalletResult,
|
|
1381
1806
|
getAllBalancesInputSchema,
|
|
1382
1807
|
getBalanceInputSchema,
|
|
1383
1808
|
getBridgeFeeInputSchema,
|
|
1384
1809
|
payGaslessInputSchema,
|
|
1385
|
-
payInputSchema
|
|
1810
|
+
payInputSchema,
|
|
1811
|
+
wdkGetBalancesInputSchema,
|
|
1812
|
+
wdkGetWalletInputSchema,
|
|
1813
|
+
wdkSwapInputSchema,
|
|
1814
|
+
wdkTransferInputSchema
|
|
1386
1815
|
});
|
|
1387
1816
|
//# sourceMappingURL=index.js.map
|