Documentation
Core Concepts
Wallet Creation
From API

Make Wallet From API

You can instantiate a wallet from API (it's typically a web wallet, a.k.a. browser extensions) to get a CIP-30 (opens in a new tab) wallet object without binding it with a Lucid object by calling the makeWalletFromAPI function.

Specify Provider

It can be Blockfrost (opens in a new tab), Koios (opens in a new tab), Maestro (opens in a new tab), etc. Even your custom provider, as long as it implements the Provider interface.

For example, with Blockfrost provider:

import { Blockfrost, Provider } from "@lucid-evolution/lucid";
 
/**
 * The endpoint based on the Cardano network,
 * please refer to Blockfrost documentations.
 */
const blockfrostURL: string = process.env.BF_URL!;
 
/**
 * Your secret Blockfrost Project ID
 */
const blockfrostPID: string = process.env.BF_PID!;
 
const blockfrost: Provider = new Blockfrost(
  blockfrostURL,
  blockfrostPID,
);

Other providers follow a similar pattern.

Create CIP-30 Wallet

import { makeWalletFromAPI } from "@lucid-evolution/lucid";
 
const provider = blockfrost;
const api = await window.cardano["WalletName"].enable(); // eternl, lace, etc.
const wallet = makeWalletFromAPI(provider, api); // CIP-30

Notice that the network will follow the current web-wallet's network. Make sure to provide a correct provider accordingly.