Skip to main content
Version: Next

sdk.provider.resolvescriptref

Home > @blaze-cardano/sdk > Provider > resolveScriptRef

Provider.resolveScriptRef() method

Resolves the script deployment by finding a UTxO containing the script reference.

Signature:

abstract resolveScriptRef(script: Script | Hash28ByteBase16, address?: Address): Promise<TransactionUnspentOutput | undefined>;

Parameters

Parameter

Type

Description

script

Script | Hash28ByteBase16

The script or its hash to resolve.

address

Address

(Optional) The address to search for the script deployment. Defaults to a burn address.

Returns:

Promise<TransactionUnspentOutput | undefined>

The UTxO containing the script reference, or undefined if not found.

Remarks

Providers must implement this explicitly. Backends with native script-reference indexes should use them. Providers that can only search an address can call findScriptRefInAddressUtxos().

Example

const scriptUtxo = await provider.resolveScriptRef(myScript);
if (scriptUtxo) {
console.log("Script found in UTxO:", scriptUtxo.input().toCore());
} else {
console.log("Script not found");
}