Skip to content

Commit df7a53c

Browse files
committed
Revert "Merge pull request #31 from LiteSVM/port-to-litesvm"
This reverts commit 3acd038, reversing changes made to a2f0ba0.
1 parent 3acd038 commit df7a53c

File tree

7 files changed

+187
-174
lines changed

7 files changed

+187
-174
lines changed

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
# Changelog
22

3-
Unreleased
3+
## [0.5.0] - 2024-10-18
4+
5+
- Re-export `startAnchor` from `solana-bankrun`
6+
- Require `solana/web3.js` >1.92.0 and fix SendTransactionError construction
7+
8+
## [0.4.1] - 2024-09-12
9+
10+
- Restrict solana/web3.js to <1.92 to avoid breaking change they introduced
11+
12+
## [0.4.0] - 2024-06-29
13+
14+
- BREAKING: Update to Anchor v0.30 [(#15)](https://github.com/kevinheavey/anchor-bankrun/pull/15)
15+
16+
## [0.3.0] - 2023-12-02
17+
18+
- Make `@solana/web3.js` a peer dependency [(#5)](https://github.com/kevinheavey/anchor-bankrun/pull/5)
19+
- Correctly handle missing transaction logs [(#10)](https://github.com/kevinheavey/anchor-bankrun/pull/10)
20+
21+
## [0.2.0] - 2023-09-08
22+
23+
- Add better support for Anchor-like errors [(#6)](https://github.com/kevinheavey/anchor-bankrun/pull/6)
24+
- Expose publicKey and add wallet to provider constructor [(#3)](https://github.com/kevinheavey/anchor-bankrun/pull/3)
25+
26+
## [0.1.0] - 2023-08-13
27+
28+
First release 🚀

README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
# anchor-litesvm
1+
# anchor-bankrun
22

3-
`anchor-litesvm` is a small extension to [LiteSVM](https://github.com/LiteSVM/litesvm)
4-
that enables using both Anchor and LiteSVM with minimal code changes. It does this by exporting a `LitesvmProvider` class that can be used as a replacement for `AnchorProvider` during testing.
3+
`anchor-bankrun` is a small but powerful extension to [solana-bankrun](https://github.com/kevinheavey/solana-bankrun)
4+
that enables using both Anchor and Bankrun with only a one-line code change. It does this by exporting a `BankrunProvider` class that can be used as a drop-in replacement for `AnchorProvider` during testing.
55

6-
## Async note
6+
## Anchor version note
77

8-
`litesvm` is synchronous because it is entirely compute-bound. However, `anchor-litesvm` uses async because
9-
it implements interfaces that require async. If you would like to avoid async tests, you can simply
10-
use regular `litesvm` without `anchor-litesvm`.
8+
Recent versions of `anchor-bankrun` use the Anchor v0.30 IDL, which is not backwards compatible with older Anchor IDLs.
9+
If you have an older IDL, use `anchor-bankrun` v0.3.0.
1110

1211
## Usage
1312

14-
Here's an example using `LitesvmProvider` to test an Anchor program:
13+
Here's an example using `BankrunProvider` to test an Anchor program:
1514

1615
```typescript
17-
import { fromWorkspace, LiteSVMProvider } from "anchor-litesvm";
16+
import { BankrunProvider, startAnchor } from "anchor-bankrun";
1817
import { Keypair, PublicKey } from "@solana/web3.js";
19-
import { BN, Program, Wallet } from "@coral-xyz/anchor";
18+
import { BN, Program } from "@coral-xyz/anchor";
2019
import { Puppet } from "./anchor-example/puppet";
2120
const IDL = require("./anchor-example/puppet.json");
2221

2322
test("anchor", async () => {
24-
const client = fromWorkspace("tests/anchor-example");
25-
const provider = new LiteSVMProvider(client);
26-
const puppetProgram = new Program<Puppet>(IDL, provider);
23+
const context = await startAnchor("tests/anchor-example", [], []);
24+
25+
const provider = new BankrunProvider(context);
26+
27+
const puppetProgram = new Program<Puppet>(
28+
IDL,
29+
provider,
30+
);
31+
2732
const puppetKeypair = Keypair.generate();
2833
await puppetProgram.methods
2934
.initialize()
@@ -51,5 +56,9 @@ test("anchor", async () => {
5156
## Installation
5257

5358
```
54-
yarn add anchor-litesvm
59+
yarn add anchor-bankrun
5560
```
61+
62+
## Why is this a separate package?
63+
64+
I want to keep the Bankrun dependencies light.

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
{
2-
"name": "anchor-litesvm",
3-
"version": "0.0.1",
2+
"name": "anchor-bankrun",
3+
"version": "0.5.0",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
6-
"files": ["dist/"],
6+
"files": [
7+
"dist/"
8+
],
79
"license": "MIT",
810
"devDependencies": {
911
"@coral-xyz/anchor": "^0.30.0",
1012
"@solana/web3.js": ">1.92.0",
1113
"@types/bn.js": "^5.1.1",
1214
"@types/bs58": "^4.0.1",
1315
"@types/jest": "^29.5.3",
14-
"@types/node": "^22.10.7",
1516
"@types/node-fetch": "^2.6.4",
1617
"bs58": "^4.0.1",
1718
"jest": "^29.6.1",
18-
"litesvm": "0.0.2",
1919
"rome": "^12.0.0",
20+
"solana-bankrun": ">=0.2.0 <0.5.0",
2021
"ts-jest": "^29.1.1",
2122
"ts-node": "^10.9.1",
2223
"typescript": "^5.0.4"
@@ -27,7 +28,7 @@
2728
"scripts": {
2829
"fmt": "rome format --write src/index.ts tests/ jest.config.ts tsconfig.json package.json",
2930
"lint": "rome check src/index.ts tests/ jest.config.ts tsconfig.json package.json && tsc",
30-
"test": "jest",
31+
"test": "RUST_LOG= jest --runInBand",
3132
"tsc": "tsc",
3233
"bumpPatch": "yarn version --no-git-tag-version --patch",
3334
"bumpMinor": "yarn version --no-git-tag-version --minor",
@@ -37,9 +38,6 @@
3738
"peerDependencies": {
3839
"@coral-xyz/anchor": "^0.30.0",
3940
"@solana/web3.js": ">1.92.0",
40-
"litesvm": "0.0.2"
41-
},
42-
"dependencies": {
43-
"@iarna/toml": "^2.2.5"
41+
"solana-bankrun": ">=0.2.0 <0.5.0"
4442
}
4543
}

0 commit comments

Comments
 (0)