sendResult method
Future
sendResult(
- int id,
- String topic,
- String method,
- dynamic result, {
- EncodeOptions? encodeOptions,
- String? appLink,
override
Implementation
@override
Future<dynamic> sendResult(
int id,
String topic,
String method,
dynamic result, {
EncodeOptions? encodeOptions,
String? appLink,
}) async {
final payload = JsonRpcUtils.formatJsonRpcResponse<dynamic>(
id,
result,
);
final String? message = await core.crypto.encode(
topic,
payload,
options: encodeOptions,
);
if (message == null) {
return;
}
core.logger.d(
'[$runtimeType] sendRequest appLink: $appLink, '
'id: $id topic: $topic, method: $method, result: $result',
);
if ((appLink ?? '').isNotEmpty) {
final redirectURL = ReownCoreUtils.getLinkModeURL(
appLink!,
topic,
message,
);
await ReownCoreUtils.openURL(redirectURL);
} else {
final RpcOptions opts = MethodConstants.RPC_OPTS[method]!['res']!;
await core.relayClient.publish(
topic: topic,
message: message,
ttl: opts.ttl,
tag: opts.tag,
);
}
}