Skip to content

feat: separate core package, restore web3js support - #387

Open
ChiefWoods wants to merge 8 commits into
LiteSVM:masterfrom
ChiefWoods:refactor/core-web3js-kit
Open

ChiefWoods wants to merge 8 commits into
LiteSVM:masterfrom
ChiefWoods:refactor/core-web3js-kit

Conversation

@ChiefWoods

Copy link
Copy Markdown

web3js and Kit can be optionally imported through split exports, with clear peerDependency requirements (consumers using litesvm-web3js need not install @solana/kit).

With this PR:

  • node-litesvm -> node-litesvm-core(JS package litesvm-core)
  • node-litesvm is now the Kit wrapper (JS package litesvm)
  • new node-litesvm-web3js as web3js wrapper (JS package litesvm-web3js)

@lorisleiva

Copy link
Copy Markdown
Contributor

Damn that was quick haha. I'll try and review this asap but I might be a little while since it's a big one.

@Aursen
Aursen force-pushed the refactor/core-web3js-kit branch from ff352bd to f1c46fa Compare July 29, 2026 10:07
@lorisleiva

Copy link
Copy Markdown
Contributor

Thanks for putting this together 🙏

Note: AI-drafted, but reviewed and discussed with me thoroughly.

The overall direction is spot on. The mechanical extraction looks clean and consistent (the internal.* → index.* rename and the litesvm-* → litesvm-core-* binding names all line up).

A few things I'd like us to sort before merging, then some follow-up notes.

Things to fix in this PR

1. Duplicate lint workflows. We've now got two workflows linting the same things on PRs:

  • node-build.yml → lint job runs yarn workspace litesvm lint, yarn workspace litesvm-web3js lint, cargo fmt --all, and yarn workspace litesvm-core lint (clippy).
  • node-lint.yml → lint job runs core clippy, litesvm lint:js, and litesvm-web3js lint.

So core clippy and both JS lints run twice per PR, across two files, with slightly different invocations. On top of that, the step labelled Clippy core in node-build.yml actually runs yarn workspace litesvm-core lint and sits after the JS steps, which reads like a copy-paste slip. I think that's a genuine bug/typo, right? IMO we should pick one workflow to own linting and strip the overlap out of the other.

2. Redundant Cargo exclude. Excluding crates/node-litesvm from the workspace is correct now that the Kit wrapper is pure TS. But crates/node-litesvm-web3js has no Cargo.toml, so this line is a no-op:

exclude = [
    "crates/node-litesvm",
    "crates/node-litesvm-web3js",  # no Cargo.toml, can drop this
    "crates/node-litesvm/tests/clock-example",
]

Minor, but might as well tidy it.

Versioning

For now I'm happy to keep all three packages pinned to the same version and publish them together, then let them diverge over time as needed. A core bump will always force a wrapper bump anyway (patch/minor/major), so lockstep is a fine starting point. We can revisit per-package release logic once they actually need to move independently.

Follow-up (not blocking this PR)

On the dependency model: right now both wrappers take their SDK as a hard dependency (@solana/kit on litesvm, @solana/web3.js on litesvm-web3js). For an intermediary library the idiomatic approach is either to request the whole SDK as a peerDependency (so the end-user's single version wins) or to depend on the smaller granular packages (e.g. @solana/codecs). This is pre-existing behaviour for the Kit wrapper rather than something this PR introduces, so I don't want to block on it, but let's track it as follow-up work since we're now cementing the pattern across two wrappers.

Lmk what you think, and give me a shout once CI is green and I'll do another pass. 🙂

@ChiefWoods

Copy link
Copy Markdown
Author

2. Redundant Cargo exclude. Excluding crates/node-litesvm from the workspace is correct now that the Kit wrapper is pure TS. But crates/node-litesvm-web3js has no Cargo.toml, so this line is a no-op:

crates/node-litesvm-web3js is included in Cargo.toml because crates is a cargo workspace member.

@Aursen
Aursen force-pushed the refactor/core-web3js-kit branch from 2dbef40 to 2883343 Compare August 1, 2026 04:49
Aursen added a commit to ChiefWoods/litesvm that referenced this pull request Oct 12, 2026
@Aursen
Aursen force-pushed the refactor/core-web3js-kit branch from 5d43799 to c0de53f Compare October 12, 2026 08:48

This branch has not been deployed

No deployments
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