Skip to content

Conversation

@jshiohaha
Copy link
Contributor

Description

Remove tx-sender from rust-sdk and ts-sdk in favor of a dedicated repository: orca-so/tx-sender#1

Testing

yarn clean && yarn && yarn build && yarn format && yarn lint && yarn test

Comment on lines +84 to +93
{
href: "https://orca-so.github.io/tx-sender/rust/orca_tx_sender",
label: "Rust TX Sender",
target: "_blank",
},
{
href: "https://orca-so.github.io/tx-sender/ts",
label: "TS TX Sender",
target: "_blank",
},
Copy link
Contributor Author

@jshiohaha jshiohaha Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these links already work 🙂

site published to gh pages here https://orca-so.github.io/tx-sender

Copy link
Contributor

@calintje calintje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this.

Aside from the inline comment I left, one small docs note that might be worth updating:

In docs/whirlpool/docs/03-SDKs/06-Send Transaction.mdx, the install snippet still shows older versions: orca_tx_sender ^0.1.0 and @orca-so/tx-sender ^1.0.0

},
"dependencies": {
"@orca-so/tx-sender": "*",
"@orca-so/tx-sender": "^3.0.0",
Copy link
Contributor

@calintje calintje Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orca-so/tx-sender imports @solana/rpc at runtime, but @solana/rpc is a peer of tx-sender. If a consumer pulls in @orca-so/whirlpools (which depends on + re-exports tx-sender config setRpc) without explicitly providing the peer chain, package managers that strictly enforce peer deps can fail fast.

I think this was mostly masked in the monorepo by workspace hoisting/shared deps.

Test

Create a fresh directory with a minimal package.json:

{
  "name": "whirlpools-peer-test",
  "private": true,
  "type": "module",
  "packageManager": "yarn@4.6.0",
  "dependencies": {
    "@orca-so/whirlpools": "^6.0.0",
    "@solana/kit": "^5.0.0"
  }
}

Create index.mjs:

import { setRpc } from "@orca-so/whirlpools";

await setRpc("https://api.devnet.solana.com");
console.log("setRpc ok");

Install and run:

yarn install
yarn node index.mjs

You should see an error similar to:

@orca-so/tx-sender tried to access @solana/rpc (a peer dependency) but it isn't provided by its ancestors

In the stack trace I saw, the peer chain was reported as breaking at @orca-so/whirlpools.

After installing @solana/rpc, I hit another peer gap: @solana/rpc-subscriptions-channel-websocket expects ws.

yarn add @solana/rpc@^5.0.0
yarn node index.mjs

Error looked like:

@solana/rpc-subscriptions-channel-websocket tried to access ws (a peer dependency) but it isn't provided by its ancestors

Installing ws made it run:

yarn add ws@^8
yarn node index.mjs

Suggestion

It may be worth making this less “peer-chasey” for consumers by treating the runtime-required pieces as regular dependencies at the layer that imports them, rather than peers that apps must discover:

  • either make ws and @solana/rpc regular dependencies where they are used
  • or, if we keep them as peers, have @orca-so/whirlpools also declare/pass-through those peer requirements so consumers are prompted to install them

It would also help if the Next.js example declared these dependencies explicitly, so they behave like real-world consumers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a great catch — i ran into this same issue when porting over to the new repository. for the purpose of tests, i just added to dev deps, but i think you make a good point that we should improve the general ergonomics.

i saw that @orca-so/whirlpools exposes @solana/kit as a peer dependency (source), so maybe it makes sense to add @solana/rpc there as well?

i'm not sure where we should draw the line though. i see there are other solana packages as normal dependencies. i could see an argument for exposing some of those as peer deps (e.g. token program packages), but i'm not sure what the threshold is for moving from normal deps to peer deps

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m also not sure where the threshold should be. An alternative solution for this issue specifically might be to remove the dependency on @solana/rpc entirely. As far as I can tell, this is the only place it’s currently used:

import { createSolanaRpcApi, createRpc } from "@solana/rpc";
import type { Address, Rpc, SolanaRpcApi } from "@solana/kit";
import { createDefaultRpcTransport, address } from "@solana/kit";
/**
* Creates an RPC client instance for interacting with the SVM blockchains using the provided RPC URL.
*
* @param {string} url - The RPC endpoint URL.
* @returns {Rpc<SolanaRpcApi>} An RPC client configured with the Solana RPC API.
*
* @example
* ```ts
* const rpc = rpcFromUrl("https://api.mainnet-beta.solana.com");
* const slot = await rpc.getSlot().send();
* console.log(slot);
* ```
*/
export function rpcFromUrl(url: string): Rpc<SolanaRpcApi> {
const api = createSolanaRpcApi({
defaultCommitment: "confirmed",
});
const transport = createDefaultRpcTransport({ url });
const rpc = createRpc({ api, transport });
return rpc;
}

Maybe inside rpcFromUrl we could use createSolanaRpc from @solana/kit instead? I’m not certain whether there was a reason not to use that originally, so this suggestion may be missing some context.

Copy link
Contributor Author

@jshiohaha jshiohaha Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh, this is a 🐐 idea — it looks like this will work, and ig @solana/kit even has some overflow handling that our previous setup did not. i will make this change in the migrated tx-sender PR

update: commit is here

@jshiohaha
Copy link
Contributor Author

In docs/whirlpool/docs/03-SDKs/06-Send Transaction.mdx, the install snippet still shows older versions: orca_tx_sender ^0.1.0 and @orca-so/tx-sender ^1.0.0

ope, good catch. i will update this! 🎣

@jshiohaha
Copy link
Contributor Author

jshiohaha commented Jan 6, 2026

i also noticed something is a little wonky with the rendering in 1 section. i think it's due to a comment on the same line as the start of a code block:

```rust // Basic RPC configuration

CleanShot 2026-01-06 at 11 28 45@2x

Update: simple change, looks correct now. I will push the commit for this.

CleanShot 2026-01-06 at 11 36 00@2x

Copy link
Contributor

@calintje calintje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants