Beispiel #1
0
        public static ICurrencySwap Create(
            CurrencyConfig currency,
            IAccount account)
        {
            return(currency switch
            {
                BitcoinBasedConfig _ => new BitcoinBasedSwap(
                    account: account.GetCurrencyAccount <BitcoinBasedAccount>(currency.Name),
                    currencies: account.Currencies),

                Erc20Config _ => new Erc20Swap(
                    account: account.GetCurrencyAccount <Erc20Account>(currency.Name),
                    ethereumAccount: account.GetCurrencyAccount <EthereumAccount>("ETH"),
                    currencies: account.Currencies),

                EthereumConfig _ => new EthereumSwap(
                    account: account.GetCurrencyAccount <EthereumAccount>(currency.Name),
                    currencies: account.Currencies),

                Fa12Config _ => new Fa12Swap(
                    account: account.GetCurrencyAccount <Fa12Account>(currency.Name),
                    tezosAccount: account.GetCurrencyAccount <TezosAccount>(TezosConfig.Xtz),
                    currencies: account.Currencies),

                TezosConfig _ => new TezosSwap(
                    account:   account.GetCurrencyAccount <TezosAccount>(currency.Name),
                    currencies: account.Currencies),

                _ => throw new NotSupportedException($"Not supported currency {currency.Name}")
            });
        public static IWalletViewModel CreateViewModel(
            IAtomexApp app,
            IDialogViewer dialogViewer,
            IMenuSelector menuSelector,
            IConversionViewModel conversionViewModel,
            CurrencyConfig currency)
        {
            return(currency switch
            {
                BitcoinBasedConfig _ or
                Erc20Config _ or
                EthereumConfig _ => new WalletViewModel(
                    app: app,
                    dialogViewer: dialogViewer,
                    menuSelector: menuSelector,
                    conversionViewModel: conversionViewModel,
                    currency: currency),

                Fa12Config _ => new Fa12WalletViewModel(
                    app: app,
                    dialogViewer: dialogViewer,
                    menuSelector: menuSelector,
                    conversionViewModel: conversionViewModel,
                    currency: currency),

                TezosConfig _ => new TezosWalletViewModel(
                    app: app,
                    dialogViewer: dialogViewer,
                    menuSelector: menuSelector,
                    conversionViewModel: conversionViewModel,
                    currency: currency),

                _ => throw new NotSupportedException($"Can't create wallet view model for {currency.Name}. This currency is not supported."),
            });
Beispiel #3
0
 public static SendViewModel CreateViewModel(IAtomexApp app, CurrencyViewModel currencyViewModel)
 {
     return(currencyViewModel.Currency switch
     {
         BitcoinBasedConfig _ => (SendViewModel) new BitcoinBasedSendViewModel(app, currencyViewModel),
         Erc20Config _ => (SendViewModel) new Erc20SendViewModel(app, currencyViewModel),
         EthereumConfig _ => (SendViewModel) new EthereumSendViewModel(app, currencyViewModel),
         Fa12Config _ => (SendViewModel) new Fa12SendViewModel(app, currencyViewModel),
         TezosConfig _ => (SendViewModel) new TezosSendViewModel(app, currencyViewModel),
         _ => throw new NotSupportedException($"Can't create send view model for {currencyViewModel.Currency.Name}. This currency is not supported."),
     });
        public static CurrencyViewModel CreateViewModel(
            IAtomexApp app,
            CurrencyConfig currency,
            bool loadTransactions = true)
        {
            return(currency switch
            {
                BitcoinBasedConfig _ or
                Erc20Config _ or
                EthereumConfig _ => new CurrencyViewModel(app, currency, loadTransactions),

                Fa12Config _ => new Fa12CurrencyViewModel(app, currency),

                TezosConfig _ => new TezosCurrencyViewModel(app, currency),

                _ => throw new NotSupportedException($"Can't create currency view model for {currency.Name}. This currency is not supported."),
            });