rejectSession method

  1. @override
Future<void> rejectSession({
  1. required int id,
  2. required WalletConnectError reason,
})
override

Implementation

@override
Future<void> rejectSession({
  required int id,
  required WalletConnectError reason,
}) async {
  _checkInitialized();

  await _isValidReject(id, reason);

  ProposalData? proposal = proposals.get(id.toString());
  if (proposal != null) {
    // Attempt to send a response, if the pairing is not active, this will fail
    // but we don't care
    try {
      await core.pairing.sendError(
        id,
        proposal.pairingTopic,
        MethodConstants.WC_SESSION_PROPOSE,
        JsonRpcError.fromJson(
          reason.toJson(),
        ),
      );
    } catch (_) {
      // print('got here');
    }
  }
  await _deleteProposal(id);
}