From e2ff9312d7ab0149ac420bcde7fa9dc2da43d100 Mon Sep 17 00:00:00 2001 From: Ysrbolles Date: Sun, 20 Oct 2024 16:59:21 +0100 Subject: [PATCH] refactor(app-config): update P-Chain address handling --- src/redux/slices/app-config.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/redux/slices/app-config.ts b/src/redux/slices/app-config.ts index 8ee28f53..1f7b7883 100644 --- a/src/redux/slices/app-config.ts +++ b/src/redux/slices/app-config.ts @@ -50,10 +50,14 @@ const appConfigSlice = createSlice({ state.walletStore = payload }, updatePchainAddress(state, { payload }) { - state.pChainAddress = payload.address[0] + const Address = store.getters.addresses[0].replace('X-', 'P-') + const activeAddress = payload.address.find((adr: string) => adr === Address) || null + + state.pChainAddress = activeAddress state.walletName = - payload.walletName !== 'Singleton Wallet' ? payload.walletName : payload.address[0] + payload.walletName !== 'Singleton Wallet' ? payload.walletName : activeAddress }, + updateAccount(state, { payload }) { state.account = payload },