コード例 #1
0
        private IActionResult ConfirmAddresses(WalletSetupViewModel vm, DerivationSchemeSettings strategy)
        {
            vm.DerivationScheme = strategy.AccountDerivation.ToString();
            var deposit = new KeyPathTemplates(null).GetKeyPathTemplate(DerivationFeature.Deposit);

            if (!string.IsNullOrEmpty(vm.DerivationScheme))
            {
                var line = strategy.AccountDerivation.GetLineFor(deposit);

                for (uint i = 0; i < 10; i++)
                {
                    var keyPath       = deposit.GetKeyPath(i);
                    var rootedKeyPath = vm.GetAccountKeypath()?.Derive(keyPath);
                    var derivation    = line.Derive(i);
                    var address       = strategy.Network.NBXplorerNetwork.CreateAddress(strategy.AccountDerivation,
                                                                                        line.KeyPathTemplate.GetKeyPath(i),
                                                                                        derivation.ScriptPubKey).ToString();
                    vm.AddressSamples.Add((keyPath.ToString(), address, rootedKeyPath));
                }
            }

            vm.Confirmation = true;
            ModelState.Remove(nameof(vm.Config)); // Remove the cached value

            return(View("ImportWallet/ConfirmAddresses", vm));
        }
コード例 #2
0
        public KeyPathInformation(KeyPathTemplates keyPathTemplates, KeyPath keyPath, DerivationStrategyBase derivationStrategy)
        {
            var derivation = derivationStrategy.GetDerivation(keyPath);

            ScriptPubKey       = derivation.ScriptPubKey;
            Redeem             = derivation.Redeem;
            TrackedSource      = new DerivationSchemeTrackedSource(derivationStrategy);
            DerivationStrategy = derivationStrategy;
            Feature            = keyPathTemplates.GetDerivationFeature(keyPath);
            KeyPath            = keyPath;
        }
コード例 #3
0
        public KeyPathInformation(KeyPathTemplates keyPathTemplates, KeyPath keyPath, DerivationStrategyBase derivationStrategy, NBXplorerNetwork network)
        {
            var derivation = derivationStrategy.GetDerivation(keyPath);

            ScriptPubKey       = derivation.ScriptPubKey;
            Redeem             = derivation.Redeem;
            TrackedSource      = new DerivationSchemeTrackedSource(derivationStrategy);
            DerivationStrategy = derivationStrategy;
            Feature            = keyPathTemplates.GetDerivationFeature(keyPath);
            KeyPath            = keyPath;
            Address            = network.CreateAddress(derivationStrategy, keyPath, ScriptPubKey);
        }
コード例 #4
0
        private Dictionary <string, string> GenerateAddresses(DerivationStrategyBase derivation,
                                                              NBXplorerNetwork network)
        {
            var result  = new Dictionary <string, string>();
            var deposit = new KeyPathTemplates(null).GetKeyPathTemplate(DerivationFeature.Deposit);

            var line = derivation.GetLineFor(deposit);

            for (int i = 0; i < 20; i++)
            {
                result.Add(deposit.GetKeyPath((uint)i).ToString(),
                           line.Derive((uint)i).ScriptPubKey.GetDestinationAddress(network.NBitcoinNetwork).ToString());
            }

            return(result);
        }
コード例 #5
0
 public MainController(
     ExplorerConfiguration explorerConfiguration,
     RepositoryProvider repositoryProvider,
     ChainProvider chainProvider,
     EventAggregator eventAggregator,
     BitcoinDWaiters waiters,
     AddressPoolServiceAccessor addressPoolService,
     ScanUTXOSetServiceAccessor scanUTXOSetService,
     RebroadcasterHostedService rebroadcaster,
     KeyPathTemplates keyPathTemplates,
     IOptions <MvcJsonOptions> jsonOptions)
 {
     ExplorerConfiguration = explorerConfiguration;
     RepositoryProvider    = repositoryProvider;
     ChainProvider         = chainProvider;
     _SerializerSettings   = jsonOptions.Value.SerializerSettings;
     _EventAggregator      = eventAggregator;
     ScanUTXOSetService    = scanUTXOSetService.Instance;
     Waiters               = waiters;
     Rebroadcaster         = rebroadcaster;
     this.keyPathTemplates = keyPathTemplates;
     AddressPoolService    = addressPoolService.Instance;
 }