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

x/lucid/src/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.10.6/src/mod.ts";

Properties

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

Methods

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

Query CIP-0068 metadata for a specifc asset.

newMessage(address: Address | RewardAddress, payload: Payload): Message

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

newTx(): Tx
selectWallet(api: WalletApi): Lucid
selectWalletFrom(unnamed 0: ExternalWallet): Lucid

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

selectWalletFromPrivateKey(privateKey: PrivateKey): Lucid

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(
address: Address | RewardAddress,
payload: Payload,
signedMessage: SignedMessage,
): boolean

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

Static Methods

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