1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::{
    api::CallTypeApi,
    types::{heap::H256, ManagedAddress, ManagedBuffer},
};

use super::{AnnotatedValue, TxFromSpecified};

pub trait TxEnv: Sized {
    type Api: CallTypeApi;

    /// Type built by result handlers that translates into the "expect" section in scenarios.
    type RHExpect: Default;

    fn resolve_sender_address(&self) -> ManagedAddress<Self::Api>;

    fn default_gas_annotation(&self) -> ManagedBuffer<Self::Api>;

    fn default_gas_value(&self) -> u64;
}

pub trait TxEnvMockDeployAddress: TxEnv {
    fn mock_deploy_new_address<From, NA>(&mut self, from: &From, new_address: NA)
    where
        From: TxFromSpecified<Self>,
        NA: AnnotatedValue<Self, ManagedAddress<Self::Api>>;
}

pub trait TxEnvWithTxHash: TxEnv {
    fn set_tx_hash(&mut self, tx_hash: H256);
}