callFunction
callFunction invokes a static function on a published template — typically used to create new component instances.
import { TransactionBuilder, literalArg, Network } from "@tari-project/ootle";
const unsignedTx = TransactionBuilder.new(Network.Esmeralda) .feeTransactionPayFromComponent(accountAddress, 1000n) .callFunction( { templateAddress: "template_0x…", functionName: "new", }, [literalArg("hello"), literalArg("42")], ) .saveVar("component") .buildUnsignedTransaction();Parameters
Section titled “Parameters”The first argument is a TariFunctionDefinition:
interface TariFunctionDefinition { templateAddress: string; // Published template address functionName: string; // Function name (e.g. "new")}The second argument is an array of NamedArg values — either { Literal: string } for raw values or { Workspace: "varName" } to reference a saved workspace variable.
literalArg helper
Section titled “literalArg helper”The literalArg helper wraps a value as { Literal: string }:
import { literalArg } from "@tari-project/ootle";
literalArg("hello"); // { Literal: "hello" }literalArg(1000n); // { Literal: "1000" }