agentcash 0.7.4 → 0.7.6

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 (43) hide show
  1. package/dist/cjs/run-server.cjs +90 -40
  2. package/dist/esm/{chunk-W7GW4W3V.js → chunk-24E2V3PA.js} +9 -35
  3. package/dist/esm/chunk-24E2V3PA.js.map +1 -0
  4. package/dist/esm/chunk-AFQXUUCH.js +7 -0
  5. package/dist/esm/{chunk-DBDSS3CQ.js → chunk-EYYVAQBE.js} +5 -5
  6. package/dist/esm/{chunk-HXRJ5ES4.js → chunk-F43CZXWI.js} +2 -2
  7. package/dist/esm/{chunk-YUCA2PQT.js → chunk-FLIDR6EU.js} +31 -2
  8. package/dist/esm/chunk-FLIDR6EU.js.map +1 -0
  9. package/dist/esm/{chunk-JNYAKINU.js → chunk-KPEJO3KV.js} +1 -7
  10. package/dist/esm/chunk-KPEJO3KV.js.map +1 -0
  11. package/dist/esm/{chunk-KOMAKKV3.js → chunk-PWYZN62H.js} +3 -3
  12. package/dist/esm/{chunk-MQLBI77V.js → chunk-Q4CNAV4N.js} +3 -15
  13. package/dist/esm/chunk-Q4CNAV4N.js.map +1 -0
  14. package/dist/esm/{chunk-NFKU5GQE.js → chunk-UYVXLY33.js} +22 -5
  15. package/dist/esm/chunk-UYVXLY33.js.map +1 -0
  16. package/dist/esm/{chunk-RY34EBJ4.js → chunk-XNU6FVCF.js} +26 -10
  17. package/dist/esm/chunk-XNU6FVCF.js.map +1 -0
  18. package/dist/esm/{commands-M66YQJM7.js → commands-CTDEOF6I.js} +96 -13
  19. package/dist/esm/commands-CTDEOF6I.js.map +1 -0
  20. package/dist/esm/{fund-LZWGF5QM.js → fund-N47ZRBRZ.js} +4 -4
  21. package/dist/esm/index.js +34 -22
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/{install-4YDF4G6T.js → install-R727Y6WB.js} +7 -7
  24. package/dist/esm/{server-GJVD7VNR.js → server-CZ4XJYLK.js} +25 -9
  25. package/dist/esm/server-CZ4XJYLK.js.map +1 -0
  26. package/dist/esm/shared/operations/index.d.ts +7 -0
  27. package/dist/esm/shared/operations/index.js +4 -4
  28. package/package.json +1 -1
  29. package/dist/esm/chunk-JNYAKINU.js.map +0 -1
  30. package/dist/esm/chunk-MQLBI77V.js.map +0 -1
  31. package/dist/esm/chunk-NFKU5GQE.js.map +0 -1
  32. package/dist/esm/chunk-OW3UV227.js +0 -7
  33. package/dist/esm/chunk-RY34EBJ4.js.map +0 -1
  34. package/dist/esm/chunk-W7GW4W3V.js.map +0 -1
  35. package/dist/esm/chunk-YUCA2PQT.js.map +0 -1
  36. package/dist/esm/commands-M66YQJM7.js.map +0 -1
  37. package/dist/esm/server-GJVD7VNR.js.map +0 -1
  38. /package/dist/esm/{chunk-OW3UV227.js.map → chunk-AFQXUUCH.js.map} +0 -0
  39. /package/dist/esm/{chunk-DBDSS3CQ.js.map → chunk-EYYVAQBE.js.map} +0 -0
  40. /package/dist/esm/{chunk-HXRJ5ES4.js.map → chunk-F43CZXWI.js.map} +0 -0
  41. /package/dist/esm/{chunk-KOMAKKV3.js.map → chunk-PWYZN62H.js.map} +0 -0
  42. /package/dist/esm/{fund-LZWGF5QM.js.map → fund-N47ZRBRZ.js.map} +0 -0
  43. /package/dist/esm/{install-4YDF4G6T.js.map → install-R727Y6WB.js.map} +0 -0
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  isMppEnabled
3
- } from "./chunk-OW3UV227.js";
3
+ } from "./chunk-AFQXUUCH.js";
4
4
  import {
5
5
  MCP_VERSION
6
- } from "./chunk-HXRJ5ES4.js";
6
+ } from "./chunk-F43CZXWI.js";
7
7
  import {
8
8
  getBalance,
9
9
  getBaseUrl,
10
- getDepositLink
11
- } from "./chunk-YUCA2PQT.js";
10
+ getDepositLink,
11
+ getState
12
+ } from "./chunk-FLIDR6EU.js";
12
13
  import {
13
14
  log,
14
15
  ok,
@@ -46,6 +47,20 @@ async function getTempoBalance({
46
47
  };
47
48
  }
48
49
 
50
+ // src/shared/operations/onboarding-cta.ts
51
+ function shouldShowOnboardingCta() {
52
+ return (getState().redeemedCodes?.length ?? 0) === 0;
53
+ }
54
+ function getOnboardingCta(address, flags) {
55
+ const onboardLink = `${getBaseUrl(flags.dev)}/onboard`;
56
+ const depositLink = getDepositLink(address, flags);
57
+ return {
58
+ onboardLink,
59
+ depositLink,
60
+ message: `Welcome to AgentCash. To get started, complete onboarding at ${onboardLink} and receive your reward. If you've already onboarded, deposit at ${depositLink} to fund your wallet.`
61
+ };
62
+ }
63
+
49
64
  // src/shared/operations/wallet-info.ts
50
65
  async function getWalletInfo(surface, address, flags) {
51
66
  const balancePromises = [
@@ -72,6 +87,7 @@ async function getWalletInfo(surface, address, flags) {
72
87
  chains,
73
88
  isNewWallet: totalBalance === 0,
74
89
  depositLink: getDepositLink(address, flags),
90
+ ...shouldShowOnboardingCta() ? { onboardingCta: getOnboardingCta(address, flags) } : {},
75
91
  ...totalBalance < 2.5 && totalBalance > 0 ? { message: "Your balance is low. Consider topping it up" } : {}
76
92
  });
77
93
  }
@@ -116,7 +132,8 @@ async function submitErrorReport(surface, input, address, dev) {
116
132
  export {
117
133
  TEMPO_RPC_URL,
118
134
  getTempoBalance,
135
+ getOnboardingCta,
119
136
  getWalletInfo,
120
137
  submitErrorReport
121
138
  };
122
- //# sourceMappingURL=chunk-NFKU5GQE.js.map
139
+ //# sourceMappingURL=chunk-UYVXLY33.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/operations/wallet-info.ts","../../src/shared/tempo.ts","../../src/shared/tempo-balance.ts","../../src/shared/operations/onboarding-cta.ts","../../src/shared/operations/report-error.ts"],"sourcesContent":["import { formatUnits } from 'viem';\n\nimport { ok } from '@agentcash/neverthrow';\n\nimport { getBalance } from '@/shared/balance';\nimport { getDepositLink } from '@/shared/utils';\nimport { TEMPO_TOKEN_ADDRESS } from '@/shared/tempo';\nimport { getTempoBalance } from '@/shared/tempo-balance';\nimport { isMppEnabled } from '@/shared/mpp-enabled';\nimport { log } from '@/shared/log';\nimport {\n shouldShowOnboardingCta,\n getOnboardingCta,\n type OnboardingCta,\n} from '@/shared/operations/onboarding-cta';\n\nimport type { GlobalFlags } from '@/types';\nimport type { Address } from 'viem';\n\ninterface ChainBalance {\n chain: string;\n balance: number;\n}\n\nexport interface WalletInfoResult {\n address: Address;\n balance: number;\n chains: ChainBalance[];\n isNewWallet: boolean;\n depositLink: string;\n onboardingCta?: OnboardingCta;\n message?: string;\n}\n\n/**\n * Get wallet info including balance and deposit link.\n * Returns summed balance across Base and Tempo, with per-chain breakdown.\n */\nexport async function getWalletInfo(\n surface: string,\n address: Address,\n flags: GlobalFlags\n) {\n const balancePromises: [\n ReturnType<typeof getBalance>,\n Promise<number | null>,\n ] = [\n getBalance({ address, surface, dev: flags.dev }),\n isMppEnabled()\n ? getTempoBalance({ address, tokenAddress: TEMPO_TOKEN_ADDRESS })\n .then(r => Number(formatUnits(r.balance, 6)))\n .catch(e => {\n log.info(`Failed to fetch Tempo balance: ${e}`);\n return null;\n })\n : Promise.resolve(null),\n ];\n\n const [balanceResult, tempoResult] = await Promise.all(balancePromises);\n\n if (balanceResult.isErr()) {\n return balanceResult;\n }\n\n const baseBalance = balanceResult.value.balance;\n const tempoBalance = tempoResult ?? 0;\n const totalBalance = baseBalance + tempoBalance;\n\n const chains: ChainBalance[] = [{ chain: 'Base', balance: baseBalance }];\n if (isMppEnabled()) {\n chains.push({ chain: 'Tempo', balance: tempoBalance });\n }\n\n return ok<WalletInfoResult>({\n address,\n balance: totalBalance,\n chains,\n isNewWallet: totalBalance === 0,\n depositLink: getDepositLink(address, flags),\n ...(shouldShowOnboardingCta()\n ? { onboardingCta: getOnboardingCta(address, flags) }\n : {}),\n ...(totalBalance < 2.5 && totalBalance > 0\n ? { message: 'Your balance is low. Consider topping it up' }\n : {}),\n });\n}\n","import type { Address } from 'viem';\n\n/** Authenticated RPC for Tempo Mainnet */\nexport const TEMPO_RPC_URL =\n 'https://eng:acard-melody-fashion-finish@rpc.mainnet.tempo.xyz';\n\n/** pathUSD token on Tempo Mainnet */\nexport const TEMPO_TOKEN_ADDRESS: Address =\n '0x20c0000000000000000000000000000000000000';\n","import { tempo } from 'viem/chains';\n\nimport type { Address } from 'viem';\n\nconst MPPSCAN_BASE = 'https://mppscan.com';\n\ninterface GetTempoBalanceResult {\n chainId: number;\n chainName: string;\n balance: bigint;\n tokenAddress: Address;\n}\n\nexport async function getTempoBalance({\n address,\n tokenAddress,\n}: {\n address: Address;\n tokenAddress: Address;\n}): Promise<GetTempoBalanceResult> {\n const url = `${MPPSCAN_BASE}/api/balance/${address}`;\n\n const res = await fetch(url, {\n method: 'GET',\n headers: { accept: 'application/json' },\n });\n\n if (!res.ok) {\n throw new Error(`mppscan balance request failed: ${res.status}`);\n }\n\n const data = (await res.json()) as { balance: string };\n\n return {\n chainId: tempo.id,\n chainName: tempo.name,\n balance: BigInt(data.balance),\n tokenAddress,\n };\n}\n","import { getState } from '@/shared/state';\nimport { getBaseUrl, getDepositLink } from '@/shared/utils';\n\nimport type { GlobalFlags } from '@/types';\nimport type { Address } from 'viem';\n\nexport interface OnboardingCta {\n onboardLink: string;\n depositLink: string;\n message: string;\n}\n\nexport function shouldShowOnboardingCta(): boolean {\n return (getState().redeemedCodes?.length ?? 0) === 0;\n}\n\nexport function getOnboardingCta(\n address: Address,\n flags: GlobalFlags\n): OnboardingCta {\n const onboardLink = `${getBaseUrl(flags.dev)}/onboard`;\n const depositLink = getDepositLink(address, flags);\n\n return {\n onboardLink,\n depositLink,\n message: `Welcome to AgentCash. To get started, complete onboarding at ${onboardLink} and receive your reward. If you've already onboarded, deposit at ${depositLink} to fund your wallet.`,\n };\n}\n","import { z } from 'zod';\nimport { ok } from '@agentcash/neverthrow';\n\nimport { safeFetchJson } from '@/shared/neverthrow/fetch';\nimport { getBaseUrl } from '@/shared/utils';\nimport { MCP_VERSION } from '@/shared/version';\n\nimport type { Address } from 'viem';\n\n/**\n * Error report input\n */\ninterface ErrorReportInput {\n tool: string;\n summary: string;\n errorMessage: string;\n resource?: string;\n stack?: string;\n fullReport?: string;\n}\n\n/**\n * Error report result\n */\nexport interface ErrorReportResult {\n submitted: true;\n reportId: string;\n message: string;\n}\n\n/**\n * Submit an error report to agentcash telemetry.\n */\nexport async function submitErrorReport(\n surface: string,\n input: ErrorReportInput,\n address: Address,\n dev: boolean\n) {\n const telemetryResult = await safeFetchJson(\n surface,\n new Request(`${getBaseUrl(dev)}/api/telemetry`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n tool: input.tool,\n summary: input.summary,\n errorMessage: input.errorMessage,\n resource: input.resource,\n stack: input.stack,\n fullReport: input.fullReport,\n walletAddress: address,\n mcpVersion: MCP_VERSION,\n reportedAt: new Date().toISOString(),\n }),\n }),\n z.object({\n reportId: z.string(),\n })\n );\n\n if (telemetryResult.isErr()) {\n return telemetryResult;\n }\n\n const { reportId } = telemetryResult.value;\n\n return ok<ErrorReportResult>({\n submitted: true,\n reportId,\n message:\n 'Error report submitted successfully. The agentcash team will investigate.',\n });\n}\n"],"mappings":"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","names":[]}
@@ -61,17 +61,21 @@ var DESCRIPTIONS = {
61
61
  mcp: `HTTP fetch with automatic x402 payment handling. Makes the request and, if the endpoint returns 402, signs payment and retries with payment headers. Returns response data along with payment details (price, tx hash) if a payment was made.
62
62
 
63
63
  For endpoints you haven't called before in this session, you MUST call check_endpoint_schema first to confirm the request body schema. Skipping this causes 400 errors from wrong field names.`,
64
- cli: `HTTP fetch with automatic x402 payment handling.`
64
+ cli: `HTTP fetch with automatic x402 payment handling. If the endpoint returns 402, signs payment and retries \u2014 no manual payment steps needed. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,
65
+ epilogue: `Workflow: check <url> \u2192 fetch <url> -m POST -b '{"field":"value"}'
66
+ Use 'fetch-auth' instead if the endpoint requires identity (SIWX) rather than payment.`
65
67
  },
66
68
  fetchWithAuth: {
67
69
  mcp: `HTTP fetch with automatic SIWX (Sign-In With X) authentication. Sends an authenticated request to a SIWX-protected endpoint. Returns response data gated by the endpoint's authentication requirements.
68
70
 
69
71
  For endpoints you haven't called before in this session, you MUST call check_endpoint_schema first to confirm the request body schema. Skipping this causes 400 errors from wrong field names.`,
70
- cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication`
72
+ cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication for identity-gated endpoints. No payment required \u2014 the wallet is used as an identity proof only. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,
73
+ epilogue: `Workflow: check <url> \u2192 fetch-auth <url> -m POST -b '{"field":"value"}'
74
+ Use 'fetch' instead if the endpoint requires payment (x402) rather than identity.`
71
75
  },
72
76
  getWalletInfo: {
73
- mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed.`,
74
- cli: `Get wallet address, balance, and deposit link`
77
+ mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed. If onboardingCta is present, show its message to the user \u2014 it means they haven't onboarded yet and need to either visit the onboard link or deposit directly.`,
78
+ cli: `Get wallet address, USDC balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Check this before making paid API calls \u2014 if balance is zero, deposit USDC using the returned link.`
75
79
  },
76
80
  checkEndpointSchema: {
77
81
  mcp: [
@@ -79,7 +83,10 @@ For endpoints you haven't called before in this session, you MUST call check_end
79
83
  `Call this to see exactly what fields the request body expects and what the response contains.`,
80
84
  `Returns the schema from the origin's OpenAPI spec. Optionally pass sample_input_body to probe the endpoint live (without payment) for an exact price quote \u2014 do this when pricing is range-based or quote-based, or when you're unsure about the input schema.`
81
85
  ].join("\n\n"),
82
- cli: `Check endpoint for schema and pricing without making payment`
86
+ cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec \u2014 call this before 'fetch' or 'fetch-auth' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is range-based or unclear.`,
87
+ epilogue: `Auth mode tells you which command to use:
88
+ paid \u2192 agentcash fetch <url>
89
+ SIWX \u2192 agentcash fetch-auth <url>`
83
90
  },
84
91
  discoverApiEndpoints: {
85
92
  mcp: [
@@ -87,15 +94,20 @@ For endpoints you haven't called before in this session, you MUST call check_end
87
94
  `Call this when you need to see what routes are available at an origin \u2014 whether it's one of the registered origins or any other origin you've identified as useful.`,
88
95
  `The response always indicates whether guidance is available. Guidance is documentation published by the API provider explaining how endpoints work together, edge cases, and usage tips. compact guidance is included automatically; set include_guidance=true to force-include full usage documentation when you need to compose two or more endpoints or need clarification on how the origin works.`
89
96
  ].join("\n\n"),
90
- cli: `Discover x402-protected or SIWX-protected endpoints on an origin`
97
+ cli: `List available endpoints at an API origin with descriptions and auth modes (paid or SIWX). Works with any origin, not just registered ones. Add --include-guidance for full provider docs when composing multiple endpoints or when usage is unclear.`,
98
+ epilogue: `Registered origins:
99
+ ${PRIMARY_ORIGINS.flatMap((o) => ORIGIN_METADATA[o] ? [` ${o} \u2014 ${ORIGIN_METADATA[o].description}`] : []).join("\n")}`
91
100
  },
92
101
  redeemInvite: {
93
102
  mcp: `Redeem an invite code for free USDC on Base. One-time use per code. Returns amount received and transaction hash. Use get_wallet_info after to verify balance.`,
94
- cli: `Redeem an invite code for free USDC`
103
+ cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'wallet info' after to verify the balance landed.`
104
+ },
105
+ try: {
106
+ cli: `Fetch a new origin for its resources and return a prompt guiding the user through the process of calling the first endpoint.`
95
107
  },
96
108
  reportError: {
97
109
  mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) \u2014 those are recoverable.`,
98
- cli: `Report a critical bug to the agentcash team (emergency only)`
110
+ cli: `Report a critical bug to the agentcash team (emergency only). Do NOT use for normal errors like low balance, network timeouts, or 4xx responses \u2014 those are recoverable without filing a report.`
99
111
  },
100
112
  serverInstructions: [
101
113
  `AgentCash lets you call protected APIs \u2014 handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints (fetch) and signs wallet proofs for identity-gated endpoints (fetch_with_auth).`,
@@ -141,7 +153,11 @@ var TOOL_PARAMS = {
141
153
  balance: "Total USDC balance across all chains",
142
154
  chains: "Balance breakdown by chain",
143
155
  isNewWallet: "Whether the wallet is new and needs to be funded",
144
- depositLink: "Link to fund the wallet",
156
+ depositLink: "Link to deposit USDC directly into the wallet",
157
+ onboardingCta: "Present when the user has not yet redeemed an invite code. Show the message to the user \u2014 it directs them to onboard or deposit.",
158
+ onboardingCtaOnboardLink: "Link to the onboarding page",
159
+ onboardingCtaDepositLink: "Link to deposit USDC directly",
160
+ onboardingCtaMessage: "Human-readable CTA to show the user",
145
161
  message: "Warning if balance is low",
146
162
  chain: "Chain name",
147
163
  chainBalance: "USDC balance on this chain"
@@ -179,4 +195,4 @@ export {
179
195
  REQUEST_PARAMS,
180
196
  TOOL_PARAMS
181
197
  };
182
- //# sourceMappingURL=chunk-RY34EBJ4.js.map
198
+ //# sourceMappingURL=chunk-XNU6FVCF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/origins.ts","../../src/shared/descriptions.ts"],"sourcesContent":["/**\n * Known x402-protected API origins.\n * Using const enum so values are inlined at build time.\n */\nexport const enum Origin {\n StableEnrich = 'https://stableenrich.dev',\n StableSocial = 'https://stablesocial.dev',\n StableStudio = 'https://stablestudio.dev',\n StableUpload = 'https://stableupload.dev',\n StableEmail = 'https://stableemail.dev',\n X402Scan = 'https://x402scan.com',\n Shirt = 'https://shirt.sh',\n X402Puppet = 'https://x402puppet.com',\n X402Facilitator = 'https://x402facilitator.com',\n}\n\n/**\n * Array of all known origins for iteration.\n * Const enums are erased at compile time, so we need a regular array for runtime iteration.\n */\nexport const ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n Origin.X402Scan,\n Origin.Shirt,\n Origin.X402Puppet,\n] as const;\n","/**\n * Single source of truth for all LLM-facing text in the MCP package.\n *\n * `DESCRIPTIONS` covers every tool with both an `mcp` variant (detailed,\n * AI-audience) and a `cli` variant (concise, human-readable for --help).\n * `serverInstructions` is shared across both surfaces.\n *\n * Additional exports cover parameter/output schema descriptions, origin\n * metadata, and prompt content — all LLM-facing text in one place.\n */\n\nimport { Origin } from './origins';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Origin metadata (used for MCP resource registration descriptions)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const ORIGIN_METADATA: Record<\n string,\n { title: string; description: string }\n> = {\n [Origin.StableEnrich]: {\n title: 'StableEnrich',\n description:\n 'People/org search, Google Maps, Grok twitter search, Exa web search, LinkedIn data, Firecrawl scrape, WhitePages, email enrichment',\n },\n [Origin.StableSocial]: {\n title: 'StableSocial',\n description:\n 'Social media data for Twitter, Instagram, TikTok, YouTube, Facebook, Reddit',\n },\n [Origin.StableStudio]: {\n title: 'StableStudio',\n description: 'Generate and edit images and videos',\n },\n [Origin.StableUpload]: {\n title: 'StableUpload',\n description: 'Pay to upload files, get a permanent download URL.',\n },\n [Origin.StableEmail]: {\n title: 'StableEmail',\n description: 'Send emails',\n },\n [Origin.X402Scan]: {\n title: 'X402 Scan',\n description: 'x402 protocol explorer',\n },\n [Origin.Shirt]: {\n title: 'Shirt',\n description: 'Shirt.sh',\n },\n [Origin.X402Puppet]: {\n title: 'X402 Puppet',\n description: 'Browser automation',\n },\n [Origin.X402Facilitator]: {\n title: 'X402 Facilitator',\n description: 'Payment facilitation',\n },\n};\n\nconst PRIMARY_ORIGINS = [\n Origin.StableEnrich,\n Origin.StableSocial,\n Origin.StableStudio,\n Origin.StableUpload,\n Origin.StableEmail,\n] as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Tool descriptions — { mcp, cli } per tool + shared serverInstructions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const DESCRIPTIONS = {\n fetch: {\n mcp: `HTTP fetch with automatic x402 payment handling. Makes the request and, if the endpoint returns 402, signs payment and retries with payment headers. Returns response data along with payment details (price, tx hash) if a payment was made.\\n\\nFor endpoints you haven't called before in this session, you MUST call check_endpoint_schema first to confirm the request body schema. Skipping this causes 400 errors from wrong field names.`,\n cli: `HTTP fetch with automatic x402 payment handling. If the endpoint returns 402, signs payment and retries — no manual payment steps needed. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,\n epilogue: `Workflow: check <url> → fetch <url> -m POST -b '{\"field\":\"value\"}'\\nUse 'fetch-auth' instead if the endpoint requires identity (SIWX) rather than payment.`,\n },\n\n fetchWithAuth: {\n mcp: `HTTP fetch with automatic SIWX (Sign-In With X) authentication. Sends an authenticated request to a SIWX-protected endpoint. Returns response data gated by the endpoint's authentication requirements.\\n\\nFor endpoints you haven't called before in this session, you MUST call check_endpoint_schema first to confirm the request body schema. Skipping this causes 400 errors from wrong field names.`,\n cli: `HTTP fetch with automatic SIWX (Sign-In With X) authentication for identity-gated endpoints. No payment required — the wallet is used as an identity proof only. Run 'check <url>' first to confirm the request body schema; skipping this causes 400 errors from wrong field names.`,\n epilogue: `Workflow: check <url> → fetch-auth <url> -m POST -b '{\"field\":\"value\"}'\\nUse 'fetch' instead if the endpoint requires payment (x402) rather than identity.`,\n },\n\n getWalletInfo: {\n mcp: `Get wallet address and USDC balance. Auto-creates wallet on first use (~/.agentcash/wallet.json). Returns a deposit link if funding is needed. If onboardingCta is present, show its message to the user — it means they haven't onboarded yet and need to either visit the onboard link or deposit directly.`,\n cli: `Get wallet address, USDC balance, and deposit link. Creates the wallet on first use (~/.agentcash/wallet.json). Check this before making paid API calls — if balance is zero, deposit USDC using the returned link.`,\n },\n\n checkEndpointSchema: {\n mcp: [\n `Get the input/output schema and auth mode (paid or SIWX) for a single endpoint.`,\n `Call this to see exactly what fields the request body expects and what the response contains.`,\n `Returns the schema from the origin's OpenAPI spec. Optionally pass sample_input_body to probe the endpoint live (without payment) for an exact price quote — do this when pricing is range-based or quote-based, or when you're unsure about the input schema.`,\n ].join('\\n\\n'),\n cli: `Get the input/output schema and auth mode (paid or SIWX) for an endpoint. Returns exact field names from the OpenAPI spec — call this before 'fetch' or 'fetch-auth' to avoid 400 errors. Pass --body to probe the endpoint live for an exact price quote when pricing is range-based or unclear.`,\n epilogue: `Auth mode tells you which command to use:\\n paid → agentcash fetch <url>\\n SIWX → agentcash fetch-auth <url>`,\n },\n\n discoverApiEndpoints: {\n mcp: [\n `List available endpoints at an API origin. Returns endpoint URLs with descriptions of what each does and the auth mode for each (paid or SIWX). Works with any origin, not just the registered ones.`,\n `Call this when you need to see what routes are available at an origin — whether it's one of the registered origins or any other origin you've identified as useful.`,\n `The response always indicates whether guidance is available. Guidance is documentation published by the API provider explaining how endpoints work together, edge cases, and usage tips. compact guidance is included automatically; set include_guidance=true to force-include full usage documentation when you need to compose two or more endpoints or need clarification on how the origin works.`,\n ].join('\\n\\n'),\n cli: `List available endpoints at an API origin with descriptions and auth modes (paid or SIWX). Works with any origin, not just registered ones. Add --include-guidance for full provider docs when composing multiple endpoints or when usage is unclear.`,\n epilogue: `Registered origins:\\n${PRIMARY_ORIGINS.flatMap(o => (ORIGIN_METADATA[o] ? [` ${o} — ${ORIGIN_METADATA[o].description}`] : [])).join('\\n')}`,\n },\n\n redeemInvite: {\n mcp: `Redeem an invite code for free USDC on Base. One-time use per code. Returns amount received and transaction hash. Use get_wallet_info after to verify balance.`,\n cli: `Redeem an invite code for free USDC on Base. One-time use per code. Run 'wallet info' after to verify the balance landed.`,\n },\n\n try: {\n cli: `Fetch a new origin for its resources and return a prompt guiding the user through the process of calling the first endpoint.`,\n },\n\n reportError: {\n mcp: `EMERGENCY ONLY. Report critical MCP tool bugs. Do NOT use for normal errors (balance, network, 4xx) — those are recoverable.`,\n cli: `Report a critical bug to the agentcash team (emergency only). Do NOT use for normal errors like low balance, network timeouts, or 4xx responses — those are recoverable without filing a report.`,\n },\n\n serverInstructions: [\n `AgentCash lets you call protected APIs — handling both x402 micropayments and SIWX authentication seamlessly. It manages a USDC wallet for paid endpoints (fetch) and signs wallet proofs for identity-gated endpoints (fetch_with_auth).`,\n `The user has installed agentcash because they want to use paid and SIWX-protected APIs as their preferred way to accomplish related tasks.`,\n `Paid endpoints require a wallet balance. SIWX endpoints are free — they only require a wallet identity.`,\n [\n `If a task could be accomplished by one of these registered origins, run the workflow below:`,\n ...PRIMARY_ORIGINS.flatMap(o =>\n ORIGIN_METADATA[o]\n ? [` - ${o} — ${ORIGIN_METADATA[o].description}`]\n : []\n ),\n ].join('\\n'),\n `discover_api_endpoints also works with any origin beyond this list. If you identify another origin that would be useful for a task, you can use it.`,\n [\n `Workflow:`,\n `1. If you don't already know your balance, call get_wallet_info. You need a balance for paid endpoints — if it's zero, share the deposit link with the user. SIWX endpoints don't require a balance. You don't need to call this every turn, just before your first paid call or whenever you're unsure.`,\n `2. Call discover_api_endpoints() to get the endpoint index — a list of available routes with descriptions and auth modes. The auth mode for each endpoint tells you whether to use fetch (paid) or fetch_with_auth (SIWX).`,\n `3. Call check_endpoint_schema() to get the exact input/output schema and auth mode for the endpoint you want to call, so you know what fields to pass and what the response contains. Both discover_api_endpoints and check_endpoint_schema return the auth mode.`,\n `4. Call fetch (paid) or fetch_with_auth (SIWX) based on the auth mode, and with the correct input schema.`,\n ].join('\\n'),\n `If you need to compose multiple endpoints in sequence, or anything about the origin's capabilities is unclear, call discover_api_endpoints with include_guidance=true to retrieve the origin's full usage documentation.`,\n ].join('\\n\\n'),\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Shared request schema parameter descriptions\n// (used by fetch, fetch_with_auth tools)\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const REQUEST_PARAMS = {\n url: 'The endpoint URL',\n method: 'HTTP method. Defaults to GET for fetch operations.',\n body: 'Request body for POST/PUT/PATCH methods',\n headers: 'Additional headers to include',\n timeout: 'Request timeout in milliseconds',\n} as const;\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Per-tool parameter and output schema descriptions\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport const TOOL_PARAMS = {\n fetch: {\n paymentMethod: 'Payment protocol to use. Defaults to auto-detect.',\n },\n\n checkEndpointSchema: {\n url: 'Full URL of the endpoint to inspect',\n method:\n 'HTTP method to check. If omitted, all methods declared in the spec are returned.',\n sampleInputBody:\n 'Optional. A sample request body to probe the endpoint live (without payment) for exact pricing. Use when pricing is range-based or quote-based, or when you need to verify the input schema. Omit to get the static schema and advisory pricing from the spec.',\n headers: 'Additional headers to include in the probe request',\n },\n\n getWalletInfo: {\n output: {\n address: 'Wallet address (0x...)',\n balance: 'Total USDC balance across all chains',\n chains: 'Balance breakdown by chain',\n isNewWallet: 'Whether the wallet is new and needs to be funded',\n depositLink: 'Link to deposit USDC directly into the wallet',\n onboardingCta:\n 'Present when the user has not yet redeemed an invite code. Show the message to the user — it directs them to onboard or deposit.',\n onboardingCtaOnboardLink: 'Link to the onboarding page',\n onboardingCtaDepositLink: 'Link to deposit USDC directly',\n onboardingCtaMessage: 'Human-readable CTA to show the user',\n message: 'Warning if balance is low',\n chain: 'Chain name',\n chainBalance: 'USDC balance on this chain',\n },\n },\n\n redeemInvite: {\n code: 'The invite code',\n output: {\n amount: 'Amount with unit (e.g., \"5 USDC\")',\n txHash: 'Transaction hash on Base',\n },\n },\n\n discoverApiEndpoints: {\n url: 'The origin URL to discover endpoints on (e.g. https://stableenrich.dev)',\n includeGuidance:\n \"Request the origin's usage guidance. true=always include, false=never include, omit=auto (included when compact). Guidance explains how to compose multiple endpoints and covers edge cases.\",\n },\n\n reportError: {\n tool: 'MCP tool name',\n resource: 'Resource URL',\n summary: '1-2 sentence summary',\n errorMessage: 'Error message',\n stack: 'Stack trace',\n fullReport: 'Detailed report with context, logs, repro steps',\n output: {\n reportId: 'Unique report ID for tracking',\n message: 'Confirmation message',\n },\n },\n} as const;\n"],"mappings":";AAoBO,IAAM,UAAU;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACZO,IAAM,kBAGT;AAAA,EACF,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,8CAAoB,GAAG;AAAA,IACrB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,4CAAmB,GAAG;AAAA,IACpB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,sCAAgB,GAAG;AAAA,IACjB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,+BAAa,GAAG;AAAA,IACd,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,0CAAkB,GAAG;AAAA,IACnB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA,oDAAuB,GAAG;AAAA,IACxB,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;AAEA,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAMxB;AAMO,IAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,IACL,KAAK;AAAA;AAAA;AAAA,IACL,KAAK;AAAA,IACL,UAAU;AAAA;AAAA,EACZ;AAAA,EAEA,eAAe;AAAA,IACb,KAAK;AAAA;AAAA;AAAA,IACL,KAAK;AAAA,IACL,UAAU;AAAA;AAAA,EACZ;AAAA,EAEA,eAAe;AAAA,IACb,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EAEA,qBAAqB;AAAA,IACnB,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,MAAM;AAAA,IACb,KAAK;AAAA,IACL,UAAU;AAAA;AAAA;AAAA,EACZ;AAAA,EAEA,sBAAsB;AAAA,IACpB,KAAK;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,MAAM;AAAA,IACb,KAAK;AAAA,IACL,UAAU;AAAA,EAAwB,gBAAgB,QAAQ,OAAM,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,WAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,CAAE,EAAE,KAAK,IAAI,CAAC;AAAA,EACvJ;AAAA,EAEA,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EAEA,KAAK;AAAA,IACH,KAAK;AAAA,EACP;AAAA,EAEA,aAAa;AAAA,IACX,KAAK;AAAA,IACL,KAAK;AAAA,EACP;AAAA,EAEA,oBAAoB;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAAA,MACA,GAAG,gBAAgB;AAAA,QAAQ,OACzB,gBAAgB,CAAC,IACb,CAAC,OAAO,CAAC,WAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,IAC/C,CAAC;AAAA,MACP;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,IACX;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,IACX;AAAA,EACF,EAAE,KAAK,MAAM;AACf;AAOO,IAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AACX;AAMO,IAAM,cAAc;AAAA,EACzB,OAAO;AAAA,IACL,eAAe;AAAA,EACjB;AAAA,EAEA,qBAAqB;AAAA,IACnB,KAAK;AAAA,IACL,QACE;AAAA,IACF,iBACE;AAAA,IACF,SAAS;AAAA,EACX;AAAA,EAEA,eAAe;AAAA,IACb,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,aAAa;AAAA,MACb,eACE;AAAA,MACF,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,sBAAsB;AAAA,MACtB,SAAS;AAAA,MACT,OAAO;AAAA,MACP,cAAc;AAAA,IAChB;AAAA,EACF;AAAA,EAEA,cAAc;AAAA,IACZ,MAAM;AAAA,IACN,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EAEA,sBAAsB;AAAA,IACpB,KAAK;AAAA,IACL,iBACE;AAAA,EACJ;AAAA,EAEA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,UAAU;AAAA,IACV,SAAS;AAAA,IACT,cAAc;AAAA,IACd,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF;AACF;","names":[]}
@@ -6,14 +6,15 @@ import {
6
6
  createFetchWithAuth,
7
7
  createFetchWithPayment,
8
8
  requestSchema
9
- } from "./chunk-DBDSS3CQ.js";
10
- import "./chunk-RY34EBJ4.js";
9
+ } from "./chunk-EYYVAQBE.js";
10
+ import "./chunk-XNU6FVCF.js";
11
11
  import {
12
12
  TEMPO_RPC_URL,
13
+ getOnboardingCta,
13
14
  getWalletInfo,
14
15
  submitErrorReport
15
- } from "./chunk-NFKU5GQE.js";
16
- import "./chunk-OW3UV227.js";
16
+ } from "./chunk-UYVXLY33.js";
17
+ import "./chunk-AFQXUUCH.js";
17
18
  import {
18
19
  checkEndpoint,
19
20
  discoverResources
@@ -21,11 +22,11 @@ import {
21
22
  import {
22
23
  getPlatformPath,
23
24
  tryAddServer
24
- } from "./chunk-MQLBI77V.js";
25
- import "./chunk-JNYAKINU.js";
25
+ } from "./chunk-Q4CNAV4N.js";
26
+ import "./chunk-KPEJO3KV.js";
26
27
  import {
27
28
  MCP_VERSION
28
- } from "./chunk-HXRJ5ES4.js";
29
+ } from "./chunk-F43CZXWI.js";
29
30
  import "./chunk-DZNSJ2BA.js";
