Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript committed Oct 8, 2023
1 parent 64841f7 commit c0a0291
Show file tree
Hide file tree
Showing 5 changed files with 968 additions and 976 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import React, {useState} from 'react'
import {ScrollView} from 'react-native'

import {Boundary, TwoActionView} from '../../../../components'
import {LedgerConnect} from '../../../../HW'
import {useSelectedWallet} from '../../../../SelectedWallet'
import {DeviceId, DeviceObj, withBLE, withUSB} from '../../../../yoroi-wallets/hw'
import {walletManager} from '../../../../yoroi-wallets/walletManager'
import {useSelectedWallet} from '../../../../SelectedWallet'
import {LedgerTransportSwitch} from '../../useCases/ConfirmTxScreen/LedgerTransportSwitch'
import {LedgerConnect} from '../../../../HW'
import {ScrollView} from 'react-native'
import {Boundary, TwoActionView} from '../../../../components'
import {useStrings} from '../strings'
import {useSignWithHwAndSubmitTx} from '../../../../yoroi-wallets/hooks'
import {YoroiWallet} from '../../../../yoroi-wallets/cardano/types'

type TransportType = 'USB' | 'BLE'
type Step = 'select-transport' | 'connect-transport' | 'confirm'

type Props = {
onSuccess?: (options: {useUSB: boolean}) => void
}

export const ConfirmRawTxWithHW = ({onSuccess}: {onSuccess?: VoidFunction}) => {
export const ConfirmRawTxWithHW = ({onSuccess}: Props) => {
const [transportType, setTransportType] = useState<TransportType>('USB')
const [step, setStep] = useState<'select-transport' | 'connect-transport' | 'confirm'>('select-transport')
const [step, setStep] = useState<Step>('select-transport')
const wallet = useSelectedWallet()

const onSelectTransport = (transportType: TransportType) => {
Expand All @@ -32,6 +36,10 @@ export const ConfirmRawTxWithHW = ({onSuccess}: {onSuccess?: VoidFunction}) => {
setStep('confirm')
}

const handleConfirm = () => {
onSuccess?.({useUSB: transportType === 'USB'})
}

if (step === 'select-transport') {
return (
<LedgerTransportSwitch
Expand All @@ -51,27 +59,12 @@ export const ConfirmRawTxWithHW = ({onSuccess}: {onSuccess?: VoidFunction}) => {

return (
<Boundary>
<Confirm
wallet={wallet}
onSuccess={onSuccess}
onCancel={() => setStep('select-transport')}
transport={transportType}
/>
<Confirm onSuccess={handleConfirm} onCancel={() => setStep('select-transport')} />
</Boundary>
)
}

const Confirm = ({
wallet,
onSuccess,
transport: transportType,
onCancel,
}: {
wallet: YoroiWallet
onCancel?: () => void
onSuccess?: () => void
transport: TransportType
}) => {
const Confirm = ({onSuccess, onCancel}: {onCancel?: () => void; onSuccess?: () => void}) => {
const strings = useStrings()

return (
Expand All @@ -89,7 +82,7 @@ const Confirm = ({
onPress: () => onCancel?.(),
}}
>
{/*<TransferSummary wallet={wallet} unsignedTx={unsignedTx} />*/}
{/* <TransferSummary wallet={wallet} unsignedTx={unsignedTx} />*/}
</TwoActionView>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ export const OpenOrders = () => {
utxos: {collateral: collateralUtxo, order: utxo},
address: addressHex,
})
const {cbor, signers} = await getMuesliSwapTransactionAndSigners(originalCbor, wallet)
console.log('got cbor')
const {cbor} = await getMuesliSwapTransactionAndSigners(originalCbor, wallet)
await wallet.signSwapCancellationWithLedger(cbor, useUSB)

closeBottomSheet()
Expand Down
Loading

0 comments on commit c0a0291

Please sign in to comment.