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

x/lucid/src/lucid/lucid.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
import { Lucid } from "https://deno.land/x/lucid@0.10.5/src/lucid/lucid.ts";

Properties

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

Methods

awaitTx(txHash: TxHash, checkInterval?): Promise<boolean>
datumOf<T = Data>(utxo: UTxO, type?: T): Promise<T>
delegationAt(rewardAddress: RewardAddress): Promise<Delegation>
metadataOf<T = Json>(unit: Unit): Promise<T>

Query CIP-0068 metadata for a specifc asset.

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; password?: string; }): 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(addressOrCredential: Address | Credential): Promise<UTxO[]>
utxosAtWithUnit(addressOrCredential: Address | Credential, 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>