@walletwright/core 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +19 -15
- package/dist/{cache-BaWu5vyM.mjs → cache-ztGj4R8m.mjs} +315 -397
- package/dist/cache-ztGj4R8m.mjs.map +1 -0
- package/dist/chain.d.mts +3 -3
- package/dist/cli.d.mts +4 -4
- package/dist/cli.mjs +52 -39
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +17 -9
- package/dist/index.mjs +226 -75
- package/dist/index.mjs.map +1 -1
- package/dist/mock-standard.d.mts +5 -0
- package/dist/mock-standard.mjs +9 -7
- package/dist/mock-standard.mjs.map +1 -1
- package/dist/mock.d.mts +2 -2
- package/dist/mock.mjs +5 -3
- package/dist/mock.mjs.map +1 -1
- package/dist/{types-BXDYOEaq.d.mts → types-CjNm7Tik.d.mts} +63 -19
- package/package.json +8 -8
- package/dist/cache-BaWu5vyM.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @walletwright/core
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8eeeb62: Make the fixtures work on Playwright's defaults, report every wallet call as a step, and make the public surface promise only what the engine does.
|
|
8
|
+
|
|
9
|
+
**The fixtures pick headless per wallet.** `createWalletFixtures` passed Playwright's `headless` straight through, and Playwright defaults it to `true`, so a MetaMask, Solflare, or Slush suite written from the getting-started guide threw at launch until the config set `headless: false`. The fixtures now launch headless only where the wallet declares support (Phantom, Rabby) and open a real window for the rest, so no `headless` setting is needed. `launchWallet` keeps its strict behaviour and still refuses headless for those wallets by name.
|
|
10
|
+
|
|
11
|
+
**Wallet calls are Playwright steps.** Each call (`wallet.connectToDapp`, `wallet.accounts.add`, …) is reported as a boxed `test.step` under its own name in the report and trace, and a failing call now shows a code frame at the spec line that made it rather than at the engine. The launch shows up as `launch <Wallet>`.
|
|
12
|
+
|
|
13
|
+
**`launchWallet` supports `await using`.** `LaunchedWallet` implements `Symbol.asyncDispose`, so `await using launched = await launchWallet(setup)` closes the browser and removes the throwaway profile on scope exit, even when the code throws.
|
|
14
|
+
|
|
15
|
+
**The CLI reads the setup file the docs show.** `walletwright cache --setup <file>` builds every `WalletSetup` the module exports, named or default, one after another, instead of requiring a default export. `--wallet` narrows it to one wallet's setups. A setup-shaped export that fails validation is reported by name; the list of valid wallets now comes from the registry.
|
|
16
|
+
|
|
17
|
+
**MetaMask's Solana connect no longer flakes.** MetaMask could render the connect page before it had enabled the Solana network, leaving Connect disabled for good, so `connectToDapp()` timed out in roughly one run in three. The request is still pending when that happens, so MetaMask's `approve` now reloads a connect page whose Connect stays disabled, and the page renders again with the network in place.
|
|
18
|
+
|
|
19
|
+
**Breaking:**
|
|
20
|
+
|
|
21
|
+
- `WalletSetup.version` is refused for Phantom, Rabby, Solflare, and Slush. They run their Chrome Web Store build, which cannot be pinned; `version` was silently ignored for the download while still forking the profile cache.
|
|
22
|
+
- `wallet.network.switch` is removed. No wallet implemented it, so it could only throw; switching is dapp-initiated through `wallet_addEthereumChain` and `wallet.approve()`.
|
|
23
|
+
- `WalletDefinition` replaces `prepareExtension`, `reachUnlockScreen`, and `unlock` with declarative `source` and `unlockScreen` fields, and `WalletActionContext` gains `unlock()`. This only affects code that reads the definitions in `wallets`; a setup can only name a built-in wallet.
|
|
24
|
+
|
|
25
|
+
`walletKinds` and the `NetworkConfig` type are now exported.
|
|
26
|
+
|
|
3
27
|
## 0.4.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -39,7 +39,8 @@ export const metamask: WalletSetup = {
|
|
|
39
39
|
## 2. Build the cache (once)
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
walletwright cache --setup ./wallet-setup.ts
|
|
42
|
+
walletwright cache --setup ./wallet-setup.ts # every WalletSetup it exports
|
|
43
|
+
walletwright cache --setup ./wallet-setup.ts --wallet metamask # just one
|
|
43
44
|
# or: walletwright cache --wallet metamask --seed "YOUR_SEED_HERE" --password "YOUR_PASSWORD_HERE"
|
|
44
45
|
```
|
|
45
46
|
|
|
@@ -75,12 +76,15 @@ test("connect and sign", async ({ page, wallet }) => {
|
|
|
75
76
|
|
|
76
77
|
The `wallet` fixture:
|
|
77
78
|
|
|
78
|
-
| Method | Description
|
|
79
|
-
| ----------------------- |
|
|
80
|
-
| `connectToDapp()` | Approve a pending connection popup.
|
|
81
|
-
| `confirmSignature()` | Approve a pending signature popup.
|
|
82
|
-
| `approve({ optional })` | Approve any pending popup, whether connect, sign, or a transaction.
|
|
83
|
-
| `extensionId` | The loaded extension id.
|
|
79
|
+
| Method | Description |
|
|
80
|
+
| ----------------------- | ------------------------------------------------------------------------------------------ |
|
|
81
|
+
| `connectToDapp()` | Approve a pending connection popup. Pass `{ optional: true }` for an already-trusted site. |
|
|
82
|
+
| `confirmSignature()` | Approve a pending signature popup. |
|
|
83
|
+
| `approve({ optional })` | Approve any pending popup, whether connect, sign, or a transaction. |
|
|
84
|
+
| `extensionId` | The loaded extension id. |
|
|
85
|
+
|
|
86
|
+
Each call shows up as its own step in the Playwright report and trace (`wallet.confirmSignature`),
|
|
87
|
+
and a failing call points at the line in your spec that made it.
|
|
84
88
|
|
|
85
89
|
The same two calls drive every chain. A Phantom test can connect and sign on
|
|
86
90
|
`window.phantom.ethereum` and then on `window.phantom.solana`; a Slush test does the same on Sui. See
|
|
@@ -91,19 +95,19 @@ The same two calls drive every chain. A Phantom test can connect and sign on
|
|
|
91
95
|
```ts
|
|
92
96
|
import { launchWallet } from "@walletwright/core";
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
const page = await context.newPage();
|
|
96
|
-
// drive the page and the
|
|
97
|
-
await close();
|
|
98
|
+
await using launched = await launchWallet(metamask);
|
|
99
|
+
const page = await launched.context.newPage();
|
|
100
|
+
// drive the page and launched.wallet here; the browser closes when the scope exits
|
|
98
101
|
```
|
|
99
102
|
|
|
100
103
|
## Requirements and notes
|
|
101
104
|
|
|
102
|
-
- **Headless works for Phantom and Rabby**, whose approval windows surface as pages that way.
|
|
103
|
-
|
|
104
|
-
virtual display: `xvfb-run --auto-servernum pnpm exec playwright test`.
|
|
105
|
+
- **Headless works for Phantom and Rabby**, whose approval windows surface as pages that way. The
|
|
106
|
+
fixtures open a real window for MetaMask, Solflare and Slush whatever `headless` says, so give CI
|
|
107
|
+
a virtual display: `xvfb-run --auto-servernum pnpm exec playwright test`.
|
|
105
108
|
- MetaMask is pinned to a known-good version (override it with `WalletSetup.version`). Phantom,
|
|
106
|
-
Rabby, Solflare, and Slush
|
|
109
|
+
Rabby, Solflare, and Slush use the Web Store build current at their first download, which cannot
|
|
110
|
+
be pinned, so they refuse a `version`.
|
|
107
111
|
- The cache lives in `.walletwright/` (override it with `WalletSetup.cacheDir`). Add that directory to
|
|
108
112
|
`.gitignore`.
|
|
109
113
|
|