Function fuels_programs::contract::method_hash

source ·
pub fn method_hash<D: Tokenizable + Parameterize + Debug, T: Account>(
    contract_id: Bech32ContractId,
    account: T,
    encoded_selector: Selector,
    args: &[Token],
    log_decoder: LogDecoder,
    is_payable: bool,
    encoder_config: EncoderConfig,
) -> ContractCallHandler<T, D>
Expand description

Creates an ABI call based on a function selector and the encoding of its call arguments, which is a slice of Tokens. It returns a prepared ContractCall that can further be used to make the actual transaction. This method is the underlying implementation of the functions generated from an ABI JSON spec, i.e, this is what’s generated:

quote! {
    #doc
    pub fn #name(&self #input) -> #result {
        contract::method_hash(#tokenized_signature, #arg)
    }
}

For more details see code_gen in fuels-core.

Note that this needs an account because the contract instance needs an account for the calls