Skip to main content
Version: 0.2.38

sdk.applyparamstoscript

Home > @blaze-cardano/sdk > applyParamsToScript

applyParamsToScript() function

Applies the given Plutus data parameters to a hex-encoded Plutus script.

This function decodes the provided Plutus script, applies the given parameters to it, and then re-encodes the script. The parameters are cast to the specified type and converted to a list of PlutusData before being applied.

T - The type of the parameters list.

Signature:

declare function applyParamsToScript<T extends TArray>(plutusScript: string, type: T, params: Exact<T>): HexBlob;

Parameters

Parameter

Type

Description

plutusScript

string

The hex-encoded Plutus script to which the parameters will be applied.

type

T

The type of the parameters list.

params

Exact<T>

The parameters to apply to the Plutus script.

Returns:

HexBlob

{HexBlob} - A new hex-encoded Plutus script with the parameters applied.