-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clean up integration exports (#171)
* fix: export enums * fix: simplify onSwitchTokens * fix: allow boolean returns in handlers * fix: simplify swap controller * test: update switch tests
- Loading branch information
Showing
10 changed files
with
31 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
import { useUpdateAtom } from 'jotai/utils' | ||
import { useEffect } from 'react' | ||
import { onConnectWalletClickAtom } from 'state/wallet' | ||
|
||
export type OnConnectWalletClick = () => void | Promise<boolean> | ||
import { OnConnectWalletClick, onConnectWalletClickAtom } from 'state/wallet' | ||
export type { OnConnectWalletClick } from 'state/wallet' | ||
|
||
export interface WidgetEventHandlers { | ||
onConnectWalletClick?: OnConnectWalletClick | ||
} | ||
|
||
export default function useSyncWidgetEventHandlers({ onConnectWalletClick }: WidgetEventHandlers): void { | ||
const setOnConnectWalletClick = useUpdateAtom(onConnectWalletClickAtom) | ||
useEffect( | ||
() => setOnConnectWalletClick((old) => (old = onConnectWalletClick)), | ||
[onConnectWalletClick, setOnConnectWalletClick] | ||
) | ||
useEffect(() => setOnConnectWalletClick(onConnectWalletClick), [onConnectWalletClick, setOnConnectWalletClick]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { atom } from 'jotai' | ||
|
||
export type OnConnectWalletClick = () => void | boolean | Promise<boolean> | ||
|
||
// If set, allows integrator to add behavior when 'Connect wallet to swap' button is clicked | ||
export const onConnectWalletClickAtom = atom<(() => void | Promise<boolean>) | undefined>(undefined) | ||
export const onConnectWalletClickAtom = atom<OnConnectWalletClick | undefined>(undefined) |
5306dd0
There was a problem hiding this comment.
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-git-main-uniswap.vercel.app
widgets-seven-tau.vercel.app
widgets-uniswap.vercel.app