Skip to Content
DocumentationWallet

Wallet

You can instantiate a wallet object from seed without binding it with a Lucid object by calling the walletFromSeed() function. For example, to use it with an emulator or to run test scenarios.

Steps to Create a Wallet

Generate Seed Phrase

import { generateSeedPhrase } from "@evolution-sdk/lucid"; const seedPhrase = generateSeedPhrase(); // BIP-39 console.log(seedPhrase);

Create Wallet

import { walletFromSeed } from "@evolution-sdk/lucid"; const seedPhrase = "your seed phrase here ..."; const wallet = walletFromSeed(seedPhrase); console.log(wallet); // { address, rewardAddress, paymentKey, stakeKey }

Utility Functions

Discover Used Key Hashes

To discover which key hashes are used in a transaction, limited by the specified UTxOs, you can use the discoverOwnUsedTxKeyHashes() function:

import { discoverOwnUsedTxKeyHashes } from "@evolution-sdk/lucid"; const tx: TxSignBuilder = await lucid .newTx() // ... build your transaction .complete(); const ownKeyHashes: Array<KeyHash> = ["KeyHash1", "KeyHash2", "OtherKeyHash"]; const ownUtxos: Array<UTxO> = utxos; const usedKeyHashes: Array<KeyHash> = discoverOwnUsedTxKeyHashes( tx.toTransaction(), ownKeyHashes, ownUtxos, ); console.log(usedKeyHashes); // ["KeyHash1", "KeyHash2"]
Last updated on