pub fn submit_transaction(
        &mut self,
        sender_account_opt: Option<&mut AccountData>,
        transaction: SignedTransaction,
    ) -> Result<()> {
        // form request
        let mut batch = JsonRpcBatch::new();
        batch.add_submit_request(transaction)?;

        let responses = self.client.execute(batch)?;
        match get_response_from_batch(0, &responses)? {
            Ok(response) => {
                if response == &JsonRpcResponse::SubmissionResponse {
                    if let Some(sender_account) = sender_account_opt {
                        // Bump up sequence_number if transaction is accepted.
                        sender_account.sequence_number += 1;
                    }
                    Ok(())
                } else {
                    bail!("Received non-submit response payload: {:?}", response)
                }
            }
            Err(e) => {
                if let Some(error) = e.downcast_ref::<JsonRpcError>() {
                    // check VM status
                    if let Some(status_code) = error.as_status_code() {
                        if status_code == StatusCode::SEQUENCE_NUMBER_TOO_OLD {
                            if let Some(sender_account) = sender_account_opt {
                                // update sender's sequence number if too old
                                sender_account.sequence_number =
                                    self.get_sequence_number(sender_account.address)?;
                            }
                        }
                    }
                }
                bail!("Transaction submission failed with error: {:?}", e)
            }
        }
    }
/// Submits a transaction and bumps the sequence number for the sender, pass in `None` for
/// sender_account if sender's address is not managed by the client.
Submits a transaction and bumps the sequence number for the sender, pass in `None` for
sender_account if sender's address is not managed by the client.
Submits a transaction and bumps the sequence number for the sender pass in ` None ` for sender_account if sender ' s address is not managed by the client .
pub fn submit_transaction(
        &mut self,
        sender_account_opt: Option<&mut AccountData>,
        transaction: SignedTransaction,
    ) -> Result<()> {
        // form request
        let mut batch = JsonRpcBatch::new();
        batch.add_submit_request(transaction)?;
        let responses = self.client.execute(batch)?;
        match get_response_from_batch(0, &responses)? {
            Ok(response) => {
                if response == &JsonRpcResponse::SubmissionResponse {
                    if let Some(sender_account) = sender_account_opt {
                        // Bump up sequence_number if transaction is accepted.
                        sender_account.sequence_number += 1;
                    }
                    Ok(())
                } else {
                    bail!("Received non-submit response payload: {:?}", response)
                }
            }
            Err(e) => {
                if let Some(error) = e.downcast_ref::<JsonRpcError>() {
                    // check VM status
                    if let Some(status_code) = error.as_status_code() {
                        if status_code == StatusCode::SEQUENCE_NUMBER_TOO_OLD {
                            if let Some(sender_account) = sender_account_opt {
                                // update sender's sequence number if too old
                                sender_account.sequence_number =
                                    self.get_sequence_number(sender_account.address)?;
                            }
                        }
                    }
                }
                bail!("Transaction submission failed with error: {:?}", e)
            }
        }
    }
pub fn submit_transaction ( & mut self , sender_account_opt : Option < & mut AccountData > , transaction : SignedTransaction , ) -> Result < ( ) > { // form request let mut batch = JsonRpcBatch :: new ( ) ; batch . add_submit_request ( transaction ) ? ; let responses = self . client . execute ( batch ) ? ; match get_response_from_batch ( 0 , & responses ) ? { Ok ( response ) => { if response == & JsonRpcResponse :: SubmissionResponse { if let Some ( sender_account ) = sender_account_opt { // Bump up sequence_number if transaction is accepted. sender_account . sequence_number += 1 ; } Ok ( ( ) ) } else { bail ! ( " " response ) } } Err ( e ) => { if let Some ( error ) = e . downcast_ref :: < JsonRpcError > ( ) { // check VM status if let Some ( status_code ) = error . as_status_code ( ) { if status_code == StatusCode :: SEQUENCE_NUMBER_TOO_OLD { if let Some ( sender_account ) = sender_account_opt { // update sender's sequence number if too old sender_account . sequence_number = self . get_sequence_number ( sender_account . address ) ? ; } } } } bail ! ( " " e ) } } }
Submits a transaction and bumps the sequence number for the sender, pass in `None` for
sender_account if sender's address is not managed by the client.
Submits a transaction and bumps the sequence number for the sender pass in ` None ` for sender_account if sender ' s address is not managed by the client .
&mut self
sender_account_opt
Option<&mut AccountData>
transaction
SignedTransaction
&mut self
sender_account_opt
Option<&mut AccountData>
transaction
SignedTransaction