pub async fn create_relayer<J, RR, TR, NR, NFR, SR, TCR, PR>(
request: CreateRelayerRequest,
state: ThinDataAppState<J, RR, TR, NR, NFR, SR, TCR, PR>,
) -> Result<HttpResponse, ApiError>where
J: JobProducerTrait + Send + Sync + 'static,
RR: RelayerRepository + Repository<RelayerRepoModel, String> + Send + Sync + 'static,
TR: TransactionRepository + Repository<TransactionRepoModel, String> + Send + Sync + 'static,
NR: NetworkRepository + Repository<NetworkRepoModel, String> + Send + Sync + 'static,
NFR: Repository<NotificationRepoModel, String> + Send + Sync + 'static,
SR: Repository<SignerRepoModel, String> + Send + Sync + 'static,
TCR: TransactionCounterTrait + Send + Sync + 'static,
PR: PluginRepositoryTrait + Send + Sync + 'static,
Expand description
Creates a new relayer.
§Arguments
request
- The relayer creation request.state
- The application state containing the relayer repository.
§Returns
The created relayer or an error if creation fails.
§Validation
This endpoint performs comprehensive dependency validation before creating the relayer:
- Signer Validation: Ensures the specified signer exists in the system
- Signer Uniqueness: Validates that the signer is not already in use by another relayer on the same network
- Notification Validation: If a notification ID is provided, validates it exists
- Network Validation: Confirms the specified network exists for the given network type
All validations must pass before the relayer is created, ensuring referential integrity and security constraints.