Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Commit

Permalink
Small Code typing improvement (#88)
Browse files Browse the repository at this point in the history
* Remove unnecessary OrderMetaData from cow-sdk

* Comply with the validation of className on Search component

* Use SupportedChainId instead any
  • Loading branch information
henrypalacios authored May 20, 2022
1 parent 8b8e8be commit 183ee90
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/apps/explorer/components/common/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { useSearchSubmit } from 'hooks/useSearchSubmit'
// assets
import searchImg from 'assets/img/search2.svg'

interface SearchProps {
interface SearchProps extends React.HTMLAttributes<HTMLFormElement> {
searchString?: string
submitSearchImmediatly?: boolean
}

export const Search: React.FC<React.HTMLAttributes<HTMLDivElement> & SearchProps> = (props) => {
export const Search: React.FC<SearchProps> = (props) => {
const { className, searchString = '', submitSearchImmediatly = false } = props
const [query, setQuery] = useState('')
const [showPlaceholder, setShowPlaceholder] = useState(true)
Expand Down
6 changes: 3 additions & 3 deletions src/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BigNumber from 'bignumber.js'
import BN from 'bn.js'
import { CowSdk } from '@cowprotocol/cow-sdk'
import { CowSdk, SupportedChainId } from '@cowprotocol/cow-sdk'
import { TokenErc20, UNLIMITED_ORDER_AMOUNT, BATCH_TIME } from '@gnosis.pm/dex-js'
export {
UNLIMITED_ORDER_AMOUNT,
Expand Down Expand Up @@ -229,10 +229,10 @@ export const DISABLED_TOKEN_MAPS = Object.keys(disabledTokens).reduce<DisabledTo
)

export const COW_SDK = [Network.MAINNET, Network.RINKEBY, Network.GNOSIS_CHAIN].reduce<
Record<number, CowSdk<any> | null> //These type are temporary until SupportedChainId is exported
Record<number, CowSdk<SupportedChainId> | null>
>((acc, networkId) => {
try {
acc[networkId] = new CowSdk(networkId as any, {
acc[networkId] = new CowSdk(networkId, {
isDevEnvironment: !(isProd || isStaging),
})
} catch (error) {
Expand Down
5 changes: 2 additions & 3 deletions src/services/helpers/tryGetOrderOnAllNetworks.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { GetOrderParams, GetTxOrdersParams, RawOrder } from 'api/operator'
import { NETWORK_ID_SEARCH_LIST } from 'apps/explorer/const'
import { Network } from 'types'
import { OrderMetaData } from '@cowprotocol/cow-sdk'

export type SingleOrder = RawOrder | OrderMetaData | null
export type MultipleOrders = RawOrder[] | OrderMetaData[] | null
export type SingleOrder = RawOrder | null
export type MultipleOrders = RawOrder[] | null

export interface GetOrderResult<R> {
order: R | null
Expand Down

0 comments on commit 183ee90

Please sign in to comment.