Skip to main content

PScriptContext

The Script Context is probably the most important piece of data your script receives.

That is because this data is passed directly by the cardano node during the contract evaluation; hence it can always be trusted.

definition:

export const PScriptContext = pstruct({
PScriptContext: {
tx: PTxInfo.type,
redeemer: data,
purpose: PScriptPurpose.type
}
});

We see it has a single constructor that includes 3 fields:

tx

tx of type PTxInfo

redeemer

redeemer of type data

purpose

purpose of type PScriptPurpose