Skip to content

Conversation

@sol-warrior
Copy link
Contributor

This PR modernizes the cross-program invocation example by introducing a new LiteSVM test suite and an improved Anchor-based test flow. It removes deprecated Bankrun files, updates @solana/web3.js and related dependencies, and adjusts the TypeScript configuration to ES2020/nodenext for improved tooling compatibility.

Changes

Dependencies

  • Updated @solana/web3.js from ^1.95.2 to ^1.98.4
  • Added litesvm (^0.4.0) for lightweight Solana VM testing
  • Removed anchor-bankrun and solana-bankrun dependencies

Test Files

  • Added tests/litesvm.test.ts - LiteSVM-based tests using low-level transaction building with BorshCoder
  • Added tests/test.ts - Refactored Anchor-based tests (replaces cpi.ts)
  • Removed tests/bankrun.test.ts and tests/cpi.ts

TypeScript Configuration

  • Updated to ES2020 (lib, target)
  • Changed module to nodenext for ESM support

Test Coverage

Both test suites cover the same CPI scenarios:

  1. Initialize the lever
  2. Pull the lever (CPI from hand program to lever program)
  3. Pull the lever again (state toggle)

All tests pass:

  • ✅ LiteSVM: CPI - 3 passing
  • ✅ Anchor: CPI - 3 passing

cc: @Perelyn-sama @jacobcreech — would appreciate your feedback at your convenience. Thank you! 🙌🏼

* Implement tests for initializing and interacting with the lever program using LiteSVM.
* Validate state changes and transaction handling for the power account.
* Ensure proper serialization and deserialization of instruction data.
* Change target and module to ES2020 and nodenext respectively.
* Update library to ES2020 for improved compatibility.
…cation testing

* Introduce test.ts with enhanced tests for initializing and interacting with the lever program.
* Include assertions to validate state changes and account information.
* Remove outdated cpi.ts test file.
* Remove outdated bankrun.test.ts file to clean up the project structure.
* Delete anchor-bankrun and solana-bankrun dependencies from package.json and pnpm-lock.yaml.
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.

1 participant