Additional React.memo exports (#2456)

* Additional React.memo exports

* rm app-transfer artifacts
This commit is contained in:
Jaco Greeff 2020-03-25 12:30:19 +01:00 committed by GitHub
parent 941f9dc5b2
commit ae3839a39f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 289 additions and 399 deletions

View File

@ -8,10 +8,10 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^1.9.0-beta.1",
"@polkadot/api-contract": "^1.9.0-beta.1",
"@polkadot/api": "^1.9.0-beta.6",
"@polkadot/api-contract": "^1.9.0-beta.6",
"@polkadot/keyring": "^2.7.0-beta.8",
"@polkadot/types": "^1.9.0-beta.1",
"@polkadot/types": "^1.9.0-beta.6",
"@polkadot/util": "^2.7.0-beta.8",
"@polkadot/util-crypto": "^2.7.0-beta.8",
"babel-core": "^7.0.0-bridge.0",

View File

@ -4,12 +4,11 @@
import { Routes } from './types';
import Transfer from '@polkadot/app-transfer';
import TransferModal from '@polkadot/app-accounts/Accounts/modals/Transfer';
export default ([
{
Component: Transfer,
Component: TransferModal,
Modal: TransferModal,
display: {
isHidden: false,

View File

@ -3,7 +3,6 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { DeriveStakingValidators } from '@polkadot/api-derive/types';
import { BareProps as Props } from '@polkadot/react-components/types';
import { Balance, BlockNumber } from '@polkadot/types/interfaces';
import React from 'react';
@ -11,8 +10,7 @@ import { Bubble, IdentityIcon } from '@polkadot/react-components';
import { useApi, useCall } from '@polkadot/react-hooks';
import { formatBalance, formatNumber } from '@polkadot/util';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default function SummaryBar (props: Props): React.ReactElement<Props> {
function SummaryBar (): React.ReactElement {
const { api, systemChain, systemName, systemVersion } = useApi();
const bestNumber = useCall<BlockNumber>(api.derive.chain.bestNumber, []);
const bestNumberLag = useCall<BlockNumber>(api.derive.chain.bestNumberLag, []);
@ -48,3 +46,5 @@ export default function SummaryBar (props: Props): React.ReactElement<Props> {
</summary>
);
}
export default React.memo(SummaryBar);

View File

@ -12,7 +12,7 @@ interface Props {
accountId?: string | null;
}
export default function Transfer ({ accountId }: Props): React.ReactElement<Props> {
function Transfer ({ accountId }: Props): React.ReactElement<Props> {
const [amount, setAmount] = useState<BN | undefined | null>(null);
const [recipientId, setRecipientId] = useState<string | null>(null);
@ -46,3 +46,5 @@ export default function Transfer ({ accountId }: Props): React.ReactElement<Prop
</section>
);
}
export default React.memo(Transfer);

View File

@ -14,7 +14,7 @@ import AccountSelector from './AccountSelector';
import SummaryBar from './SummaryBar';
import Transfer from './Transfer';
export default function TemplateApp ({ className }: Props): React.ReactElement<Props> {
function TemplateApp ({ className }: Props): React.ReactElement<Props> {
const [accountId, setAccountId] = useState<string | null>(null);
return (
@ -27,3 +27,5 @@ export default function TemplateApp ({ className }: Props): React.ReactElement<P
</main>
);
}
export default React.memo(TemplateApp);

View File

@ -25,7 +25,7 @@ interface ContentProps {
password: string;
}
export default function ({ address, onClose }: Props): React.ReactElement<Props> {
function Backup ({ address, onClose }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [password, setPassword] = useState('');
const [isPassTouched, setIsPassTouched] = useState(false);
@ -110,3 +110,5 @@ function Content ({ address, doBackup, isPassTouched, isPassValid, onChangePass,
</Modal.Content>
);
}
export default React.memo(Backup);

View File

@ -14,7 +14,7 @@ interface Props {
onCommit: () => void;
}
export default function CreateConfirmation ({ address, name, onClose, onCommit }: Props): React.ReactElement<Props> | null {
function CreateConfirmation ({ address, name, onClose, onCommit }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
return (
@ -41,3 +41,5 @@ export default function CreateConfirmation ({ address, name, onClose, onCommit }
</Modal>
);
}
export default React.memo(CreateConfirmation);

View File

@ -67,7 +67,7 @@ function createAccount (source: KeyringPair, suri: string, name: string, passwor
return status;
}
export default function Derive ({ className, from, onClose }: Props): React.ReactElement {
function Derive ({ className, from, onClose }: Props): React.ReactElement {
const { t } = useTranslation();
const { queueAction } = useContext(StatusContext);
const [source] = useState(keyring.getPair(from));
@ -235,3 +235,5 @@ export default function Derive ({ className, from, onClose }: Props): React.Reac
</Modal>
);
}
export default React.memo(Derive);

View File

@ -13,7 +13,7 @@ interface Props {
onClose: () => void;
}
export default function RecoverAccount ({ address, className, onClose }: Props): React.ReactElement {
function RecoverAccount ({ address, className, onClose }: Props): React.ReactElement {
const { t } = useTranslation();
const [recover, setRecover] = useState<string | null>(null);
@ -49,3 +49,5 @@ export default function RecoverAccount ({ address, className, onClose }: Props):
</Modal>
);
}
export default React.memo(RecoverAccount);

View File

@ -17,7 +17,7 @@ interface Props {
const MAX_HELPERS = 16;
export default function RecoverSetup ({ address, className, onClose }: Props): React.ReactElement {
function RecoverSetup ({ address, className, onClose }: Props): React.ReactElement {
const { t } = useTranslation();
const { allAccounts } = useAccounts();
const { allAddresses } = useAddresses();
@ -84,3 +84,5 @@ export default function RecoverSetup ({ address, className, onClose }: Props): R
</Modal>
);
}
export default React.memo(RecoverSetup);

View File

@ -12,6 +12,6 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api-contract": "^1.9.0-beta.1"
"@polkadot/api-contract": "^1.9.0-beta.6"
}
}

View File

@ -17,7 +17,7 @@ interface Props {
onChange: (isValid: boolean) => void;
}
export default function ValidateAddr ({ address, onChange }: Props): React.ReactElement<Props> | null {
function ValidateAddr ({ address, onChange }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const contractInfo = useCall<Option<ContractInfo>>(api.query.contracts.contractInfoOf, [address]);
@ -54,3 +54,5 @@ export default function ValidateAddr ({ address, onChange }: Props): React.React
</InfoForInput>
);
}
export default React.memo(ValidateAddr);

View File

@ -23,7 +23,7 @@ function filterContracts (api: ApiPromise, { accounts, contracts: keyringContrac
.filter((contract: ApiContract | null): boolean => !!contract) as ApiContract[];
}
export default function Contracts (props: Props): React.ReactElement<Props> {
function Contracts (props: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const { accounts, basePath, contracts: keyringContracts, hasCode, showDeploy } = props;
@ -118,3 +118,5 @@ export default function Contracts (props: Props): React.ReactElement<Props> {
</>
);
}
export default React.memo(Contracts);

View File

@ -51,7 +51,7 @@ function truncate (param: string): string {
: param;
}
export default function MessageSignature ({ message: { args, mutates, name, returnType }, params = [], asConstructor = false, withTooltip = false }: Props): React.ReactElement<Props> {
function MessageSignature ({ message: { args, mutates, name, returnType }, params = [], asConstructor = false, withTooltip = false }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
return (
@ -107,3 +107,5 @@ export default function MessageSignature ({ message: { args, mutates, name, retu
</Signature>
);
}
export default React.memo(MessageSignature);

View File

@ -21,7 +21,7 @@ interface ParamDef {
type: TypeDef;
}
export default function Params ({ isDisabled, onChange, onEnter, params: propParams }: Props): React.ReactElement<Props> | null {
function Params ({ isDisabled, onChange, onEnter, params: propParams }: Props): React.ReactElement<Props> | null {
const [params, setParams] = useState<ParamDef[]>([]);
useEffect((): void => {
@ -45,3 +45,5 @@ export default function Params ({ isDisabled, onChange, onEnter, params: propPar
/>
);
}
export default React.memo(Params);

View File

@ -16,7 +16,7 @@ interface Props {
onRemove: () => void;
}
export default function RemoveABI ({ code, onClose, onRemove }: Props): React.ReactElement<Props> {
function RemoveABI ({ code, onClose, onRemove }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const _onRemove = (): void => {
@ -50,3 +50,5 @@ export default function RemoveABI ({ code, onClose, onRemove }: Props): React.Re
</Modal>
);
}
export default React.memo(RemoveABI);

View File

@ -24,7 +24,7 @@ interface Props {
prime: AccountId | null;
}
export default function Motion ({ className, isMember, members, motion: { hash, proposal, votes }, prime }: Props): React.ReactElement<Props> | null {
function Motion ({ className, isMember, members, motion: { hash, proposal, votes }, prime }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const bestNumber = useCall<BlockNumber>(api.derive.chain.bestNumber, []) || new BN(0);
@ -94,3 +94,5 @@ export default function Motion ({ className, isMember, members, motion: { hash,
</tr>
);
}
export default React.memo(Motion);

View File

@ -20,7 +20,7 @@ interface Props {
proposal: Proposal;
}
export default function Voting ({ hash, idNumber, isDisabled, members, prime, proposal }: Props): React.ReactElement<Props> | null {
function Voting ({ hash, idNumber, isDisabled, members, prime, proposal }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { hasAccounts } = useAccounts();
const [isVotingOpen, toggleVoting] = useToggle();
@ -77,3 +77,5 @@ export default function Voting ({ hash, idNumber, isDisabled, members, prime, pr
</>
);
}
export default React.memo(Voting);

View File

@ -4,29 +4,33 @@
import { AccountId, Balance } from '@polkadot/types/interfaces';
import { useEffect, useState } from 'react';
import { useAccounts, useApi, useCall } from '@polkadot/react-hooks';
interface Result {
isMember: boolean;
members: string[];
}
function transform (allAccounts: string[]): (queryMembers: [AccountId, Balance][]) => Result {
return (queryMembers: [AccountId, Balance][]): Result => {
const members = queryMembers.map((accountId): string => accountId.toString());
function transform (allAccounts: string[], queryMembers: [AccountId, Balance][]): Result {
const members = queryMembers.map((accountId): string => accountId.toString());
return {
members,
isMember: members.some((accountId): boolean => allAccounts.includes(accountId))
};
return {
members,
isMember: members.some((accountId): boolean => allAccounts.includes(accountId))
};
}
export default function useCouncilMembers (): Result {
const { api } = useApi();
const { allAccounts } = useAccounts();
const members = useCall<Result>(!!allAccounts.length && api.query.council.members, [], {
transform: transform(allAccounts)
}) || { isMember: false, members: [] };
const [state, setState] = useState<Result>({ isMember: false, members: [] });
const queryMembers = useCall<[AccountId, Balance][]>(api.query.council.members, []);
return members;
useEffect((): void => {
allAccounts && queryMembers && setState(
transform(allAccounts, queryMembers)
);
}, [allAccounts, queryMembers]);
return state;
}

View File

@ -6,8 +6,10 @@ import React from 'react';
type Props = {};
export default function Spacer (): React.ReactElement<Props> {
function Spacer (): React.ReactElement<Props> {
return (
<div />
);
}
export default React.memo(Spacer);

View File

@ -21,7 +21,7 @@ const hidden = uiSettings.uiMode === 'full'
? []
: ['propose'];
export default function DemocracyApp ({ basePath }: Props): React.ReactElement<Props> {
function DemocracyApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [
{
@ -47,3 +47,5 @@ export default function DemocracyApp ({ basePath }: Props): React.ReactElement<P
</main>
);
}
export default React.memo(DemocracyApp);

View File

@ -9,7 +9,7 @@ export default function useCounter (): number {
const { api, isApiReady } = useApi();
const mountedRef = useIsMountedRef();
const proposals = useCall<any[]>(isApiReady && api.derive.democracy?.proposals, []);
const referenda = useCall<any[]>(isApiReady && api.derive.democracy?.referendums, []);
const referenda = useCall<any[]>(isApiReady && api.derive.democracy?.referendumsActive, []);
const [counter, setCounter] = useState(0);
useEffect((): void => {

View File

@ -30,7 +30,7 @@ async function retrieveInfo (api: ApiPromise): Promise<Partial<Info>> {
}
}
export default function NodeInfo (): React.ReactElement<{}> {
function NodeInfo (): React.ReactElement<{}> {
const { t } = useTranslation();
const { api } = useApi();
const [info, setInfo] = useState<Partial<Info>>({});
@ -68,3 +68,5 @@ export default function NodeInfo (): React.ReactElement<{}> {
</>
);
}
export default React.memo(NodeInfo);

View File

@ -14,7 +14,7 @@ interface Props extends BareProps {
params?: any;
}
export default function BalanceDisplay ({ className, label, params, style }: Props): React.ReactElement<Props> {
function BalanceDisplay ({ className, label, params, style }: Props): React.ReactElement<Props> {
const { api } = useApi();
const allBalances = useCall<DerivedBalancesAll>(api.derive.balances.all as any, [params]);
@ -28,3 +28,5 @@ export default function BalanceDisplay ({ className, label, params, style }: Pro
/>
);
}
export default React.memo(BalanceDisplay);

View File

@ -10,7 +10,7 @@ import { Tabs } from '@polkadot/react-components';
import Selection from './Selection';
import { useTranslation } from './translate';
export default function ExtrinsicsApp ({ basePath }: Props): React.ReactElement<Props> {
function ExtrinsicsApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [{
isRoot: true,
@ -32,3 +32,5 @@ export default function ExtrinsicsApp ({ basePath }: Props): React.ReactElement<
}
export { ExtrinsicsApp };
export default React.memo(ExtrinsicsApp);

View File

@ -15,7 +15,7 @@ import { useTranslation } from './translate';
interface Props extends AppProps, BareProps {}
export default function AssetApp ({ basePath }: Props): React.ReactElement<Props> {
function AssetApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [
{
@ -44,3 +44,5 @@ export default function AssetApp ({ basePath }: Props): React.ReactElement<Props
</main>
);
}
export default React.memo(AssetApp);

View File

@ -17,7 +17,7 @@ interface Props extends ModalProps {
className?: string;
}
export default function Create ({ onClose, onRegister }: Props): React.ReactElement<Props> {
function Create ({ onClose, onRegister }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [assetId, setAssetId] = useState(new BN(0));
const [name, setName] = useState('new asset');
@ -60,3 +60,5 @@ export default function Create ({ onClose, onRegister }: Props): React.ReactElem
</Modal>
);
}
export default React.memo(Create);

View File

@ -20,7 +20,7 @@ interface Props extends BareProps {
stopJs: () => void;
}
export default function ActionButtons ({ className, isCustomExample, isRunning, removeSnippet, runJs, saveSnippet, stopJs }: Props): React.ReactElement<Props> {
function ActionButtons ({ className, isCustomExample, isRunning, removeSnippet, runJs, saveSnippet, stopJs }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [isOpen, setIsOpen] = useState(false);
const [snippetName, setSnippetName] = useState('');
@ -115,3 +115,5 @@ export default function ActionButtons ({ className, isCustomExample, isRunning,
</div>
);
}
export default React.memo(ActionButtons);

View File

@ -8,6 +8,8 @@ import React from 'react';
import Playground from './Playground';
export default function JsApp (props: Props): React.ReactElement<Props> {
function JsApp (props: Props): React.ReactElement<Props> {
return <Playground {...props} />;
}
export default React.memo(JsApp);

View File

@ -32,7 +32,7 @@ const schedulingOptions = [{
const ONE_THOUSAND = new BN(1000);
export default function Register ({ nextFreeId = ONE_THOUSAND, sudoKey }: Props): React.ReactElement<Props> | null {
function Register ({ nextFreeId = ONE_THOUSAND, sudoKey }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const { isOpen, onOpen, onClose } = useModal();
@ -152,3 +152,5 @@ export default function Register ({ nextFreeId = ONE_THOUSAND, sudoKey }: Props)
</>
);
}
export default React.memo(Register);

View File

@ -16,7 +16,7 @@ import Summary from './Summary';
import { useTranslation } from '../translate';
export default function Overview ({ isMine, sudoKey }: Props): React.ReactElement<Props> {
function Overview ({ isMine, sudoKey }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const parachains = useCall<DeriveParachain[]>(api.derive.parachains.overview) || null;
@ -66,3 +66,5 @@ export default function Overview ({ isMine, sudoKey }: Props): React.ReactElemen
</>
);
}
export default React.memo(Overview);

View File

@ -23,7 +23,7 @@ interface Props {
sudoKey: string;
}
export default function Deregister ({ id, info, isOpen, onClose, onSubmit, sudoKey }: Props): React.ReactElement<Props> | null {
function Deregister ({ id, info, isOpen, onClose, onSubmit, sudoKey }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const onSendRef = useRef<() => void>();
@ -77,3 +77,5 @@ export default function Deregister ({ id, info, isOpen, onClose, onSubmit, sudoK
</Modal>
);
}
export default React.memo(Deregister);

View File

@ -18,7 +18,7 @@ import { parachainName } from './util';
interface Props extends AppProps, BareProps {}
export default function ParachainsApp ({ basePath }: Props): React.ReactElement<Props> {
function ParachainsApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const sudoState = useSudo();
const paraInfoRef = useRef<DeriveParachainInfo | null>(null);
@ -65,3 +65,5 @@ export default function ParachainsApp ({ basePath }: Props): React.ReactElement<
</main>
);
}
export default React.memo(ParachainsApp);

View File

@ -22,7 +22,7 @@ interface Props {
const ledgerConnOptions = uiSettings.availableLedgerConn;
export default function General ({ className, isModalContent, onClose }: Props): React.ReactElement<Props> {
function General ({ className, isModalContent, onClose }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
// tri-state: null = nothing changed, false = no reload, true = reload required
const [changed, setChanged] = useState<boolean | null>(null);
@ -150,3 +150,5 @@ export default function General ({ className, isModalContent, onClose }: Props):
</div>
);
}
export default React.memo(General);

View File

@ -19,7 +19,7 @@ const hidden = uiSettings.uiMode === 'full'
? []
: ['developer'];
export default function SettingsApp ({ basePath, onStatusChange }: Props): React.ReactElement<Props> {
function SettingsApp ({ basePath, onStatusChange }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [
{
@ -55,3 +55,5 @@ export default function SettingsApp ({ basePath, onStatusChange }: Props): React
</main>
);
}
export default React.memo(SettingsApp);

View File

@ -14,7 +14,7 @@ interface Props {
value: Bid;
}
export default function BidRow ({ value: { who, kind, value } }: Props): React.ReactElement<Props> {
function BidRow ({ value: { who, kind, value } }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
return (
@ -35,3 +35,5 @@ export default function BidRow ({ value: { who, kind, value } }: Props): React.R
</tr>
);
}
export default React.memo(BidRow);

View File

@ -23,7 +23,7 @@ interface Props {
value: DeriveSocietyCandidate;
}
export default function Candidate ({ allMembers, isMember, ownMembers, value: { accountId, kind, value } }: Props): React.ReactElement<Props> {
function Candidate ({ allMembers, isMember, ownMembers, value: { accountId, kind, value } }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const votes = useCall<VoteType[]>(api.query.society.votes.multi as any, [allMembers.map((memberId): [AccountId, string] => [accountId, memberId])] as any, {
@ -60,3 +60,5 @@ export default function Candidate ({ allMembers, isMember, ownMembers, value: {
</tr>
);
}
export default React.memo(Candidate);

View File

@ -14,7 +14,7 @@ interface Props {
ownMembers: string[];
}
export default function CandidateVoting ({ candidateId, isMember, ownMembers }: Props): React.ReactElement<Props> {
function CandidateVoting ({ candidateId, isMember, ownMembers }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [isVisible, toggleVisible] = useToggle();
const [vote, setVote] = useState(true);
@ -65,3 +65,5 @@ export default function CandidateVoting ({ candidateId, isMember, ownMembers }:
</>
);
}
export default React.memo(CandidateVoting);

View File

@ -16,7 +16,7 @@ interface Props extends OwnMembers {
className?: string;
}
export default function Candidates ({ allMembers, className, isMember, ownMembers }: Props): React.ReactElement<Props> {
function Candidates ({ allMembers, className, isMember, ownMembers }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const candidates = useCall<DeriveSocietyCandidate[]>(api.derive.society.candidates, []);
@ -47,3 +47,5 @@ export default function Candidates ({ allMembers, className, isMember, ownMember
</div>
);
}
export default React.memo(Candidates);

View File

@ -19,7 +19,7 @@ interface Props extends OwnMembers {
info?: DeriveSociety;
}
export default function Defender ({ className, info, isMember, ownMembers }: Props): React.ReactElement<Props> | null {
function Defender ({ className, info, isMember, ownMembers }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const votes = useCall<VoteType[]>(api.derive.society.members, [], {
@ -55,3 +55,5 @@ export default function Defender ({ className, info, isMember, ownMembers }: Pro
</div>
);
}
export default React.memo(Defender);

View File

@ -13,7 +13,7 @@ interface Props {
ownMembers: string[];
}
export default function DefenderVoting ({ isMember, ownMembers }: Props): React.ReactElement<Props> {
function DefenderVoting ({ isMember, ownMembers }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [isVisible, toggleVisible] = useToggle();
const [vote, setVote] = useState(true);
@ -63,3 +63,5 @@ export default function DefenderVoting ({ isMember, ownMembers }: Props): React.
</>
);
}
export default React.memo(DefenderVoting);

View File

@ -16,7 +16,7 @@ interface Props {
info?: DeriveSociety;
}
export default function Members ({ className, info }: Props): React.ReactElement<Props> {
function Members ({ className, info }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const members = useCall<DeriveSocietyMember[]>(api.derive.society.members, []);
@ -52,3 +52,5 @@ export default function Members ({ className, info }: Props): React.ReactElement
</div>
);
}
export default React.memo(Members);

View File

@ -13,7 +13,7 @@ import { useTranslation } from './translate';
interface Props extends AppProps, BareProps {}
export default function SocietyApp ({ basePath, className }: Props): React.ReactElement<Props> {
function SocietyApp ({ basePath, className }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [
{
@ -37,3 +37,5 @@ export default function SocietyApp ({ basePath, className }: Props): React.React
</main>
);
}
export default React.memo(SocietyApp);

View File

@ -5,26 +5,30 @@
import { DeriveSocietyMember } from '@polkadot/api-derive/types';
import { OwnMembers } from './types';
import { useEffect, useState } from 'react';
import { useAccounts, useApi, useCall } from '@polkadot/react-hooks';
function transform (allAccounts: string[]): (members: DeriveSocietyMember[]) => OwnMembers {
return (members: DeriveSocietyMember[]): OwnMembers => {
const allMembers = members
.filter((member): boolean => !member.isSuspended)
.map((member): string => member.accountId.toString());
const ownMembers = allMembers
.filter((address): boolean => allAccounts.includes(address));
function transform (allAccounts: string[], members: DeriveSocietyMember[]): OwnMembers {
const allMembers = members
.filter((member): boolean => !member.isSuspended)
.map((member): string => member.accountId.toString());
const ownMembers = allMembers
.filter((address): boolean => allAccounts.includes(address));
return { allMembers, isMember: ownMembers.length !== 0, ownMembers };
};
return { allMembers, isMember: ownMembers.length !== 0, ownMembers };
}
export default function useMembers (): OwnMembers {
const { api } = useApi();
const { allAccounts } = useAccounts();
const state = useCall<OwnMembers>(!!allAccounts.length && api.derive.society?.members, [], {
transform: transform(allAccounts)
}) || { allMembers: [], isMember: false, ownMembers: [] };
const [state, setState] = useState<OwnMembers>({ allMembers: [], isMember: false, ownMembers: [] });
const members = useCall<DeriveSocietyMember[]>(api.derive.society?.members, []);
useEffect((): void => {
allAccounts && members && setState(
transform(allAccounts, members)
);
}, [allAccounts, members]);
return state;
}

View File

@ -14,7 +14,7 @@ interface Props extends BareProps {
value?: QueryTypes[];
}
export default function Queries ({ onRemove, value }: Props): React.ReactElement<Props> | null {
function Queries ({ onRemove, value }: Props): React.ReactElement<Props> | null {
if (!value || !value.length) {
return null;
}
@ -31,3 +31,5 @@ export default function Queries ({ onRemove, value }: Props): React.ReactElement
</section>
);
}
export default React.memo(Queries);

View File

@ -12,7 +12,7 @@ import { useApi } from '@polkadot/react-hooks';
import { useTranslation } from '../translate';
export default function Consts ({ onAdd }: Props): React.ReactElement<Props> {
function Consts ({ onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [defaultValue] = useState<ConstValue>((): ConstValue => {
@ -52,3 +52,5 @@ export default function Consts ({ onAdd }: Props): React.ReactElement<Props> {
</section>
);
}
export default React.memo(Consts);

View File

@ -64,7 +64,7 @@ function expandKey (api: ApiPromise, key: StorageEntryPromise): KeyState {
};
}
export default function Modules ({ onAdd }: Props): React.ReactElement<Props> {
function Modules ({ onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const [{ defaultValues, isIterable, key, params }, setKey] = useState<KeyState>({ defaultValues: undefined, isIterable: false, key: api.query.timestamp.now, params: [] });
@ -116,3 +116,5 @@ export default function Modules ({ onAdd }: Props): React.ReactElement<Props> {
</section>
);
}
export default React.memo(Modules);

View File

@ -11,7 +11,7 @@ import { useTranslation } from '../translate';
import { u8aToU8a } from '@polkadot/util';
import { Compact } from '@polkadot/types';
export default function Raw ({ onAdd }: Props): React.ReactElement<Props> {
function Raw ({ onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [{ isValid, key }, setValue] = useState<{ isValid: boolean; key: Uint8Array }>({ isValid: false, key: new Uint8Array([]) });
@ -49,3 +49,5 @@ export default function Raw ({ onAdd }: Props): React.ReactElement<Props> {
</section>
);
}
export default React.memo(Raw);

View File

@ -20,7 +20,7 @@ interface Props {
let id = -1;
export default function Selection ({ basePath, onAdd }: Props): React.ReactElement<Props> {
function Selection ({ basePath, onAdd }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [
{
@ -59,3 +59,5 @@ export default function Selection ({ basePath, onAdd }: Props): React.ReactEleme
</>
);
}
export default React.memo(Selection);

View File

@ -16,7 +16,7 @@ import Sudo from './Sudo';
import { useTranslation } from './translate';
export default function SudoApp ({ basePath }: Props): React.ReactElement<Props> {
function SudoApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { allAccounts, sudoKey, isMine } = useSudo();
const items = useMemo(() => [
@ -71,3 +71,5 @@ export default function SudoApp ({ basePath }: Props): React.ReactElement<Props>
</main>
);
}
export default React.memo(SudoApp);

View File

@ -12,7 +12,7 @@ import { formatNumber } from '@polkadot/util';
import { useTranslation } from '../translate';
export default function Summary ({ className, members, proposals }: Props): React.ReactElement<Props> {
function Summary ({ className, members, proposals }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const proposalCount = useCall<u32>(api.query.technicalCommittee.proposalCount, []);
@ -33,3 +33,5 @@ export default function Summary ({ className, members, proposals }: Props): Reac
</SummaryBox>
);
}
export default React.memo(Summary);

View File

@ -9,7 +9,7 @@ import React from 'react';
import Members from './Members';
import Summary from './Summary';
export default function Overview ({ className, isMember, members, prime, proposals }: Props): React.ReactElement<Props> {
function Overview ({ className, isMember, members, prime, proposals }: Props): React.ReactElement<Props> {
return (
<div className={className}>
<Summary
@ -24,3 +24,5 @@ export default function Overview ({ className, isMember, members, prime, proposa
</div>
);
}
export default React.memo(Overview);

View File

@ -20,7 +20,7 @@ interface Props {
prime?: AccountId | null;
}
export default function Proposal ({ className, hash, prime }: Props): React.ReactElement<Props> | null {
function Proposal ({ className, hash, prime }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const optProposal = useCall<Option<ProposalType>>(api.query.technicalCommittee.proposalOf, [hash]);
@ -75,3 +75,5 @@ export default function Proposal ({ className, hash, prime }: Props): React.Reac
</tr>
);
}
export default React.memo(Proposal);

View File

@ -18,7 +18,7 @@ interface Props {
proposalId: BN | number;
}
export default function Voting ({ hash, prime, proposalId }: Props): React.ReactElement<Props> | null {
function Voting ({ hash, prime, proposalId }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { hasAccounts } = useAccounts();
const [accountId, setAccountId] = useState<string | null>(null);
@ -68,3 +68,5 @@ export default function Voting ({ hash, prime, proposalId }: Props): React.React
</>
);
}
export default React.memo(Voting);

View File

@ -12,7 +12,7 @@ import { useTranslation } from '../translate';
import Proposal from './Proposal';
import Propose from './Propose';
export default function Proposals ({ className, isMember, members, prime, proposals }: Props): React.ReactElement<Props> {
function Proposals ({ className, isMember, members, prime, proposals }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
return (
@ -42,3 +42,5 @@ export default function Proposals ({ className, isMember, members, prime, propos
</div>
);
}
export default React.memo(Proposals);

View File

@ -15,7 +15,7 @@ interface State {
isHexData: boolean;
}
export default function Hash (): React.ReactElement<{}> {
function Hash (): React.ReactElement<{}> {
const { t } = useTranslation();
const [{ data, hash, isHexData }, setState] = useState<State>({
data: '',
@ -76,3 +76,5 @@ export default function Hash (): React.ReactElement<{}> {
</div>
);
}
export default React.memo(Hash);

View File

@ -13,7 +13,7 @@ interface Props extends BareProps {
queue: QueueTx[];
}
export default function Results ({ queue = [] }: Props): React.ReactElement<Props> | null {
function Results ({ queue = [] }: Props): React.ReactElement<Props> | null {
const filtered = queue
.filter(({ error, result }): boolean =>
!isUndefined(error) || !isUndefined(result)
@ -41,3 +41,5 @@ export default function Results ({ queue = [] }: Props): React.ReactElement<Prop
</section>
);
}
export default React.memo(Results);

View File

@ -10,7 +10,7 @@ import { QueueConsumer } from '@polkadot/react-components/Status/Context';
import Results from './Results';
import Selection from './Selection';
export default function RpcApp (): React.ReactElement {
function RpcApp (): React.ReactElement {
return (
<QueueConsumer>
{({ txqueue, queueRpc }: QueueProps): React.ReactNode => (
@ -22,3 +22,5 @@ export default function RpcApp (): React.ReactElement {
</QueueConsumer>
);
}
export default React.memo(RpcApp);

View File

@ -33,7 +33,7 @@ const AlignedIcon = styled(Icon)`
}
`;
export default function Verify (): React.ReactElement<{}> {
function Verify (): React.ReactElement<{}> {
const { t } = useTranslation();
const [{ cryptoType, isValid }, setValidity] = useState<{ cryptoType: CryptoTypes; isValid: boolean }>({ cryptoType: 'unknown', isValid: false });
const [{ data, isHexData }, setData] = useState<{ data: string; isHexData: boolean }>({ data: '', isHexData: false });
@ -157,3 +157,5 @@ export default function Verify (): React.ReactElement<{}> {
</div>
);
}
export default React.memo(Verify);

View File

@ -15,7 +15,7 @@ import Sign from './Sign';
import Verify from './Verify';
import { useTranslation } from './translate';
export default function ToolboxApp ({ basePath }: Props): React.ReactElement<Props> {
function ToolboxApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { hasAccounts } = useAccounts();
const items = useMemo(() => [
@ -60,3 +60,5 @@ export default function ToolboxApp ({ basePath }: Props): React.ReactElement<Pro
</main>
);
}
export default React.memo(ToolboxApp);

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,3 +0,0 @@
# @polkadot/app-transfer
A basic DOT transfer application, allowing the movement of funds from one account to another.

View File

@ -1,17 +0,0 @@
{
"name": "@polkadot/app-transfer",
"version": "0.40.0-beta.184",
"description": "A basic transfer app",
"main": "index.js",
"scripts": {},
"author": "Jaco Greeff <jacogr@gmail.com>",
"maintainers": [
"Jaco Greeff <jacogr@gmail.com>"
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/react-components": "0.40.0-beta.184",
"@polkadot/react-query": "0.40.0-beta.184"
}
}

View File

@ -1,13 +0,0 @@
// Copyright 2017-2020 @polkadot/app-transfer authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import React from 'react';
export default function App (): React.ReactElement {
return (
<>
Deprecated, now operates via modal
</>
);
}

View File

@ -19,7 +19,7 @@ interface Props {
proposals?: DerivedTreasuryProposal[];
}
export default function ProposalsBase ({ className, isApprovals, proposals }: Props): React.ReactElement<Props> {
function ProposalsBase ({ className, isApprovals, proposals }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const { allAccounts } = useAccounts();
@ -61,3 +61,5 @@ export default function ProposalsBase ({ className, isApprovals, proposals }: Pr
</div>
);
}
export default React.memo(ProposalsBase);

View File

@ -13,7 +13,7 @@ interface Props {
className?: string;
}
export default function Propose ({ className }: Props): React.ReactElement<Props> | null {
function Propose ({ className }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const [accountId, setAccountId] = useState<string | null>(null);
const [beneficiary, setBeneficiary] = useState<string | null>(null);
@ -74,3 +74,5 @@ export default function Propose ({ className }: Props): React.ReactElement<Props
</>
);
}
export default React.memo(Propose);

View File

@ -17,7 +17,7 @@ interface Props {
isDisabled: boolean;
}
export default function Submission ({ councilProposals, id, isDisabled }: Props): React.ReactElement<Props> | null {
function Submission ({ councilProposals, id, isDisabled }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { api } = useApi();
const councilThreshold = useCall<number>(api.query.electionsPhragmen?.members || api.query.elections.members, [], {
@ -97,3 +97,5 @@ export default function Submission ({ councilProposals, id, isDisabled }: Props)
</>
);
}
export default React.memo(Submission);

View File

@ -20,7 +20,7 @@ interface Props {
proposalCount?: number;
}
export default function Summary ({ approvalCount, proposalCount }: Props): React.ReactElement<Props> {
function Summary ({ approvalCount, proposalCount }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const bestNumber = useCall<Balance>(api.derive.chain.bestNumber as any, []);
@ -66,3 +66,5 @@ export default function Summary ({ approvalCount, proposalCount }: Props): React
</SummaryBox>
);
}
export default React.memo(Summary);

View File

@ -22,7 +22,7 @@ interface Option {
value: number;
}
export default function Voting ({ councilProposals, isDisabled }: Props): React.ReactElement<Props> | null {
function Voting ({ councilProposals, isDisabled }: Props): React.ReactElement<Props> | null {
const { t } = useTranslation();
const { hasAccounts } = useAccounts();
const [councilOpts, setCouncilOpts] = useState<Option[]>([]);
@ -106,3 +106,5 @@ export default function Voting ({ councilProposals, isDisabled }: Props): React.
</>
);
}
export default React.memo(Voting);

View File

@ -15,7 +15,7 @@ import Propose from './Propose';
interface Props extends AppProps, BareProps, I18nProps {}
export default function Overview ({ className }: Props): React.ReactElement<Props> {
function Overview ({ className }: Props): React.ReactElement<Props> {
const { api } = useApi();
const info = useCall<DerivedTreasuryProposals>(api.derive.treasury.proposals, []);
@ -33,3 +33,5 @@ export default function Overview ({ className }: Props): React.ReactElement<Prop
</div>
);
}
export default React.memo(Overview);

View File

@ -17,7 +17,7 @@ export { default as useCounter } from './useCounter';
interface Props extends AppProps, BareProps {}
export default function TreasuryApp ({ basePath }: Props): React.ReactElement<Props> {
function TreasuryApp ({ basePath }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const items = useMemo(() => [
{
@ -42,3 +42,5 @@ export default function TreasuryApp ({ basePath }: Props): React.ReactElement<Pr
</main>
);
}
export default React.memo(TreasuryApp);

View File

@ -31,7 +31,7 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.9.2",
"@polkadot/api": "^1.9.0-beta.1",
"@polkadot/api": "^1.9.0-beta.6",
"@polkadot/extension-dapp": "^0.23.0-beta.9",
"rxjs-compat": "^6.5.4"
}

View File

@ -1,4 +1,4 @@
// Copyright 2017-2020 @polkadot/app-transfer authors & contributors
// Copyright 2017-2020 @polkadot/react-components authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.

View File

@ -58,7 +58,6 @@ i18n
'app-sudo',
'app-tech-comm',
'app-toolbox',
'app-transfer',
'app-treasury',
'apps',
'apps-routing',

View File

@ -18,7 +18,7 @@ interface Props extends BaseProps {
overrides?: ComponentMap;
}
export default function Param ({ className, defaultValue, isDisabled, isOptional, name, onChange, onEnter, onEscape, overrides, style, type }: Props): React.ReactElement<Props> | null {
function Param ({ className, defaultValue, isDisabled, isOptional, name, onChange, onEnter, onEscape, overrides, style, type }: Props): React.ReactElement<Props> | null {
const compRef = useRef<React.ComponentType<CProps> | null>(findComponent(type, overrides));
if (!compRef.current) {
@ -54,3 +54,5 @@ export default function Param ({ className, defaultValue, isDisabled, isOptional
/>
);
}
export default React.memo(Param);

View File

@ -15,7 +15,7 @@ interface Props {
onChange: (fees: State) => void;
}
export default function ContractCall ({ endowment, fees, onChange }: Props): React.ReactElement<Props> | null {
function ContractCall ({ endowment, fees, onChange }: Props): React.ReactElement<Props> | null {
const [state, setState] = useState<State>({
extraFees: new BN(0),
extraAmount: new BN(0),
@ -43,3 +43,5 @@ export default function ContractCall ({ endowment, fees, onChange }: Props): Rea
return null;
}
export default React.memo(ContractCall);

View File

@ -15,7 +15,7 @@ interface Props {
onChange: (fees: State) => void;
}
export default function ContractDeploy ({ endowment, fees, onChange }: Props): React.ReactElement<Props> | null {
function ContractDeploy ({ endowment, fees, onChange }: Props): React.ReactElement<Props> | null {
const [state, setState] = useState<State>({
extraFees: new BN(0),
extraAmount: new BN(0),
@ -43,3 +43,5 @@ export default function ContractDeploy ({ endowment, fees, onChange }: Props): R
return null;
}
export default React.memo(ContractDeploy);

View File

@ -27,7 +27,7 @@ interface State extends ExtraFees {
const ZERO = new BN(0);
export default function Proposal ({ deposit, onChange }: Props): React.ReactElement<Props> {
function Proposal ({ deposit, onChange }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const minDeposit = api.consts.democracy.minimumDeposit;
@ -84,3 +84,5 @@ export default function Proposal ({ deposit, onChange }: Props): React.ReactElem
</>
);
}
export default React.memo(Proposal);

View File

@ -27,7 +27,7 @@ interface State extends ExtraFees {
isNoEffect: boolean;
}
export default function Transfer ({ amount, fees, onChange, recipientId }: Props): React.ReactElement<Props> {
function Transfer ({ amount, fees, onChange, recipientId }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const allBalances = useCall<DerivedBalancesAll>(api.derive.balances.all as any, [recipientId]);
@ -88,3 +88,5 @@ export default function Transfer ({ amount, fees, onChange, recipientId }: Props
</>
);
}
export default React.memo(Transfer);

View File

@ -22,7 +22,7 @@ interface Props {
tip?: BN;
}
export default function Checks ({ accountId, className, extrinsic }: Props): React.ReactElement<Props> | null {
function Checks ({ accountId, className, extrinsic }: Props): React.ReactElement<Props> | null {
const { api } = useApi();
const [dispatchInfo, setDispatchInfo] = useState<RuntimeDispatchInfo | null>(null);
@ -49,3 +49,5 @@ export default function Checks ({ accountId, className, extrinsic }: Props): Rea
/>
);
}
export default React.memo(Checks);

View File

@ -48,8 +48,6 @@
"@polkadot/app-tech-comm/*": [ "packages/page-tech-comm/src/*" ],
"@polkadot/app-toolbox": [ "packages/page-toolbox/src" ],
"@polkadot/app-toolbox/*": [ "packages/page-toolbox/src/*" ],
"@polkadot/app-transfer": [ "packages/page-transfer/src" ],
"@polkadot/app-transfer/*": [ "packages/page-transfer/src/*" ],
"@polkadot/app-treasury": [ "packages/page-treasury/src" ],
"@polkadot/app-treasury/*": [ "packages/page-treasury/src/*" ],
"@polkadot/react-api": [ "packages/react-api/src" ],

108
yarn.lock
View File

@ -2826,56 +2826,56 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/api-contract@npm:^1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/api-contract@npm:1.9.0-beta.1"
"@polkadot/api-contract@npm:^1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/api-contract@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.9.0-beta.1
"@polkadot/rpc-core": 1.9.0-beta.1
"@polkadot/types": 1.9.0-beta.1
"@polkadot/api": 1.9.0-beta.6
"@polkadot/rpc-core": 1.9.0-beta.6
"@polkadot/types": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
bn.js: ^5.1.1
rxjs: ^6.5.4
checksum: 2/aaac213d2155979fb83e135e7eaf84512948034352e04a64bfdfb7799289ddad258895949a37e46643f4d956c13869e849096ac54124940fc4b1c1e96e8f5e85
checksum: 2/b25aa5eda0d7ed16c27768d5655ddb23ecb387996550e231bc9764029ec723a620ce9998ace7df26aa0e9c502e85fb9c3a29ed6ebdd2b598e01accfad18a0316
languageName: node
linkType: hard
"@polkadot/api-derive@npm:1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/api-derive@npm:1.9.0-beta.1"
"@polkadot/api-derive@npm:1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/api-derive@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api": 1.9.0-beta.1
"@polkadot/rpc-core": 1.9.0-beta.1
"@polkadot/rpc-provider": 1.9.0-beta.1
"@polkadot/types": 1.9.0-beta.1
"@polkadot/api": 1.9.0-beta.6
"@polkadot/rpc-core": 1.9.0-beta.6
"@polkadot/rpc-provider": 1.9.0-beta.6
"@polkadot/types": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
"@polkadot/util-crypto": ^2.7.0-beta.8
bn.js: ^5.1.1
memoizee: ^0.4.14
rxjs: ^6.5.4
checksum: 2/842be7c2726bf62d96c951ab3bba291b789ca14505fb95a759d27ebed5ebc7d58a6fc922a3be4f91c576bc98249d21cc0c69d6fb5b0cb3e27db200afeecbba06
checksum: 2/82229dee0cb729b4b4aeea5e6ca19a4e2c1aae0735690c31f7b8ea4e0e074df780e823ea870c63af580942551efe9c6ce140121a4e2e026818735a65a223d4c1
languageName: node
linkType: hard
"@polkadot/api@npm:^1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/api@npm:1.9.0-beta.1"
"@polkadot/api@npm:^1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/api@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api-derive": 1.9.0-beta.1
"@polkadot/api-derive": 1.9.0-beta.6
"@polkadot/keyring": ^2.7.0-beta.8
"@polkadot/metadata": 1.9.0-beta.1
"@polkadot/rpc-core": 1.9.0-beta.1
"@polkadot/rpc-provider": 1.9.0-beta.1
"@polkadot/types": 1.9.0-beta.1
"@polkadot/metadata": 1.9.0-beta.6
"@polkadot/rpc-core": 1.9.0-beta.6
"@polkadot/rpc-provider": 1.9.0-beta.6
"@polkadot/types": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
"@polkadot/util-crypto": ^2.7.0-beta.8
bn.js: ^5.1.1
eventemitter3: ^4.0.0
rxjs: ^6.5.4
checksum: 2/35c7869ec522c69a48d25de6485113a44d0f62390a3ddc01f1acf0b0e8fe187e530e8f57c52ab6f13264c88871d9f36059b2930d04b71dbd4e8762ba3343be83
checksum: 2/ba1b9ac9e313d901ecbdf070570478d4f8bc51e754e5febcd55ca726ae6ac680930495af46d5412c87807e8d941c55b5971b088ee8c470aaf9d43db704c0d324
languageName: node
linkType: hard
@ -2916,7 +2916,7 @@ __metadata:
resolution: "@polkadot/app-contracts@workspace:packages/page-contracts"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api-contract": ^1.9.0-beta.1
"@polkadot/api-contract": ^1.9.0-beta.6
languageName: unknown
linkType: soft
@ -3067,16 +3067,6 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/app-transfer@workspace:packages/page-transfer":
version: 0.0.0-use.local
resolution: "@polkadot/app-transfer@workspace:packages/page-transfer"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/react-components": 0.40.0-beta.184
"@polkadot/react-query": 0.40.0-beta.184
languageName: unknown
linkType: soft
"@polkadot/app-treasury@workspace:packages/page-treasury":
version: 0.0.0-use.local
resolution: "@polkadot/app-treasury@workspace:packages/page-treasury"
@ -3250,16 +3240,16 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/metadata@npm:1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/metadata@npm:1.9.0-beta.1"
"@polkadot/metadata@npm:1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/metadata@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/types": 1.9.0-beta.1
"@polkadot/types": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
"@polkadot/util-crypto": ^2.7.0-beta.8
bn.js: ^5.1.1
checksum: 2/db3cbab0973217b47f8e49d102a86d4ed33ffb69bc6059b2ef41350a29bc8617180d15cc508bc865628872b89cb7a13565ffc2715f0489b92be5bd3b3707afaa
checksum: 2/0a2567492cc5e85cc96afa48622241bf09f4f3272be2c9dc8d880deee7e2a485e0018fdd8f80d0c1be54c23a77607bccb0ec632332e01720bd78881b62a67ce7
languageName: node
linkType: hard
@ -3268,7 +3258,7 @@ __metadata:
resolution: "@polkadot/react-api@workspace:packages/react-api"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/api": ^1.9.0-beta.1
"@polkadot/api": ^1.9.0-beta.6
"@polkadot/extension-dapp": ^0.23.0-beta.9
rxjs-compat: ^6.5.4
languageName: unknown
@ -3385,35 +3375,35 @@ __metadata:
languageName: unknown
linkType: soft
"@polkadot/rpc-core@npm:1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/rpc-core@npm:1.9.0-beta.1"
"@polkadot/rpc-core@npm:1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/rpc-core@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/metadata": 1.9.0-beta.1
"@polkadot/rpc-provider": 1.9.0-beta.1
"@polkadot/types": 1.9.0-beta.1
"@polkadot/metadata": 1.9.0-beta.6
"@polkadot/rpc-provider": 1.9.0-beta.6
"@polkadot/types": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
memoizee: ^0.4.14
rxjs: ^6.5.4
checksum: 2/9f2b653dec3a645c9e87284766ca331226429a6c2924636ec928fd55214bc9f2918edc113e9090d23963fe556437a78a02f673bc306f1395a800656d4ee69adc
checksum: 2/8d19662f75d95dd1699c6599461df01b87ccb43b9573a770be9906fc1c98d8dd1632bd2e9124d7991c2e254b864fb4f76debfb5fa023b705942c20afd376e52b
languageName: node
linkType: hard
"@polkadot/rpc-provider@npm:1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/rpc-provider@npm:1.9.0-beta.1"
"@polkadot/rpc-provider@npm:1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/rpc-provider@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/metadata": 1.9.0-beta.1
"@polkadot/types": 1.9.0-beta.1
"@polkadot/metadata": 1.9.0-beta.6
"@polkadot/types": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
"@polkadot/util-crypto": ^2.7.0-beta.8
bn.js: ^5.1.1
eventemitter3: ^4.0.0
isomorphic-fetch: ^2.2.1
websocket: ^1.0.31
checksum: 2/c7760f893aeb557098bd0854eae8ddb9868289d21cb72c59eca44d38141eee7d8c50e576909e09b7c7fa8a727203c2c385a8b0771a09f12bb1365922d51de667
checksum: 2/225a4d8504fcc789aca9bac50dca3a1b6b322307bfd0c5814b5a82769717d73866b5757279d3df6b4f24d7ae7bf7ae8cfc688f7985178585f89706adb688351c
languageName: node
linkType: hard
@ -3426,19 +3416,19 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/types@npm:^1.9.0-beta.1":
version: 1.9.0-beta.1
resolution: "@polkadot/types@npm:1.9.0-beta.1"
"@polkadot/types@npm:^1.9.0-beta.6":
version: 1.9.0-beta.6
resolution: "@polkadot/types@npm:1.9.0-beta.6"
dependencies:
"@babel/runtime": ^7.9.2
"@polkadot/metadata": 1.9.0-beta.1
"@polkadot/metadata": 1.9.0-beta.6
"@polkadot/util": ^2.7.0-beta.8
"@polkadot/util-crypto": ^2.7.0-beta.8
"@types/bn.js": ^4.11.6
bn.js: ^5.1.1
memoizee: ^0.4.14
rxjs: ^6.5.4
checksum: 2/ed8e3e1b7343b09f56bf64a64b75c9348c41981368866eb5ed542ee12710df4a8410943f2e5994197bc86bacfb776512d4989c58b955972fdb541dea96a9d021
checksum: 2/bf6fa92828b5b3207d23f8b93331133f41f6f8e01a06a079cebd2441ccb53e6d3cefde57dca4b756705e8e90b873ba5a77cc2d8083e0c89c0b96d98cce0cacb8
languageName: node
linkType: hard