MetaMask / metamask-android-sdk

MetaMask SDK for Android
Other
47 stars 13 forks source link

[Bug]: RequestError(code=-32603, message=JSON Parse error: Unexpected token: Y)), Exception, Cause: null, Stacktrace: java.lang.Exception: Error(error=RequestError(code=-32603, message=JSON Parse error: Unexpected token: Y)) #90

Closed philos3 closed 9 months ago

philos3 commented 9 months ago

Provide environment information

flutter doctor -v [✓] Flutter (Channel stable, 3.13.9, on macOS 14.3 23D56 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.13.9 on channel stable at /Users/XXXX/fvm/versions/3.13.9 • Upstream repository https://github.com/flutter/flutter.git • Framework revision d211f42860 (3 months ago), 2023-10-25 13:42:25 -0700 • Engine revision 0545f8705d • Dart version 3.1.5 • DevTools version 2.25.0 • Pub download mirror https://pub.flutter-io.cn • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/XXXX/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.12.0

[✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.85.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.80.0

[✓] Connected device (2 available) • SM F936U1 (mobile) • RFCTA0BR6DM • android-arm64 • Android 13 (API 33) • macOS (desktop) • macos • darwin-arm64 • macOS 14.3 23D56 darwin-arm64

[✓] Network resources • All expected network resources are available.

• No issues found!

MetaMask Android SDK Version

'io.metamask.androidsdk:metamask-android-sdk:0.4.0'

MetaMask Mobile app Version

v7.12.3(1230)

Android Version

android 13

Describe the Bug

I/flutter (26883): PlatformException(java.lang.Exception: Error(error=RequestError(code=-32603, message=JSON Parse error: Unexpected token: Y)), Exception, Cause: null, Stacktrace: java.lang.Exception: Error(error=RequestError(code=-32603, message=JSON Parse error: Unexpected token: Y)) I/flutter (26883): at com.example.wallet.metamask.MetamaskApiImpl.lambda$signMessageMetamask$6(MetamaskApiImpl.java:202) I/flutter (26883): at com.example.wallet.metamask.MetamaskApiImpl$$ExternalSyntheticLambda8.invoke(Unknown Source:4) I/flutter (26883): at io.metamask.androidsdk.Ethereum$sendRequest$2.invoke(Ethereum.kt:233) I/flutter (26883): at io.metamask.androidsdk.Ethereum$sendRequest$2.invoke(Ethereum.kt:232) I/flutter (26883): at io.metamask.androidsdk.CommunicationClient.completeRequest(CommunicationClient.kt:307) I/flutter (26883): at io.metamask.androidsdk.CommunicationClient.handleError(CommunicationClient.kt:298) I/flutter (26883): at io.metamask.androidsdk.CommunicationClient.handleResponse(CommunicationClient.kt:191) I/flutter (26883): at io.metamask.androidsdk.CommunicationClient.handleMessage(CommunicationClient.kt:151) I/flutter (26883): at io.metamask.androidsdk.CommunicationClient.access$handleMessage(CommunicationClient.kt:18) I/flutter (26883): at io.metamask.androidsdk.CommunicationClient$messageServiceCallback$1.onMessageReceived(CommunicationClient.kt:88) I/flutter (26883): at io.metamask.nativesdk.IMessegeServiceCallback$Stub.onTransact(IMessegeServiceCallback.java:68) I/flutter (26883): at android.os.Binder.execTransactInternal(Binder.java:1316) I/flutter (26883): at android.os.Binder.execTransact(Binder.java:1280) I/flutter (26883): , null)

Expected Behavior

no error throw, or tell me the right way to sign message

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

image

Ethereum:: Sending request EthereumRequest(id=1707279503363, method=eth_signTypedData_v4, params=[0x20db3528752ccbed13233ea2f86bd90dd54ea7e2, You are signing into Deepcoin, Only sign on: https://www.deepcoin.com nonce:1cd25bb2c8d500f8cc453f2bfc0d7af8])

CommunicationClient:: sending request EthereumRequest(id=1707279503363, method=eth_signTypedData_v4, params=[0x20db3528752ccbed13233ea2f86bd90dd54ea7e2, You are signing into Deepcoin, Only sign on: https://www.deepcoin.com nonce:1cd25bb2c8d500f8cc453f2bfc0d7af8])

please tell me why it throw RequestError(code=-32603, message=JSON Parse error: Unexpected token: Y))

philos3 commented 9 months ago
image

is message has format restrictions? what i want is to sign a text message,no verifyingContract or wallets account ,please tell me the right way to sign a text message

philos3 commented 9 months ago

use PERSONAL_SIGN solve the problem