Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/lucid/src/lucid/mod.ts>Lucid

Lucid is a library, which allows you to create Cardano transactions and off-chain code for your Plutus contracts in JavaScript, Deno and Node.js.
Go to Latest
class Lucid
Re-export
import { Lucid } from "https://deno.land/x/lucid@0.7.8/src/lucid/mod.ts";

Properties

network: Network
provider: Provider
txBuilderConfig: Core.TransactionBuilderConfig
utils: Utils
wallet: Wallet

Methods

awaitTx(txHash: TxHash): Promise<boolean>
datumOf(utxo: UTxO): Promise<Datum>
delegationAt(rewardAddress: RewardAddress): Promise<Delegation>

Signs a message. Expects the payload to be Hex encoded.

Emulates a wallet by constructing it with the utxos and an address. If utxos are not set, utxos are fetched from the provided address.

Cardano Private key in bech32; not the BIP32 private key or any key that is not fully derived. Only an Enteprise address (without stake credential) is derived.

selectWalletFromSeed(seed: string, options?: { addressType?: "Base" | "Enterprise"; accountIndex?: number; }): Lucid

Select wallet from a seed phrase (e.g. 15 or 24 words). You have the option to choose between a Base address (with stake credential) and Enterprise address (without stake credential). You can also decide which account index to derive. By default account 0 is derived.

switchProvider(provider?: Provider, network?: Network): Promise<Lucid>

Switch provider and/or network. If provider or network unset, no overwriting happens. Provider or network from current instance are taken then.

utxoByUnit(unit: Unit): Promise<UTxO>

Unit needs to be an NFT (or optionally the entire supply in one UTxO).

utxosAt(address: Address): Promise<UTxO[]>
utxosAtWithUnit(address: Address, unit: Unit): Promise<UTxO[]>
utxosByOutRef(outRefs: Array<OutRef>): Promise<UTxO[]>
verifyMessage(
payload: Payload,
signedMessage: SignedMessage,
): boolean

Verify a message. Expects the payload to be Hex encoded.

Static Methods

new(provider?: Provider, network?: Network): Promise<Lucid>