diff --git a/packages/page-accounts/src/Accounts/Account.tsx b/packages/page-accounts/src/Accounts/Account.tsx
index 5bc980f708..8f479f2754 100644
--- a/packages/page-accounts/src/Accounts/Account.tsx
+++ b/packages/page-accounts/src/Accounts/Account.tsx
@@ -207,6 +207,154 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
[getLedger, meta]
);
+ const menuItems = useMemo(() => [
+ createMenuGroup([
+ api.api.tx.identity?.setIdentity && !isHardware && (
+
+ {t('Set on-chain identity')}
+
+ ),
+ api.api.tx.identity?.setSubs && identity?.display && !isHardware && (
+
+ {t('Set on-chain sub-identities')}
+
+ ),
+ api.api.tx.democracy?.unlock && democracyUnlockTx && (
+
+ {t('Clear expired democracy locks')}
+
+ ),
+ api.api.tx.vesting?.vest && vestingVestTx && (
+
+ {t('Unlock vested amount')}
+
+ )
+ ]),
+ createMenuGroup([
+ !(isExternal || isHardware || isInjected || isMultisig) && (
+
+ {t('Derive account via derivation path')}
+
+ ),
+ isHardware && (
+
+ {t('Show address on hardware device')}
+
+ )
+ ]),
+ createMenuGroup([
+ !(isExternal || isHardware || isInjected || isMultisig || isDevelopment) && (
+
+ {t('Create a backup file for this account')}
+
+ ),
+ !(isExternal || isHardware || isInjected || isMultisig || isDevelopment) && (
+
+ {t("Change this account's password")}
+
+ ),
+ !(isInjected || isDevelopment) && (
+
+ {t('Forget this account')}
+
+ )
+ ]),
+ api.api.tx.recovery?.createRecovery && createMenuGroup([
+ !recoveryInfo && (
+
+ {t('Make recoverable')}
+
+ ),
+
+ {t('Initiate recovery for another')}
+
+ ]),
+ api.api.tx.multisig?.asMulti && isMultisig && createMenuGroup([
+
+ {t('Multisig approvals')}
+
+ ]),
+ api.api.query.democracy?.votingOf && delegation?.accountDelegated && createMenuGroup([
+
+ {t('Change democracy delegation')}
+ ,
+
+ {t('Undelegate')}
+
+ ]),
+ api.api.query.democracy?.votingOf && !delegation?.accountDelegated && createMenuGroup([
+
+ {t('Delegate democracy votes')}
+
+ ]),
+ api.api.query.proxy?.proxies && createMenuGroup([
+
+ {proxy?.[0].length
+ ? t('Manage proxies')
+ : t('Add proxy')
+ }
+
+ ]),
+ isEditable && !api.isDevelopment && createMenuGroup([
+
+ ])
+ ].filter((i) => i),
+ [_clearDemocracyLocks, _showOnHardware, _vestingVest, api, delegation, democracyUnlockTx, genesisHash, identity, isDevelopment, isEditable, isExternal, isHardware, isInjected, isMultisig, multiInfos, onSetGenesisHash, proxy, recoveryInfo, t, toggleBackup, toggleDelegate, toggleDerive, toggleForget, toggleIdentityMain, toggleIdentitySub, toggleMultisig, togglePassword, toggleProxyOverview, toggleRecoverAccount, toggleRecoverSetup, toggleUndelegate, vestingVestTx]);
+
if (!isVisible) {
return null;
}
@@ -456,6 +604,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
trigger={
}
@@ -465,150 +614,7 @@ function Account ({ account: { address, meta }, className = '', delegation, filt
text
vertical
>
- {createMenuGroup([
- api.api.tx.identity?.setIdentity && !isHardware && (
-
- {t('Set on-chain identity')}
-
- ),
- api.api.tx.identity?.setSubs && identity?.display && !isHardware && (
-
- {t('Set on-chain sub-identities')}
-
- ),
- api.api.tx.democracy?.unlock && democracyUnlockTx && (
-
- {t('Clear expired democracy locks')}
-
- ),
- api.api.tx.vesting?.vest && vestingVestTx && (
-
- {t('Unlock vested amount')}
-
- )
- ])}
- {createMenuGroup([
- !(isExternal || isHardware || isInjected || isMultisig) && (
-
- {t('Derive account via derivation path')}
-
- ),
- isHardware && (
-
- {t('Show address on hardware device')}
-
- )
- ])}
- {createMenuGroup([
- !(isExternal || isHardware || isInjected || isMultisig || isDevelopment) && (
-
- {t('Create a backup file for this account')}
-
- ),
- !(isExternal || isHardware || isInjected || isMultisig || isDevelopment) && (
-
- {t("Change this account's password")}
-
- ),
- !(isInjected || isDevelopment) && (
-
- {t('Forget this account')}
-
- )
- ])}
- {api.api.tx.recovery?.createRecovery && createMenuGroup([
- !recoveryInfo && (
-
- {t('Make recoverable')}
-
- ),
-
- {t('Initiate recovery for another')}
-
- ])}
- {api.api.tx.multisig?.asMulti && isMultisig && createMenuGroup([
-
- {t('Multisig approvals')}
-
- ])}
- {api.api.query.democracy?.votingOf && delegation?.accountDelegated && createMenuGroup([
-
- {t('Change democracy delegation')}
- ,
-
- {t('Undelegate')}
-
- ])}
- {api.api.query.democracy?.votingOf && !delegation?.accountDelegated && createMenuGroup([
-
- {t('Delegate democracy votes')}
-
- ])}
- {api.api.query.proxy?.proxies && createMenuGroup([
-
- {proxy?.[0].length
- ? t('Manage proxies')
- : t('Add proxy')
- }
-
- ])}
- {isEditable && !api.isDevelopment && createMenuGroup([
-
- ])}
+ {menuItems}