makeValidator
[!CAUTION]
This method is deprecated as of Plutus V3
Once on-chain contracts are not typed. Instead they only receive generic data arguments.
This is why makeValidator exists.
The type signature is not too complicated:
export function makeValidator(
typedValidator: Term<
PLam<
PType,
PLam<
PType,
PLam<
typeof PScriptContext,
PBool
>
>
>
>,
errorMessage?: string
): TermFn<[PData,PData,PData], PUnit>
As you can see it takes any typed validator and returns a generic untyped validator so that the node will be able to evaluate it correctly.
use
makeValidator only for spending scriptsAs you can see; makeValidator expects a contract with 3 arguments.
This means it can only be used for contracts with Spending as PScriptPurpose
For all other purposes you likely want to use makeRedeemerValidator
errorMessage
Optionally you can pass a string that will be included in the on-chain script and passed to ptrace in case of failure