diff --git a/.gitignore b/.gitignore index 687e7691..183436dd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ extension *-error.log .env .idea/ -extension.zip \ No newline at end of file +*.zip \ No newline at end of file diff --git a/@types/index.d.ts b/@types/index.d.ts index 4beeef18..a8d3c0b2 100644 --- a/@types/index.d.ts +++ b/@types/index.d.ts @@ -138,5 +138,7 @@ declare const dash: BitcoinLikeProvider declare const litecoin: BitcoinLikeProvider declare const dogecoin: BitcoinLikeProvider declare const bitcoinsv: BitcoinLikeProvider +declare const ravencoin: BitcoinLikeProvider declare const Zilliqa: any declare const bitcore: any +declare const ravencore: any diff --git a/package.json b/package.json index fb74cb13..76112be6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "extension", - "version": "1.17.0", + "version": "1.18.0", "description": "extension", "private": false, "repository": "https://github.com/SimpleHold/extension.git", @@ -43,9 +43,9 @@ "crypto-js": "^4.0.0", "dayjs": "^1.10.6", "detect-browser": "^5.2.0", + "digibyte-lib": "https://github.com/DigiByte-Core/digibyte-lib", "lodash": "^4.17.21", "neblio-lib": "https://github.com/NeblioTeam/bitcore-lib#neblcore-lib", - "digibyte-lib": "https://github.com/DigiByte-Core/digibyte-lib", "nerve-sdk-js": "^1.0.8", "nuls-sdk-js": "^2.5.0", "numeral": "^2.0.6", @@ -61,9 +61,11 @@ "react-qrcode-logo": "^2.2.1", "react-router-dom": "^5.2.0", "react-transition-group": "^4.4.1", + "react-virtualized": "^9.22.3", "ripple-binary-codec": "^1.1.3", "ripple-keypairs": "^1.0.3", "ripple-lib": "^1.9.5", + "socket.io-client": "^4.3.2", "styled-components": "^5.2.1", "thor-devkit": "^2.0.1", "thorify": "^1.5.7", @@ -97,6 +99,7 @@ "@types/react-otp-input": "^2.0.0", "@types/react-router-dom": "^5.1.7", "@types/react-transition-group": "^4.4.1", + "@types/react-virtualized": "^9.21.15", "@types/styled-components": "^5.1.7", "@types/uuid": "^8.3.0", "@types/webpack": "^4.41.25", diff --git a/src/app.tsx b/src/app.tsx index d4643e50..231812d1 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -26,8 +26,18 @@ const App: React.FC = () => { preloadPages() getPlatformInfo() browser.runtime.setUninstallURL(`https://simplehold.io/survey?id=${getItem('clientId')}`) + + if (window.name) { + window.onresize = () => { + const height = window.outerHeight + const width = window.outerWidth + if (width === 375 && height === 630) return; + setTimeout(() => window.resizeTo(375, 630), 1000) + } + } }, []) + const getPlatformInfo = async (): Promise => { const info = await browser.runtime.getPlatformInfo() diff --git a/src/assets/currencies/rvn.svg b/src/assets/currencies/rvn.svg new file mode 100644 index 00000000..4dd65536 --- /dev/null +++ b/src/assets/currencies/rvn.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/icons/help.svg b/src/assets/icons/help.svg new file mode 100644 index 00000000..fd54208e --- /dev/null +++ b/src/assets/icons/help.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/icons/qrCode.svg b/src/assets/icons/qrCode.svg new file mode 100644 index 00000000..538bdc37 --- /dev/null +++ b/src/assets/icons/qrCode.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/components/CollapsibleHeader/CollapsibleHeader.tsx b/src/components/CollapsibleHeader/CollapsibleHeader.tsx index 8b898b07..4bd30cba 100644 --- a/src/components/CollapsibleHeader/CollapsibleHeader.tsx +++ b/src/components/CollapsibleHeader/CollapsibleHeader.tsx @@ -45,7 +45,7 @@ const CollapsibleHeader: React.FC = (props) => { } }, [scrollPosition, isDrawersActive]) - const сontainerHeight = Math.max(110, 290 - 1.25 * latesScrollPosition) + const containerHeight = Math.max(110, 290 - 1.25 * latesScrollPosition) const balanceRowMarginTop = Math.max(3, 50 - latesScrollPosition) const balanceFontSize = Math.max(16, 36 - 0.2 * latesScrollPosition) @@ -79,9 +79,8 @@ const CollapsibleHeader: React.FC = (props) => { 'activeSortType', ]) } - return ( - +
diff --git a/src/components/DrawerWrapper/DrawerWrapper.tsx b/src/components/DrawerWrapper/DrawerWrapper.tsx index 9ba56fe8..1ddd20db 100644 --- a/src/components/DrawerWrapper/DrawerWrapper.tsx +++ b/src/components/DrawerWrapper/DrawerWrapper.tsx @@ -39,6 +39,8 @@ const DrawerWrapper: React.FC = (props) => { const nodeRef = React.useRef(null) + const isWindowedMode = window.location.pathname === "/popup.html" && window.name !== '' + const drawerStyle = { entering: { transform: `translate3d(0, ${openFrom === 'browser' ? '80px' : '100%'}, 0)`, @@ -67,6 +69,7 @@ const DrawerWrapper: React.FC = (props) => { openFrom={openFrom} /> (openFrom === 'browser' ? '315px' : '100%')}; + min-width: ${({ isWindowedMode }: TDrawerProps) => (isWindowedMode ? `375px` : 'initial')}; transition: transform 250ms; ` diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 3f52662f..35000b81 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -58,7 +58,7 @@ const Header: React.FC = (props) => { - + diff --git a/src/config/currencies.ts b/src/config/currencies.ts index 06a011e0..df7a5f79 100644 --- a/src/config/currencies.ts +++ b/src/config/currencies.ts @@ -26,6 +26,7 @@ import oneLogo from '@assets/currencies/one.svg' import vetLogo from '@assets/currencies/vet.svg' import vthoLogo from '@assets/currencies/vtho.svg' import toncoinLogo from '@assets/currencies/toncoin.svg' +import ravencoinLogo from '@assets/currencies/rvn.svg' import digibyteLogo from '@assets/currencies/dgb.svg' // Utils @@ -294,6 +295,15 @@ const currencies: ICurrency[] = [ minSendAmount: 100000, isCustomFee: false, }, + { + name: 'Ravencoin', + symbol: 'rvn', + logo: ravencoinLogo, + background: '#B4B8CE', + chain: 'ravencoin', + minSendAmount: 1000, + isCustomFee: true, + } ] export const getCurrency = (symbol: string): ICurrency | undefined => { diff --git a/src/config/index.ts b/src/config/index.ts index 5ae84c34..47eaa163 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -5,4 +5,5 @@ export default { amplitude: isDevMode ? '' : 'a9ef99a1f9f24a563cc32a696d8b50b6', }, serverUrl: isDevMode ? 'http://localhost:8080' : 'https://simplehold.io/api', + socketUrl: isDevMode ? 'http://localhost:8080' : 'wss://simplehold.io', } diff --git a/src/config/tokens.ts b/src/config/tokens.ts index a84ef163..aec66d12 100644 --- a/src/config/tokens.ts +++ b/src/config/tokens.ts @@ -22,13 +22,13 @@ import zilLogo from '@assets/tokens/zil.svg' import sxpLogo from '@assets/tokens/sxp.svg' import xvsLogo from '@assets/tokens/xvs.svg' import linkLogo from '@assets/tokens/link.svg' -import bntLogo from '@assets/tokens/bnt.svg' -import audioLogo from '@assets/tokens/audio.svg' import toncoinLogo from '@assets/tokens/toncoin.svg' import wethLogo from '@assets/tokens/weth.svg' import croLogo from '@assets/tokens/cro.svg' import wbtcLogo from '@assets/tokens/wbtc.svg' import flameLogo from '@assets/tokens/flame.svg' +import bntLogo from '@assets/tokens/bnt.svg' +import audioLogo from '@assets/tokens/audio.svg' // Utils import { IWallet } from '@utils/wallet' @@ -457,7 +457,7 @@ const tokens: IToken[] = [ symbol: 'bnt', decimals: 18, logo: bntLogo, - background: '#132BD8', + background: ETH_TOKEN_BG, chain: 'eth', minSendAmount: 0.001, isCustomFee: true, @@ -468,11 +468,11 @@ const tokens: IToken[] = [ symbol: 'audio', decimals: 18, logo: audioLogo, - background: '#132BD8', + background: ETH_TOKEN_BG, chain: 'eth', minSendAmount: 0.001, isCustomFee: true, - } + }, ] export default tokens diff --git a/src/drawers/FilterWallets/FilterWalletsDrawer.tsx b/src/drawers/FilterWallets/FilterWalletsDrawer.tsx index b79cf21f..4763b560 100644 --- a/src/drawers/FilterWallets/FilterWalletsDrawer.tsx +++ b/src/drawers/FilterWallets/FilterWalletsDrawer.tsx @@ -177,6 +177,7 @@ const FilterWalletsDrawer: React.FC = (props) => { return ( { updateState({ isButtonLoading: true }) const generateAddress = await generate(symbol, chain) - if (generateAddress) { const { privateKey, mnemonic, isNotActivated, address } = generateAddress diff --git a/src/pages/ScanBackup/ScanBackup.tsx b/src/pages/ScanBackup/ScanBackup.tsx new file mode 100644 index 00000000..651da84e --- /dev/null +++ b/src/pages/ScanBackup/ScanBackup.tsx @@ -0,0 +1,69 @@ +import * as React from 'react' +import { useHistory } from 'react-router-dom' + +// Components +import Cover from '@components/Cover' +import Header from '@components/Header' +import QRCode from '@components/QRCode' +import Button from '@components/Button' + +// Utils +import { sha512hash } from '@utils/crypto' +import { getItem } from '@utils/storage' +import socket from '@utils/socket' + +// Styles +import Styles from './styles' + +const ScanBackup: React.FC = () => { + const history = useHistory() + + const [backupHash, setBackupHash] = React.useState('') + + React.useEffect(() => { + const getBackup = getItem('backup') + + if (getBackup) { + setBackupHash(sha512hash(getBackup)) + } + }, []) + + React.useEffect(() => { + socket.auth = { username: backupHash } + + socket.connect() + + socket.on('share-backup', ({ content, from }) => { + if (content === backupHash) { + socket.emit('share-backup', { + content: getItem('backup'), + to: from, + }) + } + }) + + return () => { + socket.disconnect() + } + }, [backupHash]) + + return ( + + +
+ + + {backupHash.length ? ( + + + + ) : null} + Scan the QR code to restore your mobile SimpleHold wallet + +