Exemple #1
0
        /// <inheritdoc />
        public WatchOnlyWallet LoadWatchOnlyWallet()
        {
            if (this.fileStorage.Exists(WalletFileName))
            {
                return(this.fileStorage.LoadByFileName(WalletFileName));
            }

            var watchOnlyWallet = new WatchOnlyWallet
            {
                Network      = this.network,
                CoinType     = this.coinType,
                CreationTime = this.dateTimeProvider.GetTimeOffset()
            };

            this.fileStorage.SaveToFile(watchOnlyWallet, WalletFileName);
            return(watchOnlyWallet);
        }
        /// <inheritdoc />
        public WatchOnlyWallet LoadWatchOnlyWallet()
        {
            if (this.fileStorage.Exists(WalletFileName))
            {
                return(this.fileStorage.LoadByFileName(WalletFileName));
            }

            WatchOnlyWallet watchOnlyWallet = new WatchOnlyWallet
            {
                Network          = this.network,
                CoinType         = this.coinType,
                CreationTime     = DateTimeOffset.Now,
                WatchedAddresses = new ConcurrentDictionary <string, WatchedAddress>()
            };

            this.fileStorage.SaveToFile(watchOnlyWallet, WalletFileName);
            return(watchOnlyWallet);
        }
Exemple #3
0
        /// <inheritdoc />
        public WatchOnlyWallet LoadWatchOnlyWallet()
        {
            string walletFilePath = this.GetWalletFilePath();

            if (!File.Exists(walletFilePath))
            {
                this.Wallet = new WatchOnlyWallet
                {
                    Network          = this.network,
                    CoinType         = this.coinType,
                    CreationTime     = DateTimeOffset.Now,
                    WatchedAddresses = new ConcurrentDictionary <string, WatchedAddress>()
                };

                this.SaveWatchOnlyWallet();
            }

            // Load the file from the local system.
            return(JsonConvert.DeserializeObject <WatchOnlyWallet>(File.ReadAllText(walletFilePath)));
        }
 /// <inheritdoc />
 public void Initialize()
 {
     // load the watch only wallet into memory
     this.Wallet = this.LoadWatchOnlyWallet();
 }
Exemple #5
0
 public void Initialize()
 {
     // load the watch only wallet into memory
     this.Wallet = this.DeserializeWallet();
 }