Skip to content

Commit

Permalink
maturity methods
Browse files Browse the repository at this point in the history
  • Loading branch information
hal3e committed Jan 27, 2025
1 parent 9ae9df1 commit 967e20b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 2 additions & 0 deletions e2e/tests/predicates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,10 @@ async fn tx_id_not_changed_after_adding_witnesses() -> Result<()> {

tx.append_witness(witness.into())?;
tx.append_witness(witness2.into())?;
let tx = tx.with_maturity(17);
let tx_id_after_witnesses = tx.id(chain_id);

provider.produce_blocks(20, None).await?;
let tx_id_from_provider = provider.send_transaction(tx).await?;

assert_eq!(tx_id, tx_id_after_witnesses);
Expand Down
9 changes: 2 additions & 7 deletions packages/fuels-core/src/types/wrappers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,19 +439,14 @@ macro_rules! impl_tx_wrapper {
self.tx.id(&chain_id)
}

fn maturity(&self) -> u32 {
(*self.tx.maturity()).into()
fn maturity(&self) -> Option<u64> {
self.tx.policies().get(PolicyType::Maturity)
}

fn expiration(&self) -> Option<u64> {
self.tx.policies().get(PolicyType::Expiration)
}

fn with_maturity(mut self, maturity: u32) -> Self {
self.tx.set_maturity(maturity.into());
self
}

fn metered_bytes_size(&self) -> usize {
self.tx.metered_bytes_size()
}
Expand Down

0 comments on commit 967e20b

Please sign in to comment.