subscribeEvents method
void
subscribeEvents({})
Implementation
void subscribeEvents({
required Function(Map) onPairing,
required Function(Map) onPaired,
required Function(Map) onCallRequest,
required Function(String) onDisconnect,
String? uri,
bool isV2 = false,
}) {
serviceRoot.webView!
.addMsgHandler("wallet_connect_message${isV2 ? '_v2' : ''}", (data) {
final event = data['event'];
switch (event) {
case 'session_request':
case 'session_proposal':
onPairing(data);
break;
case 'connect':
onPaired(data['session']);
break;
case 'call_request':
onCallRequest(data);
break;
case 'disconnect':
onDisconnect(uri == null ? data['topic'] : uri);
break;
}
});
}