approveSession method

dynamic approveSession({
  1. required List<String> accounts,
  2. int? chainId,
})

Implementation

approveSession({required List<String> accounts, int? chainId}) {
  if (_handshakeId <= 0) {
    throw HandshakeException();
  }

  if (chainId != null) _chainId = chainId;
  final result = WCApproveSessionResponse(
    chainId: _chainId,
    accounts: accounts,
    peerId: _peerId!,
    peerMeta: _peerMeta!,
  );
  final response = JsonRpcResponse<Map<String, dynamic>>(
    id: _handshakeId,
    result: result.toJson(),
  );
  // print('approveSession ${jsonEncode(response.toJson())}');
  onConnect?.call();
  _encryptAndSend(jsonEncode(response.toJson()));
}