Update new device models
MODIFY
WalletWasabi.Tests/IntegrationTests/HwiKatas.cs
WalletWasabi.Tests/IntegrationTests/HwiKatas.cs
@@ -51,11 +51,11 @@ namespace WalletWasabi.Tests.IntegrationTests.Hwi
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
Assert.NotNull(entry.Path);
- Assert.Equal(HardwareWalletVendors.Trezor, entry.Type);
+ Assert.Equal(HardwareWalletModels.Trezor_T, entry.Type);
Assert.True(entry.Fingerprint.HasValue);
string devicePath = entry.Path;
- HardwareWalletVendors deviceType = entry.Type;
+ HardwareWalletModels deviceType = entry.Type;
HDFingerprint fingerprint = entry.Fingerprint.Value;
await Assert.ThrowsAsync<HwiException>(async () => await client.SetupAsync(deviceType, devicePath, false, cts.Token));
@@ -124,13 +124,13 @@ namespace WalletWasabi.Tests.IntegrationTests.Hwi
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
Assert.NotNull(entry.Path);
- Assert.Equal(HardwareWalletVendors.Trezor, entry.Type);
+ Assert.Equal(HardwareWalletModels.Trezor_1, entry.Type);
Assert.True(entry.NeedsPinSent);
Assert.Equal(HwiErrorCode.DeviceNotReady, entry.Code);
Assert.Null(entry.Fingerprint);
string devicePath = entry.Path;
- HardwareWalletVendors deviceType = entry.Type;
+ HardwareWalletModels deviceType = entry.Type;
await Assert.ThrowsAsync<HwiException>(async () => await client.SetupAsync(deviceType, devicePath, false, cts.Token));
@@ -187,11 +187,11 @@ namespace WalletWasabi.Tests.IntegrationTests.Hwi
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
Assert.NotNull(entry.Path);
- Assert.Equal(HardwareWalletVendors.Coldcard, entry.Type);
+ Assert.Equal(HardwareWalletModels.Coldcard, entry.Type);
Assert.True(entry.Fingerprint.HasValue);
string devicePath = entry.Path;
- HardwareWalletVendors deviceType = entry.Type;
+ HardwareWalletModels deviceType = entry.Type;
HDFingerprint fingerprint = entry.Fingerprint.Value;
// ColdCard doesn't support it.
@@ -267,7 +267,7 @@ namespace WalletWasabi.Tests.IntegrationTests.Hwi
var enumerate = await client.EnumerateAsync(cts.Token);
HwiEnumerateEntry entry = Assert.Single(enumerate);
Assert.NotNull(entry.Path);
- Assert.Equal(HardwareWalletVendors.Ledger, entry.Type);
+ Assert.Equal(HardwareWalletModels.Ledger_Nano_S, entry.Type);
Assert.True(entry.Fingerprint.HasValue);
Assert.Null(entry.Code);
Assert.Null(entry.Error);
@@ -276,7 +276,7 @@ namespace WalletWasabi.Tests.IntegrationTests.Hwi
Assert.False(entry.NeedsPinSent);
string devicePath = entry.Path;
- HardwareWalletVendors deviceType = entry.Type;
+ HardwareWalletModels deviceType = entry.Type;
HDFingerprint fingerprint = entry.Fingerprint.Value;
await Assert.ThrowsAsync<HwiException>(async () => await client.SetupAsync(deviceType, devicePath, false, cts.Token));

