register method

  1. @override
void register({
  1. required String method,
  2. required dynamic function(
    1. String,
    2. JsonRpcRequest, [
    3. TransportType
    ]),
  3. required ProtocolType type,
})
override

Implementation

@override
void register({
  required String method,
  required Function(String, JsonRpcRequest, [TransportType]) function,
  required ProtocolType type,
}) {
  if (routerMapRequest.containsKey(method)) {
    final registered = routerMapRequest[method];
    if (registered!.type == type) {
      throw const ReownCoreError(
        code: -1,
        message: 'Method already exists',
      );
    }
  }

  routerMapRequest[method] = RegisteredFunction(
    method: method,
    function: function,
    type: type,
  );
}