Skip to main content
The call materialiser resolves an input resource by executing a user-supplied contract call before the flow starts and measuring the resulting token balance delta. Use it when the amount you want to spend is produced by an external action — for example, “claim rewards from staking contract X, then deposit the claimed amount into vault Y”. At compile time, the materialiser executes the supplied calldata against target from the sender’s execution proxy, measures the change in the input resource’s declared token balance, and injects that delta as the input amount. The resulting flow calldata performs the same call on-chain, then consumes the produced balance as the flow’s input resource.
materialisers.callcore.call. The core.call op (covered in the Op catalog) accepts a functionSignature plus typed args in its config and ABI-encodes the call for you. The call materialiser is a separate construct: it takes pre-encoded calldata (a raw hex string) and a target address. Callers are responsible for ABI-encoding the call themselves (viem’s encodeFunctionData, ethers.Interface.encodeFunctionData, etc.).

Example

Consume the output of claimRewards() on a staking contract as the flow input. ABI-encode the call once before invoking:
import { encodeFunctionData } from 'viem';

const claimRewardsCalldata = encodeFunctionData({
  abi: [{ type: 'function', name: 'claimRewards', inputs: [], outputs: [] }],
  functionName: 'claimRewards',
});

const request = sdk.request(builder.build(), {
  signer: OWNER,
  inputs: {
    amountIn: materialisers.call({
      target: STAKING_CONTRACT,
      calldata: claimRewardsCalldata, // pre-encoded hex string
    }),
  },
  sweepTo: builder.context.sender,
});