Skip to content

jito-ts dependency conflict in @solana-agent-kit/plugin-defi plugin #466

@soupy0x

Description

@soupy0x

Describe the bug
The @solana-agent-kit/plugin-defi package fails to load due to a dependency conflict with rpc-websockets.

The plugin's dependency chain includes jito-ts which bundles an outdated version of @solana/web3.js (v1.77.4) that expects an old file structure from rpc-websockets that no longer exists in modern versions.

To Reproduce

  1. Create a new project with npm init
  2. Install the required packages: npm install solana-agent-kit @solana-agent-kit/adapter-mcp @solana-agent-kit/plugin-token @solana-agent-kit/plugin-defi
  3. Create an index.js file that imports the DefiPlugin:
  import { SolanaAgentKit } from "solana-agent-kit";
  import DefiPlugin from "@solana-agent-kit/plugin-defi";

  const agent = new SolanaAgentKit(wallet, rpcUrl, options)
    .use(DefiPlugin);
  1. Run node index.js
  2. See error: Error: Cannot find module 'rpc-websockets/dist/lib/client'

Expected behavior
The DefiPlugin should load successfully without module resolution errors.

Additional context
Error stack trace:

  Error: Cannot find module 'rpc-websockets/dist/lib/client'
  Require stack:
  - node_modules/jito-ts/node_modules/@solana/web3.js/lib/index.cjs.js
  - node_modules/jito-ts/dist/sdk/block-engine/types.js
  - node_modules/@pythnetwork/solana-utils/lib/jito.js
  - node_modules/@drift-labs/sdk/lib/node/oracles/pythPullClient.js

The issue stems from [email protected] bundling @solana/[email protected] internally
This old web3.js version expects rpc-websockets/dist/lib/client.js but modern rpc-websockets (v7.11+) uses .cjs extensions
The dependency chain: @solana-agent-kit/plugin-defi → @drift-labs/sdk → @pythnetwork/pyth-solana-receiver → @pythnetwork/solana-utils → jito-ts → old @solana/web3.js

Workaround: manually copy .cjs files to .js in node_modules/rpc-websockets/dist/lib/
Suggested fix: Update the dependency chain to use compatible versions or add a compatibility layer

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions