protected override void OnPluginsLoaded() { walletProvider = GetService <IWalletProvider>(); if (Settings.Default.AutoStart) { walletProvider.WalletOpened += WalletProvider_WalletOpened; } }
public ReportController( ILogger <InternalController> logger, UserManager <ApplicationUser> userManager, ApplicationDbContext context, IWalletProvider walletProvider, IOptions <KycSettings> kycSettings, IOptions <ExchangeSettings> settings) : base(logger, userManager, context, settings, walletProvider, kycSettings) { }
public BaseWalletController( ILogger logger, UserManager <ApplicationUser> userManager, ApplicationDbContext context, IOptions <ExchangeSettings> settings, IWalletProvider walletProvider, IOptions <KycSettings> kycSettings) : base(logger, userManager, context, settings) { _walletProvider = walletProvider; _kycSettings = kycSettings.Value; }
public WalletController( IWalletProvider walletProvider, IPersistedCheckoutContextProvider persistedCheckoutContextProvider, NoticeProvider noticeProvider, ISkinProvider skinProvider) { WalletProvider = walletProvider; PersistedCheckoutContextProvider = persistedCheckoutContextProvider; NoticeProvider = noticeProvider; SkinProvider = skinProvider; }
public Operator(Blockchain blockchain, IHashProvider hashProvider, IWalletProvider walletProvider, IOptions <CoinSettings> coinSettings, ILogger <Operator> logger) { _blockchain = blockchain; _hashProvider = hashProvider; _walletProvider = walletProvider; _coinSettings = coinSettings.Value; _logger = logger; }
private void NeoSystem_ServiceAdded(object sender, object service) { if (service is IWalletProvider) { walletProvider = service as IWalletProvider; System.ServiceAdded -= NeoSystem_ServiceAdded; if (Settings.Default.AutoStart) { walletProvider.WalletChanged += WalletProvider_WalletChanged; } } }
private void NeoSystem_ServiceAdded(object sender, object service) { if (service is not IWalletProvider provider) { return; } walletProvider = provider; neoSystem.ServiceAdded -= NeoSystem_ServiceAdded; if (settings.AutoStart) { walletProvider.WalletChanged += WalletProvider_WalletChanged; } }
public WalletService(IUserSession userSession, IWalletProvider walletProvider) { if (userSession == null) { throw new ArgumentNullException("userSession"); } if (walletProvider == null) { throw new ArgumentNullException("walletProvider"); } this.userSession = userSession; this.walletProvider = walletProvider; }
public CheckoutCreditCardController( CreditCardTypeProvider creditCardTypeProvider, ICreditCardValidationProvider creditCardValidationProvider, NoticeProvider noticeProvider, IPaymentOptionProvider paymentOptionProvider, IPersistedCheckoutContextProvider persistedCheckoutContextProvider, IWalletProvider walletProvider) { CreditCardTypeProvider = creditCardTypeProvider; CreditCardValidationProvider = creditCardValidationProvider; NoticeProvider = noticeProvider; PaymentOptionProvider = paymentOptionProvider; PersistedCheckoutContextProvider = persistedCheckoutContextProvider; WalletProvider = walletProvider; }
public WalletController( ILogger <WalletController> logger, UserManager <ApplicationUser> userManager, ApplicationDbContext context, IOptions <ExchangeSettings> settings, IWalletProvider walletProvider, IOptions <KycSettings> kycSettings, IEmailSender emailSender, ITripwire tripwire, IUserLocks userLocks) : base(logger, userManager, context, settings, walletProvider, kycSettings) { _emailSender = emailSender; _tripwire = tripwire; _userLocks = userLocks; }
public InternalController( ILogger <InternalController> logger, UserManager <ApplicationUser> userManager, ApplicationDbContext context, IOptions <ExchangeSettings> settings, IOptions <WalletSettings> walletSettings, IWalletProvider walletProvider, IOptions <KycSettings> kycSettings, IWebsocketTokens websocketTokens, ITripwire tripwire, IOptions <TripwireSettings> tripwireSettings) : base(logger, userManager, context, settings, walletProvider, kycSettings) { _walletSettings = walletSettings.Value; _websocketTokens = websocketTokens; _tripwire = tripwire; _tripwireSettings = tripwireSettings.Value; }
public ManageController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, ILogger <ManageController> logger, UrlEncoder urlEncoder, ApplicationDbContext context, IOptions <ExchangeSettings> settings, IOptions <GeneralSettings> gen, IOptions <KycSettings> kyc, IWalletProvider walletProvider) : base(logger, userManager, context, settings) { _signInManager = signInManager; _emailSender = emailSender; _urlEncoder = urlEncoder; _genSettings = gen.Value; _kycSettings = kyc.Value; _walletProvider = walletProvider; }
public Broker(ILogger <Broker> logger, ApplicationDbContext context, IWalletProvider walletProvider, IOptions <ApiSettings> apiSettings, UserManager <ApplicationUser> userManager, IOptions <ExchangeSettings> settings, ITripwire tripwire, IOptions <FiatProcessorSettings> fiatSettings, IEmailSender emailSender) { _logger = logger; _context = context; _walletProvider = walletProvider; _apiSettings = apiSettings.Value; _userManager = userManager; _settings = settings.Value; _tripwire = tripwire; _fiatSettings = fiatSettings.Value; _emailSender = emailSender; }
public DevApiController( IWebHostEnvironment webhostEnvironment, ILogger <ApiController> logger, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, ApplicationDbContext context, IEmailSender emailSender, IOptions <ExchangeSettings> settings, IOptions <ApiSettings> apiSettings, RoleManager <IdentityRole> roleManager, IOptions <KycSettings> kycSettings, IWalletProvider walletProvider, ITripwire tripwire) : base(logger, userManager, context, settings, walletProvider, kycSettings) { _webhostEnvironment = webhostEnvironment; _signInManager = signInManager; _emailSender = emailSender; _roleManager = roleManager; _apiSettings = apiSettings.Value; _tripwire = tripwire; }
public Transaction AddTransaction(string from, string to, decimal amount, IWalletProvider walletProvider) { this.CalculateBalances(0); if (balances.ContainsKey(from) && balances[from] < amount) { Console.WriteLine("Not enought coins..."); return(null); } var publicKeyHex = CryptographyUtilities.BytesToHex(walletProvider.PublicKey.GetEncoded()); var transaction = new Transaction() { From = from, To = to, Value = amount, SenderPublicKey = publicKeyHex }; string transactionJson = JsonConvert.SerializeObject(transaction, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); var transactionHash = CryptographyUtilities.BytesToHex(CryptographyUtilities.CalcSHA256(transactionJson)); var signiture = walletProvider.SignTransaction(Encoding.UTF8.GetBytes(transactionHash)); transaction.TransactionHash = transactionHash; transaction.SenderSignature = signiture; this.pendingTransactions.Add(transaction); StorageFileProvider <Transaction[]> .SetModel(Constants.PendingTransactionsFilePath, this.pendingTransactions.ToArray()); Console.WriteLine("Transaction is pending..."); return(transaction); }
public FaucetController() { this.blockchain = new Blockchain(); this.faucetWalletProvider = new FaucetWalletProvider(); }
public WalletController(IWalletProvider walletProvider) { this.walletProvider = walletProvider; }
public override ITransactionSelectionMethod CreateTransactionSelectionMethod(TransactionSelectionMethodType type, long blockId, BlockElectionDistillate blockElectionDistillate, IWalletProvider walletProvider, BlockChainConfigurations blockChainConfigurations, BlockchainServiceSet serviceSet) { if (blockElectionDistillate.electionContext is INeuraliumElectionContext neuraliumElectionContext) { if (type == TransactionSelectionMethodTypes.Instance.Automatic) { // ok, this one is meant to be automatic. we wlil try to find the best method //TODO: make this more elaborate. Try to response to the various cues we can use like the declared bounty allocator if (neuraliumElectionContext.BountyAllocationMethod.Version.Type.Value == BountyAllocationMethodTypes.Instance.EqualSplit) { type = NeuraliumTransactionSelectionMethodTypes.Instance.HighestTips; } // the default automatic best choice type = NeuraliumTransactionSelectionMethodTypes.Instance.HighestTips; } if (type == NeuraliumTransactionSelectionMethodTypes.Instance.HighestTips) { // ok, nothing special here, lets just maximize profits by choosing the highest paying transactions return(new NeuraliumHighestTipTransactionSelectionMethod(blockId, neuraliumElectionContext.TransactionTipsAllocationMethod, (INeuraliumWalletProviderProxy)walletProvider, blockElectionDistillate.electionContext.MaximumElectedTransactionCount, ((NeuraliumBlockChainConfigurations)blockChainConfigurations).HighestTipTransactionSelectionStrategySettings, serviceSet.BlockchainTimeService)); } } return(base.CreateTransactionSelectionMethod(type, blockId, blockElectionDistillate, walletProvider, blockChainConfigurations, serviceSet)); }
static async Task Main() { IConfigurationRoot configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", true, false) .Build(); ServiceProvider services = new ServiceCollection().AddLogging(builder => builder.SetMinimumLevel(LogLevel.Trace).AddFile(configuration.GetSection("Logging:File"))) .AddWalletManager(configuration) .BuildServiceProvider(); IWalletProvider walletProvider = services.GetService <IWalletProvider>(); string walletName = "TestnetDemoWallet" + Guid.NewGuid().ToString(); string walletPassword = "******"; string walletPasswordUpdated = "1234567890"; string walletRecoverySeed = @"tackle cousin pet true inner exhibit cradle crazy exact segment hard smooth loan beef crystal speak usage life weekend remove come sock just elite"; // Create a wallet { IWalletProviderResult <WalletInfo> walletProviderResult = await walletProvider.CreateWalletAsync(walletName, walletPassword, walletPassword); WalletInfo walletInfo = walletProviderResult.Result; walletInfo.Dump("Create a wallet"); // `.Dump` >>>> Prints to console } // Update a password on a wallet { IWalletProviderResult walletResult = await walletProvider.UpdateWalletAsync(walletName, walletPassword, walletPasswordUpdated, walletPasswordUpdated); walletResult.Dump("Updated password on wallet"); } // GetAsync all wallets { IWalletProviderResult <IEnumerable <WalletInfo> > walletProviderResult = await walletProvider.GetAllWalletsAsync(); IEnumerable <WalletInfo> wallets = walletProviderResult.Result; wallets.Dump("GetAsync all wallets"); } // Remove the wallet { IWalletProviderResult walletResult = await walletProvider.RemoveWalletAsync(walletName, walletPasswordUpdated); walletResult.Dump("Remove the wallet"); } // Import wallet { IWalletProviderResult <WalletInfo> walletProviderResult = await walletProvider.ImportWalletAsync(walletName, walletPassword, walletPassword, walletRecoverySeed); WalletInfo walletInfo = walletProviderResult.Result; walletInfo.Dump("Import wallet"); } // Find an individual wallet { IWalletProviderResult <WalletInfo> walletProviderResult = await walletProvider.FindWalletAsync(walletName); WalletInfo walletInfo = walletProviderResult.Result; walletInfo.Dump("Finding an individual wallet"); } // Cleaning up { IWalletProviderResult walletResult = await walletProvider.RemoveWalletAsync(walletName, walletPassword); walletResult.Dump("Cleaned up"); } }