{"_id":"@awakentax/sdk","_rev":"2-3e57f0855c769c71c4c0f261a08efd5d","name":"@awakentax/sdk","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@awakentax/sdk","version":"0.1.0","keywords":["awaken","crypto","tax","embedded","api","sdk"],"license":"MIT","_id":"@awakentax/sdk@0.1.0","maintainers":[{"name":"andrewawaken","email":"andrew@awaken.tax"}],"homepage":"https://awaken.tax/docs/embedded/overview","dist":{"shasum":"d3274993b82ac582b6db993bf330874de8c1ba7e","tarball":"https://registry.npmjs.org/@awakentax/sdk/-/sdk-0.1.0.tgz","fileCount":48,"integrity":"sha512-rBDMJulY9rcsZ4xvAh7aOIP2HyJX/r79TPvj2HeMjw+UhwxOBbjvj/uOCV6rnv4pMqjfvcWXgTIHpsRsbxexEw==","signatures":[{"sig":"MEUCIQD0Efq4O9CJyQoT7pQQah1B9fr90+otH0FVm2wsI3ue0AIgETY8wdp9m42sqOyxJxvZDZl9TW7Qa0sZWobSOH/93rM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":75845},"main":"./dist/cjs/index.js","type":"module","types":"./dist/esm/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"865540195aca7cf09c1765cba309c8df693f8d78","scripts":{"test":"yarn build && node --test \"test/**/*.test.mjs\"","build":"rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/write-cjs-package.mjs","typecheck":"tsc -p tsconfig.esm.json --noEmit","prepublishOnly":"yarn test"},"_npmUser":{"name":"andrewawaken","email":"andrew@awaken.tax"},"_npmVersion":"11.19.0","description":"Official TypeScript SDK for the Awaken Embedded Tax API. Find or create a user, attach their wallets, and get a portal URL they can open.","directories":{},"sideEffects":false,"_nodeVersion":"24.20.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1788502173858_0.9101882057594342","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"_id":"@awakentax/sdk@0.2.0","dist":{"shasum":"d1af0b266151f2b48a8d605a66f537a7ff346dfe","tarball":"https://registry.npmjs.org/@awakentax/sdk/-/sdk-0.2.0.tgz","fileCount":48,"integrity":"sha512-CDHTY3T6q3bwradG2wopZSvSj3MRQdbeyYjX8xMMKY0/TkEMZJgs/a+7F9ZKpDo/Cyqyxl8fyNtn2FDZTdmPxg==","signatures":[{"sig":"MEYCIQC6fAvBZXgwl/yuzQQqKfLOfbfAT1MYaD9PQPJT7HcmIwIhAJnb2FLSXuTFQOh92yk22LOKTKBJM8xqN6gB/eOoskYt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAQzcHz5EV6AkmoBXQuFUm0fLvsrVvWr0NyXmMirRnrkAiAUUFgIKY5xtYkWPikx7gxcKvPIuJX13BiY4oHfN4qKug=="}],"unpackedSize":96232},"main":"./dist/cjs/index.js","name":"@awakentax/sdk","type":"module","types":"./dist/esm/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/esm/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"27424329b8ccb74851beb96f546213d7042cd218","license":"MIT","scripts":{"test":"yarn build && node --test \"test/**/*.test.mjs\"","build":"rm -rf dist && tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/write-cjs-package.mjs","typecheck":"tsc -p tsconfig.esm.json --noEmit","prepublishOnly":"yarn test"},"version":"0.2.0","_npmUser":{"name":"andrewawaken","email":"andrew@awaken.tax"},"homepage":"https://awaken.tax/docs/embedded/overview","keywords":["awaken","crypto","tax","embedded","api","sdk"],"_npmVersion":"11.19.0","description":"Official TypeScript SDK for the Awaken Embedded Tax API. Find or create a user, attach their wallets, and get a portal URL they can open.","directories":{},"maintainers":[{"name":"andrewawaken","email":"andrew@awaken.tax"}],"sideEffects":false,"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5","@types/node":"^20"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.2.0_1788508049880_0.8006731468894734"}}},"time":{"created":"2026-09-04T06:09:33.677Z","modified":"2026-09-04T07:47:30.208Z","0.1.0":"2026-09-04T06:09:34.022Z","0.2.0":"2026-09-04T07:47:29.966Z"},"license":"MIT","homepage":"https://awaken.tax/docs/embedded/overview","keywords":["awaken","crypto","tax","embedded","api","sdk"],"description":"Official TypeScript SDK for the Awaken Embedded Tax API. Find or create a user, attach their wallets, and get a portal URL they can open.","maintainers":[{"name":"andrewawaken","email":"andrew@awaken.tax"}],"readme":"# @awakentax/sdk\n\nOfficial TypeScript SDK for the [Awaken Embedded Tax API](https://awaken.tax/docs/embedded/overview).\nGive your users a complete crypto tax experience from your backend in one call.\n\n```bash\nnpm install @awakentax/sdk\n```\n\n## Quickstart\n\n```ts\nimport { Awaken } from \"@awakentax/sdk\";\n\nconst awaken = new Awaken({\n  clientId: process.env.AWAKEN_CLIENT_ID!,\n  apiSecret: process.env.AWAKEN_API_SECRET!,\n});\n\n// Finds or creates the user, attaches their wallets, and starts importing.\nconst { url } = await awaken.crunch({\n  userId: \"user-42\",\n  email: \"user@example.com\",\n  wallets: [\n    { address: \"0xabc…\", provider: \"ethereum\" },\n    { address: \"SolanaAddress…\", provider: \"solana\" },\n  ],\n});\n\n// Send the user here. Awaken shows import progress, their tax preview,\n// and lets them generate and download reports.\nredirect(url);\n```\n\n`crunch` is safe to call again for the same `userId`: the user is reused and a\nfresh short-lived URL is issued each time.\n\n## What `crunch` returns\n\n| Field         | Meaning                                                                  |\n| ------------- | ------------------------------------------------------------------------ |\n| `url`         | Ready-to-open hosted portal URL with a short-lived access token baked in |\n| `accessToken` | The token inside `url`, if you want to build your own link               |\n| `expiresAt`   | ISO timestamp when the URL stops working                                 |\n| `referenceId` | Echo of your `userId`; use it in every other call                        |\n| `user`        | The embedded user (`id`, partner branding)                               |\n| `accounts`    | Accounts created by this call                                            |\n\n## Build your own UI\n\nEvery endpoint in the [REST reference](https://awaken.tax/docs/reference/rest)\nis available as a typed method. Use your `userId` as the `referenceId`.\n\n```ts\n// Gains, income, and transaction count for a tax year\nconst preview = await awaken.tax.preview(\"user-42\", { year: 2025 });\npreview.capGainsTotal; // \"$17,090.55\"\n\n// Import progress after crunch\nconst { accounts } = await awaken.syncs.list(\"user-42\");\n\n// Reports are generated asynchronously\nawait awaken.reports.create(\"user-42\", { year: 2025, reportType: \"irs_8949\" });\nconst reports = await awaken.reports.list(\"user-42\");\nconst { fileName, bytes } = await awaken.reports.download(\n  \"user-42\",\n  reports[0].id,\n);\n// `fileName` is a single safe path segment; join it onto your own directory.\n```\n\n| Namespace              | Methods                                    |\n| ---------------------- | ------------------------------------------ |\n| `awaken.crunch`        | find-or-create user + wallets + portal URL |\n| `awaken.users`         | `create`, `get`                            |\n| `awaken.accounts`      | `list`, `create`                           |\n| `awaken.syncs`         | `list`, `get`, `create`                    |\n| `awaken.tax`           | `preview`, `recalculate`, `activeJob`      |\n| `awaken.reports`       | `list`, `create`, `download`               |\n| `awaken.accessTokens`  | `create`                                   |\n| `awaken.links`         | `create`, `email`, `forUser`               |\n| `awaken.discountCodes` | `create`                                   |\n\n## Authentication\n\nPass your client id and API secret. They map to the `x-client-id` and\n`x-api-secret` headers. A legacy single `apiKey` is also accepted.\n\nKeep credentials on your server. The only thing that should reach a browser is\nthe `url` from `crunch` or a token from `accessTokens.create`, both of which\nare scoped to one user and expire.\n\nThe client never prints its credentials: `console.log(awaken)` and\n`JSON.stringify(awaken)` show nothing sensitive. Requests are sent with\n`redirect: \"manual\"`, so a redirect is reported as an `AwakenError` rather\nthan followed with your headers attached, and `baseUrl` must be https. A local\nsandbox over plain http needs `allowInsecureBaseUrl: true`; never set that in\nproduction.\n\n## Errors\n\nNon-2xx responses, redirects, and 2xx bodies that are not the JSON envelope\nthrow an `AwakenError` carrying the API's message, the HTTP status, and the raw\nbody. `error.body` and `error.path` can include the reference id and, on\nvalidation errors, the submitted email, so redact them before sending errors to\na log aggregator.\n\n```ts\nimport { AwakenError } from \"@awakentax/sdk\";\n\ntry {\n  await awaken.tax.preview(\"missing-user\");\n} catch (error) {\n  if (error instanceof AwakenError && error.status === 404) {\n    // create the user first\n  }\n}\n```\n\n## Options\n\n```ts\nnew Awaken({\n  clientId,\n  apiSecret,\n  baseUrl: \"https://api.awaken.tax/api\", // default; must be https\n  allowInsecureBaseUrl: false, // default; only for a plain-http local sandbox\n  portalUrl: \"https://embed.awaken.tax\", // default, used when building portal URLs\n  timeoutMs: 30_000, // default\n  fetch: customFetch, // default: global fetch (Node 18+)\n});\n```\n\n## Requirements\n\nNode 18 or newer, or any runtime with a global `fetch`. Ships ESM and CommonJS\nbuilds with type declarations.\n","readmeFilename":"README.md"}