updateSelectedAccountIsDeployed method

dynamic updateSelectedAccountIsDeployed({
  1. required String walletId,
  2. required int accountId,
  3. required bool isDeployed,
})

Implementation

updateSelectedAccountIsDeployed({
  required String walletId,
  required int accountId,
  required bool isDeployed,
}) {
  final wallet = state.wallets[walletId];
  if (wallet == null) {
    throw Exception("Wallet not found");
  }
  final account = wallet.accounts[accountId];
  if (account == null) {
    throw Exception("Account not found");
  }
  state = state.copyWith(
    wallets: {
      ...state.wallets,
      walletId: wallet.copyWith(
        accounts: {
          ...wallet.accounts,
          accountId: account.copyWith(
            isDeployed: isDeployed,
          ),
        },
      ),
    },
    selected: (accountId: accountId, walletId: wallet.id),
  );
}