Skip to content

Commit

Permalink
fix: rename accounts update (#2665)
Browse files Browse the repository at this point in the history
  • Loading branch information
sokolova-an authored Nov 15, 2024
1 parent 5b83e03 commit 3fcf3bc
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { storageService } from '@/shared/api/storage';
import { type Wallet } from '@/shared/core';
import { nonNullable } from '@/shared/lib/utils';
import { walletModel, walletUtils } from '@/entities/wallet';
import { walletConnectModel } from '@/entities/walletConnect';

export type Callbacks = {
onSubmit: () => void;
Expand Down Expand Up @@ -45,6 +44,7 @@ const $walletForm = createForm({

const renameWalletFx = createEffect(async ({ id, accounts, ...rest }: Wallet): Promise<Wallet> => {
await storageService.wallets.update(id, rest);
await storageService.accounts.updateAll(accounts);

return { id, accounts, ...rest };
});
Expand Down Expand Up @@ -90,18 +90,6 @@ sample({
target: renameWalletFx,
});

sample({
clock: renameWalletFx.doneData,
filter: (updatedWallet) => {
return !walletUtils.isPolkadotVault(updatedWallet) && !walletUtils.isMultiShard(updatedWallet);
},
fn: (updatedWallet) => ({
walletId: updatedWallet.id,
accounts: updatedWallet.accounts,
}),
target: walletConnectModel.events.accountsUpdated,
});

sample({
clock: renameWalletFx.doneData,
fn: (updatedWallet) => {
Expand Down

0 comments on commit 3fcf3bc

Please sign in to comment.