Skip to content

Commit

Permalink
Merge pull request #46 from amitojsingh366/master
Browse files Browse the repository at this point in the history
refactor: fix prettier issues
  • Loading branch information
BitHighlander authored Mar 4, 2022
2 parents e317477 + 5f03d2c commit 3c5beef
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
8 changes: 4 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Alert, AlertDescription } from '@chakra-ui/alert'
import { Button } from '@chakra-ui/button'
import { ToastId, useToast } from '@chakra-ui/toast'
import { ipcRenderer } from 'electron'
import { pluginManager, registerPlugins } from 'plugins'
import { useEffect, useRef, useState } from 'react'
import { FaSync } from 'react-icons/fa'
import { useTranslate } from 'react-polyglot'
import { Routes } from 'Routes/Routes'
import { IconCircle } from 'components/IconCircle'
import { PairingProps } from 'components/Modals/Pair/Pair'
import { useModal } from 'context/ModalProvider/ModalProvider'
import { useHasAppUpdated } from 'hooks/useHasAppUpdated/useHasAppUpdated'

import { Route } from './Routes/helpers'
import { useModal } from 'context/ModalProvider/ModalProvider'
import { ipcRenderer } from 'electron'
import { PairingProps } from 'components/Modals/Pair/Pair'

export const App = () => {
const [pluginRoutes, setPluginRoutes] = useState<Route[]>([])
Expand All @@ -38,7 +38,7 @@ export const App = () => {
ipcRenderer.on('@modal/pair', (event, data: PairingProps) => {
pair.open(data)
})
}, [])
}, [pair])

useEffect(() => {
if (shouldUpdate && !toast.isActive(updateId)) {
Expand Down
22 changes: 12 additions & 10 deletions src/components/Modals/Pair/Pair.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@ import {
Alert,
AlertDescription,
AlertIcon,
Box,
Button,
Image,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalHeader,
ModalOverlay,
Stack,
Image,
Box
Stack
} from '@chakra-ui/react'
import { ipcRenderer } from 'electron'
import { useState } from 'react'
import { SlideTransition } from 'components/SlideTransition'
import { Text } from 'components/Text'
import { useModal } from 'context/ModalProvider/ModalProvider'
import { SlideTransition } from 'components/SlideTransition'


export type PairingProps = {
serviceName: string,
serviceImageUrl: string,
serviceName: string
serviceImageUrl: string
nonce: string
}

Expand Down Expand Up @@ -62,9 +61,12 @@ export const PairModal = (input: PairingProps) => {
</ModalHeader>
<ModalBody>
<Stack spacing={4} mb={4}>
<Box display="inline-flex" justifyContent={'center'} alignItems='center'>
<Image src={input.serviceImageUrl} borderRadius="full" height="10" width="10" />
<Text translation={['modals.pair.body', { serviceName: input.serviceName }]} pl='2' />
<Box display='inline-flex' justifyContent={'center'} alignItems='center'>
<Image src={input.serviceImageUrl} borderRadius='full' height='10' width='10' />
<Text
translation={['modals.pair.body', { serviceName: input.serviceName }]}
pl='2'
/>
</Box>
{error && (
<Alert status='error'>
Expand Down
6 changes: 5 additions & 1 deletion src/context/WalletProvider/KeepKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export class KeepKeyService {
if (!serviceKey) {
serviceKey = uuidv4()
localStorage.setItem('@bridge/service-key', serviceKey)
ipcRenderer.send('@bridge/add-service', { serviceKey, serviceName: 'ShapeShift', serviceKeyImageUrl: 'https://app.shapeshift.com/icon-512x512.png' })
ipcRenderer.send('@bridge/add-service', {
serviceKey,
serviceName: 'ShapeShift',
serviceKeyImageUrl: 'https://app.shapeshift.com/icon-512x512.png'
})
}
return serviceKey
}
Expand Down
28 changes: 14 additions & 14 deletions src/context/WalletProvider/WalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ function playSound(type: any) {
export type ActionTypes =
| { type: WalletActions.SET_ADAPTERS; payload: Adapters }
| {
type: WalletActions.SET_WALLET
payload: {
wallet: HDWallet | null
name: string
icon: ComponentWithAs<'svg', IconProps>
deviceId: string
meta?: { label: string }
type: WalletActions.SET_WALLET
payload: {
wallet: HDWallet | null
name: string
icon: ComponentWithAs<'svg', IconProps>
deviceId: string
meta?: { label: string }
}
}
}
| { type: WalletActions.SET_IS_CONNECTED; payload: boolean }
| { type: WalletActions.SET_CONNECTOR_TYPE; payload: KeyManager }
| { type: WalletActions.SET_INITIAL_ROUTE; payload: string }
Expand Down Expand Up @@ -193,7 +193,7 @@ export const WalletProvider = ({ children }: { children: React.ReactNode }): JSX

useEffect(() => {
if (state.keyring) {
; (async () => {
;(async () => {
const adapters: Adapters = new Map()
let options: undefined | { portisAppId: string }
for (const wallet of Object.values(KeyManager)) {
Expand All @@ -205,8 +205,8 @@ export const WalletProvider = ({ children }: { children: React.ReactNode }): JSX
const adapter = SUPPORTED_WALLETS[wallet].adapter.useKeyring(state.keyring, options)
// useKeyring returns the instance of the adapter. We'll keep it for future reference.
if (wallet === 'keepkey') {
const serviceKey = keepkey.getServiceKey()
// TODO: add ability to pass serviceKey to adapter
// const serviceKey = keepkey.getServiceKey()
await adapter.pairDevice('http://localhost:1646')
adapters.set(wallet, adapter)
} else {
Expand Down Expand Up @@ -251,7 +251,7 @@ export const WalletProvider = ({ children }: { children: React.ReactNode }): JSX
}
})

ipcRenderer.on('playSound', (event, data) => { })
ipcRenderer.on('playSound', (event, data) => {})

ipcRenderer.on('attach', (event, data) => {
dispatch({ type: WalletActions.SET_KEEPKEY_STATE, payload: data.state })
Expand Down Expand Up @@ -310,7 +310,7 @@ export const WalletProvider = ({ children }: { children: React.ReactNode }): JSX
bootloader.open({})
})

ipcRenderer.on('setDevice', (event, data) => { })
ipcRenderer.on('setDevice', (event, data) => {})

ipcRenderer.on('signTx', async (event: any, data: any) => {
let unsignedTx = data.payload.data
Expand Down Expand Up @@ -347,8 +347,8 @@ export const WalletProvider = ({ children }: { children: React.ReactNode }): JSX
if (type === 'keepkey') {
const adapter = SUPPORTED_WALLETS['keepkey'].adapter.useKeyring(state.keyring)
try {
const serviceKey = keepkey.getServiceKey()
// TODO: add ability to pass serviceKey to adapter
// const serviceKey = keepkey.getServiceKey()
await adapter.pairDevice('http://localhost:1646')
const adapters: Adapters = new Map()
adapters.set('keepkey' as KeyManager, adapter)
Expand Down Expand Up @@ -399,7 +399,7 @@ export const WalletProvider = ({ children }: { children: React.ReactNode }): JSX
const localWalletType = getLocalWalletType()
const localWalletDeviceId = getLocalWalletDeviceId()
if (localWalletType && localWalletDeviceId && state.adapters) {
; (async () => {
;(async () => {
if (state.adapters?.has(localWalletType)) {
switch (localWalletType) {
case KeyManager.Native:
Expand Down

0 comments on commit 3c5beef

Please sign in to comment.