Skip to main content

simulateSpend

@totemsdk/kissvm


@totemsdk/kissvm / simulateSpend

Function: simulateSpend()

simulateSpend(scriptStr, coinData, txContext, witness?): Promise<EvalResult>

simulateSpend — simulate a KISSVM coin-spend.

Populates the evaluator context from coinData (used as the input coin at inputIndex 0) unless the caller has already provided txContext.inputs. This ensures @ADDRESS, @AMOUNT, @TOKENID,

Parameters​

scriptStr​

string

coinData​

CoinData

txContext​

TxContext

witness?​

ScriptWitness

Returns​

Promise<EvalResult>

COINAGE​

and

SCRIPT​

resolve correctly during evaluation.

Always computes (or forwards) a txDigest so SIGNEDBY/CHECKSIG perform real WOTS signature verification. Never uses simulationMode — callers who need presence-only checks for script-logic unit tests must pass simulationMode: true in txContext directly to evaluateScript.

Returns a Promise so callers can uniformly await it even though the evaluation itself is synchronous.