Produce_blocks doesn't affect transaction's timestamp

use fuels::{
  signers::fuel_crypto::SecretKey,
  prelude::*,
  types::{
    Identity,
    block::Block
  },
  client::{
    PaginationRequest,
    PageDirection
  },
};
use chrono::{Utc, Duration, TimeZone};

pub async fn get_timestamp(provider: &Provider) -> Result<i64, Error> {
  let req = PaginationRequest {
    cursor: None,
    results: 1,
    direction: PageDirection::Backward,
  };
  let blocks: Vec<Block> = provider.get_blocks(req).await?.results;

  Ok(blocks[0].header.time.unwrap().timestamp())
}

Also, to note, this post is somewhat similar to Allow to set message sender of a given call to a specified Identity - Rust SDK - Fuel Network & Sway Language

2 Likes