addWallet method

dynamic addWallet({
  1. required SecureStore secureStore,
  2. String? seedPhrase,
  3. String? walletId,
})

Implementation

addWallet({
  required SecureStore secureStore,
  String? seedPhrase,
  String? walletId,
}) async {
  seedPhrase = seedPhrase ?? WalletService.newSeedPhrase();
  final walletWithoutAccount = await WalletService.addWallet(
    secureStore: secureStore,
    seedPhrase: seedPhrase,
    walletId: walletId,
    walletName: "Wallet ${state.wallets.length + 1}",
  );
  final (walletWithAccount, account) = await WalletService.addAccount(
    secureStore: secureStore,
    wallet: walletWithoutAccount,
    seedPhrase: seedPhrase,
  );
  updateWallet(wallet: walletWithAccount, accountId: account.id);
}