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 wallet object without binding it with a Lucid object by calling the makeWalletFromAPI()
function.
Steps to Create a Wallet Object
Specify the Provider
It can be Blockfrost , Koios , Maestro , etc. Even a custom provider, as long as it implements the Provider
interface.
For example, here’s how to instantiate a Blockfrost provider:
import { Blockfrost, Provider } from "@evolution-sdk/lucid";
const blockfrostURL: string = process.env.BF_URL!;
const blockfrostPID: string = process.env.BF_PID!;
const blockfrost: Provider = new Blockfrost(
blockfrostURL, // The endpoint based on the Cardano network, please refer to Blockfrost documentation
blockfrostPID, // Your secret Blockfrost Project ID
);
💡
Other providers follow a similar pattern.
Create the Wallet Object
import { makeWalletFromAPI } from "@evolution-sdk/lucid";
const provider = blockfrost;
const api = await window.cardano["WalletName"].enable(); // eternl, lace, etc.
const wallet = makeWalletFromAPI(provider, api); // CIP-30
Last updated on