Skip to content

Conversation

@jshiohaha
Copy link
Contributor

@jshiohaha jshiohaha commented Nov 23, 2025

Description

Expose the ability to create native mints for both SPL token programs to node-litesvm

Motivation

Consumers of node-litesvm have to create native mints on their own. It would be convenient to expose a function to allow for this within the core library.

If accepted, this change makes it as easy as 🔽 (as long as the expected token programs are loaded)

const svm = new LiteSVM()
    .withDefaultPrograms()
    .withNativeMints();

Note: I left the token-2022 feature flag alone since that will dictate what SPL token program is used in the rust token crate

Alternatives considered

Leave the token crate alone, and copy the existing create_native_mint function into node-litesvm. In many ways, I think this is a simpler approach because it (1) leaves token crate untouched, (2) avoids staking token crate as a dependency, (3) easily exposes create native mint functions for both token programs. I think the main downside is that we'd copy some code from the token crate.

Testing

I added a new test token.test.ts to verify the native mint accounts are created as expected

@Aursen Aursen requested a review from kevinheavey November 23, 2025 07:47
@jshiohaha jshiohaha force-pushed the expose-create-native-mint branch 2 times, most recently from b337aaf to 6d16ea3 Compare December 24, 2025 17:16
@jshiohaha
Copy link
Contributor Author

jshiohaha commented Dec 26, 2025

ok @kevinheavey i updated the PR with a different approach that results in fewer changes overall. specifically, i no longer touch or pull in token-litesvm, which reduces the change surface area. let me know what you think - would be great to either merge or close these proposed changes 🙂

i ran into some issues (example) with the stable - xxx-apple-darwin and stable - xxx-unknown-linux-musl builds and made some changes in .github/workflows/node-build.yml, but maybe you know a better way to handle

@Aursen Aursen force-pushed the expose-create-native-mint branch from a664c9e to a795b0a Compare January 4, 2026 15:19
@Aursen Aursen removed the request for review from kevinheavey January 4, 2026 15:30
@Aursen Aursen force-pushed the expose-create-native-mint branch from a795b0a to b2b5339 Compare January 4, 2026 21:59
@Aursen
Copy link
Collaborator

Aursen commented Jan 4, 2026

I'll fix the CI issues in this PR. However, I'm not entirely convinced that exposing create-native-mints directly in the Node.js API is the best long-term design choice

@jshiohaha
Copy link
Contributor Author

My main motivation for the change was that I found it annoying to have to re-add the create native mint logic when I used the JS library in different test suites.

Feel free to close this PR if you don't agree with the implementation though. You definitely have more context.

@Aursen Aursen merged commit 096f8c2 into LiteSVM:master Jan 16, 2026
17 checks passed
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.

2 participants