@lifi/widget 3.0.0-alpha.33 → 3.0.0-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.tsx +6 -3
- package/AppDefault.tsx +3 -3
- package/AppDrawer.tsx +3 -5
- package/_esm/App.js +6 -3
- package/_esm/App.js.map +1 -1
- package/_esm/AppDefault.js +3 -3
- package/_esm/AppDefault.js.map +1 -1
- package/_esm/AppDrawer.js +3 -3
- package/_esm/AppDrawer.js.map +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.d.ts +2 -2
- package/_esm/components/ActiveTransactions/ActiveTransactions.js +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.js.map +1 -1
- package/_esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +1 -1
- package/_esm/components/AmountInput/AmountInput.d.ts +3 -3
- package/_esm/components/AmountInput/AmountInput.js +2 -2
- package/_esm/components/AmountInput/AmountInput.js.map +1 -1
- package/_esm/components/AppContainer.js +3 -2
- package/_esm/components/AppContainer.js.map +1 -1
- package/_esm/components/Avatar/AccountAvatar.d.ts +3 -1
- package/_esm/components/Avatar/AccountAvatar.js +3 -3
- package/_esm/components/Avatar/AccountAvatar.js.map +1 -1
- package/_esm/components/Avatar/utils.d.ts +1 -1
- package/_esm/components/Avatar/utils.js +1 -1
- package/_esm/components/Avatar/utils.js.map +1 -1
- package/_esm/components/Card/Card.d.ts +7 -19
- package/_esm/components/Card/Card.js +36 -42
- package/_esm/components/Card/Card.js.map +1 -1
- package/_esm/components/Card/CardLabel.js +5 -3
- package/_esm/components/Card/CardLabel.js.map +1 -1
- package/_esm/components/Card/InputCard.d.ts +4 -0
- package/_esm/components/Card/InputCard.js +7 -0
- package/_esm/components/Card/InputCard.js.map +1 -0
- package/_esm/components/ChainSelect/ChainSelect.js +1 -1
- package/_esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/_esm/components/ChainSelect/ChainSelect.style.d.ts +2 -10
- package/_esm/components/ContractComponent/ContractComponent.d.ts +2 -2
- package/_esm/components/ContractComponent/ContractComponent.js.map +1 -1
- package/_esm/components/ContractComponent/ItemPrice.d.ts +8 -0
- package/_esm/components/ContractComponent/ItemPrice.js +23 -0
- package/_esm/components/ContractComponent/ItemPrice.js.map +1 -0
- package/_esm/components/{NFT → ContractComponent/NFT}/NFT.js +5 -11
- package/_esm/components/ContractComponent/NFT/NFT.js.map +1 -0
- package/_esm/components/ContractComponent/NFT/NFT.style.js.map +1 -0
- package/_esm/components/{NFT → ContractComponent/NFT}/NFTBase.js +1 -1
- package/_esm/components/ContractComponent/NFT/NFTBase.js.map +1 -0
- package/_esm/components/{NFT → ContractComponent/NFT}/types.d.ts +2 -3
- package/_esm/components/ContractComponent/NFT/types.js.map +1 -0
- package/_esm/components/Dialog.d.ts +2 -9
- package/_esm/components/Dialog.js +1 -0
- package/_esm/components/Dialog.js.map +1 -1
- package/_esm/components/Header/BackButton.d.ts +3 -0
- package/_esm/components/Header/BackButton.js +8 -0
- package/_esm/components/Header/BackButton.js.map +1 -0
- package/_esm/components/Header/CloseDrawerButton.d.ts +5 -1
- package/_esm/components/Header/CloseDrawerButton.js +8 -2
- package/_esm/components/Header/CloseDrawerButton.js.map +1 -1
- package/_esm/components/Header/Header.style.d.ts +4 -1
- package/_esm/components/Header/Header.style.js +24 -16
- package/_esm/components/Header/Header.style.js.map +1 -1
- package/_esm/components/Header/NavigationHeader.js +8 -9
- package/_esm/components/Header/NavigationHeader.js.map +1 -1
- package/_esm/components/Header/NavigationTabs.js +1 -1
- package/_esm/components/Header/NavigationTabs.js.map +1 -1
- package/_esm/components/Header/SettingsButton.style.d.ts +1 -1
- package/_esm/components/Header/TransactionHistoryButton.js +1 -1
- package/_esm/components/Header/TransactionHistoryButton.js.map +1 -1
- package/_esm/components/Header/WalletHeader.js +4 -11
- package/_esm/components/Header/WalletHeader.js.map +1 -1
- package/_esm/components/Header/WalletMenu.js +2 -2
- package/_esm/components/Header/WalletMenu.js.map +1 -1
- package/_esm/components/Insurance/types.d.ts +3 -3
- package/_esm/components/ListItem/ListItem.d.ts +1 -1
- package/_esm/components/PageContainer.d.ts +2 -1
- package/_esm/components/PageContainer.js +3 -3
- package/_esm/components/PageContainer.js.map +1 -1
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.js +2 -2
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.js.map +1 -1
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +9 -3
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.js +24 -14
- package/_esm/components/ReverseTokensButton/ReverseTokensButton.style.js.map +1 -1
- package/_esm/components/RouteCard/RouteCard.js +2 -2
- package/_esm/components/RouteCard/RouteCard.js.map +1 -1
- package/_esm/components/RouteCard/RouteCardSkeleton.d.ts +2 -2
- package/_esm/components/RouteCard/RouteCardSkeleton.js +1 -1
- package/_esm/components/RouteCard/RouteCardSkeleton.js.map +1 -1
- package/_esm/components/Routes/Routes.d.ts +2 -2
- package/_esm/components/Routes/Routes.js +1 -1
- package/_esm/components/Routes/Routes.js.map +1 -1
- package/_esm/components/Routes/RoutesExpanded.js +9 -3
- package/_esm/components/Routes/RoutesExpanded.js.map +1 -1
- package/_esm/components/Routes/RoutesExpanded.style.js +1 -0
- package/_esm/components/Routes/RoutesExpanded.style.js.map +1 -1
- package/_esm/components/SelectChainAndToken.js +3 -6
- package/_esm/components/SelectChainAndToken.js.map +1 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.js +9 -10
- package/_esm/components/SelectTokenButton/SelectTokenButton.js.map +1 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +10 -0
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.js +41 -1
- package/_esm/components/SelectTokenButton/SelectTokenButton.style.js.map +1 -1
- package/_esm/components/SendToWallet/SendToWalletButton.d.ts +2 -2
- package/_esm/components/SendToWallet/SendToWalletButton.js +2 -2
- package/_esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/_esm/components/Step/Step.js +8 -8
- package/_esm/components/Step/Step.js.map +1 -1
- package/_esm/components/Step/StepList.js +1 -1
- package/_esm/components/Step/StepList.js.map +1 -1
- package/_esm/components/StepActions/StepActions.d.ts +4 -9
- package/_esm/components/StepActions/StepActions.js +13 -12
- package/_esm/components/StepActions/StepActions.js.map +1 -1
- package/_esm/components/StepActions/types.d.ts +8 -2
- package/_esm/components/TokenList/TokenList.js +4 -1
- package/_esm/components/TokenList/TokenList.js.map +1 -1
- package/_esm/components/TokenList/TokenList.style.d.ts +1 -1
- package/_esm/components/TokenList/TokenList.style.js +1 -1
- package/_esm/components/TokenList/TokenList.style.js.map +1 -1
- package/_esm/components/TokenList/VirtualizedTokenList.js +19 -18
- package/_esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/_esm/components/TokenList/useTokenSelect.js +1 -1
- package/_esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/_esm/components/TokenList/utils.d.ts +2 -0
- package/_esm/components/TokenList/utils.js +35 -0
- package/_esm/components/TokenList/utils.js.map +1 -0
- package/_esm/config/version.d.ts +1 -1
- package/_esm/config/version.js +1 -1
- package/_esm/hooks/useAddressValidation.d.ts +1 -1
- package/_esm/hooks/useGasRecommendation.d.ts +1 -1
- package/_esm/hooks/useProcessMessage.d.ts +2 -2
- package/_esm/hooks/useProcessMessage.js +16 -12
- package/_esm/hooks/useProcessMessage.js.map +1 -1
- package/_esm/hooks/useRoutes.d.ts +2 -2
- package/_esm/hooks/useRoutes.js +11 -20
- package/_esm/hooks/useRoutes.js.map +1 -1
- package/_esm/hooks/useTokenAddressBalance.d.ts +1 -1
- package/_esm/hooks/useTokenBalance.d.ts +1 -1
- package/_esm/hooks/useTokenBalances.d.ts +1 -1
- package/_esm/hooks/useWideVariant.d.ts +1 -0
- package/_esm/hooks/{useExpandableVariant.js → useWideVariant.js} +3 -3
- package/_esm/hooks/useWideVariant.js.map +1 -0
- package/_esm/i18n/en.json +9 -5
- package/_esm/i18n/index.js +14 -14
- package/_esm/i18n/index.js.map +1 -1
- package/_esm/index.d.ts +6 -3
- package/_esm/index.js +6 -3
- package/_esm/index.js.map +1 -1
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +9 -2
- package/_esm/pages/ActiveTransactionsPage/ActiveTransactionsPage.js.map +1 -1
- package/_esm/pages/LanguagesPage.js +1 -0
- package/_esm/pages/LanguagesPage.js.map +1 -1
- package/_esm/pages/MainPage/MainPage.js +4 -4
- package/_esm/pages/MainPage/MainPage.js.map +1 -1
- package/_esm/pages/MainPage/ReviewButton.js +2 -2
- package/_esm/pages/MainPage/ReviewButton.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.js +1 -8
- package/_esm/pages/RoutesPage/RoutesPage.js.map +1 -1
- package/_esm/pages/RoutesPage/RoutesPage.style.js +1 -1
- package/_esm/pages/SelectChainPage/SelectChainPage.js +1 -0
- package/_esm/pages/SelectChainPage/SelectChainPage.js.map +1 -1
- package/_esm/pages/SelectEnabledToolsPage.js +4 -2
- package/_esm/pages/SelectEnabledToolsPage.js.map +1 -1
- package/_esm/pages/SelectNativeTokenPage.js +1 -0
- package/_esm/pages/SelectNativeTokenPage.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/_esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js +1 -1
- package/_esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js +1 -0
- package/_esm/pages/SelectWalletPage/SelectWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/BookmarkAddressSheet.js +1 -1
- package/_esm/pages/SendToWallet/BookmarkAddressSheet.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js +1 -1
- package/_esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js +3 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.js.map +1 -1
- package/_esm/pages/SendToWallet/SendToWalletPage.style.d.ts +2 -10
- package/_esm/pages/SendToWallet/SendToWalletPage.style.js +3 -2
- package/_esm/pages/SendToWallet/SendToWalletPage.style.js.map +1 -1
- package/_esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
- package/_esm/pages/SettingsPage/SettingsPage.js +1 -1
- package/_esm/pages/SettingsPage/SettingsPage.js.map +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +3 -3
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js +1 -1
- package/_esm/pages/TransactionDetailsPage/TransactionDetailsSkeleton.js.map +1 -1
- package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js +6 -3
- package/_esm/pages/TransactionHistoryPage/TransactionHistoryPage.js.map +1 -1
- package/_esm/pages/TransactionPage/StatusBottomSheet.js +6 -6
- package/_esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/_esm/pages/TransactionPage/TransactionPage.js +7 -7
- package/_esm/pages/TransactionPage/TransactionPage.js.map +1 -1
- package/_esm/providers/ThemeProvider/ThemeProvider.js +1 -1
- package/_esm/providers/ThemeProvider/ThemeProvider.js.map +1 -1
- package/_esm/stores/StoreProvider.js +1 -1
- package/_esm/stores/StoreProvider.js.map +1 -1
- package/_esm/stores/form/createFormStore.js +1 -6
- package/_esm/stores/form/createFormStore.js.map +1 -1
- package/_esm/stores/form/types.d.ts +4 -6
- package/_esm/stores/form/types.js.map +1 -1
- package/_esm/stores/form/useFieldController.d.ts +1 -1
- package/_esm/stores/form/useFieldValues.js +1 -1
- package/_esm/stores/form/useFieldValues.js.map +1 -1
- package/_esm/stores/form/useTouchedFields.d.ts +1 -4
- package/_esm/stores/settings/types.d.ts +4 -4
- package/_esm/stores/settings/useSettings.d.ts +1 -1
- package/_esm/themes/createTheme.d.ts +3 -0
- package/_esm/themes/createTheme.js +356 -0
- package/_esm/themes/createTheme.js.map +1 -0
- package/_esm/themes/jumper.d.ts +2 -0
- package/_esm/themes/jumper.js +36 -0
- package/_esm/themes/jumper.js.map +1 -0
- package/_esm/themes/types.d.ts +49 -0
- package/_esm/themes/types.js +2 -0
- package/_esm/{components/NFT → themes}/types.js.map +1 -1
- package/_esm/themes/utils.d.ts +4 -0
- package/_esm/themes/utils.js +9 -0
- package/_esm/themes/utils.js.map +1 -0
- package/_esm/themes/windows95.d.ts +2 -0
- package/_esm/themes/windows95.js +92 -0
- package/_esm/themes/windows95.js.map +1 -0
- package/_esm/types/events.d.ts +3 -1
- package/_esm/types/events.js +1 -0
- package/_esm/types/events.js.map +1 -1
- package/_esm/types/widget.d.ts +40 -27
- package/_esm/types/widget.js.map +1 -1
- package/_esm/utils/item.d.ts +1 -1
- package/components/ActiveTransactions/ActiveTransactions.tsx +3 -3
- package/components/AmountInput/AmountInput.tsx +6 -6
- package/components/AppContainer.tsx +2 -2
- package/components/Avatar/AccountAvatar.tsx +21 -17
- package/components/Avatar/utils.ts +1 -1
- package/components/Card/Card.tsx +45 -74
- package/components/Card/CardLabel.tsx +15 -3
- package/components/Card/InputCard.tsx +7 -0
- package/components/ChainSelect/ChainSelect.tsx +6 -2
- package/components/ContractComponent/ContractComponent.tsx +2 -2
- package/components/ContractComponent/ItemPrice.tsx +33 -0
- package/components/{NFT → ContractComponent/NFT}/NFT.tsx +5 -11
- package/components/{NFT → ContractComponent/NFT}/NFTBase.tsx +1 -1
- package/components/{NFT → ContractComponent/NFT}/types.ts +2 -3
- package/components/Dialog.tsx +3 -2
- package/components/Header/BackButton.tsx +17 -0
- package/components/Header/CloseDrawerButton.tsx +16 -3
- package/components/Header/Header.style.ts +25 -16
- package/components/Header/NavigationHeader.tsx +8 -11
- package/components/Header/NavigationTabs.tsx +1 -1
- package/components/Header/TransactionHistoryButton.tsx +0 -1
- package/components/Header/WalletHeader.tsx +5 -12
- package/components/Header/WalletMenu.tsx +2 -2
- package/components/Insurance/types.ts +3 -3
- package/components/PageContainer.ts +6 -5
- package/components/ReverseTokensButton/ReverseTokensButton.style.tsx +26 -21
- package/components/ReverseTokensButton/ReverseTokensButton.tsx +10 -8
- package/components/RouteCard/RouteCard.tsx +2 -2
- package/components/RouteCard/RouteCardSkeleton.tsx +5 -6
- package/components/Routes/Routes.tsx +3 -3
- package/components/Routes/RoutesExpanded.style.ts +1 -0
- package/components/Routes/RoutesExpanded.tsx +11 -4
- package/components/SelectChainAndToken.tsx +7 -13
- package/components/SelectTokenButton/SelectTokenButton.style.tsx +51 -1
- package/components/SelectTokenButton/SelectTokenButton.tsx +43 -38
- package/components/SendToWallet/SendToWalletButton.tsx +8 -8
- package/components/Step/Step.tsx +8 -8
- package/components/Step/StepList.tsx +1 -1
- package/components/StepActions/StepActions.tsx +40 -21
- package/components/StepActions/types.ts +12 -2
- package/components/TokenList/TokenList.style.tsx +1 -1
- package/components/TokenList/TokenList.tsx +9 -6
- package/components/TokenList/VirtualizedTokenList.tsx +26 -20
- package/components/TokenList/useTokenSelect.ts +1 -1
- package/components/TokenList/utils.ts +42 -0
- package/config/version.ts +1 -1
- package/hooks/useProcessMessage.ts +38 -15
- package/hooks/useRoutes.ts +13 -30
- package/hooks/{useExpandableVariant.ts → useWideVariant.ts} +2 -2
- package/i18n/en.json +9 -5
- package/i18n/index.ts +14 -14
- package/index.ts +6 -3
- package/package.json +15 -15
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.tsx +20 -5
- package/pages/LanguagesPage.tsx +1 -0
- package/pages/MainPage/MainPage.tsx +12 -10
- package/pages/MainPage/ReviewButton.tsx +2 -2
- package/pages/RoutesPage/RoutesPage.style.ts +1 -1
- package/pages/RoutesPage/RoutesPage.tsx +1 -9
- package/pages/SelectChainPage/SelectChainPage.tsx +1 -0
- package/pages/SelectEnabledToolsPage.tsx +8 -1
- package/pages/SelectNativeTokenPage.tsx +1 -0
- package/pages/SelectTokenPage/SearchTokenInput.tsx +3 -3
- package/pages/SelectTokenPage/SelectTokenPage.tsx +1 -1
- package/pages/SelectWalletPage/SelectWalletPage.tsx +1 -0
- package/pages/SendToWallet/BookmarkAddressSheet.tsx +2 -4
- package/pages/SendToWallet/SendToConfiguredWalletPage.tsx +1 -0
- package/pages/SendToWallet/SendToWalletPage.style.tsx +3 -2
- package/pages/SendToWallet/SendToWalletPage.tsx +7 -2
- package/pages/SettingsPage/SettingsPage.tsx +1 -1
- package/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -8
- package/pages/TransactionDetailsPage/TransactionDetailsSkeleton.tsx +1 -1
- package/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +19 -16
- package/pages/TransactionPage/StatusBottomSheet.tsx +7 -11
- package/pages/TransactionPage/TransactionPage.tsx +12 -16
- package/providers/ThemeProvider/ThemeProvider.tsx +1 -1
- package/stores/StoreProvider.tsx +1 -1
- package/stores/form/createFormStore.ts +1 -6
- package/stores/form/types.ts +4 -6
- package/stores/form/useFieldValues.ts +1 -1
- package/stores/settings/types.ts +4 -4
- package/themes/createTheme.ts +415 -0
- package/themes/jumper.ts +37 -0
- package/themes/types.ts +63 -0
- package/themes/utils.ts +18 -0
- package/themes/windows95.ts +98 -0
- package/types/events.ts +2 -0
- package/types/widget.ts +54 -32
- package/_esm/components/NFT/NFT.js.map +0 -1
- package/_esm/components/NFT/NFT.style.js.map +0 -1
- package/_esm/components/NFT/NFTBase.js.map +0 -1
- package/_esm/config/theme.d.ts +0 -27
- package/_esm/config/theme.js +0 -250
- package/_esm/config/theme.js.map +0 -1
- package/_esm/hooks/useExpandableVariant.d.ts +0 -1
- package/_esm/hooks/useExpandableVariant.js.map +0 -1
- package/config/theme.ts +0 -321
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.d.ts +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.style.d.ts +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFT.style.js +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/NFTBase.d.ts +0 -0
- /package/_esm/components/{NFT → ContractComponent/NFT}/types.js +0 -0
- /package/components/{NFT → ContractComponent/NFT}/NFT.style.ts +0 -0
package/_esm/types/widget.d.ts
CHANGED
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
import type { BaseToken, ChainType, Order, RouteOptions, SDKConfig, StaticToken, Token } from '@lifi/sdk';
|
|
1
|
+
import type { BaseToken, ChainType, ContractCall, Order, RouteOptions, SDKConfig, StaticToken, Token } from '@lifi/sdk';
|
|
2
2
|
import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
|
|
3
3
|
import type { TypographyOptions } from '@mui/material/styles/createTypography.js';
|
|
4
4
|
import type { CoinbaseWalletParameters, WalletConnectParameters } from '@wagmi/connectors';
|
|
5
5
|
import type { CSSProperties, ReactNode, RefObject } from 'react';
|
|
6
6
|
import type { LanguageKey, LanguageResources } from '../providers/I18nProvider/types.js';
|
|
7
|
-
export type WidgetVariant = '
|
|
8
|
-
export type WidgetSubvariant = 'default' | 'split' | '
|
|
9
|
-
export type
|
|
7
|
+
export type WidgetVariant = 'compact' | 'wide' | 'drawer';
|
|
8
|
+
export type WidgetSubvariant = 'default' | 'split' | 'custom' | 'refuel';
|
|
9
|
+
export type SplitSubvariant = 'bridge' | 'swap';
|
|
10
|
+
export type CustomSubvariant = 'checkout' | 'deposit';
|
|
11
|
+
export interface SubvariantOptions {
|
|
12
|
+
split?: SplitSubvariant;
|
|
13
|
+
custom?: CustomSubvariant;
|
|
14
|
+
}
|
|
15
|
+
export type Appearance = PaletteMode | 'auto';
|
|
16
|
+
export interface NavigationProps {
|
|
17
|
+
/**
|
|
18
|
+
* If given, uses a negative margin to counteract the padding on sides for navigation elements like icon buttons.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
edge?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* If true, makes navigation header components compact.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
dense?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type WidgetThemeComponents = Pick<Components<Theme>, 'MuiAppBar' | 'MuiAvatar' | 'MuiButton' | 'MuiCard' | 'MuiIconButton' | 'MuiInputCard'>;
|
|
29
|
+
export type WidgetTheme = {
|
|
30
|
+
palette?: Pick<PaletteOptions, 'background' | 'grey' | 'primary' | 'secondary' | 'text'>;
|
|
31
|
+
shape?: Shape;
|
|
32
|
+
typography?: TypographyOptions;
|
|
33
|
+
components?: WidgetThemeComponents;
|
|
34
|
+
container?: CSSProperties;
|
|
35
|
+
playground?: CSSProperties;
|
|
36
|
+
navigation?: NavigationProps;
|
|
37
|
+
};
|
|
10
38
|
export declare enum DisabledUI {
|
|
11
39
|
FromAmount = "fromAmount",
|
|
12
40
|
FromToken = "fromToken",
|
|
@@ -29,22 +57,11 @@ export declare enum RequiredUI {
|
|
|
29
57
|
ToAddress = "toAddress"
|
|
30
58
|
}
|
|
31
59
|
export type RequiredUIType = `${RequiredUI}`;
|
|
32
|
-
export type Appearance = PaletteMode | 'auto';
|
|
33
|
-
export type ThemeConfig = {
|
|
34
|
-
palette?: Pick<PaletteOptions, 'background' | 'grey' | 'primary' | 'secondary' | 'text'>;
|
|
35
|
-
shape?: Shape;
|
|
36
|
-
typography?: TypographyOptions;
|
|
37
|
-
components?: Pick<Components<Omit<Theme, 'components'>>, 'MuiAvatar'>;
|
|
38
|
-
};
|
|
39
60
|
export interface WidgetWalletConfig {
|
|
40
61
|
onConnect(): void;
|
|
41
62
|
walletConnect?: WalletConnectParameters;
|
|
42
63
|
coinbase?: CoinbaseWalletParameters;
|
|
43
64
|
}
|
|
44
|
-
export interface AllowDeny<T> {
|
|
45
|
-
allow?: T[];
|
|
46
|
-
deny?: T[];
|
|
47
|
-
}
|
|
48
65
|
export interface WidgetSDKConfig extends Omit<SDKConfig, 'apiKey' | 'disableVersionCheck' | 'integrator' | 'routeOptions' | 'widgetVersion'> {
|
|
49
66
|
routeOptions?: Omit<RouteOptions, 'bridges' | 'exchanges' | 'insurance'>;
|
|
50
67
|
}
|
|
@@ -52,18 +69,15 @@ export interface WidgetContractTool {
|
|
|
52
69
|
logoURI: string;
|
|
53
70
|
name: string;
|
|
54
71
|
}
|
|
55
|
-
export interface WidgetContract {
|
|
56
|
-
address?: string;
|
|
57
|
-
callData?: string;
|
|
58
|
-
gasLimit?: string;
|
|
59
|
-
approvalAddress?: string;
|
|
60
|
-
outputToken?: string;
|
|
61
|
-
fallbackAddress?: string;
|
|
62
|
-
}
|
|
63
72
|
export interface ToAddress {
|
|
64
73
|
name?: string;
|
|
65
74
|
address: string;
|
|
66
75
|
chainType: ChainType;
|
|
76
|
+
logoURI?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface AllowDeny<T> {
|
|
79
|
+
allow?: T[];
|
|
80
|
+
deny?: T[];
|
|
67
81
|
}
|
|
68
82
|
export interface WidgetConfig {
|
|
69
83
|
fromChain?: number;
|
|
@@ -74,7 +88,7 @@ export interface WidgetConfig {
|
|
|
74
88
|
toAddresses?: ToAddress[];
|
|
75
89
|
fromAmount?: number | string;
|
|
76
90
|
toAmount?: number | string;
|
|
77
|
-
|
|
91
|
+
contractCalls?: ContractCall[];
|
|
78
92
|
contractComponent?: ReactNode;
|
|
79
93
|
contractSecondaryComponent?: ReactNode;
|
|
80
94
|
contractCompactComponent?: ReactNode;
|
|
@@ -88,10 +102,9 @@ export interface WidgetConfig {
|
|
|
88
102
|
insurance?: boolean;
|
|
89
103
|
variant?: WidgetVariant;
|
|
90
104
|
subvariant?: WidgetSubvariant;
|
|
91
|
-
subvariantOptions?:
|
|
105
|
+
subvariantOptions?: SubvariantOptions;
|
|
92
106
|
appearance?: Appearance;
|
|
93
|
-
theme?:
|
|
94
|
-
containerStyle?: CSSProperties;
|
|
107
|
+
theme?: WidgetTheme;
|
|
95
108
|
disabledUI?: DisabledUIType[];
|
|
96
109
|
hiddenUI?: HiddenUIType[];
|
|
97
110
|
requiredUI?: RequiredUIType[];
|
package/_esm/types/widget.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../types/widget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../types/widget.ts"],"names":[],"mappings":"AAwEA,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,uCAAyB,CAAA;IACzB,qCAAuB,CAAA;IACvB,qCAAuB,CAAA;IACvB,iCAAmB,CAAA;AACrB,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAGD,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,qCAAyB,CAAA;IACzB,mDAAuC,CAAA;IACvC,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;IACrB,mCAAuB,CAAA;IACvB,mCAAuB,CAAA;IACvB,+BAAmB,CAAA;IACnB,qCAAyB,CAAA;AAC3B,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB;AAGD,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACpB,qCAAuB,CAAA;AACzB,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB"}
|
package/_esm/utils/item.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AllowDeny } from '../types/widget.js';
|
|
2
|
-
export declare const isItemAllowed: <T>(itemId: T, items?: AllowDeny<T>
|
|
2
|
+
export declare const isItemAllowed: <T>(itemId: T, items?: AllowDeny<T>) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CardProps } from '@mui/material';
|
|
2
2
|
import { Stack } from '@mui/material';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -9,7 +9,7 @@ import { CardTitle } from '../Card/CardTitle.js';
|
|
|
9
9
|
import { ActiveTransactionItem } from './ActiveTransactionItem.js';
|
|
10
10
|
import { ShowAllButton } from './ActiveTransactions.style.js';
|
|
11
11
|
|
|
12
|
-
export const ActiveTransactions: React.FC<
|
|
12
|
+
export const ActiveTransactions: React.FC<CardProps> = (props) => {
|
|
13
13
|
const { t } = useTranslation();
|
|
14
14
|
const navigate = useNavigate();
|
|
15
15
|
const executingRoutes = useExecutingRoutesIds();
|
|
@@ -25,7 +25,7 @@ export const ActiveTransactions: React.FC<BoxProps> = (props) => {
|
|
|
25
25
|
const hasShowAll = executingRoutes?.length > 2;
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
|
-
<Card
|
|
28
|
+
<Card type="selected" selectionColor="secondary" {...props}>
|
|
29
29
|
<CardTitle>{t('header.activeTransactions')}</CardTitle>
|
|
30
30
|
<Stack spacing={1.5} pt={1.5} pb={hasShowAll ? 0 : 2}>
|
|
31
31
|
{executingRoutes.slice(0, 2).map((routeId) => (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Token } from '@lifi/sdk';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CardProps } from '@mui/material';
|
|
3
3
|
import type { ChangeEvent, ReactNode } from 'react';
|
|
4
4
|
import { useLayoutEffect, useRef } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -11,8 +11,8 @@ import { useFieldValues } from '../../stores/form/useFieldValues.js';
|
|
|
11
11
|
import { DisabledUI } from '../../types/widget.js';
|
|
12
12
|
import { formatInputAmount } from '../../utils/format.js';
|
|
13
13
|
import { fitInputText } from '../../utils/input.js';
|
|
14
|
-
import { Card } from '../Card/Card.js';
|
|
15
14
|
import { CardTitle } from '../Card/CardTitle.js';
|
|
15
|
+
import { InputCard } from '../Card/InputCard.js';
|
|
16
16
|
import {
|
|
17
17
|
FormContainer,
|
|
18
18
|
FormControl,
|
|
@@ -24,7 +24,7 @@ import { AmountInputEndAdornment } from './AmountInputEndAdornment.js';
|
|
|
24
24
|
import { AmountInputStartAdornment } from './AmountInputStartAdornment.js';
|
|
25
25
|
import { PriceFormHelperText } from './PriceFormHelperText.js';
|
|
26
26
|
|
|
27
|
-
export const AmountInput: React.FC<FormTypeProps &
|
|
27
|
+
export const AmountInput: React.FC<FormTypeProps & CardProps> = ({
|
|
28
28
|
formType,
|
|
29
29
|
...props
|
|
30
30
|
}) => {
|
|
@@ -53,7 +53,7 @@ export const AmountInput: React.FC<FormTypeProps & BoxProps> = ({
|
|
|
53
53
|
|
|
54
54
|
export const AmountInputBase: React.FC<
|
|
55
55
|
FormTypeProps &
|
|
56
|
-
|
|
56
|
+
CardProps & {
|
|
57
57
|
token?: Token;
|
|
58
58
|
startAdornment?: ReactNode;
|
|
59
59
|
endAdornment?: ReactNode;
|
|
@@ -98,7 +98,7 @@ export const AmountInputBase: React.FC<
|
|
|
98
98
|
}, [value, ref]);
|
|
99
99
|
|
|
100
100
|
return (
|
|
101
|
-
<
|
|
101
|
+
<InputCard {...props}>
|
|
102
102
|
<CardTitle>{t('main.fromAmount')}</CardTitle>
|
|
103
103
|
<FormContainer>
|
|
104
104
|
<AmountInputStartAdornment formType={formType} />
|
|
@@ -123,6 +123,6 @@ export const AmountInputBase: React.FC<
|
|
|
123
123
|
{bottomAdornment}
|
|
124
124
|
</FormControl>
|
|
125
125
|
</FormContainer>
|
|
126
|
-
</
|
|
126
|
+
</InputCard>
|
|
127
127
|
);
|
|
128
128
|
};
|
|
@@ -29,6 +29,7 @@ const RelativeContainer = styled(Box, {
|
|
|
29
29
|
overflow: 'auto',
|
|
30
30
|
flex: 1,
|
|
31
31
|
zIndex: 0,
|
|
32
|
+
...theme.container,
|
|
32
33
|
}));
|
|
33
34
|
|
|
34
35
|
const CssBaselineContainer = styled(ScopedCssBaseline, {
|
|
@@ -53,10 +54,9 @@ export const FlexContainer = styled(Container)({
|
|
|
53
54
|
|
|
54
55
|
export const AppContainer: React.FC<PropsWithChildren<{}>> = ({ children }) => {
|
|
55
56
|
// const ref = useRef<HTMLDivElement>(null);
|
|
56
|
-
const {
|
|
57
|
+
const { variant, elementId } = useWidgetConfig();
|
|
57
58
|
return (
|
|
58
59
|
<RelativeContainer
|
|
59
|
-
sx={containerStyle}
|
|
60
60
|
variant={variant}
|
|
61
61
|
id={createElementId(ElementId.RelativeContainer, elementId)}
|
|
62
62
|
>
|
|
@@ -3,6 +3,7 @@ import { Wallet } from '@mui/icons-material';
|
|
|
3
3
|
import { Badge } from '@mui/material';
|
|
4
4
|
import type { Account } from '../../hooks/useAccount.js';
|
|
5
5
|
import { useChain } from '../../hooks/useChain.js';
|
|
6
|
+
import type { ToAddress } from '../../types/widget.js';
|
|
6
7
|
import { SmallAvatar } from '../SmallAvatar.js';
|
|
7
8
|
import {
|
|
8
9
|
AvatarDefault,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
interface AccountAvatarProps {
|
|
14
15
|
chainId?: number;
|
|
15
16
|
account?: Account;
|
|
17
|
+
toAddress?: ToAddress;
|
|
16
18
|
empty?: boolean;
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -20,26 +22,28 @@ export const AccountAvatar = ({
|
|
|
20
22
|
chainId,
|
|
21
23
|
account,
|
|
22
24
|
empty,
|
|
25
|
+
toAddress,
|
|
23
26
|
}: AccountAvatarProps) => {
|
|
24
27
|
const { chain } = useChain(chainId);
|
|
25
28
|
|
|
26
|
-
const avatar =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
const avatar =
|
|
30
|
+
account?.connector || toAddress?.logoURI ? (
|
|
31
|
+
<AvatarMasked
|
|
32
|
+
src={toAddress?.logoURI || getConnectorIcon(account?.connector)}
|
|
33
|
+
alt={toAddress?.name || account?.connector?.name}
|
|
34
|
+
sx={{
|
|
35
|
+
marginRight: chain?.logoURI ? 0 : 1.5,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
{(toAddress?.name || account?.connector?.name)?.[0]}
|
|
39
|
+
</AvatarMasked>
|
|
40
|
+
) : empty ? (
|
|
41
|
+
<AvatarDefault />
|
|
42
|
+
) : (
|
|
43
|
+
<AvatarDefault>
|
|
44
|
+
<Wallet sx={{ fontSize: 20 }} />
|
|
45
|
+
</AvatarDefault>
|
|
46
|
+
);
|
|
43
47
|
|
|
44
48
|
return (
|
|
45
49
|
<Badge
|
|
@@ -8,4 +8,4 @@ export const avatarMask16 =
|
|
|
8
8
|
* Avatar mask for 12px badge
|
|
9
9
|
*/
|
|
10
10
|
export const avatarMask12 =
|
|
11
|
-
'radial-gradient(circle 8.5px at calc(100% - 3.5px) calc(100% - 3.5px), #fff0 96%, #fff) 100% 100
|
|
11
|
+
'radial-gradient(circle 8.5px at calc(100% - 3.5px) calc(100% - 3.5px), #fff0 96%, #fff) 100% 100% / 100% 100% no-repeat';
|
package/components/Card/Card.tsx
CHANGED
|
@@ -1,83 +1,54 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
import type { MouseEventHandler } from 'react';
|
|
1
|
+
import type { CardProps as MuiCardProps } from '@mui/material';
|
|
2
|
+
import { Card as MuiCard, alpha, darken, lighten, styled } from '@mui/material';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type CardProps = {
|
|
8
|
-
variant?: CardVariant;
|
|
4
|
+
export interface CardProps extends MuiCardProps {
|
|
5
|
+
type?: 'default' | 'selected' | 'error';
|
|
9
6
|
selectionColor?: 'primary' | 'secondary';
|
|
10
7
|
indented?: boolean;
|
|
11
|
-
|
|
12
|
-
pointerEvents?: 'auto' | 'none';
|
|
13
|
-
} & BoxProps;
|
|
14
|
-
|
|
15
|
-
const getBackgroundColor = (
|
|
16
|
-
theme: Theme,
|
|
17
|
-
variant?: CardVariant,
|
|
18
|
-
selectionColor?: 'primary' | 'secondary',
|
|
19
|
-
) =>
|
|
20
|
-
variant === 'selected'
|
|
21
|
-
? selectionColor === 'primary'
|
|
22
|
-
? theme.palette.mode === 'light'
|
|
23
|
-
? alpha(theme.palette.primary.main, 0.04)
|
|
24
|
-
: alpha(theme.palette.primary.main, 0.42)
|
|
25
|
-
: alpha(
|
|
26
|
-
theme.palette.secondary.main,
|
|
27
|
-
theme.palette.mode === 'light' ? 0.08 : 0.12,
|
|
28
|
-
)
|
|
29
|
-
: theme.palette.background.paper;
|
|
8
|
+
}
|
|
30
9
|
|
|
31
|
-
export const Card = styled(
|
|
10
|
+
export const Card = styled(MuiCard, {
|
|
32
11
|
shouldForwardProp: (prop) =>
|
|
33
|
-
!['
|
|
34
|
-
|
|
35
|
-
),
|
|
36
|
-
})<CardProps>(({
|
|
37
|
-
theme,
|
|
38
|
-
variant = 'default',
|
|
39
|
-
selectionColor = 'primary',
|
|
40
|
-
indented,
|
|
41
|
-
pointerEvents,
|
|
42
|
-
onClick,
|
|
43
|
-
}) => {
|
|
44
|
-
const backgroundColor = getBackgroundColor(theme, variant, selectionColor);
|
|
45
|
-
const backgroundHoverColor = onClick
|
|
46
|
-
? theme.palette.mode === 'light'
|
|
47
|
-
? darken(backgroundColor, 0.02)
|
|
48
|
-
: lighten(backgroundColor, 0.02)
|
|
49
|
-
: backgroundColor;
|
|
12
|
+
!['type', 'indented', 'selectionColor'].includes(prop as string),
|
|
13
|
+
})<CardProps>(({ theme, indented, selectionColor, type }) => {
|
|
50
14
|
return {
|
|
51
|
-
backgroundColor,
|
|
52
|
-
// border: variant === 'default' ? 'none' : '1px solid',
|
|
53
|
-
border: '1px solid',
|
|
54
|
-
borderColor:
|
|
55
|
-
variant === 'error'
|
|
56
|
-
? theme.palette.error.main
|
|
57
|
-
: variant === 'selected'
|
|
58
|
-
? selectionColor === 'primary'
|
|
59
|
-
? theme.palette.primary.main
|
|
60
|
-
: alpha(theme.palette.secondary.main, 0.48)
|
|
61
|
-
: theme.palette.mode === 'light'
|
|
62
|
-
? theme.palette.grey[300]
|
|
63
|
-
: theme.palette.grey[800],
|
|
64
|
-
borderRadius: theme.shape.borderRadius,
|
|
65
|
-
// boxShadow: '0px 1px 8px 0px rgba(0, 0, 0, 0.04)',
|
|
66
|
-
overflow: 'hidden',
|
|
67
|
-
position: 'relative',
|
|
68
15
|
padding: indented ? theme.spacing(2) : 0,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
16
|
+
...(type === 'selected' &&
|
|
17
|
+
selectionColor === 'primary' && {
|
|
18
|
+
backgroundColor:
|
|
19
|
+
theme.palette.mode === 'light'
|
|
20
|
+
? lighten(theme.palette.primary.main, 0.95)
|
|
21
|
+
: darken(theme.palette.primary.main, 0.65),
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderStyle: 'solid',
|
|
24
|
+
borderColor: theme.palette.primary.main,
|
|
25
|
+
'&:hover': {
|
|
26
|
+
backgroundColor:
|
|
27
|
+
theme.palette.mode === 'light'
|
|
28
|
+
? lighten(theme.palette.primary.main, 0.9)
|
|
29
|
+
: darken(theme.palette.primary.main, 0.6),
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
...(type === 'selected' &&
|
|
33
|
+
selectionColor === 'secondary' && {
|
|
34
|
+
backgroundColor:
|
|
35
|
+
theme.palette.mode === 'light'
|
|
36
|
+
? lighten(theme.palette.secondary.main, 0.9)
|
|
37
|
+
: darken(theme.palette.secondary.main, 0.85),
|
|
38
|
+
borderWidth: 1,
|
|
39
|
+
borderStyle: 'solid',
|
|
40
|
+
borderColor: alpha(theme.palette.secondary.main, 0.32),
|
|
41
|
+
'&:hover': {
|
|
42
|
+
backgroundColor:
|
|
43
|
+
theme.palette.mode === 'light'
|
|
44
|
+
? lighten(theme.palette.secondary.main, 0.85)
|
|
45
|
+
: darken(theme.palette.secondary.main, 0.8),
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
...(type === 'error' && {
|
|
49
|
+
borderWidth: 1,
|
|
50
|
+
borderStyle: 'solid',
|
|
51
|
+
borderColor: theme.palette.error.main,
|
|
52
|
+
}),
|
|
82
53
|
};
|
|
83
54
|
});
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Typography,
|
|
4
|
+
alpha,
|
|
5
|
+
getContrastRatio,
|
|
6
|
+
lighten,
|
|
7
|
+
styled,
|
|
8
|
+
} from '@mui/material';
|
|
2
9
|
|
|
3
10
|
export const CardLabel = styled(Box, {
|
|
4
11
|
shouldForwardProp: (prop) => prop !== 'type',
|
|
@@ -7,7 +14,7 @@ export const CardLabel = styled(Box, {
|
|
|
7
14
|
type === 'active'
|
|
8
15
|
? theme.palette.mode === 'light'
|
|
9
16
|
? theme.palette.secondary.main
|
|
10
|
-
: alpha(theme.palette.secondary.main, 0.
|
|
17
|
+
: alpha(theme.palette.secondary.main, 0.8)
|
|
11
18
|
: type?.includes('insurance')
|
|
12
19
|
? alpha(
|
|
13
20
|
theme.palette.success.main,
|
|
@@ -22,7 +29,12 @@ export const CardLabel = styled(Box, {
|
|
|
22
29
|
theme.palette.success.main,
|
|
23
30
|
theme.palette.mode === 'light' ? 0 : 0.24,
|
|
24
31
|
)
|
|
25
|
-
:
|
|
32
|
+
: getContrastRatio(
|
|
33
|
+
theme.palette.common.white,
|
|
34
|
+
alpha(theme.palette.secondary.main, 0.08),
|
|
35
|
+
) >= 3
|
|
36
|
+
? theme.palette.common.white
|
|
37
|
+
: theme.palette.common.black,
|
|
26
38
|
padding: type === 'insurance' ? theme.spacing(0, 1.5) : 0,
|
|
27
39
|
display: 'flex',
|
|
28
40
|
alignItems: 'center',
|
|
@@ -58,11 +58,15 @@ export const ChainSelect = ({ formType }: FormTypeProps) => {
|
|
|
58
58
|
title={chain.name}
|
|
59
59
|
placement="top"
|
|
60
60
|
enterDelay={400}
|
|
61
|
+
enterNextDelay={100}
|
|
62
|
+
disableInteractive
|
|
61
63
|
arrow
|
|
62
64
|
>
|
|
63
65
|
<ChainCard
|
|
66
|
+
component="button"
|
|
64
67
|
onClick={() => setCurrentChain(chain.id)}
|
|
65
|
-
|
|
68
|
+
type={chainId === chain.id ? 'selected' : 'default'}
|
|
69
|
+
selectionColor="primary"
|
|
66
70
|
>
|
|
67
71
|
<Avatar
|
|
68
72
|
src={chain.logoURI}
|
|
@@ -75,7 +79,7 @@ export const ChainSelect = ({ formType }: FormTypeProps) => {
|
|
|
75
79
|
</Tooltip>
|
|
76
80
|
))}
|
|
77
81
|
{chainsToHide > 0 ? (
|
|
78
|
-
<ChainCard onClick={showAllChains}>
|
|
82
|
+
<ChainCard component="button" onClick={showAllChains}>
|
|
79
83
|
<Box
|
|
80
84
|
sx={{
|
|
81
85
|
width: 40,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CardProps } from '@mui/material';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
3
|
import { Card } from '../Card/Card.js';
|
|
4
4
|
|
|
5
|
-
export const ContractComponent: React.FC<PropsWithChildren<
|
|
5
|
+
export const ContractComponent: React.FC<PropsWithChildren<CardProps>> = ({
|
|
6
6
|
children,
|
|
7
7
|
...props
|
|
8
8
|
}) => {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ContractCall } from '@lifi/sdk';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useFieldActions } from '../../stores/form/useFieldActions.js';
|
|
4
|
+
import type { TokenAmount } from '../../types/token.js';
|
|
5
|
+
import { Token } from '../Token/Token.js';
|
|
6
|
+
|
|
7
|
+
export interface ItemPriceProps {
|
|
8
|
+
token: TokenAmount;
|
|
9
|
+
contractCalls?: ContractCall[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ItemPrice: React.FC<ItemPriceProps> = ({
|
|
13
|
+
token,
|
|
14
|
+
contractCalls,
|
|
15
|
+
}) => {
|
|
16
|
+
const { setFieldValue } = useFieldActions();
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (token) {
|
|
20
|
+
setFieldValue('toChain', token.chainId, { isTouched: true });
|
|
21
|
+
setFieldValue('toToken', token.address, { isTouched: true });
|
|
22
|
+
setFieldValue('toAmount', token.amount?.toString(), {
|
|
23
|
+
isTouched: true,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (contractCalls) {
|
|
27
|
+
setFieldValue('contractCalls', contractCalls, {
|
|
28
|
+
isTouched: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, [contractCalls, setFieldValue, token]);
|
|
32
|
+
return <Token token={token} p={2} />;
|
|
33
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { useFieldActions } from '
|
|
2
|
+
import { useFieldActions } from '../../../stores/form/useFieldActions.js';
|
|
3
3
|
import { NFTBase } from './NFTBase.js';
|
|
4
4
|
import type { NFTProps } from './types.js';
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ export const NFT: React.FC<NFTProps> = ({
|
|
|
10
10
|
assetName,
|
|
11
11
|
owner,
|
|
12
12
|
token,
|
|
13
|
-
|
|
13
|
+
contractCall,
|
|
14
14
|
}) => {
|
|
15
15
|
const { setFieldValue } = useFieldActions();
|
|
16
16
|
|
|
@@ -22,18 +22,12 @@ export const NFT: React.FC<NFTProps> = ({
|
|
|
22
22
|
isTouched: true,
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
if (
|
|
26
|
-
setFieldValue('
|
|
27
|
-
isTouched: true,
|
|
28
|
-
});
|
|
29
|
-
setFieldValue('toContractCallData', contract.callData, {
|
|
30
|
-
isTouched: true,
|
|
31
|
-
});
|
|
32
|
-
setFieldValue('toContractGasLimit', contract.gasLimit, {
|
|
25
|
+
if (contractCall) {
|
|
26
|
+
setFieldValue('contractCalls', [contractCall], {
|
|
33
27
|
isTouched: true,
|
|
34
28
|
});
|
|
35
29
|
}
|
|
36
|
-
}, [
|
|
30
|
+
}, [contractCall, setFieldValue, token]);
|
|
37
31
|
return (
|
|
38
32
|
<NFTBase
|
|
39
33
|
isLoading={isLoading}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, Link, Skeleton, Typography } from '@mui/material';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { Token } from '
|
|
3
|
+
import { Token } from '../../Token/Token.js';
|
|
4
4
|
import { PreviewAvatar } from './NFT.style.js';
|
|
5
5
|
import type { NFTProps } from './types.js';
|
|
6
6
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { TokenAmount } from '@lifi/sdk';
|
|
2
|
-
import type { WidgetContract } from '../../types/widget.js';
|
|
1
|
+
import type { ContractCall, TokenAmount } from '@lifi/sdk';
|
|
3
2
|
|
|
4
3
|
export interface NFTBaseProps {
|
|
5
4
|
imageUrl?: string;
|
|
@@ -11,7 +10,7 @@ export interface NFTBaseProps {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export interface NFTProps extends NFTBaseProps {
|
|
14
|
-
|
|
13
|
+
contractCall?: ContractCall;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
export interface NFTOwner {
|
package/components/Dialog.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DialogProps, Theme } from '@mui/material';
|
|
1
|
+
import type { DialogProps, PaperProps, Theme } from '@mui/material';
|
|
2
2
|
import { Dialog as MuiDialog } from '@mui/material';
|
|
3
3
|
import type { PropsWithChildren } from 'react';
|
|
4
4
|
import { useGetScrollableContainer } from '../hooks/useScrollableContainer.js';
|
|
@@ -10,10 +10,11 @@ export const modalProps = {
|
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const paperProps = {
|
|
13
|
+
export const paperProps: Partial<PaperProps> = {
|
|
14
14
|
sx: (theme: Theme) => ({
|
|
15
15
|
position: 'absolute',
|
|
16
16
|
backgroundImage: 'none',
|
|
17
|
+
backgroundColor: theme.palette.background.default,
|
|
17
18
|
borderTopLeftRadius: theme.shape.borderRadius,
|
|
18
19
|
borderTopRightRadius: theme.shape.borderRadius,
|
|
19
20
|
}),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ArrowBack } from '@mui/icons-material';
|
|
2
|
+
import type { IconButtonProps } from '@mui/material';
|
|
3
|
+
import { IconButton, useTheme } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
export const BackButton: React.FC<IconButtonProps> = ({ onClick }) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<IconButton
|
|
10
|
+
size="medium"
|
|
11
|
+
edge={theme?.navigation?.edge ? 'start' : false}
|
|
12
|
+
onClick={onClick}
|
|
13
|
+
>
|
|
14
|
+
<ArrowBack />
|
|
15
|
+
</IconButton>
|
|
16
|
+
);
|
|
17
|
+
};
|