@lifi/widget
Version:
LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.
29 lines (24 loc) • 698 B
text/typescript
import { useShallow } from 'zustand/shallow'
import { createWithEqualityFn } from 'zustand/traditional'
import type { SendToWalletStore } from './types.js'
export const sendToWalletStore = createWithEqualityFn<SendToWalletStore>(
(set) => ({
showSendToWallet: false,
setSendToWallet: (value) =>
set({
showSendToWallet: value,
}),
}),
Object.is
)
export const useSendToWalletStore = <T>(
selector: (state: SendToWalletStore) => T
): T => {
return sendToWalletStore(useShallow(selector))
}
export const useSendToWalletActions = () => {
const actions = useSendToWalletStore((store) => ({
setSendToWallet: store.setSendToWallet,
}))
return actions
}