mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-12-03 02:47:04 +00:00
Remove the local fork
"Fork Locally" ran the selected chain in the browser through @acala-network/chopsticks-core, which brings its own @polkadot stack (types, rpc-provider, util-crypto 13 and 14) and @polkadot/wasm-crypto 7.5.4 with the crate versions pezkuwi-wasm 7.5.21 moved off. The app shipped that second wasm twice, next to ours, for a developer tool; chopsticks itself stays available from the command line. Gone: the button, the overlay, the "Local" mock-account modal and the chopsticks account group, the fork path in the API context, and their 69 locale strings. Mock accounts a fork left in a browser's keyring are address-only; they now show with the test accounts. yarn.lock: 32 @polkadot and 2 @acala-network entries -> 0.
This commit is contained in:
1 parent
8f49d487dc
commit
b77006ccfc
20 files changed
+35
-1154
No files matched your search
@@ -21,7 +21,6 @@ import ExportAll from '../modals/ExportAll.js';
|
||||
import ImportModal from '../modals/Import.js';
|
||||
import ImportAll from '../modals/ImportAll.js';
|
||||
import Ledger from '../modals/Ledger.js';
|
||||
import Local from '../modals/LocalAdd.js';
|
||||
import Multisig from '../modals/MultisigCreate.js';
|
||||
import Proxy from '../modals/ProxiedAdd.js';
|
||||
import Qr from '../modals/Qr.js';
|
||||
@@ -48,18 +47,17 @@ interface SortControls {
|
||||
sortFromMax: boolean;
|
||||
}
|
||||
|
||||
type GroupName = 'accounts' | 'chopsticks' | 'hardware' | 'injected' | 'multisig' | 'proxied' | 'qr' | 'testing';
|
||||
type GroupName = 'accounts' | 'hardware' | 'injected' | 'multisig' | 'proxied' | 'qr' | 'testing';
|
||||
|
||||
const DEFAULT_SORT_CONTROLS: SortControls = { sortBy: 'date', sortFromMax: true };
|
||||
|
||||
const STORE_FAVS = 'accounts:favorites';
|
||||
|
||||
const GROUP_ORDER: GroupName[] = ['accounts', 'injected', 'qr', 'hardware', 'proxied', 'multisig', 'testing', 'chopsticks'];
|
||||
const GROUP_ORDER: GroupName[] = ['accounts', 'injected', 'qr', 'hardware', 'proxied', 'multisig', 'testing'];
|
||||
|
||||
function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]> {
|
||||
const ret: Record<GroupName, string[]> = {
|
||||
accounts: [],
|
||||
chopsticks: [],
|
||||
hardware: [],
|
||||
injected: [],
|
||||
multisig: [],
|
||||
@@ -74,7 +72,10 @@ function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]>
|
||||
|
||||
if (account?.meta.isHardware) {
|
||||
ret.hardware.push(address);
|
||||
} else if (account?.meta.isTesting) {
|
||||
} else if (account?.meta.isTesting || account?.meta.isLocal) {
|
||||
// isLocal: address-only mock accounts from the local fork, removed in
|
||||
// 2026-10. They never could sign outside a fork, so they sit with the
|
||||
// test accounts.
|
||||
ret.testing.push(address);
|
||||
} else if (cryptoType === 'injected') {
|
||||
ret.injected.push(address);
|
||||
@@ -82,8 +83,6 @@ function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]>
|
||||
ret.multisig.push(address);
|
||||
} else if (cryptoType === 'proxied') {
|
||||
ret.proxied.push(address);
|
||||
} else if (cryptoType === 'chopsticks') {
|
||||
ret.chopsticks.push(address);
|
||||
} else if (cryptoType === 'qr') {
|
||||
ret.qr.push(address);
|
||||
} else {
|
||||
@@ -96,7 +95,7 @@ function groupAccounts (accounts: SortedAccount[]): Record<GroupName, string[]>
|
||||
|
||||
function Overview ({ className = '', onStatusChange }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api, fork } = useApi();
|
||||
const { api } = useApi();
|
||||
const { allAccounts, hasAccounts } = useAccounts();
|
||||
const { isIpfs } = useIpfs();
|
||||
const { isLedgerEnabled } = useLedger();
|
||||
@@ -105,7 +104,6 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
|
||||
const [isLedgerOpen, toggleLedger] = useToggle();
|
||||
const [isMultisigOpen, toggleMultisig] = useToggle();
|
||||
const [isProxyOpen, toggleProxy] = useToggle();
|
||||
const [isLocalOpen, toggleLocal] = useToggle();
|
||||
const [isQrOpen, toggleQr] = useToggle();
|
||||
const [isExportAll, toggleExportAll] = useToggle();
|
||||
const [isImportAll, toggleImportAll] = useToggle();
|
||||
@@ -207,7 +205,6 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
|
||||
(): Record<GroupName, [React.ReactNode?, string?, number?, (() => void)?][]> => {
|
||||
const ret: Record<GroupName, [React.ReactNode?, string?, number?, (() => void)?][]> = {
|
||||
accounts: [[<>{t('accounts')}<div className='sub'>{t('all locally stored accounts')}</div></>]],
|
||||
chopsticks: [[<>{t('chopsticks')}<div className='sub'>{t('local accounts added via chopsticks fork')}</div></>]],
|
||||
hardware: [[<>{t('hardware')}<div className='sub'>{t('accounts managed via hardware devices')}</div></>]],
|
||||
injected: [[<>{t('extension')}<div className='sub'>{t('accounts available via browser extensions')}</div></>]],
|
||||
multisig: [[<>{t('multisig')}<div className='sub'>{t('on-chain multisig accounts')}</div></>]],
|
||||
@@ -299,12 +296,6 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
|
||||
{isLedgerOpen && (
|
||||
<Ledger onClose={toggleLedger} />
|
||||
)}
|
||||
{isLocalOpen && (
|
||||
<Local
|
||||
onClose={toggleLocal}
|
||||
onStatusChange={onStatusChange}
|
||||
/>
|
||||
)}
|
||||
{isMultisigOpen && (
|
||||
<Multisig
|
||||
onClose={toggleMultisig}
|
||||
@@ -419,13 +410,6 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{fork && (
|
||||
<Button
|
||||
icon='plus'
|
||||
label={t('Local')}
|
||||
onClick={toggleLocal}
|
||||
/>
|
||||
)}
|
||||
</Button.Group>
|
||||
</SummaryBox>
|
||||
{!isNextTick || !sortedAccounts.length
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
// Copyright 2017-2026 @pezkuwi/app-accounts authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ActionStatus } from '@pezkuwi/react-components/Status/types';
|
||||
import type { ModalProps } from '../types.js';
|
||||
|
||||
import React, { useCallback, useState } from 'react';
|
||||
|
||||
import { Button, Input, InputAddressSimple, Modal } from '@pezkuwi/react-components';
|
||||
import { keyring } from '@pezkuwi/ui-keyring';
|
||||
|
||||
import { useTranslation } from '../translate.js';
|
||||
|
||||
interface Props extends ModalProps {
|
||||
className?: string;
|
||||
onClose: () => void;
|
||||
onStatusChange: (status: ActionStatus) => void;
|
||||
}
|
||||
|
||||
interface CreateOptions {
|
||||
name: string;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export function createLocalAccount (address: string, { name }: CreateOptions): ActionStatus {
|
||||
const status = { action: 'create' } as ActionStatus;
|
||||
|
||||
try {
|
||||
keyring.addExternal(address, { isLocal: true, name, tags: ['local'] });
|
||||
|
||||
status.account = address;
|
||||
status.status = 'success';
|
||||
status.message = 'Local account created.';
|
||||
} catch (error) {
|
||||
status.status = 'error';
|
||||
status.message = (error as Error).message;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
function LocalAdd ({ className = '', onClose, onStatusChange }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const [{ isNameValid, name }, setName] = useState({ isNameValid: false, name: '' });
|
||||
const [address, setAdress] = useState<string | null>(null);
|
||||
|
||||
const _createLocalAccount = useCallback(
|
||||
() => {
|
||||
if (!address) {
|
||||
return;
|
||||
}
|
||||
|
||||
const options = { name: name.trim() };
|
||||
const status = createLocalAccount(address, options);
|
||||
|
||||
onStatusChange(status);
|
||||
onClose();
|
||||
},
|
||||
[address, name, onClose, onStatusChange]
|
||||
);
|
||||
|
||||
const _onChangeName = useCallback(
|
||||
(name: string) => setName({ isNameValid: (name.trim().length >= 3), name }),
|
||||
[]
|
||||
);
|
||||
|
||||
const isValid = isNameValid && !!address;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
className={className}
|
||||
header={t('Add a mock account to chopsticks')}
|
||||
onClose={onClose}
|
||||
size='large'
|
||||
>
|
||||
<Modal.Content>
|
||||
<Modal.Columns hint={t('Any address, this can override other accounts')}>
|
||||
<InputAddressSimple
|
||||
autoFocus
|
||||
label={t('address')}
|
||||
onChange={setAdress}
|
||||
placeholder={t('e.g. 5Gg3...')}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
<Modal.Columns hint={t('The name for this account')}>
|
||||
<Input
|
||||
className='full'
|
||||
isError={!isNameValid}
|
||||
label={t('name')}
|
||||
onChange={_onChangeName}
|
||||
placeholder={t('local account name')}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<Button
|
||||
icon='plus'
|
||||
isDisabled={!isValid}
|
||||
label={t('Add')}
|
||||
onClick={_createLocalAccount}
|
||||
/>
|
||||
</Modal.Actions>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(LocalAdd);
|
||||
Reference in new issue
Block a user