Skip to content

Commit

Permalink
fix: add field type to onTokenSelectorClick types (#137)
Browse files Browse the repository at this point in the history
* fix: add field type to onTokenSelectorClick types

* nit
  • Loading branch information
kristiehuang authored Aug 11, 2022
1 parent cdbfff0 commit 133ed89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/Swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useOnSupportedNetwork from 'hooks/useOnSupportedNetwork'
import useSyncEventHandlers from 'hooks/useSyncEventHandlers'
import { useAtom } from 'jotai'
import { useState } from 'react'
import { displayTxHashAtom } from 'state/swap'
import { displayTxHashAtom, Field } from 'state/swap'
import { SwapTransactionInfo, Transaction, TransactionType, WrapTransactionInfo } from 'state/transactions'

import Dialog from '../Dialog'
Expand Down Expand Up @@ -51,7 +51,7 @@ export interface SwapProps extends TokenDefaults, FeeOptions {
routerUrl?: string
onConnectWalletClick?: () => void | Promise<boolean>
onReviewSwapClick?: () => void | Promise<boolean>
onTokenSelectorClick?: () => void | Promise<boolean>
onTokenSelectorClick?: (f: Field) => void | Promise<boolean>
}

export default function Swap(props: SwapProps) {
Expand Down
7 changes: 7 additions & 0 deletions src/cosmos/Swap.fixture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { CHAIN_NAMES_TO_IDS } from 'constants/chains'
import { useEffect } from 'react'
import { useValue } from 'react-cosmos/fixture'
import { Field } from 'state/swap'

import { DAI, USDC_MAINNET } from '../constants/tokens'
import useOption from './useOption'
Expand Down Expand Up @@ -92,6 +93,12 @@ function Fixture() {
})
}
onReviewSwapClick={() => new Promise((resolve) => resolve(true))}
onTokenSelectorClick={(f: Field) =>
new Promise((resolve) => {
console.log('onTokenSelectorClick', f)
resolve(true)
})
}
onTxSubmit={(txHash: string, data: any) => console.log('tx submitted:', txHash, data)}
onTxSuccess={(txHash: string, data: any) => console.log('tx success:', txHash, data)}
onTxFail={(error: Error, data: any) => console.log('tx fail:', error, data)}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useSyncEventHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { onConnectWalletClickAtom } from 'state/wallet'
interface UseSyncEventHandlersArgs {
onConnectWalletClick?: () => void | Promise<boolean>
onReviewSwapClick?: () => void | Promise<boolean>
onTokenSelectorClick?: () => void | Promise<boolean>
onTokenSelectorClick?: (f: Field) => void | Promise<boolean>
}

export default function useSyncEventHandlers(handlers: UseSyncEventHandlersArgs): void {
Expand Down

1 comment on commit 133ed89

@vercel
Copy link

@vercel vercel bot commented on 133ed89 Aug 11, 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-seven-tau.vercel.app
widgets-uniswap.vercel.app
widgets-git-main-uniswap.vercel.app

Please sign in to comment.