invoke Contract Function
fun invokeContractFunction(contractAddress: String, functionName: String, parameters: List<SCValXdr>): InvokeHostFunctionOperation
Creates an InvokeHostFunctionOperation for invoking a specific function on a contract.
This is a convenience factory method that builds the necessary XDR structures for contract invocation.
Return
An InvokeHostFunctionOperation ready to be added to a transaction
Parameters
contract Address
The contract address (C... format)
function Name
The name of the contract function to invoke
parameters
The function parameters as SCVal XDR values
Throws
If contractAddress is not a contract (C...) address
Example
val operation = InvokeHostFunctionOperation.invokeContractFunction(
contractAddress = "CABC123...",
functionName = "transfer",
parameters = listOf(
Scv.toAddress(fromAccount),
Scv.toAddress(toAccount),
Scv.toInt128(amount)
)
)Content copied to clipboard