Skip to content

Commit 42ca371

Browse files
committed
e2e(regtest mint): add cat21-wallet pipeline (iteration 1 — connect proof)
Cat21 Wallet — our own Leather fork — joins the regtest mint suite as a separate workflow + spec next to the existing Xverse path. Iteration 1 ships the picker + connect proof; the full mint round-trip has a known regtest-derivation gap documented in the spec docstring. # What this iteration pins - SDK bumped 09e42fe → e38d794 to pull in the cat21wallet connector, signer, KnownOrdinalWallets entry ("Cat21 Wallet"), and provider- detection contract from SDK commit 59aa430. - `cat21wallet-mint-regtest.spec.ts`: launches Chromium with the cat21-wallet `.crx`, onboards inline from the BIP-39 test seed (sign-in-link → 12 inputs → password → dashboard), navigates to /cat21-mint, clicks "Cat21 Wallet" in the picker, approves the connect popup (testid `get-addresses-approve-button`), and pins that the mint form renders (i.e. the orchestrator's `connectedWallet$` signal resolved). - `e2e-regtest-mint-cat21wallet.yml`: separate workflow on its own cron (03:47 UTC, 30 min after the Xverse run) so the two pipelines iterate cleanly. Mirrors the Xverse workflow minus the SDK globalSetup step (cat21-wallet doesn't use a cloned seed user-data-dir). # What's deferred to iteration 2 Full mint round-trip needs SDK-level regtest-address-derivation plumbing in the consumer flow. Cat21 Wallet returns MAINNET bc1q addresses from `getAddresses` regardless of the dapp's Network.Regtest request; the orchestrator-built bcrt1q PSBT can't sign against those. The SDK's own `cat21wallet-mint-roundtrip.spec.ts` works around this with a `deriveRegtestAddresses` harness — porting that into the consumer mint flow is its own design decision the maintainer should weigh in on. # Per-wallet RBF policy (for the iteration-2 follow-up) Cat21 Wallet IS allowed to signal RBF (`sequence === 0xfffffffd`) because its mempool-acceleration UI guarantees `nLockTime=21` is preserved on any replacement. The existing Xverse spec's `sequence >= 0xfffffffe` assertion must be parameterised when the full mint round-trip lands here.
1 parent e7b08cb commit 42ca371

4 files changed

Lines changed: 1033 additions & 1180 deletions

