Skip to content

Conversation

@0xnullifier
Copy link
Collaborator

@0xnullifier 0xnullifier commented Jan 16, 2026

Currently we are also importing faucet accounts from a encrypted json which have imported to client when doing metadata fetching.

While we are removing metadata fetching by importing faucet accounts with the release where this 0xMiden/miden-client#1638 is included (was not in 13.next.1) but until then this should do and I feel it is good to check otherwise also

@0xnullifier
Copy link
Collaborator Author

0xnullifier commented Jan 17, 2026

After looking at the import flow it seems that the encrypted file thing never worked as the secret keys were never added when importing accounts

@0xnullifier 0xnullifier force-pushed the utk-fix-import-encrypted-json branch 3 times, most recently from 6ba0d3e to 47e3714 Compare January 22, 2026 06:32
const midenClientDbContent = decryptedWallet.midenClientDbContent;
const walletDbContent = decryptedWallet.walletDbContent;
const seedPhrase = decryptedWallet.seedPhrase;
const walletAccounts = decryptedWallet.accounts;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old export files without the accounts field will cause import to fail. Need to add fallback: decryptedWallet.accounts ?? []

Copy link
Collaborator Author

@0xnullifier 0xnullifier Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But they would be useless anyways cause there is no way to get secret key without having accounts, I mean we could insert a single account assuming it would be a "On Chain" account but if it was not then that would be disastrous.

Also in lieu of upcoming upgrades the old accounts would be useless or will have zero values anyways

vaultKey
);
await savePlain(currentAccPubKeyStrgKey, newAccounts[0].publicKey);
await savePlain(currentAccPubKeyStrgKey, walletAccounts[0].publicKey);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

walletAccounts[0].publicKey without checking if array is empty will crash if importing old export files

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would add a error check here thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On another thought the loop above would anyways throw error if it could not find the walletAccount.

Or could it be the case that there are no accounts in miden db and no wallet accounts also? Unlikely no

console.log('importing wallet from client');
await importWalletFromClient(password, seedPhraseFormatted, importedWalletAccounts);
} catch (e) {
console.error(e);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should show an error message, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No UI for this currently; do you want me to address it in this one or separate one

@0xnullifier 0xnullifier force-pushed the utk-fix-import-encrypted-json branch from e5ce701 to 97e8b4a Compare January 23, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants