public HardwareWalletInfo(string masterFingerprint, string serialNumber, HardwareWalletType type, string path, string error)
        {
            try
            {
                Guard.NotNullOrEmptyOrWhitespace(nameof(masterFingerprint), masterFingerprint);
                var masterFingerPrintBytes = ByteHelpers.FromHex(masterFingerprint);
                MasterFingerprint = new HDFingerprint(masterFingerPrintBytes);
            }
            catch (ArgumentException)
            {
                MasterFingerprint = null;
            }

            SerialNumber = serialNumber;
            Type         = type;
            Path         = path;
            Error        = error;

            Ready       = true;
            Initialized = true;
            if (Error != null)
            {
                if (Error.Contains("Not initialized", StringComparison.OrdinalIgnoreCase))
                {
                    Initialized = false;
                }
                else if (Type == HardwareWalletType.Ledger &&
                         (Error.Contains("get_pubkey_at_path canceled", StringComparison.OrdinalIgnoreCase) ||
                          Error.Contains("Invalid status 6f04", StringComparison.OrdinalIgnoreCase) ||               // It comes when device asleep too.
                          Error.Contains("Device is asleep", StringComparison.OrdinalIgnoreCase)))
                {
                    Ready = false;
                }
            }
        }
示例#2
0
 public HardwareWalletInfo(string fingerprint, string serialNumber, HardwareWalletType type, string path, string error)
 {
     Fingerprint  = fingerprint;
     SerialNumber = serialNumber;
     Type         = type;
     Path         = path;
     Error        = error;
 }
示例#3
0
 public HardwareWalletInfo(string fingerprint, string serialNumber, HardwareWalletType type, string path, string error)
 {
     MasterFingerprint = new HDFingerprint(ByteHelpers.FromHex(fingerprint));
     SerialNumber      = serialNumber;
     Type  = type;
     Path  = path;
     Error = error;
 }
示例#4
0
        public HardwareWalletInfo(string masterFingerprint, string serialNumber, HardwareWalletType type, string path, string error)
        {
            Guard.NotNullOrEmptyOrWhitespace(nameof(masterFingerprint), masterFingerprint);
            var masterFingerPrintBytes = ByteHelpers.FromHex(masterFingerprint);

            MasterFingerprint = new HDFingerprint(masterFingerPrintBytes);
            SerialNumber      = serialNumber;
            Type  = type;
            Path  = path;
            Error = error;
        }