0xtrails 0.1.13 → 0.2.1
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/dist/aave.d.ts.map +1 -1
- package/dist/analytics.d.ts +12 -2
- package/dist/analytics.d.ts.map +1 -1
- package/dist/apiClient.d.ts +1 -1
- package/dist/apiClient.d.ts.map +1 -1
- package/dist/{ccip-D3gTQONK.js → ccip-BbfANth7.js} +12 -12
- package/dist/cctp.d.ts.map +1 -1
- package/dist/cctpqueue.d.ts +3 -3
- package/dist/cctpqueue.d.ts.map +1 -1
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +18 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/contractUtils.d.ts +2 -0
- package/dist/contractUtils.d.ts.map +1 -1
- package/dist/customChains.d.ts +24 -0
- package/dist/customChains.d.ts.map +1 -0
- package/dist/gasless.d.ts +19 -7
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-CnUM7lKf.js → index-WpIVoh3X.js} +36741 -31761
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +405 -394
- package/dist/indexerClient.d.ts +10 -0
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/intentEntrypoint.d.ts +122 -0
- package/dist/intentEntrypoint.d.ts.map +1 -0
- package/dist/intents.d.ts +5 -3
- package/dist/intents.d.ts.map +1 -1
- package/dist/metaTxnMonitor.d.ts.map +1 -1
- package/dist/morpho.d.ts.map +1 -1
- package/dist/pools.d.ts +3 -1
- package/dist/pools.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +18 -9
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +1 -1
- package/dist/prices.d.ts.map +1 -1
- package/dist/relaySdk.d.ts.map +1 -1
- package/dist/relayer.d.ts.map +1 -1
- package/dist/toast.d.ts +9 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/tokenBalances.d.ts +6 -2
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +6 -5
- package/dist/trails.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +12 -0
- package/dist/trailsClient.d.ts.map +1 -0
- package/dist/trailsRouter.d.ts +22 -0
- package/dist/trailsRouter.d.ts.map +1 -0
- package/dist/transactions.d.ts +8 -1
- package/dist/transactions.d.ts.map +1 -1
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/AccountSettings.d.ts +7 -0
- package/dist/widget/components/AccountSettings.d.ts.map +1 -0
- package/dist/widget/components/ChainList.d.ts +0 -1
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +46 -0
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -0
- package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts +9 -0
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -0
- package/dist/widget/components/DebugMenu.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
- package/dist/widget/components/DebugToast.d.ts +3 -0
- package/dist/widget/components/DebugToast.d.ts.map +1 -0
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.d.ts +22 -0
- package/dist/widget/components/FeeOption.d.ts.map +1 -0
- package/dist/widget/components/FeeOptions.d.ts +13 -17
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +44 -0
- package/dist/widget/components/Fund.d.ts.map +1 -0
- package/dist/widget/components/FundMethods.d.ts +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundSendForm.d.ts.map +1 -1
- package/dist/widget/components/Identicon.d.ts +9 -0
- package/dist/widget/components/Identicon.d.ts.map +1 -0
- package/dist/widget/components/MeshConnectExchanges.d.ts +5 -2
- package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
- package/dist/widget/components/MeshConnectFlow.d.ts +2 -0
- package/dist/widget/components/MeshConnectFlow.d.ts.map +1 -1
- package/dist/widget/components/NativeGasOption.d.ts +12 -0
- package/dist/widget/components/NativeGasOption.d.ts.map +1 -0
- package/dist/widget/components/Pay.d.ts +46 -0
- package/dist/widget/components/Pay.d.ts.map +1 -0
- package/dist/widget/components/PaySendForm.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receive.d.ts.map +1 -1
- package/dist/widget/components/RecentTokens.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts +9 -0
- package/dist/widget/components/Recipients.d.ts.map +1 -0
- package/dist/widget/components/RefundWarning.d.ts +9 -0
- package/dist/widget/components/RefundWarning.d.ts.map +1 -0
- package/dist/widget/components/SimpleSwap.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/SwapSettings.d.ts +1 -5
- package/dist/widget/components/SwapSettings.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/ThemeSyncer.d.ts +6 -0
- package/dist/widget/components/ThemeSyncer.d.ts.map +1 -0
- package/dist/widget/components/Toast.d.ts +24 -0
- package/dist/widget/components/Toast.d.ts.map +1 -0
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TruncatedAddress.d.ts +2 -0
- package/dist/widget/components/TruncatedAddress.d.ts.map +1 -1
- package/dist/widget/components/UserPreferences.d.ts +7 -0
- package/dist/widget/components/UserPreferences.d.ts.map +1 -0
- package/dist/widget/hooks/useBack.d.ts +2 -0
- package/dist/widget/hooks/useBack.d.ts.map +1 -1
- package/dist/widget/hooks/useBalanceVisible.d.ts +1 -0
- package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts +54 -0
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -0
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/usePayMessage.d.ts +34 -0
- package/dist/widget/hooks/usePayMessage.d.ts.map +1 -0
- package/dist/widget/hooks/useRecipients.d.ts +17 -0
- package/dist/widget/hooks/useRecipients.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts +32 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts +14 -0
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts +12 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +10 -13
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts +13 -0
- package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -0
- package/dist/widget/hooks/useSwapSettings.d.ts +16 -0
- package/dist/widget/hooks/useSwapSettings.d.ts.map +1 -0
- package/dist/widget/hooks/useTargetAmount.d.ts +5 -0
- package/dist/widget/hooks/useTargetAmount.d.ts.map +1 -0
- package/dist/widget/hooks/useTheme.d.ts +14 -0
- package/dist/widget/hooks/useTheme.d.ts.map +1 -0
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.js +2 -2
- package/dist/widget/widget.d.ts +9 -0
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +38 -36
- package/src/aave.ts +6 -1
- package/src/analytics.ts +109 -53
- package/src/apiClient.ts +1 -1
- package/src/cctp.ts +6 -2
- package/src/cctpqueue.ts +7 -7
- package/src/chains.ts +18 -0
- package/src/config.ts +63 -17
- package/src/constants.ts +20 -16
- package/src/contractUtils.ts +33 -2
- package/src/customChains.ts +24 -0
- package/src/gasless.ts +162 -109
- package/src/index.ts +11 -1
- package/src/indexerClient.ts +73 -1
- package/src/intentEntrypoint.ts +218 -0
- package/src/intents.ts +85 -54
- package/src/metaTxnMonitor.ts +1 -0
- package/src/morpho.ts +13 -2
- package/src/pools.ts +68 -86
- package/src/prepareSend.ts +1719 -967
- package/src/prices.ts +51 -7
- package/src/relaySdk.ts +6 -4
- package/src/relayer.ts +6 -3
- package/src/toast.ts +110 -0
- package/src/tokenBalances.ts +112 -20
- package/src/tokens.ts +70 -7
- package/src/trails.ts +81 -80
- package/src/trailsClient.ts +48 -0
- package/src/{proxyCaller.ts → trailsRouter.ts} +25 -20
- package/src/transactions.ts +30 -88
- package/src/umd.tsx +1 -1
- package/src/wallets.ts +2 -1
- package/src/widget/assets/sequence-logo.svg +15 -0
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/AccountActionsDropdown.tsx +18 -159
- package/src/widget/components/AccountIntentTransactionHistory.tsx +346 -63
- package/src/widget/components/AccountSettings.tsx +102 -0
- package/src/widget/components/ChainFilterDropdown.tsx +1 -1
- package/src/widget/components/ChainList.tsx +10 -20
- package/src/widget/components/ClassicSwap.tsx +921 -0
- package/src/widget/components/ConfigDisplay.tsx +41 -5
- package/src/widget/components/ConnectWallet.tsx +168 -11
- package/src/widget/components/ConnectedWallets.tsx +342 -0
- package/src/widget/components/DebugMenu.tsx +2 -0
- package/src/widget/components/DebugScreensList.tsx +3 -0
- package/src/widget/components/DebugToast.tsx +63 -0
- package/src/widget/components/Earn.tsx +112 -143
- package/src/widget/components/EarnPools.tsx +2 -4
- package/src/widget/components/EarnPoolsFilters.tsx +6 -6
- package/src/widget/components/FeeOption.tsx +78 -0
- package/src/widget/components/FeeOptions.tsx +192 -127
- package/src/widget/components/Fund.tsx +1236 -0
- package/src/widget/components/FundMethods.tsx +4 -4
- package/src/widget/components/FundSendForm.tsx +1 -34
- package/src/widget/components/Identicon.tsx +158 -0
- package/src/widget/components/MeshConnectExchanges.tsx +32 -3
- package/src/widget/components/MeshConnectFlow.tsx +23 -4
- package/src/widget/components/NativeGasOption.tsx +99 -0
- package/src/widget/components/Pay.tsx +1092 -0
- package/src/widget/components/PaySendForm.tsx +1 -38
- package/src/widget/components/QuoteDetails.tsx +1 -30
- package/src/widget/components/Receipt.tsx +1 -1
- package/src/widget/components/Receive.tsx +4 -2
- package/src/widget/components/RecentTokens.tsx +2 -1
- package/src/widget/components/Recipients.tsx +448 -0
- package/src/widget/components/RefundWarning.tsx +61 -0
- package/src/widget/components/ScreenHeader.tsx +1 -1
- package/src/widget/components/SimpleSwap.tsx +74 -58
- package/src/widget/components/Swap.tsx +35 -853
- package/src/widget/components/SwapSettings.tsx +5 -11
- package/src/widget/components/ThemeProvider.tsx +32 -0
- package/src/widget/components/ThemeSyncer.tsx +47 -0
- package/src/widget/components/Toast.tsx +315 -0
- package/src/widget/components/TokenList.tsx +2 -34
- package/src/widget/components/TokenSelector.tsx +14 -3
- package/src/widget/components/TransactionDetails.tsx +153 -13
- package/src/widget/components/TransferPendingVertical.tsx +1 -1
- package/src/widget/components/TruncatedAddress.tsx +5 -1
- package/src/widget/components/UserPreferences.tsx +155 -0
- package/src/widget/components/WalletList.tsx +1 -1
- package/src/widget/hooks/useBack.tsx +4 -0
- package/src/widget/hooks/useBalanceVisible.tsx +40 -2
- package/src/widget/hooks/useCheckout.ts +13 -0
- package/src/widget/hooks/useCurrentScreen.tsx +4 -0
- package/src/widget/hooks/useDebugScreens.ts +12 -2
- package/src/widget/hooks/useDefaultTokenSelection.tsx +471 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +212 -0
- package/src/widget/hooks/usePayMessage.tsx +370 -0
- package/src/widget/hooks/useRecipients.ts +168 -0
- package/src/widget/hooks/useSelectedFeeToken.tsx +299 -0
- package/src/widget/hooks/useSelectedMeshExchange.tsx +46 -0
- package/src/widget/hooks/useSelectedRecipient.tsx +48 -0
- package/src/widget/hooks/useSendForm.ts +257 -49
- package/src/widget/hooks/useSwapAmount.tsx +50 -0
- package/src/widget/hooks/useSwapSettings.tsx +100 -0
- package/src/widget/hooks/useTargetAmount.ts +23 -0
- package/src/widget/hooks/useTheme.tsx +80 -0
- package/src/widget/hooks/useTokenList.ts +20 -11
- package/src/widget/index.css +45 -21
- package/src/widget/widget.tsx +294 -136
- package/dist/address.d.ts +0 -2
- package/dist/address.d.ts.map +0 -1
- package/dist/proxyCaller.d.ts +0 -21
- package/dist/proxyCaller.d.ts.map +0 -1
- package/src/address.ts +0 -6
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
useContext,
|
|
4
|
+
useState,
|
|
5
|
+
useCallback,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
} from "react"
|
|
8
|
+
import { logger } from "../../logger.js"
|
|
9
|
+
|
|
10
|
+
type Theme = "auto" | "light" | "dark"
|
|
11
|
+
|
|
12
|
+
interface ThemeContextType {
|
|
13
|
+
selectedTheme: Theme | null
|
|
14
|
+
setSelectedTheme: (theme: Theme) => void
|
|
15
|
+
resetThemePreference: () => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ThemeContext = createContext<ThemeContextType | undefined>(undefined)
|
|
19
|
+
|
|
20
|
+
interface ThemeProviderProps {
|
|
21
|
+
children: ReactNode
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const THEME_KEY = "trails-theme"
|
|
25
|
+
|
|
26
|
+
export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
|
|
27
|
+
// Initialize state from localStorage or return null if no preference is stored
|
|
28
|
+
const [selectedTheme, setSelectedThemeState] = useState<Theme | null>(() => {
|
|
29
|
+
try {
|
|
30
|
+
const stored = localStorage.getItem(THEME_KEY)
|
|
31
|
+
if (stored && ["auto", "light", "dark"].includes(stored)) {
|
|
32
|
+
return stored as Theme
|
|
33
|
+
}
|
|
34
|
+
return null // No user preference stored
|
|
35
|
+
} catch (error) {
|
|
36
|
+
logger.console.warn("Failed to read theme from localStorage:", error)
|
|
37
|
+
return null
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
// Function that updates state and saves to localStorage
|
|
42
|
+
const setSelectedTheme = useCallback((theme: Theme) => {
|
|
43
|
+
setSelectedThemeState(theme)
|
|
44
|
+
try {
|
|
45
|
+
localStorage.setItem(THEME_KEY, theme)
|
|
46
|
+
} catch (error) {
|
|
47
|
+
logger.console.warn("Failed to save theme to localStorage:", error)
|
|
48
|
+
}
|
|
49
|
+
}, [])
|
|
50
|
+
|
|
51
|
+
const resetThemePreference = useCallback(() => {
|
|
52
|
+
try {
|
|
53
|
+
localStorage.removeItem(THEME_KEY)
|
|
54
|
+
setSelectedThemeState(null) // Clear user preference
|
|
55
|
+
} catch (error) {
|
|
56
|
+
logger.console.warn("Failed to reset theme preference:", error)
|
|
57
|
+
setSelectedThemeState(null) // Still reset state even if localStorage fails
|
|
58
|
+
}
|
|
59
|
+
}, [])
|
|
60
|
+
|
|
61
|
+
const value: ThemeContextType = {
|
|
62
|
+
selectedTheme,
|
|
63
|
+
setSelectedTheme,
|
|
64
|
+
resetThemePreference,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const useThemePreference = (): ThemeContextType => {
|
|
71
|
+
const context = useContext(ThemeContext)
|
|
72
|
+
|
|
73
|
+
if (context === undefined) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
"useThemePreference must be used within a ThemePreferenceProvider",
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return context
|
|
80
|
+
}
|
|
@@ -310,9 +310,14 @@ export function useTokenList({
|
|
|
310
310
|
}, [balanceError, onError])
|
|
311
311
|
|
|
312
312
|
const handleTokenSelect = (token: TokenFormatted) => {
|
|
313
|
-
const isNative =
|
|
313
|
+
const isNative =
|
|
314
|
+
!("contractAddress" in token) || token.contractAddress === zeroAddress
|
|
314
315
|
const chainInfo = getChainInfo(token.chainId)
|
|
315
316
|
const imageUrl = token.imageUrl
|
|
317
|
+
const decimals = isNative ? 18 : token.contractInfo?.decimals
|
|
318
|
+
if (!decimals) {
|
|
319
|
+
throw new Error("Decimals not found")
|
|
320
|
+
}
|
|
316
321
|
|
|
317
322
|
let formattedToken: Token
|
|
318
323
|
if (isNative) {
|
|
@@ -328,7 +333,7 @@ export function useTokenList({
|
|
|
328
333
|
(token as TokenBalanceExtended).balanceUsdFormatted ?? "",
|
|
329
334
|
tokenPriceUsd: (token as TokenBalanceExtended).price?.value ?? 0,
|
|
330
335
|
contractInfo: {
|
|
331
|
-
decimals
|
|
336
|
+
decimals,
|
|
332
337
|
symbol: chainInfo?.nativeCurrency.symbol || "ETH",
|
|
333
338
|
name: chainInfo?.nativeCurrency.name || "Native Token",
|
|
334
339
|
},
|
|
@@ -346,7 +351,7 @@ export function useTokenList({
|
|
|
346
351
|
...token.contractInfo,
|
|
347
352
|
name: token.contractInfo?.name ?? "Unknown Token",
|
|
348
353
|
symbol: token.contractInfo?.symbol ?? "???",
|
|
349
|
-
decimals
|
|
354
|
+
decimals,
|
|
350
355
|
},
|
|
351
356
|
balanceUsdFormatted: token.balanceUsdFormatted ?? "",
|
|
352
357
|
tokenPriceUsd: token.price?.value ?? 0,
|
|
@@ -373,7 +378,8 @@ export function useTokenList({
|
|
|
373
378
|
const isTokenSelected = (token: TokenBalanceExtended): boolean => {
|
|
374
379
|
if (!selectedToken) return false
|
|
375
380
|
|
|
376
|
-
const isNative =
|
|
381
|
+
const isNative =
|
|
382
|
+
!("contractAddress" in token) || token.contractAddress === zeroAddress
|
|
377
383
|
return (
|
|
378
384
|
selectedToken.chainId === token.chainId &&
|
|
379
385
|
(isNative
|
|
@@ -395,7 +401,8 @@ export function useTokenList({
|
|
|
395
401
|
|
|
396
402
|
const matchingTokens = sortedTokens.filter(
|
|
397
403
|
(token: TokenBalanceExtended) => {
|
|
398
|
-
const isNative =
|
|
404
|
+
const isNative =
|
|
405
|
+
!("contractAddress" in token) || token.contractAddress === zeroAddress
|
|
399
406
|
const chainInfo = getChainInfo(token.chainId)
|
|
400
407
|
const chainName = chainInfo?.name || ""
|
|
401
408
|
const chainNameLower = chainName.toLowerCase()
|
|
@@ -506,7 +513,8 @@ export function useTokenList({
|
|
|
506
513
|
// Get base formatted tokens
|
|
507
514
|
const baseFormattedTokens = filteredTokens.map(
|
|
508
515
|
(token: TokenBalanceExtended): TokenFormatted => {
|
|
509
|
-
const isNative =
|
|
516
|
+
const isNative =
|
|
517
|
+
!("contractAddress" in token) || token.contractAddress === zeroAddress
|
|
510
518
|
const chainInfo = getChainInfo(token.chainId)
|
|
511
519
|
const nativeSymbol = chainInfo?.nativeCurrency.symbol || "ETH"
|
|
512
520
|
const tokenSymbol = isNative
|
|
@@ -525,13 +533,14 @@ export function useTokenList({
|
|
|
525
533
|
tokenSymbol,
|
|
526
534
|
token.chainId,
|
|
527
535
|
)
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
536
|
+
const decimals = isNative ? 18 : token.contractInfo?.decimals
|
|
537
|
+
if (!decimals) {
|
|
538
|
+
throw new Error("Decimals not found")
|
|
539
|
+
}
|
|
540
|
+
const formattedBalance = formatRawAmount(token.balance, decimals)
|
|
532
541
|
const priceUsd = Number(token.price?.value) ?? 0
|
|
533
542
|
const balanceUsdFormatted = token.balanceUsdFormatted ?? ""
|
|
534
|
-
|
|
543
|
+
|
|
535
544
|
let isSufficientBalance = true
|
|
536
545
|
if (targetAmountUsd) {
|
|
537
546
|
isSufficientBalance = (token.balanceUsd ?? 0) >= targetAmountUsd
|
package/src/widget/index.css
CHANGED
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
--trails-widget-border: 1px solid rgb(229 231 235); /* Default widget border */
|
|
30
30
|
|
|
31
31
|
/* Primary Colors - These apply to both themes */
|
|
32
|
-
--trails-primary: rgb(
|
|
33
|
-
--trails-primary-hover: rgb(
|
|
34
|
-
--trails-primary-disabled: rgb(
|
|
32
|
+
--trails-primary: rgb(21 93 252); /* #155DFC - Change this to customize */
|
|
33
|
+
--trails-primary-hover: rgb(17 75 202); /* Darker shade of #155DFC - Change this for hover state */
|
|
34
|
+
--trails-primary-disabled: rgb(212 212 216); /* #D4D4D8 - Disabled state */
|
|
35
35
|
--trails-primary-disabled-text: rgb(107 114 128); /* gray-500 - Disabled text */
|
|
36
36
|
|
|
37
37
|
/* Modal Button Colors - Customizable modal trigger button */
|
|
38
|
-
--trails-modal-button-bg: var(--trails-primary, rgb(
|
|
39
|
-
--trails-modal-button-hover-bg: var(--trails-primary-hover, rgb(
|
|
38
|
+
--trails-modal-button-bg: var(--trails-primary, rgb(21 93 252)); /* Defaults to primary color */
|
|
39
|
+
--trails-modal-button-hover-bg: var(--trails-primary-hover, rgb(17 75 202)); /* Defaults to primary hover */
|
|
40
40
|
--trails-modal-button-text: rgb(255 255 255); /* white text */
|
|
41
41
|
--trails-modal-button-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); /* subtle shadow */
|
|
42
42
|
}
|
|
@@ -50,6 +50,14 @@
|
|
|
50
50
|
background-color: var(--trails-bg-secondary);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
.trails-bg-secondary-hover:hover {
|
|
54
|
+
background-color: var(--trails-bg-secondary-hover);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.trails-focus-border-secondary:focus-within {
|
|
58
|
+
border-color: var(--trails-bg-secondary-focus-border);
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
.trails-bg-tertiary {
|
|
54
62
|
background-color: var(--trails-bg-tertiary);
|
|
55
63
|
}
|
|
@@ -184,10 +192,18 @@
|
|
|
184
192
|
background-color: var(--trails-dropdown-hover-bg);
|
|
185
193
|
}
|
|
186
194
|
|
|
195
|
+
.trails-list-item {
|
|
196
|
+
background-color: var(--trails-list-item-bg);
|
|
197
|
+
}
|
|
198
|
+
|
|
187
199
|
.trails-list-item:hover {
|
|
188
200
|
background-color: var(--trails-list-hover-bg);
|
|
189
201
|
}
|
|
190
202
|
|
|
203
|
+
.trails-list-item-selected {
|
|
204
|
+
background-color: var(--trails-list-item-selected-bg);
|
|
205
|
+
}
|
|
206
|
+
|
|
191
207
|
/* Token List Utility Classes */
|
|
192
208
|
.trails-list {
|
|
193
209
|
background-color: var(--trails-list-bg);
|
|
@@ -207,7 +223,9 @@
|
|
|
207
223
|
[data-theme="light"] {
|
|
208
224
|
/* Background Colors */
|
|
209
225
|
--trails-bg-primary: rgb(255 255 255); /* white */
|
|
210
|
-
--trails-bg-secondary: rgb(
|
|
226
|
+
--trails-bg-secondary: rgb(244 244 245); /* #F4F4F5 */
|
|
227
|
+
--trails-bg-secondary-hover: rgb(228 228 231); /* #E4E4E7 */
|
|
228
|
+
--trails-bg-secondary-focus-border: rgb(244 244 245); /* #F4F4F5 - same as secondary bg */
|
|
211
229
|
--trails-bg-tertiary: rgb(243 244 246); /* gray-100 */
|
|
212
230
|
--trails-bg-card: rgb(255 255 255); /* white */
|
|
213
231
|
--trails-bg-overlay: rgb(255 255 255); /* white */
|
|
@@ -233,7 +251,7 @@
|
|
|
233
251
|
--trails-input-border: rgb(209 213 219); /* gray-300 */
|
|
234
252
|
--trails-input-text: rgb(17 24 39); /* gray-900 */
|
|
235
253
|
--trails-input-placeholder: rgb(156 163 175); /* gray-400 */
|
|
236
|
-
--trails-input-focus-border: rgb(
|
|
254
|
+
--trails-input-focus-border: rgb(21 93 252); /* #155DFC */
|
|
237
255
|
|
|
238
256
|
/* Dropdown Colors */
|
|
239
257
|
--trails-dropdown-bg: rgb(255 255 255); /* white */
|
|
@@ -242,18 +260,20 @@
|
|
|
242
260
|
--trails-dropdown-hover-bg: rgb(249 250 251); /* gray-50 */
|
|
243
261
|
--trails-dropdown-selected-bg: rgb(243 244 246); /* gray-100 */
|
|
244
262
|
--trails-dropdown-selected-text: rgb(17 24 39); /* gray-900 */
|
|
245
|
-
--trails-dropdown-focus-border: rgb(
|
|
263
|
+
--trails-dropdown-focus-border: rgb(21 93 252); /* #155DFC - matches input focus border */
|
|
246
264
|
|
|
247
265
|
/* Modal Button Colors - Light Mode */
|
|
248
|
-
--trails-modal-button-bg: var(--trails-primary, rgb(
|
|
249
|
-
--trails-modal-button-hover-bg: var(--trails-primary-hover, rgb(
|
|
266
|
+
--trails-modal-button-bg: var(--trails-primary, rgb(21 93 252)); /* #155DFC for light mode */
|
|
267
|
+
--trails-modal-button-hover-bg: var(--trails-primary-hover, rgb(17 75 202)); /* Darker shade of #155DFC for light mode */
|
|
250
268
|
--trails-modal-button-text: rgb(255 255 255); /* white text */
|
|
251
269
|
--trails-modal-button-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); /* subtle shadow for light mode */
|
|
252
270
|
|
|
253
271
|
/* Token List Colors */
|
|
254
272
|
--trails-list-bg: rgb(255 255 255); /* white background for token list */
|
|
255
273
|
--trails-list-border: rgb(229 231 235); /* gray-200 border */
|
|
256
|
-
--trails-list-hover-bg: rgb(
|
|
274
|
+
--trails-list-hover-bg: rgb(250 250 250); /* #FAFAFA hover */
|
|
275
|
+
--trails-list-item-bg: transparent; /* transparent background for list items */
|
|
276
|
+
--trails-list-item-selected-bg: rgb(239 246 255); /* #EFF6FF selected */
|
|
257
277
|
|
|
258
278
|
/* Widget Border - Customizable widget border */
|
|
259
279
|
--trails-widget-border: none; /* Default widget border */
|
|
@@ -291,6 +311,8 @@
|
|
|
291
311
|
/* Background Colors */
|
|
292
312
|
--trails-bg-primary: rgb(17 24 39); /* gray-900 */
|
|
293
313
|
--trails-bg-secondary: rgb(31 41 55); /* gray-800 */
|
|
314
|
+
--trails-bg-secondary-hover: rgb(55 65 81); /* gray-700 */
|
|
315
|
+
--trails-bg-secondary-focus-border: rgb(31 41 55); /* gray-800 - same as secondary bg */
|
|
294
316
|
--trails-bg-tertiary: rgb(55 65 81); /* gray-700 */
|
|
295
317
|
--trails-bg-card: rgb(31 41 55); /* gray-800 */
|
|
296
318
|
--trails-bg-overlay: rgb(17 24 39); /* gray-900 */
|
|
@@ -316,7 +338,7 @@
|
|
|
316
338
|
--trails-input-border: rgb(75 85 99); /* gray-600 */
|
|
317
339
|
--trails-input-text: rgb(255 255 255); /* white */
|
|
318
340
|
--trails-input-placeholder: rgb(107 114 128); /* gray-500 */
|
|
319
|
-
--trails-input-focus-border: rgb(
|
|
341
|
+
--trails-input-focus-border: rgb(21 93 252); /* #155DFC */
|
|
320
342
|
|
|
321
343
|
/* Dropdown Colors */
|
|
322
344
|
--trails-dropdown-bg: rgb(31 41 55); /* gray-800 */
|
|
@@ -325,11 +347,11 @@
|
|
|
325
347
|
--trails-dropdown-hover-bg: rgb(55 65 81); /* gray-700 */
|
|
326
348
|
--trails-dropdown-selected-bg: rgb(55 65 81); /* gray-700 */
|
|
327
349
|
--trails-dropdown-selected-text: rgb(255 255 255); /* white */
|
|
328
|
-
--trails-dropdown-focus-border: rgb(
|
|
350
|
+
--trails-dropdown-focus-border: rgb(21 93 252); /* #155DFC - matches input focus border */
|
|
329
351
|
|
|
330
352
|
/* Modal Button Colors - Dark Mode */
|
|
331
|
-
--trails-modal-button-bg: var(--trails-primary, rgb(
|
|
332
|
-
--trails-modal-button-hover-bg: var(--trails-primary-hover, rgb(
|
|
353
|
+
--trails-modal-button-bg: var(--trails-primary, rgb(21 93 252)); /* #155DFC for dark mode */
|
|
354
|
+
--trails-modal-button-hover-bg: var(--trails-primary-hover, rgb(17 75 202)); /* Darker shade of #155DFC for dark mode */
|
|
333
355
|
--trails-modal-button-text: rgb(255 255 255); /* white text */
|
|
334
356
|
--trails-modal-button-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.1); /* subtle shadow for dark mode */
|
|
335
357
|
|
|
@@ -337,6 +359,8 @@
|
|
|
337
359
|
--trails-list-bg: rgb(31 41 55); /* gray-800 background for token list */
|
|
338
360
|
--trails-list-border: rgb(55 65 81); /* gray-700 border - good balance */
|
|
339
361
|
--trails-list-hover-bg: rgb(55 65 81); /* gray-700 hover */
|
|
362
|
+
--trails-list-item-bg: transparent; /* transparent background for list items */
|
|
363
|
+
--trails-list-item-selected-bg: rgb(30 58 138); /* blue-800 selected for dark mode */
|
|
340
364
|
|
|
341
365
|
/* Widget Border - Customizable widget border */
|
|
342
366
|
--trails-widget-border: none; /* Default widget border */
|
|
@@ -433,27 +457,27 @@
|
|
|
433
457
|
/* Primary Button Override Classes - These will override Tailwind classes */
|
|
434
458
|
/* Light mode primary button */
|
|
435
459
|
.bg-blue-500 {
|
|
436
|
-
background-color: var(--trails-primary, rgb(
|
|
460
|
+
background-color: var(--trails-primary, rgb(21 93 252));
|
|
437
461
|
}
|
|
438
462
|
|
|
439
463
|
/* Dark mode primary button */
|
|
440
464
|
.dark .bg-blue-500 {
|
|
441
|
-
background-color: var(--trails-primary, rgb(
|
|
465
|
+
background-color: var(--trails-primary, rgb(21 93 252)); /* #155DFC for dark mode */
|
|
442
466
|
}
|
|
443
467
|
|
|
444
468
|
/* Light mode hover */
|
|
445
469
|
.hover\:bg-blue-600:hover {
|
|
446
|
-
background-color: var(--trails-primary-hover, rgb(
|
|
470
|
+
background-color: var(--trails-primary-hover, rgb(17 75 202));
|
|
447
471
|
}
|
|
448
472
|
|
|
449
473
|
/* Dark mode hover */
|
|
450
474
|
.dark .hover\:bg-blue-600:hover {
|
|
451
|
-
background-color: var(--trails-primary-hover, rgb(
|
|
475
|
+
background-color: var(--trails-primary-hover, rgb(17 75 202)); /* Darker shade of #155DFC for dark mode */
|
|
452
476
|
}
|
|
453
477
|
|
|
454
478
|
/* Light mode disabled background */
|
|
455
479
|
.disabled\:bg-gray-300:disabled {
|
|
456
|
-
background-color: var(--trails-primary-disabled, rgb(
|
|
480
|
+
background-color: var(--trails-primary-disabled, rgb(212 212 216));
|
|
457
481
|
}
|
|
458
482
|
|
|
459
483
|
/* Dark mode disabled background */
|
|
@@ -484,7 +508,7 @@
|
|
|
484
508
|
}
|
|
485
509
|
|
|
486
510
|
.trails-btn-primary:disabled {
|
|
487
|
-
background-color: var(--trails-primary-disabled, rgb(
|
|
511
|
+
background-color: var(--trails-primary-disabled, rgb(212 212 216));
|
|
488
512
|
color: var(--trails-primary-disabled-text, rgb(107 114 128));
|
|
489
513
|
cursor: not-allowed;
|
|
490
514
|
}
|