Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app-123code/src/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function Transfer ({ accountId }: Props): React.ReactElement<Prop
label='make transfer'
params={[recipientId, amount]}
tx='balances.transfer'
withSpinner
/>
</Button.Group>
</div>
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Identity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ function Identity ({ address, className, onClose }: Props): React.ReactElement<P
onStart={onClose}
params={[info]}
tx='identity.setIdentity'
withSpinner={false}
/>
</Modal.Actions>
</Modal>
Expand Down
3 changes: 1 addition & 2 deletions packages/app-accounts/src/modals/RecoverAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ export default function RecoverAccount ({ address, className, onClose }: Props):
icon='recycle'
isDisabled={!recover || recover === address}
label={t('Start recovery')}
onClick={onClose}
onStart={onClose}
params={[recover]}
tx='recovery.initiateRecovery'
withSpinner={false}
/>
</Modal.Actions>
</Modal>
Expand Down
3 changes: 1 addition & 2 deletions packages/app-accounts/src/modals/RecoverSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ export default function RecoverSetup ({ address, className, onClose }: Props): R
icon='share alternate'
isDisabled={isErrorHelpers || isErrorThreshold || isErrorDelay}
label={t('Make recoverable')}
onClick={onClose}
onStart={onClose}
params={[helpers, threshold, delay]}
tx='recovery.createRecovery'
withSpinner={false}
/>
</Modal.Actions>
</Modal>
Expand Down
1 change: 0 additions & 1 deletion packages/app-accounts/src/modals/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ function Transfer ({ className, onClose, recipientId: propRecipientId, senderId:
isPrimary
label={t('Make Transfer')}
onStart={onClose}
withSpinner={false}
/>
</Modal.Actions>
</Modal>
Expand Down
1 change: 1 addition & 0 deletions packages/app-contracts/src/Codes/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class Upload extends ContractModal<Props, State> {
params={[gasLimit, wasm]}
tx={api.tx.contracts ? 'contracts.putCode' : 'contract.putCode'}
ref={this.button}
withSpinner
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/app-contracts/src/Contracts/Call.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ function Call (props: Props): React.ReactElement<Props> | null {
onSuccess={_toggleBusy}
params={_constructTx}
tx={api.tx.contracts ? 'contracts.call' : 'contract.call'}
withSpinner
/>
)
}
Expand Down
1 change: 1 addition & 0 deletions packages/app-contracts/src/Deploy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class Deploy extends ContractModal<Props, State> {
: 'contract.create' // V1
}
ref={this.button}
withSpinner
/>
);
}
Expand Down
1 change: 0 additions & 1 deletion packages/app-democracy/src/Overview/PreImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ function PreImage ({ className, isImminent: propsIsImminent, matchHash, onClose
onStart={onClose}
params={[encodedProposal]}
tx={isImminent ? 'democracy.noteImminentPreimage' : 'democracy.notePreimage'}
withSpinner={false}
/>
</Modal.Actions>
</Modal>
Expand Down
1 change: 0 additions & 1 deletion packages/app-democracy/src/Overview/Propose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default function Propose ({ className, onClose }: Props): React.ReactElem
onStart={onClose}
params={[hash, balance]}
tx='democracy.propose'
withSpinner={false}
/>
</Modal.Actions>
</Modal>
Expand Down
11 changes: 5 additions & 6 deletions packages/app-democracy/src/Overview/Seconding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { AccountId, Proposal } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import React, { useState } from 'react';
import { Button, InputAddress, Modal, ProposedAction, TxButton } from '@polkadot/react-components';
import { useAccounts } from '@polkadot/react-hooks';
import { useAccounts, useToggle } from '@polkadot/react-hooks';

import { useTranslation } from '../translate';

Expand All @@ -22,14 +22,13 @@ export default function Seconding ({ depositors, proposal, proposalId }: Props):
const { t } = useTranslation();
const { hasAccounts } = useAccounts();
const [accountId, setAccountId] = useState<string | null>(null);
const [isSecondingOpen, setIsSecondingOpen] = useState(false);
const [isSecondingOpen, toggleSeconding] = useToggle();

if (!hasAccounts) {
return null;
}

const isDepositor = depositors.some((depositor): boolean => depositor.eq(accountId));
const _toggleSeconding = (): void => setIsSecondingOpen(!isSecondingOpen);

return (
<>
Expand All @@ -51,14 +50,14 @@ export default function Seconding ({ depositors, proposal, proposalId }: Props):
withLabel
/>
</Modal.Content>
<Modal.Actions onCancel={_toggleSeconding}>
<Modal.Actions onCancel={toggleSeconding}>
<TxButton
accountId={accountId}
isDisabled={!accountId || isDepositor}
isPrimary
label={t('Second')}
icon='sign-in'
onStart={_toggleSeconding}
onStart={toggleSeconding}
params={[proposalId]}
tx='democracy.second'
/>
Expand All @@ -69,7 +68,7 @@ export default function Seconding ({ depositors, proposal, proposalId }: Props):
isPrimary
label={t('Second')}
icon='toggle off'
onClick={_toggleSeconding}
onClick={toggleSeconding}
/>
</>
);
Expand Down
2 changes: 2 additions & 0 deletions packages/app-extrinsics/src/Selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Selection extends TxComponent<Props, State> {
label={t('Submit Unsigned')}
icon='sign-in'
extrinsic={extrinsic}
withSpinner
/>
<Button.Or />
<TxButton
Expand All @@ -70,6 +71,7 @@ class Selection extends TxComponent<Props, State> {
icon='sign-in'
extrinsic={extrinsic}
ref={this.button}
withSpinner
/>
</Button.Group>
</div>
Expand Down
1 change: 0 additions & 1 deletion packages/app-generic-asset/src/Transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ function Transfer ({ assets, className, onClose, recipientId: propRecipientId, s
label={t('Make Transfer')}
icon='send'
onStart={onClose}
withSpinner={false}
/>
</Button.Group>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/app-staking/src/Actions/Account/BondExtra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ class BondExtra extends TxComponent<Props, State> {
isPrimary
label={t('Bond more')}
icon='sign-in'
onClick={onClose}
onStart={onClose}
extrinsic={extrinsic}
ref={this.button}
withSpinner
/>
</Modal.Actions>
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion packages/app-staking/src/Actions/Account/Nominate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function Nominate ({ className, controllerId, nominees, onClose, next, stakingOv
accountId={controllerId}
isDisabled={!selection.length}
isPrimary
onClick={onClose}
onStart={onClose}
params={[selection]}
label={t('Nominate')}
icon='hand paper outline'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ class SetControllerAccount extends TxComponent<Props, State> {
isPrimary
label={t('Set controller')}
icon='sign-in'
onClick={onClose}
onStart={onClose}
params={[controllerId]}
tx='staking.setController'
ref={this.button}
withSpinner
/>
</Modal.Actions>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ class SetRewardDestination extends TxComponent<Props, State> {
isPrimary
label={t('Set reward destination')}
icon='sign-in'
onClick={onClose}
onStart={onClose}
params={[destination]}
tx={'staking.setPayee'}
ref={this.button}
withSpinner
/>
</Modal.Actions>
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion packages/app-staking/src/Actions/Account/SetSessionKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function SetSessionKey ({ controllerId, isOpen, onClose, sessionI
isPrimary
label={t('Set Session Key')}
icon='sign-in'
onClick={onClose}
onStart={onClose}
params={
isSubstrateV2
? [keys, EMPTY_PROOF]
Expand Down
3 changes: 2 additions & 1 deletion packages/app-staking/src/Actions/Account/Unbond.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ class Unbond extends TxComponent<Props, State> {
isPrimary
label={t('Unbond')}
icon='sign-out'
onClick={onClose}
onStart={onClose}
params={[maxUnbond]}
tx='staking.unbond'
ref={this.button}
withSpinner
/>
</Modal.Actions>
</Modal>
Expand Down
3 changes: 2 additions & 1 deletion packages/app-staking/src/Actions/Account/Validate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ class Validate extends TxComponent<Props, State> {
isPrimary
label={t('Validate')}
icon='check circle outline'
onClick={onClose}
onStart={onClose}
params={[{ commission }]}
tx='staking.validate'
ref={this.button}
withSpinner
/>
</Modal.Actions>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/app-staking/src/Actions/NewStake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ class NewStake extends TxComponent<Props, State> {
isPrimary
label={t('Bond')}
icon='sign-in'
onClick={onClose}
onStart={onClose}
extrinsic={extrinsic}
ref={this.button}
withSpinner
/>
</Modal.Actions>
</Modal>
Expand Down
1 change: 1 addition & 0 deletions packages/app-sudo/src/Sudo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Propose extends TxComponent<Props, State> {
isDisabled={!method || !isValid}
params={method ? [createType(registry, 'Proposal', method)] : []}
ref={this.button}
withSpinner
/>
</Button.Group>
</section>
Expand Down
11 changes: 5 additions & 6 deletions packages/app-treasury/src/Overview/Propose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import BN from 'bn.js';
import React, { useState } from 'react';
import { Button, InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components';
import { useToggle } from '@polkadot/react-hooks';
import useCouncilMembers from '@polkadot/app-council/useCouncilMembers';

import { useTranslation } from '../translate';
Expand All @@ -18,11 +19,9 @@ export default function Propose ({ className }: Props): React.ReactElement<Props
const { isMember, members } = useCouncilMembers();
const [accountId, setAccountId] = useState<string | null>(null);
const [beneficiary, setBeneficiary] = useState<string | null>(null);
const [isProposeOpen, setIsProposeOpen] = useState(false);
const [isProposeOpen, togglePropose] = useToggle();
const [value, setValue] = useState<BN | undefined>();

const _togglePropose = (): void => setIsProposeOpen(!isProposeOpen);

const hasValue = value?.gtn(0);

return (
Expand Down Expand Up @@ -57,14 +56,14 @@ export default function Propose ({ className }: Props): React.ReactElement<Props
onChange={setValue}
/>
</Modal.Content>
<Modal.Actions onCancel={_togglePropose}>
<Modal.Actions onCancel={togglePropose}>
<TxButton
accountId={accountId}
icon='add'
isDisabled={!accountId || !hasValue}
isPrimary
label={t('Submit proposal')}
onClick={_togglePropose}
onStart={togglePropose}
params={[value, beneficiary]}
tx='treasury.proposeSpend'
/>
Expand All @@ -76,7 +75,7 @@ export default function Propose ({ className }: Props): React.ReactElement<Props
isDisabled={!isMember}
isPrimary
label={t('Submit proposal')}
onClick={_togglePropose}
onClick={togglePropose}
/>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/app-treasury/src/Overview/Submission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function Submission ({ councilProposals, id, isDisabled }: Props)
isDisabled={!accountId || !councilThreshold}
isPrimary
label={t('Send to council')}
onClick={toggleOpen}
onStart={toggleOpen}
params={[
councilThreshold,
councilType === 'reject'
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/src/AccountName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function AccountName ({ children, className, defaultName, label, onClick, overri
icon='check'
isDisabled={registrarIndex === -1}
label={t('Judge')}
onClick={toggleJudgement}
onStart={toggleJudgement}
params={[registrarIndex, accountId, judgementEnum]}
tx='identity.provideJudgement'
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/src/TxButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TxButtonInner extends React.PureComponent<InnerProps> {
}

protected send = (): void => {
const { accountId, api, extrinsic: propsExtrinsic, isUnsigned, onClick, onFailed, onStart, onSuccess, onUpdate, params = [], queueExtrinsic, tx = '', withSpinner = true } = this.props;
const { accountId, api, extrinsic: propsExtrinsic, isUnsigned, onClick, onFailed, onStart, onSuccess, onUpdate, params = [], queueExtrinsic, tx = '', withSpinner = false } = this.props;
let extrinsic: any;

if (propsExtrinsic) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/src/VoteActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function VoteActions ({ accountId, className, isDisabled, onClick
isDisabled={!accountId || isDisabled}
isPrimary
label={t('Vote')}
onClick={onClick}
onStart={onClick}
params={params}
tx={tx}
/>
Expand Down