{"_id":"@agentcash/sdk","_rev":"4-c06693aa0d86a1c2920a7a40509ed290","name":"@agentcash/sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.0":{"name":"@agentcash/sdk","version":"0.0.0","_id":"@agentcash/sdk@0.0.0","maintainers":[{"name":"sragss","email":"sammage@gmail.com"},{"name":"rsproule","email":"ryan@merit.systems"},{"name":"json-merit","email":"jason@merit.systems"}],"dist":{"shasum":"c79463a15571dc57abe9ec105965c0be9d4004f7","tarball":"https://registry.npmjs.org/@agentcash/sdk/-/sdk-0.0.0.tgz","fileCount":8,"integrity":"sha512-24ixlt0MH5m+YyJOGdB4zjIV7H380B/lX7VcullugJqJ5ZUodkHgvcV5UVLMHu7DenILK1FZdSC+o3kk+DSP4Q==","signatures":[{"sig":"MEUCIEiPtwpnKbHe85TBIAMP4m1s3MbO8XOJl37tTY8f7phKAiEAsNSk1xsfLTdBSNGlreEsudjbyQy2wtSr39SA4wVn0sU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31465},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js"}},"scripts":{"lint":"eslint . --max-warnings 0","test":"vitest run","build":"tsup","generate":"kubb generate","lint:fix":"eslint . --max-warnings 0 --fix","test:watch":"vitest","types:check":"tsc --noEmit"},"_npmUser":{"name":"json-merit","email":"jason@merit.systems"},"repository":{"url":"git+https://github.com/Merit-Systems/agentcash-web.git","type":"git","directory":"packages/sdk"},"description":"TypeScript SDK for the AgentCash public API","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.1","react":"19.2.7","eslint":"^10.7.0","vitest":"4.1.10","@kubb/cli":"4.39.2","react-dom":"19.2.7","@kubb/core":"4.39.2","typescript":"6.0.3","@types/node":"^24.13.3","@types/react":"19.2.17","@kubb/plugin-ts":"4.39.2","@kubb/plugin-oas":"4.39.2","@types/react-dom":"19.2.3","@kubb/plugin-client":"4.39.2","@repo/eslint-config":"0.0.0","@tanstack/react-query":"5.101.2","@repo/typescript-config":"0.0.0","@kubb/plugin-react-query":"4.39.2"},"peerDependencies":{"react":">=18","@tanstack/react-query":">=5"},"peerDependenciesMeta":{"react":{"optional":true},"@tanstack/react-query":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.0.0_1784583038267_0.04373783998731806","host":"s3://npm-registry-packages-npm-production"}},"0.0.1":{"name":"@agentcash/sdk","version":"0.0.1","_id":"@agentcash/sdk@0.0.1","maintainers":[{"name":"sragss","email":"sammage@gmail.com"},{"name":"rsproule","email":"ryan@merit.systems"},{"name":"json-merit","email":"jason@merit.systems"}],"dist":{"shasum":"3e7e7256155c3a29657bd8e7d6b2d694d338ef65","tarball":"https://registry.npmjs.org/@agentcash/sdk/-/sdk-0.0.1.tgz","fileCount":8,"integrity":"sha512-RT/DlBwBOlfigZypg7rM+DLSlQRNsc0fIDDErHyJcooDR4RYEjBUkRZavR1x4RejHweBMQQplYdbVBkrCDV97A==","signatures":[{"sig":"MEMCHwO5I9jW6FSO8X/Uw7NJaqcUhCCdQQGzpb9KCAGGFoACIELf5M0P9RIkITC5rmtSvjjZh288HxUsX/V43Fb46lG8","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31465},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js"}},"scripts":{"lint":"eslint . --max-warnings 0","test":"vitest run","build":"tsup","generate":"kubb generate","lint:fix":"eslint . --max-warnings 0 --fix","test:watch":"vitest","types:check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d947520d-a214-4b03-be08-82b7c792766a"}},"repository":{"url":"git+https://github.com/Merit-Systems/agentcash-web.git","type":"git","directory":"packages/sdk"},"description":"TypeScript SDK for the AgentCash public API","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"8.5.1","react":"19.2.7","eslint":"^10.7.0","vitest":"4.1.10","@kubb/cli":"4.39.2","react-dom":"19.2.7","@kubb/core":"4.39.2","typescript":"6.0.3","@types/node":"^24.13.3","@types/react":"19.2.17","@kubb/plugin-ts":"4.39.2","@kubb/plugin-oas":"4.39.2","@types/react-dom":"19.2.3","@kubb/plugin-client":"4.39.2","@repo/eslint-config":"0.0.0","@tanstack/react-query":"5.101.2","@repo/typescript-config":"0.0.0","@kubb/plugin-react-query":"4.39.2"},"peerDependencies":{"react":">=18","@tanstack/react-query":">=5"},"peerDependenciesMeta":{"react":{"optional":true},"@tanstack/react-query":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.0.1_1784585429916_0.18970866409905662","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@agentcash/sdk","version":"0.1.0","description":"TypeScript SDK for the AgentCash public API","repository":{"type":"git","url":"git+https://github.com/Merit-Systems/agentcash-web.git","directory":"packages/sdk"},"type":"module","sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js"}},"peerDependencies":{"@tanstack/react-query":">=5","react":">=18"},"peerDependenciesMeta":{"@tanstack/react-query":{"optional":true},"react":{"optional":true}},"devDependencies":{"@kubb/cli":"4.39.2","@kubb/core":"4.39.2","@kubb/plugin-client":"4.39.2","@kubb/plugin-oas":"4.39.2","@kubb/plugin-react-query":"4.39.2","@kubb/plugin-ts":"4.39.2","@tanstack/react-query":"5.101.4","@types/node":"^24.13.3","@types/react":"19.2.17","@types/react-dom":"19.2.3","eslint":"^10.7.0","react":"19.2.8","react-dom":"19.2.8","tsup":"8.5.1","typescript":"6.0.3","vitest":"4.1.10","@repo/eslint-config":"0.0.0","@repo/typescript-config":"0.0.0"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","generate":"kubb generate","lint":"eslint . --max-warnings 0","lint:fix":"eslint . --max-warnings 0 --fix","test":"vitest run","test:watch":"vitest","types:check":"tsc --noEmit"},"_nodeVersion":"24.18.0","_id":"@agentcash/sdk@0.1.0","dist":{"integrity":"sha512-wPa9D+K4uxSWa2Pggm9a/6VjREhXWQuoEb+bjTPHE4bs6pGnRpJcd6t/jPQf6t3XYylbBPbzh3lq5mOh9QcV2g==","shasum":"c9bcaca4a29072ed1a61e415028bcbb425466c77","tarball":"https://registry.npmjs.org/@agentcash/sdk/-/sdk-0.1.0.tgz","fileCount":8,"unpackedSize":54242,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDwgFJVzb6oh9B2Z8EQGMb6PUnj6EcfEbi9cL/MyShaVQIhALfHI+WeCWFhp5ymGvkeYq0MayP3PsRiGyGOpjKz9z+9"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d947520d-a214-4b03-be08-82b7c792766a"}},"directories":{},"maintainers":[{"name":"sragss","email":"sammage@gmail.com"},{"name":"rsproule","email":"ryan@merit.systems"},{"name":"json-merit","email":"jason@merit.systems"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.0_1785198455635_0.9636529723938791"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-20T21:30:38.165Z","modified":"2026-07-28T00:27:35.964Z","0.0.0":"2026-07-20T21:30:38.413Z","0.0.1":"2026-07-20T22:10:30.052Z","0.1.0":"2026-07-28T00:27:35.775Z"},"repository":{"type":"git","url":"git+https://github.com/Merit-Systems/agentcash-web.git","directory":"packages/sdk"},"description":"TypeScript SDK for the AgentCash public API","maintainers":[{"name":"sragss","email":"sammage@gmail.com"},{"name":"rsproule","email":"ryan@merit.systems"},{"name":"json-merit","email":"jason@merit.systems"}],"readme":"# AgentCash SDK\n\nTypeScript bindings for the AgentCash public API, generated from its OpenAPI\ndocument and wrapped with a small runtime for authentication, errors, React\nQuery, custom base URLs, and custom Fetch implementations.\n\n## Core client\n\nUse an API key from trusted server-side code:\n\n```ts\nimport { AgentCash } from \"@agentcash/sdk\";\n\nconst agentcash = new AgentCash({\n  apiKey: process.env.AGENTCASH_API_KEY!,\n});\n\nconst { wallets } = await agentcash.wallets.list();\nconst { balance, accounts } = await agentcash.balance.get();\n```\n\nOAuth access tokens with the API's `agentcash:read` scope are also supported.\nA credential callback is evaluated for every request, so it can refresh or\nretrieve the current token lazily:\n\n```ts\nconst agentcash = new AgentCash({\n  accessToken: () => getAccessToken(),\n});\n```\n\nRequest OAuth tokens for the `https://api.agentcash.dev/v1` resource. Browser\napplications should use OAuth rather than embedding a long-lived API key.\n\n### Errors and custom transport options\n\nNon-success responses throw `AgentCashError`, which exposes the HTTP `status`\nand parsed response `body`:\n\n```ts\nimport { AgentCashError } from \"@agentcash/sdk\";\n\ntry {\n  await agentcash.wallets.list();\n} catch (error) {\n  if (error instanceof AgentCashError) {\n    console.error(error.status, error.body);\n  }\n}\n```\n\nThe constructor also accepts `baseUrl` and `fetch` for alternate environments,\ntests, or runtimes with a custom Fetch implementation.\n\n## React Query\n\nReact integrations live behind the `@agentcash/sdk/react` export so core\nconsumers do not need React or TanStack Query. Install React Query alongside the\nSDK and place `AgentCashProvider` beneath its `QueryClientProvider`:\n\n```tsx\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { AgentCash } from \"@agentcash/sdk\";\nimport { AgentCashProvider, useListWallets } from \"@agentcash/sdk/react\";\nimport { useMemo } from \"react\";\n\nconst queryClient = new QueryClient();\n\nfunction Wallets() {\n  const query = useListWallets();\n\n  if (!query.data) return null;\n  return <pre>{JSON.stringify(query.data.wallets, null, 2)}</pre>;\n}\n\ninterface AppProps {\n  getAccessToken: () => Promise<string>;\n  userId: string;\n}\n\nfunction App({ getAccessToken, userId }: AppProps) {\n  const agentcash = useMemo(\n    () => new AgentCash({ accessToken: () => getAccessToken() }),\n    [getAccessToken]\n  );\n\n  return (\n    <QueryClientProvider client={queryClient}>\n      <AgentCashProvider client={agentcash} cacheKey={userId}>\n        <Wallets />\n      </AgentCashProvider>\n    </QueryClientProvider>\n  );\n}\n```\n\n`cacheKey` must be a stable identifier for the authenticated user or account.\nChanging it when the active account changes keeps cached API data isolated.\nThe provider owns transport injection; there is no global SDK configuration.\n\n## Generated and handwritten code\n\n- `src/generated` contains Kubb output and is committed to git.\n- `src/http.ts` and `src/client.ts` provide authentication, transport, and the\n  public core client.\n- `src/react` provides the side-effect-free React provider and hook adapters.\n- `generators/provider-hook-generator.ts` generates the public provider-aware\n  hooks alongside Kubb's internal hooks.\n\nDo not edit files under `src/generated` manually.\n\n## Regeneration\n\nFrom the repository root, run:\n\n```sh\npnpm api:generate\n```\n\nTurbo first regenerates `apps/web/openapi/v1.json` from the Hono API and then\nruns Kubb for `@agentcash/sdk`. Review and commit both the OpenAPI and generated\nSDK diffs.\n\nPublic class-client method aliases such as `wallets.list()` are configured in\nthe `clientMethodNames` map in `kubb.config.ts`. Keep OpenAPI operation IDs\ndescriptive and globally unique; React hooks and models intentionally retain\nnames such as `useListWallets` and `ListWalletsQueryResponse`.\n\n## Validation\n\n```sh\npnpm --filter @agentcash/sdk test\npnpm --filter @agentcash/sdk build\npnpm check\n```\n","readmeFilename":""}