MODIFY
WalletWasabi.Tests/UnitTests/Hwi/DefaultResponseTests.cs
WalletWasabi.Tests/UnitTests/Hwi/DefaultResponseTests.cs
@@ -92,7 +92,7 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
var wrongDeviePaths = new[] { "", " " };
using (var cts = new CancellationTokenSource(ReasonableRequestTimeout))
{
- foreach (HardwareWalletVendors deviceType in Enum.GetValues(typeof(HardwareWalletVendors)))
+ foreach (HardwareWalletModels deviceType in Enum.GetValues(typeof(HardwareWalletModels)))
{
foreach (var wrongDevicePath in wrongDeviePaths)
{

MODIFY
WalletWasabi.Tests/UnitTests/Hwi/HwiProcessBridgeMock.cs
WalletWasabi.Tests/UnitTests/Hwi/HwiProcessBridgeMock.cs
@@ -28,24 +28,24 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
string type;
string rawPath;
- if (Model == HardwareWalletModels.TrezorT)
+ if (Model == HardwareWalletModels.Trezor_T)
{
- type = "trezor";
+ type = "trezor_t";
rawPath = "webusb: 001:4";
}
- else if (Model == HardwareWalletModels.TrezorOne)
+ else if (Model == HardwareWalletModels.Trezor_1)
{
- type = "trezor";
+ type = "trezor_1";
rawPath = "hid:\\\\\\\\?\\\\hid#vid_534c&pid_0001&mi_00#7&6f0b727&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}";
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
type = "coldcard";
rawPath = @"\\\\?\\hid#vid_d13e&pid_cc10&mi_00#7&1b239988&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
- type = "ledger";
+ type = "ledger_nano_s";
rawPath = "\\\\\\\\?\\\\hid#vid_2c97&pid_0001&mi_00#7&e45ae20&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}";
}
else
@@ -63,123 +63,123 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
if (CompareArguments(arguments, "enumerate"))
{
- if (Model == HardwareWalletModels.TrezorT)
+ if (Model == HardwareWalletModels.Trezor_T)
{
response = $"[{{\"type\": \"{type}\", \"path\": \"{rawPath}\", \"needs_pin_sent\": false, \"needs_passphrase_sent\": false, \"error\": \"Not initialized\"}}]";
}
- else if (Model == HardwareWalletModels.TrezorOne)
+ else if (Model == HardwareWalletModels.Trezor_1)
{
response = $"[{{\"type\": \"{type}\", \"path\": \"{rawPath}\", \"needs_pin_sent\": true, \"needs_passphrase_sent\": false, \"error\": \"Could not open client or get fingerprint information: Trezor is locked. Unlock by using 'promptpin' and then 'sendpin'.\", \"code\": -12}}]\r\n";
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = $"[{{\"type\": \"{type}\", \"path\": \"{rawPath}\", \"needs_passphrase\": false, \"fingerprint\": \"a3d0d797\"}}]\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = $"[{{\"type\": \"{type}\", \"path\": \"{rawPath}\", \"fingerprint\": \"4054d6f6\", \"needs_pin_sent\": false, \"needs_passphrase_sent\": false}}]\r\n";
}
}
else if (CompareArguments(arguments, $"{devicePathAndTypeArgumentString} wipe"))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.TrezorOne)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Trezor_1)
{
response = successTrueResponse;
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = "{\"error\": \"The Coldcard does not support wiping via software\", \"code\": -9}\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = "{\"error\": \"The Ledger Nano S does not support wiping via software\", \"code\": -9}\r\n";
}
}
else if (CompareArguments(arguments, $"{devicePathAndTypeArgumentString} setup"))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.TrezorOne)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Trezor_1)
{
response = "{\"error\": \"setup requires interactive mode\", \"code\": -9}";
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = "{\"error\": \"The Coldcard does not support software setup\", \"code\": -9}\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = "{\"error\": \"The Ledger Nano S does not support software setup\", \"code\": -9}\r\n";
}
}
else if (CompareArguments(arguments, $"{devicePathAndTypeArgumentString} --interactive setup"))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.TrezorOne)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Trezor_1)
{
response = successTrueResponse;
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = "{\"error\": \"The Coldcard does not support software setup\", \"code\": -9}\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = "{\"error\": \"The Ledger Nano S does not support software setup\", \"code\": -9}\r\n";
}
}
else if (CompareArguments(arguments, $"{devicePathAndTypeArgumentString} --interactive restore"))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.TrezorOne)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Trezor_1)
{
response = successTrueResponse;
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = "{\"error\": \"The Coldcard does not support restoring via software\", \"code\": -9}\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = "{\"error\": \"The Ledger Nano S does not support restoring via software\", \"code\": -9}\r\n";
}
}
else if (CompareArguments(arguments, $"{devicePathAndTypeArgumentString} promptpin"))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.TrezorOne)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Trezor_1)
{
response = "{\"error\": \"The PIN has already been sent to this device\", \"code\": -11}\r\n";
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = "{\"error\": \"The Coldcard does not need a PIN sent from the host\", \"code\": -9}\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = "{\"error\": \"The Ledger Nano S does not need a PIN sent from the host\", \"code\": -9}\r\n";
}
}
else if (CompareArguments(arguments, $"{devicePathAndTypeArgumentString} sendpin", true))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.TrezorOne)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Trezor_1)
{
response = "{\"error\": \"The PIN has already been sent to this device\", \"code\": -11}";
}
- else if (Model == HardwareWalletModels.ColdcardMk1)
+ else if (Model == HardwareWalletModels.Coldcard)
{
response = "{\"error\": \"The Coldcard does not need a PIN sent from the host\", \"code\": -9}\r\n";
}
- else if (Model == HardwareWalletModels.LedgerNanoS)
+ else if (Model == HardwareWalletModels.Ledger_Nano_S)
{
response = "{\"error\": \"The Ledger Nano S does not need a PIN sent from the host\", \"code\": -9}\r\n";
}
}
else if (CompareGetXbpubArguments(arguments, out string xpub))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.ColdcardMk1 || Model == HardwareWalletModels.TrezorOne || Model == HardwareWalletModels.LedgerNanoS)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Coldcard || Model == HardwareWalletModels.Trezor_1 || Model == HardwareWalletModels.Ledger_Nano_S)
{
response = $"{{\"xpub\": \"{xpub}\"}}\r\n";
}
}
else if (CompareArguments(out bool t1, arguments, $"{devicePathAndTypeArgumentString} displayaddress --path m/84h/0h/0h --wpkh", false))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.ColdcardMk1 || Model == HardwareWalletModels.TrezorOne || Model == HardwareWalletModels.LedgerNanoS)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Coldcard || Model == HardwareWalletModels.Trezor_1 || Model == HardwareWalletModels.Ledger_Nano_S)
{
response = t1
? "{\"address\": \"tb1q7zqqsmqx5ymhd7qn73lm96w5yqdkrmx7rtzlxy\"}\r\n"
@@ -188,7 +188,7 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
}
else if (CompareArguments(out bool t2, arguments, $"{devicePathAndTypeArgumentString} displayaddress --path m/84h/0h/0h/1 --wpkh", false))
{
- if (Model == HardwareWalletModels.TrezorT || Model == HardwareWalletModels.ColdcardMk1 || Model == HardwareWalletModels.TrezorOne || Model == HardwareWalletModels.LedgerNanoS)
+ if (Model == HardwareWalletModels.Trezor_T || Model == HardwareWalletModels.Coldcard || Model == HardwareWalletModels.Trezor_1 || Model == HardwareWalletModels.Ledger_Nano_S)
{
response = t2
? "{\"address\": \"tb1qmaveee425a5xjkjcv7m6d4gth45jvtnjqhj3l6\"}\r\n"

MODIFY
WalletWasabi.Tests/UnitTests/Hwi/MockedDeviceTests.cs
WalletWasabi.Tests/UnitTests/Hwi/MockedDeviceTests.cs
@@ -29,14 +29,14 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
[MemberData(nameof(GetDifferentNetworkValues))]
public async Task TrezorTMockTestsAsync(Network network)
{
- var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.TrezorT));
+ var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.Trezor_T));
using (var cts = new CancellationTokenSource(ReasonableRequestTimeout))
{
IEnumerable<HwiEnumerateEntry> enumerate = await client.EnumerateAsync(cts.Token);
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
- Assert.Equal(HardwareWalletVendors.Trezor, entry.Type);
+ Assert.Equal(HardwareWalletModels.Trezor_T, entry.Type);
Assert.Equal("webusb: 001:4", entry.Path);
Assert.False(entry.NeedsPassphraseSent);
Assert.False(entry.NeedsPinSent);
@@ -105,14 +105,14 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
[MemberData(nameof(GetDifferentNetworkValues))]
public async Task TrezorOneMockTestsAsync(Network network)
{
- var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.TrezorOne));
+ var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.Trezor_1));
using (var cts = new CancellationTokenSource(ReasonableRequestTimeout))
{
IEnumerable<HwiEnumerateEntry> enumerate = await client.EnumerateAsync(cts.Token);
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
- Assert.Equal(HardwareWalletVendors.Trezor, entry.Type);
+ Assert.Equal(HardwareWalletModels.Trezor_1, entry.Type);
string rawPath = "hid:\\\\\\\\?\\\\hid#vid_534c&pid_0001&mi_00#7&6f0b727&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}";
string normalizedPath = HwiParser.NormalizeRawDevicePath(rawPath);
Assert.Equal(normalizedPath, entry.Path);
@@ -181,14 +181,14 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
[MemberData(nameof(GetDifferentNetworkValues))]
public async Task ColdCardMk1MockTestsAsync(Network network)
{
- var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.ColdcardMk1));
+ var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.Coldcard));
using (var cts = new CancellationTokenSource(ReasonableRequestTimeout))
{
IEnumerable<HwiEnumerateEntry> enumerate = await client.EnumerateAsync(cts.Token);
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
- Assert.Equal(HardwareWalletVendors.Coldcard, entry.Type);
+ Assert.Equal(HardwareWalletModels.Coldcard, entry.Type);
string rawPath = "\\\\\\\\?\\\\hid#vid_d13e&pid_cc10&mi_00#7&1b239988&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}";
string normalizedPath = HwiParser.NormalizeRawDevicePath(rawPath);
Assert.Equal(normalizedPath, entry.Path);
@@ -270,14 +270,14 @@ namespace WalletWasabi.Tests.UnitTests.Hwi
[MemberData(nameof(GetDifferentNetworkValues))]
public async Task LedgerNanoSTestsAsync(Network network)
{
- var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.LedgerNanoS));
+ var client = new HwiClient(network, new HwiProcessBridgeMock(HardwareWalletModels.Ledger_Nano_S));
using (var cts = new CancellationTokenSource(ReasonableRequestTimeout))
{
IEnumerable<HwiEnumerateEntry> enumerate = await client.EnumerateAsync(cts.Token);
Assert.Single(enumerate);
HwiEnumerateEntry entry = enumerate.Single();
- Assert.Equal(HardwareWalletVendors.Ledger, entry.Type);
+ Assert.Equal(HardwareWalletModels.Ledger_Nano_S, entry.Type);
Assert.Equal(@"\\?\hid#vid_2c97&pid_0001&mi_00#7&e45ae20&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}", entry.Path);
Assert.False(entry.NeedsPassphraseSent);
Assert.False(entry.NeedsPinSent);

MODIFY
WalletWasabi/Hwi/HwiClient.cs
WalletWasabi/Hwi/HwiClient.cs
@@ -65,13 +65,13 @@ namespace WalletWasabi.Hwi
}
}
- public async Task PromptPinAsync(HardwareWalletVendors deviceType, string devicePath, CancellationToken cancel)
+ public async Task PromptPinAsync(HardwareWalletModels deviceType, string devicePath, CancellationToken cancel)
=> await PromptPinImplAsync(deviceType, devicePath, null, cancel);
public async Task PromptPinAsync(HDFingerprint fingerprint, CancellationToken cancel)
=> await PromptPinImplAsync(null, null, fingerprint, cancel);
- private async Task PromptPinImplAsync(HardwareWalletVendors? deviceType, string devicePath, HDFingerprint? fingerprint, CancellationToken cancel)
+ private async Task PromptPinImplAsync(HardwareWalletModels? deviceType, string devicePath, HDFingerprint? fingerprint, CancellationToken cancel)
{
await SendCommandAsync(
options: BuildOptions(deviceType, devicePath, fingerprint),
@@ -81,13 +81,13 @@ namespace WalletWasabi.Hwi
cancel).ConfigureAwait(false);
}
- public async Task SendPinAsync(HardwareWalletVendors deviceType, string devicePath, int pin, CancellationToken cancel)
+ public async Task SendPinAsync(HardwareWalletModels deviceType, string devicePath, int pin, CancellationToken cancel)
=> await SendPinImplAsync(deviceType, devicePath, null, pin, cancel);
public async Task SendPinAsync(HDFingerprint fingerprint, int pin, CancellationToken cancel)
=> await SendPinImplAsync(null, null, fingerprint, pin, cancel);
- private async Task SendPinImplAsync(HardwareWalletVendors? deviceType, string devicePath, HDFingerprint? fingerprint, int pin, CancellationToken cancel)
+ private async Task SendPinImplAsync(HardwareWalletModels? deviceType, string devicePath, HDFingerprint? fingerprint, int pin, CancellationToken cancel)
{
await SendCommandAsync(
options: BuildOptions(deviceType, devicePath, fingerprint),
@@ -97,13 +97,13 @@ namespace WalletWasabi.Hwi
cancel).ConfigureAwait(false);
}
- public async Task<ExtPubKey> GetXpubAsync(HardwareWalletVendors deviceType, string devicePath, KeyPath keyPath, CancellationToken cancel)
+ public async Task<ExtPubKey> GetXpubAsync(HardwareWalletModels deviceType, string devicePath, KeyPath keyPath, CancellationToken cancel)
=> await GetXpubImplAsync(deviceType, devicePath, null, keyPath, cancel);
public async Task<ExtPubKey> GetXpubAsync(HDFingerprint fingerprint, KeyPath keyPath, CancellationToken cancel)
=> await GetXpubImplAsync(null, null, fingerprint, keyPath, cancel);
- private async Task<ExtPubKey> GetXpubImplAsync(HardwareWalletVendors? deviceType, string devicePath, HDFingerprint? fingerprint, KeyPath keyPath, CancellationToken cancel)
+ private async Task<ExtPubKey> GetXpubImplAsync(HardwareWalletModels? deviceType, string devicePath, HDFingerprint? fingerprint, KeyPath keyPath, CancellationToken cancel)
{
string keyPathString = keyPath.ToString(true, "h");
var response = await SendCommandAsync(
@@ -118,13 +118,13 @@ namespace WalletWasabi.Hwi
return extPubKey;
}
- public async Task<BitcoinWitPubKeyAddress> DisplayAddressAsync(HardwareWalletVendors deviceType, string devicePath, KeyPath keyPath, CancellationToken cancel)
+ public async Task<BitcoinWitPubKeyAddress> DisplayAddressAsync(HardwareWalletModels deviceType, string devicePath, KeyPath keyPath, CancellationToken cancel)
=> await DisplayAddressImplAsync(deviceType, devicePath, null, keyPath, cancel);
public async Task<BitcoinWitPubKeyAddress> DisplayAddressAsync(HDFingerprint fingerprint, KeyPath keyPath, CancellationToken cancel)
=> await DisplayAddressImplAsync(null, null, fingerprint, keyPath, cancel);
- private async Task<BitcoinWitPubKeyAddress> DisplayAddressImplAsync(HardwareWalletVendors? deviceType, string devicePath, HDFingerprint? fingerprint, KeyPath keyPath, CancellationToken cancel)
+ private async Task<BitcoinWitPubKeyAddress> DisplayAddressImplAsync(HardwareWalletModels? deviceType, string devicePath, HDFingerprint? fingerprint, KeyPath keyPath, CancellationToken cancel)
{
var response = await SendCommandAsync(
options: BuildOptions(deviceType, devicePath, fingerprint),
@@ -140,13 +140,13 @@ namespace WalletWasabi.Hwi
return address;
}
- public async Task<PSBT> SignTxAsync(HardwareWalletVendors deviceType, string devicePath, PSBT psbt, CancellationToken cancel)
+ public async Task<PSBT> SignTxAsync(HardwareWalletModels deviceType, string devicePath, PSBT psbt, CancellationToken cancel)
=> await SignTxImplAsync(deviceType, devicePath, null, psbt, cancel);
public async Task<PSBT> SignTxAsync(HDFingerprint fingerprint, PSBT psbt, CancellationToken cancel)
=> await SignTxImplAsync(null, null, fingerprint, psbt, cancel);
- private async Task<PSBT> SignTxImplAsync(HardwareWalletVendors? deviceType, string devicePath, HDFingerprint? fingerprint, PSBT psbt, CancellationToken cancel)
+ private async Task<PSBT> SignTxImplAsync(HardwareWalletModels? deviceType, string devicePath, HDFingerprint? fingerprint, PSBT psbt, CancellationToken cancel)
{
var psbtString = psbt.ToBase64();
@@ -167,7 +167,7 @@ namespace WalletWasabi.Hwi
return signedPsbt;
}
- public async Task WipeAsync(HardwareWalletVendors deviceType, string devicePath, CancellationToken cancel)
+ public async Task WipeAsync(HardwareWalletModels deviceType, string devicePath, CancellationToken cancel)
{
await SendCommandAsync(
options: BuildOptions(deviceType, devicePath, null),
@@ -177,7 +177,7 @@ namespace WalletWasabi.Hwi
cancel).ConfigureAwait(false);
}
- public async Task SetupAsync(HardwareWalletVendors deviceType, string devicePath, bool openConsole, CancellationToken cancel)
+ public async Task SetupAsync(HardwareWalletModels deviceType, string devicePath, bool openConsole, CancellationToken cancel)
{
await SendCommandAsync(
options: BuildOptions(deviceType, devicePath, null, HwiOption.Interactive),
@@ -187,7 +187,7 @@ namespace WalletWasabi.Hwi
cancel).ConfigureAwait(false);
}
- public async Task RestoreAsync(HardwareWalletVendors deviceType, string devicePath, bool openConsole, CancellationToken cancel)
+ public async Task RestoreAsync(HardwareWalletModels deviceType, string devicePath, bool openConsole, CancellationToken cancel)
{
await SendCommandAsync(
options: BuildOptions(deviceType, devicePath, null, HwiOption.Interactive),
@@ -247,7 +247,7 @@ namespace WalletWasabi.Hwi
}
}
- private static HwiOption[] BuildOptions(HardwareWalletVendors? deviceType, string devicePath, HDFingerprint? fingerprint, params HwiOption[] extraOptions)
+ private static HwiOption[] BuildOptions(HardwareWalletModels? deviceType, string devicePath, HDFingerprint? fingerprint, params HwiOption[] extraOptions)
{
var options = new List<HwiOption>();

MODIFY
WalletWasabi/Hwi/Models/HardwareWalletModels.cs
WalletWasabi/Hwi/Models/HardwareWalletModels.cs
@@ -4,17 +4,22 @@ using System.Text;
namespace WalletWasabi.Hwi.Models
{
+ /// <summary>
+ /// https://github.com/bitcoin-core/HWI/pull/228
+ /// </summary>
public enum HardwareWalletModels
{
- TrezorOne,
- TrezorT,
- ColdcardMk1,
- ColdcardMk2,
- LedgerNano,
- LedgerNanoS,
- LedgerNanoX,
+ Unknown,
+ Coldcard,
+ Coldcard_Simulator,
+ DigitalBitBox_01,
+ DigitalBitBox_01_Simulator,
KeepKey,
- DigitalBitBox1,
- DigitalBitBix2
+ KeepKey_Simulator,
+ Ledger_Nano_S,
+ Trezor_1,
+ Trezor_1_Simulator,
+ Trezor_T,
+ Trezor_T_Simulator,
}
}

DELETE
WalletWasabi/Hwi/Models/HardwareWalletVendors.cs
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace WalletWasabi.Hwi.Models
-{
- public enum HardwareWalletVendors
- {
- Unknown,
- Trezor,
- Coldcard,
- Ledger,
- KeepKey,
- DigitalBitBox,
- }
-}

MODIFY
WalletWasabi/Hwi/Models/HwiEnumerateEntry.cs
WalletWasabi/Hwi/Models/HwiEnumerateEntry.cs
@@ -9,7 +9,7 @@ namespace WalletWasabi.Hwi.Models
{
public class HwiEnumerateEntry
{
- public HardwareWalletVendors Type { get; }
+ public HardwareWalletModels Type { get; }
public string Path { get; }
public string SerialNumber { get; }
public HDFingerprint? Fingerprint { get; }
@@ -26,7 +26,7 @@ namespace WalletWasabi.Hwi.Models
}
public HwiEnumerateEntry(
- HardwareWalletVendors type,
+ HardwareWalletModels type,
string path,
string serialNumber,
HDFingerprint? fingerprint,

MODIFY
WalletWasabi/Hwi/Models/HwiOption.cs
WalletWasabi/Hwi/Models/HwiOption.cs
@@ -15,7 +15,7 @@ namespace WalletWasabi.Hwi.Models
return new HwiOption(HwiOptions.DevicePath, devicePath);
}
- public static HwiOption DeviceType(HardwareWalletVendors deviceType) => new HwiOption(HwiOptions.DeviceType, deviceType.ToHwiFriendlyString());
+ public static HwiOption DeviceType(HardwareWalletModels deviceType) => new HwiOption(HwiOptions.DeviceType, deviceType.ToHwiFriendlyString());
public static HwiOption Debug => new HwiOption(HwiOptions.Debug);

MODIFY
WalletWasabi/Hwi/Parsers/HwiParser.cs
WalletWasabi/Hwi/Parsers/HwiParser.cs
@@ -116,9 +116,9 @@ namespace WalletWasabi.Hwi.Parsers
return false;
}
- public static bool TryParseHardwareWalletVendor(JToken token, out HardwareWalletVendors vendor)
+ public static bool TryParseHardwareWalletVendor(JToken token, out HardwareWalletModels vendor)
{
- vendor = HardwareWalletVendors.Unknown;
+ vendor = HardwareWalletModels.Unknown;
if (token is null)
{
@@ -128,7 +128,7 @@ namespace WalletWasabi.Hwi.Parsers
try
{
var typeString = token.Value<string>();
- if (Enum.TryParse(typeString, ignoreCase: true, out HardwareWalletVendors t))
+ if (Enum.TryParse(typeString, ignoreCase: true, out HardwareWalletModels t))
{
vendor = t;
return true;
@@ -252,8 +252,8 @@ namespace WalletWasabi.Hwi.Parsers
errorString = err.Message;
}
- HardwareWalletVendors type = HardwareWalletVendors.Unknown;
- if (TryParseHardwareWalletVendor(typeToken, out HardwareWalletVendors t))
+ HardwareWalletModels type = HardwareWalletModels.Unknown;
+ if (TryParseHardwareWalletVendor(typeToken, out HardwareWalletModels t))
{
type = t;
}
@@ -379,7 +379,7 @@ namespace WalletWasabi.Hwi.Parsers
return arguments;
}
- public static string ToHwiFriendlyString(this HardwareWalletVendors me)
+ public static string ToHwiFriendlyString(this HardwareWalletModels me)
{
return me.ToString().ToLowerInvariant();
}

Update new device models