Skip to main content

importAccountFromMnemonic

Imports an account from a 25-word mnemonic.

Usage

import { voi } from '@kibisis/chains';
import { type Account, createKatavault } from '@kibisis/katavault-core';

const katavault = await createKatavault({
chains: [voi],
});
let account: Account;

await katavault.authenticateWithPasskey({
user: {
name: 'Kibi',
username: 'kibi@kibis.is',
},
});

account = await katavault.importAccountFromMnemonic({
mnemonic: 'under detect dog...',
name: 'MyAVMWallet',
});

console.log(account);
/*
{
address: 'NWAETAF7ULBD57DVW4JTH5ZENV5C3XOYLU66VLR3WVOUNBJWX5GOJLQZCI',
name: 'MyAVMWallet',
}
*/

Parameters

params

The 25-word mnemonic of the account to be imported and an optional name for the account.

Returns

Promise<Account>

A promise that resolves to the imported account.

Throws

InvalidAccountError

If the supplied mnemonic is not valid.

EncryptionError

If the account's private key failed to be encrypted.

NotAuthenticatedError

If the provider has not been authenticated.