fix(coinpay): map OAuth wallet cryptocurrency chains - #311
Conversation
Greptile SummaryThis PR fixes OAuth wallet payload mapping in
Confidence Score: 5/5Safe to merge — the change is a one-line addition to an existing fallback chain with no impact on the existing symbol-resolution priority order. The fix is narrow: a single new optional interface field and one extra No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["coinToPaymentCurrency(coin)"] --> B["Try directCurrency\ncoin.currency / coin.id / coin.code\nnormalizeCurrencyKey → lowercase"]
B --> C{isSupportedCurrency?}
C -- Yes --> D["return SupportedCurrency"]
C -- No --> E["Derive symbol\ncoin.symbol → coin.code → coin.currency\n→ coin.cryptocurrency ← NEW\n→ coin.id\nnormalizeCoinSymbol → UPPERCASE"]
E --> F["Derive chain\ncoin.chain → coin.network → coin.blockchain"]
F --> G{symbol?}
G -- "BTC/BCH/ETH/POL/SOL" --> H["return simple key"]
G -- "USDT" --> I{chain?}
I -- "POL/POLYGON/MATIC" --> J["usdt_pol"]
I -- "SOL/SOLANA" --> K["usdt_sol"]
I -- "ETH/ETHEREUM" --> L["usdt_eth"]
I -- other --> M["usdt"]
G -- "USDC" --> N{chain?}
N -- "POL/POLYGON/MATIC" --> O["usdc_pol"]
N -- "ETH/ETHEREUM" --> P["usdc_eth"]
N -- other --> Q["usdc_sol"]
G -- no match --> R["return null"]
Reviews (1): Last reviewed commit: "test(coinpay): cover oauth cryptocurrenc..." | Re-trigger Greptile |
|
@Jorel97 plesae resolve conflicts |
Fixes #301.
CoinPay OAuth
/api/oauth/userinfowallet payloads can identify a wallet withcryptocurrencypluschainfields, for example{ cryptocurrency: "USDC", chain: "POL" }.coinToPaymentCurrencyalready understoodchain, but did not considercryptocurrencyas the coin symbol source, so those wallets could fail to map tousdc_pol,usdt_eth, etc.Changes:
cryptocurrencyto theSupportedCoinshapecoin.cryptocurrencywhen deriving the normalized symbolUSDC/POL,USDT/ETH, andSOL/SOLVerification: local dependency checkout is not available here, so I did a targeted static inspection rather than running the full Vitest suite.