【发布时间】:2022-07-01 02:58:55
【问题描述】:
我正在使用walletconnect_dart 包将我的 Flutter 应用程序连接到 MetaMask,它工作正常。但我希望用户在 MetaMask 中签署消息并获得签名。我如何在 Flutter 中做到这一点?
【问题讨论】:
标签: flutter metamask wallet-connect
我正在使用walletconnect_dart 包将我的 Flutter 应用程序连接到 MetaMask,它工作正常。但我希望用户在 MetaMask 中签署消息并获得签名。我如何在 Flutter 中做到这一点?
【问题讨论】:
标签: flutter metamask wallet-connect
这是您的解决方案
ElevatedButton signMessage() {
return ElevatedButton(
onPressed: () async {
String? signmessage = "Sign Message";
List<String?> params = [walletAddress, signmessage];
String method = "personal_sign";
await launchUrl(Uri.parse(walletConnect.session.toUri()),
mode: LaunchMode.externalApplication);
final _signature = await walletConnect.sendCustomRequest(
method: method,
params: params,
);
print( _signature);
},
child: const Text("SIGN MESSAGE"));}
【讨论】: