{"_id":"@cooperalma/hydrex-sdk","_rev":"6-025fa4b81bea7872f7d9789cc365f6db","name":"@cooperalma/hydrex-sdk","dist-tags":{"latest":"1.2.5"},"versions":{"1.2.1":{"name":"@cooperalma/hydrex-sdk","version":"1.2.1","author":{"name":"Hydrex"},"license":"MIT","_id":"@cooperalma/hydrex-sdk@1.2.1","maintainers":[{"name":"cooperalma","email":"cooper@almalabs.io"}],"dist":{"shasum":"961f242f2489e06d1818d04ec7ffc32d993af9fe","tarball":"https://registry.npmjs.org/@cooperalma/hydrex-sdk/-/hydrex-sdk-1.2.1.tgz","fileCount":86,"integrity":"sha512-3JooXctajlit21Cyr1kChGWWCPnRVIEiqrpO2kxoYEeApI3IygwaZoEWV/CyDKkSwK9AZAFvtTsK59cmnGnpUQ==","signatures":[{"sig":"MEUCIQDUuekxoBybEuz+Ys7BzQLloNGAY3hptPsKKoYxo9WguQIgBmPxJi1imQlMjmHLjypaJd0HDjKNY+xoq3o2nJRMDYE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1699870},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"tsdx lint"}},"module":"dist/hydrex-sdk.esm.js","engines":{"node":">=10"},"gitHead":"e9cb7413c9ea4fa0e497eb39812f0cb64486fb29","scripts":{"lint":"tsdx lint","size":"size-limit","build":"tsdx build","start":"tsdx watch","analyze":"size-limit --why","prepare":"tsdx build"},"typings":"dist/index.d.ts","_npmUser":{"name":"cooperalma","email":"cooper@almalabs.io"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"_npmVersion":"11.2.0","description":"A TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.","directories":{},"_nodeVersion":"23.9.0","dependencies":{"jsbi":"^3.2.5","big.js":"^6.2.1","numeral":"^2.0.6","toformat":"^2.0.0","tiny-warning":"^1.0.3","tiny-invariant":"^1.3.1","decimal.js-light":"^2.5.1","@ethersproject/abi":"^5.7.0","@ethersproject/units":"^5.7.0","@ethersproject/address":"^5.7.0","@ethersproject/solidity":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdx":"^0.14.1","husky":"^8.0.3","tslib":"^2.6.2","size-limit":"^9.0.0","typescript":"^5.2.2","@types/numeral":"^2.0.5","@size-limit/preset-small-lib":"^9.0.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/hydrex-sdk_1.2.1_1775851335775_0.24574002704695008","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package has moved to @hydrexfi/hydrex-sdk"},"1.2.2":{"name":"@cooperalma/hydrex-sdk","version":"1.2.2","author":{"name":"Hydrex"},"license":"MIT","_id":"@cooperalma/hydrex-sdk@1.2.2","maintainers":[{"name":"cooperalma","email":"cooper@almalabs.io"}],"dist":{"shasum":"a0a536ee63a08cc4bbb3e47ff201732a02354457","tarball":"https://registry.npmjs.org/@cooperalma/hydrex-sdk/-/hydrex-sdk-1.2.2.tgz","fileCount":86,"integrity":"sha512-xi7iTtVAagrw9ftc9TF2wfkKa1Us4uFW2oGiY5xEr7Fe//pDMjuhHGubTi158mnVmBqVuYtsN45N2LsqHN1X5w==","signatures":[{"sig":"MEUCIQDGW8zcjhhJCTWOOmHrfGpUSm7XekvI9AO2WxrPlzo74gIgVEfNqQBG2GRv2zTXY+5ZZyoPO9io9jF2XHviMFtgZSw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1699870},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"tsdx lint"}},"module":"dist/hydrex-sdk.esm.js","engines":{"node":">=10"},"gitHead":"96fd64eb1e8cf389d08d49210d133671abdd3997","scripts":{"lint":"tsdx lint","size":"size-limit","build":"tsdx build","start":"tsdx watch","analyze":"size-limit --why","prepare":"tsdx build"},"typings":"dist/index.d.ts","_npmUser":{"name":"cooperalma","email":"cooper@almalabs.io"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"_npmVersion":"11.2.0","description":"A TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.","directories":{},"_nodeVersion":"23.9.0","dependencies":{"jsbi":"^4.3.0","big.js":"^6.2.1","numeral":"^2.0.6","toformat":"^2.0.0","tiny-warning":"^1.0.3","tiny-invariant":"^1.3.1","decimal.js-light":"^2.5.1","@ethersproject/abi":"^5.7.0","@ethersproject/units":"^5.7.0","@ethersproject/address":"^5.7.0","@ethersproject/solidity":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdx":"^0.14.1","husky":"^8.0.3","tslib":"^2.6.2","size-limit":"^9.0.0","typescript":"^5.2.2","@types/numeral":"^2.0.5","@size-limit/preset-small-lib":"^9.0.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/hydrex-sdk_1.2.2_1776107200643_0.7628901849206837","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package has moved to @hydrexfi/hydrex-sdk"},"1.2.3":{"name":"@cooperalma/hydrex-sdk","version":"1.2.3","author":{"name":"Hydrex"},"license":"MIT","_id":"@cooperalma/hydrex-sdk@1.2.3","maintainers":[{"name":"cooperalma","email":"cooper@almalabs.io"}],"dist":{"shasum":"cac71a7323b842a48f9fb1f29e45b9bc467dc9ff","tarball":"https://registry.npmjs.org/@cooperalma/hydrex-sdk/-/hydrex-sdk-1.2.3.tgz","fileCount":88,"integrity":"sha512-86bFlBNbJlqNGAaaW+S+Zj9snT43usN7QBiDwTOL4JzLa5KaXLB1oZTYNWpzZcSamohBoQAHuJZlwdqCqW2rXg==","signatures":[{"sig":"MEUCIQCiMqTZ3gGGqBYRfS/Jh955GQaD9xSiOqOzH4oHOALXwAIgVA07teM7PTRvjH20eFXsK29s//Gdlckn3crqCK7q0Zw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2115371},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"tsdx lint"}},"module":"dist/hydrex-sdk.esm.js","engines":{"node":">=10"},"gitHead":"fb26155f2cbe12e84ae37fd2c8425e7df84d1c5f","scripts":{"lint":"tsdx lint","size":"size-limit","build":"tsdx build","start":"tsdx watch","analyze":"size-limit --why","prepare":"tsdx build"},"typings":"dist/index.d.ts","_npmUser":{"name":"cooperalma","email":"cooper@almalabs.io"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"_npmVersion":"11.2.0","description":"A TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.","directories":{},"_nodeVersion":"23.9.0","dependencies":{"jsbi":"^4.3.0","big.js":"^6.2.1","numeral":"^2.0.6","toformat":"^2.0.0","tiny-warning":"^1.0.3","tiny-invariant":"^1.3.1","decimal.js-light":"^2.5.1","@ethersproject/abi":"^5.7.0","@ethersproject/units":"^5.7.0","@ethersproject/address":"^5.7.0","@ethersproject/solidity":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdx":"^0.14.1","husky":"^8.0.3","tslib":"^2.6.2","size-limit":"^9.0.0","typescript":"^5.2.2","@types/numeral":"^2.0.5","@size-limit/preset-small-lib":"^9.0.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/hydrex-sdk_1.2.3_1776363407989_0.2088817631315416","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package has moved to @hydrexfi/hydrex-sdk"},"1.2.4":{"name":"@cooperalma/hydrex-sdk","version":"1.2.4","author":{"name":"Hydrex"},"license":"MIT","_id":"@cooperalma/hydrex-sdk@1.2.4","maintainers":[{"name":"cooperalma","email":"cooper@almalabs.io"}],"dist":{"shasum":"9c8ed7004fdbde8cb9b4db7271431e2523fa4c0f","tarball":"https://registry.npmjs.org/@cooperalma/hydrex-sdk/-/hydrex-sdk-1.2.4.tgz","fileCount":92,"integrity":"sha512-wNta0uZ+qjVDawnQTYGKfWNTpitmDSg2qUuanGF98uG2kYYfkzEz7EKkugVdOoMCMUqpoSggJLjEIM34wVCkTw==","signatures":[{"sig":"MEUCIDGVJZrAvTVf4/mDzXt6w/26TsVBVbpEtk+e5YCsOiODAiEAiiVuqOwnANfdOPvwMm22erjcFC7u8fJDVFP9onZjYBM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2283116},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"tsdx lint"}},"module":"dist/hydrex-sdk.esm.js","engines":{"node":">=10"},"gitHead":"3d9c8c0bd315b3a3d181100dfd764fa23efbd89b","scripts":{"lint":"tsdx lint","size":"size-limit","build":"tsdx build","start":"tsdx watch","analyze":"size-limit --why","prepare":"tsdx build"},"typings":"dist/index.d.ts","_npmUser":{"name":"cooperalma","email":"cooper@almalabs.io"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"_npmVersion":"11.2.0","description":"A TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.","directories":{},"_nodeVersion":"23.9.0","dependencies":{"jsbi":"^4.3.0","big.js":"^6.2.1","numeral":"^2.0.6","toformat":"^2.0.0","tiny-warning":"^1.0.3","tiny-invariant":"^1.3.1","decimal.js-light":"^2.5.1","@ethersproject/abi":"^5.7.0","@ethersproject/units":"^5.7.0","@ethersproject/address":"^5.7.0","@ethersproject/solidity":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdx":"^0.14.1","husky":"^8.0.3","tslib":"^2.6.2","size-limit":"^9.0.0","typescript":"^5.2.2","@types/numeral":"^2.0.5","@size-limit/preset-small-lib":"^9.0.0"},"peerDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/hydrex-sdk_1.2.4_1776370900639_0.6001245736213519","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package has moved to @hydrexfi/hydrex-sdk"},"1.2.5":{"name":"@cooperalma/hydrex-sdk","version":"1.2.5","author":{"name":"Hydrex"},"license":"MIT","_id":"@cooperalma/hydrex-sdk@1.2.5","maintainers":[{"name":"cooperalma","email":"cooper@almalabs.io"}],"dist":{"shasum":"480f4d2b0ab11b20f69daaf6cac79568412147e5","tarball":"https://registry.npmjs.org/@cooperalma/hydrex-sdk/-/hydrex-sdk-1.2.5.tgz","fileCount":99,"integrity":"sha512-aizkzziq8zya78rBvlr5kgqnJ5Ytkz4nQ49qlt84357Ge2a29/OHDxIKRkb4vU2BSuxyhfYInwPRhlK4BJBgkA==","signatures":[{"sig":"MEQCIFY8Yijs4vC63SZ0hjYyqGeuxQvuQU7m6Sp54GdE2VlqAiBaFfbKh2jEM4F0JMWKgN84eYatWZKRQ4K32eVgaDOEVg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2544732},"main":"dist/index.js","husky":{"hooks":{"pre-commit":"tsdx lint"}},"module":"dist/hydrex-sdk.esm.js","engines":{"node":">=10"},"gitHead":"77f818680c0e3ebc281572d5a84c0b04a803bf88","scripts":{"lint":"tsdx lint","size":"size-limit","build":"tsdx build","start":"tsdx watch","analyze":"size-limit --why","prepare":"tsdx build"},"typings":"dist/index.d.ts","_npmUser":{"name":"cooperalma","email":"cooper@almalabs.io"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"_npmVersion":"11.2.0","description":"A TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.","directories":{},"_nodeVersion":"23.9.0","dependencies":{"jsbi":"^4.3.0","big.js":"^6.2.1","numeral":"^2.0.6","toformat":"^2.0.0","tiny-warning":"^1.0.3","tiny-invariant":"^1.3.1","decimal.js-light":"^2.5.1","@ethersproject/abi":"^5.7.0","@ethersproject/units":"^5.7.0","@ethersproject/address":"^5.7.0","@ethersproject/solidity":"^5.7.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdx":"^0.14.1","husky":"^8.0.3","tslib":"^2.6.2","size-limit":"^9.0.0","typescript":"^5.2.2","@types/numeral":"^2.0.5","@size-limit/preset-small-lib":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/hydrex-sdk_1.2.5_1776453594359_0.6617316710521914","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package has moved to @hydrexfi/hydrex-sdk"}},"time":{"created":"2026-04-10T20:02:15.688Z","modified":"2026-04-20T19:02:44.899Z","1.2.1":"2026-04-10T20:02:16.005Z","1.2.2":"2026-04-13T19:06:40.884Z","1.2.3":"2026-04-16T18:16:48.331Z","1.2.4":"2026-04-16T20:21:40.820Z","1.2.5":"2026-04-17T19:19:54.511Z"},"author":{"name":"Hydrex"},"license":"MIT","description":"A TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.","maintainers":[{"name":"cooperalma","email":"cooper@almalabs.io"}],"readme":"# Hydrex SDK\n\nA TypeScript SDK for interacting with the Hydrex concentrated-liquidity AMM on Base.\n\n## Overview\n\nThe Hydrex SDK provides tools to:\n\n- Compute pool addresses\n- Model pools, positions, routes, and trades\n- Build calldata for swaps via the swap router\n- Build calldata for liquidity management via the position manager\n- Work with ERC4626 \"boosted\" token vaults\n\n## Installation\n\n```bash\nnpm install @hydrex/sdk\n# or\nyarn add @hydrex/sdk\n```\n\n## Supported Networks\n\n| Network      | Chain ID | Status     | Pool Deployer                                |\n|--------------|----------|------------|----------------------------------------------|\n| Base         | 8453     | Mainnet    | `0x1595A5D101d69D2a2bAB2976839cC8eeEb13Ab94` |\n\n## Quick Start\n\n```typescript\nimport {\n  Token,\n  Pool,\n  Position,\n  Route,\n  Trade,\n  TradeType,\n  SwapRouter,\n  NonfungiblePositionManager,\n  ChainId,\n  WNATIVE,\n  Percent,\n  CurrencyAmount,\n} from '@hydrex/sdk';\n```\n\n## Core Concepts\n\n### Tokens\n\n```typescript\nimport { Token, ChainId } from '@hydrex/sdk';\n\nconst USDC = new Token(\n  ChainId.Base,\n  '0xYourUSDCAddress',\n  6,\n  'USDC',\n  'USD Coin'\n);\n\nconst WETH = WNATIVE[ChainId.Base];\n```\n\n### Computing Pool Addresses\n\n```typescript\nimport { computePoolAddress, ChainId } from '@hydrex/sdk';\n\nconst poolAddress = computePoolAddress({\n  tokenA: USDC,\n  tokenB: WETH,\n});\n```\n\nFor pools deployed by a custom deployer:\n\n```typescript\nimport { computeCustomPoolAddress } from '@hydrex/sdk';\n\nconst customPoolAddress = computeCustomPoolAddress({\n  tokenA: USDC,\n  tokenB: WETH,\n  customPoolDeployer: '0xYourCustomDeployer',\n});\n```\n\n### Creating a Pool Instance\n\n```typescript\nimport { Pool, INITIAL_POOL_FEE, DEFAULT_TICK_SPACING } from '@hydrex/sdk';\n\nconst pool = new Pool(\n  USDC,\n  WETH,\n  INITIAL_POOL_FEE, // pool fee tier\n  sqrtRatioX96,     // current sqrt price\n  liquidity,        // current in-range liquidity\n  tickCurrent,      // current tick\n  ticks             // tick data provider or array\n);\n```\n\n### Swapping\n\nBuild calldata for an exact-input swap:\n\n```typescript\nimport { Trade, Route, SwapRouter, TradeType, Percent, CurrencyAmount } from '@hydrex/sdk';\n\nconst route = new Route([pool], USDC, WETH);\n\nconst trade = Trade.createUncheckedTrade({\n  route,\n  inputAmount: CurrencyAmount.fromRawAmount(USDC, '1000000'), // 1 USDC\n  outputAmount: CurrencyAmount.fromRawAmount(WETH, estimatedOutput),\n  tradeType: TradeType.EXACT_INPUT,\n});\n\nconst { calldata, value } = SwapRouter.swapCallParameters(trade, {\n  slippageTolerance: new Percent(50, 10_000), // 0.5%\n  recipient: '0xYourWallet',\n  deadline: Math.floor(Date.now() / 1000) + 60 * 20,\n  feeOnTransfer: false,\n});\n\n// Send transaction to the swap router contract\n```\n\n### Managing Liquidity\n\n#### Minting a new position\n\n```typescript\nimport { Position, NonfungiblePositionManager, Percent, DEFAULT_TICK_SPACING } from '@hydrex/sdk';\n\nconst position = Position.fromAmounts({\n  pool,\n  tickLower: nearestUsableTick(tickCurrent - DEFAULT_TICK_SPACING * 10, DEFAULT_TICK_SPACING),\n  tickUpper: nearestUsableTick(tickCurrent + DEFAULT_TICK_SPACING * 10, DEFAULT_TICK_SPACING),\n  amount0: '1000000',\n  amount1: '500000000000000000',\n  useFullPrecision: true,\n});\n\nconst { calldata, value } = NonfungiblePositionManager.addCallParameters(position, {\n  slippageTolerance: new Percent(50, 10_000),\n  recipient: '0xYourWallet',\n  deadline: Math.floor(Date.now() / 1000) + 60 * 20,\n});\n```\n\n#### Collecting fees\n\n```typescript\nconst { calldata, value } = NonfungiblePositionManager.collectCallParameters({\n  tokenId: '42',\n  recipient: '0xYourWallet',\n  expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(USDC, '0'),\n  expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(WETH, '0'),\n});\n```\n\n#### Removing liquidity\n\n```typescript\nconst { calldata, value } = NonfungiblePositionManager.removeCallParameters(position, {\n  tokenId: '42',\n  liquidityPercentage: new Percent(100, 100), // 100% removal\n  slippageTolerance: new Percent(50, 10_000),\n  deadline: Math.floor(Date.now() / 1000) + 60 * 20,\n  collectOptions: {\n    expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(USDC, '0'),\n    expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(WETH, '0'),\n    recipient: '0xYourWallet',\n  },\n});\n```\n\n### Boosted Tokens (ERC4626 Vaults)\n\nHydrex supports ERC4626 vault-wrapped tokens as first-class entities for routing:\n\n```typescript\nimport { BoostedToken, BoostedRoute } from '@hydrex/sdk';\n\nconst mwETH = new BoostedToken(\n  ChainId.Base,\n  '0xYourVaultAddress',\n  18,\n  'mwETH',\n  'Morpho Wrapped ETH',\n  WETH // underlying token\n);\n\n// A BoostedRoute automatically handles the wrap/unwrap steps\nconst boostedRoute = new BoostedRoute([pool], USDC, mwETH);\n```\n\n## ABIs\n\nThe package exports the contract ABIs for direct use with ethers.js or viem:\n\n```typescript\nimport { hydrexSwapRouterABI, hydrexPositionManagerABI, selfPermitABI } from '@hydrex/sdk';\n```\n\n## Constants\n\n```typescript\nimport {\n  ChainId,\n  POOL_DEPLOYER_ADDRESSES,\n  POOL_INIT_CODE_HASH,\n  WNATIVE,\n  ADDRESS_ZERO,\n  INITIAL_POOL_FEE,\n  DEFAULT_TICK_SPACING,\n} from '@hydrex/sdk';\n\n// Base mainnet WETH (0x4200000000000000000000000000000000000006)\nconst weth = WNATIVE[ChainId.Base];\n\n// Hydrex Base mainnet deployment\nconst deployer = POOL_DEPLOYER_ADDRESSES[ChainId.Base];\n// => 0x1595A5D101d69D2a2bAB2976839cC8eeEb13Ab94\n\nconst initCodeHash = POOL_INIT_CODE_HASH[ChainId.Base];\n// => 0xa18736c3ee97fe3c96c9428c0cc2a9116facec18e84f95f9da30543f8238a782\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install      # or: yarn\n\n# Build\nnpm run build    # or: yarn build\n\n# Watch mode\nnpm start        # or: yarn start\n\n# Lint\nnpm run lint     # or: yarn lint\n```\n\n## License\n\nMIT © Hydrex\n","readmeFilename":"README.md"}