Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskares authored Jun 13, 2024
1 parent 4b554ca commit 564dd16
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Wallet Mock
Fully functional E2E tests for your dApp. Installs a fully operational Mock Wallet into the [Playwright](https://github.com/microsoft/playwright) Browser Context, making it discoverable through [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963) and leveraging [viem](https://github.com/wevm/viem) `Account` and `Transport` interfaces.

## Quickstart
```ts
import { installMockWallet } from "@johanneskares/mock-wallet";
import { privateKeyToAccount } from "viem/accounts";
import { http } from "viem";

test.beforeEach(async ({ page }) => {
await installMockWallet({
page,
account: privateKeyToAccount(
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
),
transport: http(),
});
});

test("Your Test", async ({ page }) => {
...
});
```

Please note! This will execute actual transactions on the blockchain using the Private Key. You can use a [Custom Transport](https://viem.sh/docs/clients/transports/custom.html) to intercept the behavior.

0 comments on commit 564dd16

Please sign in to comment.