mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
Use broader matching on HWI wallet types (eg bitbox02_btconly)
This commit is contained in:
parent
8d413e839c
commit
87fe0accd5
1 changed files with 11 additions and 1 deletions
|
@ -535,7 +535,17 @@ public class Hwi {
|
||||||
private static class DeviceModelDeserializer implements JsonDeserializer<WalletModel> {
|
private static class DeviceModelDeserializer implements JsonDeserializer<WalletModel> {
|
||||||
@Override
|
@Override
|
||||||
public WalletModel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
public WalletModel deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||||
return WalletModel.valueOf(json.getAsJsonPrimitive().getAsString().toUpperCase());
|
String modelStr = json.getAsJsonPrimitive().getAsString();
|
||||||
|
try {
|
||||||
|
return WalletModel.valueOf(modelStr.toUpperCase());
|
||||||
|
} catch(Exception e) {
|
||||||
|
for(WalletModel model : WalletModel.values()) {
|
||||||
|
if(modelStr.startsWith(model.getType())) {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Could not determine wallet model for " + modelStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue