pub fn operator_registrations(
        &self,
        layout: &Layout,
    ) -> Result<Vec<OperatorRegistration>, Error> {
        let mut registrations = Vec::new();
        for operator in layout.operators.iter() {
            let operator_config = self.backend.backend.clone();
            let operator_config = operator_config.set_namespace(operator.into());

            let operator_storage = operator_config.create_storage(RemoteStorage)?;

            let operator_key = operator_storage
                .get(OPERATOR_KEY)
                .map_err(|e| Error::RemoteStorageReadError(OPERATOR_KEY, e.to_string()))?
                .value
                .ed25519_public_key()
                .map_err(|e| Error::RemoteStorageReadError(OPERATOR_KEY, e.to_string()))?;

            let validator_config_tx = operator_storage
                .get(constants::VALIDATOR_CONFIG)
                .map_err(|e| {
                    Error::RemoteStorageReadError(constants::VALIDATOR_CONFIG, e.to_string())
                })?
                .value;
            let validator_config_tx = validator_config_tx.transaction().unwrap();
            let validator_config_tx = validator_config_tx.as_signed_user_txn().unwrap().payload();
            let validator_config_tx =
                if let TransactionPayload::Script(script) = validator_config_tx {
                    script.clone()
                } else {
                    return Err(Error::UnexpectedError("Found invalid registration".into()));
                };

            registrations.push((operator_key, validator_config_tx));
        }

        Ok(registrations)
    }
/// Produces a set of OperatorRegistrations from the remote storage.
Produces a set of OperatorRegistrations from the remote storage.
Produces a set of OperatorRegistrations from the remote storage .
pub fn operator_registrations(
        &self,
        layout: &Layout,
    ) -> Result<Vec<OperatorRegistration>, Error> {
        let mut registrations = Vec::new();
        for operator in layout.operators.iter() {
            let operator_config = self.backend.backend.clone();
            let operator_config = operator_config.set_namespace(operator.into());
            let operator_storage = operator_config.create_storage(RemoteStorage)?;
            let operator_key = operator_storage
                .get(OPERATOR_KEY)
                .map_err(|e| Error::RemoteStorageReadError(OPERATOR_KEY, e.to_string()))?
                .value
                .ed25519_public_key()
                .map_err(|e| Error::RemoteStorageReadError(OPERATOR_KEY, e.to_string()))?;
            let validator_config_tx = operator_storage
                .get(constants::VALIDATOR_CONFIG)
                .map_err(|e| {
                    Error::RemoteStorageReadError(constants::VALIDATOR_CONFIG, e.to_string())
                })?
                .value;
            let validator_config_tx = validator_config_tx.transaction().unwrap();
            let validator_config_tx = validator_config_tx.as_signed_user_txn().unwrap().payload();
            let validator_config_tx =
                if let TransactionPayload::Script(script) = validator_config_tx {
                    script.clone()
                } else {
                    return Err(Error::UnexpectedError("Found invalid registration".into()));
                };
            registrations.push((operator_key, validator_config_tx));
        }
        Ok(registrations)
    }
pub fn operator_registrations ( & self , layout : & Layout , ) -> Result < Vec < OperatorRegistration > , Error > { let mut registrations = Vec :: new ( ) ; for operator in layout . operators . iter ( ) { let operator_config = self . backend . backend . clone ( ) ; let operator_config = operator_config . set_namespace ( operator . into ( ) ) ; let operator_storage = operator_config . create_storage ( RemoteStorage ) ? ; let operator_key = operator_storage . get ( OPERATOR_KEY ) . map_err ( | e | Error :: RemoteStorageReadError ( OPERATOR_KEY , e . to_string ( ) ) ) ? . value . ed25519_public_key ( ) . map_err ( | e | Error :: RemoteStorageReadError ( OPERATOR_KEY , e . to_string ( ) ) ) ? ; let validator_config_tx = operator_storage . get ( constants :: VALIDATOR_CONFIG ) . map_err ( | e | { Error :: RemoteStorageReadError ( constants :: VALIDATOR_CONFIG , e . to_string ( ) ) } ) ? . value ; let validator_config_tx = validator_config_tx . transaction ( ) . unwrap ( ) ; let validator_config_tx = validator_config_tx . as_signed_user_txn ( ) . unwrap ( ) . payload ( ) ; let validator_config_tx = if let TransactionPayload :: Script ( script ) = validator_config_tx { script . clone ( ) } else { return Err ( Error :: UnexpectedError ( " " . into ( ) ) ) ; } ; registrations . push ( ( operator_key , validator_config_tx ) ) ; } Ok ( registrations ) }
Produces a set of OperatorRegistrations from the remote storage.
Produces a set of OperatorRegistrations from the remote storage .
&self
layout
&Layout
&self
layout
&Layout