Skip to content

Commit

Permalink
fix: better type-safe provider
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasc committed Jan 25, 2023
1 parent 74afecb commit 8a6013e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/SwapPageContent/SwapPageContent.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JsonRpcSigner } from '@ethersproject/providers';
import { SwapWidget, Theme } from '@uniswap/widgets';
import '@uniswap/widgets/fonts.css';
import { useConfig } from 'hooks/useConfig';
Expand All @@ -20,7 +21,7 @@ const theme: Theme = {

export function SwapPageContent() {
const { chainId, jsonRpcProvider } = useConfig();
const { data: signer } = useSigner();
const provider = useSigner<JsonRpcSigner>().data?.provider;

const jsonRpcUrlMap = useMemo(
() => ({ [chainId]: jsonRpcProvider }),
Expand All @@ -31,7 +32,7 @@ export function SwapPageContent() {
<SwapWidget
theme={theme}
jsonRpcUrlMap={jsonRpcUrlMap}
provider={signer?.provider as any}
provider={provider}
/>
</div>
);
Expand Down

0 comments on commit 8a6013e

Please sign in to comment.