Disable multisig addition on Ethereum chains (#9211)

* Disable multisig addition on Ethereum chains

* Move issue comment to detection
This commit is contained in:
Jaco 2023-03-23 07:55:11 +02:00 committed by GitHub
parent 07d8bbfa6c
commit fbf285e7b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,7 @@ function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]>
function Overview ({ className = '', onStatusChange }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api, isElectron } = useApi();
const { api, isElectron, isEthereum } = useApi();
const { allAccounts, hasAccounts } = useAccounts();
const { isIpfs } = useIpfs();
const { isLedgerEnabled } = useLedger();
@ -156,9 +156,12 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
);
// detect multisigs
// FIXME Currently Ethereum shorter-addresses and the multisig hashing is not quite supported,
// somewhere in the chain we need to adjust quite a bit (it would seem). Tracking issue -
// https://github.com/polkadot-js/apps/issues/9209
const hasPalletMultisig = useMemo(
() => isFunction((api.tx.multisig || api.tx.utility)?.approveAsMulti),
[api]
() => !isEthereum && isFunction((api.tx.multisig || api.tx.utility)?.approveAsMulti),
[api, isEthereum]
);
// proxy support
@ -359,18 +362,24 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
onClick={toggleLedger}
/>
)}
<Button
icon='plus'
isDisabled={!hasPalletMultisig || !hasAccounts}
label={t<string>('Multisig')}
onClick={toggleMultisig}
/>
<Button
icon='plus'
isDisabled={!hasPalletProxy || !hasAccounts}
label={t<string>('Proxied')}
onClick={toggleProxy}
/>
{hasAccounts && (
<>
{hasPalletMultisig && (
<Button
icon='plus'
label={t<string>('Multisig')}
onClick={toggleMultisig}
/>
)}
{hasPalletProxy && (
<Button
icon='plus'
label={t<string>('Proxied')}
onClick={toggleProxy}
/>
)}
</>
)}
</Button.Group>
</SummaryBox>
{!isNextTick || !sortedAccounts.length