Documentation
Deep Dives
Interact with Validators
Advanced
Applying Parameters

Applying Parameters

Many validators are parameterized, you can apply parameters dynamically.

const mintingPolicy = {
  type: "PlutusV3",
  script: applyParamsToScript(
    "5907945907910100...", // CBOR hex of the compiled script
    [10n] // Parameters
  ),
};

For a validator expecting one parameter:

validator minting_policy(first_param: Int) { .. }
💡

applyParamsToScript function handles CBOR encoding internally. You can check encoding levels with:

const encodingLevel = CBOREncodingLevel(script); // Returns "double" | "single"