File tree

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
name: E2E (regtest mint — cat21-wallet)
2+
3+
# Cat21 Wallet variant of the regtest mint suite. Runs as a separate
4+
# workflow so the two wallets can iterate independently and CI signal
5+
# stays cleanly attributed.
6+
#
7+
# Pipeline differs from the Xverse workflow in two material ways:
8+
# - No SDK globalSetup needed. Cat21 Wallet onboards inline in the
9+
# spec's `beforeAll` (BIP-39 mnemonic restore), so we skip the
10+
# "Run SDK's Xverse onboarding" + "Verify seed user-data-dir
11+
# landed" steps.
12+
# - We stage cat21wallet.crx instead of xverse.crx via the SDK
13+
# bootstrap (`playwright-bootstrap.sh cat21wallet`).
14+
#
15+
# The frontend stack-up + serve sequence is identical; the spec runs
16+
# under the same playwright.regtest.config.ts but `--grep`-ed to the
17+
# cat21wallet spec file so it doesn't co-execute with the Xverse spec.
18+
19+
on:
20+
workflow_dispatch:
21+
schedule:
22+
- cron: '47 3 * * *' # nightly at 03:47 UTC (30 min after Xverse run)
23+
push:
24+
paths:
25+
- 'frontend/playwright/specs/regtest/cat21wallet-mint-regtest.spec.ts'
26+
- '.github/workflows/e2e-regtest-mint-cat21wallet.yml'
27+
28+
permissions:
29+
contents: read
30+
31+
concurrency:
32+
group: ordpool-e2e-regtest-mint-cat21wallet-${{ github.ref }}
33+
cancel-in-progress: false
34+
35+
jobs:
36+
regtest-mint-cat21wallet:
37+
name: Bring up stack + cat21-wallet round-trip
38+
runs-on: ubuntu-latest
39+
timeout-minutes: 60
40+
steps:
41+
- name: Checkout ordpool
42+
uses: actions/checkout@v4
43+
44+
- name: Setup Node
45+
uses: actions/setup-node@v6
46+
with:
47+
node-version: 24
48+
cache: 'npm'
49+
cache-dependency-path: 'frontend/package-lock.json'
50+
51+
- name: Install frontend npm deps (brings ordpool-sdk into node_modules)
52+
run: npm ci
53+
working-directory: frontend
54+
55+
- name: Make SDK consumer-environment scripts executable
56+
run: chmod +x node_modules/ordpool-sdk/e2e/consumer-environment-bootstrap.sh
57+
working-directory: frontend
58+
59+
- name: Bring up consumer-environment (bitcoind + electrs + mariadb)
60+
run: |
61+
frontend/node_modules/ordpool-sdk/e2e/consumer-environment-bootstrap.sh \
62+
> stack.json
63+
cat stack.json
64+
65+
- name: Start fees + electrs HTTP+WS shim on :8999
66+
run: |
67+
cd frontend
68+
ELECTRS_URL=http://localhost:3000 PORT=8999 WS_ENABLED=1 \
69+
nohup node ../e2e/fees-electrs-stub.mjs > ../fees-stub.log 2>&1 &
70+
echo $! > ../fees-stub.pid
71+
cd ..
72+
for i in $(seq 1 30); do
73+
if curl -fsS http://localhost:8999/healthz >/dev/null 2>&1; then
74+
echo "fees-stub up"; break
75+
fi
76+
if [ "$i" = "30" ]; then
77+
echo "fees-stub never came up"; cat fees-stub.log || true; exit 1
78+
fi
79+
sleep 1
80+
done
81+
82+
- name: Smoke-test stub endpoints
83+
run: |
84+
echo "--- fees/recommended"
85+
curl -fsS http://localhost:8999/api/v1/fees/recommended
86+
echo
87+
echo "--- blocks/tip/height (electrs)"
88+
curl -fsS http://localhost:8999/api/blocks/tip/height
89+
echo
90+
91+
- name: Checkout ordpool-sdk (for the cat21-wallet extension + bootstrap script)
92+
uses: actions/checkout@v4
93+
with:
94+
repository: ordpool-space/ordpool-sdk
95+
path: sdk
96+
ref: main
97+
98+
- name: Setup Node (sdk)
99+
uses: actions/setup-node@v4
100+
with:
101+
node-version: '24.13.0'
102+
cache: 'npm'
103+
cache-dependency-path: 'sdk/package-lock.json'
104+
105+
- name: Install SDK deps + build
106+
working-directory: sdk
107+
run: |
108+
npm ci
109+
npm run build
110+
111+
- name: Install Playwright system deps + Chromium
112+
working-directory: sdk
113+
run: npx playwright install --with-deps chromium
114+
115+
- name: Cache unpacked Cat21 Wallet extension
116+
id: cat21wallet-cache
117+
uses: actions/cache@v4
118+
with:
119+
path: sdk/e2e/extensions/cat21wallet
120+
key: cat21wallet-extension-v6.103.0.675
121+
122+
- name: Download + unpack Cat21 Wallet from SDK release mirror
123+
if: steps.cat21wallet-cache.outputs.cache-hit != 'true'
124+
env:
125+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
working-directory: sdk
127+
run: bash e2e/playwright/playwright-bootstrap.sh cat21wallet
128+
129+
- name: Bootstrap regtest funds (101 blocks, dump WIF)
130+
working-directory: sdk
131+
run: |
132+
chmod +x e2e/regtest-bootstrap.sh
133+
./e2e/regtest-bootstrap.sh > regtest-bootstrap.json
134+
cat regtest-bootstrap.json
135+
136+
- name: Generate frontend config (Ordpool defaults)
137+
working-directory: frontend
138+
run: npm run config:defaults:ordpool
139+
140+
- name: Patch environment.ts to localhost absolute URLs
141+
working-directory: frontend
142+
run: |
143+
sed -i \
144+
-e "s|apiBaseUrl: ''|apiBaseUrl: 'http://localhost:8999'|" \
145+
-e "s|websocketBaseUrl: ''|websocketBaseUrl: 'ws://localhost:8999'|" \
146+
-e "s|cat21BaseUrl: 'http://localhost:3333'|cat21BaseUrl: 'http://localhost:8999'|" \
147+
src/environments/environment.ts
148+
149+
- name: Patch bitcoinNetwork to Regtest
150+
working-directory: frontend
151+
run: |
152+
sed -i \
153+
-e 's|useValue: Network\.Mainnet|useValue: Network.Regtest|' \
154+
src/app/app.module.ts
155+
grep -n bitcoinNetwork src/app/app.module.ts | head -2
156+
157+
- name: Build static frontend bundle
158+
working-directory: frontend
159+
run: |
160+
set -o pipefail
161+
npm run ng -- build --output-path ../dist-regtest 2>&1 | tee ../build.log
162+
163+
- name: Locate the built browser output
164+
run: |
165+
for candidate in \
166+
dist-regtest \
167+
dist-regtest/browser \
168+
$(find dist-regtest -maxdepth 3 -type d -name browser); do
169+
if [ -f "$candidate/index.html" ]; then
170+
BROWSER_DIR="$candidate"
171+
break
172+
fi
173+
done
174+
if [ -z "${BROWSER_DIR:-}" ]; then
175+
echo "could not find any index.html under dist-regtest"
176+
ls -la dist-regtest || true
177+
tail -200 build.log || true
178+
exit 1
179+
fi
180+
echo "BROWSER_DIR=$BROWSER_DIR" >> "$GITHUB_ENV"
181+
182+
- name: Serve the static bundle on :4200
183+
run: |
184+
nohup npx -y serve@14 -s "$BROWSER_DIR" -l 4200 --no-clipboard > serve.log 2>&1 &
185+
echo $! > serve.pid
186+
187+
- name: Wait for static server ready on :4200
188+
run: |
189+
for i in $(seq 1 30); do
190+
code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:4200/ 2>/dev/null || echo 000)
191+
if [ "$code" = "200" ]; then
192+
echo "static server up"; break
193+
fi
194+
if [ "$i" = "30" ]; then
195+
echo "static server never came up (last HTTP $code)"; tail -200 serve.log || true; exit 1
196+
fi
197+
sleep 1
198+
done
199+
200+
- name: Install Playwright in the frontend tree
201+
working-directory: frontend
202+
run: npx playwright install --with-deps chromium
203+
204+
- name: Lift SDK e2e helpers out of node_modules (Node 24 strip-types refuses .ts there)
205+
working-directory: frontend
206+
run: |
207+
mkdir -p playwright/specs/regtest/sdk-lib
208+
cp node_modules/ordpool-sdk/e2e/regtest/regtest-helpers.ts playwright/specs/regtest/sdk-lib/
209+
cp node_modules/ordpool-sdk/e2e/playwright/approval-popup.ts playwright/specs/regtest/sdk-lib/
210+
ls -la playwright/specs/regtest/sdk-lib/
211+
212+
- name: Run the cat21-wallet regtest spec
213+
working-directory: frontend
214+
env:
215+
CAT21WALLET_EXT_PATH: ${{ github.workspace }}/sdk/e2e/extensions/cat21wallet
216+
FRONTEND_URL: http://localhost:4200
217+
run: |
218+
xvfb-run --auto-servernum --server-args='-screen 0 1280x900x24' \
219+
npx playwright test playwright/specs/regtest/cat21wallet-mint-regtest.spec.ts \
220+
--config=playwright.regtest.config.ts
221+
222+
- name: Upload Playwright artifacts
223+
if: always()
224+
uses: actions/upload-artifact@v4
225+
with:
226+
name: regtest-mint-cat21wallet-playwright-${{ github.run_id }}
227+
path: |
228+
frontend/test-results
229+
frontend/playwright-report-regtest
230+
build.log
231+
serve.log
232+
fees-stub.log
233+
retention-days: 14
234+
if-no-files-found: warn
235+
236+
- name: Dump container logs on failure
237+
if: failure()
238+
run: |
239+
for c in ordpool-e2e-consumer-bitcoind ordpool-e2e-consumer-electrs ordpool-e2e-consumer-mariadb; do
240+
echo "=== $c ==="
241+
docker logs "$c" 2>&1 | tail -200 || true
242+
done
243+
244+
- name: Tear down stack
245+
if: always()
246+
run: |
247+
docker compose \
248+
-f frontend/node_modules/ordpool-sdk/e2e/docker-compose.consumer-environment.yml \
249+
down -v || true
250+
if [ -f fees-stub.pid ]; then
251+
kill "$(cat fees-stub.pid)" 2>/dev/null || true
252+
fi
253+
if [ -f serve.pid ]; then
254+
kill "$(cat serve.pid)" 2>/dev/null || true
255+
fi

0 commit comments

Comments
 (0)