multiSignerExecuteAndSubmit

suspend fun multiSignerExecuteAndSubmit(target: String, targetFn: String, targetArgs: List<SCValXdr> = emptyList(), selectedSigners: List<SelectedSigner>, forceMethod: SubmissionMethod? = null, resolveContextRuleIds: ResolveContextRuleIds? = null): TransactionResult

Executes an arbitrary contract function through the smart account's execute entry point with multi-signer authorization.

This method is the multi-signer counterpart to OZTransactionOperations.executeAndSubmit. Use it when a contract call must be authorized by more than one signer — for example, a governance vote, a multisig swap, or any operation gated by a multi-signer context rule.

The method routes the call through the smart account contract's execute(target, target_fn, target_args) entry point and collects signatures from all selectedSigners before submission.

This method takes target, targetFn, and targetArgs directly rather than accepting an AssembledTransaction. The KMP SDK constructs transactions from raw XDR without an AssembledTransaction wrapper; targetArgs must therefore be pre-encoded using Scv helpers.

Return

TransactionResult indicating success or failure with the transaction hash.

Parameters

target

The target contract address (C-address) to invoke via execute.

targetFn

The function name to call on the target contract.

targetArgs

Pre-encoded arguments for the target function. Use Scv helpers (e.g., Scv.toUint32, Scv.toBoolean, Scv.toAddress) to encode each argument. Defaults to an empty list for functions that take no arguments.

selectedSigners

All signers that must sign, in collection order.

forceMethod

Optional override for the submission method. When null (default), the SDK auto-detects whether to use the relayer or direct submission.

resolveContextRuleIds

Optional callback to resolve context rule IDs per auth entry. When null (default), the SDK resolves the rule IDs automatically from the selected signers and available context rules.

Throws

if validation fails, signing fails, or submission fails.

Example — multi-signer governance vote:

val result = multiSigner.multiSignerExecuteAndSubmit(
target = "CDAO_CONTRACT_ADDRESS_HERE...",
targetFn = "vote",
targetArgs = listOf(
Scv.toUint32(proposalId),
Scv.toBoolean(true)
),
selectedSigners = listOf(
SelectedSigner.Passkey(
credentialId = credIdStr,
credentialIdBytes = credIdBytes,
keyData = signer.keyData
),
SelectedSigner.Wallet("GA7Q...")
)
)
if (result.success) {
println("Vote submitted: ${result.hash ?: ""}")
}