@@ -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