Example #1
0
 public static SendViewModel CreateViewModel(
     IAtomexApp app,
     Currency currency)
 {
     return(currency switch
     {
         BitcoinBasedCurrency _ => (SendViewModel) new BitcoinBasedSendViewModel(app, currency),
         ERC20 _ => (SendViewModel) new Erc20SendViewModel(app, currency),
         Ethereum _ => (SendViewModel) new EthereumSendViewModel(app, currency),
         NYX _ => (SendViewModel) new Fa12SendViewModel(app, currency),
         FA2 _ => (SendViewModel) new Fa12SendViewModel(app, currency),
         FA12 _ => (SendViewModel) new Fa12SendViewModel(app, currency),
         Tezos _ => (SendViewModel) new TezosSendViewModel(app, currency),
         _ => throw new NotSupportedException($"Can't create send view model for {currency.Name}. This currency is not supported."),
     });
Example #2
0
 public static ReceiveViewModel CreateViewModel(
     IAtomexApp app,
     Currency currency)
 {
     return(currency switch
     {
         BitcoinBasedCurrency _ => new ReceiveViewModel(app, currency),
         ERC20 _ => new ReceiveViewModel(app, currency),
         Ethereum _ => new EthereumReceiveViewModel(app, currency),
         NYX _ => new ReceiveViewModel(app, currency),
         FA2 _ => new ReceiveViewModel(app, currency),
         FA12 _ => new ReceiveViewModel(app, currency),
         Tezos _ => new TezosReceiveViewModel(app, currency),
         _ => throw new NotSupportedException($"Can't create receive view model for {currency.Name}. This currency is not supported."),
     });
 public static ICurrencySwap Create(
     Currency currency,
     IAccount account,
     ISwapClient swapClient)
 {
     return(currency switch
     {
         BitcoinBasedCurrency _ => (ICurrencySwap) new BitcoinBasedSwap(
             account: account.GetCurrencyAccount <BitcoinBasedAccount>(currency.Name),
             swapClient: swapClient,
             currencies: account.Currencies),
         ERC20 _ => (ICurrencySwap) new ERC20Swap(
             account: account.GetCurrencyAccount <ERC20Account>(currency.Name),
             ethereumAccount: account.GetCurrencyAccount <EthereumAccount>("ETH"),
             swapClient: swapClient,
             currencies: account.Currencies),
         Atomex.Ethereum _ => (ICurrencySwap) new EthereumSwap(
             account: account.GetCurrencyAccount <EthereumAccount>(currency.Name),
             swapClient: swapClient,
             currencies: account.Currencies),
         NYX _ => (ICurrencySwap) new NYXSwap(
             account: account.GetCurrencyAccount <NYXAccount>(currency.Name),
             tezosAccount: account.GetCurrencyAccount <TezosAccount>("XTZ"),
             swapClient: swapClient,
             currencies: account.Currencies),
         FA2 _ => (ICurrencySwap) new FA2Swap(
             account: account.GetCurrencyAccount <FA2Account>(currency.Name),
             tezosAccount: account.GetCurrencyAccount <TezosAccount>("XTZ"),
             swapClient: swapClient,
             currencies: account.Currencies),
         FA12 _ => (ICurrencySwap) new FA12Swap(
             account: account.GetCurrencyAccount <FA12Account>(currency.Name),
             tezosAccount: account.GetCurrencyAccount <TezosAccount>("XTZ"),
             swapClient: swapClient,
             currencies: account.Currencies),
         Atomex.Tezos _ => (ICurrencySwap) new TezosSwap(
             account: account.GetCurrencyAccount <TezosAccount>(currency.Name),
             swapClient: swapClient,
             currencies: account.Currencies),
         _ => throw new NotSupportedException($"Not supported currency {currency.Name}"),
     });