@rackspay/wallet-mcp 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +59 -9
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -217,12 +217,12 @@ server.tool("racks_bridge_usdc", "Bridge USDC between chains using the Relay sol
217
217
  // ─────────────────────────────────────────────────────────────────────────────
218
218
  server.tool("racks_deposit_to_hypercore", "Move USDC from this agent's Arbitrum wallet into HyperCore (Hyperliquid's L1 trading account). " +
219
219
  "This is required before placing any trades — Hyperliquid only accepts funds from Arbitrum. " +
220
- "The agent signs two transactions via Privy: ERC-20 approve, then bridge deposit. " +
220
+ "Sends a single USDC.transfer() to the Bridge2 contract. Minimum deposit: 5 USDC. " +
221
221
  "IMPORTANT: call racks_get_wallet_balance first to confirm sufficient Arbitrum USDC.", {
222
222
  amount_usdc: z
223
223
  .number()
224
- .positive()
225
- .describe("Amount of USDC to deposit into HyperCore (e.g. 10.5 = $10.50)"),
224
+ .min(5)
225
+ .describe("Amount of USDC to deposit into HyperCore (minimum 5.0). Deposits below 5 USDC are lost."),
226
226
  }, async ({ amount_usdc }) => {
227
227
  const res = await request("POST", "/api/v1/agent/wallet/deposit/hypercore", { amount_usdc });
228
228
  if (!res.ok)
@@ -235,7 +235,6 @@ server.tool("racks_deposit_to_hypercore", "Move USDC from this agent's Arbitrum
235
235
  text: JSON.stringify({
236
236
  success: true,
237
237
  deposited_usdc: amount_usdc,
238
- approve_tx: d.approve_tx,
239
238
  deposit_tx: d.deposit_tx,
240
239
  note: "Funds typically arrive in HyperCore within 1-2 minutes. Then call racks_get_trade_account to confirm.",
241
240
  }, null, 2),
@@ -244,6 +243,45 @@ server.tool("racks_deposit_to_hypercore", "Move USDC from this agent's Arbitrum
244
243
  };
245
244
  });
246
245
  // ─────────────────────────────────────────────────────────────────────────────
246
+ // Tool: racks_withdraw_from_hypercore
247
+ // ─────────────────────────────────────────────────────────────────────────────
248
+ server.tool("racks_withdraw_from_hypercore", "Withdraw USDC from HyperCore back to the agent's Arbitrum wallet. " +
249
+ "This is an L1 action signed and submitted to Hyperliquid. " +
250
+ "Validators process it and send USDC on Arbitrum in 3-4 minutes. " +
251
+ "IMPORTANT: call racks_get_trade_account first to check withdrawable balance. " +
252
+ "Funds in open positions are NOT withdrawable — close positions first.", {
253
+ amount_usdc: z
254
+ .number()
255
+ .positive()
256
+ .describe("Amount of USDC to withdraw from HyperCore (e.g. 5.0 = $5.00)"),
257
+ destination: z
258
+ .string()
259
+ .optional()
260
+ .describe("Arbitrum address to receive funds. Defaults to this agent's own wallet."),
261
+ }, async ({ amount_usdc, destination }) => {
262
+ const body = { amount_usdc };
263
+ if (destination)
264
+ body.destination = destination;
265
+ const res = await request("POST", "/api/v1/agent/wallet/withdraw/hypercore", body);
266
+ if (!res.ok)
267
+ return apiError(res, "Failed to withdraw from HyperCore");
268
+ const d = res.data;
269
+ return {
270
+ content: [
271
+ {
272
+ type: "text",
273
+ text: JSON.stringify({
274
+ success: true,
275
+ withdrawn_usdc: amount_usdc,
276
+ destination: d.destination,
277
+ status: d.status,
278
+ note: "Withdrawal takes 3-4 minutes. Then call racks_get_wallet_balance to confirm Arbitrum balance.",
279
+ }, null, 2),
280
+ },
281
+ ],
282
+ };
283
+ });
284
+ // ─────────────────────────────────────────────────────────────────────────────
247
285
  // Tool: racks_get_trade_account
248
286
  // ─────────────────────────────────────────────────────────────────────────────
249
287
  server.tool("racks_get_trade_account", "Fetch this agent's full Hyperliquid HyperCore account state: account value, margin, " +
@@ -402,12 +440,13 @@ server.tool("racks_cancel_order", "Cancel an open order on Hyperliquid by order
402
440
  // ─────────────────────────────────────────────────────────────────────────────
403
441
  server.tool("racks_get_markets", "Browse active Polymarket prediction markets. Returns market questions, outcomes, " +
404
442
  "current prices (0–1 scale = probability), and token IDs needed for placing bets. " +
405
- "Use the next_cursor value to paginate through more markets.", {
443
+ "Use keyword to search by topic (e.g. 'bitcoin', 'election'). " +
444
+ "Use next_cursor to paginate through more markets.", {
406
445
  next_cursor: z
407
446
  .string()
408
447
  .optional()
409
448
  .default("MA==")
410
- .describe('Pagination cursor (use the next_cursor from a previous call, or omit for the first page)'),
449
+ .describe("Pagination cursor (use the next_cursor from a previous call, or omit for the first page)"),
411
450
  limit: z
412
451
  .number()
413
452
  .int()
@@ -416,18 +455,29 @@ server.tool("racks_get_markets", "Browse active Polymarket prediction markets. R
416
455
  .optional()
417
456
  .default(10)
418
457
  .describe("Number of markets to return (default 10, max 50)"),
419
- }, async ({ next_cursor, limit }) => {
420
- const res = await request("GET", `/api/v1/agent/predict/markets?next_cursor=${encodeURIComponent(next_cursor ?? "MA==")}&limit=${limit}`);
458
+ keyword: z
459
+ .string()
460
+ .optional()
461
+ .describe("Optional keyword to filter markets by question text (e.g. 'bitcoin', 'election', 'fed rate')"),
462
+ }, async ({ next_cursor, limit, keyword }) => {
463
+ const qs = new URLSearchParams({
464
+ next_cursor: next_cursor ?? "MA==",
465
+ limit: String(limit),
466
+ ...(keyword ? { keyword } : {}),
467
+ });
468
+ const res = await request("GET", `/api/v1/agent/predict/markets?${qs.toString()}`);
421
469
  if (!res.ok)
422
470
  return apiError(res, "Failed to fetch Polymarket markets");
423
471
  const d = res.data;
472
+ const markets = d.data;
424
473
  return {
425
474
  content: [
426
475
  {
427
476
  type: "text",
428
477
  text: JSON.stringify({
429
478
  success: true,
430
- markets: d.data,
479
+ count: d.count ?? (Array.isArray(markets) ? markets.length : 0),
480
+ markets,
431
481
  next_cursor: d.next_cursor,
432
482
  note: "Prices are probabilities on a 0–1 scale. Use token_id when placing bets.",
433
483
  }, null, 2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rackspay/wallet-mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "RACKS Wallet MCP — crypto trading and betting infrastructure for AI agents. Trade perps on Hyperliquid, bet on Polymarket, and check on-chain balances via Claude Desktop or any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {