@t402/mcp 2.7.1 → 2.8.1

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.
@@ -435,7 +435,8 @@ var payInputSchema = z3.object({
435
435
  "berachain",
436
436
  "unichain"
437
437
  ]).describe("Network to execute payment on"),
438
- memo: z3.string().optional().describe("Optional memo/reference for the payment")
438
+ memo: z3.string().optional().describe("Optional memo/reference for the payment"),
439
+ confirmed: z3.boolean().optional().describe("Set to true to confirm and execute this payment")
439
440
  });
440
441
  function getViemChain2(network) {
441
442
  switch (network) {
@@ -464,6 +465,13 @@ function getViemChain2(network) {
464
465
  async function executePay(input, options) {
465
466
  const { to, amount, token, network, memo: _memo } = input;
466
467
  const { privateKey, rpcUrl, demoMode } = options;
468
+ if (!input.confirmed) {
469
+ return {
470
+ needsConfirmation: true,
471
+ summary: `Send ${amount} ${token} on ${network} to ${to}`,
472
+ details: { to, amount, token, network }
473
+ };
474
+ }
467
475
  if (!supportsToken(network, token)) {
468
476
  throw new Error(`Token ${token} is not supported on ${network}`);
469
477
  }
@@ -548,7 +556,8 @@ var payGaslessInputSchema = z4.object({
548
556
  to: z4.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Recipient address"),
549
557
  amount: z4.string().regex(/^\d+(\.\d+)?$/).describe("Amount to pay (e.g., '10.50' for 10.50 USDC)"),
550
558
  token: z4.enum(["USDC", "USDT", "USDT0"]).describe("Token to use for payment"),
551
- network: z4.enum(["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche"]).describe("Network to execute gasless payment on (must support ERC-4337)")
559
+ network: z4.enum(["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche"]).describe("Network to execute gasless payment on (must support ERC-4337)"),
560
+ confirmed: z4.boolean().optional().describe("Set to true to confirm and execute this payment")
552
561
  });
553
562
  var GASLESS_SUPPORTED_NETWORKS = [
554
563
  "ethereum",
@@ -585,6 +594,13 @@ function getViemChain3(network) {
585
594
  async function executePayGasless(input, options) {
586
595
  const { to, amount, token, network } = input;
587
596
  const { privateKey, bundlerUrl, paymasterUrl: _paymasterUrl, rpcUrl, demoMode } = options;
597
+ if (!input.confirmed) {
598
+ return {
599
+ needsConfirmation: true,
600
+ summary: `Send ${amount} ${token} gasless on ${network} to ${to}`,
601
+ details: { to, amount, token, network }
602
+ };
603
+ }
588
604
  if (!GASLESS_SUPPORTED_NETWORKS.includes(network)) {
589
605
  throw new Error(
590
606
  `Network ${network} does not support ERC-4337 gasless transactions. Supported: ${GASLESS_SUPPORTED_NETWORKS.join(", ")}`
@@ -876,7 +892,8 @@ var bridgeInputSchema = z6.object({
876
892
  fromChain: z6.enum(["ethereum", "arbitrum", "ink", "berachain", "unichain"]).describe("Source chain to bridge from"),
877
893
  toChain: z6.enum(["ethereum", "arbitrum", "ink", "berachain", "unichain"]).describe("Destination chain to bridge to"),
878
894
  amount: z6.string().regex(/^\d+(\.\d+)?$/).describe("Amount of USDT0 to bridge (e.g., '100' for 100 USDT0)"),
879
- recipient: z6.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Recipient address on destination chain")
895
+ recipient: z6.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Recipient address on destination chain"),
896
+ confirmed: z6.boolean().optional().describe("Set to true to confirm and execute this bridge")
880
897
  });
881
898
  var LAYERZERO_ENDPOINT_IDS2 = {
882
899
  ethereum: 30101,
@@ -1003,6 +1020,13 @@ function addressToBytes322(address) {
1003
1020
  async function executeBridge(input, options) {
1004
1021
  const { fromChain, toChain, amount, recipient } = input;
1005
1022
  const { privateKey, rpcUrl, demoMode, slippageTolerance = 0.5 } = options;
1023
+ if (!input.confirmed) {
1024
+ return {
1025
+ needsConfirmation: true,
1026
+ summary: `Bridge ${amount} USDT0 from ${fromChain} to ${toChain}`,
1027
+ details: { fromChain, toChain, amount, recipient }
1028
+ };
1029
+ }
1006
1030
  if (fromChain === toChain) {
1007
1031
  throw new Error("Source and destination chains must be different");
1008
1032
  }
@@ -1132,10 +1156,10 @@ import { z as z7 } from "zod";
1132
1156
  var wdkGetWalletInputSchema = z7.object({});
1133
1157
  async function executeWdkGetWallet(_input, wdk) {
1134
1158
  const signer = await wdk.getSigner("ethereum");
1135
- const chains7 = wdk.getConfiguredChains();
1159
+ const chains10 = wdk.getConfiguredChains();
1136
1160
  return {
1137
1161
  evmAddress: signer.address,
1138
- chains: chains7.length > 0 ? chains7 : ["ethereum"]
1162
+ chains: chains10.length > 0 ? chains10 : ["ethereum"]
1139
1163
  };
1140
1164
  }
1141
1165
  function executeWdkGetWalletDemo() {
@@ -1167,14 +1191,14 @@ function findTokenFormatted(tokens, symbol) {
1167
1191
  }
1168
1192
  async function executeWdkGetBalances(input, wdk) {
1169
1193
  const balances = await wdk.getAggregatedBalances();
1170
- const chains7 = balances.chains.filter((c) => !input.chains || input.chains.includes(c.chain)).map((c) => ({
1194
+ const chains10 = balances.chains.filter((c) => !input.chains || input.chains.includes(c.chain)).map((c) => ({
1171
1195
  chain: c.chain,
1172
1196
  usdt0: findTokenFormatted(c.tokens, "USDT0"),
1173
1197
  usdc: findTokenFormatted(c.tokens, "USDC"),
1174
1198
  native: formatUnits2(c.native, 18)
1175
1199
  }));
1176
1200
  return {
1177
- chains: chains7,
1201
+ chains: chains10,
1178
1202
  totalUsdt0: formatUnits2(balances.totalUsdt0, 6),
1179
1203
  totalUsdc: formatUnits2(balances.totalUsdc, 6)
1180
1204
  };
@@ -1216,9 +1240,17 @@ var wdkTransferInputSchema = z9.object({
1216
1240
  to: z9.string().describe("Recipient address"),
1217
1241
  amount: z9.string().regex(/^\d+(\.\d+)?$/).describe("Amount to send (e.g., '10.50')"),
1218
1242
  token: z9.enum(["USDC", "USDT", "USDT0"]).describe("Token to transfer"),
1219
- chain: z9.string().describe('Chain to execute transfer on (e.g., "ethereum", "arbitrum")')
1243
+ chain: z9.string().describe('Chain to execute transfer on (e.g., "ethereum", "arbitrum")'),
1244
+ confirmed: z9.boolean().optional().describe("Set to true to confirm and execute this transfer")
1220
1245
  });
1221
1246
  async function executeWdkTransfer(input, wdk) {
1247
+ if (!input.confirmed) {
1248
+ return {
1249
+ needsConfirmation: true,
1250
+ summary: `Transfer ${input.amount} ${input.token} on ${input.chain} to ${input.to}`,
1251
+ details: { to: input.to, amount: input.amount, token: input.token, chain: input.chain }
1252
+ };
1253
+ }
1222
1254
  const signer = await wdk.getSigner(input.chain);
1223
1255
  const result = await signer.sendTransaction({
1224
1256
  to: input.to
@@ -1235,6 +1267,13 @@ async function executeWdkTransfer(input, wdk) {
1235
1267
  };
1236
1268
  }
1237
1269
  function executeWdkTransferDemo(input) {
1270
+ if (!input.confirmed) {
1271
+ return {
1272
+ needsConfirmation: true,
1273
+ summary: `Transfer ${input.amount} ${input.token} on ${input.chain} to ${input.to}`,
1274
+ details: { to: input.to, amount: input.amount, token: input.token, chain: input.chain }
1275
+ };
1276
+ }
1238
1277
  const demoTxHash = "0xdemo" + Math.random().toString(16).slice(2, 10);
1239
1278
  return {
1240
1279
  txHash: demoTxHash,
@@ -1264,9 +1303,22 @@ var wdkSwapInputSchema = z10.object({
1264
1303
  fromToken: z10.string().describe('Token to swap from (e.g., "ETH", "USDC")'),
1265
1304
  toToken: z10.string().describe('Token to swap to (e.g., "USDT0", "USDC")'),
1266
1305
  amount: z10.string().regex(/^\d+(\.\d+)?$/).describe("Amount to swap (e.g., '1.0')"),
1267
- chain: z10.string().describe('Chain to execute swap on (e.g., "ethereum", "arbitrum")')
1306
+ chain: z10.string().describe('Chain to execute swap on (e.g., "ethereum", "arbitrum")'),
1307
+ confirmed: z10.boolean().optional().describe("Set to true to confirm and execute this swap")
1268
1308
  });
1269
1309
  async function executeWdkSwap(input, wdk) {
1310
+ if (!input.confirmed) {
1311
+ return {
1312
+ needsConfirmation: true,
1313
+ summary: `Swap ${input.amount} ${input.fromToken} to ${input.toToken} on ${input.chain}`,
1314
+ details: {
1315
+ fromToken: input.fromToken,
1316
+ toToken: input.toToken,
1317
+ amount: input.amount,
1318
+ chain: input.chain
1319
+ }
1320
+ };
1321
+ }
1270
1322
  const decimals = ["USDC", "USDT", "USDT0"].includes(input.fromToken.toUpperCase()) ? 6 : 18;
1271
1323
  const amountBigInt = parseUnits3(input.amount, decimals);
1272
1324
  const quote = await wdk.getSwapQuote(input.chain, input.fromToken, amountBigInt);
@@ -1287,6 +1339,18 @@ async function executeWdkSwap(input, wdk) {
1287
1339
  };
1288
1340
  }
1289
1341
  function executeWdkSwapDemo(input) {
1342
+ if (!input.confirmed) {
1343
+ return {
1344
+ needsConfirmation: true,
1345
+ summary: `Swap ${input.amount} ${input.fromToken} to ${input.toToken} on ${input.chain}`,
1346
+ details: {
1347
+ fromToken: input.fromToken,
1348
+ toToken: input.toToken,
1349
+ amount: input.amount,
1350
+ chain: input.chain
1351
+ }
1352
+ };
1353
+ }
1290
1354
  const inputAmount = parseFloat(input.amount);
1291
1355
  const outputAmount = (inputAmount * 0.997).toFixed(6);
1292
1356
  return {
@@ -1319,25 +1383,52 @@ var autoPayInputSchema = z11.object({
1319
1383
  maxAmount: z11.string().regex(/^\d+(\.\d+)?$/).optional().describe('Maximum amount willing to pay (e.g., "10.00"). If not set, pays any amount.'),
1320
1384
  preferredChain: z11.string().optional().describe(
1321
1385
  'Preferred chain for payment (e.g., "arbitrum"). If not specified, uses first available.'
1322
- )
1386
+ ),
1387
+ confirmed: z11.boolean().optional().describe("Set to true to confirm and execute this payment")
1323
1388
  });
1324
1389
  async function executeAutoPay(input, wdk) {
1325
- const chains7 = input.preferredChain ? [input.preferredChain] : ["ethereum", "arbitrum", "base"];
1390
+ if (!input.confirmed) {
1391
+ return {
1392
+ needsConfirmation: true,
1393
+ summary: `Auto-pay for ${input.url}${input.maxAmount ? ` (max ${input.maxAmount})` : ""}`,
1394
+ details: {
1395
+ url: input.url,
1396
+ ...input.maxAmount ? { maxAmount: input.maxAmount } : {},
1397
+ ...input.preferredChain ? { preferredChain: input.preferredChain } : {}
1398
+ }
1399
+ };
1400
+ }
1401
+ const chains10 = input.preferredChain ? [input.preferredChain] : ["ethereum", "arbitrum", "base"];
1326
1402
  const { T402Protocol } = await import("@t402/wdk-protocol");
1327
- const protocol = await T402Protocol.create(wdk, { chains: chains7 });
1328
- const { response, receipt } = await protocol.fetch(input.url);
1329
- if (receipt && input.maxAmount) {
1330
- const paidAmount = parseFloat(receipt.amount) / 1e6;
1403
+ const protocol = await T402Protocol.create(wdk, { chains: chains10 });
1404
+ if (input.maxAmount) {
1331
1405
  const maxAmount = parseFloat(input.maxAmount);
1332
- if (paidAmount > maxAmount) {
1333
- return {
1334
- success: false,
1335
- statusCode: 402,
1336
- body: "",
1337
- error: `Payment amount (${paidAmount}) exceeds max allowed (${maxAmount})`
1338
- };
1406
+ const preflightResponse = await fetch(input.url);
1407
+ if (preflightResponse.status === 402) {
1408
+ const requirementsHeader = preflightResponse.headers.get("x-payment") || preflightResponse.headers.get("x-payment-requirements");
1409
+ if (requirementsHeader) {
1410
+ try {
1411
+ const requirements = JSON.parse(requirementsHeader);
1412
+ const reqArray = Array.isArray(requirements) ? requirements : [requirements];
1413
+ for (const req of reqArray) {
1414
+ if (req.amount) {
1415
+ const reqAmount = parseFloat(req.amount) / 1e6;
1416
+ if (reqAmount > maxAmount) {
1417
+ return {
1418
+ success: false,
1419
+ statusCode: 402,
1420
+ body: "",
1421
+ error: `Required payment amount (${reqAmount}) exceeds max allowed (${maxAmount})`
1422
+ };
1423
+ }
1424
+ }
1425
+ }
1426
+ } catch {
1427
+ }
1428
+ }
1339
1429
  }
1340
1430
  }
1431
+ const { response, receipt } = await protocol.fetch(input.url);
1341
1432
  const contentType = response.headers.get("content-type") ?? void 0;
1342
1433
  let body = "";
1343
1434
  try {
@@ -1362,6 +1453,17 @@ async function executeAutoPay(input, wdk) {
1362
1453
  };
1363
1454
  }
1364
1455
  function executeAutoPayDemo(input) {
1456
+ if (!input.confirmed) {
1457
+ return {
1458
+ needsConfirmation: true,
1459
+ summary: `Auto-pay for ${input.url}${input.maxAmount ? ` (max ${input.maxAmount})` : ""}`,
1460
+ details: {
1461
+ url: input.url,
1462
+ ...input.maxAmount ? { maxAmount: input.maxAmount } : {},
1463
+ ...input.preferredChain ? { preferredChain: input.preferredChain } : {}
1464
+ }
1465
+ };
1466
+ }
1365
1467
  return {
1366
1468
  success: true,
1367
1469
  statusCode: 200,
@@ -1813,175 +1915,1307 @@ function formatErc8004VerifyWalletResult(result) {
1813
1915
  return lines.join("\n");
1814
1916
  }
1815
1917
 
1816
- // src/tools/unified.ts
1918
+ // src/tools/priceService.ts
1919
+ var CACHE_TTL_MS = 5 * 60 * 1e3;
1920
+ var COINGECKO_API = "https://api.coingecko.com/api/v3/simple/price";
1921
+ var TOKEN_TO_COINGECKO_ID = {
1922
+ ETH: "ethereum",
1923
+ MATIC: "matic-network",
1924
+ AVAX: "avalanche-2",
1925
+ BERA: "berachain-bera",
1926
+ USDC: "usd-coin",
1927
+ USDT: "tether",
1928
+ USDT0: "tether"
1929
+ };
1930
+ var cache = /* @__PURE__ */ new Map();
1931
+ async function getTokenPrices(tokens, currency = "usd") {
1932
+ const cacheKey = `${currency}:${tokens.sort().join(",")}`;
1933
+ const cached = cache.get(cacheKey);
1934
+ if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
1935
+ return cached.prices;
1936
+ }
1937
+ const coinIds = /* @__PURE__ */ new Set();
1938
+ const tokenToCoinId = /* @__PURE__ */ new Map();
1939
+ for (const token of tokens) {
1940
+ const coinId = TOKEN_TO_COINGECKO_ID[token.toUpperCase()] ?? token.toLowerCase();
1941
+ coinIds.add(coinId);
1942
+ tokenToCoinId.set(token.toUpperCase(), coinId);
1943
+ }
1944
+ const url = `${COINGECKO_API}?ids=${[...coinIds].join(",")}&vs_currencies=${currency}`;
1945
+ const response = await fetch(url);
1946
+ if (!response.ok) {
1947
+ throw new Error(`CoinGecko API error: ${response.status} ${response.statusText}`);
1948
+ }
1949
+ const data = await response.json();
1950
+ const prices = {};
1951
+ for (const token of tokens) {
1952
+ const coinId = tokenToCoinId.get(token.toUpperCase()) ?? token.toLowerCase();
1953
+ prices[token.toUpperCase()] = data[coinId]?.[currency] ?? 0;
1954
+ }
1955
+ cache.set(cacheKey, { prices, timestamp: Date.now() });
1956
+ return prices;
1957
+ }
1958
+ function getTokenPricesDemo(tokens) {
1959
+ const demoPrices = {
1960
+ ETH: 3250.42,
1961
+ MATIC: 0.58,
1962
+ AVAX: 24.15,
1963
+ BERA: 3.82,
1964
+ USDC: 1,
1965
+ USDT: 1,
1966
+ USDT0: 1
1967
+ };
1968
+ const prices = {};
1969
+ for (const token of tokens) {
1970
+ prices[token.toUpperCase()] = demoPrices[token.toUpperCase()] ?? 0;
1971
+ }
1972
+ return prices;
1973
+ }
1974
+ function clearPriceCache() {
1975
+ cache.clear();
1976
+ }
1977
+
1978
+ // src/tools/getTokenPrice.ts
1817
1979
  import { z as z15 } from "zod";
1818
- var smartPayInputSchema = z15.object({
1819
- url: z15.string().url().describe("URL of the 402-protected resource"),
1820
- maxBridgeFee: z15.string().regex(/^\d+(\.\d+)?$/).optional().describe("Maximum acceptable bridge fee in native token (optional)"),
1821
- preferredNetwork: z15.string().optional().describe("Preferred network for payment (optional)")
1822
- });
1823
- var paymentPlanInputSchema = z15.object({
1824
- paymentRequired: z15.object({
1825
- scheme: z15.string().optional(),
1826
- network: z15.string().optional(),
1827
- maxAmountRequired: z15.string().optional(),
1828
- resource: z15.string().optional(),
1829
- description: z15.string().optional(),
1830
- payTo: z15.string().optional(),
1831
- maxDeadline: z15.number().optional()
1832
- }).passthrough().describe("The 402 PaymentRequired response")
1980
+ var getTokenPriceInputSchema = z15.object({
1981
+ tokens: z15.array(z15.string()).min(1).describe('Token symbols to get prices for (e.g., ["ETH", "MATIC", "USDC"])'),
1982
+ currency: z15.string().optional().describe('Target currency (default: "usd"). Supports: usd, eur, gbp, etc.')
1833
1983
  });
1834
- var UNIFIED_TOOL_DEFINITIONS = {
1835
- "t402/smartPay": {
1836
- name: "t402/smartPay",
1837
- description: "Intelligent payment that automatically checks balance, bridges if needed, and pays. Handles the entire payment flow for 402-protected resources.",
1838
- inputSchema: {
1839
- type: "object",
1840
- properties: {
1841
- url: { type: "string", description: "URL of the 402-protected resource" },
1842
- maxBridgeFee: {
1843
- type: "string",
1844
- description: "Maximum acceptable bridge fee in native token (optional)"
1845
- },
1846
- preferredNetwork: {
1847
- type: "string",
1848
- description: "Preferred network for payment (optional)"
1849
- }
1850
- },
1851
- required: ["url"]
1852
- }
1853
- },
1854
- "t402/paymentPlan": {
1855
- name: "t402/paymentPlan",
1856
- description: "Analyze a 402 response and create an optimal payment plan considering balances across all chains. Returns recommended network, bridge requirements, and balance overview.",
1857
- inputSchema: {
1858
- type: "object",
1859
- properties: {
1860
- paymentRequired: {
1861
- type: "object",
1862
- description: "The 402 PaymentRequired response"
1863
- }
1864
- },
1865
- required: ["paymentRequired"]
1984
+ async function executeGetTokenPrice(input, options) {
1985
+ const currency = input.currency ?? "usd";
1986
+ const prices = options.demoMode ? getTokenPricesDemo(input.tokens) : await getTokenPrices(input.tokens, currency);
1987
+ return { prices, currency };
1988
+ }
1989
+ function formatTokenPriceResult(result) {
1990
+ const lines = ["## Token Prices", ""];
1991
+ const currencyUpper = result.currency.toUpperCase();
1992
+ for (const [token, price] of Object.entries(result.prices)) {
1993
+ if (price > 0) {
1994
+ lines.push(`- **${token}:** ${price.toLocaleString()} ${currencyUpper}`);
1995
+ } else {
1996
+ lines.push(`- **${token}:** Price unavailable`);
1866
1997
  }
1867
1998
  }
1868
- };
1869
- async function executeSmartPay(input, wdk) {
1870
- const steps = [];
1871
- const chains7 = input.preferredNetwork ? [input.preferredNetwork] : ["ethereum", "arbitrum", "base"];
1872
- steps.push({
1873
- action: "check_balance",
1874
- status: "success",
1875
- detail: `Checking balances on ${chains7.join(", ")}`
1876
- });
1877
- const { T402Protocol } = await import("@t402/wdk-protocol");
1878
- const protocol = await T402Protocol.create(wdk, { chains: chains7 });
1879
- steps.push({
1880
- action: "fetch",
1881
- status: "success",
1882
- detail: `Fetching ${input.url}`
1883
- });
1884
- const { response, receipt } = await protocol.fetch(input.url);
1885
- if (receipt) {
1886
- steps.push({
1887
- action: "pay",
1888
- status: "success",
1889
- detail: `Payment made: ${receipt.amount} on ${receipt.network}`
1890
- });
1999
+ return lines.join("\n");
2000
+ }
2001
+
2002
+ // src/tools/getGasPrice.ts
2003
+ import { z as z16 } from "zod";
2004
+ import { createPublicClient as createPublicClient7, http as http7, formatGwei } from "viem";
2005
+ import * as chains7 from "viem/chains";
2006
+ var getGasPriceInputSchema = z16.object({
2007
+ network: z16.enum([
2008
+ "ethereum",
2009
+ "base",
2010
+ "arbitrum",
2011
+ "optimism",
2012
+ "polygon",
2013
+ "avalanche",
2014
+ "ink",
2015
+ "berachain",
2016
+ "unichain"
2017
+ ]).describe("Blockchain network to check gas price on")
2018
+ });
2019
+ function getViemChain6(network) {
2020
+ switch (network) {
2021
+ case "ethereum":
2022
+ return chains7.mainnet;
2023
+ case "base":
2024
+ return chains7.base;
2025
+ case "arbitrum":
2026
+ return chains7.arbitrum;
2027
+ case "optimism":
2028
+ return chains7.optimism;
2029
+ case "polygon":
2030
+ return chains7.polygon;
2031
+ case "avalanche":
2032
+ return chains7.avalanche;
2033
+ case "ink":
2034
+ return chains7.ink;
2035
+ case "berachain":
2036
+ return chains7.berachain;
2037
+ case "unichain":
2038
+ return chains7.unichain;
2039
+ default:
2040
+ return chains7.mainnet;
1891
2041
  }
1892
- const contentType = response.headers.get("content-type") ?? void 0;
1893
- let body = "";
1894
- try {
1895
- body = await response.text();
1896
- if (body.length > 1e4) {
1897
- body = body.slice(0, 1e4) + "\n... (truncated)";
1898
- }
1899
- } catch {
1900
- body = "[Could not read response body]";
2042
+ }
2043
+ async function executeGetGasPrice(input, options) {
2044
+ const { network } = input;
2045
+ if (options.demoMode) {
2046
+ const demoGasPrices = {
2047
+ ethereum: 25000000000n,
2048
+ // 25 gwei
2049
+ base: 50000000n,
2050
+ // 0.05 gwei
2051
+ arbitrum: 100000000n,
2052
+ // 0.1 gwei
2053
+ optimism: 50000000n,
2054
+ // 0.05 gwei
2055
+ polygon: 30000000000n,
2056
+ // 30 gwei
2057
+ avalanche: 25000000000n,
2058
+ // 25 nAVAX
2059
+ ink: 50000000n,
2060
+ // 0.05 gwei
2061
+ berachain: 1000000000n,
2062
+ // 1 gwei
2063
+ unichain: 50000000n
2064
+ // 0.05 gwei
2065
+ };
2066
+ const gasPrice2 = demoGasPrices[network] ?? 1000000000n;
2067
+ return {
2068
+ network,
2069
+ gasPriceWei: gasPrice2.toString(),
2070
+ gasPriceGwei: formatGwei(gasPrice2),
2071
+ nativeSymbol: NATIVE_SYMBOLS[network]
2072
+ };
1901
2073
  }
2074
+ const chain = getViemChain6(network);
2075
+ const transport = http7(options.rpcUrl ?? DEFAULT_RPC_URLS[network]);
2076
+ const client = createPublicClient7({ chain, transport });
2077
+ const gasPrice = await client.getGasPrice();
1902
2078
  return {
1903
- success: response.ok,
1904
- statusCode: response.status,
1905
- body,
1906
- contentType,
1907
- steps,
1908
- payment: receipt ? {
1909
- network: receipt.network,
1910
- scheme: receipt.scheme,
1911
- amount: receipt.amount,
1912
- payTo: receipt.payTo
1913
- } : void 0
2079
+ network,
2080
+ gasPriceWei: gasPrice.toString(),
2081
+ gasPriceGwei: formatGwei(gasPrice),
2082
+ nativeSymbol: NATIVE_SYMBOLS[network]
1914
2083
  };
1915
2084
  }
1916
- function executeSmartPayDemo(input) {
1917
- const network = input.preferredNetwork ?? "arbitrum";
1918
- return {
1919
- success: true,
1920
- statusCode: 200,
1921
- body: `[Demo] Premium content from ${input.url}
2085
+ function formatGasPriceResult(result) {
2086
+ return [
2087
+ "## Gas Price",
2088
+ "",
2089
+ `- **Network:** ${result.network}`,
2090
+ `- **Gas Price:** ${result.gasPriceGwei} gwei`,
2091
+ `- **Native Token:** ${result.nativeSymbol}`
2092
+ ].join("\n");
2093
+ }
1922
2094
 
1923
- This is simulated content returned after smart payment.`,
1924
- contentType: "text/plain",
1925
- steps: [
1926
- { action: "check_balance", status: "success", detail: `Checked balances on ${network}` },
1927
- { action: "check_price", status: "success", detail: "Resource costs 1.00 USDT0" },
1928
- { action: "pay", status: "success", detail: `Paid 1000000 USDT0 on eip155:42161` },
1929
- { action: "fetch", status: "success", detail: `Fetched ${input.url}` }
1930
- ],
1931
- payment: {
1932
- network: "eip155:42161",
1933
- scheme: "exact",
1934
- amount: "1000000",
1935
- payTo: "0xC88f67e776f16DcFBf42e6bDda1B82604448899B"
1936
- }
1937
- };
2095
+ // src/tools/estimatePaymentFee.ts
2096
+ import { z as z17 } from "zod";
2097
+ import { createPublicClient as createPublicClient8, http as http8, formatEther as formatEther3, formatGwei as formatGwei2, parseUnits as parseUnits4 } from "viem";
2098
+ import * as chains8 from "viem/chains";
2099
+ var estimatePaymentFeeInputSchema = z17.object({
2100
+ network: z17.enum([
2101
+ "ethereum",
2102
+ "base",
2103
+ "arbitrum",
2104
+ "optimism",
2105
+ "polygon",
2106
+ "avalanche",
2107
+ "ink",
2108
+ "berachain",
2109
+ "unichain"
2110
+ ]).describe("Network to estimate fee on"),
2111
+ amount: z17.string().regex(/^\d+(\.\d+)?$/).describe("Payment amount (e.g., '100')"),
2112
+ token: z17.enum(["USDC", "USDT", "USDT0"]).describe("Token to use for payment")
2113
+ });
2114
+ function getViemChain7(network) {
2115
+ switch (network) {
2116
+ case "ethereum":
2117
+ return chains8.mainnet;
2118
+ case "base":
2119
+ return chains8.base;
2120
+ case "arbitrum":
2121
+ return chains8.arbitrum;
2122
+ case "optimism":
2123
+ return chains8.optimism;
2124
+ case "polygon":
2125
+ return chains8.polygon;
2126
+ case "avalanche":
2127
+ return chains8.avalanche;
2128
+ case "ink":
2129
+ return chains8.ink;
2130
+ case "berachain":
2131
+ return chains8.berachain;
2132
+ case "unichain":
2133
+ return chains8.unichain;
2134
+ default:
2135
+ return chains8.mainnet;
2136
+ }
1938
2137
  }
1939
- async function executePaymentPlan(input, wdk) {
1940
- const targetNetwork = input.paymentRequired.network;
1941
- const requiredAmount = input.paymentRequired.maxAmountRequired;
1942
- const aggregated = await wdk.getAggregatedBalances();
1943
- const balances = aggregated.chains.map((chain) => {
1944
- const usdt0 = chain.tokens.find((t) => t.symbol === "USDT0");
1945
- const usdc = chain.tokens.find((t) => t.symbol === "USDC");
1946
- return {
1947
- chain: chain.chain,
1948
- usdt0: usdt0?.formatted ?? "0",
1949
- usdc: usdc?.formatted ?? "0"
2138
+ async function executeEstimatePaymentFee(input, options) {
2139
+ const { network, amount, token } = input;
2140
+ const nativeSymbol = NATIVE_SYMBOLS[network];
2141
+ if (options.demoMode) {
2142
+ const demoEstimates = {
2143
+ ethereum: { gasLimit: 65000n, gasPrice: 25000000000n, nativePrice: 3250.42 },
2144
+ base: { gasLimit: 65000n, gasPrice: 50000000n, nativePrice: 3250.42 },
2145
+ arbitrum: { gasLimit: 65000n, gasPrice: 100000000n, nativePrice: 3250.42 },
2146
+ optimism: { gasLimit: 65000n, gasPrice: 50000000n, nativePrice: 3250.42 },
2147
+ polygon: { gasLimit: 65000n, gasPrice: 30000000000n, nativePrice: 0.58 },
2148
+ avalanche: { gasLimit: 65000n, gasPrice: 25000000000n, nativePrice: 24.15 },
2149
+ ink: { gasLimit: 65000n, gasPrice: 50000000n, nativePrice: 3250.42 },
2150
+ berachain: { gasLimit: 65000n, gasPrice: 1000000000n, nativePrice: 3.82 },
2151
+ unichain: { gasLimit: 65000n, gasPrice: 50000000n, nativePrice: 3250.42 }
1950
2152
  };
1951
- });
1952
- const requiredBigint = requiredAmount ? BigInt(requiredAmount) : 0n;
1953
- const bestChain = await wdk.findBestChainForPayment(requiredBigint);
1954
- if (bestChain) {
1955
- const needsBridge = targetNetwork ? !bestChain.chain.includes(targetNetwork) : false;
2153
+ const est = demoEstimates[network] ?? demoEstimates["ethereum"];
2154
+ const nativeCost2 = est.gasLimit * est.gasPrice;
2155
+ const usdCost2 = Number(nativeCost2) / 1e18 * est.nativePrice;
1956
2156
  return {
1957
- viable: true,
1958
- recommendedNetwork: bestChain.chain,
1959
- availableBalance: bestChain.balance.toString(),
1960
- bridgeRequired: needsBridge,
1961
- bridgeDetails: needsBridge ? {
1962
- fromChain: bestChain.chain,
1963
- toChain: targetNetwork ?? bestChain.chain,
1964
- amount: requiredAmount ?? "0",
1965
- estimatedFee: "0.001"
1966
- } : void 0,
1967
- balances
2157
+ network,
2158
+ gasLimit: est.gasLimit.toString(),
2159
+ gasPriceGwei: formatGwei2(est.gasPrice),
2160
+ nativeCost: formatEther3(nativeCost2),
2161
+ nativeSymbol,
2162
+ usdCost: `$${usdCost2.toFixed(4)}`
1968
2163
  };
1969
2164
  }
2165
+ const tokenAddress = getTokenAddress(network, token);
2166
+ if (!tokenAddress) {
2167
+ throw new Error(`Token ${token} is not supported on ${network}`);
2168
+ }
2169
+ const chain = getViemChain7(network);
2170
+ const transport = http8(options.rpcUrl ?? DEFAULT_RPC_URLS[network]);
2171
+ const client = createPublicClient8({ chain, transport });
2172
+ const amountBigInt = parseUnits4(amount, 6);
2173
+ const dummyTo = "0x000000000000000000000000000000000000dEaD";
2174
+ let gasLimit;
2175
+ try {
2176
+ gasLimit = await client.estimateGas({
2177
+ to: tokenAddress,
2178
+ data: `0xa9059cbb${dummyTo.slice(2).padStart(64, "0")}${amountBigInt.toString(16).padStart(64, "0")}`
2179
+ });
2180
+ } catch {
2181
+ gasLimit = 65000n;
2182
+ }
2183
+ const gasPrice = await client.getGasPrice();
2184
+ const nativeCost = gasLimit * gasPrice;
2185
+ let usdCost;
2186
+ try {
2187
+ const prices = await getTokenPrices([nativeSymbol]);
2188
+ const nativePrice = prices[nativeSymbol] ?? 0;
2189
+ const cost = Number(nativeCost) / 1e18 * nativePrice;
2190
+ usdCost = `$${cost.toFixed(4)}`;
2191
+ } catch {
2192
+ usdCost = "N/A";
2193
+ }
1970
2194
  return {
1971
- viable: false,
1972
- bridgeRequired: false,
1973
- balances,
1974
- reason: "Insufficient balance across all chains"
2195
+ network,
2196
+ gasLimit: gasLimit.toString(),
2197
+ gasPriceGwei: formatGwei2(gasPrice),
2198
+ nativeCost: formatEther3(nativeCost),
2199
+ nativeSymbol,
2200
+ usdCost
1975
2201
  };
1976
2202
  }
1977
- function executePaymentPlanDemo(_input) {
1978
- return {
1979
- viable: true,
1980
- recommendedNetwork: "arbitrum",
1981
- availableBalance: "500000000",
1982
- bridgeRequired: false,
1983
- balances: [
1984
- { chain: "ethereum", usdt0: "100.00", usdc: "250.00" },
2203
+ function formatPaymentFeeEstimate(result) {
2204
+ return [
2205
+ "## Payment Fee Estimate",
2206
+ "",
2207
+ `- **Network:** ${result.network}`,
2208
+ `- **Estimated Gas:** ${result.gasLimit}`,
2209
+ `- **Gas Price:** ${result.gasPriceGwei} gwei`,
2210
+ `- **Native Cost:** ${result.nativeCost} ${result.nativeSymbol}`,
2211
+ `- **USD Cost:** ${result.usdCost}`
2212
+ ].join("\n");
2213
+ }
2214
+
2215
+ // src/tools/compareNetworkFees.ts
2216
+ import { z as z18 } from "zod";
2217
+ var compareNetworkFeesInputSchema = z18.object({
2218
+ amount: z18.string().regex(/^\d+(\.\d+)?$/).describe("Payment amount (e.g., '100')"),
2219
+ token: z18.enum(["USDC", "USDT", "USDT0"]).describe("Token to use for payment"),
2220
+ networks: z18.array(z18.string()).optional().describe(
2221
+ "Networks to compare. If not provided, compares all networks that support the token."
2222
+ )
2223
+ });
2224
+ var ALL_NETWORKS2 = [
2225
+ "ethereum",
2226
+ "base",
2227
+ "arbitrum",
2228
+ "optimism",
2229
+ "polygon",
2230
+ "avalanche",
2231
+ "ink",
2232
+ "berachain",
2233
+ "unichain"
2234
+ ];
2235
+ async function executeCompareNetworkFees(input, options) {
2236
+ const { amount, token } = input;
2237
+ const requestedNetworks = input.networks ? input.networks : ALL_NETWORKS2;
2238
+ const networks = requestedNetworks.filter((n) => supportsToken(n, token));
2239
+ if (networks.length === 0) {
2240
+ throw new Error(`No supported networks found for token ${token}`);
2241
+ }
2242
+ const results = await Promise.allSettled(
2243
+ networks.map(
2244
+ (network) => executeEstimatePaymentFee(
2245
+ { network, amount, token },
2246
+ {
2247
+ rpcUrl: options.rpcUrls?.[network],
2248
+ demoMode: options.demoMode
2249
+ }
2250
+ )
2251
+ )
2252
+ );
2253
+ const fees = [];
2254
+ for (const result of results) {
2255
+ if (result.status === "fulfilled") {
2256
+ fees.push(result.value);
2257
+ }
2258
+ }
2259
+ if (fees.length === 0) {
2260
+ throw new Error("Failed to estimate fees on any network");
2261
+ }
2262
+ fees.sort((a, b) => {
2263
+ const costA = parseFloat(a.nativeCost) || Infinity;
2264
+ const costB = parseFloat(b.nativeCost) || Infinity;
2265
+ const usdA = parseFloat(a.usdCost.replace("$", "")) || Infinity;
2266
+ const usdB = parseFloat(b.usdCost.replace("$", "")) || Infinity;
2267
+ return usdA - usdB || costA - costB;
2268
+ });
2269
+ return {
2270
+ token,
2271
+ amount,
2272
+ fees,
2273
+ cheapest: fees[0].network
2274
+ };
2275
+ }
2276
+ function formatNetworkFeeComparison(result) {
2277
+ const lines = [
2278
+ "## Network Fee Comparison",
2279
+ "",
2280
+ `**Token:** ${result.token} | **Amount:** ${result.amount}`,
2281
+ `**Cheapest:** ${result.cheapest}`,
2282
+ "",
2283
+ "| Network | Gas Price | Native Cost | USD Cost |",
2284
+ "|---------|----------|-------------|----------|"
2285
+ ];
2286
+ for (const fee of result.fees) {
2287
+ const marker = fee.network === result.cheapest ? " *" : "";
2288
+ lines.push(
2289
+ `| ${fee.network}${marker} | ${fee.gasPriceGwei} gwei | ${fee.nativeCost} ${fee.nativeSymbol} | ${fee.usdCost} |`
2290
+ );
2291
+ }
2292
+ return lines.join("\n");
2293
+ }
2294
+
2295
+ // src/tools/signMessage.ts
2296
+ import { z as z19 } from "zod";
2297
+ var signMessageInputSchema = z19.object({
2298
+ chain: z19.enum([
2299
+ "ethereum",
2300
+ "base",
2301
+ "arbitrum",
2302
+ "optimism",
2303
+ "polygon",
2304
+ "avalanche",
2305
+ "ink",
2306
+ "berachain",
2307
+ "unichain"
2308
+ ]).describe("Blockchain network context for signing"),
2309
+ message: z19.string().min(1).describe("Message to sign")
2310
+ });
2311
+ async function executeSignMessage(_input) {
2312
+ throw new Error(
2313
+ "Wallet not configured. To sign messages, configure a private key via the T402_PRIVATE_KEY environment variable."
2314
+ );
2315
+ }
2316
+ function formatSignMessageResult(result) {
2317
+ const lines = [
2318
+ `## Message Signed on ${result.network}`,
2319
+ "",
2320
+ `- **Signer:** ${result.address}`,
2321
+ `- **Message:** ${result.message.length > 100 ? result.message.slice(0, 100) + "..." : result.message}`,
2322
+ `- **Signature:** \`${result.signature}\``
2323
+ ];
2324
+ return lines.join("\n");
2325
+ }
2326
+
2327
+ // src/tools/verifySignature.ts
2328
+ import { z as z20 } from "zod";
2329
+ import { verifyMessage } from "viem";
2330
+ var verifySignatureInputSchema = z20.object({
2331
+ chain: z20.enum([
2332
+ "ethereum",
2333
+ "base",
2334
+ "arbitrum",
2335
+ "optimism",
2336
+ "polygon",
2337
+ "avalanche",
2338
+ "ink",
2339
+ "berachain",
2340
+ "unichain"
2341
+ ]).describe("Blockchain network context for verification"),
2342
+ message: z20.string().min(1).describe("The original message that was signed"),
2343
+ signature: z20.string().regex(/^0x[a-fA-F0-9]+$/).describe("The signature to verify (hex string)"),
2344
+ address: z20.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("The expected signer address")
2345
+ });
2346
+ async function executeVerifySignature(input) {
2347
+ const { chain, message, signature, address } = input;
2348
+ try {
2349
+ const valid = await verifyMessage({
2350
+ address,
2351
+ message,
2352
+ signature
2353
+ });
2354
+ return {
2355
+ valid,
2356
+ address,
2357
+ message,
2358
+ network: chain
2359
+ };
2360
+ } catch (err) {
2361
+ return {
2362
+ valid: false,
2363
+ address,
2364
+ message,
2365
+ network: chain,
2366
+ error: err instanceof Error ? err.message : "Unknown verification error"
2367
+ };
2368
+ }
2369
+ }
2370
+ function formatVerifySignatureResult(result) {
2371
+ const status = result.valid ? "VALID" : "INVALID";
2372
+ const lines = [
2373
+ `## Signature Verification: ${status}`,
2374
+ "",
2375
+ `- **Address:** ${result.address}`,
2376
+ `- **Network:** ${result.network}`,
2377
+ `- **Message:** ${result.message.length > 100 ? result.message.slice(0, 100) + "..." : result.message}`,
2378
+ `- **Result:** ${result.valid ? "Signature is valid and matches the address" : "Signature does NOT match the address"}`
2379
+ ];
2380
+ if (result.error) {
2381
+ lines.push(`- **Error:** ${result.error}`);
2382
+ }
2383
+ return lines.join("\n");
2384
+ }
2385
+
2386
+ // src/tools/getTransferHistory.ts
2387
+ import { z as z21 } from "zod";
2388
+ import { createPublicClient as createPublicClient9, http as http9, formatUnits as formatUnits4, parseAbiItem } from "viem";
2389
+ import * as chains9 from "viem/chains";
2390
+ var getTransferHistoryInputSchema = z21.object({
2391
+ network: z21.enum([
2392
+ "ethereum",
2393
+ "base",
2394
+ "arbitrum",
2395
+ "optimism",
2396
+ "polygon",
2397
+ "avalanche",
2398
+ "ink",
2399
+ "berachain",
2400
+ "unichain"
2401
+ ]).describe("Blockchain network to query"),
2402
+ address: z21.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Wallet address to get transfer history for"),
2403
+ token: z21.enum(["USDC", "USDT", "USDT0"]).optional().describe("Filter by specific token. If not provided, queries all supported stablecoins."),
2404
+ limit: z21.number().int().min(1).max(100).optional().describe("Maximum number of transfers to return (default: 10, max: 100)")
2405
+ });
2406
+ function getViemChain8(network) {
2407
+ switch (network) {
2408
+ case "ethereum":
2409
+ return chains9.mainnet;
2410
+ case "base":
2411
+ return chains9.base;
2412
+ case "arbitrum":
2413
+ return chains9.arbitrum;
2414
+ case "optimism":
2415
+ return chains9.optimism;
2416
+ case "polygon":
2417
+ return chains9.polygon;
2418
+ case "avalanche":
2419
+ return chains9.avalanche;
2420
+ case "ink":
2421
+ return chains9.ink;
2422
+ case "berachain":
2423
+ return chains9.berachain;
2424
+ case "unichain":
2425
+ return chains9.unichain;
2426
+ default:
2427
+ return chains9.mainnet;
2428
+ }
2429
+ }
2430
+ var TOKEN_DECIMALS = {
2431
+ USDC: 6,
2432
+ USDT: 6,
2433
+ USDT0: 6
2434
+ };
2435
+ async function executeGetTransferHistory(input, rpcUrls) {
2436
+ const { network, address, token, limit = 10 } = input;
2437
+ const walletAddress = address.toLowerCase();
2438
+ const rpcUrl = rpcUrls?.[network] || DEFAULT_RPC_URLS[network];
2439
+ const chain = getViemChain8(network);
2440
+ const client = createPublicClient9({
2441
+ chain,
2442
+ transport: http9(rpcUrl)
2443
+ });
2444
+ const tokenContracts = [];
2445
+ if (token) {
2446
+ const addresses = token === "USDC" ? USDC_ADDRESSES : token === "USDT" ? USDT_ADDRESSES : USDT0_ADDRESSES;
2447
+ const addr = addresses[network];
2448
+ if (addr) {
2449
+ tokenContracts.push({ address: addr, symbol: token });
2450
+ }
2451
+ } else {
2452
+ if (USDC_ADDRESSES[network]) {
2453
+ tokenContracts.push({ address: USDC_ADDRESSES[network], symbol: "USDC" });
2454
+ }
2455
+ if (USDT_ADDRESSES[network]) {
2456
+ tokenContracts.push({ address: USDT_ADDRESSES[network], symbol: "USDT" });
2457
+ }
2458
+ if (USDT0_ADDRESSES[network]) {
2459
+ tokenContracts.push({ address: USDT0_ADDRESSES[network], symbol: "USDT0" });
2460
+ }
2461
+ }
2462
+ if (tokenContracts.length === 0) {
2463
+ return {
2464
+ network,
2465
+ chainId: CHAIN_IDS[network],
2466
+ address,
2467
+ transfers: [],
2468
+ explorerUrl: EXPLORER_URLS[network]
2469
+ };
2470
+ }
2471
+ const currentBlock = await client.getBlockNumber();
2472
+ const fromBlock = currentBlock > 50000n ? currentBlock - 50000n : 0n;
2473
+ const transferEvent = parseAbiItem(
2474
+ "event Transfer(address indexed from, address indexed to, uint256 value)"
2475
+ );
2476
+ const allTransfers = [];
2477
+ for (const tokenContract of tokenContracts) {
2478
+ const decimals = TOKEN_DECIMALS[tokenContract.symbol] ?? 6;
2479
+ const [sentLogs, receivedLogs] = await Promise.all([
2480
+ client.getLogs({
2481
+ address: tokenContract.address,
2482
+ event: transferEvent,
2483
+ args: { from: walletAddress },
2484
+ fromBlock,
2485
+ toBlock: "latest"
2486
+ }),
2487
+ client.getLogs({
2488
+ address: tokenContract.address,
2489
+ event: transferEvent,
2490
+ args: { to: walletAddress },
2491
+ fromBlock,
2492
+ toBlock: "latest"
2493
+ })
2494
+ ]);
2495
+ for (const log of sentLogs) {
2496
+ allTransfers.push({
2497
+ txHash: log.transactionHash,
2498
+ blockNumber: (log.blockNumber ?? 0n).toString(),
2499
+ from: log.args.from ?? "",
2500
+ to: log.args.to ?? "",
2501
+ amount: formatUnits4(log.args.value ?? 0n, decimals),
2502
+ token: tokenContract.symbol,
2503
+ tokenAddress: tokenContract.address,
2504
+ direction: "out"
2505
+ });
2506
+ }
2507
+ for (const log of receivedLogs) {
2508
+ allTransfers.push({
2509
+ txHash: log.transactionHash,
2510
+ blockNumber: (log.blockNumber ?? 0n).toString(),
2511
+ from: log.args.from ?? "",
2512
+ to: log.args.to ?? "",
2513
+ amount: formatUnits4(log.args.value ?? 0n, decimals),
2514
+ token: tokenContract.symbol,
2515
+ tokenAddress: tokenContract.address,
2516
+ direction: "in"
2517
+ });
2518
+ }
2519
+ }
2520
+ allTransfers.sort((a, b) => {
2521
+ const blockA = BigInt(a.blockNumber);
2522
+ const blockB = BigInt(b.blockNumber);
2523
+ if (blockB > blockA) return 1;
2524
+ if (blockB < blockA) return -1;
2525
+ return 0;
2526
+ });
2527
+ return {
2528
+ network,
2529
+ chainId: CHAIN_IDS[network],
2530
+ address,
2531
+ transfers: allTransfers.slice(0, limit),
2532
+ explorerUrl: EXPLORER_URLS[network]
2533
+ };
2534
+ }
2535
+ function formatTransferHistoryResult(result) {
2536
+ const lines = [
2537
+ `## Transfer History on ${result.network} (Chain ID: ${result.chainId})`,
2538
+ "",
2539
+ `**Address:** ${result.address}`,
2540
+ ""
2541
+ ];
2542
+ if (result.transfers.length === 0) {
2543
+ lines.push("_No recent transfers found_");
2544
+ return lines.join("\n");
2545
+ }
2546
+ lines.push(`Found ${result.transfers.length} recent transfer(s):`, "");
2547
+ for (const tx of result.transfers) {
2548
+ const arrow = tx.direction === "in" ? "RECEIVED" : "SENT";
2549
+ const counterparty = tx.direction === "in" ? `from ${tx.from}` : `to ${tx.to}`;
2550
+ lines.push(
2551
+ `- **${arrow}** ${tx.amount} ${tx.token} ${counterparty}`,
2552
+ ` Block: ${tx.blockNumber} | [View Tx](${result.explorerUrl}/tx/${tx.txHash})`,
2553
+ ""
2554
+ );
2555
+ }
2556
+ return lines.join("\n");
2557
+ }
2558
+
2559
+ // src/tools/getHistoricalPrice.ts
2560
+ import { z as z22 } from "zod";
2561
+ var getHistoricalPriceInputSchema = z22.object({
2562
+ token: z22.string().min(1).describe('Token symbol (e.g., "ETH", "USDC", "USDT", "MATIC", "AVAX")'),
2563
+ days: z22.number().int().min(1).max(365).optional().describe("Number of days of history to retrieve (default: 7, max: 365)")
2564
+ });
2565
+ var COINGECKO_MARKET_CHART = "https://api.coingecko.com/api/v3/coins";
2566
+ var TOKEN_TO_COINGECKO_ID2 = {
2567
+ ETH: "ethereum",
2568
+ MATIC: "matic-network",
2569
+ AVAX: "avalanche-2",
2570
+ BERA: "berachain-bera",
2571
+ USDC: "usd-coin",
2572
+ USDT: "tether",
2573
+ USDT0: "tether",
2574
+ BTC: "bitcoin",
2575
+ SOL: "solana",
2576
+ TON: "the-open-network",
2577
+ TRX: "tron"
2578
+ };
2579
+ async function executeGetHistoricalPrice(input, options = {}) {
2580
+ const { token, days = 7 } = input;
2581
+ const tokenUpper = token.toUpperCase();
2582
+ const coinId = TOKEN_TO_COINGECKO_ID2[tokenUpper] ?? token.toLowerCase();
2583
+ const currency = "usd";
2584
+ if (options.demoMode) {
2585
+ return generateDemoData(tokenUpper, coinId, days);
2586
+ }
2587
+ const url = `${COINGECKO_MARKET_CHART}/${coinId}/market_chart?vs_currency=${currency}&days=${days}`;
2588
+ const response = await fetch(url);
2589
+ if (!response.ok) {
2590
+ throw new Error(`CoinGecko API error: ${response.status} ${response.statusText}`);
2591
+ }
2592
+ const data = await response.json();
2593
+ const prices = data.prices.map(([timestamp, price]) => ({
2594
+ timestamp,
2595
+ date: new Date(timestamp).toISOString(),
2596
+ price
2597
+ }));
2598
+ const priceValues = prices.map((p) => p.price);
2599
+ const firstPrice = priceValues[0] ?? 0;
2600
+ const lastPrice = priceValues[priceValues.length - 1] ?? 0;
2601
+ const high = Math.max(...priceValues);
2602
+ const low = Math.min(...priceValues);
2603
+ const absolute = lastPrice - firstPrice;
2604
+ const percentage = firstPrice > 0 ? absolute / firstPrice * 100 : 0;
2605
+ return {
2606
+ token: tokenUpper,
2607
+ coinId,
2608
+ currency,
2609
+ days,
2610
+ prices,
2611
+ priceChange: {
2612
+ absolute: Math.round(absolute * 100) / 100,
2613
+ percentage: Math.round(percentage * 100) / 100,
2614
+ high: Math.round(high * 100) / 100,
2615
+ low: Math.round(low * 100) / 100
2616
+ }
2617
+ };
2618
+ }
2619
+ function generateDemoData(token, coinId, days) {
2620
+ const basePrices = {
2621
+ ETH: 3250,
2622
+ MATIC: 0.58,
2623
+ AVAX: 24.15,
2624
+ BERA: 3.82,
2625
+ USDC: 1,
2626
+ USDT: 1,
2627
+ USDT0: 1,
2628
+ BTC: 62e3,
2629
+ SOL: 145,
2630
+ TON: 5.2,
2631
+ TRX: 0.12
2632
+ };
2633
+ const basePrice = basePrices[token] ?? 1;
2634
+ const now = Date.now();
2635
+ const interval = days * 24 * 60 * 60 * 1e3 / Math.min(days * 24, 168);
2636
+ const numPoints = Math.min(days * 24, 168);
2637
+ const prices = [];
2638
+ for (let i = 0; i < numPoints; i++) {
2639
+ const timestamp = now - (numPoints - i) * interval;
2640
+ const fluctuation = 1 + (Math.sin(i * 0.5) * 0.03 + Math.cos(i * 0.3) * 0.02);
2641
+ const price = Math.round(basePrice * fluctuation * 100) / 100;
2642
+ prices.push({
2643
+ timestamp,
2644
+ date: new Date(timestamp).toISOString(),
2645
+ price
2646
+ });
2647
+ }
2648
+ const priceValues = prices.map((p) => p.price);
2649
+ const firstPrice = priceValues[0] ?? 0;
2650
+ const lastPrice = priceValues[priceValues.length - 1] ?? 0;
2651
+ return {
2652
+ token,
2653
+ coinId,
2654
+ currency: "usd",
2655
+ days,
2656
+ prices,
2657
+ priceChange: {
2658
+ absolute: Math.round((lastPrice - firstPrice) * 100) / 100,
2659
+ percentage: firstPrice > 0 ? Math.round((lastPrice - firstPrice) / firstPrice * 1e4) / 100 : 0,
2660
+ high: Math.round(Math.max(...priceValues) * 100) / 100,
2661
+ low: Math.round(Math.min(...priceValues) * 100) / 100
2662
+ }
2663
+ };
2664
+ }
2665
+ function formatHistoricalPriceResult(result) {
2666
+ const lines = [
2667
+ `## ${result.token} Price History (${result.days} day${result.days > 1 ? "s" : ""})`,
2668
+ "",
2669
+ `- **Current:** $${result.prices[result.prices.length - 1]?.price.toLocaleString() ?? "N/A"}`,
2670
+ `- **High:** $${result.priceChange.high.toLocaleString()}`,
2671
+ `- **Low:** $${result.priceChange.low.toLocaleString()}`,
2672
+ `- **Change:** ${result.priceChange.absolute >= 0 ? "+" : ""}$${result.priceChange.absolute.toLocaleString()} (${result.priceChange.percentage >= 0 ? "+" : ""}${result.priceChange.percentage}%)`,
2673
+ "",
2674
+ `_${result.prices.length} data points from CoinGecko_`
2675
+ ];
2676
+ return lines.join("\n");
2677
+ }
2678
+
2679
+ // src/tools/quoteStore.ts
2680
+ import { randomUUID } from "crypto";
2681
+ var DEFAULT_TTL_MS = 5 * 60 * 1e3;
2682
+ var quotes = /* @__PURE__ */ new Map();
2683
+ var cleanupInterval = null;
2684
+ function ensureCleanup() {
2685
+ if (cleanupInterval) return;
2686
+ cleanupInterval = setInterval(() => {
2687
+ const now = Date.now();
2688
+ for (const [id, quote] of quotes) {
2689
+ if (now > quote.expiresAt) {
2690
+ quotes.delete(id);
2691
+ }
2692
+ }
2693
+ }, 6e4);
2694
+ if (cleanupInterval.unref) {
2695
+ cleanupInterval.unref();
2696
+ }
2697
+ }
2698
+ function createQuote(type, data, ttlMs = DEFAULT_TTL_MS) {
2699
+ ensureCleanup();
2700
+ const id = randomUUID();
2701
+ const now = Date.now();
2702
+ quotes.set(id, {
2703
+ id,
2704
+ type,
2705
+ createdAt: now,
2706
+ expiresAt: now + ttlMs,
2707
+ data
2708
+ });
2709
+ return id;
2710
+ }
2711
+ function getQuote(quoteId) {
2712
+ const quote = quotes.get(quoteId);
2713
+ if (!quote) return null;
2714
+ if (Date.now() > quote.expiresAt) {
2715
+ quotes.delete(quoteId);
2716
+ return null;
2717
+ }
2718
+ return quote;
2719
+ }
2720
+ function deleteQuote(quoteId) {
2721
+ quotes.delete(quoteId);
2722
+ }
2723
+ function clearQuoteStore() {
2724
+ quotes.clear();
2725
+ }
2726
+
2727
+ // src/tools/wdkQuoteSwap.ts
2728
+ import { z as z23 } from "zod";
2729
+ import { parseUnits as parseUnits5 } from "viem";
2730
+ var wdkQuoteSwapInputSchema = z23.object({
2731
+ fromToken: z23.string().describe('Token to swap from (e.g., "ETH", "USDC")'),
2732
+ toToken: z23.string().describe('Token to swap to (e.g., "USDT0", "USDC")'),
2733
+ amount: z23.string().regex(/^\d+(\.\d+)?$/).describe("Amount to swap (e.g., '1.0')"),
2734
+ chain: z23.string().describe('Chain to execute swap on (e.g., "ethereum", "arbitrum")')
2735
+ });
2736
+ async function executeWdkQuoteSwap(input, wdk) {
2737
+ const decimals = ["USDC", "USDT", "USDT0"].includes(input.fromToken.toUpperCase()) ? 6 : 18;
2738
+ const amountBigInt = parseUnits5(input.amount, decimals);
2739
+ const quote = await wdk.getSwapQuote(input.chain, input.fromToken, amountBigInt);
2740
+ const outputDecimals = ["USDC", "USDT", "USDT0"].includes(input.toToken.toUpperCase()) ? 6 : 18;
2741
+ const outputDivisor = 10 ** outputDecimals;
2742
+ const toAmount = (Number(quote.outputAmount) / outputDivisor).toFixed(outputDecimals === 6 ? 6 : 8);
2743
+ const inputAmount = parseFloat(input.amount);
2744
+ const outputAmount = parseFloat(toAmount);
2745
+ const exchangeRate = inputAmount > 0 ? (outputAmount / inputAmount).toFixed(6) : "0";
2746
+ const expiresAt = new Date(Date.now() + 5 * 60 * 1e3).toISOString();
2747
+ const quoteId = createQuote("swap", {
2748
+ fromToken: input.fromToken,
2749
+ toToken: input.toToken,
2750
+ fromAmount: input.amount,
2751
+ toAmount,
2752
+ chain: input.chain,
2753
+ exchangeRate
2754
+ });
2755
+ return {
2756
+ quoteId,
2757
+ fromToken: input.fromToken,
2758
+ toToken: input.toToken,
2759
+ fromAmount: input.amount,
2760
+ toAmount,
2761
+ exchangeRate,
2762
+ fee: "0.3%",
2763
+ priceImpact: "< 0.1%",
2764
+ expiresAt,
2765
+ chain: input.chain
2766
+ };
2767
+ }
2768
+ function executeWdkQuoteSwapDemo(input) {
2769
+ const inputAmount = parseFloat(input.amount);
2770
+ const toAmount = (inputAmount * 0.997).toFixed(6);
2771
+ const exchangeRate = 0.997.toFixed(6);
2772
+ const expiresAt = new Date(Date.now() + 5 * 60 * 1e3).toISOString();
2773
+ const quoteId = createQuote("swap", {
2774
+ fromToken: input.fromToken,
2775
+ toToken: input.toToken,
2776
+ fromAmount: input.amount,
2777
+ toAmount,
2778
+ chain: input.chain,
2779
+ exchangeRate
2780
+ });
2781
+ return {
2782
+ quoteId,
2783
+ fromToken: input.fromToken,
2784
+ toToken: input.toToken,
2785
+ fromAmount: input.amount,
2786
+ toAmount,
2787
+ exchangeRate,
2788
+ fee: "0.3%",
2789
+ priceImpact: "< 0.1%",
2790
+ expiresAt,
2791
+ chain: input.chain
2792
+ };
2793
+ }
2794
+ function formatSwapQuoteResult(result) {
2795
+ return [
2796
+ "## Swap Quote",
2797
+ "",
2798
+ `- **Quote ID:** \`${result.quoteId}\``,
2799
+ `- **From:** ${result.fromAmount} ${result.fromToken}`,
2800
+ `- **To:** ${result.toAmount} ${result.toToken}`,
2801
+ `- **Exchange Rate:** ${result.exchangeRate}`,
2802
+ `- **Fee:** ${result.fee}`,
2803
+ `- **Price Impact:** ${result.priceImpact}`,
2804
+ `- **Chain:** ${result.chain}`,
2805
+ `- **Expires:** ${result.expiresAt}`,
2806
+ "",
2807
+ "_Call `wdk/executeSwap` with the quoteId to execute this swap._"
2808
+ ].join("\n");
2809
+ }
2810
+
2811
+ // src/tools/wdkExecuteSwap.ts
2812
+ import { z as z24 } from "zod";
2813
+ import { parseUnits as parseUnits6 } from "viem";
2814
+ var wdkExecuteSwapInputSchema = z24.object({
2815
+ quoteId: z24.string().uuid().describe("Quote ID from wdk/quoteSwap"),
2816
+ confirmed: z24.boolean().optional().describe("Set to true to confirm and execute this swap")
2817
+ });
2818
+ async function executeWdkExecuteSwap(input, wdk) {
2819
+ const quote = getQuote(input.quoteId);
2820
+ if (!quote) {
2821
+ throw new Error("Quote not found or expired. Please request a new quote.");
2822
+ }
2823
+ if (quote.type !== "swap") {
2824
+ throw new Error("Invalid quote type. Expected a swap quote.");
2825
+ }
2826
+ const { fromToken, toToken, fromAmount, toAmount, chain } = quote.data;
2827
+ if (!input.confirmed) {
2828
+ return {
2829
+ needsConfirmation: true,
2830
+ summary: `Swap ${fromAmount} ${fromToken} to ${toAmount} ${toToken} on ${chain}`,
2831
+ details: { fromToken, toToken, fromAmount, toAmount, chain, quoteId: input.quoteId }
2832
+ };
2833
+ }
2834
+ const decimals = ["USDC", "USDT", "USDT0"].includes(fromToken.toUpperCase()) ? 6 : 18;
2835
+ const amountBigInt = parseUnits6(fromAmount, decimals);
2836
+ const result = await wdk.swapAndPay({
2837
+ chain,
2838
+ fromToken,
2839
+ amount: amountBigInt
2840
+ });
2841
+ deleteQuote(input.quoteId);
2842
+ return {
2843
+ fromAmount,
2844
+ fromToken,
2845
+ toAmount,
2846
+ toToken,
2847
+ chain,
2848
+ txHash: result?.txHash ?? "0x"
2849
+ };
2850
+ }
2851
+ function executeWdkExecuteSwapDemo(input) {
2852
+ const quote = getQuote(input.quoteId);
2853
+ if (!quote) {
2854
+ throw new Error("Quote not found or expired. Please request a new quote.");
2855
+ }
2856
+ if (quote.type !== "swap") {
2857
+ throw new Error("Invalid quote type. Expected a swap quote.");
2858
+ }
2859
+ const { fromToken, toToken, fromAmount, toAmount, chain } = quote.data;
2860
+ if (!input.confirmed) {
2861
+ return {
2862
+ needsConfirmation: true,
2863
+ summary: `Swap ${fromAmount} ${fromToken} to ${toAmount} ${toToken} on ${chain}`,
2864
+ details: { fromToken, toToken, fromAmount, toAmount, chain, quoteId: input.quoteId }
2865
+ };
2866
+ }
2867
+ deleteQuote(input.quoteId);
2868
+ return {
2869
+ fromAmount,
2870
+ fromToken,
2871
+ toAmount,
2872
+ toToken,
2873
+ chain,
2874
+ txHash: "0xdemo" + Math.random().toString(16).slice(2, 10)
2875
+ };
2876
+ }
2877
+ function formatExecuteSwapResult(result) {
2878
+ return [
2879
+ "## Swap Executed",
2880
+ "",
2881
+ `- **From:** ${result.fromAmount} ${result.fromToken}`,
2882
+ `- **To:** ${result.toAmount} ${result.toToken}`,
2883
+ `- **Chain:** ${result.chain}`,
2884
+ `- **Tx Hash:** \`${result.txHash}\``
2885
+ ].join("\n");
2886
+ }
2887
+
2888
+ // src/tools/quoteBridge.ts
2889
+ import { z as z25 } from "zod";
2890
+ var quoteBridgeInputSchema = z25.object({
2891
+ fromChain: z25.enum(["ethereum", "arbitrum", "ink", "berachain", "unichain"]).describe("Source chain to bridge from"),
2892
+ toChain: z25.enum(["ethereum", "arbitrum", "ink", "berachain", "unichain"]).describe("Destination chain to bridge to"),
2893
+ amount: z25.string().regex(/^\d+(\.\d+)?$/).describe("Amount of USDT0 to bridge (e.g., '100' for 100 USDT0)"),
2894
+ recipient: z25.string().regex(/^0x[a-fA-F0-9]{40}$/).describe("Recipient address on destination chain")
2895
+ });
2896
+ async function executeQuoteBridge(input, rpcUrls) {
2897
+ const feeResult = await executeGetBridgeFee(input, rpcUrls);
2898
+ const expiresAt = new Date(Date.now() + 5 * 60 * 1e3).toISOString();
2899
+ const quoteId = createQuote("bridge", {
2900
+ fromChain: input.fromChain,
2901
+ toChain: input.toChain,
2902
+ amount: input.amount,
2903
+ recipient: input.recipient,
2904
+ nativeFee: feeResult.nativeFee,
2905
+ nativeFeeFormatted: feeResult.nativeFeeFormatted,
2906
+ estimatedTime: feeResult.estimatedTime
2907
+ });
2908
+ return {
2909
+ quoteId,
2910
+ fromChain: input.fromChain,
2911
+ toChain: input.toChain,
2912
+ amount: input.amount,
2913
+ recipient: input.recipient,
2914
+ nativeFee: feeResult.nativeFee,
2915
+ nativeFeeFormatted: feeResult.nativeFeeFormatted,
2916
+ estimatedTime: feeResult.estimatedTime,
2917
+ expiresAt
2918
+ };
2919
+ }
2920
+ function executeQuoteBridgeDemo(input) {
2921
+ const expiresAt = new Date(Date.now() + 5 * 60 * 1e3).toISOString();
2922
+ const estimatedTime = input.toChain === "ethereum" ? 900 : 300;
2923
+ const quoteId = createQuote("bridge", {
2924
+ fromChain: input.fromChain,
2925
+ toChain: input.toChain,
2926
+ amount: input.amount,
2927
+ recipient: input.recipient,
2928
+ nativeFee: "1000000000000000",
2929
+ nativeFeeFormatted: "0.001 ETH",
2930
+ estimatedTime
2931
+ });
2932
+ return {
2933
+ quoteId,
2934
+ fromChain: input.fromChain,
2935
+ toChain: input.toChain,
2936
+ amount: input.amount,
2937
+ recipient: input.recipient,
2938
+ nativeFee: "1000000000000000",
2939
+ nativeFeeFormatted: "0.001 ETH",
2940
+ estimatedTime,
2941
+ expiresAt
2942
+ };
2943
+ }
2944
+ function formatBridgeQuoteResult(result) {
2945
+ const minutes = Math.ceil(result.estimatedTime / 60);
2946
+ return [
2947
+ "## Bridge Quote",
2948
+ "",
2949
+ `- **Quote ID:** \`${result.quoteId}\``,
2950
+ `- **Route:** ${result.fromChain} -> ${result.toChain}`,
2951
+ `- **Amount:** ${result.amount} USDT0`,
2952
+ `- **Recipient:** \`${result.recipient}\``,
2953
+ `- **Fee:** ${result.nativeFeeFormatted}`,
2954
+ `- **Estimated Time:** ~${minutes} minutes`,
2955
+ `- **Expires:** ${result.expiresAt}`,
2956
+ "",
2957
+ "_Call `t402/executeBridge` with the quoteId to execute this bridge._"
2958
+ ].join("\n");
2959
+ }
2960
+
2961
+ // src/tools/executeBridgeFromQuote.ts
2962
+ import { z as z26 } from "zod";
2963
+ var executeBridgeFromQuoteInputSchema = z26.object({
2964
+ quoteId: z26.string().uuid().describe("Quote ID from t402/quoteBridge"),
2965
+ confirmed: z26.boolean().optional().describe("Set to true to confirm and execute this bridge")
2966
+ });
2967
+ async function executeExecuteBridgeFromQuote(input, options) {
2968
+ const quote = getQuote(input.quoteId);
2969
+ if (!quote) {
2970
+ throw new Error("Quote not found or expired. Please request a new quote.");
2971
+ }
2972
+ if (quote.type !== "bridge") {
2973
+ throw new Error("Invalid quote type. Expected a bridge quote.");
2974
+ }
2975
+ const { fromChain, toChain, amount, recipient } = quote.data;
2976
+ if (!input.confirmed) {
2977
+ return {
2978
+ needsConfirmation: true,
2979
+ summary: `Bridge ${amount} USDT0 from ${fromChain} to ${toChain}`,
2980
+ details: { fromChain, toChain, amount, recipient, quoteId: input.quoteId }
2981
+ };
2982
+ }
2983
+ const result = await executeBridge(
2984
+ { fromChain, toChain, amount, recipient, confirmed: true },
2985
+ options
2986
+ );
2987
+ if ("needsConfirmation" in result) {
2988
+ return result;
2989
+ }
2990
+ deleteQuote(input.quoteId);
2991
+ return result;
2992
+ }
2993
+ function executeExecuteBridgeFromQuoteDemo(input) {
2994
+ const quote = getQuote(input.quoteId);
2995
+ if (!quote) {
2996
+ throw new Error("Quote not found or expired. Please request a new quote.");
2997
+ }
2998
+ if (quote.type !== "bridge") {
2999
+ throw new Error("Invalid quote type. Expected a bridge quote.");
3000
+ }
3001
+ const { fromChain, toChain, amount, recipient } = quote.data;
3002
+ if (!input.confirmed) {
3003
+ return {
3004
+ needsConfirmation: true,
3005
+ summary: `Bridge ${amount} USDT0 from ${fromChain} to ${toChain}`,
3006
+ details: { fromChain, toChain, amount, recipient, quoteId: input.quoteId }
3007
+ };
3008
+ }
3009
+ deleteQuote(input.quoteId);
3010
+ const fakeTxHash = `0x${"a".repeat(64)}`;
3011
+ const fakeGuid = `0x${"b".repeat(64)}`;
3012
+ return {
3013
+ txHash: fakeTxHash,
3014
+ messageGuid: fakeGuid,
3015
+ amount,
3016
+ fromChain,
3017
+ toChain,
3018
+ estimatedTime: quote.data.estimatedTime ?? 300,
3019
+ trackingUrl: `https://layerzeroscan.com/tx/${fakeGuid}`
3020
+ };
3021
+ }
3022
+
3023
+ // src/tools/unified.ts
3024
+ import { z as z27 } from "zod";
3025
+ var smartPayInputSchema = z27.object({
3026
+ url: z27.string().url().describe("URL of the 402-protected resource"),
3027
+ maxBridgeFee: z27.string().regex(/^\d+(\.\d+)?$/).optional().describe("Maximum acceptable bridge fee in native token (optional)"),
3028
+ preferredNetwork: z27.string().optional().describe("Preferred network for payment (optional)"),
3029
+ confirmed: z27.boolean().optional().describe("Set to true to confirm and execute this payment")
3030
+ });
3031
+ var paymentPlanInputSchema = z27.object({
3032
+ paymentRequired: z27.object({
3033
+ scheme: z27.string().optional(),
3034
+ network: z27.string().optional(),
3035
+ maxAmountRequired: z27.string().optional(),
3036
+ resource: z27.string().optional(),
3037
+ description: z27.string().optional(),
3038
+ payTo: z27.string().optional(),
3039
+ maxDeadline: z27.number().optional()
3040
+ }).passthrough().describe("The 402 PaymentRequired response")
3041
+ });
3042
+ var UNIFIED_TOOL_DEFINITIONS = {
3043
+ "t402/smartPay": {
3044
+ name: "t402/smartPay",
3045
+ description: "Intelligent payment that automatically checks balance, bridges if needed, and pays. Handles the entire payment flow for 402-protected resources.",
3046
+ inputSchema: {
3047
+ type: "object",
3048
+ properties: {
3049
+ url: { type: "string", description: "URL of the 402-protected resource" },
3050
+ maxBridgeFee: {
3051
+ type: "string",
3052
+ description: "Maximum acceptable bridge fee in native token (optional)"
3053
+ },
3054
+ preferredNetwork: {
3055
+ type: "string",
3056
+ description: "Preferred network for payment (optional)"
3057
+ },
3058
+ confirmed: {
3059
+ type: "boolean",
3060
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
3061
+ }
3062
+ },
3063
+ required: ["url"]
3064
+ }
3065
+ },
3066
+ "t402/paymentPlan": {
3067
+ name: "t402/paymentPlan",
3068
+ description: "Analyze a 402 response and create an optimal payment plan considering balances across all chains. Returns recommended network, bridge requirements, and balance overview.",
3069
+ inputSchema: {
3070
+ type: "object",
3071
+ properties: {
3072
+ paymentRequired: {
3073
+ type: "object",
3074
+ description: "The 402 PaymentRequired response"
3075
+ }
3076
+ },
3077
+ required: ["paymentRequired"]
3078
+ }
3079
+ }
3080
+ };
3081
+ async function executeSmartPay(input, wdk) {
3082
+ if (!input.confirmed) {
3083
+ return {
3084
+ needsConfirmation: true,
3085
+ summary: `Smart-pay for ${input.url}${input.preferredNetwork ? ` on ${input.preferredNetwork}` : ""}`,
3086
+ details: {
3087
+ url: input.url,
3088
+ ...input.maxBridgeFee ? { maxBridgeFee: input.maxBridgeFee } : {},
3089
+ ...input.preferredNetwork ? { preferredNetwork: input.preferredNetwork } : {}
3090
+ }
3091
+ };
3092
+ }
3093
+ const steps = [];
3094
+ const chains10 = input.preferredNetwork ? [input.preferredNetwork] : ["ethereum", "arbitrum", "base"];
3095
+ steps.push({
3096
+ action: "check_balance",
3097
+ status: "success",
3098
+ detail: `Checking balances on ${chains10.join(", ")}`
3099
+ });
3100
+ const { T402Protocol } = await import("@t402/wdk-protocol");
3101
+ const protocol = await T402Protocol.create(wdk, { chains: chains10 });
3102
+ steps.push({
3103
+ action: "fetch",
3104
+ status: "success",
3105
+ detail: `Fetching ${input.url}`
3106
+ });
3107
+ const { response, receipt } = await protocol.fetch(input.url);
3108
+ if (receipt) {
3109
+ steps.push({
3110
+ action: "pay",
3111
+ status: "success",
3112
+ detail: `Payment made: ${receipt.amount} on ${receipt.network}`
3113
+ });
3114
+ }
3115
+ const contentType = response.headers.get("content-type") ?? void 0;
3116
+ let body = "";
3117
+ try {
3118
+ body = await response.text();
3119
+ if (body.length > 1e4) {
3120
+ body = body.slice(0, 1e4) + "\n... (truncated)";
3121
+ }
3122
+ } catch {
3123
+ body = "[Could not read response body]";
3124
+ }
3125
+ return {
3126
+ success: response.ok,
3127
+ statusCode: response.status,
3128
+ body,
3129
+ contentType,
3130
+ steps,
3131
+ payment: receipt ? {
3132
+ network: receipt.network,
3133
+ scheme: receipt.scheme,
3134
+ amount: receipt.amount,
3135
+ payTo: receipt.payTo
3136
+ } : void 0
3137
+ };
3138
+ }
3139
+ function executeSmartPayDemo(input) {
3140
+ if (!input.confirmed) {
3141
+ return {
3142
+ needsConfirmation: true,
3143
+ summary: `Smart-pay for ${input.url}${input.preferredNetwork ? ` on ${input.preferredNetwork}` : ""}`,
3144
+ details: {
3145
+ url: input.url,
3146
+ ...input.maxBridgeFee ? { maxBridgeFee: input.maxBridgeFee } : {},
3147
+ ...input.preferredNetwork ? { preferredNetwork: input.preferredNetwork } : {}
3148
+ }
3149
+ };
3150
+ }
3151
+ const network = input.preferredNetwork ?? "arbitrum";
3152
+ return {
3153
+ success: true,
3154
+ statusCode: 200,
3155
+ body: `[Demo] Premium content from ${input.url}
3156
+
3157
+ This is simulated content returned after smart payment.`,
3158
+ contentType: "text/plain",
3159
+ steps: [
3160
+ { action: "check_balance", status: "success", detail: `Checked balances on ${network}` },
3161
+ { action: "check_price", status: "success", detail: "Resource costs 1.00 USDT0" },
3162
+ { action: "pay", status: "success", detail: `Paid 1000000 USDT0 on eip155:42161` },
3163
+ { action: "fetch", status: "success", detail: `Fetched ${input.url}` }
3164
+ ],
3165
+ payment: {
3166
+ network: "eip155:42161",
3167
+ scheme: "exact",
3168
+ amount: "1000000",
3169
+ payTo: "0xC88f67e776f16DcFBf42e6bDda1B82604448899B"
3170
+ }
3171
+ };
3172
+ }
3173
+ async function executePaymentPlan(input, wdk) {
3174
+ const targetNetwork = input.paymentRequired.network;
3175
+ const requiredAmount = input.paymentRequired.maxAmountRequired;
3176
+ const aggregated = await wdk.getAggregatedBalances();
3177
+ const balances = aggregated.chains.map((chain) => {
3178
+ const usdt0 = chain.tokens.find((t) => t.symbol === "USDT0");
3179
+ const usdc = chain.tokens.find((t) => t.symbol === "USDC");
3180
+ return {
3181
+ chain: chain.chain,
3182
+ usdt0: usdt0?.formatted ?? "0",
3183
+ usdc: usdc?.formatted ?? "0"
3184
+ };
3185
+ });
3186
+ const requiredBigint = requiredAmount ? BigInt(requiredAmount) : 0n;
3187
+ const bestChain = await wdk.findBestChainForPayment(requiredBigint);
3188
+ if (bestChain) {
3189
+ const needsBridge = targetNetwork ? !bestChain.chain.includes(targetNetwork) : false;
3190
+ return {
3191
+ viable: true,
3192
+ recommendedNetwork: bestChain.chain,
3193
+ availableBalance: bestChain.balance.toString(),
3194
+ bridgeRequired: needsBridge,
3195
+ bridgeDetails: needsBridge ? {
3196
+ fromChain: bestChain.chain,
3197
+ toChain: targetNetwork ?? bestChain.chain,
3198
+ amount: requiredAmount ?? "0",
3199
+ estimatedFee: "0.001"
3200
+ } : void 0,
3201
+ balances
3202
+ };
3203
+ }
3204
+ return {
3205
+ viable: false,
3206
+ bridgeRequired: false,
3207
+ balances,
3208
+ reason: "Insufficient balance across all chains"
3209
+ };
3210
+ }
3211
+ function executePaymentPlanDemo(_input) {
3212
+ return {
3213
+ viable: true,
3214
+ recommendedNetwork: "arbitrum",
3215
+ availableBalance: "500000000",
3216
+ bridgeRequired: false,
3217
+ balances: [
3218
+ { chain: "ethereum", usdt0: "100.00", usdc: "250.00" },
1985
3219
  { chain: "arbitrum", usdt0: "500.00", usdc: "0" },
1986
3220
  { chain: "base", usdt0: "50.00", usdc: "100.00" }
1987
3221
  ]
@@ -2167,6 +3401,10 @@ var TOOL_DEFINITIONS = {
2167
3401
  memo: {
2168
3402
  type: "string",
2169
3403
  description: "Optional memo/reference for the payment"
3404
+ },
3405
+ confirmed: {
3406
+ type: "boolean",
3407
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
2170
3408
  }
2171
3409
  },
2172
3410
  required: ["to", "amount", "token", "network"]
@@ -2197,6 +3435,10 @@ var TOOL_DEFINITIONS = {
2197
3435
  type: "string",
2198
3436
  enum: ["ethereum", "base", "arbitrum", "optimism", "polygon", "avalanche"],
2199
3437
  description: "Network to execute gasless payment on (must support ERC-4337)"
3438
+ },
3439
+ confirmed: {
3440
+ type: "boolean",
3441
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
2200
3442
  }
2201
3443
  },
2202
3444
  required: ["to", "amount", "token", "network"]
@@ -2235,6 +3477,144 @@ var TOOL_DEFINITIONS = {
2235
3477
  "t402/bridge": {
2236
3478
  name: "t402/bridge",
2237
3479
  description: "Bridge USDT0 between chains using LayerZero OFT standard. Executes a cross-chain transfer and returns the LayerZero message GUID for tracking. Supported chains: ethereum, arbitrum, ink, berachain, unichain.",
3480
+ inputSchema: {
3481
+ type: "object",
3482
+ properties: {
3483
+ fromChain: {
3484
+ type: "string",
3485
+ enum: ["ethereum", "arbitrum", "ink", "berachain", "unichain"],
3486
+ description: "Source chain to bridge from"
3487
+ },
3488
+ toChain: {
3489
+ type: "string",
3490
+ enum: ["ethereum", "arbitrum", "ink", "berachain", "unichain"],
3491
+ description: "Destination chain to bridge to"
3492
+ },
3493
+ amount: {
3494
+ type: "string",
3495
+ pattern: "^\\d+(\\.\\d+)?$",
3496
+ description: "Amount of USDT0 to bridge (e.g., '100' for 100 USDT0)"
3497
+ },
3498
+ recipient: {
3499
+ type: "string",
3500
+ pattern: "^0x[a-fA-F0-9]{40}$",
3501
+ description: "Recipient address on destination chain"
3502
+ },
3503
+ confirmed: {
3504
+ type: "boolean",
3505
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
3506
+ }
3507
+ },
3508
+ required: ["fromChain", "toChain", "amount", "recipient"]
3509
+ }
3510
+ },
3511
+ "t402/getTokenPrice": {
3512
+ name: "t402/getTokenPrice",
3513
+ description: "Get current market prices for tokens (ETH, MATIC, AVAX, USDC, etc.) via CoinGecko. Cached for 5 minutes.",
3514
+ inputSchema: {
3515
+ type: "object",
3516
+ properties: {
3517
+ tokens: {
3518
+ type: "array",
3519
+ items: { type: "string" },
3520
+ description: 'Token symbols to get prices for (e.g., ["ETH", "MATIC", "USDC"])'
3521
+ },
3522
+ currency: {
3523
+ type: "string",
3524
+ description: 'Target currency (default: "usd")'
3525
+ }
3526
+ },
3527
+ required: ["tokens"]
3528
+ }
3529
+ },
3530
+ "t402/getGasPrice": {
3531
+ name: "t402/getGasPrice",
3532
+ description: "Get the current gas price on a specific blockchain network. Returns the price in gwei.",
3533
+ inputSchema: {
3534
+ type: "object",
3535
+ properties: {
3536
+ network: {
3537
+ type: "string",
3538
+ enum: [
3539
+ "ethereum",
3540
+ "base",
3541
+ "arbitrum",
3542
+ "optimism",
3543
+ "polygon",
3544
+ "avalanche",
3545
+ "ink",
3546
+ "berachain",
3547
+ "unichain"
3548
+ ],
3549
+ description: "Blockchain network to check gas price on"
3550
+ }
3551
+ },
3552
+ required: ["network"]
3553
+ }
3554
+ },
3555
+ "t402/estimatePaymentFee": {
3556
+ name: "t402/estimatePaymentFee",
3557
+ description: "Estimate the gas cost (in native token and USD) for a stablecoin payment on a specific network.",
3558
+ inputSchema: {
3559
+ type: "object",
3560
+ properties: {
3561
+ network: {
3562
+ type: "string",
3563
+ enum: [
3564
+ "ethereum",
3565
+ "base",
3566
+ "arbitrum",
3567
+ "optimism",
3568
+ "polygon",
3569
+ "avalanche",
3570
+ "ink",
3571
+ "berachain",
3572
+ "unichain"
3573
+ ],
3574
+ description: "Network to estimate fee on"
3575
+ },
3576
+ amount: {
3577
+ type: "string",
3578
+ pattern: "^\\d+(\\.\\d+)?$",
3579
+ description: "Payment amount (e.g., '100')"
3580
+ },
3581
+ token: {
3582
+ type: "string",
3583
+ enum: ["USDC", "USDT", "USDT0"],
3584
+ description: "Token to use for payment"
3585
+ }
3586
+ },
3587
+ required: ["network", "amount", "token"]
3588
+ }
3589
+ },
3590
+ "t402/compareNetworkFees": {
3591
+ name: "t402/compareNetworkFees",
3592
+ description: "Compare payment fees across multiple networks for the same token. Returns a sorted table from cheapest to most expensive.",
3593
+ inputSchema: {
3594
+ type: "object",
3595
+ properties: {
3596
+ amount: {
3597
+ type: "string",
3598
+ pattern: "^\\d+(\\.\\d+)?$",
3599
+ description: "Payment amount (e.g., '100')"
3600
+ },
3601
+ token: {
3602
+ type: "string",
3603
+ enum: ["USDC", "USDT", "USDT0"],
3604
+ description: "Token to use for payment"
3605
+ },
3606
+ networks: {
3607
+ type: "array",
3608
+ items: { type: "string" },
3609
+ description: "Networks to compare. If not provided, compares all networks that support the token."
3610
+ }
3611
+ },
3612
+ required: ["amount", "token"]
3613
+ }
3614
+ },
3615
+ "t402/quoteBridge": {
3616
+ name: "t402/quoteBridge",
3617
+ description: "Get a bridge fee quote with a quoteId for later execution. Like getBridgeFee but returns a reusable quoteId. Call t402/executeBridge with the quoteId to execute.",
2238
3618
  inputSchema: {
2239
3619
  type: "object",
2240
3620
  properties: {
@@ -2261,6 +3641,149 @@ var TOOL_DEFINITIONS = {
2261
3641
  },
2262
3642
  required: ["fromChain", "toChain", "amount", "recipient"]
2263
3643
  }
3644
+ },
3645
+ "t402/executeBridgeQuote": {
3646
+ name: "t402/executeBridgeQuote",
3647
+ description: "Execute a bridge using a quoteId from t402/quoteBridge. Requires confirmation.",
3648
+ inputSchema: {
3649
+ type: "object",
3650
+ properties: {
3651
+ quoteId: {
3652
+ type: "string",
3653
+ description: "Quote ID from t402/quoteBridge"
3654
+ },
3655
+ confirmed: {
3656
+ type: "boolean",
3657
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
3658
+ }
3659
+ },
3660
+ required: ["quoteId"]
3661
+ }
3662
+ },
3663
+ "t402/signMessage": {
3664
+ name: "t402/signMessage",
3665
+ description: "Sign a message using the configured wallet. Returns an EIP-191 personal signature. Requires a configured private key.",
3666
+ inputSchema: {
3667
+ type: "object",
3668
+ properties: {
3669
+ chain: {
3670
+ type: "string",
3671
+ enum: [
3672
+ "ethereum",
3673
+ "base",
3674
+ "arbitrum",
3675
+ "optimism",
3676
+ "polygon",
3677
+ "avalanche",
3678
+ "ink",
3679
+ "berachain",
3680
+ "unichain"
3681
+ ],
3682
+ description: "Blockchain network context for signing"
3683
+ },
3684
+ message: {
3685
+ type: "string",
3686
+ description: "Message to sign"
3687
+ }
3688
+ },
3689
+ required: ["chain", "message"]
3690
+ }
3691
+ },
3692
+ "t402/verifySignature": {
3693
+ name: "t402/verifySignature",
3694
+ description: "Verify an EIP-191 signed message. Checks whether a signature was produced by the claimed address. No wallet configuration needed \u2014 this is a read-only verification.",
3695
+ inputSchema: {
3696
+ type: "object",
3697
+ properties: {
3698
+ chain: {
3699
+ type: "string",
3700
+ enum: [
3701
+ "ethereum",
3702
+ "base",
3703
+ "arbitrum",
3704
+ "optimism",
3705
+ "polygon",
3706
+ "avalanche",
3707
+ "ink",
3708
+ "berachain",
3709
+ "unichain"
3710
+ ],
3711
+ description: "Blockchain network context for verification"
3712
+ },
3713
+ message: {
3714
+ type: "string",
3715
+ description: "The original message that was signed"
3716
+ },
3717
+ signature: {
3718
+ type: "string",
3719
+ pattern: "^0x[a-fA-F0-9]+$",
3720
+ description: "The signature to verify (hex string)"
3721
+ },
3722
+ address: {
3723
+ type: "string",
3724
+ pattern: "^0x[a-fA-F0-9]{40}$",
3725
+ description: "The expected signer address"
3726
+ }
3727
+ },
3728
+ required: ["chain", "message", "signature", "address"]
3729
+ }
3730
+ },
3731
+ "t402/getTransferHistory": {
3732
+ name: "t402/getTransferHistory",
3733
+ description: "Get recent ERC-20 stablecoin transfer history for a wallet address. Queries on-chain Transfer events for USDC, USDT, and USDT0. Returns sent and received transfers sorted by most recent.",
3734
+ inputSchema: {
3735
+ type: "object",
3736
+ properties: {
3737
+ network: {
3738
+ type: "string",
3739
+ enum: [
3740
+ "ethereum",
3741
+ "base",
3742
+ "arbitrum",
3743
+ "optimism",
3744
+ "polygon",
3745
+ "avalanche",
3746
+ "ink",
3747
+ "berachain",
3748
+ "unichain"
3749
+ ],
3750
+ description: "Blockchain network to query"
3751
+ },
3752
+ address: {
3753
+ type: "string",
3754
+ pattern: "^0x[a-fA-F0-9]{40}$",
3755
+ description: "Wallet address to get transfer history for"
3756
+ },
3757
+ token: {
3758
+ type: "string",
3759
+ enum: ["USDC", "USDT", "USDT0"],
3760
+ description: "Filter by specific token. If not provided, queries all supported stablecoins."
3761
+ },
3762
+ limit: {
3763
+ type: "number",
3764
+ description: "Maximum number of transfers to return (default: 10, max: 100)"
3765
+ }
3766
+ },
3767
+ required: ["network", "address"]
3768
+ }
3769
+ },
3770
+ "t402/getHistoricalPrice": {
3771
+ name: "t402/getHistoricalPrice",
3772
+ description: "Get historical price data for a token over a specified period via CoinGecko. Returns price data points, high/low, and percentage change. Useful for trend analysis.",
3773
+ inputSchema: {
3774
+ type: "object",
3775
+ properties: {
3776
+ token: {
3777
+ type: "string",
3778
+ description: 'Token symbol (e.g., "ETH", "USDC", "USDT", "MATIC", "AVAX", "BTC", "SOL")'
3779
+ },
3780
+ days: {
3781
+ type: "number",
3782
+ description: "Number of days of history to retrieve (default: 7, max: 365)"
3783
+ }
3784
+ },
3785
+ required: ["token"]
3786
+ }
2264
3787
  }
2265
3788
  };
2266
3789
  var WDK_TOOL_DEFINITIONS = {
@@ -2311,6 +3834,10 @@ var WDK_TOOL_DEFINITIONS = {
2311
3834
  chain: {
2312
3835
  type: "string",
2313
3836
  description: 'Chain to execute transfer on (e.g., "ethereum", "arbitrum")'
3837
+ },
3838
+ confirmed: {
3839
+ type: "boolean",
3840
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
2314
3841
  }
2315
3842
  },
2316
3843
  required: ["to", "amount", "token", "chain"]
@@ -2338,6 +3865,10 @@ var WDK_TOOL_DEFINITIONS = {
2338
3865
  chain: {
2339
3866
  type: "string",
2340
3867
  description: 'Chain to execute swap on (e.g., "ethereum", "arbitrum")'
3868
+ },
3869
+ confirmed: {
3870
+ type: "boolean",
3871
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
2341
3872
  }
2342
3873
  },
2343
3874
  required: ["fromToken", "toToken", "amount", "chain"]
@@ -2361,10 +3892,59 @@ var WDK_TOOL_DEFINITIONS = {
2361
3892
  preferredChain: {
2362
3893
  type: "string",
2363
3894
  description: 'Preferred chain for payment (e.g., "arbitrum"). If not specified, uses first available.'
3895
+ },
3896
+ confirmed: {
3897
+ type: "boolean",
3898
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
2364
3899
  }
2365
3900
  },
2366
3901
  required: ["url"]
2367
3902
  }
3903
+ },
3904
+ "wdk/quoteSwap": {
3905
+ name: "wdk/quoteSwap",
3906
+ description: "Get a swap quote with a quoteId for later execution. Returns exchange rate, fee, and price impact. Call wdk/executeSwap with the quoteId to execute.",
3907
+ inputSchema: {
3908
+ type: "object",
3909
+ properties: {
3910
+ fromToken: {
3911
+ type: "string",
3912
+ description: 'Token to swap from (e.g., "ETH", "USDC")'
3913
+ },
3914
+ toToken: {
3915
+ type: "string",
3916
+ description: 'Token to swap to (e.g., "USDT0", "USDC")'
3917
+ },
3918
+ amount: {
3919
+ type: "string",
3920
+ pattern: "^\\d+(\\.\\d+)?$",
3921
+ description: "Amount to swap (e.g., '1.0')"
3922
+ },
3923
+ chain: {
3924
+ type: "string",
3925
+ description: 'Chain to execute swap on (e.g., "ethereum", "arbitrum")'
3926
+ }
3927
+ },
3928
+ required: ["fromToken", "toToken", "amount", "chain"]
3929
+ }
3930
+ },
3931
+ "wdk/executeSwap": {
3932
+ name: "wdk/executeSwap",
3933
+ description: "Execute a swap using a quoteId from wdk/quoteSwap. Requires confirmation.",
3934
+ inputSchema: {
3935
+ type: "object",
3936
+ properties: {
3937
+ quoteId: {
3938
+ type: "string",
3939
+ description: "Quote ID from wdk/quoteSwap"
3940
+ },
3941
+ confirmed: {
3942
+ type: "boolean",
3943
+ description: "Set to true to confirm and execute. Omit for a preview/confirmation prompt."
3944
+ }
3945
+ },
3946
+ required: ["quoteId"]
3947
+ }
2368
3948
  }
2369
3949
  };
2370
3950
  var ERC8004_TOOL_DEFINITIONS = {
@@ -2510,6 +4090,52 @@ export {
2510
4090
  erc8004VerifyWalletInputSchema,
2511
4091
  executeErc8004VerifyWallet,
2512
4092
  formatErc8004VerifyWalletResult,
4093
+ getTokenPrices,
4094
+ getTokenPricesDemo,
4095
+ clearPriceCache,
4096
+ getTokenPriceInputSchema,
4097
+ executeGetTokenPrice,
4098
+ formatTokenPriceResult,
4099
+ getGasPriceInputSchema,
4100
+ executeGetGasPrice,
4101
+ formatGasPriceResult,
4102
+ estimatePaymentFeeInputSchema,
4103
+ executeEstimatePaymentFee,
4104
+ formatPaymentFeeEstimate,
4105
+ compareNetworkFeesInputSchema,
4106
+ executeCompareNetworkFees,
4107
+ formatNetworkFeeComparison,
4108
+ signMessageInputSchema,
4109
+ executeSignMessage,
4110
+ formatSignMessageResult,
4111
+ verifySignatureInputSchema,
4112
+ executeVerifySignature,
4113
+ formatVerifySignatureResult,
4114
+ getTransferHistoryInputSchema,
4115
+ executeGetTransferHistory,
4116
+ formatTransferHistoryResult,
4117
+ getHistoricalPriceInputSchema,
4118
+ executeGetHistoricalPrice,
4119
+ formatHistoricalPriceResult,
4120
+ createQuote,
4121
+ getQuote,
4122
+ deleteQuote,
4123
+ clearQuoteStore,
4124
+ wdkQuoteSwapInputSchema,
4125
+ executeWdkQuoteSwap,
4126
+ executeWdkQuoteSwapDemo,
4127
+ formatSwapQuoteResult,
4128
+ wdkExecuteSwapInputSchema,
4129
+ executeWdkExecuteSwap,
4130
+ executeWdkExecuteSwapDemo,
4131
+ formatExecuteSwapResult,
4132
+ quoteBridgeInputSchema,
4133
+ executeQuoteBridge,
4134
+ executeQuoteBridgeDemo,
4135
+ formatBridgeQuoteResult,
4136
+ executeBridgeFromQuoteInputSchema,
4137
+ executeExecuteBridgeFromQuote,
4138
+ executeExecuteBridgeFromQuoteDemo,
2513
4139
  smartPayInputSchema,
2514
4140
  paymentPlanInputSchema,
2515
4141
  UNIFIED_TOOL_DEFINITIONS,
@@ -2523,4 +4149,4 @@ export {
2523
4149
  WDK_TOOL_DEFINITIONS,
2524
4150
  ERC8004_TOOL_DEFINITIONS
2525
4151
  };
2526
- //# sourceMappingURL=chunk-B7X7H6NV.mjs.map
4152
+ //# sourceMappingURL=chunk-OSPCSAZF.mjs.map