Closed mthinh closed 5 months ago
Hello @mthinh, can I see your implementation?
Future<String?> personalSign({
required String message,
required String wallet,
String? chainId,
}) async {
await _w3mService.launchConnectedWallet();
if (_w3mService.session?.sessionService.isCoinbase == true) {
final data = await _w3mService.cbRequest(
chainId: chainId ?? _currentWalletChainId ?? ETHEREUM.chainId,
request: SessionRequestParams(
method: 'personal_sign',
params: [message, wallet],
),
);
if (data is String) return data;
return null;
}
final data = await _app!.request(
topic: _w3mService.session?.topic ?? '',
chainId: chainId ?? _currentWalletChainId ?? ETHEREUM.chainId,
request: SessionRequestParams(
method: 'personal_sign',
params: [message, wallet],
),
);
if (data is String) return data;
return null;
}
Thanks @quetool , I just found out that we always have cbRequest method to handle coinbase case
cbRequest shouldn't be used and it will be deprecated soon. Let me take a look at your code.
This is what you need to do. I added some explanatory comments.
Future<String?> personalSign({
required String message,
required String wallet,
}) async {
_w3mService.launchConnectedWallet(); // you don't have to await this method
// not sure why you used `_app!.request()` here, what is _app?
final data = await _w3mService!.request(
topic: _w3mService.session?.topic ?? '',
// chainId chas to be always the current selected chain, otherwise request might not work on several wallets if the chain was not approved.
chainId: _w3mService.selectedChain!.chainId,
request: SessionRequestParams(
method: 'personal_sign',
params: [message, wallet],
),
);
if (data is String) return data;
return null;
}
cool, thanks, let me try to @quetool
Hi @quetool , btw, you got any idea on Coinbase side ? I tried to sign a transaction, but always facing the error saying Something went wrong
Here is my code
Future<String> requestTransaction({
required String chainId,
required EthereumTransaction transaction,
}) async {
_w3mService.launchConnectedWallet();
final transactionId = await _w3mService.request(
topic: _w3mService.session?.topic ?? '',
chainId: chainId,
request: SessionRequestParams(
method: 'eth_sendTransaction',
params: [
transaction.copyWith(data: transaction.data ?? '').toJson(),
],
),
);
return transactionId;
}
This is something on Coinbase side. Anyway this is not a personal_sign
, right? Did the personal_sign
example work? Any chance you can share the code for this transaction issue? I'm pretty sure it might be something wrong in the transaction object that Coinbase can't part properly.
@quetool , this is the code to make a transaction request, it works with other wallet (metamask, etc,..) but coinbase. Btw, sign transaction is working now. Thanks
Wonderful! Would be interesting if you could share the transaction object so I could debug and report to Coinbase if the issue is on their side
Hi @quetool , this is how transaction object looks like
And is this not working? The only thing I see is the missing 0x
in the hex representation of the value but that shouldn't be an issue. It is weird anyway that is not added if you are using .toJson()
method from our package
Please remove the copyWith(data: transaction.data ?? '')
from transaction and try again.
If I remove it, will face this error, cause data is required as string
btw, Im using eth sepolia to test , also try data = 0x0
but no luck
Seems like you are using and old version of our package. Could you please update to web3modal_flutter: ^3.2.2
?
@quetool yes. currently using 3.1.2
cause I dont see any differences between 3.1.2 and 3.2.2 in term of coinbase stuff
But there are :) You can check coinbase_service here https://github.com/WalletConnect/Web3ModalFlutter/blob/master/lib/services/coinbase_service/coinbase_service.dart#L222
Several other bug fixes and new features were made in following versions https://pub.dev/packages/web3modal_flutter/changelog
I would totally update if I were you :)
@quetool sure ah, thanks, let me update and retry
Thanks @quetool , I can see transaction confirmation popup now. Thanks a lot for your great help 🙏
Wonderful! I'll close the issue then! Thanks!
Describe the bug I was able to connect coinbase, but cannot request a message signed The error keeps saying
"No matching key. session topic doesn't exist:
And I found out that cause we are connecting to coinbase data which does not contain topicI'm currently using v.3.1.2
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.