diff --git a/Atomex.Client.Core b/Atomex.Client.Core index 5ebc632..9db0c61 160000 --- a/Atomex.Client.Core +++ b/Atomex.Client.Core @@ -1 +1 @@ -Subproject commit 5ebc632e81c01d9eb50d56a6e566322557d9dc06 +Subproject commit 9db0c61b947559c362ff8e3b732d1f6941373f12 diff --git a/Atomex.Client.Wpf.Installer/Product.wxs b/Atomex.Client.Wpf.Installer/Product.wxs index dd128ed..2c8c863 100644 --- a/Atomex.Client.Wpf.Installer/Product.wxs +++ b/Atomex.Client.Wpf.Installer/Product.wxs @@ -3,7 +3,7 @@ - + diff --git a/Atomex.Client.Wpf/Atomex.Client.Wpf.csproj b/Atomex.Client.Wpf/Atomex.Client.Wpf.csproj index 9a5ec6f..ee51a3c 100644 --- a/Atomex.Client.Wpf/Atomex.Client.Wpf.csproj +++ b/Atomex.Client.Wpf/Atomex.Client.Wpf.csproj @@ -352,6 +352,7 @@ + @@ -940,7 +941,11 @@ - + + + + + diff --git a/Atomex.Client.Wpf/Resources/Images/kusd.png b/Atomex.Client.Wpf/Resources/Images/kusd.png new file mode 100644 index 0000000..0ba65bc Binary files /dev/null and b/Atomex.Client.Wpf/Resources/Images/kusd.png differ diff --git a/Atomex.Client.Wpf/Resources/Images/kusd_90x90.png b/Atomex.Client.Wpf/Resources/Images/kusd_90x90.png new file mode 100644 index 0000000..9012e06 Binary files /dev/null and b/Atomex.Client.Wpf/Resources/Images/kusd_90x90.png differ diff --git a/Atomex.Client.Wpf/Resources/Images/kusd_mask.png b/Atomex.Client.Wpf/Resources/Images/kusd_mask.png new file mode 100644 index 0000000..c53f424 Binary files /dev/null and b/Atomex.Client.Wpf/Resources/Images/kusd_mask.png differ diff --git a/Atomex.Client.Wpf/Resources/Images/tzbtc_90x90_dark.png b/Atomex.Client.Wpf/Resources/Images/tzbtc_90x90_dark.png index 2054f1c..ed2f0bb 100644 Binary files a/Atomex.Client.Wpf/Resources/Images/tzbtc_90x90_dark.png and b/Atomex.Client.Wpf/Resources/Images/tzbtc_90x90_dark.png differ diff --git a/Atomex.Client.Wpf/Styles/WalletViewStyle.xaml b/Atomex.Client.Wpf/Styles/WalletViewStyle.xaml index 1cf8a7c..7809821 100644 --- a/Atomex.Client.Wpf/Styles/WalletViewStyle.xaml +++ b/Atomex.Client.Wpf/Styles/WalletViewStyle.xaml @@ -175,6 +175,15 @@ SwapPaymentTemplate="{StaticResource TezosTransactionDetailsTemplate}" SwapRedeemTemplate="{StaticResource TezosTransactionDetailsTemplate}" SwapRefundTemplate="{StaticResource TezosTransactionDetailsTemplate}"/> + (CurrencyViewModel)new BitcoinCurrencyViewModel(currency), - Litecoin _ => (CurrencyViewModel)new LitecoinCurrencyViewModel(currency), - Tether _ => (CurrencyViewModel)new TetherCurrencyViewModel(currency), - TBTC _ => (CurrencyViewModel)new TbtcCurrencyViewModel(currency), - WBTC _ => (CurrencyViewModel)new WbtcCurrencyViewModel(currency), - Ethereum _ => (CurrencyViewModel)new EthereumCurrencyViewModel(currency), - NYX _ => (CurrencyViewModel)new NYXCurrencyViewModel(currency), - FA2 _ => (CurrencyViewModel)new FA2CurrencyViewModel(currency), - TZBTC _ => (CurrencyViewModel)new TzbtcCurrencyViewModel(currency), - Tezos _ => (CurrencyViewModel)new TezosCurrencyViewModel(currency), + "BTC" => (CurrencyViewModel)new BitcoinCurrencyViewModel(currency), + "LTC" => new LitecoinCurrencyViewModel(currency), + "USDT" => new TetherCurrencyViewModel(currency), + "TBTC" => new TbtcCurrencyViewModel(currency), + "WBTC" => new WbtcCurrencyViewModel(currency), + "ETH" => new EthereumCurrencyViewModel(currency), + "NYX" => new NYXCurrencyViewModel(currency), + "FA2" => new FA2CurrencyViewModel(currency), + "TZBTC" => new TzbtcCurrencyViewModel(currency), + "KUSD" => new KusdCurrencyViewModel(currency), + "XTZ" => new TezosCurrencyViewModel(currency), + "FA12" => new TzbtcCurrencyViewModel(currency), _ => throw new NotSupportedException( $"Can't create currency view model for {currency.Name}. This currency is not supported.") }; diff --git a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/EthereumCurrencyViewModel.cs b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/EthereumCurrencyViewModel.cs index ed60aa0..0bb3baf 100644 --- a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/EthereumCurrencyViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/EthereumCurrencyViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Media; using System.Windows.Media.Imaging; + using Atomex.Client.Wpf.Properties; using Atomex.Client.Wpf.ViewModels.Abstract; using Atomex.Core; @@ -12,15 +13,15 @@ public class EthereumCurrencyViewModel : CurrencyViewModel public EthereumCurrencyViewModel(Currency currency) : base(currency) { - Header = Currency.Description; - IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_90x90.png")))); - IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_mask.png")))); - AccentColor = Color.FromRgb(r: 73, g: 114, b: 143); - AmountColor = Color.FromRgb(r: 183, g: 208, b: 225); + Header = Currency.Description; + IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_90x90.png")))); + IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("ethereum_mask.png")))); + AccentColor = Color.FromRgb(r: 73, g: 114, b: 143); + AmountColor = Color.FromRgb(r: 183, g: 208, b: 225); UnselectedIconBrush = Brushes.White; - IconPath = PathToImage("ethereum.png"); - LargeIconPath = PathToImage("ethereum_90x90.png"); - FeeName = Resources.SvGasLimit; + IconPath = PathToImage("ethereum.png"); + LargeIconPath = PathToImage("ethereum_90x90.png"); + FeeName = Resources.SvGasLimit; } } } \ No newline at end of file diff --git a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/KusdCurrencyViewModel.cs b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/KusdCurrencyViewModel.cs new file mode 100644 index 0000000..4c34c8a --- /dev/null +++ b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/KusdCurrencyViewModel.cs @@ -0,0 +1,27 @@ +using System; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +using Atomex.Client.Wpf.Properties; +using Atomex.Client.Wpf.ViewModels.Abstract; +using Atomex.Core; + +namespace Atomex.Client.Wpf.ViewModels.CurrencyViewModels +{ + public class KusdCurrencyViewModel : CurrencyViewModel + { + public KusdCurrencyViewModel(Currency currency) + : base(currency) + { + Header = Currency.Description; + IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("kusd_90x90.png")))); + IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("kusd_mask.png")))); + AccentColor = Color.FromRgb(r: 7, g: 82, b: 192); + AmountColor = Color.FromRgb(r: 188, g: 212, b: 247); + UnselectedIconBrush = Brushes.White; + IconPath = PathToImage("kusd.png"); + LargeIconPath = PathToImage("kusd_90x90.png"); + FeeName = Resources.SvMiningFee; + } + } +} \ No newline at end of file diff --git a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/LitecoinCurrencyViewModel.cs b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/LitecoinCurrencyViewModel.cs index 900d7af..9080296 100644 --- a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/LitecoinCurrencyViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/LitecoinCurrencyViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Media; using System.Windows.Media.Imaging; + using Atomex.Client.Wpf.Properties; using Atomex.Client.Wpf.ViewModels.Abstract; using Atomex.Core; @@ -12,15 +13,15 @@ public class LitecoinCurrencyViewModel : CurrencyViewModel public LitecoinCurrencyViewModel(Currency currency) : base(currency) { - Header = Currency.Description; - IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_90x90.png")))); - IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_mask.png")))); - AccentColor = Color.FromRgb(r: 191, g: 191, b: 191); - AmountColor = Color.FromRgb(r: 231, g: 231, b: 231); + Header = Currency.Description; + IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_90x90.png")))); + IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("litecoin_mask.png")))); + AccentColor = Color.FromRgb(r: 191, g: 191, b: 191); + AmountColor = Color.FromRgb(r: 231, g: 231, b: 231); UnselectedIconBrush = Brushes.White; - IconPath = PathToImage("litecoin.png"); - LargeIconPath = PathToImage("litecoin_90x90.png"); - FeeName = Resources.SvMiningFee; + IconPath = PathToImage("litecoin.png"); + LargeIconPath = PathToImage("litecoin_90x90.png"); + FeeName = Resources.SvMiningFee; } } } \ No newline at end of file diff --git a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TetherCurrencyViewModel.cs b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TetherCurrencyViewModel.cs index eb93987..dcaff36 100644 --- a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TetherCurrencyViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TetherCurrencyViewModel.cs @@ -14,16 +14,16 @@ public class TetherCurrencyViewModel : CurrencyViewModel public TetherCurrencyViewModel(Currency currency) : base(currency) { - ChainCurrency = new Ethereum(); - Header = Currency.Description; - IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_90x90.png")))); - IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_mask.png")))); - AccentColor = Color.FromRgb(r: 0, g: 162, b: 122); - AmountColor = Color.FromRgb(r: 183, g: 208, b: 225); + ChainCurrency = new Ethereum(); + Header = Currency.Description; + IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_90x90.png")))); + IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tether_mask.png")))); + AccentColor = Color.FromRgb(r: 0, g: 162, b: 122); + AmountColor = Color.FromRgb(r: 183, g: 208, b: 225); UnselectedIconBrush = Brushes.White; - IconPath = PathToImage("tether.png"); - LargeIconPath = PathToImage("tether_90x90.png"); - FeeName = Resources.SvGasLimit; + IconPath = PathToImage("tether.png"); + LargeIconPath = PathToImage("tether_90x90.png"); + FeeName = Resources.SvGasLimit; } } } \ No newline at end of file diff --git a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TezosCurrencyViewModel.cs b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TezosCurrencyViewModel.cs index 357f9a3..120a6a9 100644 --- a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TezosCurrencyViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TezosCurrencyViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Windows.Media; using System.Windows.Media.Imaging; + using Atomex.Client.Wpf.Properties; using Atomex.Client.Wpf.ViewModels.Abstract; using Atomex.Core; @@ -12,15 +13,15 @@ public class TezosCurrencyViewModel : CurrencyViewModel public TezosCurrencyViewModel(Currency currency) : base(currency) { - Header = Currency.Description; - IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_90x90.png")))); - IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_mask.png")))); - AccentColor = Color.FromRgb(r: 44, g: 125, b: 247); - AmountColor = Color.FromRgb(r: 188, g: 212, b: 247); + Header = Currency.Description; + IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_90x90.png")))); + IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tezos_mask.png")))); + AccentColor = Color.FromRgb(r: 44, g: 125, b: 247); + AmountColor = Color.FromRgb(r: 188, g: 212, b: 247); UnselectedIconBrush = Brushes.White; - IconPath = PathToImage("tezos.png"); - LargeIconPath = PathToImage("tezos_90x90.png"); - FeeName = Resources.SvMiningFee; + IconPath = PathToImage("tezos.png"); + LargeIconPath = PathToImage("tezos_90x90.png"); + FeeName = Resources.SvMiningFee; } } } \ No newline at end of file diff --git a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TzbtcCurrencyViewModel.cs b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TzbtcCurrencyViewModel.cs index 29d7503..b0977cf 100644 --- a/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TzbtcCurrencyViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/CurrencyViewModels/TzbtcCurrencyViewModel.cs @@ -12,15 +12,15 @@ public class TzbtcCurrencyViewModel : CurrencyViewModel public TzbtcCurrencyViewModel(Currency currency) : base(currency) { - Header = Currency.Description; - IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_90x90_dark.png")))); - IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_mask.png")))); - AccentColor = Color.FromRgb(r: 7, g: 82, b: 192); - AmountColor = Color.FromRgb(r: 188, g: 212, b: 247); + Header = Currency.Description; + IconBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_90x90_dark.png")))); + IconMaskBrush = new ImageBrush(new BitmapImage(new Uri(PathToImage("tzbtc_mask.png")))); + AccentColor = Color.FromRgb(r: 7, g: 82, b: 192); + AmountColor = Color.FromRgb(r: 188, g: 212, b: 247); UnselectedIconBrush = Brushes.White; - IconPath = PathToImage("tzbtc_dark.png"); - LargeIconPath = PathToImage("tzbtc_90x90_dark.png"); - FeeName = Resources.SvMiningFee; + IconPath = PathToImage("tzbtc_dark.png"); + LargeIconPath = PathToImage("tzbtc_90x90_dark.png"); + FeeName = Resources.SvMiningFee; } } } \ No newline at end of file diff --git a/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/EthereumReceiveViewModel.cs b/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/EthereumReceiveViewModel.cs index f42e4bf..a17c9e6 100644 --- a/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/EthereumReceiveViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/EthereumReceiveViewModel.cs @@ -30,7 +30,9 @@ public override Currency Currency activeTokenAddresses.ForEach(a => a.Balance = activeAddresses.Find(b => b.Address == a.Address)?.Balance ?? 0m); - activeAddresses = activeAddresses.Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null).ToList(); + activeAddresses = activeAddresses + .Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null) + .ToList(); var freeAddress = App.Account .GetFreeExternalAddressAsync(_currency.Name) diff --git a/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/TezosReceiveViewModel.cs b/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/TezosReceiveViewModel.cs index a5b885f..2037378 100644 --- a/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/TezosReceiveViewModel.cs +++ b/Atomex.Client.Wpf/ViewModels/ReceiveViewModels/TezosReceiveViewModel.cs @@ -30,7 +30,9 @@ public override Currency Currency activeTokenAddresses.ForEach(a => a.Balance = activeAddresses.Find(b => b.Address == a.Address)?.Balance ?? 0m); - activeAddresses = activeAddresses.Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null).ToList(); + activeAddresses = activeAddresses + .Where(a => activeTokenAddresses.FirstOrDefault(b => b.Address == a.Address) == null) + .ToList(); var freeAddress = App.Account .GetFreeExternalAddressAsync(_currency.Name) diff --git a/Atomex.Client.Wpf/ViewModels/TransactionViewModels/TransactionViewModelCreator.cs b/Atomex.Client.Wpf/ViewModels/TransactionViewModels/TransactionViewModelCreator.cs index 8ad22f8..0fee1ab 100644 --- a/Atomex.Client.Wpf/ViewModels/TransactionViewModels/TransactionViewModelCreator.cs +++ b/Atomex.Client.Wpf/ViewModels/TransactionViewModels/TransactionViewModelCreator.cs @@ -1,10 +1,9 @@ using System; + using Atomex.Blockchain.Abstract; using Atomex.Blockchain.BitcoinBased; using Atomex.Blockchain.Ethereum; using Atomex.Blockchain.Tezos; -using Atomex.EthereumTokens; -using Atomex.TezosTokens; namespace Atomex.Client.Wpf.ViewModels.TransactionViewModels { @@ -12,17 +11,20 @@ public static class TransactionViewModelCreator { public static TransactionViewModel CreateViewModel(IBlockchainTransaction tx) { - return tx.Currency switch + return tx.Currency.Name switch { - BitcoinBasedCurrency _ => (TransactionViewModel)new BitcoinBasedTransactionViewModel((IBitcoinBasedTransaction)tx), - Tether _ => (TransactionViewModel)new EthereumERC20TransactionViewModel((EthereumTransaction)tx), - TBTC _ => (TransactionViewModel)new EthereumERC20TransactionViewModel((EthereumTransaction)tx), - WBTC _ => (TransactionViewModel)new EthereumERC20TransactionViewModel((EthereumTransaction)tx), - Ethereum _ => (TransactionViewModel)new EthereumTransactionViewModel((EthereumTransaction)tx), - NYX _ => (TransactionViewModel)new TezosNYXTransactionViewModel((TezosTransaction)tx), - FA2 _ => (TransactionViewModel)new TezosFA2TransactionViewModel((TezosTransaction)tx), - FA12 _ => (TransactionViewModel)new TezosFA12TransactionViewModel((TezosTransaction)tx), - Tezos _ => (TransactionViewModel)new TezosTransactionViewModel((TezosTransaction)tx), + "BTC" => (TransactionViewModel)new BitcoinBasedTransactionViewModel((IBitcoinBasedTransaction)tx), + "LTC" => new BitcoinBasedTransactionViewModel((IBitcoinBasedTransaction)tx), + "USDT" => new EthereumERC20TransactionViewModel((EthereumTransaction)tx), + "TBTC" => new EthereumERC20TransactionViewModel((EthereumTransaction)tx), + "WBTC" => new EthereumERC20TransactionViewModel((EthereumTransaction)tx), + "ETH" => new EthereumTransactionViewModel((EthereumTransaction)tx), + "NYX" => new TezosNYXTransactionViewModel((TezosTransaction)tx), + "FA2" => new TezosFA2TransactionViewModel((TezosTransaction)tx), + "FA12" => new TezosFA12TransactionViewModel((TezosTransaction)tx), + "TZBTC" => new TezosFA12TransactionViewModel((TezosTransaction)tx), + "KUSD" => new TezosFA12TransactionViewModel((TezosTransaction)tx), + "XTZ" => new TezosTransactionViewModel((TezosTransaction)tx), _ => throw new NotSupportedException("Not supported transaction type."), }; } diff --git a/Atomex.Client.Wpf/ViewModels/WalletViewModels/WalletViewModelCreator.cs b/Atomex.Client.Wpf/ViewModels/WalletViewModels/WalletViewModelCreator.cs index c4bf00f..f808077 100644 --- a/Atomex.Client.Wpf/ViewModels/WalletViewModels/WalletViewModelCreator.cs +++ b/Atomex.Client.Wpf/ViewModels/WalletViewModels/WalletViewModelCreator.cs @@ -1,4 +1,5 @@ using System; + using Atomex.Client.Wpf.Controls; using Atomex.Client.Wpf.ViewModels.Abstract; using Atomex.Core; @@ -21,15 +22,15 @@ public static WalletViewModel CreateViewModel( case BitcoinBasedCurrency _: case ERC20 _: case Ethereum _: + case NYX _: + case FA2 _: + case FA12 _: return new WalletViewModel( app: app, dialogViewer: dialogViewer, menuSelector: menuSelector, conversionViewModel: conversionViewModel, currency: currency); - case NYX _: - case FA2 _: - case FA12 _: case Tezos _: return new TezosWalletViewModel( app: app,