createGroupV2OptionsValidator function
Implementation
void createGroupV2OptionsValidator({required ChatCreateGroupTypeV2 options}) {
if (options.groupName.isEmpty) {
throw Exception('groupName cannot be null or empty');
}
if (options.groupName.length > 50) {
throw Exception('groupName cannot be more than 50 characters');
}
if (options.groupDescription.length > 150) {
throw Exception('groupDescription cannot be more than 150 characters');
}
for (int i = 0; i < options.members.length; i++) {
if (!isValidETHAddress(options.members[i])) {
throw Exception('Invalid member address!');
}
}
for (int i = 0; i < options.admins.length; i++) {
if (!isValidETHAddress(options.admins[i])) {
throw Exception('Invalid admin address!');
}
}
validateScheduleDates(
scheduleAt: options.config.scheduleAt,
scheduleEnd: options.config.scheduleEnd);
}