From bc6073692a24c631604b210d351565b2ba596f93 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Thu, 29 Feb 2024 12:39:49 -0800 Subject: [PATCH] currency updates --- assets/images/lightning_logo.png | Bin 0 -> 9612 bytes assets/images/lightning_logo.svg | 10 ++++++++++ cw_bitcoin/lib/electrum_wallet_snapshot.dart | 2 +- cw_core/lib/amount_converter.dart | 12 ++++++++++++ cw_core/lib/crypto_currency.dart | 4 ++-- cw_core/lib/wallet_type.dart | 2 +- cw_lightning/lib/lightning_wallet.dart | 4 ++-- lib/core/address_validator.dart | 1 + lib/view_model/lightning_view_model.dart | 7 ++++--- 9 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 assets/images/lightning_logo.png create mode 100644 assets/images/lightning_logo.svg diff --git a/assets/images/lightning_logo.png b/assets/images/lightning_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..af38b4ccb05dc01c469ac0eaa35c76a1807bc749 GIT binary patch literal 9612 zcmX9^bySq!(|?w3mRh=zZV6eWQyQdJN?J*Um68UjB?alOFCqvmr3i>iO3TtIl1nH^ z_q+byKlYqG_uPA*nR`DocV<2lZ)BiFPQpY2008+TZFLg>0FnOt5fNZVM$O8w10293 zbrsWq{QV{We7dPQ!h;px%@!Nw=!)N>9D*|HDtpvl8r-Sx#Z#3v6lXN6m;K4(;@r@e z;uZX&9Qi1*;ojRG{@Di2N%cMa2IH0=kn;Un-@>yLd>oH2&Mu?F9b;!=erKa{N=l+i zo1+DCvDu8J1Cz;dymAt><*|*wBFId^W$fW3kvn7Kbi#M_y~4x z9sfLPA#-c%9hF6wYw0>=`QQ|2^*5%z3~dw#smtGLYG>=Uvq)Bk~A zK*Q4k)4b7j+!FvI{v%z$Spofe;_pc%?mMUeshY`s!jz_xQLeu4Kr${^rr>+O2Uk0J z626ChsE0mUD7$YSUS-1Vyjn6j{EZv-0g){ZQhtYd2$~*<{z_x-<>7-?RSu2s;Ba0= z{+l8F;Sk^jW{2Q~T&82uu@w&%`J7iHr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.svg new file mode 100644 index 000000000..6fbc51ef4 --- /dev/null +++ b/assets/images/lightning_logo.svg @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/cw_bitcoin/lib/electrum_wallet_snapshot.dart b/cw_bitcoin/lib/electrum_wallet_snapshot.dart index 98c3753db..e0d70f05d 100644 --- a/cw_bitcoin/lib/electrum_wallet_snapshot.dart +++ b/cw_bitcoin/lib/electrum_wallet_snapshot.dart @@ -42,7 +42,7 @@ class ElectrumWalletSnapshot { .whereType() .map((addr) => BitcoinAddressRecord.fromJSON(addr, network)) .toList(); - final balance = ElectrumBalance.fromJSON(data['balance'] as String) ?? + final balance = ElectrumBalance.fromJSON(data['balance'] as String?) ?? ElectrumBalance(confirmed: 0, unconfirmed: 0, frozen: 0); var regularAddressIndexByType = {SegwitAddresType.p2wpkh.toString(): 0}; var changeAddressIndexByType = {SegwitAddresType.p2wpkh.toString(): 0}; diff --git a/cw_core/lib/amount_converter.dart b/cw_core/lib/amount_converter.dart index 249b87bd3..6be067d89 100644 --- a/cw_core/lib/amount_converter.dart +++ b/cw_core/lib/amount_converter.dart @@ -23,6 +23,8 @@ class AmountConverter { return _moneroAmountToDouble(amount); case CryptoCurrency.btc: return _bitcoinAmountToDouble(amount); + case CryptoCurrency.btcln: + return _lightningAmountToDouble(amount); case CryptoCurrency.bch: return _bitcoinCashAmountToDouble(amount); case CryptoCurrency.dash: @@ -83,6 +85,8 @@ class AmountConverter { case CryptoCurrency.bch: case CryptoCurrency.ltc: return _bitcoinAmountToString(amount); + case CryptoCurrency.btcln: + return _lightningAmountToString(amount); case CryptoCurrency.xhv: case CryptoCurrency.xag: case CryptoCurrency.xau: @@ -119,9 +123,17 @@ class AmountConverter { _bitcoinAmountFormat.format( cryptoAmountToDouble(amount: amount, divider: _bitcoinAmountDivider)); + static String _lightningAmountToString(int amount) { + String formattedAmount = _bitcoinAmountFormat.format(amount); + return formattedAmount.substring(0, formattedAmount.length - 2); + } + static double _bitcoinAmountToDouble(int amount) => cryptoAmountToDouble(amount: amount, divider: _bitcoinAmountDivider); + static double _lightningAmountToDouble(int amount) => + cryptoAmountToDouble(amount: amount, divider: 1); + static int _doubleToBitcoinAmount(double amount) => (amount * _bitcoinAmountDivider).toInt(); diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart index 93684ec0f..023d64ed4 100644 --- a/cw_core/lib/crypto_currency.dart +++ b/cw_core/lib/crypto_currency.dart @@ -186,7 +186,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen static const scrt = CryptoCurrency(title: 'SCRT', fullName: 'Secret Network', raw: 59, name: 'scrt', iconPath: 'assets/images/scrt_icon.png', decimals: 6); static const uni = CryptoCurrency(title: 'UNI', tag: 'ETH', fullName: 'Uniswap', raw: 60, name: 'uni', iconPath: 'assets/images/uni_icon.png', decimals: 18); static const stx = CryptoCurrency(title: 'STX', fullName: 'Stacks', raw: 61, name: 'stx', iconPath: 'assets/images/stx_icon.png', decimals: 8); - static const btcln = CryptoCurrency(title: 'BTC', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'btcln', iconPath: 'assets/images/btc.png', decimals: 8); + static const btcln = CryptoCurrency(title: 'Sats', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'btcln', iconPath: 'assets/images/lightning_logo.png', decimals: 8); static const shib = CryptoCurrency(title: 'SHIB', tag: 'ETH', fullName: 'Shiba Inu', raw: 63, name: 'shib', iconPath: 'assets/images/shib_icon.png', decimals: 18); static const aave = CryptoCurrency(title: 'AAVE', tag: 'ETH', fullName: 'Aave', raw: 64, name: 'aave', iconPath: 'assets/images/aave_icon.png', decimals: 18); static const arb = CryptoCurrency(title: 'ARB', fullName: 'Arbitrum', raw: 65, name: 'arb', iconPath: 'assets/images/arb_icon.png', decimals: 18); @@ -216,7 +216,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen static const kaspa = CryptoCurrency(title: 'KAS', fullName: 'Kaspa', raw: 89, name: 'kas', iconPath: 'assets/images/kaspa_icon.png', decimals: 8); static const digibyte = CryptoCurrency(title: 'DGB', fullName: 'DigiByte', raw: 90, name: 'dgb', iconPath: 'assets/images/digibyte.png', decimals: 8); static const usdtSol = CryptoCurrency(title: 'USDT', tag: 'SOL', fullName: 'USDT Tether', raw: 90, name: 'usdtsol', iconPath: 'assets/images/usdt_icon.png', decimals: 6); - static const satoshis = CryptoCurrency(title: 'Sats', fullName: 'Satoshis', raw: 91, name: 'sats', iconPath: 'assets/images/btc.png', decimals: 0); + static const satoshis = CryptoCurrency(title: 'Sats', fullName: 'Satoshis', raw: 91, name: 'sats', iconPath: 'assets/images/lightning_logo.png', decimals: 0); diff --git a/cw_core/lib/wallet_type.dart b/cw_core/lib/wallet_type.dart index edecc6d81..1774ad051 100644 --- a/cw_core/lib/wallet_type.dart +++ b/cw_core/lib/wallet_type.dart @@ -194,7 +194,7 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type) { case WalletType.polygon: return CryptoCurrency.maticpoly; case WalletType.lightning: - return CryptoCurrency.btc; + return CryptoCurrency.btcln; case WalletType.solana: return CryptoCurrency.sol; default: diff --git a/cw_lightning/lib/lightning_wallet.dart b/cw_lightning/lib/lightning_wallet.dart index e42b44e51..9141512aa 100644 --- a/cw_lightning/lib/lightning_wallet.dart +++ b/cw_lightning/lib/lightning_wallet.dart @@ -84,7 +84,7 @@ abstract class LightningWalletBase _password = password, _isTransactionUpdating = false, balance = ObservableMap.of({ - CryptoCurrency.btc: + CryptoCurrency.btcln: initialBalance ?? const LightningBalance(confirmed: 0, unconfirmed: 0, frozen: 0) }), super(walletInfo) { @@ -207,7 +207,7 @@ abstract class LightningWalletBase sdk.nodeStateStream.listen((event) { if (event == null) return; - balance[CryptoCurrency.btc] = LightningBalance( + balance[CryptoCurrency.btcln] = LightningBalance( confirmed: event.maxPayableMsat ~/ 1000, unconfirmed: event.maxReceivableMsat ~/ 1000, frozen: 0, diff --git a/lib/core/address_validator.dart b/lib/core/address_validator.dart index 853762a1c..9cfc01ec3 100644 --- a/lib/core/address_validator.dart +++ b/lib/core/address_validator.dart @@ -270,6 +270,7 @@ class AddressValidator extends TextValidator { '|([^0-9a-zA-Z]|^)8[0-9a-zA-Z]{94}([^0-9a-zA-Z]|\$)' '|([^0-9a-zA-Z]|^)[0-9a-zA-Z]{106}([^0-9a-zA-Z]|\$)'; case CryptoCurrency.btc: + case CryptoCurrency.btcln: return '([^0-9a-zA-Z]|^)${P2pkhAddress.regex.pattern}|\$)' '([^0-9a-zA-Z]|^)${P2shAddress.regex.pattern}|\$)' '([^0-9a-zA-Z]|^)${P2wpkhAddress.regex.pattern}|\$)' diff --git a/lib/view_model/lightning_view_model.dart b/lib/view_model/lightning_view_model.dart index 65045e7fc..3370a0d0f 100644 --- a/lib/view_model/lightning_view_model.dart +++ b/lib/view_model/lightning_view_model.dart @@ -39,13 +39,14 @@ abstract class LightningViewModelBase with Store { Future> invoiceLimitsSats() async { final sdk = await BreezSDK(); - final req = ReceivePaymentRequest( - amountMsat: 3000 * 1000,// 3000 sats + ReceivePaymentRequest? req = null; + req = ReceivePaymentRequest( + amountMsat: 10000 * 1000, // 10000 sats description: "limits", ); final res = await sdk.receivePayment(req: req); int min = (res.openingFeeMsat ?? (2500 * 1000)) ~/ 1000; - int max = 1000000000 * 1000 * 10;// 10 BTC + int max = 1000000000 * 1000 * 10; // 10 BTC return [min.toString(), max.toString()]; } }