Skip to content

feat(wrw): add PSBT-based recovery with signing workflow and test infrastructure#706

Merged
OttoAllmendinger merged 4 commits into
masterfrom
BTC-0.signWithPsbt
May 21, 2026
Merged

feat(wrw): add PSBT-based recovery with signing workflow and test infrastructure#706
OttoAllmendinger merged 4 commits into
masterfrom
BTC-0.signWithPsbt

Conversation

@OttoAllmendinger
Copy link
Copy Markdown
Contributor

Implements PSBT-based UTXO recovery for the WRW with complete signing workflow, fee calculation, and
comprehensive test coverage.

Changes

  • Add recoverWithPsbt recovery mode for PSBT-based workflows
  • Add signPsbt workflow with recipient address and fee rate inputs
  • Implement automatic output derivation from PSBT inputs and fee calculation using Dimensions API
  • Validate PSBT has zero outputs before signing
  • Add vitest setup with jsdom and @testing-library/react cleanup
  • Add unit tests for App and SignPsbt components
  • Add e2e tests covering web-server form rendering and Electron PSBT signing with real tbtc p2wsh fixtures
  • Add shared e2e/utxo/helpers.ts with launchApp() utility
  • Configure tsconfig.test.json for composite type-checking of tests
  • Update playwright config to enable screenshots on every run
  • Install electron@22.3.25 for ELECTRON_RUN_AS_NODE fix

T1-3271
T1-3272
T1-3273

Replace the form's optional recipientAmount field with a required
recipientAddress + feeRateSatVB. The backend (buildOutput) reads input
values from the PSBT via BitGoPsbt.getInputs(), estimates transaction
vsize using Dimensions.fromPsbt + Dimensions.fromOutput, computes
fee = feeRateSatVB * vsize, and adds a single output for the remainder.
PSBT must have zero outputs on entry — validated before signing.

T1-3271
- Add vitest setup with jsdom, @testing-library/react cleanup
- Add tsconfig.test.json (composite) for type-checking tests and eslint
  project service; use explicit project array in eslint.config.mjs
- Add App.test.tsx: smoke tests for render, bigint-buffer binding errors
- Add SignPsbt.test.tsx: unit tests for form fields and container routing
- Add e2e/sign-psbt.spec.ts: web-server tests covering form rendering,
  coin selector, passphrase conditional, cancel navigation
- Add e2e/utxo/sign-psbt.spec.ts: Electron test that signs a real tbtc
  p2wsh PSBT (inputs-only fixture) and verifies success page
- Add e2e/utxo/helpers.ts: shared launchApp() — Electron launch,
  1440x900 window resize, waitForSelector
- Update e2e/utxo/blockchain-recovery.spec.ts to use launchApp()
- playwright.config.ts: enable screenshot on every run
- eslint.config.mjs: ignore playwright-report/ and test-results/
- Install electron@22.3.25 (required for ELECTRON_RUN_AS_NODE fix)

T1-3273
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review May 8, 2026 10:33
@OttoAllmendinger OttoAllmendinger requested review from a team as code owners May 8, 2026 10:33
Comment thread e2e/sign-psbt.spec.ts
@@ -0,0 +1,139 @@
import { test, expect } from '@playwright/test';

test.describe('Sign PSBT E2E Tests', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file should be owned by btc-team

Comment thread electron/utxo/psbt.ts
'dash', 'tdash', 'zec', 'tzec', 'bch', 'tbch', 'btg', 'tbtg',
] as const;

export type UtxoCoin = (typeof UTXO_COINS)[number];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same. This file should be owned by btc-team

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do so in a follow-up

@borkds
Copy link
Copy Markdown

borkds commented May 21, 2026

@claude please review. be first principles and reason all changes

@OttoAllmendinger OttoAllmendinger merged commit 04686fd into master May 21, 2026
6 checks passed
@OttoAllmendinger OttoAllmendinger deleted the BTC-0.signWithPsbt branch May 21, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants