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

x/lucid/mod.ts>Utils

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 Utils
Re-export
import { Utils } from "https://deno.land/x/lucid@0.7.7/mod.ts";

Constructors

new
Utils(lucid: Lucid)

Properties

private
lucid: Lucid

Methods

credentialToAddress(paymentCredential: Credential, stakeCredential?: Credential): Address
credentialToRewardAddress(stakeCredential: Credential): RewardAddress
datumToHash(datum: Datum): DatumHash
generatePrivateKey(): PrivateKey
getAddressDetails(address: string): AddressDetails

Address can be in Bech32 or Hex

keyHashToCredential(keyHash: KeyHash): Credential
mintingPolicyToId(mintingPolicy: MintingPolicy): PolicyId
nativeScriptFromJson(nativeScript: NativeScript): Script

Convert a native script from Json to the Hex representation. It follows this Json format: https://github.com/input-output-hk/cardano-node/blob/master/doc/reference/simple-scripts.md

scriptHashToCredential(scriptHash: ScriptHash): Credential
slotToUnixTime(slot: Slot): UnixTime
unixTimeToSlot(unixTime: UnixTime): Slot
validatorToAddress(validator: SpendingValidator, stakeCredential?: Credential): Address
validatorToRewardAddress(validator: CertificateValidator | WithdrawalValidator): RewardAddress
validatorToScriptHash(validator: Validator): ScriptHash