{"_id":"@baseline-markets/sdk","_rev":"9-27b591a0f9efee3d9af67918d9eddb82","name":"@baseline-markets/sdk","dist-tags":{"latest":"1.3.0"},"versions":{"0.0.1":{"name":"@baseline-markets/sdk","version":"0.0.1","_id":"@baseline-markets/sdk@0.0.1","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"11251086f8d219fed0b4d0b322f649990a29bd9d","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-0.0.1.tgz","fileCount":6,"integrity":"sha512-7eNGWeyfkzOHZTsqsakf4ty5wMM9SANsRzMZtHbNsmKx3kGx0NhlnRGATYpByfR+yztAKpHwdDztSRnAZ6gYnw==","signatures":[{"sig":"MEUCIQD76uaMoulT7t1PAb6hXFD37kvhnG5aTEvADWVm7SXWaAIgIYwv7FRPAP2befCywJS7iColDvkZ82tz//A2QHfnuUo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":236795},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"5e9e9d46dc8c85732f727db17fc288498b51b164","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build"},"_npmUser":{"name":"a1740942002","email":"a1740942002@me.com"},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.0.1_1779286324411_0.7142959572880847","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@baseline-markets/sdk","version":"0.0.3","_id":"@baseline-markets/sdk@0.0.3","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"5531aa2e4a3542f58397bd765e35f6b28faa54a7","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-0.0.3.tgz","fileCount":6,"integrity":"sha512-sUQE5UERXYUhAfisqyClenvumChXwtCnE9L8ObvOmKHXH3+D+1hzOKUeMOpJt/96sfzr9vjucOPQTniupcU5CQ==","signatures":[{"sig":"MEUCIQCMdGzdWCQ+jGY8tovMfVd7KplNfd03j35Uny0cBgrACAIgGn0Y5q0LwxIM6tcJ9jeD3QUC6zL5KLsV/pp3QHliqn0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":241272},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"bec913635afbb41230da4789439ef89491c535e9","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.0.3_1779346264679_0.3069872339402522","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@baseline-markets/sdk","version":"1.0.0","license":"MIT","_id":"@baseline-markets/sdk@1.0.0","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"2bd00b9d6b15db1a0c8505b401f364289acf2006","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.0.0.tgz","fileCount":6,"integrity":"sha512-W4SsrE+UNuARAG3mV/kgq7J88nXOwkZf65N4r1cru2WnbdavQ8azqFpdkuBryzHdmo0OQRZYvzv1zQQ0I81N4w==","signatures":[{"sig":"MEUCIQCnDRZtoefw2ds6e10SHboHTFsZl1yzUB/w3bU+zzcX9AIgI9seT1m9Y535ay95mx4DNHHwommdtpHlRZiy3B3TOhk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":241185},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"1a4180bb739b53d1b8836c884348253402ba61e2","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.0_1779350311956_0.640183080274775","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@baseline-markets/sdk","version":"1.0.1","license":"MIT","_id":"@baseline-markets/sdk@1.0.1","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"70a83f43555565daf61df9344f84a7f81d463e32","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.0.1.tgz","fileCount":6,"integrity":"sha512-tyWeCj+H7pe7bTUSz2X99vt1fUhU15RxoyYC5KfZ9+nkDjAa/wHP1v9XS96ZhC95X8NWhKmH3xNMicPS3Muptw==","signatures":[{"sig":"MEYCIQCid0q5ygJioB+nejSMYn9mQU8jrz6+kWkUnMtOb/E0sgIhALei163AIoEWCdSIHm2WLMSjdCyaDFNliptRJb2KLU6h","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":241411},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"8ed96cc6f3d05a99a15a259d99829a4d076c2606","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.1_1779354577057_0.9608006161430023","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@baseline-markets/sdk","version":"1.0.2","license":"MIT","_id":"@baseline-markets/sdk@1.0.2","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"6216eb8d3568d8166331d96d8b6421524c0bd17a","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.0.2.tgz","fileCount":6,"integrity":"sha512-5BZuYjH58mKd257xhQJUrDIGs6aj0b6tdEAuXudNAuqKREq6s35ILbd/Oq/S6sOfqYSSG5CLMkrD01wk24+cCA==","signatures":[{"sig":"MEYCIQC9P9ymvQs/DD8nHls+IXtfsLdesf5aEALztT25/X6xIQIhALYDDAkdBuqbDLOlknYoZipx+v9MhvQyS3Nac4yEsIYG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":241618},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","source":"./index.ts","require":"./dist/index.cjs"}},"gitHead":"11883cd9cc6f43f2f94588a1a9f24b1527449cde","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.2_1779428024419_0.0370669640900636","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@baseline-markets/sdk","version":"1.1.0","license":"MIT","_id":"@baseline-markets/sdk@1.1.0","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"c8ca09a08086f9844bd62eb34d336eb0c5bccbd7","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.1.0.tgz","fileCount":6,"integrity":"sha512-dREPiOIsB009p0GqkBntci8EeVC2s3UAlZpRBGnIjFD02tn4v+z4KejM4R23tMqCEiZaZha/ORea/IsHiwZLPQ==","signatures":[{"sig":"MEYCIQDxPiIkb3N9f8ks62lE6nM39BeW2lcNu0AZo0KVN9pQcQIhANApdTOnAtkiLuqO14xjAtvGYf1SSJtxVmZaXmSZ53fT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":257078},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","source":"./index.ts","require":"./dist/index.cjs"}},"gitHead":"4fd78fd14d949ac69bc0b3b4172aa13fcd746587","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build","test:integration":"bun test tests/*.integration.test.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.1.0_1781772806932_0.19789666526032001","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@baseline-markets/sdk","version":"1.2.0","license":"MIT","_id":"@baseline-markets/sdk@1.2.0","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"bdd898ee61f3f50c563c85b6f15b1a042461daa8","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.2.0.tgz","fileCount":6,"integrity":"sha512-+ChWYhyKbkI+hfZS67ozTdmX+cbkfrudCR4+46DjIznixD3b3ERwS2JssBe9U42+A4wzNhO+klv0QU2XUmyWxw==","signatures":[{"sig":"MEQCIHEeH/O5N+qJbxDejSjhH0VnoaT/pKG9q8zBT/YXSY41AiBIsL2GoDi05rdAw7YHPuTkAag7qRjudkhY0T7HcrZI9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":533896},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","source":"./index.ts","require":"./dist/index.cjs"}},"gitHead":"a067e892418b8e6933b5d5f07d6b9218f785d1aa","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build","test:integration":"bun test tests/*.integration.test.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.12.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"24.17.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.0_1782465069529_0.8084408645229184","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@baseline-markets/sdk","version":"1.2.1","license":"MIT","_id":"@baseline-markets/sdk@1.2.1","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"dist":{"shasum":"e95713c29af71d89608ff4d042b92437c48d1ea5","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.2.1.tgz","fileCount":6,"integrity":"sha512-dOdRn5Hfv2F+ydHQm4YVgg36+9cp6BwzJCLKVDctubOcSdA5myGo6JiIQYFNRHZJVlEG4GKvPXTjDGRh65cKSA==","signatures":[{"sig":"MEQCIEo4rr+Ki6GTo/SCmWtdtj87pAm/O+Mrrumj5fuwQbC7AiBoELTyzi1+tnYYKT7LphIMvHy2sEhv57aPiDmzHRjAIQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":530055},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","source":"./index.ts","require":"./dist/index.cjs"}},"gitHead":"4196d81163abd3aa026bebf82e5e8b085b7c0104","scripts":{"dev":"tsup --watch","test":"bun test","build":"tsup","prepublishOnly":"bun run build","test:integration":"bun test tests/*.integration.test.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"_npmVersion":"11.18.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.31.6","@types/bun":"latest","@baseline/contracts":"workspace:*"},"peerDependencies":{"viem":"^2.31.6","typescript":"^5"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.2.1_1783497299730_0.7975174831078367","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@baseline-markets/sdk","version":"1.3.0","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","license":"MIT","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"source":"./index.ts","types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"sideEffects":false,"scripts":{"build":"tsup","dev":"tsup --watch","prepublishOnly":"bun run build","test":"bun test","test:integration":"bun test tests/*.integration.test.ts"},"peerDependencies":{"typescript":"^5","viem":"^2.31.6"},"peerDependenciesMeta":{"typescript":{"optional":true}},"devDependencies":{"@baseline/contracts":"workspace:*","@types/bun":"latest","tsup":"^8.0.0","viem":"^2.31.6"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"gitHead":"ae165d442583367fa52f6ebf120a2b138410d8ce","_id":"@baseline-markets/sdk@1.3.0","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-1pTLDPu95CPrl7F2hRyMh6o6GFbbCGWHmJPBImowL8X3nkFwsS9c3hpsLO/55dJDkAdPIXFvAgYEtAG4+FATZw==","shasum":"5cab5340b9a3b0dd7c0468546c4a04b9e387bbfe","tarball":"https://registry.npmjs.org/@baseline-markets/sdk/-/sdk-1.3.0.tgz","fileCount":6,"unpackedSize":541109,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCeZJqMv5cTyz9z7dNy9UPCLaV5cig50XaJm+ANXfwS1QIgISZSuJomu+STLH1dhLQOsKgWp4HIFw7tVpVZLtfEl7M="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c79e2fd7-f301-4b73-a467-fe98e53bd84a"}},"directories":{},"maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.3.0_1783781068058_0.1392827794016367"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-20T14:12:04.198Z","modified":"2026-07-11T14:44:28.314Z","0.0.1":"2026-05-20T14:12:04.545Z","0.0.3":"2026-05-21T06:51:04.850Z","1.0.0":"2026-05-21T07:58:32.080Z","1.0.1":"2026-05-21T09:09:37.240Z","1.0.2":"2026-05-22T05:33:44.564Z","1.1.0":"2026-06-18T08:53:27.074Z","1.2.0":"2026-06-26T09:11:09.653Z","1.2.1":"2026-07-08T07:54:59.851Z","1.3.0":"2026-07-11T14:44:28.185Z"},"license":"MIT","description":"TypeScript SDK for Baseline — the end-to-end asset issuance protocol where tokens own their liquidity.","maintainers":[{"name":"indigo256","email":"indigo.eth@protonmail.com"},{"name":"a1740942002","email":"a1740942002@me.com"}],"readme":"# @baseline-markets/sdk\n\nA typed TypeScript SDK for interacting with [Baseline Protocol](https://baseline.markets) contracts via [viem](https://viem.sh).\n\nBaseline is an onchain AMM for tokens with built-in liquidity — `@baseline-markets/sdk` exposes a single `BaselineSDK` class covering token launches, swaps, borrowing, leverage, staking, and rewards.\n\n## Install\n\n```bash\nnpm install @baseline-markets/sdk viem\n# or: bun add @baseline-markets/sdk viem\n```\n\n`viem` is a peer dependency — bring your own.\n\n## Quickstart\n\n```ts\nimport { BaselineSDK } from '@baseline-markets/sdk';\nimport { createPublicClient, createWalletClient, http, custom } from 'viem';\nimport { base } from 'viem/chains';\n\nconst publicClient = createPublicClient({\n  chain: base,\n  transport: http(),\n});\n\n// Wallet client is optional — only needed for write actions\nconst walletClient = createWalletClient({\n  chain: base,\n  transport: custom(window.ethereum),\n});\n\nconst sdk = new BaselineSDK(publicClient, walletClient);\n```\n\nEach SDK instance is **bound to a single chain** — the chain comes from `publicClient.chain`. To talk to a different chain, build a new `publicClient` (and `walletClient` if writing) for that chain and instantiate a new `BaselineSDK`. The SDK has no `chainId` parameter on its methods by design; chain selection lives in the clients you pass to the constructor. See [Switching chains](#switching-chains) below for the React + wagmi pattern.\n\n### Read-only\n\n```ts\nconst bToken = '0x...' as const;\n\nconst price   = await sdk.activePrice(bToken);\nconst reserve = await sdk.getReserve(bToken);\nconst quote   = await sdk.quoteBuyExactOut(bToken, 100n);\n```\n\n### Swaps\n\n```ts\n// Buy exactly 100 bTokens, capped at `quote.amountIn` reserve in\nconst hash = await sdk.buyTokensExactOut(bToken, 100n, quote.amountIn, {\n  confirmations: 1,\n});\n\n// Sell 100 bTokens, accept at least `minOut` reserve out\nconst hash2 = await sdk.sellTokensExactIn(bToken, 100n, minOut);\n```\n\n### Borrow / leverage / stake\n\n```ts\nawait sdk.deposit(bToken, collateral);\nawait sdk.borrow(bToken, debtAmount, recipient);\n\nconst leverageQuote = await sdk.quoteLeverage(bToken, collateralIn, leverageFactor);\nawait sdk.leverage(\n  bToken,\n  leverageQuote.targetCollateral,\n  collateralIn,\n  leverageQuote.maxSwapReservesIn,\n);\n\nawait sdk.repay(bToken, reservesIn, recipient);\nawait sdk.claim(bToken);\n```\n\nSee `src/baseline-sdk.ts` for the full method list.\n\n## Error handling\n\nAll write methods throw `SDKError`, a single error type with a `.kind` discriminator so you don't have to sniff messages:\n\n```ts\nimport { SDKError } from '@baseline-markets/sdk';\n\ntry {\n  await sdk.buyTokensExactOut(bToken, 100n, maxIn);\n} catch (err) {\n  if (err instanceof SDKError) {\n    switch (err.kind) {\n      case 'user_rejected':     // user cancelled in their wallet\n      case 'insufficient_funds': // not enough native balance for gas\n      case 'reverted':          // contract reverted (decoded reason in .message)\n      case 'network':           // RPC/socket/timeout — retry-worthy\n      case 'wallet':            // SDK misuse: no wallet, no account\n      case 'unknown':           // anything else\n    }\n  }\n}\n```\n\nThe original viem error is preserved on `err.cause` if you need it.\n\n## React + wagmi\n\nwagmi's `usePublicClient` / `useWalletClient` return viem clients, so they plug straight into `BaselineSDK`. Wrap construction in a hook and memoize — re-creating the SDK on every render is fine but wasteful.\n\n```tsx\nimport { useMemo } from 'react';\nimport { useChainId, usePublicClient, useWalletClient } from 'wagmi';\nimport { BaselineSDK } from '@baseline-markets/sdk';\n\nexport function useBaselineSDK(chainId?: number) {\n  const walletChainId = useChainId();\n  const targetChainId = chainId ?? walletChainId;\n\n  const publicClient  = usePublicClient({ chainId: targetChainId });\n  const { data: walletClient } = useWalletClient({ chainId: targetChainId });\n\n  return useMemo(() => {\n    if (!publicClient) return null;\n    return new BaselineSDK(publicClient, walletClient ?? undefined);\n  }, [publicClient, walletClient]);\n}\n```\n\n`useWalletClient()` returns `undefined` until the user connects — the SDK still works for reads in that state, and `sdk.hasWallet` tells you whether write actions are available.\n\n### Switching chains\n\nThe SDK is **single-chain**: the chain is baked into `publicClient`, so a `BaselineSDK` instance can only talk to one network. When the user switches network, you need new clients and a new SDK.\n\nWith the hook above this is automatic — passing `chainId` to wagmi's `usePublicClient`/`useWalletClient` returns different client references per chain, the `useMemo` deps change, and a fresh `BaselineSDK` is constructed. You don't have to do anything special; just trust that:\n\n1. **Chain change → new clients → new SDK.** Construction is cheap (the SDK just holds client references and resolves a proxy address from the chain id), so don't try to skip the rebuild.\n2. **Don't mix chains in one SDK.** Never pass a `publicClient` for one chain and a `walletClient` for another — reads and writes will target different networks.\n3. **Read across chains?** Call the hook with an explicit `chainId` per component (e.g. `useBaselineSDK(mainnet.id)` and `useBaselineSDK(base.id)`) — you'll get two independent SDK instances, one per chain.\n\n### Reads with `useQuery`\n\n```tsx\nimport { useQuery } from '@tanstack/react-query';\n\nfunction Price({ bToken }: { bToken: `0x${string}` }) {\n  const sdk = useBaselineSDK();\n\n  const { data: price } = useQuery({\n    queryKey: ['baseline', 'activePrice', sdk?.chainId, bToken],\n    queryFn: () => sdk!.activePrice(bToken),\n    enabled: !!sdk,\n  });\n\n  return <div>{price?.toString()}</div>;\n}\n```\n\nInclude `sdk.chainId` in the query key so cached data is scoped per network.\n\n### Writes with `useMutation`\n\n```tsx\nimport { useMutation } from '@tanstack/react-query';\nimport { SDKError } from '@baseline-markets/sdk';\n\nfunction BuyButton({ bToken, amount, maxIn }: {\n  bToken: `0x${string}`;\n  amount: bigint;\n  maxIn: bigint;\n}) {\n  const sdk = useBaselineSDK();\n\n  const buy = useMutation({\n    mutationFn: () =>\n      sdk!.buyTokensExactOut(bToken, amount, maxIn, { confirmations: 1 }),\n    onError: (err) => {\n      if (err instanceof SDKError && err.kind === 'user_rejected') return;\n      // surface other kinds: insufficient_funds, reverted, network, ...\n    },\n  });\n\n  return (\n    <button\n      disabled={!sdk?.hasWallet || buy.isPending}\n      onClick={() => buy.mutate()}\n    >\n      {buy.isPending ? 'Confirming…' : 'Buy'}\n    </button>\n  );\n}\n```\n\nThe `confirmations` option resolves the promise only after the receipt reaches the requested confirmation count, so `buy.isPending` covers both the wallet prompt and the on-chain confirmation.\n\n## Configuration\n\n`BaselineSDK` takes an optional third argument:\n\n```ts\nnew BaselineSDK(publicClient, walletClient, {\n  defaultUseNative: true,  // use native ETH paths by default where supported\n});\n```\n\nPer-call options live on `TxOpts`:\n\n```ts\nawait sdk.buyTokensExactOut(bToken, 100n, maxIn, {\n  account: '0x...',           // override which address sends the tx\n  confirmations: 2,           // wait for N confirmations before returning\n  onSimulateError: (e) => {}, // hook for pre-simulation failures\n});\n```\n\n## Supported networks\n\n- Ethereum mainnet (`mainnet`, chain id `1`)\n- Base (`base`, chain id `8453`)\n\nThe SDK reads the chain from your `publicClient` and throws if it isn't one of the supported chains — no separate chain config needed.\n\n```ts\nimport { supportedChainIds } from '@baseline-markets/sdk';\n\nif (!supportedChainIds.includes(chainId)) {\n  // unsupported network — prompt user to switch\n}\n```\n\n## Development\n\n```bash\nbun install\nbun run build     # bundle ESM + CJS + .d.ts via tsup\nbun test\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}