@@ -604,6 +604,26 @@ const exportExitMessage = async () => {
604604 .filter ((item ) => item .validatorID === stakingStore .selectedServiceToFilter ? .config ? .serviceID )
605605 .map ((item ) => item .key );
606606
607+ // if there are more than 50 keys, split them into chunks of 50
608+ const chunkSize = 50 ;
609+ if (pubkeys .length > chunkSize) {
610+ let allResults = [];
611+ for (let i = 0 ; i < pubkeys .length ; i += chunkSize) {
612+ const chunk = pubkeys .slice (i, i + chunkSize);
613+ const results = await Promise .all (
614+ chunk .map (async (key ) => {
615+ return ControlService .getExitValidatorMessage ({
616+ pubkey: key,
617+ serviceID: stakingStore .selectedServiceToFilter .config ? .serviceID ,
618+ });
619+ })
620+ );
621+ allResults = allResults .concat (results);
622+ }
623+ saveExitMessage (allResults, " multiple" );
624+ return ;
625+ }
626+
607627 const results = await Promise .all (
608628 pubkeys .map (async (key ) => {
609629 return ControlService .getExitValidatorMessage ({
@@ -625,7 +645,9 @@ const saveExitMessage = (data, type) => {
625645 const unwrap = (entry ) => (entry && entry .data ? entry .data : entry);
626646
627647 const content =
628- type === " single" ? JSON .stringify (unwrap (data), null , 2 ) : data .map ((entry ) => JSON .stringify (unwrap (entry), null , 2 )).join (" \n\n " );
648+ type === " single"
649+ ? JSON .stringify (unwrap (data), null , 2 )
650+ : " [" + data .map ((entry ) => JSON .stringify (unwrap (entry), null , 2 )).join (" ,\n " ) + " ]" ;
629651
630652 const fileName = type === " single" ? " single_exit_message.txt" : " multiple_exit_messages.txt" ;
631653 const blob = new Blob ([content], { type: " application/json;charset=utf-8" });
0 commit comments