Skip to content

Conversation

@OttoAllmendinger
Copy link
Contributor

Add standalone ScriptType API for fixed-script wallets:

  • Add ScriptType enum (p2sh, p2shP2wsh, p2wsh, p2tr, p2trMusig2)
  • Add supports_script_type method to OutputScriptSupport
  • Expose supportsScriptType via WASM and TypeScript

This enables abstract-utxo to check network support for script types
without depending on utxo-lib.

The taproot chains had internal/external values swapped compared to other
script types. This commit fixes the enum values to be consistent, making
external chains have even values and internal chains have odd values.

This is not a breaking change since the internal/external distinctions were
not surfaced in the public API.

Co-authored-by: llm-git <llm-git@ttll.de>

Issue: BTC-2916
@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2916.impl-supportsScriptType branch 2 times, most recently from 09db15f to b6db2d8 Compare January 9, 2026 13:15
@OttoAllmendinger OttoAllmendinger changed the title feat(wasm-utxo): add ScriptType enum and supportsScriptType function feat(wasm-utxo): add OutputScriptType enum and supportsScriptType function Jan 9, 2026
Add `supportsScriptType` function to check if a given network supports
a particular wallet script type (p2sh, p2wsh, p2tr, etc). This provides
a simple API for frontends to determine script compatibility before
attempting to create wallets.

Major improvements:
- Refactored script type handling to use a dedicated OutputScriptType enum
- Separated script type from derivation chain/scope concerns
- Added network compatibility checks for script types
- Exposed JS API with proper TypeScript definitions

Issue: BTC-2916

Co-authored-by: llm-git <llm-git@ttll.de>
@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2916.impl-supportsScriptType branch from b6db2d8 to 2c28d11 Compare January 9, 2026 13:24
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review January 9, 2026 13:34
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner January 9, 2026 13:34
@OttoAllmendinger OttoAllmendinger merged commit 7db5759 into master Jan 9, 2026
1 check passed
@OttoAllmendinger OttoAllmendinger deleted the BTC-2916.impl-supportsScriptType branch January 9, 2026 14:17
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.

3 participants