From 67c7e20d871011c043ba5d1ab367b83e0673b980 Mon Sep 17 00:00:00 2001 From: David Sato Date: Tue, 13 Oct 2020 14:48:36 +0200 Subject: [PATCH 1/2] fix networkOrDefault type and typo --- src/components/TradeWidget/index.tsx | 2 +- src/hooks/useWalletConnection.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/TradeWidget/index.tsx b/src/components/TradeWidget/index.tsx index 63d3fd5b9..385b3bbcd 100644 --- a/src/components/TradeWidget/index.tsx +++ b/src/components/TradeWidget/index.tsx @@ -152,7 +152,7 @@ const TradeWidgetContainer: React.FC = () => { const sellTokenSymbol = decodeSymbol(encodedSellTokenSymbol || '') const receiveTokenSymbol = decodeSymbol(decodeReceiveTokenSymbol || '') - const { sellToken: initialSellTokenDefaultNetwork, buyToken: initialReceiveTokenDefaultNetwork } = + const { sellToken: initialSellTokenDefaultNetwork, receiveToken: initialReceiveTokenDefaultNetwork } = initialTokenSelection.networks[networkIdOrDefault] || {} const sellTokenWithFallback = useMemo( diff --git a/src/hooks/useWalletConnection.ts b/src/hooks/useWalletConnection.ts index fdef07e59..8d837ccb7 100644 --- a/src/hooks/useWalletConnection.ts +++ b/src/hooks/useWalletConnection.ts @@ -6,7 +6,7 @@ import { BlockchainUpdatePrompt, WalletInfo } from 'api/wallet/WalletApi' interface PendingStateObject extends WalletInfo { pending: true - networkIdOrDefault: number + networkIdOrDefault: Network } const PendingState: PendingStateObject = { @@ -33,7 +33,7 @@ const constructPendingState = ({ chainId, account, blockHeader }: BlockchainUpda } export const useWalletConnection = (): - | (WalletInfo & { pending: false; networkIdOrDefault: number }) + | (WalletInfo & { pending: false; networkIdOrDefault: Network }) | PendingStateObject => { const [walletInfo, setWalletInfo] = useSafeState(null) From 1ec5b5ae35c5b68acc224045caf1772e293d5988 Mon Sep 17 00:00:00 2001 From: David Sato Date: Tue, 13 Oct 2020 15:03:11 +0200 Subject: [PATCH 2/2] WalletInfo type --- src/api/wallet/WalletApi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/wallet/WalletApi.ts b/src/api/wallet/WalletApi.ts index 269dfb2c5..0793ff765 100644 --- a/src/api/wallet/WalletApi.ts +++ b/src/api/wallet/WalletApi.ts @@ -67,7 +67,7 @@ export interface WalletApi { export interface WalletInfo { isConnected: boolean userAddress?: string - networkId?: number + networkId?: Network blockNumber?: number }