Repository navigation
Add CoinCode enum - #48
Merged
Merged
Conversation
…testnets with their decimals; coin() takes a CoinCode or any string.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 151 161 +10
===========================================
Files 15 16 +1
Lines 354 370 +16
===========================================
+ Hits 354 370 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Adds
CoinCode, a backed enum of BitGo's codes for the major coins and their testnets.BitGo::coin()now takes aCoinCodeor any string.What's in it
GET /api/v1/all/publicAssets), production and test, checked 2026-10-30. That turned up two things:tbtc(testnet3) andtbtc4(testnet4). BitGo's docs now usetbtc4as the Bitcoin testnet, so both are in.hteth(now Hoodi) andsepeth(Sepolia). There's noteth.decimals()returns each code's decimals, forAmount. They're set per code, not per chain: Polkadot has 10 and its testnet 12. Thematchhas no default arm, so PHPStan fails (match.unhandled) if a case is added without its decimals. I checked that it does.'ttao', so a new BitGo coin never needs an SDK release. Tokens are left out on purpose: they're the part of 2.x'sCurrencyCodethat went stale (B16).Tests
5 new tests, 182 in all.
composer checkpasses, and line coverage is 100%.decimals()works withAmount, including Polkadot's testnet at 12.For review
decimals()goes beyond the roadmap line. It's the coin table that 3.0: Amount value object for exact amounts #47 left out, and since it comes from BitGo's own list, the risk of a wrong entry is low. It's easy to drop if you'd rather keep decimals out of the enum.