Skip to content

Commit 41dfe2c

Browse files
committed
adapt README to litesvm
1 parent e699913 commit 41dfe2c

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

README.md

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

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.
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.
55

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

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.
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`.
1011

1112
## Usage
1213

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

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

2223
test("anchor", async () => {
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-
24+
const client = fromWorkspace("tests/anchor-example");
25+
const provider = new LiteSVMProvider(client);
26+
const puppetProgram = new Program<Puppet>(IDL, provider);
3227
const puppetKeypair = Keypair.generate();
3328
await puppetProgram.methods
3429
.initialize()
@@ -56,9 +51,5 @@ test("anchor", async () => {
5651
## Installation
5752

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

0 commit comments

Comments
 (0)