Skip to main content
Version: Next

sdk.calculatereferencescriptfee

Home > @blaze-cardano/sdk > calculateReferenceScriptFee

calculateReferenceScriptFee() function

Calculates the fee for reference scripts in the transaction. This method iterates through the reference inputs, finds the corresponding UTXOs, and calculates the fee based on the size of the Plutus scripts referenced.

The fee calculation follows a tiered approach where the base fee increases for each range of script size, as defined in the protocol parameters. See https://github.com/CardanoSolutions/ogmios/releases/tag/v6.5.0

Signature:

declare function calculateReferenceScriptFee(refScripts: Script[], params: ProtocolParameters): number;

Parameters

Parameter

Type

Description

refScripts

Script[]

An array of reference inputs in the transaction.

params

ProtocolParameters

Returns:

number

{number} The calculated fee for all reference scripts.

Exceptions

{Error} If a reference input cannot be resolved or if a reference script is not a Plutus script.