validate method

  1. @override
void validate()

Validate the model.

Base implementation that does nothing. Subclasses should override this method to add their own validation logic.

Implementation

@override
void validate() {
  super.validate();
  validateRequired('signedTransaction', signedTransaction);
  validateRequired('requestId', requestId);

  // Validate base64 format for signed transaction
  try {
    final decoded = base64.decode(
      signedTransaction.replaceAll(RegExp(r'\s+'), ''),
    );
    if (decoded.isEmpty) {
      throw JupiterValidationException(
        'Invalid base64 transaction data',
        field: 'signedTransaction',
        constraints: {'format': 'base64'},
      );
    }
  } catch (e) {
    throw JupiterValidationException(
      'Invalid base64 transaction format',
      field: 'signedTransaction',
      error: e,
    );
  }

  // Validate request ID format (ensure it's not empty and has reasonable length)
  validateStringLength('requestId', requestId, minLength: 1, maxLength: 100);
}