mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
feat: Pay Anything from Any Wallet (#2450)
* feat: Pay Anything from Any Wallet * feat: Trigger payment flow when address is pasted * chore: Remove unneeded changes * feat Expand address checks and fix scanning bch qrs * fix: Add support for dogecoin * feat: More modifications for Pay from Any Wallet This change: - Adds the pay from any wallet flow to externally signed QR codes - Adds fixes for review comments - Fixes failing tests --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
co-authored by
Omar Hatem
parent
16f058e9e2
commit
13a74133f5
@@ -261,6 +261,24 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
|
||||
return acc;
|
||||
});
|
||||
|
||||
// Scheme to currency mapping for URI scheme
|
||||
static final Map<String, CryptoCurrency> _schemeCurrencyMap = {
|
||||
'bitcoin': btc,
|
||||
'bitcoincash': bch,
|
||||
'polygon': maticpoly,
|
||||
'nano-gpt': nano,
|
||||
'secret': scrt,
|
||||
'stellar': xlm,
|
||||
'avalanche': avaxc,
|
||||
'binance': bnb,
|
||||
'tether': usdt,
|
||||
'usdcoin': usdc,
|
||||
'wrappedbitcoin': wbtc,
|
||||
'wrappedether': weth,
|
||||
'shibainu': shib,
|
||||
'zcash': zec,
|
||||
};
|
||||
|
||||
static CryptoCurrency deserialize({required int raw}) {
|
||||
if (CryptoCurrency._rawCurrencyMap[raw] == null) {
|
||||
final s = 'Unexpected token: $raw for CryptoCurrency deserialize';
|
||||
@@ -271,6 +289,10 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
|
||||
|
||||
// TODO: refactor this
|
||||
static CryptoCurrency fromString(String name, {CryptoCurrency? walletCurrency}) {
|
||||
|
||||
final schemeMatch = _schemeCurrencyMap[name.toLowerCase()];
|
||||
if (schemeMatch != null) return schemeMatch;
|
||||
|
||||
try {
|
||||
return CryptoCurrency.all.firstWhere((element) =>
|
||||
element.title.toLowerCase() == name.toLowerCase() &&
|
||||
|
||||
Reference in New Issue
Block a user