コード例 #1
0
 public void Validate(string address)
 {
     if (string.IsNullOrEmpty(address))
     {
         AddError(nameof(address), "Address can not be empty!");
         return;
     }
     if (!address.StartsWith("F") && !address.StartsWith("3") && !address.StartsWith("grs1"))
     {
         AddError(nameof(address), "Address must start with F or 3!");
         return;
     }
     if (address.StartsWith("grs1"))
     {
         var errors = Bech32.Verify(address, NetworkType.Mainnet);
         if (errors.Any())
         {
             foreach (var error in errors)
             {
                 AddError(nameof(address), error);
             }
             return;
         }
     }
     else
     {
         try {
             Groestlcoin.GroestlEncoder.Instance.DecodeData(address);
         }
         catch (Exception e) {
             AddError(nameof(address), e.Message);
         }
     }
 }