addAccount method
dynamic
addAccount({})
Implementation
addAccount({
required String walletId,
required Future<String?> Function() getPassword,
SecureStore? secureStore,
}) async {
final wallet = state.wallets[walletId];
if (wallet == null) {
throw Exception("Wallet not found");
}
secureStore = secureStore ??
await getSecureStore(
getPassword: getPassword,
type: wallet.secureStoreType,
);
final seedPhrase = await secureStore.getSecret(
key: seedPhraseKey(walletId),
);
if (seedPhrase == null) {
throw Exception("Seed phrase not found");
}
final (walletWithAccount, account) = await WalletService.addAccount(
secureStore: secureStore,
wallet: wallet,
seedPhrase: seedPhrase,
);
updateWallet(wallet: walletWithAccount, accountId: account.id);
}