{"_id":"@3rd-eye-labs/dexter-v2","_rev":"6-73b506cd839bea20bd62b539c41af01e","name":"@3rd-eye-labs/dexter-v2","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@3rd-eye-labs/dexter-v2","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@3rd-eye-labs/dexter-v2@1.0.0","maintainers":[{"name":"adacapo21","email":"aggeloskappos@gmail.com"},{"name":"_hummus","email":"zachary.sluder@gmail.com"},{"name":"cbutz-3rdeyelabs","email":"cbutz@blokdev.io"}],"dist":{"shasum":"3a9d71c379aecceaad74a031c954a482b1dc5613","tarball":"https://registry.npmjs.org/@3rd-eye-labs/dexter-v2/-/dexter-v2-1.0.0.tgz","fileCount":6,"integrity":"sha512-iF6hcA+HqZw2PVz/g5gYapTE0KPvZeAUSlHGpQ6Gn3KMsqBGlc3YGOZtCgdV4ZBivtcIw0CuJIC5yBqwgH/LOA==","signatures":[{"sig":"MEYCIQCQ4hX9r38WImcx6wuVV6E5p6aLw0/in503h3DJVw79WQIhALnb0Dl73/Nyg1ezOTgaykekn94Oema3JbWpDE6isGdo","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31124},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"f9fa3645ada78e68d374081aab0d3122dbf34b9e","scripts":{"dev":"pnpm build && pnpm start","lint":"npx eslint .","test":"jest","build":"tsup src/index.ts --minify --format esm,cjs --dts --clean","start":"node dist/index.js","format":"npx prettier --write ."},"_npmUser":{"name":"_hummus","email":"zachary.sluder@gmail.com"},"_npmVersion":"10.2.4","description":"`$ npm install @third-eye-labs/arc`","directories":{},"_nodeVersion":"18.19.1","dependencies":{"@indigo-labs/iris-sdk":"^1.0.5","@lucid-evolution/lucid":"^0.4.29"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","tsup":"^8.3.6","eslint":"^9.32.0","ts-jest":"^29.4.6","ts-node":"^10.9.2","prettier":"^3.6.2","@eslint/js":"^9.32.0","typescript":"^5.9.2","@types/jest":"^30.0.0","@types/node":"^24.3.0","typescript-eslint":"^8.39.0"},"_npmOperationalInternal":{"tmp":"tmp/dexter-v2_1.0.0_1766433552576_0.29940524641987754","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@3rd-eye-labs/dexter-v2","version":"1.0.1","keywords":[],"author":"","license":"ISC","_id":"@3rd-eye-labs/dexter-v2@1.0.1","maintainers":[{"name":"adacapo21","email":"aggeloskappos@gmail.com"},{"name":"_hummus","email":"zachary.sluder@gmail.com"},{"name":"cbutz-3rdeyelabs","email":"cbutz@blokdev.io"}],"dist":{"shasum":"ec679b7396afe58a8abaa137dd4acabaee3de6e5","tarball":"https://registry.npmjs.org/@3rd-eye-labs/dexter-v2/-/dexter-v2-1.0.1.tgz","fileCount":6,"integrity":"sha512-vAKN7QKaJpFA56ohcE89i/A+rk73cSrLp1QV3L5KHlt4PWAKlSa5ASFF8Kv+Nizc4yRKWFpmhcR3UEYmX8Q4gg==","signatures":[{"sig":"MEUCIQDjiLbq6o85KT9gwx5CjHsM+rK3/O82gJUdnYbgYeu+JwIgdEl0v7idc3UCQ9stTNDrNqLHL3xbSihRJNEBlUsDAzg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31160},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"357e8d613d6887f557b2bbc0b990f0c61b89bbe0","scripts":{"dev":"pnpm build && pnpm start","lint":"npx eslint .","test":"jest","build":"tsup src/index.ts --minify --format esm,cjs --dts --clean","start":"node dist/index.js","format":"npx prettier --write ."},"_npmUser":{"name":"_hummus","email":"zachary.sluder@gmail.com"},"_npmVersion":"10.2.4","description":"`$ npm install @3rd-eye-labs/dexter-v2`","directories":{},"_nodeVersion":"18.19.1","dependencies":{"@indigo-labs/iris-sdk":"^1.0.5","@lucid-evolution/lucid":"^0.4.29"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","tsup":"^8.3.6","eslint":"^9.32.0","ts-jest":"^29.4.6","ts-node":"^10.9.2","prettier":"^3.6.2","@eslint/js":"^9.32.0","typescript":"^5.9.2","@types/jest":"^30.0.0","@types/node":"^24.3.0","typescript-eslint":"^8.39.0"},"_npmOperationalInternal":{"tmp":"tmp/dexter-v2_1.0.1_1766433687571_0.09276140764284091","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@3rd-eye-labs/dexter-v2","version":"2.0.0","keywords":[],"author":"","license":"ISC","_id":"@3rd-eye-labs/dexter-v2@2.0.0","maintainers":[{"name":"adacapo21","email":"aggeloskappos@gmail.com"},{"name":"_hummus","email":"zachary.sluder@gmail.com"},{"name":"cbutz-3rdeyelabs","email":"cbutz@blokdev.io"}],"dist":{"shasum":"daca60f27a73ea4b15743d6d3f86c0e6bc40ff92","tarball":"https://registry.npmjs.org/@3rd-eye-labs/dexter-v2/-/dexter-v2-2.0.0.tgz","fileCount":7,"integrity":"sha512-0qmwwlW2Gx6zcMbhP3SLNXK8M4eoJusISZJwKoHdjqshIOAOLRMDDaXqOg7/GaFoPWbfiVUi7MyhdzMVQ1tn6w==","signatures":[{"sig":"MEYCIQD8GxV4ntljY0tyVZYkzvuUKEvHiJqGhQZg6RfqMXwkUQIhAJKgWjikZITg4fL4HRjojWrmL5ZvIZAOpeNJH/P94f/S","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":183426},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"146fd6f869cf2152f1ad8324cd5c520693ed4ad0","scripts":{"dev":"pnpm build && pnpm start","lint":"npx eslint .","test":"jest","build":"tsup src/index.ts --minify --format esm,cjs --dts --clean","start":"node dist/index.js","format":"npx prettier --write ."},"_npmUser":{"name":"_hummus","email":"zachary.sluder@gmail.com"},"_npmVersion":"10.2.4","description":"A composable TypeScript SDK for building and submitting Cardano DEX transactions across multiple DEXs using a clean builder pattern.","directories":{},"_nodeVersion":"18.19.1","dependencies":{"axios":"^1.13.5","@indigo-labs/iris-sdk":"^1.0.5","@lucid-evolution/lucid":"^0.4.29"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","tsup":"^8.3.6","eslint":"^9.32.0","ts-jest":"^29.4.6","ts-node":"^10.9.2","prettier":"^3.6.2","@eslint/js":"^9.32.0","typescript":"^5.9.2","@types/jest":"^30.0.0","@types/node":"^24.3.0","typescript-eslint":"^8.39.0"},"_npmOperationalInternal":{"tmp":"tmp/dexter-v2_2.0.0_1770843721746_0.4029352778425681","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@3rd-eye-labs/dexter-v2","version":"2.0.1","keywords":[],"author":"","license":"MIT","_id":"@3rd-eye-labs/dexter-v2@2.0.1","maintainers":[{"name":"adacapo21","email":"aggeloskappos@gmail.com"},{"name":"_hummus","email":"zachary.sluder@gmail.com"},{"name":"cbutz-3rdeyelabs","email":"cbutz@blokdev.io"}],"dist":{"shasum":"ab0d43681c2d9c8ab6f89b018f938714cedfa4c9","tarball":"https://registry.npmjs.org/@3rd-eye-labs/dexter-v2/-/dexter-v2-2.0.1.tgz","fileCount":7,"integrity":"sha512-ClYm9gSvsOMK/lpkYe1MNLic0gSGfZKSfUdZQAq2+es8Zgpz03pZt+WKnUAC33CxFMgLJxmFmmNsOTgO9OKL2g==","signatures":[{"sig":"MEUCIQCuAmku7WJqiZqP3y8CzbNCzfhFFZjhv/Wx5krb8koEdAIgEJTdaydqbz9YE/cxx2rglyla9saqDadzo6zOGpkQE1U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":210697},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"6258c4d7709d6e05563b2e3f7d738961c527bfde","scripts":{"dev":"pnpm build && pnpm start","lint":"npx eslint .","test":"jest","build":"tsup src/index.ts --minify --format esm,cjs --dts --clean","start":"node dist/index.js","format":"npx prettier --write ."},"_npmUser":{"name":"_hummus","email":"zachary.sluder@gmail.com"},"_npmVersion":"11.4.2","description":"A composable TypeScript SDK for building and submitting Cardano DEX transactions across multiple DEXs using a clean builder pattern.","directories":{},"_nodeVersion":"24.4.1","dependencies":{"axios":"^1.13.5","@indigo-labs/iris-sdk":"^1.0.5","@lucid-evolution/lucid":"^0.4.29"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","tsup":"^8.3.6","eslint":"^9.32.0","ts-jest":"^29.4.6","ts-node":"^10.9.2","prettier":"^3.6.2","@eslint/js":"^9.32.0","typescript":"^5.9.2","@types/jest":"^30.0.0","@types/node":"^24.3.0","typescript-eslint":"^8.39.0"},"_npmOperationalInternal":{"tmp":"tmp/dexter-v2_2.0.1_1772477888447_0.8489635395886688","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-12-22T19:59:12.471Z","modified":"2026-07-30T17:45:19.537Z","1.0.0":"2025-12-22T19:59:12.760Z","1.0.1":"2025-12-22T20:01:27.703Z","2.0.0":"2026-02-11T21:02:01.898Z","2.0.1":"2026-03-02T18:58:08.637Z"},"license":"MIT","keywords":[],"description":"A composable TypeScript SDK for building and submitting Cardano DEX transactions across multiple DEXs using a clean builder pattern.","maintainers":[{"email":"kristian@3rdeyelabs.dev","name":"kribah"},{"email":"aggeloskappos@gmail.com","name":"adacapo21"},{"email":"cbutz@blokdev.io","name":"cbutz-3rdeyelabs"}],"readme":"# Dexter v2\nA composable TypeScript SDK for building and submitting Cardano DEX transactions across multiple DEXs using a clean builder pattern.\n\n## Features\n- **One swap interface** across integrations (Minswap V1/V2, Muesliswap, SundaeSwap V1/V3, WingRiders, etc.)\n- **Builder pattern** for swap configuration\n- **Two-way quoting**\n    - Provide **inAmount** → estimate **outAmount**\n    - Provide **outAmount** → estimate **inAmount**\n- **Transaction lifecycle** with statuses + error details (`Building` → `Signing` → `Submitting` → `Submitted` / `Errored`)\n\n## Installation\n##### NPM\n`$ npm install @3rd-eye-labs/dexter-v2`\n\n##### PNPM\n`$ pnpm install @3rd-eye-labs/dexter-v2`\n\n##### Yarn\n`$ yarn add @3rd-eye-labs/dexter-v2`\n\n## Using\n\n##### Dexter Instance\nDexter supports using CIP-30 wallets, and wallets by seed phrase. Each have their own required config, however here is how you can load a wallet by seed phrase :\n```ts\nconst dexter = await LoadDexter({\n    // Custom Iris instance, ignore if using default\n    irisHost: 'http://localhost:8000',\n    wallet: {\n     \t// Can use Blockfrost, or Kupo + Ogmios\n        connection: {\n            url: 'https://cardano-mainnet.blockfrost.io',\n            projectId: 'project_id',\n        },\n        // Or specify the CIP-30 instance with the property `cip30`\n        seedPhrase: ['word1', 'word2', ...],\n    },\n});\n```\n\n##### Submitting Swaps\nProperties\n- `swapInToken` : Token you are swapping in\n- `swapOutToken` : Token you are swapping to\n- `liquidityPool` : The pool you are swapping from\n- `slippage` : The amount of slippage you are tolerating\n- `swapInAmount` : The amount you are swapping in\n- `swapOutAmount` : The amount of token you are expected to receive\n\n```\n// Pools can be grabbed from Iris, or specified directly\nconst lp = new LiquidityPool(\n    'MinswapV2',\n    'f5808c2c990d86da54bfc97d89cee6efa20cd8461616359478d96b4c9b65707373c4cec488b16151a64d7102dbae16857c500652b5c513650b8d604e',\n    'addr123',\n    'addr1w8p79rpkcdz8x9d6tft0x0dx5mwuzac2sa4gm8cvkw5hcnqst2ctf',\n    'lovelace',\n    new Asset('533bb94a8850ee3ccbe483106489399112b74c905342cb1792a797a0', '494e4459'),\n    1,\n    null,\n    new LiquidityPoolState(\n        281445008120n,\n        354823812631n,\n        1n,\n        0.3,\n        0.3,\n        0n,\n        1,\n        null,\n        new Asset('f5808c2c990d86da54bfc97d89cee6efa20cd8461616359478d96b4c', '9b65707373c4cec488b16151a64d7102dbae16857c500652b5c513650b8d604e'),\n    )\n);\n\n// Configure from IN token & submit\nconst swap = dexter.swap(dexter.minswapV2)\n    .withLiquidityPool(lp)\n    .withSwapInToken('lovelace')\n    .withSwapInAmount(1000000n)\n    .withSlippagePercent(2)\n    .submit();\n\nswap.onError((t) => {\n    console.error(t);\n});\nswap.onSubmitted((t) => {\n    console.log('Submitted!');\n});\n\n// Configure from OUT token & submit\nconst swap = dexter.swap(dexter.minswapV2)\n    .withLiquidityPool(lp)\n    .withSwapOutToken('lovelace')\n    .withSwapOutAmount(1000000n)\n    .withSlippagePercent(2)\n    .submit();\n\nswap.onError((t) => {\n    console.error(t);\n});\nswap.onSubmitted((t) => {\n    console.log('Submitted!');\n});\n```\n\n##### Cancelling a Minswap order\n\nCancelling on-chain orders uses the DEX helper’s `buildCancelSwapOrder` plus the `Wallet`/`Transaction` helpers. For Minswap, you pass in the UTxO(s) that hold your existing order and Dexter builds the right spending redeemer and validator wiring.\n\n```ts\nimport {\n  LoadDexter,\n  MinswapV2,\n} from '@3rd-eye-labs/dexter-v2';\nimport { LiquidityPool } from '@indigo-labs/iris-sdk';\nimport { UTxO } from '@lucid-evolution/lucid';\n\nconst dexter = await LoadDexter({\n  irisHost: 'https://iris.indigoprotocol.io',\n  wallet: {\n    connection: {\n      url: 'https://cardano-mainnet.blockfrost.io',\n      projectId: 'project_id',\n    },\n    seedPhrase: ['word1', 'word2', /* ... */],\n  },\n});\n\nconst minswap: MinswapV2 = dexter.minswapV2;\n\n// 1. Resolve the liquidity pool and the order UTxO you want to cancel\nconst lp: LiquidityPool = /* fetch from Iris or other source */ {} as any;\nconst orderUtxo: UTxO = /* lookup user order UTxO from your indexer */ {} as any;\n\n// 2. Ask the Minswap helper to build cancel payments\nconst payments = minswap.buildCancelSwapOrder({\n  address: dexter.wallet.address,\n  liquidityPool: lp,\n  // in/out fields are unused by cancel, but required by the type\n  inToken: 'lovelace',\n  inAmount: 0n,\n  minReceive: 0n,\n  spendUtxos: [orderUtxo],\n});\n\n// 3. Build, sign, and submit the cancellation transaction\nconst tx = dexter.wallet\n  .createTransaction();\n\nawait tx\n  .payToAddresses(payments)\n  .then(() => tx.sign())\n  .then(() => tx.submit());\n\ntx.onSubmitted((t) => {\n  console.log('Cancel submitted with hash', t.hash);\n});\n```\n\n##### Calling specific DEX helpers\n\nUnder the hood, each DEX (Minswap, Muesliswap, SundaeSwap, WingRiders, Splash, etc.) is exposed as a helper on the `Dexter` instance. These helpers all implement the `SwapBuilder` interface (`estimatedReceive`, `estimatedGive`, `fees`, `priceImpactPercent`, `buildSwapOrder`, `buildCancelSwapOrder`).\n\n```js\nimport {\n    LoadDexter,\n    MinswapV1,\n    MinswapV2,\n    Muesliswap,\n    SundaeSwapV1,\n    SundaeSwapV3,\n    Splash,\n    WingRidersV1,\n    WingRidersV2,\n} from '@3rd-eye-labs/dexter-v2';\nimport { LiquidityPool } from '@indigo-labs/iris-sdk';\n\nconst dexter = await LoadDexter({\n    irisHost: 'https://iris.indigoprotocol.io',\n    // wallet config optional if you only want quotes\n});\n\n// Choose which DEX you want to use\nconst minswapV2: MinswapV2 = dexter.minswapV2;\nconst muesliswap: Muesliswap = dexter.muesliswap;\nconst sundaeV1: SundaeSwapV1 = dexter.sundaeSwapV1;\nconst sundaeV3: SundaeSwapV3 = dexter.sundaeSwapV3;\nconst splash: Splash = dexter.splash;\nconst wingRidersV1: WingRidersV1 = dexter.wingRidersV1;\nconst wingRidersV2: WingRidersV2 = dexter.wingRidersV2;\n\n// Liquidity pool can come from Iris or be constructed manually\nconst lp: LiquidityPool = /* fetch from IrisApiService or build */ {} as any;\n\n// Example: quote how much you receive on Minswap v2 for a given input\nconst minswapOut = minswapV2.estimatedReceive({\n    address: dexter.wallet?.address ?? '',\n    liquidityPool: lp,\n    inToken: 'lovelace',\n    inAmount: 1_000_000n,\n    minReceive: 0n,\n});\n\n// Example: quote how much you need to give on WingRiders v2 for a desired output\nconst wingRidersIn = wingRidersV2.estimatedGive({\n    address: dexter.wallet?.address ?? '',\n    liquidityPool: lp,\n    outToken: 'lovelace',\n    outAmount: 1_000_000n,\n    minReceive: 0n,\n});\n\n// You can also inspect fees and price impact per DEX\nconst fees = minswapV2.fees({\n    address: dexter.wallet?.address ?? '',\n    liquidityPool: lp,\n    minReceive: 0n,\n});\n\nconst priceImpact = muesliswap.priceImpactPercent({\n    address: dexter.wallet?.address ?? '',\n    liquidityPool: lp,\n    inToken: 'lovelace',\n    inAmount: 1_000_000n,\n    minReceive: 0n,\n});\n\n// Example: quote on Splash\nconst splashOut = splash.estimatedReceive({\n    address: dexter.wallet?.address ?? '',\n    liquidityPool: lp,\n    inToken: 'lovelace',\n    inAmount: 1_000_000n,\n    minReceive: 0n,\n});\n```\n\n##### Protocol helpers: Indigo, Liqwid, Bodega\n\nDexter also exposes lightweight protocol clients for Iris-backed services: `indigo`, `liqwid`, and `bodega`. All methods return `Promise<any>` and resolve to `false` if the underlying HTTP call fails.\n\n```js\nimport { LoadDexter } from '@3rd-eye-labs/dexter-v2';\n\nconst dexter = await LoadDexter({\n  irisHost: 'https://iris.indigoprotocol.io',\n});\n\n// Indigo\nconst cdps = await dexter.indigo.cdps(); \nconst stakingPositions = await dexter.indigo.stakingPositions();\n\n// Liqwid\nconst liqwidMarketParams = await dexter.liqwid.marketParameters(); \n\n// Bodega\nconst bodegaMarkets = await dexter.bodega.markets(); \nconst marketHistory = await dexter.bodega.marketHistory('MARKET_ID');\n```\n\n## Transactions\nYou should never have to create DEX transactions yourself. However, the documentation below gives a rundown\non how you can obtain information for your swap transactions, as well as listen for specific events through the Tx lifecycle.\n\n### Getters\n\n<details>\n<summary><code>hash(): string</code> Get the Tx hash if available</summary>\n\n##### Using\n\n```js\nconsole.log(transaction.hash);\n```\n</details>\n\n<details>\n<summary><code>isSigned(): boolean</code> Get whether the Tx has been signed</summary>\n\n##### Using\n\n```js\nconsole.log(transaction.isSigned);\n```\n</details>\n\n<details>\n<summary><code>payments(): PayToAddress[]</code> Get the address payments made for the Tx</summary>\n\n##### Using\n\n```js\nconsole.log(transaction.payments);\n```\n</details>\n\n<details>\n<summary><code>status(): TransactionStatus</code> Get the current status of the transaction</summary>\n\n##### Using\n\n```js\nconsole.log(transaction.status);\n```\n</details>\n\n### Listen for Events\n\n<details>\n<summary><code>onBuilding(TransactionCallback): DexTransaction</code> Tx is in building status</summary>\n\n##### Using\n\n```js\ntransaction.onBuilding(() => {\n    console.log('Tx building');\n});\n```\n</details>\n\n<details>\n<summary><code>onSigning(TransactionCallback): DexTransaction</code> Tx is in signing status</summary>\n\n##### Using\n\n```js\ntransaction.onSigning(() => {\n    console.log('Tx signing');\n});\n```\n</details>\n\n<details>\n<summary><code>onSubmitting(TransactionCallback): DexTransaction</code> Tx is in submitting status</summary>\n\n##### Using\n\n```js\ntransaction.onSubmitting(() => {\n    console.log('Tx submitting to chain');\n});\n```\n</details>\n\n<details>\n<summary><code>onSubmitted(TransactionCallback): DexTransaction</code> Tx has been submitted on-chain</summary>\n\n##### Using\n\n```js\ntransaction.onSubmitted(() => {\n    console.log('Tx submitted');\n});\n```\n</details>\n\n<details>\n<summary><code>onError(TransactionCallback): DexTransaction</code> Error has occurred with the transaction</summary>\n\n##### Using\n\n```js\ntransaction.onError(() => {\n    console.log('Something went wrong');\n});\n```\n</details>\n\n<details>\n<summary><code>onFinally(TransactionCallback): DexTransaction</code> Everything went OK or error has occurred</summary>\n\n##### Using\n\n```js\ntransaction.onFinally(() => {\n    console.log('All complete or has errored');\n});\n```\n</details>\n\n## Wallet\n- `isWalletLoaded` : Whether the wallet has been loaded or not\n- `address` : Usable address for a loaded wallet\n- `publicKeyHash` : The public key hash used for orders\n- `stakingKeyHash` : The staking key hash used for orders\n- `lucid` : Used internally to handle the connection to your wallet config\n- `load()` : Used internally to load your wallet config\n\n## Running Tests\n`$ pnpm run test`\n\n## Development Notes\n- Dexter uses `@indigo-labs/iris-sdk` types like LiquidityPool, LiquidityPoolState, and Token.\n- Wallet integration is abstracted behind IWallet, allowing mock wallets.\n- Transactions are created and executed via Transaction model.","readmeFilename":"README.md"}