Skip to content

Commit a7569f1

Browse files
authored
Merge pull request #26 from KeystoneHQ/release-fix
compitible with old signature
2 parents 2a061a7 + 632d670 commit a7569f1

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

app/src/main/java/com/keystone/cold/ui/fragment/main/EthTxFragment.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,30 +105,36 @@ private void updateUI() {
105105
}
106106

107107
private void showQrCode(JSONObject signed) {
108-
WatchWallet watchWallet = WatchWallet.getWatchWallet(mActivity);
109-
if (watchWallet.equals(WatchWallet.METAMASK)) {
110-
try {
108+
try {
109+
WatchWallet watchWallet = WatchWallet.getWatchWallet(mActivity);
110+
if (watchWallet.equals(WatchWallet.METAMASK)) {
111+
try {
112+
if (signed != null) {
113+
signed.remove("abi");
114+
signed.remove("chainId");
115+
byte[] signature = Hex.decode(signed.getString("signature"));
116+
UUID uuid = UUID.fromString(signed.getString("signId"));
117+
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
118+
byteBuffer.putLong(uuid.getMostSignificantBits());
119+
byteBuffer.putLong(uuid.getLeastSignificantBits());
120+
byte[] requestId = byteBuffer.array();
121+
EthSignature ethSignature = new EthSignature(signature, requestId);
122+
mBinding.qrcode.qrcode.setData(ethSignature.toUR().toString());
123+
}
124+
} catch (JSONException e) {
125+
e.printStackTrace();
126+
}
127+
} else {
111128
if (signed != null) {
112129
signed.remove("abi");
113130
signed.remove("chainId");
114-
byte[] signature = Hex.decode(signed.getString("signature"));
115-
UUID uuid = UUID.fromString(signed.getString("signId"));
116-
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
117-
byteBuffer.putLong(uuid.getMostSignificantBits());
118-
byteBuffer.putLong(uuid.getLeastSignificantBits());
119-
byte[] requestId = byteBuffer.array();
120-
EthSignature ethSignature = new EthSignature(signature, requestId);
121-
mBinding.qrcode.qrcode.setData(ethSignature.toUR().toString());
131+
mBinding.qrcode.qrcode.setData(Hex.toHexString(signed.toString().getBytes(StandardCharsets.UTF_8)));
122132
}
123-
} catch (JSONException e) {
124-
e.printStackTrace();
125-
}
126-
} else {
127-
if (signed != null) {
128-
signed.remove("abi");
129-
signed.remove("chainId");
130-
mBinding.qrcode.qrcode.setData(Hex.toHexString(signed.toString().getBytes(StandardCharsets.UTF_8)));
131133
}
134+
}catch (Exception e){
135+
signed.remove("abi");
136+
signed.remove("chainId");
137+
mBinding.qrcode.qrcode.setData(Hex.toHexString(signed.toString().getBytes(StandardCharsets.UTF_8)));
132138
}
133139
}
134140

0 commit comments

Comments
 (0)