### Install Project Dependencies Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/README.md Navigate into the cloned project directory and install all necessary dependencies using pnpm. ```bash cd lucid-evolution pnpm install ``` -------------------------------- ### Full Transaction Lifecycle - TypeScript Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/documentation/core-concepts/first-transaction.mdx This example demonstrates the complete process of initializing Lucid, selecting a wallet, building, signing, and submitting a transaction. It includes necessary imports and provider setup. ```typescript import { Lucid, Koios, generateSeedPhrase } from "@lucid-evolution/lucid"; // Initialize Lucid with a provider const lucid = await Lucid( new Koios("https://preprod.koios.rest/api/v1"), "Preprod" ); const seedPhrase = generateSeedPhrase(); // BIP-39 lucid.selectWallet.fromSeed(seedPhrase); // Select a wallet for signing // Build, sign and submit transaction const tx = await lucid .newTx() .pay.ToAddress("addr_testa...", { lovelace: 5000000n }) // Pay 5 ADA to addr_testa... .pay.ToAddress("addr_testb...", { lovelace: 5000000n }) // Pay 5 ADA to addr_testb... .complete(); // Balance the transaction and initiate UTxO selection const signedTx = await tx.sign.withWallet().complete(); const txHash = await signedTx.submit(); console.log("Transaction Submitted:", txHash); ``` -------------------------------- ### Start Local Development Server Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/README.md Run this command to start the local development server. Access the application at http://localhost:3000/lucid-evolution. ```bash pnpm dev ``` -------------------------------- ### Install Lucid Evolution with bun Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/install.mdx Use this command to install the main Lucid Evolution package using bun. ```bash bun i @lucid-evolution/lucid ``` -------------------------------- ### Install Lucid Evolution with yarn Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/install.mdx Use this command to install the main Lucid Evolution package using yarn. ```bash yarn add @lucid-evolution/lucid ``` -------------------------------- ### Install Lucid Evolution with npm Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/install.mdx Use this command to install the main Lucid Evolution package using npm. ```bash npm i @lucid-evolution/lucid ``` -------------------------------- ### Build Project Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/README.md Build the Lucid Evolution project after installing dependencies. ```bash pnpm build ``` -------------------------------- ### Get Validity Interval Start from TransactionBody Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/TransactionBody.ts.md Retrieves the validity interval start from the transaction body. Returns a bigint or undefined if not set. ```typescript export declare const validityIntervalStart: ( instance: CML.TransactionBody, ) => Effect.Effect; ``` -------------------------------- ### Get the start value of UnitInterval Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/UnitInterval.ts.md Safely retrieves the start value of a UnitInterval instance within an Effect context. Handles potential errors. ```typescript export declare const start: ( instance: CML.UnitInterval, ) => Effect.Effect; ``` -------------------------------- ### Instantiate Lucid, Generate Seed Phrase, Build and Submit Transaction Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/index.mdx This example demonstrates how to instantiate Lucid with a provider, generate a seed phrase, select a wallet, build a transaction, sign it, and submit it to the network. Ensure you have the necessary imports and a valid network provider. ```typescript import { Lucid, Koios, generateSeedPhrase } from "@lucid-evolution/lucid"; const lucid = await Lucid( new Koios("https://preprod.koios.rest/api/v1"), "Preprod" ); const seedPhrase = generateSeedPhrase(); lucid.selectWallet.fromSeed(seedPhrase); const tx = await lucid .newTx() .pay.ToAddress("addr_testa...", { lovelace: 5000000n }) .pay.ToAddress("addr_testb...", { lovelace: 5000000n }) .complete(); const signedTx = await tx.sign.withWallet().complete(); const txHash = await signedTx.submit(); console.log("Transaction Submitted:", txHash); ``` -------------------------------- ### Validity Interval Start Unsafe Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/TransactionBody.ts.md Unsafely retrieves the start of the validity interval from a TransactionBody instance. This method provides direct access to the validity interval start. ```typescript export declare const validityIntervalStartUnsafe: ( instance: CML.TransactionBody, ) => bigint | undefined; ``` -------------------------------- ### Enter Development Environment with Nix Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/uplc/README.md Run this command to enter the Nix development environment. This sets up the necessary tools and dependencies for local development. ```bash nix develop ``` -------------------------------- ### Set Validity Interval Start Unsafe Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/TransactionBody.ts.md Unsafely sets the start of the validity interval for a TransactionBody instance. Use this for direct manipulation of the validity interval start. ```typescript export declare const setValidityIntervalStartUnsafe: ( instance: CML.TransactionBody, validityIntervalStart: bigint, ) => void; ``` -------------------------------- ### Get Length of CIP36DelegationList (Unsafe) Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/CIP36DelegationList.ts.md Gets the number of delegations in the list directly, without an Effect wrapper. This provides a quick way to get the length but lacks built-in error handling. ```typescript export declare const lenUnsafe: (instance: CML.CIP36DelegationList) => number; ``` -------------------------------- ### Aiken Test Example Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/lucid/test/specs/contracts/README.md Example of a basic test function written in Gleam. Tests can be included in any module. ```gleam test foo() { 1 + 1 == 2 } ``` -------------------------------- ### Example UTxOs in Wallet Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/documentation/under-the-hood.mdx Illustrates a sample set of UTxOs available in a wallet, used to demonstrate the coin selection algorithm. Each UTxO has a specified ADA amount. ```typescript [ { amount: 3_000_000n }, // 3 ADA { amount: 10_000_000n }, // 10 ADA { amount: 1_000_000n }, // 1 ADA ]; ``` -------------------------------- ### Quick Start: Build and Submit Transaction Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/README.md Initialize Lucid with a provider, select a wallet, build, sign, and submit a transaction. Ensure you have the necessary provider endpoint and network specified. ```typescript import { Lucid, Koios, generateSeedPhrase } from "@lucid-evolution/lucid"; // Initialize Lucid with a provider const lucid = await Lucid( new Koios("https://preprod.koios.rest/api/v1"), "Preprod", ); const seedPhrase = generateSeedPhrase(); // BIP-39 lucid.selectWallet.fromSeed(seedPhrase); // Select a wallet for signing // Build, sign and submit transaction const tx = await lucid .newTx() .pay.ToAddress("addr_testa...", { lovelace: 5000000n }) // Pay 5 ADA to addr_testa... .pay.ToAddress("addr_testb...", { lovelace: 5000000n }) // Pay 5 ADA to addr_testb... .complete(); // Balance the transaction and initiate UTxO selection const signedTx = await tx.sign.withWallet().complete(); const txHash = await signedTx.submit(); console.log("Transaction Submitted:", txHash); ``` -------------------------------- ### Set Validity Start Interval Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/TransactionBuilder.ts.md Sets the validity start interval for the transaction. The transaction will only be valid from this slot onwards. ```typescript export declare const setValidityStartInterval: ( instance: CML.TransactionBuilder, validityStartInterval: bigint, ) => Effect.Effect; ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Bip32PublicKey.ts.md Methods for creating new Bip32PublicKey instances from different formats. ```APIDOC ## fromBech32 Static method fromBech32 of Bip32PublicKey ### Signature ```ts export declare const fromBech32: ( bech32Str: string, ) => Effect.Effect; ``` ### Description Creates a Bip32PublicKey from a Bech32 encoded string. This operation is wrapped in an Effect for error handling. ### Parameters - **bech32Str** (string) - The Bech32 encoded public key string. ### Returns An Effect that yields a CML.Bip32PublicKey on success or a Bip32PublicKeyError on failure. ``` ```APIDOC ## fromRawBytes Static method fromRawBytes of Bip32PublicKey ### Signature ```ts export declare const fromRawBytes: ( bytes: Uint8Array, ) => Effect.Effect; ``` ### Description Creates a Bip32PublicKey from a raw byte array. This operation is wrapped in an Effect for error handling. ### Parameters - **bytes** (Uint8Array) - The raw byte representation of the public key. ### Returns An Effect that yields a CML.Bip32PublicKey on success or a Bip32PublicKeyError on failure. ``` -------------------------------- ### Get Length of FilesDetailsList with Effect Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/FilesDetailsList.ts.md Gets the number of elements in the FilesDetailsList within an Effect, returning the count or a FilesDetailsListError. ```typescript export declare const len: ( instance: CML.FilesDetailsList, ) => Effect.Effect; ``` -------------------------------- ### Initialize Emulator and Lucid Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/documentation/deep-dives/emulator.mdx Create a mock blockchain state with predefined addresses and asset distributions, then initialize Lucid with the emulator. ```typescript const emulator = new Emulator([ generateEmulatorAccount({ lovelace: 80000000000n, // 80,000 ADA }), ]); const lucid = await Lucid(emulator, "Custom"); ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/CIP36Delegation.ts.md Static methods for creating new CIP36Delegation instances. ```APIDOC ## _new Static method _new of CIP36Delegation ### Description Creates a new CIP36Delegation instance. ### Signature ```ts export declare const _new: ( votingPubKey: CML.PublicKey, weight: number, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborBytes Static method fromCborBytes of CIP36Delegation ### Description Creates a CIP36Delegation instance from CBOR encoded bytes. ### Signature ```ts export declare const fromCborBytes: ( cborBytes: Uint8Array, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborHex Static method fromCborHex of CIP36Delegation ### Description Creates a CIP36Delegation instance from a CBOR hex string. ### Signature ```ts export declare const fromCborHex: ( cborBytes: string, ) => Effect.Effect; ``` ``` ```APIDOC ## fromJson Static method fromJson of CIP36Delegation ### Description Creates a CIP36Delegation instance from a JSON string. ### Signature ```ts export declare const fromJson: ( json: string, ) => Effect.Effect; ``` ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/MultiHostName.ts.md Static methods for creating new MultiHostName instances. ```APIDOC ## _new Static method _new of MultiHostName ### Description Creates a new MultiHostName instance. ### Signature ```ts export declare const _new: ( dnsName: CML.DNSName, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborBytes Static method fromCborBytes of MultiHostName ### Description Creates a MultiHostName instance from CBOR encoded bytes. ### Signature ```ts export declare const fromCborBytes: ( cborBytes: Uint8Array, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborHex Static method fromCborHex of MultiHostName ### Description Creates a MultiHostName instance from a CBOR hex string. ### Signature ```ts export declare const fromCborHex: ( cborBytes: string, ) => Effect.Effect; ``` ``` ```APIDOC ## fromJson Static method fromJson of MultiHostName ### Description Creates a MultiHostName instance from a JSON string. ### Signature ```ts export declare const fromJson: ( json: string, ) => Effect.Effect; ``` ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/SingleHostName.ts.md Methods for creating new SingleHostName instances. ```APIDOC ## _new Static method _new of SingleHostName ### Description Creates a new SingleHostName instance. ### Signature ```ts export declare const _new: ( port: number | undefined, dnsName: CML.DNSName, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborBytes Static method fromCborBytes of SingleHostName ### Description Creates a SingleHostName instance from CBOR encoded bytes. ### Signature ```ts export declare const fromCborBytes: ( cborBytes: Uint8Array, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborHex Static method fromCborHex of SingleHostName ### Description Creates a SingleHostName instance from a CBOR hex string. ### Signature ```ts export declare const fromCborHex: ( cborBytes: string, ) => Effect.Effect; ``` ``` ```APIDOC ## fromJson Static method fromJson of SingleHostName ### Description Creates a SingleHostName instance from a JSON string. ### Signature ```ts export declare const fromJson: ( json: string, ) => Effect.Effect; ``` ``` -------------------------------- ### Set Validity Interval Start for TransactionBody Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/TransactionBody.ts.md Sets the validity interval start for a TransactionBody instance. Requires v2.0.0 or later. ```typescript export declare const setValidityIntervalStart: ( instance: CML.TransactionBody, validityIntervalStart: bigint, ) => Effect.Effect; ``` -------------------------------- ### Mint Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Mint.ts.md Provides methods for creating new Mint instances. ```APIDOC ## _new Static method _new of Mint ### Description Creates a new Mint instance. ### Signature ```ts export declare const _new: () => Effect.Effect; ``` ``` ```APIDOC ## _newUnsafe Static method _newUnsafe of Mint ### Description Unsafely creates a new Mint instance without an Effect wrapper. ### Signature ```ts export declare const _newUnsafe: () => CML.Mint; ``` ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Ipv6.ts.md Methods for creating new Ipv6 instances from various formats. ```APIDOC ## fromCborBytes Static method fromCborBytes of Ipv6 ### Description Creates an Ipv6 instance from CBOR encoded bytes. ### Method `fromCborBytes` ### Parameters #### Path Parameters - `cborBytes` (Uint8Array) - Required - The CBOR encoded byte array. ### Response #### Success Response - `Effect.Effect` - An effect that yields an Ipv6 instance or an Ipv6Error. ### Added in v2.0.0 ``` ```APIDOC ## fromCborHex Static method fromCborHex of Ipv6 ### Description Creates an Ipv6 instance from a CBOR encoded hexadecimal string. ### Method `fromCborHex` ### Parameters #### Path Parameters - `cborBytes` (string) - Required - The CBOR encoded hexadecimal string. ### Response #### Success Response - `Effect.Effect` - An effect that yields an Ipv6 instance or an Ipv6Error. ### Added in v2.0.0 ``` ```APIDOC ## fromJson Static method fromJson of Ipv6 ### Description Creates an Ipv6 instance from a JSON string. ### Method `fromJson` ### Parameters #### Path Parameters - `json` (string) - Required - The JSON string representing the Ipv6 address. ### Response #### Success Response - `Effect.Effect` - An effect that yields an Ipv6 instance or an Ipv6Error. ### Added in v2.0.0 ``` -------------------------------- ### Get the length of the TransactionMetadatumList (Unsafe) Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/TransactionMetadatumList.ts.md An unsafe method to get the length of the TransactionMetadatumList. It returns the number directly and does not handle errors. ```typescript export declare const lenUnsafe: ( instance: CML.TransactionMetadatumList, ) => number; ``` -------------------------------- ### Get the length of MapAssetNameToU64 (unsafe) Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/MapAssetNameToU64.ts.md Unsafely get the number of elements in a MapAssetNameToU64 instance. This bypasses Effect error handling. ```typescript export declare const lenUnsafe: (instance: CML.MapAssetNameToU64) => number; ``` -------------------------------- ### Mint Methods Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Mint.ts.md Core methods for interacting with Mint instances. ```APIDOC ## asNegativeMultiasset Method asNegativeMultiasset of Mint ### Description Converts the Mint instance to a MultiAsset representing negative values. ### Signature ```ts export declare const asNegativeMultiasset: ( instance: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## asPositiveMultiasset Method asPositiveMultiasset of Mint ### Description Converts the Mint instance to a MultiAsset representing positive values. ### Signature ```ts export declare const asPositiveMultiasset: ( instance: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## checkedAdd Method checkedAdd of Mint ### Description Adds another Mint instance to the current one, with checks. ### Signature ```ts export declare const checkedAdd: ( instance: CML.Mint, rhs: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## checkedSub Method checkedSub of Mint ### Description Subtracts another Mint instance from the current one, with checks. ### Signature ```ts export declare const checkedSub: ( instance: CML.Mint, rhs: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## free Method free of Mint ### Description Frees the memory associated with the Mint instance. ### Signature ```ts export declare const free: ( instance: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## get Method get of Mint ### Description Retrieves the value of a specific asset within a policy. ### Signature ```ts export declare const get: ( instance: CML.Mint, policyId: CML.ScriptHash, asset: CML.AssetName, ) => Effect.Effect; ``` ``` ```APIDOC ## getAssets Method getAssets of Mint ### Description Retrieves all assets associated with a given policy ID. ### Signature ```ts export declare const getAssets: ( instance: CML.Mint, key: CML.ScriptHash, ) => Effect.Effect; ``` ``` ```APIDOC ## insertAssets Method insertAssets of Mint ### Description Inserts or updates assets for a given policy ID. ### Signature ```ts export declare const insertAssets: ( instance: CML.Mint, policyId: CML.ScriptHash, assets: CML.MapAssetNameToNonZeroInt64, ) => Effect.Effect; ``` ``` ```APIDOC ## keys Method keys of Mint ### Description Retrieves a list of all policy IDs present in the Mint instance. ### Signature ```ts export declare const keys: ( instance: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## policyCount Method policyCount of Mint ### Description Returns the number of unique policy IDs in the Mint instance. ### Signature ```ts export declare const policyCount: ( instance: CML.Mint, ) => Effect.Effect; ``` ``` ```APIDOC ## set Method set of Mint ### Description Sets or updates the value of a specific asset within a policy. ### Signature ```ts export declare const set: ( instance: CML.Mint, policyId: CML.ScriptHash, asset: CML.AssetName, value: bigint, ) => Effect.Effect; ``` ``` -------------------------------- ### Package Structure Example Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/code-style.md Illustrates how to structure packages for distinct responsibilities and reuse of common logic. Each package should have a clear purpose. ```typescript packages/ cml/ index.ts cardano-js/ index.ts ``` ```typescript import * as CML from "cml-library"; export const add = (a: number, b: number): number => { return CML.add(a, b); }; ``` ```typescript import * as CardanoJS from "cardano-js-library"; export const add = (a: number, b: number): number => { return CardanoJS.add(a, b); }; ``` -------------------------------- ### Get Length of FilesDetailsList Unsafely Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/FilesDetailsList.ts.md Gets the number of elements in the FilesDetailsList directly, without an Effect wrapper. Use with caution. ```typescript export declare const lenUnsafe: (instance: CML.FilesDetailsList) => number; ``` -------------------------------- ### Install Lucid Package Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/README.md Install the core lucid package using pnpm. This command automatically includes all other packages in the library. ```bash pnpm i @lucid-evolution/lucid ``` -------------------------------- ### Complete DRep Delegation Transaction Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/documentation/deep-dives/governance.mdx This example demonstrates the full process of initializing Lucid, selecting a wallet, obtaining a reward address, converting a DRep ID, building a delegation transaction, signing it with the wallet, and submitting it to the network. ```typescript import { Lucid, Blockfrost, drepIDToCredential } from "@lucid-evolution/lucid"; // Initialize Lucid const lucid = await Lucid( new Blockfrost( "https://cardano-mainnet.blockfrost.io/api/v0", "" ), "Mainnet" ); // Select wallet lucid.selectWallet.fromPrivateKey(privateKey); // Get your reward address const rewardAddress = await lucid.wallet().rewardAddress(); // Convert DRep ID to credential const drepId = "drep1..."; const drepCredential = drepIDToCredential(drepId); // Build, sign and submit transaction const tx = await lucid .newTx() .delegate.VoteToDRep(rewardAddress, drepCredential) // or use a predefined strategy .complete(); const signedTx = await tx.sign.withWallet().complete(); const txHash = await signedTx.submit(); ``` -------------------------------- ### Get the length of RelayList Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/RelayList.ts.md Returns the number of elements in the RelayList within an Effect. This is the safe method for getting the list's length. ```typescript export declare const len: ( instance: CML.RelayList, ) => Effect.Effect; ``` -------------------------------- ### Methods Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/CIP36KeyRegistration.ts.md Core methods for interacting with CIP36KeyRegistration instances. ```APIDOC ## delegation Retrieves the delegation distribution associated with the key registration. ### Method Signature ```ts export declare const delegation: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## free Frees the memory associated with the CIP36KeyRegistration instance. ### Method Signature ```ts export declare const free: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## nonce Retrieves the nonce associated with the key registration. ### Method Signature ```ts export declare const nonce: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## paymentAddress Retrieves the payment address associated with the key registration. ### Method Signature ```ts export declare const paymentAddress: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## setVotingPurpose Sets the voting purpose for the key registration. ### Method Signature ```ts export declare const setVotingPurpose: ( instance: CML.CIP36KeyRegistration, votingPurpose: bigint, ) => Effect.Effect; ``` ``` ```APIDOC ## stakeCredential Retrieves the stake credential associated with the key registration. ### Method Signature ```ts export declare const stakeCredential: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## toCanonicalCborBytes Converts the CIP36KeyRegistration to canonical CBOR bytes. ### Method Signature ```ts export declare const toCanonicalCborBytes: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## toCanonicalCborHex Converts the CIP36KeyRegistration to a canonical CBOR hex string. ### Method Signature ```ts export declare const toCanonicalCborHex: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## toCborBytes Converts the CIP36KeyRegistration to CBOR bytes. ### Method Signature ```ts export declare const toCborBytes: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## toCborHex Converts the CIP36KeyRegistration to a CBOR hex string. ### Method Signature ```ts export declare const toCborHex: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## toJsValue Converts the CIP36KeyRegistration to a JavaScript value. ### Method Signature ```ts export declare const toJsValue: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## toJson Converts the CIP36KeyRegistration to a JSON string. ### Method Signature ```ts export declare const toJson: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` ```APIDOC ## votingPurpose Retrieves the voting purpose associated with the key registration. ### Method Signature ```ts export declare const votingPurpose: ( instance: CML.CIP36KeyRegistration, ) => Effect.Effect; ``` ``` -------------------------------- ### Deposit and Collect from Contract Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/docs/pages/documentation/deep-dives/transaction-chaining.mdx This example shows how to deposit assets to a contract and then collect them in a subsequent transaction using `chain()` and `collectFrom`. ```typescript // Deposit to contract const [newWalletUTxOs, contractOutputs, txSignBuilder] = await lucid .newTx() .pay.ToAddressWithData( contractAddress, { kind: "inline", value: datum }, { lovelace: 10_000_000n } ) .chain(); // Sign and submit const signedTx = await txSignBuilder.sign.withWallet().complete(); await signedTx.submit(); // Update wallet state lucid.overrideUTxOs(newWalletUTxOs); // Collect from contract const [newWalletUTxOs2, derivedOutputs2, txSignBuilder2] = await lucid .newTx() .collectFrom(contractOutputs, redeemer) .attach.SpendingValidator(validator) .chain(); // Sign and submit const signedTx2 = await txSignBuilder2.sign.withWallet().complete(); await signedTx2.submit(); // Update wallet state again lucid.overrideUTxOs(newWalletUTxOs2); ``` -------------------------------- ### Get the length of PlutusMap Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/PlutusMap.ts.md Use `len` to get the number of key-value pairs in a PlutusMap. Returns the count as a number within an Effect. ```typescript export declare const len: ( instance: CML.PlutusMap, ) => Effect.Effect; ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/CIP36KeyDeregistration.ts.md Methods to create new CIP36KeyDeregistration instances from different formats. ```APIDOC ## fromCborBytes Static method to create a CIP36KeyDeregistration instance from CBOR bytes. ### Method `fromCborBytes(cborBytes: Uint8Array): Effect.Effect` ### Parameters - **cborBytes** (Uint8Array) - The CBOR encoded bytes. ### Returns An Effect that resolves to a CIP36KeyDeregistration instance or a CIP36KeyDeregistrationError. ``` ```APIDOC ## fromCborHex Static method to create a CIP36KeyDeregistration instance from a CBOR hex string. ### Method `fromCborHex(cborHex: string): Effect.Effect` ### Parameters - **cborHex** (string) - The CBOR encoded hex string. ### Returns An Effect that resolves to a CIP36KeyDeregistration instance or a CIP36KeyDeregistrationError. ``` ```APIDOC ## fromJson Static method to create a CIP36KeyDeregistration instance from a JSON string. ### Method `fromJson(json: string): Effect.Effect` ### Parameters - **json** (string) - The JSON string representing the deregistration data. ### Returns An Effect that resolves to a CIP36KeyDeregistration instance or a CIP36KeyDeregistrationError. ``` -------------------------------- ### Get List Length Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/GovActionIdList.ts.md Gets the current number of elements in the GovActionIdList within an Effect. Provides the list's size safely. ```typescript export declare const len: ( instance: CML.GovActionIdList, ) => Effect.Effect; ``` -------------------------------- ### Create Preview NetworkInfo Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/NetworkInfo.ts.md Creates a NetworkInfo instance for the Cardano preview testnet. The result is returned as an Effect. ```typescript export declare const preview: () => Effect.Effect< CML.NetworkInfo, NetworkInfoError >; ``` -------------------------------- ### Get BootstrapWitnessList Length Unsafely Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/BootstrapWitnessList.ts.md Gets the number of elements in the BootstrapWitnessList directly, without an Effect wrapper. Returns the length as a number. ```typescript export declare const lenUnsafe: (instance: CML.BootstrapWitnessList) => number; ``` -------------------------------- ### Get the length of the RedeemerKeyList Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/RedeemerKeyList.ts.md Use `len` to get the number of RedeemerKey elements in the RedeemerKeyList within an Effect. This operation can fail and throw a `RedeemerKeyListError`. ```typescript export declare const len: ( instance: CML.RedeemerKeyList, ) => Effect.Effect; ``` -------------------------------- ### Methods Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/MultiHostName.ts.md Instance methods for operating on MultiHostName objects. ```APIDOC ## dnsName Method dnsName of MultiHostName ### Description Retrieves the DNS name associated with the MultiHostName instance. ### Signature ```ts export declare const dnsName: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## free Method free of MultiHostName ### Description Frees the resources associated with the MultiHostName instance. ### Signature ```ts export declare const free: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## toCanonicalCborBytes Method toCanonicalCborBytes of MultiHostName ### Description Serializes the MultiHostName instance to canonical CBOR bytes. ### Signature ```ts export declare const toCanonicalCborBytes: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## toCanonicalCborHex Method toCanonicalCborHex of MultiHostName ### Description Serializes the MultiHostName instance to a canonical CBOR hex string. ### Signature ```ts export declare const toCanonicalCborHex: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## toCborBytes Method toCborBytes of MultiHostName ### Description Serializes the MultiHostName instance to CBOR bytes. ### Signature ```ts export declare const toCborBytes: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## toCborHex Method toCborHex of MultiHostName ### Description Serializes the MultiHostName instance to a CBOR hex string. ### Signature ```ts export declare const toCborHex: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## toJsValue Method toJsValue of MultiHostName ### Description Converts the MultiHostName instance to a JavaScript value. ### Signature ```ts export declare const toJsValue: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` ```APIDOC ## toJson Method toJson of MultiHostName ### Description Serializes the MultiHostName instance to a JSON string. ### Signature ```ts export declare const toJson: ( instance: CML.MultiHostName, ) => Effect.Effect; ``` ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/CIP36KeyRegistration.ts.md Methods to create new CIP36KeyRegistration instances from various formats. ```APIDOC ## fromCborBytes Static method to create a CIP36KeyRegistration from CBOR bytes. ### Method Signature ```ts export declare const fromCborBytes: ( cborBytes: Uint8Array, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborHex Static method to create a CIP36KeyRegistration from a CBOR hex string. ### Method Signature ```ts export declare const fromCborHex: ( cborBytes: string, ) => Effect.Effect; ``` ``` ```APIDOC ## fromJson Static method to create a CIP36KeyRegistration from a JSON string. ### Method Signature ```ts export declare const fromJson: ( json: string, ) => Effect.Effect; ``` ``` -------------------------------- ### Get Length of ProposalProcedureList Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/ProposalProcedureList.ts.md Returns the number of elements in a ProposalProcedureList within an Effect context. This is the safe way to get the list's length. ```typescript export declare const len: ( instance: CML.ProposalProcedureList, ) => Effect.Effect; ``` -------------------------------- ### Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Ipv4.ts.md Methods for creating Ipv4 instances from different data formats. ```APIDOC ## fromCborBytes Static method fromCborBytes of Ipv4 ### Description Creates an Ipv4 instance from CBOR encoded bytes. ### Signature ```ts export declare const fromCborBytes: ( cborBytes: Uint8Array, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborHex Static method fromCborHex of Ipv4 ### Description Creates an Ipv4 instance from a CBOR hex string. ### Signature ```ts export declare const fromCborHex: ( cborBytes: string, ) => Effect.Effect; ``` ``` ```APIDOC ## fromJson Static method fromJson of Ipv4 ### Description Creates an Ipv4 instance from a JSON string. ### Signature ```ts export declare const fromJson: ( json: string, ) => Effect.Effect; ``` ``` -------------------------------- ### Get Length of Ed25519KeyHashList Unsafely Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Ed25519KeyHashList.ts.md Unsafely gets the number of elements in an Ed25519KeyHashList without an Effect wrapper. Use this only when the list is guaranteed to be valid. ```typescript export declare const lenUnsafe: (instance: CML.Ed25519KeyHashList) => number; ``` -------------------------------- ### Get Length of Ed25519KeyHashList Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/Ed25519KeyHashList.ts.md Gets the number of elements in an Ed25519KeyHashList within an Effect context. This is the safe method for checking the list's size. ```typescript export declare const len: ( instance: CML.Ed25519KeyHashList, ) => Effect.Effect; ``` -------------------------------- ### Methods Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/ExUnitPrices.ts.md Core methods for interacting with ExUnitPrices instances. ```APIDOC ## free Method free of ExUnitPrices ### Description Frees the memory associated with an ExUnitPrices instance. ### Signature ```ts export declare const free: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` ```APIDOC ## memPrice Method memPrice of ExUnitPrices ### Description Retrieves the memory price associated with the ExUnitPrices instance. ### Signature ```ts export declare const memPrice: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` ```APIDOC ## stepPrice Method stepPrice of ExUnitPrices ### Description Retrieves the step price associated with the ExUnitPrices instance. ### Signature ```ts export declare const stepPrice: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` ```APIDOC ## toCanonicalCborBytes Method toCanonicalCborBytes of ExUnitPrices ### Description Serializes the ExUnitPrices instance to its canonical CBOR byte representation. ### Signature ```ts export declare const toCanonicalCborBytes: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` ```APIDOC ## toCanonicalCborHex Method toCanonicalCborHex of ExUnitPrices ### Description Serializes the ExUnitPrices instance to its canonical CBOR hex string representation. ### Signature ```ts export declare const toCanonicalCborHex: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` ```APIDOC ## toCborBytes Method toCborBytes of ExUnitPrices ### Description Serializes the ExUnitPrices instance to its CBOR byte representation. ### Signature ```ts export declare const toCborBytes: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` ```APIDOC ## toCborHex Method toCborHex of ExUnitPrices ### Description Serializes the ExUnitPrices instance to its CBOR hex string representation. ### Signature ```ts export declare const toCborHex: ( instance: CML.ExUnitPrices, ) => Effect.Effect; ``` ``` -------------------------------- ### Get BootstrapWitnessList Length Safely Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/BootstrapWitnessList.ts.md Gets the number of elements in the BootstrapWitnessList within an Effect. Provides safe access to the list's size. ```typescript export declare const len: ( instance: CML.BootstrapWitnessList, ) => Effect.Effect; ``` -------------------------------- ### ScriptPubkey Constructors Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/ScriptPubkey.ts.md Methods for creating ScriptPubkey instances. ```APIDOC ## _new Static method _new of ScriptPubkey ### Description Creates a new ScriptPubkey instance from an Ed25519KeyHash. ### Signature ```ts export declare const _new: ( ed25519KeyHash: CML.Ed25519KeyHash, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborBytes Static method fromCborBytes of ScriptPubkey ### Description Creates a new ScriptPubkey instance from CBOR encoded bytes. ### Signature ```ts export declare const fromCborBytes: ( cborBytes: Uint8Array, ) => Effect.Effect; ``` ``` ```APIDOC ## fromCborHex Static method fromCborHex of ScriptPubkey ### Description Creates a new ScriptPubkey instance from a CBOR hex string. ### Signature ```ts export declare const fromCborHex: ( cborBytes: string, ) => Effect.Effect; ``` ``` ```APIDOC ## fromJson Static method fromJson of ScriptPubkey ### Description Creates a new ScriptPubkey instance from a JSON string. ### Signature ```ts export declare const fromJson: ( json: string, ) => Effect.Effect; ``` ``` -------------------------------- ### Function Commenting with JSDoc Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/code-style.md Functions must include a concise description, usage example with @example, introduction version with @since, and a category tag. ```typescript /** * Sums two numbers * * @example * import { sum } from "my-package/Calculator"; * sum(1, 2) // 3 * * @since 1.0.0 * @category transformation */ export const sum = (self: number, that: number): number => self + that; ``` -------------------------------- ### Get a RedeemerKey from the list by index Source: https://github.com/anastasia-labs/lucid-evolution/blob/main/packages/experimental/docs/modules/CML/RedeemerKeyList.ts.md Use `get` to retrieve a RedeemerKey from the RedeemerKeyList at a specific index within an Effect. This operation can fail and throw a `RedeemerKeyListError`. ```typescript export declare const get: ( instance: CML.RedeemerKeyList, index: number, ) => Effect.Effect; ```