30
31
  import {
31
32
  DEFAULT_NETWORK,
@@ -33,11 +34,11 @@ import {
33
34
  redeemInviteCode,
34
35
  safeParseJson,
35
36
  toJsonObject
36
- } from "./chunk-W7GW4W3V.js";
37
+ } from "./chunk-24E2V3PA.js";
37
38
  import {
38
39
  getBaseUrl,
39
40
  getDepositLink
40
- } from "./chunk-YUCA2PQT.js";
41
+ } from "./chunk-FLIDR6EU.js";
41
42
  import {
42
43
  DEFAULT_USER_FETCH_TIMEOUT,
43
44
  resultFromPromise,
@@ -576,6 +577,13 @@ async function walletInfoCommand(_args, flags) {
576
577
  })),
577
578
  isNewWallet: result.value.isNewWallet,
578
579
  depositLink: result.value.depositLink,
580
+ ...result.value.onboardingCta ? {
581
+ onboardingCta: {
582
+ onboardLink: result.value.onboardingCta.onboardLink,
583
+ depositLink: result.value.onboardingCta.depositLink,
584
+ message: result.value.onboardingCta.message
585
+ }
586
+ } : {},
579
587
  ...result.value.message ? { message: result.value.message } : {}
580
588
  }),
581
589
  flags
