Choose a wallet

Use different methods to select a wallet and query balances.

Wallet selection

There are multiple methods to select a wallet in Lucid.

Select wallet from private key

const privateKey = lucid.utils.generatePrivateKey(); // Bech32 encoded private key
lucid.selectWalletFromPrivateKey(privateKey);

Select wallet from seed phrase

const seed = lucid.utils.generateSeedPhrase();
lucid.selectWalletFromSeed(seed);

Select wallet from browser

The wallet type works obviously only in the browser. This method works for any CIP-0030 compliant wallet.

const api = await window.cardano.nami.enable();
lucid.selectWallet(api);

Select wallet from custom data

This wallet is viewable and can only handle query requests. Signing operations do not work because no private key was selected via this method.

lucid.selectWalletFrom({address: "addr_test...", utxos: [...]});

Query wallet

Get address

const address = await lucid.wallet.address(); // Bech32 address

Query UTxOs

const utxos = await lucid.wallet.getUtxos();

Query delegation

const delegation = await lucid.wallet.getDelegation();

Wallet API reference