Make Wallet From Seed
Similar to instantiating a wallet object from seed without binding it with the Lucid object by calling the walletFromSeed
function, you can instantiate a wallet from seed to get a CIP-30 (opens in a new tab) wallet object (not just { address, rewardAddress, paymentKey, stakeKey }
) by calling the makeWalletFromSeed
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 { makeWalletFromSeed } from "@lucid-evolution/lucid";
const provider = blockfrost;
const network: Network = "Mainnet"; // "Mainnet" | "Preview" | "Preprod" | "Custom"
const seedPhrase = "your seed phrase here ...";
const wallet = makeWalletFromSeed(provider, network, seedPhrase); // CIP-30