diff --git a/src/utils/beacon/BeaconPeers.test.tsx b/src/utils/beacon/BeaconPeers.test.tsx
index 93aa82a977..e27a294e5e 100644
--- a/src/utils/beacon/BeaconPeers.test.tsx
+++ b/src/utils/beacon/BeaconPeers.test.tsx
@@ -243,9 +243,6 @@ describe("", () => {
[peersData[0].senderId]: {
[mockMnemonicAccount(1).address.pkh]: NetworkType.MAINNET,
},
- [peersData[1].senderId]: {
- [mockMnemonicAccount(5).address.pkh]: NetworkType.FLORENCENET,
- },
[peersData[2].senderId]: {
[mockMnemonicAccount(2).address.pkh]: NetworkType.CUSTOM,
},
diff --git a/src/utils/beacon/BeaconPeers.tsx b/src/utils/beacon/BeaconPeers.tsx
index 6536ab4774..485039ac59 100644
--- a/src/utils/beacon/BeaconPeers.tsx
+++ b/src/utils/beacon/BeaconPeers.tsx
@@ -118,7 +118,7 @@ const PeerRow = ({ peerInfo, accountPkh }: { peerInfo: ExtendedPeerInfo; account
}
- onClick={() => removePeer(peerInfo, accountPkh)}
+ onClick={() => removePeer(peerInfo)}
size="xs"
variant="circle"
/>
diff --git a/src/utils/beacon/beacon.tsx b/src/utils/beacon/beacon.tsx
index d91aad65fd..e6dbc73452 100644
--- a/src/utils/beacon/beacon.tsx
+++ b/src/utils/beacon/beacon.tsx
@@ -4,7 +4,6 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import { makePeerInfo } from "./types";
import { WalletClient } from "./WalletClient";
-import { RawPkh } from "../../types/Address";
import { useRemoveConnection } from "../hooks/beaconHooks";
const PEERS_QUERY_KEY = "beaconPeers";
@@ -25,16 +24,10 @@ export const useRemovePeer = () => {
const refresh = useRefreshPeers();
const removeConnectionFromBeaconSlice = useRemoveConnection();
- return (peerInfo: ExtendedPeerInfo, accountPkh?: RawPkh) => {
- if (!accountPkh) {
- // No saved data for this dApp, just remove the peer connection.
- return WalletClient.removePeer(peerInfo as ExtendedP2PPairingResponse).then(refresh);
- }
- // Remove both: peer connection and saved data.
- return WalletClient.removePeer(peerInfo as ExtendedP2PPairingResponse)
- .then(() => removeConnectionFromBeaconSlice(peerInfo.senderId, accountPkh))
+ return (peerInfo: ExtendedPeerInfo) =>
+ WalletClient.removePeer(peerInfo as ExtendedP2PPairingResponse)
+ .then(() => removeConnectionFromBeaconSlice(peerInfo.senderId))
.then(refresh);
- };
};
export const useAddPeer = () => {
diff --git a/src/utils/hooks/beaconHooks.test.ts b/src/utils/hooks/beaconHooks.test.ts
index e0dad5ed79..363dd91e41 100644
--- a/src/utils/hooks/beaconHooks.test.ts
+++ b/src/utils/hooks/beaconHooks.test.ts
@@ -121,10 +121,9 @@ describe("useRemoveConnection", () => {
const {
result: { current: removeConnection },
} = renderHook(() => useRemoveConnection());
- removeConnection(dAppId1, pkh1);
+ removeConnection(dAppId1);
expect(store.getState().beacon).toEqual({
- [dAppId1]: { [pkh3]: NetworkType.CUSTOM },
[dAppId2]: { [pkh2]: NetworkType.GHOSTNET },
});
});
diff --git a/src/utils/hooks/beaconHooks.ts b/src/utils/hooks/beaconHooks.ts
index 38ed6385c5..d70730877f 100644
--- a/src/utils/hooks/beaconHooks.ts
+++ b/src/utils/hooks/beaconHooks.ts
@@ -42,10 +42,9 @@ export const useAddConnection = () => {
};
/**
- * Returns function for removing connection from {@link beaconSlice}.
+ * Returns function for removing connections from {@link beaconSlice}.
*/
export const useRemoveConnection = () => {
const dispatch = useDispatch();
- return (dAppId: string, accountPkh: RawPkh) =>
- dispatch(beaconSlice.actions.removeConnection({ dAppId, accountPkh }));
+ return (dAppId: string) => dispatch(beaconSlice.actions.removeConnection({ dAppId }));
};
diff --git a/src/utils/redux/migrations.ts b/src/utils/redux/migrations.ts
index ac72d30717..a6a2ad6eec 100644
--- a/src/utils/redux/migrations.ts
+++ b/src/utils/redux/migrations.ts
@@ -35,5 +35,5 @@ export const accountsMigrations = {
}
});
}),
- 3: identity,
+ 3: identity,
} as any;
diff --git a/src/utils/redux/slices/beaconSlice.test.ts b/src/utils/redux/slices/beaconSlice.test.ts
index b49a56da08..a2024e0ad9 100644
--- a/src/utils/redux/slices/beaconSlice.test.ts
+++ b/src/utils/redux/slices/beaconSlice.test.ts
@@ -64,24 +64,12 @@ describe("Beacon slice", () => {
});
});
- it("removes account record on removing connection", () => {
+ it("removes dApp record on removing connection", () => {
addConnection(dAppId1, pkh1, NetworkType.MAINNET);
addConnection(dAppId2, pkh2, NetworkType.GHOSTNET);
addConnection(dAppId1, pkh3, NetworkType.CUSTOM);
- store.dispatch(beaconActions.removeConnection({ dAppId: dAppId1, accountPkh: pkh1 }));
-
- expect(store.getState().beacon).toEqual({
- [dAppId1]: { [pkh3]: NetworkType.CUSTOM },
- [dAppId2]: { [pkh2]: NetworkType.GHOSTNET },
- });
- });
-
- it("removes dApp record on removing connections", () => {
- addConnection(dAppId1, pkh1, NetworkType.MAINNET);
- addConnection(dAppId2, pkh2, NetworkType.GHOSTNET);
-
- store.dispatch(beaconActions.removeConnection({ dAppId: dAppId1, accountPkh: pkh1 }));
+ store.dispatch(beaconActions.removeConnection({ dAppId: dAppId1 }));
expect(store.getState().beacon).toEqual({
[dAppId2]: { [pkh2]: NetworkType.GHOSTNET },
diff --git a/src/utils/redux/slices/beaconSlice.ts b/src/utils/redux/slices/beaconSlice.ts
index d29835285e..20b9c59341 100644
--- a/src/utils/redux/slices/beaconSlice.ts
+++ b/src/utils/redux/slices/beaconSlice.ts
@@ -29,11 +29,8 @@ export const beaconSlice = createSlice({
setWith(state, [payload.dAppId, payload.accountPkh], payload.networkType);
},
- removeConnection: (state, { payload }: { payload: { dAppId: string; accountPkh: RawPkh } }) => {
- delete state[payload.dAppId][payload.accountPkh];
- if (Object.keys(state[payload.dAppId]).length === 0) {
- delete state[payload.dAppId];
- }
+ removeConnection: (state, { payload }: { payload: { dAppId: string } }) => {
+ delete state[payload.dAppId];
},
},
});