mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-07-16 19:55:40 +00:00
971df8edba
- 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
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
// Copyright 2017-2026 @pezkuwi/app-staking-async authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { SessionInfo } from './types.js';
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
import { Input, Modal } from '@pezkuwi/react-components';
|
|
import { useApi } from '@pezkuwi/react-hooks';
|
|
import { isHex } from '@pezkuwi/util';
|
|
|
|
import { useTranslation } from '../../translate.js';
|
|
import SenderInfo from './SenderInfo.js';
|
|
|
|
interface Props {
|
|
className?: string;
|
|
controllerId: string;
|
|
onChange: (info: SessionInfo) => void;
|
|
stashId: string;
|
|
withFocus?: boolean;
|
|
withSenders?: boolean;
|
|
}
|
|
|
|
const EMPTY_PROOF = new Uint8Array();
|
|
|
|
function SessionKey ({ className = '', controllerId, onChange, stashId, withFocus, withSenders }: Props): React.ReactElement<Props> {
|
|
const { t } = useTranslation();
|
|
const { api } = useApi();
|
|
const [keys, setKeys] = useState<string | null>(null);
|
|
|
|
useEffect((): void => {
|
|
try {
|
|
onChange({
|
|
sessionTx: isHex(keys)
|
|
? api?.tx.session.setKeys(keys, EMPTY_PROOF)
|
|
: null
|
|
});
|
|
} catch {
|
|
onChange({ sessionTx: null });
|
|
}
|
|
}, [api?.tx.session, keys, onChange]);
|
|
|
|
return (
|
|
<div className={className}>
|
|
{withSenders && (
|
|
<SenderInfo
|
|
controllerId={controllerId}
|
|
stashId={stashId}
|
|
/>
|
|
)}
|
|
<Modal.Columns hint={t('The hex output from author_rotateKeys, as executed on the validator node. The keys will show as pending until applied at the start of a new session.')}>
|
|
<Input
|
|
autoFocus={withFocus}
|
|
isError={!keys}
|
|
label={t('Keys from rotateKeys')}
|
|
onChange={setKeys}
|
|
placeholder='0x...'
|
|
/>
|
|
</Modal.Columns>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default React.memo(SessionKey);
|