{"_id":"@perawallet/swap","_rev":"8-6d436f00ec92a5e59f274ac31374a715","name":"@perawallet/swap","dist-tags":{"latest":"1.0.0-beta.5"},"versions":{"1.0.0-beta.1":{"name":"@perawallet/swap","version":"1.0.0-beta.1","keywords":["algorand","pera","wallet","swap","widget","iframe"],"author":{"name":"Pera Wallet"},"license":"MIT","_id":"@perawallet/swap@1.0.0-beta.1","maintainers":[{"name":"taylanpince","email":"taylan@hipolabs.com"},{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},{"name":"yigitguler","email":"yigit@hipo.biz"}],"homepage":"https://github.com/perawallet/pera-swap-widget#readme","bugs":{"url":"https://github.com/perawallet/pera-swap-widget/issues"},"dist":{"shasum":"b4983fa58a285a91c025c8cbc6a977d74c74e9db","tarball":"https://registry.npmjs.org/@perawallet/swap/-/swap-1.0.0-beta.1.tgz","fileCount":8,"integrity":"sha512-bTn8BTU91FrKufIXv8Xzze1LsdvfwydZxycQCgw57/zLLe0BLxpXDxMnU0KeC69F25LfPByAY6oryfuRpLDpzg==","signatures":[{"sig":"MEYCIQCirgNT2DfIr8J1ZVD5A6KcZ3Q92Q4YQX/77ZHZfEnsFwIhAJ4O7EoJ8IqYLUztl3fiI+Rnu0Qi2XTHIucVANHFVtUe","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":80242},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"698f35c5f6a32e0599a966776fdab4133f346cb9","scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},"repository":{"url":"git+https://github.com/perawallet/pera-swap-widget.git","type":"git"},"_npmVersion":"10.9.3","description":"Algorand swap utilities and widget integration","directories":{},"_nodeVersion":"22.18.0","dependencies":{"algosdk":"^3.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/swap_1.0.0-beta.1_1755179846391_0.40149823540198026","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-beta.2":{"name":"@perawallet/swap","version":"1.0.0-beta.2","keywords":["algorand","pera","wallet","swap","widget","iframe"],"author":{"name":"Pera Wallet"},"license":"MIT","_id":"@perawallet/swap@1.0.0-beta.2","maintainers":[{"name":"taylanpince","email":"taylan@hipolabs.com"},{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},{"name":"yigitguler","email":"yigit@hipo.biz"}],"homepage":"https://github.com/perawallet/pera-swap#readme","bugs":{"url":"https://github.com/perawallet/pera-swap/issues"},"dist":{"shasum":"1bdfe67e88a4baadf048c7eb9232fbb448c1de0e","tarball":"https://registry.npmjs.org/@perawallet/swap/-/swap-1.0.0-beta.2.tgz","fileCount":8,"integrity":"sha512-F4iieaBYDiOJajdroKPoxl9EIiFdTnG43pi69WiNKuqW5naaSsjWo4iyjihOvFNm0d0KeRq2vjbU5xPry7NjaA==","signatures":[{"sig":"MEYCIQCCnz2gq5rkaGsUCyXVe6cg99UGzTleut2LnKfcg/frigIhAOveReheTdk6MTn6Cu6EtlLYjrasJHUSPaQKLfPX9lTf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":81630},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"85240117a3efb74dfde6e31446f29a9b9fde8028","scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},"repository":{"url":"git+https://github.com/perawallet/pera-swap.git","type":"git"},"_npmVersion":"10.9.3","description":"Algorand swap utilities and widget integration","directories":{},"_nodeVersion":"22.18.0","dependencies":{"algosdk":"^3.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/swap_1.0.0-beta.2_1756124832166_0.1768013004572906","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-beta.3":{"name":"@perawallet/swap","version":"1.0.0-beta.3","keywords":["algorand","pera","wallet","swap","widget","iframe"],"author":{"name":"Pera Wallet"},"license":"MIT","_id":"@perawallet/swap@1.0.0-beta.3","maintainers":[{"name":"taylanpince","email":"taylan@hipolabs.com"},{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},{"name":"yigitguler","email":"yigit@hipo.biz"}],"homepage":"https://github.com/perawallet/pera-swap#readme","bugs":{"url":"https://github.com/perawallet/pera-swap/issues"},"dist":{"shasum":"beed965ad5d25a58ca5a3ad903da54ab26d6b845","tarball":"https://registry.npmjs.org/@perawallet/swap/-/swap-1.0.0-beta.3.tgz","fileCount":8,"integrity":"sha512-RhNSasaCc38P0SUQKOws1vdAhz2HhtgX5By2uk+wYvHxfHVuaVXnQQ/QhyRVeH3gibXeht8pNVixa2YWxJpPDw==","signatures":[{"sig":"MEUCIQDkU/Hqpc5h9WmGcMKt66j7GkqpPdELxKxfzSu+MsdsdwIgRuQSyNTLA+THAftfJ09Oct9NNFctgHvS4KToxzGfuVk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":85525},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"1f597ae7f885533abdedc645a59983dc4ad8c023","scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},"repository":{"url":"git+https://github.com/perawallet/pera-swap.git","type":"git"},"_npmVersion":"10.9.3","description":"Algorand swap utilities and widget integration","directories":{},"_nodeVersion":"22.20.0","dependencies":{"algosdk":"^3.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/swap_1.0.0-beta.3_1761744192692_0.12581554444392062","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-beta.4":{"name":"@perawallet/swap","version":"1.0.0-beta.4","keywords":["algorand","pera","wallet","swap","widget","iframe"],"author":{"name":"Pera Wallet"},"license":"MIT","_id":"@perawallet/swap@1.0.0-beta.4","maintainers":[{"name":"taylanpince","email":"taylan@hipolabs.com"},{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},{"name":"yigitguler","email":"yigit@hipo.biz"}],"homepage":"https://github.com/perawallet/pera-swap#readme","bugs":{"url":"https://github.com/perawallet/pera-swap/issues"},"dist":{"shasum":"2ab092ca4f72c1a1b6af8868d3898d60c3e08de4","tarball":"https://registry.npmjs.org/@perawallet/swap/-/swap-1.0.0-beta.4.tgz","fileCount":8,"integrity":"sha512-2JMH6L98+bOCx/kns1/4Z7DcGTev0W1wI2PQh2JBasGwqiIR1pM93QB+ZRYw1B+O6YJRQmj9k4jCZBCdHHFiJQ==","signatures":[{"sig":"MEQCIHRa9wRHaKtue+1vxBpdB8A7U6nh+lxM92z57lGMTWetAiB2+F+6I5SG3jXId8JKUPEA5sz8c8tFncBXZ8tABuQyRQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":86975},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"2d24cce09aa05a7c3cec4cdd9ef8a6c43bcc4243","scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},"repository":{"url":"git+https://github.com/perawallet/pera-swap.git","type":"git"},"_npmVersion":"10.9.4","description":"Algorand swap utilities and widget integration","directories":{},"_nodeVersion":"22.21.1","dependencies":{"algosdk":"^3.2.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/swap_1.0.0-beta.4_1762882148868_0.5948246873459737","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-beta.5":{"_id":"@perawallet/swap@1.0.0-beta.5","bugs":{"url":"https://github.com/perawallet/pera-swap/issues"},"dist":{"shasum":"d969af81ccd99438cd3d9daa66d0c9f818c0d0dc","tarball":"https://registry.npmjs.org/@perawallet/swap/-/swap-1.0.0-beta.5.tgz","fileCount":9,"integrity":"sha512-OfXhKWvB3mf1CJZFwhuHBpPZVhS6WjZo5I0Sdp9G9NTANuAT+ktzcTrnq2wsNvI8xGBLwUXFFex5/mct9xQmxA==","signatures":[{"sig":"MEUCIQCsZ/c/gjVpOoSSjhpYKd77PZ1o+kNnNn5zQOf+rXl8tgIgTJwK+gtT0pCSYNHULzZ2B5CHe5Xn2I0UG/3UACQHTL4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDqY40bjzpONo4AJyLLTwX27Ikr6oRctW+Kc98t2xnooQIgDMcu1cafHjvH8TB0ZLyPO838D2O2+1GJP7uCkr0FUus="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@perawallet%2fswap@1.0.0-beta.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":158070},"main":"./dist/index.cjs","name":"@perawallet/swap","type":"module","_from":"file:package.tgz","types":"./dist/index.d.ts","author":{"name":"Pera Wallet"},"module":"./dist/index.js","engines":{"node":">=20"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"license":"MIT","scripts":{"dev":"tsdown --watch","lint":"oxlint --deny-warnings","test":"vitest run --project unit","build":"tsdown","check":"pnpm format:check && pnpm lint && pnpm lint:types && pnpm typecheck && pnpm test:coverage && pnpm test:integration && pnpm test:package","clean":"node -e \"fs.rmSync('dist',{recursive:true,force:true});fs.rmSync('coverage',{recursive:true,force:true})\"","setup":"git config core.hooksPath tools/hooks","format":"oxfmt \"**/*.{ts,tsx,md}\"","lint:fix":"oxlint --fix","test:all":"pnpm test:coverage && pnpm test:integration && pnpm test:package && playwright test","test:live":"PERA_LIVE_API=1 vitest run --project live","typecheck":"tsc --noEmit && tsc --noEmit -p tests","lint:types":"oxlint --config .oxlintrc.types.json --type-aware src","test:watch":"vitest --project unit","example:dev":"pnpm build && pnpm --filter pera-swap-react-example dev","format:check":"oxfmt --check \"**/*.{ts,tsx,md}\"","test:browser":"pnpm build && playwright test","test:package":"pnpm build && vitest run --project package","example:build":"pnpm build && pnpm --filter pera-swap-react-example build","test:coverage":"vitest run --project unit --coverage","test:integration":"vitest run --project integration"},"version":"1.0.0-beta.5","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"ae3b0de5-bc96-4a77-aa6c-eefe6a1d96ee"}},"homepage":"https://github.com/perawallet/pera-swap#readme","keywords":["algorand","iframe","pera","swap","wallet","widget"],"_resolved":"/home/runner/work/pera-swap/pera-swap/package.tgz","_integrity":"sha512-OfXhKWvB3mf1CJZFwhuHBpPZVhS6WjZo5I0Sdp9G9NTANuAT+ktzcTrnq2wsNvI8xGBLwUXFFex5/mct9xQmxA==","repository":{"url":"git+https://github.com/perawallet/pera-swap.git","type":"git"},"_npmVersion":"11.19.1","description":"Algorand swap utilities and Pera Swap widget integration","directories":{},"maintainers":[{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},{"name":"yigitguler","email":"yigit@hipo.biz"},{"name":"yasincetiner.pera","email":"yasin.cetiner@perawallet.app"},{"name":"wjbeau","email":"will@wjbeaumont.org"}],"sideEffects":false,"_nodeVersion":"24.22.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"msw":"2.15.0","vite":"8.3.4","jsdom":"30.1.2","oxfmt":"0.72.0","oxlint":"1.87.0","tsdown":"0.23.1","vitest":"5.0.3","algosdk":"3.8.0","publint":"0.3.25","typescript":"7.0.2","@types/node":"22.20.5","oxlint-tsgolint":"7.0.2004","@playwright/test":"1.64.0","@vitest/coverage-v8":"5.0.3","@arethetypeswrong/core":"0.18.5"},"peerDependencies":{"algosdk":"^3.2.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/swap_1.0.0-beta.5_1793196579531_0.9947054602181907"}}},"time":{"created":"2025-08-14T13:57:26.253Z","modified":"2026-10-28T14:09:40.655Z","1.0.0-beta.1":"2025-08-14T13:57:26.569Z","1.0.0-beta.2":"2025-08-25T12:27:12.353Z","1.0.0-beta.3":"2025-10-29T13:23:12.893Z","1.0.0-beta.4":"2025-11-11T17:29:09.048Z","1.0.0-beta.5":"2026-10-28T14:09:39.653Z"},"bugs":{"url":"https://github.com/perawallet/pera-swap/issues"},"author":{"name":"Pera Wallet"},"license":"MIT","homepage":"https://github.com/perawallet/pera-swap#readme","keywords":["algorand","iframe","pera","swap","wallet","widget"],"repository":{"url":"git+https://github.com/perawallet/pera-swap.git","type":"git"},"description":"Algorand swap utilities and Pera Swap widget integration","maintainers":[{"name":"yasincaliskan","email":"yasincaliskandev@gmail.com"},{"name":"yigitguler","email":"yigit@hipo.biz"},{"name":"yasincetiner.pera","email":"yasin.cetiner@perawallet.app"},{"name":"wjbeau","email":"will@wjbeaumont.org"}],"readme":"# @perawallet/swap\n\n[![npm](https://img.shields.io/npm/v/@perawallet/swap)](https://www.npmjs.com/package/@perawallet/swap)\n[![CI](https://github.com/perawallet/pera-swap/actions/workflows/ci.yml/badge.svg)](https://github.com/perawallet/pera-swap/actions/workflows/ci.yml)\n\nAlgorand swap utilities and Pera Swap widget integration. Use it to:\n\n- embed the **Pera Swap widget** in an iframe, optionally signing transactions with your own wallet, or\n- build your own swap UI on top of the **Pera Swap API** (quotes, transactions, assets).\n\nShips ESM + CommonJS with TypeScript types. Uses the native `fetch` API.\n\n## Installation\n\n```bash\nnpm install @perawallet/swap algosdk\n```\n\n`algosdk` (v3) is a peer dependency, so the `Transaction` objects you receive\ncome from the same `algosdk` your wallet uses.\n\n## Embedding the widget\n\n```ts\nimport { WidgetController } from '@perawallet/swap'\n\nconst iframe = WidgetController.createWidgetIframe(\n    { network: 'mainnet', theme: 'dark', assetIn: 0, assetOut: 31566704 },\n    { height: '488px' },\n)\ndocument.body.appendChild(iframe)\n\n// Or just the URL, for your own <iframe src=\"...\">\nconst url = WidgetController.generateWidgetUrl({ theme: 'light' })\n```\n\n### Widget options\n\n| Option            | Description                                            | Values                     | Default           |\n| ----------------- | ------------------------------------------------------ | -------------------------- | ----------------- |\n| `network`         | Algorand network                                       | `'mainnet'` \\| `'testnet'` | `'mainnet'`       |\n| `theme`           | Widget theme                                           | `'light'` \\| `'dark'`      | `'light'`         |\n| `assetIn`         | Input asset ID                                         | `number` \\| `string`       | `0` (ALGO)        |\n| `assetOut`        | Output asset ID                                        | `number` \\| `string`       | `31566704` (USDC) |\n| `iframeBg`        | Background color                                       | Hex color string           | `#FFFFFF`         |\n| `useParentSigner` | Sign transactions in the host page (see below)         | `boolean`                  | `false`           |\n| `accountAddress`  | Signer address, only used with `useParentSigner: true` | `string`                   | –                 |\n| `widgetUrl`       | Widget to load (see [other widgets](#other-widgets))   | URL string                 | Pera Swap widget  |\n\n`createWidgetIframe(config, options)` also takes `width`, `height`, `className`,\n`id` and `title` for the iframe element.\n\n### Signing in the host page (parent signer)\n\nWith `useParentSigner: true` the widget doesn't connect a wallet itself; it asks\nthe host page to sign. `WidgetController` handles that messaging for you:\n\n```ts\nimport { WidgetController } from '@perawallet/swap'\n\nconst url = WidgetController.generateWidgetUrl({\n    useParentSigner: true,\n    accountAddress: 'ABCDEF...',\n})\n\nconst controller = new WidgetController({\n    // txGroups are decoded algosdk Transaction[][]; resolve with the signed bytes\n    onTxnSignRequest: ({ txGroups }) =>\n        peraWallet.signTransaction(\n            txGroups.map(group => group.map(txn => ({ txn }))),\n        ),\n    onSwapSuccess: ({ signedTxns }) =>\n        console.log(`Swap completed (${signedTxns.length} transactions)`),\n})\n\ncontroller.addWidgetEventListeners()\n// When the widget is removed from the page:\ncontroller.removeWidgetEventListeners()\n```\n\nIf `onTxnSignRequest` rejects, the widget is told signing failed.\n\nFor security, the controller only accepts messages from (and replies to) the\nPera Swap widget origin, `https://swap-widget.perawallet.app`. A signing\nrequest from an origin that isn't allowed is ignored, with a one-time\n`console.warn`.\n\n### Other widgets\n\nTo load another widget, such as the staging one, pass its URL as `widgetUrl`\nand its origin in `allowedOrigins` (`https:` origins with no path; `http:`\nonly for localhost):\n\n```ts\nconst STAGING_WIDGET = 'https://swap-widget-staging.perawallet.app'\n\nconst iframe = WidgetController.createWidgetIframe({\n    widgetUrl: STAGING_WIDGET,\n    network: 'testnet',\n    useParentSigner: true,\n    accountAddress: 'ABCDEF...',\n})\nconst controller = new WidgetController({\n    allowedOrigins: [STAGING_WIDGET],\n    onTxnSignRequest: ({ txGroups }) => wallet.sign(txGroups),\n})\n```\n\n### Messaging the widget\n\n`WidgetController.sendMessageToWidget` posts a message to the widget. Use it to\nswitch the theme without reloading the iframe:\n\n```ts\nWidgetController.sendMessageToWidget({\n    data: { type: 'UPDATE_THEME', message: 'dark' },\n    targetWindow: iframe.contentWindow,\n    // targetOrigin: STAGING_WIDGET, // defaults to the Pera Swap widget origin\n})\n```\n\n## Using the Swap API\n\n```ts\nimport { PeraSwap, PeraSwapApiError } from '@perawallet/swap'\n\nconst peraSwap = new PeraSwap({\n    network: 'mainnet',\n    referrerUrl: 'https://myapp.example', // optional, for attribution\n})\n\nconst { results: quotes } = await peraSwap.createQuote({\n    providers: ['tinyman', 'vestige-v4'],\n    swapper_address: 'ABCDEF...',\n    swap_type: 'fixed-input',\n    asset_in_id: 0, // ALGO\n    asset_out_id: 31566704, // USDC\n    amount: '1000000', // 1 ALGO in microAlgos\n    slippage: '0.005', // 0.5%\n})\n\nconst prepared = await peraSwap.prepareTransactions(quotes[0].quote_id_str)\n\n// ...sign and submit prepared.transaction_groups with your wallet...\n\nawait peraSwap.updateSwapStatus(prepared.swap_id, {\n    status: 'in_progress',\n    submitted_transaction_ids: txIds,\n})\n```\n\nReport failures too, so Pera can track them:\n\n```ts\nawait peraSwap.updateSwapStatus(prepared.swap_id, {\n    status: 'failed',\n    reason: 'user_cancelled', // 'blockchain_error' | 'invalid_submission' | 'other'\n})\n```\n\n### Methods\n\nEvery request method accepts an optional `AbortSignal` as its last argument.\n\n| Method                                          | Returns                                |\n| ----------------------------------------------- | -------------------------------------- |\n| `createQuote(body)`                             | `Promise<{ results: SwapQuote[] }>`    |\n| `prepareTransactions(quoteId, depositAddress?)` | `Promise<PrepareTransactionsResponse>` |\n| `updateSwapStatus(swapId, body)`                | `Promise<unknown>`                     |\n| `getAssets({ asset_ids?, q? })`                 | `Promise<GetAssetsResponse>`           |\n| `getAsset(assetId)`                             | `Promise<Asset \\| null>` ¹             |\n| `searchAssets(query)`                           | `Promise<Asset[]>` ¹                   |\n| `getAvailableAssets({ asset_in_id, q? })`       | `Promise<{ results: Asset[] }>`        |\n| `getAlgoPrice()`                                | `Promise<{ exchange_price: string }>`  |\n| `updateNetwork(network)` / `getNetwork()`       | `void` / `Network`                     |\n\n¹ Resolves to `null` / `[]` instead of throwing when the request fails.\n\n### Constructor\n\n```ts\nnew PeraSwap({ network?, referrerUrl?, fetch? })\nnew PeraSwap(network?, referrerUrl?) // positional form, still supported\n```\n\nPass `fetch` to use a custom implementation (SSR, tests, retries). The two\nforms can't be mixed: a `referrerUrl` after an options object throws.\n\n### Errors\n\nNon-2xx responses throw a `PeraSwapApiError` with `status`, `url` and the parsed\nresponse `body`. Its `message` is the JSON-encoded body, as in earlier versions.\n\n```ts\ntry {\n    await peraSwap.createQuote(body)\n} catch (error) {\n    if (error instanceof PeraSwapApiError && error.status === 400) {\n        console.error(error.body)\n    }\n}\n```\n\n## Examples\n\n[`examples/react`](examples/react) shows four integrations: widget URL, direct\niframe, custom UI on the Swap API and parent signer. Live at\nhttps://perawallet.github.io/pera-swap/.\n\n```bash\npnpm install\npnpm example:dev\n```\n\n## Development\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md). In short:\n\n```bash\ncorepack enable\npnpm install\npnpm run setup   # git hooks\npnpm check       # format, lint, typecheck, test, build\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}