Open devsideal opened 1 year ago
Hi, we seem to have a similar issue. In my case the transfer of tokens via my erc721 compatible contract deployed on Polygon started to fail after having to migrate to WalletConnect v2 in our Flutter dApp. See https://github.com/orgs/WalletConnect/discussions/3094 and https://stackoverflow.com/questions/76788918/walletconnect-migration-issue-failed-to-execute-eth-sendtransaction-requests. I am not sure about the proper way to convert the parameters to json but that does not seem to be the cause of the issue. I would be eager to learn about your findings and progress on the matter. Perhaps we could team-up.
+1 have the same problem from the last week.
@devsideal
await launchUrl(Uri.parse("$wcUriPrefix$_encodedWcUrl"
If you are sending a transaction on an established wallet connect pairing session, you only need to launch the wallet with the redirect link (i.e. native: metamask:// ) . If you include the original encoded WalletConnect pairing URI, you are attempting to create a new session with a duplicate seed. (Right before you send a transaction ... )
FYI : I am working on some interop and troubleshooting pointers here: https://gitlab.com/graflr/flutter_web3_demo/-/wikis/WalletConnect-Interop
@devsideal
await launchUrl(Uri.parse("$wcUriPrefix$_encodedWcUrl"
If you are sending a transaction on an established wallet connect pairing session, you only need to launch the wallet with the redirect link (i.e. native: metamask:// ) . If you include the original encoded WalletConnect pairing URI, you are attempting to create a new session with a duplicate seed. (Right before you send a transaction ... )
FYI : I am working on some interop and troubleshooting pointers here: https://gitlab.com/graflr/flutter_web3_demo/-/wikis/WalletConnect-Interop
Not working getting same error.
@devsideal - I can't offer more given what you have posted.
You can look at my demo app https://gitlab.com/graflr/flutter_web3_demo and the wiki pages on that site.
If you go the route of using a class WalletConnectEip155Credentials that extends the web3dart CustomTransactionSender, you can likely avoid the need to manually create the Transaction.callContract (which I suspect is causing you trouble.)
Peek at: lib/model/wallet_connect_eip155_credential.dart lib/logic/token_contract.dart. // includes logs of the app running a transaction
@devsideal
I was able to reproduce what I think you saw. To confirm:
This is going to take more context to track down. As I have only seen this once. Do you have any of these in common?
Curious if this is a startup, initialization issue. But I won't have time to look at it further for a few days. There is also a good possibility this is on the Metamask side since the same message works other times.
I believe it's a MetaMask issue.
I created an example of signing a smart contract interaction transaction. It fails on MetaMask, but it succeeds on TrustWallet.
@Luzzotica - I found sending a stale session ID (i.e. expired) to signEngine.request can cause this error. (I am sure there are more ways...)
Should the app check for expired sessions or should the library catch & correct this before sending it to Metamask?
I see you can use WalletConnectUtils.isExpired(sessionData.expiry) to check expired. What do you call for an existing pairing to re-establish a new signing session?
/// 987ce182a2ad35d1899cb2af83f2aff82712a571c3571d5804814de5158279bf is the stale sessioin Topic
flutter: 09:01:48 π‘ HomePage - _onInitDone
flutter: 09:02:14 π WalletConnctSvc - =Core Services wc: v2, relayUrl: wss://relay.walletconnect.com, pushUrl: https://echo.walletconnect.com, uptime: 26 seconds=
flutter: 09:02:14 π WalletConnctSvc - ==Pairings (1)==
flutter: 09:02:14 π WalletConnctSvc - 22.0861 days topic: 0a98bd9400fa3f84833282c3b8161943cbae80b5c60266943db86b833859cd5c, relay: irn, active: true, peer: MetaMask Wallet, redirect native: metamask://, redirect universal: https://metamask.app.link/
flutter: 09:02:19 π WalletConnctSvc - =Sign Client Info - (wc v2)=
flutter: 09:02:19 π WalletConnctSvc - ==Sign Client Sessions (1)==
flutter: 09:02:19 π WalletConnctSvc - <expired> topic: 987ce182a2ad35d1899cb2af83f2aff82712a571c3571d5804814de5158279bf, pairing topic: 0a98bd9400fa3f84833282c3b8161943cbae80b5c60266943db86b833859cd5c ack: true,
peer name: MetaMask Wallet accounts: [ eip155:137:0x72A4408DA42DE870499c1841D0e4a49f864e34ba, eip155:80001:0x72A4408DA42DE870499c1841D0e4a49f864e34ba ] sessionProperties: null
flutter: 09:02:19 π WalletConnctSvc - ==Sign Client Proposals (0)==
flutter: 09:02:19 π WalletConnctSvc - No proposals.
flutter: 09:02:29 π HomePage - Navigate to Token Test Page.
flutter: 09:02:29 π TokenContract - Token constructor called with contract address Mumbai 0xBd08...9aF1
flutter: 09:02:29 π‘ TokenContract - init - contractAddress Mumbai 0xBd08...9aF1, web3NodeProviderUrl: https://polygon-mumbai.infura.io/v3 (redacted)
flutter: 09:02:33 π TokenContract - Contract owner: 0x72a4408da42de870499c1841d0e4a49f864e34ba
flutter: 09:02:33 π WalletConnctSvc - getEip155Credentials - blockchainAccount: Mumbai 0x72a4...34ba, sessionTopic: 987ce182a2ad35d1899cb2af83f2aff82712a571c3571d5804814de5158279bf
flutter: 09:02:33 π TokenContract - transfer - to: Mumbai 0x7Fd6...b0b1, amount: 10, from: 0x72a4408da42de870499c1841d0e4a49f864e34ba
flutter: WalletConnectEip155Credentials: sendTransaction - transaction: {from: null, to: 0xbd08b78ec1fe51e9b5db03657c637e8b18379af1, maxGas: null, gasPrice: null, value: null, nonce: null, maxFeePerGas: null, maxPriorityFeePerGas: null}
transaction.data in bytes: [ a9 05 9c bb 00 00 00 00 00 00 00 00 00 00 00 00 7f d6 11 af 09 be fb 5f 47 ab b1 9f cc 25 a2 29 97 ae b0 b1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0a ]
flutter: WalletConnectEip155Credentials: sendTransaction - blockchain eip155:80001, sessionRequestParams: {method: eth_sendTransaction, params: [{from: 0x72a4408da42de870499c1841d0e4a49f864e34ba, to: 0xbd08b78ec1fe51e9b5db03657c637e8b18379af1, data: a9059cbb0000000000000000000000007fd611af09befb5f47abb19fcc25a22997aeb0b1000000000000000000000000000000000000000000000000000000000000000a}]}
flutter: 09:02:33 π WalletConnctSvc - getWalletLaunchUri - for pairingTopic or sessionTopic 987ce182a2ad35d1899cb2af83f2aff82712a571c3571d5804814de5158279bf, return universal link: false
flutter: \^[[38;5;244mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ<β¦>
flutter: \^[[38;5;244mβ #0 Pairing.sendRequest (package:walletconnect_flutter_v2/apis/core/pairing/pairing.dart:388:17)<β¦>
flutter: \^[[38;5;244mβ #1 SignEngine.request (package:walletconnect_flutter_v2/apis/sign_api/sign_engine.dart:471:31)<β¦>
flutter: \^[[38;5;244mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ<β¦>
flutter: \^[[38;5;244mβ pairing sendResult, id: null topic: 987ce182a2ad35d1899cb2af83f2aff82712a571c3571d5804814de5158279bf, method: wc_sessionRequest, params: WcSessionRequestRequest(chainId: eip155:80001, request: SessionRequestParams(method: eth_sendTransaction, params: [{from: 0x72a4408da42de870499c1841d0e4a49f864e34ba, to: 0xbd08b78ec1fe51e9b5db03657c637e8b18379af1, data: a9059cbb0000000000000000000000007fd611af09befb5f47abb19fcc25a22997aeb0b1000000000000000000000000000000000000000000000000000000000000000a}])), ttl: null<β¦>
flutter: \^[[38;5;244mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ<β¦>
flutter: 09:02:33 π HomePage - AppLifecycleState: AppLifecycleState.inactive.
flutter: 09:02:34 π HomePage - AppLifecycleState: AppLifecycleState.hidden.
I am also facing this issue
Hello @Mash-Woo (and anyone else), do you still need help here?
@devsideal - I can't offer more given what you have posted.
You can look at my demo app https://gitlab.com/graflr/flutter_web3_demo and the wiki pages on that site.
If you go the route of using a class WalletConnectEip155Credentials that extends the web3dart CustomTransactionSender, you can likely avoid the need to manually create the Transaction.callContract (which I suspect is causing you trouble.)
Peek at: lib/model/wallet_connect_eip155_credential.dart lib/logic/token_contract.dart. // includes logs of the app running a transaction
Can you update your demo? I config my projectID, But I cannot initialize the wallet normally and an Error when Running on iPhone
@FelixYin66 - I updated my demo project dependencies.
Note: I wasn't able to use the latest (0.1.0) web3dart_builders due to https://github.com/inveker/web3dart_builders/issues/12
When I'm calling a custom contract method to send transaction through metamask app, getting below error
Unhandled Exception: JsonRpcError(code: 5000, message: Internal JSON-RPC error.)
STR I have three step process like:
Step-1 is working fine when i click on Connect button its open the Metamask and i successfully received chain id and account address. But when i click on Approve button its open the Metamask app & show the Modal sheet with Approve and Reject buttons, when click on Approve It shows Internal JSON-RPC error alert as showing in screenshot:
My Code is:
Anyone, can you help me what's going wrong?