Exemple #1
0
        internal static uint160 GetHash(this TrackedSource trackedSource)
        {
            if (trackedSource is DerivationSchemeTrackedSource t)
            {
                return(t.DerivationStrategy.GetHash());
            }
            var data = Encoding.UTF8.GetBytes(trackedSource.ToString());

            return(new uint160(Hashes.RIPEMD160(data, data.Length)));
        }
Exemple #2
0
 internal static string ToPrettyString(this TrackedSource trackedSource)
 {
     if (trackedSource is DerivationSchemeTrackedSource derivation)
     {
         var strategy = derivation.DerivationStrategy.ToString();
         if (strategy.Length > 35)
         {
             strategy = strategy.Substring(0, 10) + "..." + strategy.Substring(strategy.Length - 20);
         }
         return(strategy);
     }
     else if (trackedSource is AddressTrackedSource addressDerivation)
     {
         return(addressDerivation.Address.ToString());
     }
     else
     {
         return(trackedSource.ToString());
     }
 }