feat(abstract-utxo): refactor coin name handling and improve type safety#7855
Merged
OttoAllmendinger merged 7 commits intomasterfrom Jan 8, 2026
Merged
feat(abstract-utxo): refactor coin name handling and improve type safety#7855OttoAllmendinger merged 7 commits intomasterfrom
OttoAllmendinger merged 7 commits intomasterfrom
Conversation
Use a type union with template literals to derive testnet coin names from mainnet names. Update validation function to check if name starts with 't' followed by a valid mainnet coin name. This now declares some testnets that may not really exists, but simplifies the code and type definitions significantly. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
Refines and enhances type definitions throughout the abstract-utxo module. Introduces cleaner naming conventions with `getCoinName` replacing the deprecated `getChainFromNetwork` function. Adds proper return type annotations to class methods for better static analysis and IDE support. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
Check that obj.coin is a string before testing if it's a valid UTXO coin name. This prevents potential runtime errors when processing wallet data. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
This change makes coin name an explicit property of each coin class instead of deriving it from the network. Coin classes now declare their name directly with a readonly property, and the network is derived from the name instead. This simplifies the constructor by removing the network parameter and improves the type safety by making the relationship between coin name and network explicit. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
Add explicit array of testnet coin names instead of deriving them with string operations. Add getMainnetCoinName function to map any coin to its mainnet variant, with special handling for Bitcoin testnet variants. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
Replace getFamilyFromNetwork with getMainnetCoinName to directly determine the family name from the coin name without going through the network. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
Replace the deprecated `getFullNameFromNetwork` with the new `getFullNameFromCoinName` function that determines the full coin name directly from the coin name rather than the network object. Issue: BTC-2909 Co-authored-by: llm-git <llm-git@ttll.de>
68fe95a to
c6afa6b
Compare
davidkaplanbitgo
approved these changes
Jan 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors how coin names are handled in the abstract-utxo module,
significantly improving type safety and simplifying the codebase.
Key changes:
This is part of the effort to get rid of utxolib
BTC-2909