Skip to main content

Module call

Module call 

Source
Expand description

Cross-contract call utilities for contract composability.

This module provides functions to invoke other contracts from within your contract, enabling composability and modular contract design.

§Features

  • Legacy calls: Basic cross-contract invocation without value transfer
  • Value transfer: Call contracts while transferring native tokens
  • Return data: Capture and process return values from called contracts

§Example

use truthlinked_sdk::call;

// Call another contract
let token_contract = [0x12; 32];
let calldata = encode_transfer_call(recipient, amount);
let result = call::call_contract(&token_contract, &calldata)?;

// Call with value transfer
let result = call::call_contract_with_value(
    &contract_id,
    &calldata,
    1000, // Transfer 1000 base units
)?;

Functions§

call_contract
Invokes another contract without transferring value.
call_contract_with_value
Invokes another contract while transferring native tokens.

Type Aliases§

AccountId
Type alias for 32-byte account identifiers.