Skip to content

[STACK nxrtmzsz] refactor(abstract-utxo): inline ScriptType2Of3 type definition#8915

Draft
OttoAllmendinger wants to merge 7 commits into
otto/drop-fetchinputsfrom
otto/abstract-utxo-replacements
Draft

[STACK nxrtmzsz] refactor(abstract-utxo): inline ScriptType2Of3 type definition#8915
OttoAllmendinger wants to merge 7 commits into
otto/drop-fetchinputsfrom
otto/abstract-utxo-replacements

Conversation

@OttoAllmendinger
Copy link
Copy Markdown
Contributor

@OttoAllmendinger OttoAllmendinger commented Jun 2, 2026

Summary

Mechanically replaces remaining @bitgo/utxo-lib call sites in modules/abstract-utxo/src/ with @bitgo/wasm-utxo or coinName-based equivalents. Stacks on otto/drop-fetchinputs.

Changes, in order:

  1. remove createTransactionFromHex from AbstractUtxoCoin — last usage was already removed; backupKeyRecovery.ts migrated to wasm Transaction.fromBytes
  2. pass coinName directly to BitGoPsbt.fromBytes — drops utxolib network lookup
  3. replace 3 utxolib network/script helpers with wasm/coinName equivalentsgetMainnet, isValidCoin, isValidScript replaced
  4. migrate isValidAddress off utxolib.addressFormat — now uses wasmAddress.toOutputScriptWithCoin
  5. replace remaining utxolib.bitgo helpers and drop dead branches — removes last bitgo-namespace call sites
  6. remove deprecated network getter and getNetworkFromCoinName — removes the two deprecated helpers and all callers
  7. inline ScriptType2Of3 type definition — drops the utxolib type import; type is now a local literal union

PR group context

Stack: master → abstract-utxo-foundation → drop-fetchinputs → this PR → keychains-drop-utxolib → abstract-utxo-terminal

Test plan

  • yarn tsc --noEmit clean in modules/abstract-utxo
  • yarn lint clean in modules/abstract-utxo
  • All abstract-utxo unit tests pass

🤖 Generated with Claude Code

@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner June 2, 2026 08:23
…tUtxoCoin

The only remaining caller was the deleted fetchInputs and the doge override
that just delegated to super. Remove the method, drop the doge override, and
remove the now-unused createTransactionFromHex stubs from verifyTransaction tests.

Refs: T1-3279
BitGoPsbt.fromBytes accepts NetworkName = UtxolibName | CoinName, so the
round-trip through utxolib.getNetworkName is unnecessary. Drop the utxolib
import from decode.ts.

Refs: T1-3279
…h wasm/coinName equivalents

- supportsBlockTarget: compare coinName instead of utxolib network objects
- isSupportedScriptType: use fixedScriptWallet.supportsScriptType from wasm-utxo
- postProcessPrebuild: delete the psbt-lite detection block and the
  allowNonSegwitSigningWithoutPrevTx flag end-to-end (wasm-utxo signing is
  permissive by default and never read the flag)

Refs: T1-3279
…rmat

Replace utxolib.addressFormat.toOutputScriptAndFormat / fromOutputScriptWithFormat
with wasm-utxo's address.toOutputScriptWithCoin / fromOutputScriptWithCoin.
Detect address format by trying each candidate and checking which round-trips
byte-equal.

Refs: T1-3279
…branches

- isChainCode / scriptTypeForChain -> ChainCode.is / ChainCode.scriptType (wasm-utxo)
- hasKeyPathSpendInput: drop unreachable utxolib.bitgo.UtxoPsbt branch and
  isTransactionWithKeyPathSpendInput call (DecodedTransaction is now BitGoPsbt only)
- validAddressTypes: inline the 2-of-3 list instead of utxolib.outputScripts.scriptTypes2Of3
- Drop unused RootWalletKeys / UtxoNetwork type re-exports and the now-empty
  utxolib bitgo import

Three utxolib references remain in abstractUtxoCoin: the ScriptType2Of3 type
re-export, the deprecated network getter (still used by tests), and the top-level
utxolib import that backs both.

Refs: T1-3279
…orkFromCoinName

Drop the deprecated coin.network getter from AbstractUtxoCoin and the
getNetworkFromCoinName helper from names.ts. Tests that previously called
coin.network now call the test-local getNetworkForCoinName(coin.name) from
util/utxoCoins. With this, names.ts no longer depends on utxolib.

Refs: T1-3279
Replace the utxolib.bitgo.outputScripts.ScriptType2Of3 type re-export with
an inline literal union. The values are identical to the utxolib export
('p2sh' | 'p2shP2wsh' | 'p2wsh' | 'p2tr' | 'p2trMusig2').

This removes the last utxolib type reference and the top-level utxolib import
from abstractUtxoCoin.ts.

Refs: T1-3279
@OttoAllmendinger OttoAllmendinger force-pushed the otto/abstract-utxo-foundation branch from c011adb to f3ecc52 Compare June 2, 2026 08:51
@OttoAllmendinger OttoAllmendinger force-pushed the otto/abstract-utxo-replacements branch from 4b8b110 to d5eb4fa Compare June 2, 2026 08:51
@OttoAllmendinger OttoAllmendinger changed the base branch from otto/abstract-utxo-foundation to otto/drop-fetchinputs June 2, 2026 08:51
@OttoAllmendinger OttoAllmendinger marked this pull request as draft June 2, 2026 08:58
@OttoAllmendinger OttoAllmendinger changed the title refactor(abstract-utxo): replace utxolib helpers with wasm/coinName equivalents [STACK nxrtmzsz] refactor(abstract-utxo): inline ScriptType2Of3 type definition Jun 2, 2026
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.

2 participants