parent
b7176010a5
commit
e9fe113b29
14
package.json
14
package.json
@ -8,11 +8,11 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@polkadot/api": "^1.18.0-beta.7",
|
"@polkadot/api": "^1.20.0-beta.3",
|
||||||
"@polkadot/keyring": "^2.13.0-beta.3",
|
"@polkadot/keyring": "^2.14.1",
|
||||||
"@polkadot/types": "^1.18.0-beta.7",
|
"@polkadot/types": "^1.20.0-beta.3",
|
||||||
"@polkadot/util": "^2.13.0-beta.3",
|
"@polkadot/util": "^2.14.1",
|
||||||
"@polkadot/util-crypto": "^2.13.0-beta.3",
|
"@polkadot/util-crypto": "^2.14.1",
|
||||||
"babel-core": "^7.0.0-bridge.0"
|
"babel-core": "^7.0.0-bridge.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -32,8 +32,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.2",
|
"@babel/core": "^7.10.2",
|
||||||
"@polkadot/dev": "^0.55.8",
|
"@polkadot/dev": "^0.55.10",
|
||||||
"@polkadot/typegen": "^1.18.0-beta.7",
|
"@polkadot/typegen": "^1.20.0-beta.3",
|
||||||
"@types/jest": "^25.2.3",
|
"@types/jest": "^25.2.3",
|
||||||
"copy-webpack-plugin": "^6.0.2",
|
"copy-webpack-plugin": "^6.0.2",
|
||||||
"sinon-chrome": "^3.0.1",
|
"sinon-chrome": "^3.0.1",
|
||||||
|
|||||||
@ -6,9 +6,9 @@
|
|||||||
"license": "Apache-2",
|
"license": "Apache-2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.10.2",
|
"@babel/runtime": "^7.10.2",
|
||||||
"@polkadot/api": "^1.18.0-beta.7",
|
"@polkadot/api": "^1.20.0-beta.3",
|
||||||
"@polkadot/extension-inject": "0.30.1",
|
"@polkadot/extension-inject": "0.30.1",
|
||||||
"@polkadot/keyring": "^2.13.0-beta.3",
|
"@polkadot/keyring": "^2.14.1",
|
||||||
"@polkadot/ui-keyring": "^0.54.0-beta.6"
|
"@polkadot/ui-keyring": "^0.54.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.10.2",
|
"@babel/runtime": "^7.10.2",
|
||||||
"@polkadot/extension-inject": "0.30.1",
|
"@polkadot/extension-inject": "0.30.1",
|
||||||
"@polkadot/util": "^2.13.0-beta.3",
|
"@polkadot/util": "^2.14.1",
|
||||||
"@polkadot/util-crypto": "^2.13.0-beta.3"
|
"@polkadot/util-crypto": "^2.14.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/api": "*"
|
"@polkadot/api": "*"
|
||||||
|
|||||||
@ -8,11 +8,11 @@
|
|||||||
"@babel/runtime": "^7.10.2",
|
"@babel/runtime": "^7.10.2",
|
||||||
"@polkadot/extension-base": "0.30.1",
|
"@polkadot/extension-base": "0.30.1",
|
||||||
"@polkadot/extension-inject": "0.30.1",
|
"@polkadot/extension-inject": "0.30.1",
|
||||||
"@polkadot/keyring": "^2.13.0-beta.3",
|
"@polkadot/keyring": "^2.14.1",
|
||||||
"@polkadot/react-identicon": "^0.54.0-beta.6",
|
"@polkadot/react-identicon": "^0.54.1",
|
||||||
"@polkadot/react-qr": "^0.54.0-beta.6",
|
"@polkadot/react-qr": "^0.54.1",
|
||||||
"@polkadot/util": "^2.13.0-beta.3",
|
"@polkadot/util": "^2.14.1",
|
||||||
"@polkadot/util-crypto": "^2.13.0-beta.3",
|
"@polkadot/util-crypto": "^2.14.1",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
"react-dropzone": "^11.0.1",
|
"react-dropzone": "^11.0.1",
|
||||||
|
|||||||
@ -33,7 +33,7 @@ function AddAccount ({ className }: Props): React.ReactElement<Props> {
|
|||||||
<AddAccountImage onClick={_onClick}/>
|
<AddAccountImage onClick={_onClick}/>
|
||||||
</div>
|
</div>
|
||||||
<div className='no-accounts'>
|
<div className='no-accounts'>
|
||||||
<p>You currently don't have any accounts. Either create a new account or if you have an existing account you wish to use, import it with the seed phrase.</p>
|
<p>You currently don't have any accounts. Create your first account to get started.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -11,13 +11,13 @@ import { Header, Name } from '../partials';
|
|||||||
|
|
||||||
export default function ImportQr (): React.ReactElement {
|
export default function ImportQr (): React.ReactElement {
|
||||||
const onAction = useContext(ActionContext);
|
const onAction = useContext(ActionContext);
|
||||||
const [account, setAccount] = useState<null | { address: string; genesisHash: string }>(null);
|
const [account, setAccount] = useState<null | { content: string; genesisHash: string }>(null);
|
||||||
const [name, setName] = useState<string | null>(null);
|
const [name, setName] = useState<string | null>(null);
|
||||||
|
|
||||||
// FIXME Duplicated between here and Create.tsx
|
// FIXME Duplicated between here and Create.tsx
|
||||||
const _onCreate = (): void => {
|
const _onCreate = (): void => {
|
||||||
if (account && name) {
|
if (account && name) {
|
||||||
createAccountExternal(name, account.address, account.genesisHash)
|
createAccountExternal(name, account.content, account.genesisHash)
|
||||||
.then((): void => onAction('/'))
|
.then((): void => onAction('/'))
|
||||||
.catch((error: Error) => console.error(error));
|
.catch((error: Error) => console.error(error));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,7 @@ function isRawPayload (payload: SignerPayloadJSON | SignerPayloadRaw): payload i
|
|||||||
export default function Request ({ account: { isExternal }, buttonText, isFirst, request, signId, url }: Props): React.ReactElement<Props> | null {
|
export default function Request ({ account: { isExternal }, buttonText, isFirst, request, signId, url }: Props): React.ReactElement<Props> | null {
|
||||||
const onAction = useContext(ActionContext);
|
const onAction = useContext(ActionContext);
|
||||||
const [{ hexBytes, payload }, setData] = useState<Data>({ hexBytes: null, payload: null });
|
const [{ hexBytes, payload }, setData] = useState<Data>({ hexBytes: null, payload: null });
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect((): void => {
|
useEffect((): void => {
|
||||||
const payload = request.payload;
|
const payload = request.payload;
|
||||||
@ -67,11 +68,17 @@ export default function Request ({ account: { isExternal }, buttonText, isFirst,
|
|||||||
const _onSign = (password: string): Promise<void> =>
|
const _onSign = (password: string): Promise<void> =>
|
||||||
approveSignPassword(signId, password)
|
approveSignPassword(signId, password)
|
||||||
.then((): void => onAction())
|
.then((): void => onAction())
|
||||||
.catch((error: Error) => console.error(error));
|
.catch((error: Error): void => {
|
||||||
|
setError(error.message);
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
const _onSignature = ({ signature }: { signature: string }): Promise<void> =>
|
const _onSignature = ({ signature }: { signature: string }): Promise<void> =>
|
||||||
approveSignSignature(signId, signature)
|
approveSignSignature(signId, signature)
|
||||||
.then((): void => onAction())
|
.then((): void => onAction())
|
||||||
.catch((error: Error) => console.error(error));
|
.catch((error: Error): void => {
|
||||||
|
setError(error.message);
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
if (payload !== null) {
|
if (payload !== null) {
|
||||||
const json = request.payload as SignerPayloadJSON;
|
const json = request.payload as SignerPayloadJSON;
|
||||||
@ -104,6 +111,7 @@ export default function Request ({ account: { isExternal }, buttonText, isFirst,
|
|||||||
{isFirst && !isExternal && (
|
{isFirst && !isExternal && (
|
||||||
<Unlock
|
<Unlock
|
||||||
buttonText={buttonText}
|
buttonText={buttonText}
|
||||||
|
error={error}
|
||||||
onSign={_onSign}
|
onSign={_onSign}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -2,24 +2,29 @@
|
|||||||
// This software may be modified and distributed under the terms
|
// This software may be modified and distributed under the terms
|
||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
import React, { useCallback, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { Button, InputWithLabel } from '../../components';
|
import { Button, InputWithLabel } from '../../components';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
error?: string | null;
|
||||||
onSign: (password: string) => Promise<void>;
|
onSign: (password: string) => Promise<void>;
|
||||||
buttonText?: string;
|
buttonText?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Unlock ({ buttonText = 'Sign the transaction', className, onSign }: Props): React.ReactElement<Props> {
|
export default function Unlock ({ buttonText = 'Sign the transaction', className, error, onSign }: Props): React.ReactElement<Props> {
|
||||||
const [error, setError] = useState('');
|
const [ownError, setError] = useState<string | null>();
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
|
|
||||||
|
useEffect((): void => {
|
||||||
|
setError(error || null);
|
||||||
|
}, [error]);
|
||||||
|
|
||||||
const _onChangePassword = useCallback(
|
const _onChangePassword = useCallback(
|
||||||
(password: string): void => {
|
(password: string): void => {
|
||||||
setPassword(password);
|
setPassword(password);
|
||||||
setError('');
|
setError(null);
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
@ -32,7 +37,7 @@ export default function Unlock ({ buttonText = 'Sign the transaction', className
|
|||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<InputWithLabel
|
<InputWithLabel
|
||||||
isError={!password || !!error}
|
isError={!password || !!ownError}
|
||||||
isFocused
|
isFocused
|
||||||
label='Password for this account'
|
label='Password for this account'
|
||||||
onChange={_onChangePassword}
|
onChange={_onChangePassword}
|
||||||
|
|||||||
@ -38,14 +38,14 @@ export default function Welcome (): React.ReactElement<Props> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Note = styled.p`
|
const Note = styled.p(({ theme }: Props) => `
|
||||||
|
color: ${theme.subTextColor};
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
color: ${({ theme }: Props): string => theme.subTextColor};
|
`);
|
||||||
`;
|
|
||||||
|
|
||||||
const TextBox = styled(Box)`
|
const TextBox = styled(Box)(({ theme }: Props) => `
|
||||||
|
border: 1px solid ${theme.inputBorderColor};
|
||||||
|
color: ${theme.subTextColor};
|
||||||
margin: 0.75rem 24px;
|
margin: 0.75rem 24px;
|
||||||
border: 1px solid ${({ theme }: Props): string => theme.inputBorderColor};
|
`);
|
||||||
color: ${({ theme }: Props): string => theme.subTextColor};
|
|
||||||
`;
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
"@polkadot/extension-ui": "0.30.1"
|
"@polkadot/extension-ui": "0.30.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/dev": "^0.55.8",
|
"@polkadot/dev": "^0.55.10",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.1.0",
|
||||||
"extract-loader": "^5.1.0",
|
"extract-loader": "^5.1.0",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.0.0",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user