Skip to content

Commit

Permalink
chore: fix types related to tradeType (#180)
Browse files Browse the repository at this point in the history
* chore: fix types related to tradeType

* drop tradeType check

* style(lint): lint action with ESLint

Co-authored-by: Lint Action <[email protected]>
  • Loading branch information
JFrankfurt and Lint Action authored Aug 30, 2022
1 parent 0d74a8c commit 140dd5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/hooks/swap/useSyncTokenDefaults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Currency } from '@uniswap/sdk-core'
import { Currency, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { nativeOnChain } from 'constants/tokens'
import { useToken } from 'hooks/useCurrency'
Expand Down Expand Up @@ -61,12 +61,12 @@ export default function useSyncTokenDefaults({
amount: '',
[Field.INPUT]: defaultInputToken,
[Field.OUTPUT]: defaultOutputToken,
independentField: Field.INPUT,
type: TradeType.EXACT_INPUT,
}
if (defaultInputToken && defaultInputAmount) {
defaultSwapState.amount = defaultInputAmount.toString()
} else if (defaultOutputToken && defaultOutputAmount) {
defaultSwapState.independentField = Field.OUTPUT
defaultSwapState.type = TradeType.EXACT_OUTPUT
defaultSwapState.amount = defaultOutputAmount.toString()
}
updateSwap((swap) => ({ ...swap, ...defaultSwapState }))
Expand Down
5 changes: 1 addition & 4 deletions src/state/routing/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { TradeType } from '@uniswap/sdk-core'
import type { ChainId } from '@uniswap/smart-order-router'
import ms from 'ms.macro'
import qs from 'qs'
import { isExactInput } from 'utils/tradeType'

import { GetQuoteResult } from './types'

Expand Down Expand Up @@ -78,9 +77,7 @@ export const routing = createApi({
// Lazy-load the clientside router to improve initial pageload times.
return await (
await import('../../hooks/routing/clientSideSmartOrderRouter')
).getClientSideQuote({ ...args, type: isExactInput(tradeType) ? 'exactIn' : 'exactOut' }, provider, {
protocols,
})
).getClientSideQuote(args, provider, { protocols })
}

let result
Expand Down

1 comment on commit 140dd5f

@vercel
Copy link

@vercel vercel bot commented on 140dd5f Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

widgets – ./

widgets-uniswap.vercel.app
widgets-seven-tau.vercel.app
widgets-git-main-uniswap.vercel.app

Please sign in to comment.