Skip to main content
Version: 0.2.38

sdk

Home > @blaze-cardano/sdk

sdk package

Classes

Class

Description

Blaze

The Blaze class is used to create and manage Cardano transactions. It requires a provider and a wallet to interact with the blockchain and manage funds.

Blockfrost

ColdWallet

Wallet class that interacts with the ColdWallet.

HotSingleWallet

Wallet class that interacts with the HotSingleWallet. This is like HotWallet, but without key derivation.

HotWallet

Wallet class that interacts with the HotWallet.

Kupmios

Maestro

TxBuilder

A builder class for constructing Cardano transactions with various components like inputs, outputs, and scripts.

UPLCDecoder

This class provides decoding functionality for UPLC (Untyped Plutus Core) programs. It extends the FlatDecoder class to handle the specific structure of UPLC programs. The decoding process involves interpreting binary data into structured UPLC terms and types.

UPLCEncoder

UPLCEncoder class for encoding Untyped Plutus Core (UPLC) programs. Extends the FlatEncoder class to provide UPLC-specific encoding functionality.

WebWallet

Wallet class that interacts with the WalletInterface.

Abstract Classes

Abstract Class

Description

Provider

Abstract class for the Provider. This class provides an interface for interacting with the blockchain.

Wallet

Abstract class for Wallet.

Functions

Function

Description

applyParams(hex, params)

Applies parameters to a UPLC program encoded as a hex blob.

This function takes a hex-encoded UPLC program and applies one or more Plutus data parameters to it. It does this by decoding the program, modifying its AST to apply the parameters, and then re-encoding it.

applyParamsToScript(plutusScript, type, params)

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.

assertLockAddress(address)

Asserts that the given address is a valid lock address.

assertPaymentsAddress(address)

Asserts that the given address is a valid payment address.

assertValidOutput(output, coinsPerUtxoByte, maxValueSize)

Utility function to test the validity of a TransactionOutput.

bigintMax(a, b)

Returns the maximum of two BigInt values.

calculateMinAda(output, coinsPerUtxoByte)

This methods calculates the minimum ada required for a transaction output.

calculateReferenceScriptFee(refScripts, params)

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

calculateRequiredCollateral(fee, collateralPercentage)

Calculate the required "collateral" the a transaction must put up if it is running smart contracts. This is to prevent DDOS attacks with failing scripts, and must be some percentage above the total fee of the script.

cborToScript(cbor, type)

Converts the compiled code of a UPLC program into a Script based on the specified script type, handling possible double-CBOR encoding.

computeScriptData(redeemers, datums, usedCostModels)

Calculates the correct script data hash for a transaction

Separate from the getScriptData method in TxBuilder to allow for more thorough testing This is heavily documented here: https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/conway/impl/cddl-files/conway.cddl\#L423-L490

fromBlockfrostLanguageVersion(x)

getAuxiliaryDataHash(data)

Computes the hash of the auxiliary data if it exists.

getScriptSize(script)

insertSorted(arr, el)

Given an array and a string, it mutates the provided array and inserts the string after the closest match. It returns the index at which the string was inserted.

isEqualInput(self, that)

Utility function to compare the equality of two inputs.

isEqualOutput(self, that)

Utility function to compare the equality of two outputs.

isEqualUTxO(self, that)

Utility function to compare the equality of two UTxOs.

makeValue(lovelace, assets)

Creates a new Value object with the specified amount of lovelace and assets.

sortLargestFirst(inputs)

Sorts a list of UTxOs by highest total value first.

Interfaces

Interface

Description

BlockfrostProtocolParametersResponse

CIP30DataSignature

CIP30Interface

CIP-30 Wallet interface.

Namespaces

Namespace

Description

CoinSelector

Core

Value

Variables

Variable

Description

purposeToTag

Mapping of RedeemerPurpose to RedeemerTag. Ensures consistency between purpose strings and tag numbers.

stringifyBigint

Wraps JSON.stringify with a serializer for bigints.

WalletDetails

The details of the wallets.

Type Aliases

Type Alias

Description

Namespace

The namespace of the wallet.

NetworkName

ScriptType