containsParameter('peer')) { return $rpcRequest->produceError(StandardError::RPC_INVALID_ARGUMENTS, 'Missing required peer parameter'); } try { $address = PeerAddress::fromAddress($rpcRequest->getParameter('peer')); } catch(InvalidArgumentException $e) { throw new StandardRpcException('Invalid peer address', StandardError::RPC_INVALID_ARGUMENTS, $e); } try { if(!ContactManager::isContact($request->getPeer(), $address)) { return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Contact does not exist'); } $contact = ContactManager::getContact($request->getPeer(), $address); } catch(DatabaseOperationException $e) { throw new StandardRpcException('Failed to get contact', StandardError::INTERNAL_SERVER_ERROR, $e); } return $rpcRequest->produceResponse($contact->toStandard()); } }