fuels_programs/calls/traits/
contract_dep_configurator.rs

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
31
32
33
34
use fuels_core::types::bech32::Bech32ContractId;

use crate::calls::{utils::sealed, ContractCall, ScriptCall};

pub trait ContractDependencyConfigurator: sealed::Sealed {
    fn append_external_contract(&mut self, contract_id: Bech32ContractId);
    fn with_external_contracts(self, external_contracts: Vec<Bech32ContractId>) -> Self;
}

impl ContractDependencyConfigurator for ContractCall {
    fn append_external_contract(&mut self, contract_id: Bech32ContractId) {
        self.external_contracts.push(contract_id)
    }

    fn with_external_contracts(self, external_contracts: Vec<Bech32ContractId>) -> Self {
        ContractCall {
            external_contracts,
            ..self
        }
    }
}

impl ContractDependencyConfigurator for ScriptCall {
    fn append_external_contract(&mut self, contract_id: Bech32ContractId) {
        self.external_contracts.push(contract_id)
    }

    fn with_external_contracts(self, external_contracts: Vec<Bech32ContractId>) -> Self {
        ScriptCall {
            external_contracts,
            ..self
        }
    }
}