Skip to main content
Version: Next

tx.txbuilder.locklovelace

Home > @blaze-cardano/tx > TxBuilder > lockLovelace

TxBuilder.lockLovelace() method

Locks a specified amount of lovelace to a script. The difference between 'pay' and 'lock' is that you pay to a public key/user, and you lock at a script. This method ensures that the address is valid and the lovelace is locked to the script.

Signature:

lockLovelace(address: Address, lovelace: bigint, datum: Datum, scriptReference?: Script): TxBuilder;

Parameters

Parameter

Type

Description

address

Address

The address to lock the lovelace to.

lovelace

bigint

The amount of lovelace to lock.

datum

Datum

The datum to be associated with the locked lovelace.

scriptReference

Script

(Optional) The reference to the script to lock the lovelace to.

Returns:

TxBuilder

{TxBuilder} The same transaction builder