Skip to content

Commit

Permalink
Expose signed transactions (polkadot-js#2203)
Browse files Browse the repository at this point in the history
* sign offline WIP

* signing transactions from extrinsics screen

* signing tx from accounts screen

* added translations

* removed unnecessary value

* removed console logs

* removed unused import

* used new signAsync method

* fixed types

* removed unused imports

* added missing translations

* code review changes

* fixed signing with local account

* added sign toggle

* improvements for QR
  • Loading branch information
ma12ki authored and jordy25519 committed Feb 20, 2020
1 parent c294dde commit 0e789cf
Show file tree
Hide file tree
Showing 5 changed files with 304 additions and 145 deletions.
5 changes: 3 additions & 2 deletions packages/react-components/src/ButtonCancel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import { useTranslation } from './translate';
interface Props {
className?: string;
isDisabled?: boolean;
label?: string;
onClick: () => void;
tabIndex?: number;
}

export default function ButtonCancel ({ className, isDisabled, onClick, tabIndex }: Props): React.ReactElement<Props> {
export default function ButtonCancel ({ className, isDisabled, label, onClick, tabIndex }: Props): React.ReactElement<Props> {
const { t } = useTranslation();

return (
Expand All @@ -23,7 +24,7 @@ export default function ButtonCancel ({ className, isDisabled, onClick, tabIndex
icon='cancel'
isDisabled={isDisabled}
isNegative
label={t('Cancel')}
label={label || t('Cancel')}
onClick={onClick}
tabIndex={tabIndex}
/>
Expand Down
8 changes: 5 additions & 3 deletions packages/react-components/src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ interface ModalProps extends BareProps {
}

interface ActionsProps extends BareProps {
cancelLabel?: string;
children: React.ReactNode;
withOr?: boolean;
onCancel: () => void;
}

Expand All @@ -42,12 +44,12 @@ function Modal (props: ModalProps): React.ReactElement<ModalProps> {
);
}

function Actions ({ className, children, onCancel }: ActionsProps): React.ReactElement<ActionsProps> {
function Actions ({ cancelLabel, className, children, withOr = true, onCancel }: ActionsProps): React.ReactElement<ActionsProps> {
return (
<SUIModal.Actions>
<Button.Group className={className}>
<ButtonCancel onClick={onCancel} />
<Button.Or />
<ButtonCancel label={cancelLabel} onClick={onCancel} />
{withOr && <Button.Or />}
{children}
</Button.Group>
</SUIModal.Actions>
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 = false } = this.props;
const { accountId, api, extrinsic: propsExtrinsic, isUnsigned, onClick, onFailed, onStart, onSuccess, onUpdate, params = [], queueExtrinsic, tx = '', withSpinner = true } = this.props;
let extrinsic: any;

if (propsExtrinsic) {
Expand Down
Loading

0 comments on commit 0e789cf

Please sign in to comment.