fn create_validator_config_transaction(&self, script: Script) -> Result<Transaction, Error> {
        let mut local_storage = self.backends.local.clone().create_storage(LocalStorage)?;
        let operator_key = ed25519_from_storage(OPERATOR_KEY, &local_storage)?;
        let operator_address_string = local_storage
            .get(OPERATOR_ACCOUNT)
            .and_then(|v| v.value.string())
            .map_err(|e| Error::LocalStorageReadError(OPERATOR_ACCOUNT, e.to_string()))?;
        let operator_address = AccountAddress::from_str(&operator_address_string)
            .map_err(|e| Error::BackendParsingError(e.to_string()))?;

        // TODO(joshlind): In genesis the sequence number is irrelevant. After genesis we need to
        // obtain the current sequence number by querying the blockchain.
        let sequence_number = 0;
        let expiration_time = RealTimeService::new().now() + constants::TXN_EXPIRATION_SECS;
        let raw_transaction = RawTransaction::new_script(
            operator_address,
            sequence_number,
            script,
            constants::MAX_GAS_AMOUNT,
            constants::GAS_UNIT_PRICE,
            constants::GAS_CURRENCY_CODE.to_owned(),
            Duration::from_secs(expiration_time),
            self.chain_id,
        );

        let signature = local_storage
            .sign(OPERATOR_KEY, &raw_transaction)
            .map_err(|e| {
                Error::LocalStorageSigningError("validator-config", OPERATOR_KEY, e.to_string())
            })?;
        let signed_txn = SignedTransaction::new(raw_transaction, operator_key, signature);
        Ok(Transaction::UserTransaction(signed_txn))
    }
/// Creates and returns a signed validator-config transaction.
Creates and returns a signed validator-config transaction.
Creates and returns a signed validator - config transaction .
fn create_validator_config_transaction(&self, script: Script) -> Result<Transaction, Error> {
        let mut local_storage = self.backends.local.clone().create_storage(LocalStorage)?;
        let operator_key = ed25519_from_storage(OPERATOR_KEY, &local_storage)?;
        let operator_address_string = local_storage
            .get(OPERATOR_ACCOUNT)
            .and_then(|v| v.value.string())
            .map_err(|e| Error::LocalStorageReadError(OPERATOR_ACCOUNT, e.to_string()))?;
        let operator_address = AccountAddress::from_str(&operator_address_string)
            .map_err(|e| Error::BackendParsingError(e.to_string()))?;
        // TODO(joshlind): In genesis the sequence number is irrelevant. After genesis we need to
        // obtain the current sequence number by querying the blockchain.
        let sequence_number = 0;
        let expiration_time = RealTimeService::new().now() + constants::TXN_EXPIRATION_SECS;
        let raw_transaction = RawTransaction::new_script(
            operator_address,
            sequence_number,
            script,
            constants::MAX_GAS_AMOUNT,
            constants::GAS_UNIT_PRICE,
            constants::GAS_CURRENCY_CODE.to_owned(),
            Duration::from_secs(expiration_time),
            self.chain_id,
        );
        let signature = local_storage
            .sign(OPERATOR_KEY, &raw_transaction)
            .map_err(|e| {
                Error::LocalStorageSigningError("validator-config", OPERATOR_KEY, e.to_string())
            })?;
        let signed_txn = SignedTransaction::new(raw_transaction, operator_key, signature);
        Ok(Transaction::UserTransaction(signed_txn))
    }
fn create_validator_config_transaction ( & self , script : Script ) -> Result < Transaction , Error > { let mut local_storage = self . backends . local . clone ( ) . create_storage ( LocalStorage ) ? ; let operator_key = ed25519_from_storage ( OPERATOR_KEY , & local_storage ) ? ; let operator_address_string = local_storage . get ( OPERATOR_ACCOUNT ) . and_then ( | v | v . value . string ( ) ) . map_err ( | e | Error :: LocalStorageReadError ( OPERATOR_ACCOUNT , e . to_string ( ) ) ) ? ; let operator_address = AccountAddress :: from_str ( & operator_address_string ) . map_err ( | e | Error :: BackendParsingError ( e . to_string ( ) ) ) ? ; // TODO(joshlind): In genesis the sequence number is irrelevant. After genesis we need to // obtain the current sequence number by querying the blockchain. let sequence_number = 0 ; let expiration_time = RealTimeService :: new ( ) . now ( ) + constants :: TXN_EXPIRATION_SECS ; let raw_transaction = RawTransaction :: new_script ( operator_address , sequence_number , script , constants :: MAX_GAS_AMOUNT , constants :: GAS_UNIT_PRICE , constants :: GAS_CURRENCY_CODE . to_owned ( ) , Duration :: from_secs ( expiration_time ) , self . chain_id , ) ; let signature = local_storage . sign ( OPERATOR_KEY , & raw_transaction ) . map_err ( | e | { Error :: LocalStorageSigningError ( " " , OPERATOR_KEY , e . to_string ( ) ) } ) ? ; let signed_txn = SignedTransaction :: new ( raw_transaction , operator_key , signature ) ; Ok ( Transaction :: UserTransaction ( signed_txn ) ) }
Creates and returns a signed validator-config transaction.
Creates and returns a signed validator - config transaction .
&self
script
Script
&self
script
Script