@@ -1059,128 +1059,12 @@ export class LitContracts {
10591059 return addresses ;
10601060 }
10611061
1062- /**
1063- * FIXME: Remove this for Naga
1064- * @deprecated - Use {@link getConnectionInfo } instead, which provides more information.
1065- */
1066- public static getMinNodeCount = async (
1067- network : LIT_NETWORKS_KEYS ,
1068- context ?: LitContractContext | LitContractResolverContext ,
1069- rpcUrl ?: string
1070- ) => {
1071- const contract = await LitContracts . getStakingContract (
1072- network ,
1073- context ,
1074- rpcUrl
1075- ) ;
1076-
1077- const minNodeCount = await contract [ 'currentValidatorCountForConsensus' ] ( ) ;
1078-
1079- if ( ! minNodeCount ) {
1080- throw new InitError (
1081- {
1082- info : {
1083- minNodeCount,
1084- } ,
1085- } ,
1086- '❌ Minimum validator count is not set'
1087- ) ;
1088- }
1089- return minNodeCount ;
1090- } ;
1091-
1092- /**
1093- * FIXME: remove this for Naga
1094- * @deprecated - Use {@link getConnectionInfo } instead, which provides more information.
1095- */
1096- public static getValidators = async (
1097- network : LIT_NETWORKS_KEYS ,
1098- context ?: LitContractContext | LitContractResolverContext ,
1099- rpcUrl ?: string ,
1100- nodeProtocol ?: typeof HTTP | typeof HTTPS | null
1101- ) : Promise < string [ ] > => {
1102- const contract = await LitContracts . getStakingContract (
1103- network ,
1104- context ,
1105- rpcUrl
1106- ) ;
1107-
1108- // Fetch contract data
1109- const [ activeValidators , currentValidatorsCount , kickedValidators ] =
1110- await Promise . all ( [
1111- contract [ 'getValidatorsInCurrentEpoch' ] ( ) ,
1112- contract [ 'currentValidatorCountForConsensus' ] ( ) ,
1113- contract [ 'getKickedValidators' ] ( ) ,
1114- ] ) ;
1115-
1116- const validators = [ ] ;
1117-
1118- // Check if active validator set meets the threshold
1119- if (
1120- activeValidators . length - kickedValidators . length >=
1121- currentValidatorsCount
1122- ) {
1123- // Process each validator
1124- for ( const validator of activeValidators ) {
1125- validators . push ( validator ) ;
1126- }
1127- } else {
1128- LitContracts . logger . error (
1129- '❌ Active validator set does not meet the threshold'
1130- ) ;
1131- }
1132-
1133- // remove kicked validators in active validators
1134- const cleanedActiveValidators = activeValidators . filter (
1135- ( av : any ) => ! kickedValidators . some ( ( kv : any ) => kv === av )
1136- ) ;
1137-
1138- const activeValidatorStructs : ValidatorStruct [ ] = (
1139- await contract [ 'getValidatorsStructs' ] ( cleanedActiveValidators )
1140- ) . map ( ( item : any ) => {
1141- return {
1142- ip : item [ 0 ] ,
1143- ipv6 : item [ 1 ] ,
1144- port : item [ 2 ] ,
1145- nodeAddress : item [ 3 ] ,
1146- reward : item [ 4 ] ,
1147- seconderPubkey : item [ 5 ] ,
1148- receiverPubkey : item [ 6 ] ,
1149- } ;
1150- } ) ;
1151-
1152- const networks = activeValidatorStructs . map ( ( item : ValidatorStruct ) => {
1153-
1154- // Convert the integer IP to a string format
1155- const ip = intToIP ( item . ip ) ;
1156- const port = item . port ;
1157-
1158- // Determine the protocol to use based on various conditions
1159- const protocol =
1160- // If nodeProtocol is defined, use it
1161- nodeProtocol ||
1162- // If port is 443, use HTTPS, otherwise use network-specific HTTP
1163- ( port === 443 ? HTTPS : HTTP_BY_NETWORK [ network ] ) ||
1164- // Fallback to HTTP if no other conditions are met
1165- HTTP ;
1166-
1167- const url = `${ protocol } ${ ip } :${ port } ` ;
1168-
1169- LitContracts . logger . debug ( "Validator's URL:" , url ) ;
1170-
1171- return url ;
1172- } ) ;
1173-
1174- return networks ;
1175- } ;
1176-
1177-
11781062 /**
11791063 * Generates an array of validator URLs based on the given validator structs and network configurations.
11801064 *
1181- * @param {ValidatorStruct[] } activeValidatorStructs - Array of validator structures containing IP and port information.
1182- * @param {string | undefined } nodeProtocol - Optional node protocol to override the default protocol selection logic.
1183- * @param {string } litNetwork - The name of the network used to determine HTTP/HTTPS settings.
1065+ * @property {ValidatorStruct[] } activeValidatorStructs - Array of validator structures containing IP and port information.
1066+ * @property {string | undefined } nodeProtocol - Optional node protocol to override the default protocol selection logic.
1067+ * @property {string } litNetwork - The name of the network used to determine HTTP/HTTPS settings.
11841068 * @returns {string[] } Array of constructed validator URLs.
11851069 *
11861070 * @example
@@ -1360,7 +1244,6 @@ export class LitContracts {
13601244 litNetwork,
13611245 networkContext,
13621246 rpcUrl,
1363- nodeProtocol,
13641247 productIds, // Array of product IDs
13651248 } : {
13661249 litNetwork : LIT_NETWORKS_KEYS ,
0 commit comments