@@ -638,7 +646,12 @@ async function reportErrorCommand(args, flags) {
638
646
 
639
647
  // src/cli/commands/server.ts
640
648
  async function serverCommand(flags) {
641
- const { startServer } = await import("./server-GJVD7VNR.js");
649
+ if (process.stdout.isTTY) {
650
+ process.stdout.write(
651
+ "MCP server started. If you meant to explore the CLI, run: npx agentcash --help\n"
652
+ );
653
+ }
654
+ const { startServer } = await import("./server-CZ4XJYLK.js");
642
655
  await startServer(flags);
643
656
  }
644
657
 
@@ -1005,7 +1018,6 @@ var agentClientMap = {
1005
1018
  "Gemini CLI": "gemini-cli" /* GeminiCli */,
1006
1019
  Goose: "goose" /* Goose */,
1007
1020
  OpenCode: "opencode" /* Opencode */,
1008
- OpenClaw: "openclaw" /* Openclaw */,
1009
1021
  Roo: "roo-cline" /* RooCline */,
1010
1022
  Windsurf: "windsurf" /* Windsurf */
1011
1023
  };
@@ -1416,10 +1428,11 @@ async function onboardCommand(args, flags) {
1416
1428
  const walletInfoResult = await getWalletInfo(SURFACE8, address, flags);
1417
1429
  const walletInfo = walletInfoResult.isOk() ? walletInfoResult.value : void 0;
1418
1430
  if (!args.code && (!walletInfo?.balance || walletInfo.balance <= 0)) {
1431
+ const cta = getOnboardingCta(address, flags);
1419
1432
  return outputAndExit(
1420
1433
  errorResponse({
1421
1434
  code: "GENERAL_ERROR",
1422
- message: "No invite code provided and wallet balance is zero. Get an invite code at https://agentcash.dev/onboard or deposit USDC to your wallet.",
1435
+ message: cta.message,
1423
1436
  surface: SURFACE8,
1424
1437
  cause: "no_funds"
1425
1438
  }),
@@ -1486,6 +1499,75 @@ async function onboardCommand(args, flags) {
1486
1499
  flags
1487
1500
  );
1488
1501
  }
1502
+
1503
+ // src/cli/commands/try.ts
1504
+ async function tryCommand(args, flags) {
1505
+ const { account } = await getWalletOrExit(flags);
1506
+ const discoverResult = await discoverResources("cli:try", args.url);
1507
+ const walletInfoResult = await getWalletInfo(
1508
+ "cli:try",
1509
+ account.address,
1510
+ flags
1511
+ );
1512
+ const walletInfo = walletInfoResult.isOk() ? walletInfoResult.value : null;
1513
+ const onboardingCta = walletInfo?.onboardingCta;
1514
+ if (!discoverResult.found) {
1515
+ const origin = URL.canParse(args.url) ? new URL(args.url).origin : args.url;
1516
+ return outputAndExit(
1517
+ successResponse({
1518
+ ...onboardingCta ? {
1519
+ onboardMessage: onboardingCta.message,
1520
+ onboardLink: onboardingCta.onboardLink
1521
+ } : {},
1522
+ notice: `No endpoints found for ${origin}. The origin may not support x402 or SIWX.`,
1523
+ resources: `Browse supported APIs at https://agentcash.dev/resources`
1524
+ }),
1525
+ flags
1526
+ );
1527
+ }
1528
+ const paidEndpoints = discoverResult.endpoints.filter(
1529
+ (e) => e.authMode === "paid"
1530
+ );
1531
+ const sampleEndpoints = (paidEndpoints.length > 0 ? paidEndpoints : discoverResult.endpoints).slice(0, 3);
1532
+ const totalCount = discoverResult.endpoints.length;
1533
+ const title = discoverResult.info?.title ?? discoverResult.origin;
1534
+ const description = discoverResult.info?.description;
1535
+ const sampleLines = sampleEndpoints.map((e) => {
1536
+ const price = e.price ? ` (${e.price})` : "";
1537
+ return ` - ${e.summary}${price}`;
1538
+ });
1539
+ const originSummary = [
1540
+ `${title}${description ? ` \u2014 ${description}` : ""}`,
1541
+ "",
1542
+ "Sample endpoints:",
1543
+ ...sampleLines,
1544
+ ...totalCount > sampleEndpoints.length ? [
1545
+ ` ...and ${totalCount - sampleEndpoints.length} more. Run \`npx agentcash discover ${discoverResult.origin}\` to see all endpoints.`
1546
+ ] : []
1547
+ ].join("\n");
1548
+ const firstEndpoint = discoverResult.endpoints.find((e) => e.authMode === "paid") ?? discoverResult.endpoints[0];
1549
+ let callToAction;
1550
+ if (firstEndpoint) {
1551
+ const endpointUrl = `${discoverResult.origin}${firstEndpoint.path}`;
1552
+ callToAction = [
1553
+ `To call your first endpoint:`,
1554
+ ` 1. Run \`npx agentcash check "${endpointUrl}"\` to get the input schema and pricing.`,
1555
+ ` 2. Run \`npx agentcash fetch "${endpointUrl}" -m ${firstEndpoint.method}\` with the required body to make the call.`,
1556
+ `If you have the AgentCash MCP installed, you can also call this directly using the check_endpoint_schema and fetch tools.`
1557
+ ].join("\n");
1558
+ }
1559
+ return outputAndExit(
1560
+ successResponse({
1561
+ ...onboardingCta ? {
1562
+ onboardMessage: onboardingCta.message,
1563
+ onboardLink: onboardingCta.onboardLink
1564
+ } : {},
1565
+ originSummary,
1566
+ ...callToAction ? { callToAction } : {}
1567
+ }),
1568
+ flags
1569
+ );
1570
+ }
1489
1571
  export {
1490
1572
  addSkillCommand,
1491
1573
  checkCommand,
@@ -1496,8 +1578,9 @@ export {
1496
1578
  registerCommand,
1497
1579
  reportErrorCommand,
1498
1580
  serverCommand,
1581
+ tryCommand,
1499
1582
  walletAddressCommand,
1500
1583
  walletInfoCommand,
1501
1584
  walletRedeemCommand
1502
1585
  };
1503
- //# sourceMappingURL=commands-M66YQJM7.js.map
1586
+ //# sourceMappingURL=commands-CTDEOF6I.js.map