Files
pwap/pezkuwi-sdk-ui/packages/react-signer/src/Password.tsx
T
pezkuwichain 971df8edba Rebrand: Remove 3rd party chains, update domains to PezkuwiChain
- Remove all 3rd party parachain configurations from endpoints:
  - productionRelayPolkadot.ts: Keep only system parachains
  - productionRelayDicle.ts: Keep only system parachains
  - testingRelayZagros.ts: Keep only system parachains
  - testingRelayTeyrChain.ts: Keep only system parachains

- Update domain references:
  - polkadot.js.org → pezkuwichain.app
  - wiki.polkadot.network → wiki.pezkuwichain.io
  - dotapps.io → pezkuwichain.app
  - statement.polkadot.network → docs.pezkuwichain.io/statement
  - support.polkadot.network → docs.pezkuwichain.io

- Update repository references:
  - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap

- Rename system parachains to Pezkuwi ecosystem:
  - PolkadotAssetHub → PezkuwiAssetHub
  - polkadotBridgeHub → pezkuwiBridgeHub
  - polkadotCollectives → pezkuwiCollectives
  - polkadotCoretime → pezkuwiCoretime
  - polkadotPeople → pezkuwiPeople

- Update network name in claims utility:
  - Polkadot → Pezkuwi
2026-01-09 03:08:11 +03:00

86 lines
2.1 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/react-signer authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { KeyringPair } from '@pezkuwi/keyring/types';
import React, { useEffect, useMemo, useState } from 'react';
import { Modal, Password, styled, Toggle } from '@pezkuwi/react-components';
import { keyring } from '@pezkuwi/ui-keyring';
import { useTranslation } from './translate.js';
import { UNLOCK_MINS } from './util.js';
interface Props {
address: string;
className?: string;
error?: string | null;
onChange: (password: string, isUnlockCached: boolean) => void;
onEnter?: () => void;
tabIndex?: number;
}
function getPair (address: string): KeyringPair | null {
try {
return keyring.getPair(address);
} catch {
return null;
}
}
function Unlock ({ address, className, error, onChange, onEnter, tabIndex }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const [password, setPassword] = useState('');
const [isUnlockCached, setIsUnlockCached] = useState(false);
const pair = useMemo(
() => getPair(address),
[address]
);
useEffect((): void => {
onChange(password, isUnlockCached);
}, [onChange, isUnlockCached, password]);
if (!pair || !pair.isLocked || pair.meta.isInjected) {
return null;
}
return (
<StyledModalColumns
className={className}
hint={t('Unlock the sending account to allow signing of this transaction.')}
>
<Password
autoFocus
isError={!!error}
label={t('unlock account with password')}
labelExtra={
<Toggle
label={t('unlock for {{expiry}} min', { replace: { expiry: UNLOCK_MINS } })}
onChange={setIsUnlockCached}
value={isUnlockCached}
/>
}
onChange={setPassword}
onEnter={onEnter}
tabIndex={tabIndex}
value={password}
/>
</StyledModalColumns>
);
}
const StyledModalColumns = styled(Modal.Columns)`
.errorLabel {
margin-right: 1rem;
color: #9f3a38 !important;
}
.ui--Toggle {
bottom: 1.1rem;
}
`;
export default React.memo(Unlock);