export async function importWallet(params) {
    if (!params.mnemonic && !params.privateKey) {
        throw new Error('Either mnemonic or privateKey must be provided');
    }
    const { ethers } = await import('ethers');
    if (params.mnemonic) {
        const wallet = ethers.Wallet.fromPhrase(params.mnemonic);
        return {
            address: wallet.address,
            privateKey: wallet.privateKey,
            source: 'mnemonic',
        };
    }
    else {
        const wallet = new ethers.Wallet(params.privateKey);
        return {
            address: wallet.address,
            privateKey: wallet.privateKey,
            source: 'privateKey',
        };
    }
}
