0xtrails 0.6.6 → 0.7.0
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 +10 -2
- package/dist/aave.d.ts.map +1 -1
- package/dist/analytics.d.ts +26 -0
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-CbJrlK-L.js → ccip-fConRNoG.js} +21 -21
- package/dist/chains.d.ts +23 -8
- package/dist/chains.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -5
- package/dist/constants.d.ts.map +1 -1
- package/dist/customTokens.d.ts +12 -0
- package/dist/customTokens.d.ts.map +1 -0
- package/dist/decoders.d.ts +2 -2
- package/dist/decoders.d.ts.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/fees.d.ts +37 -2
- package/dist/fees.d.ts.map +1 -1
- package/dist/gasless.d.ts +15 -36
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-w7_dK4c5.js → index-BbajxCG_.js} +59269 -77146
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +828 -359
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/intentReceiptMonitor.d.ts +1 -1
- package/dist/intentReceiptMonitor.d.ts.map +1 -1
- package/dist/intentReceiptPoller.d.ts +1 -1
- package/dist/intentReceiptPoller.d.ts.map +1 -1
- package/dist/intents.d.ts +3 -2
- package/dist/intents.d.ts.map +1 -1
- package/dist/mode.d.ts +1 -1
- package/dist/mode.d.ts.map +1 -1
- package/dist/mutations.d.ts +2 -2
- package/dist/mutations.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +2 -2
- 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/sequenceWallet.d.ts +2 -2
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/time.d.ts +6 -0
- package/dist/time.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +40 -25
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +54 -14
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +1 -1
- package/dist/trailsClient.d.ts.map +1 -1
- package/dist/trailsRouter.d.ts +2 -1
- package/dist/trailsRouter.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +3 -2
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/execution/transactionState.d.ts +1 -1
- package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +5 -3
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +5 -3
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/feeExtractors.d.ts +1 -6
- package/dist/transactionIntent/quote/feeExtractors.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +4 -2
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +28 -5
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/utils/testnetHelpers.d.ts +0 -1
- package/dist/transactionIntent/utils/testnetHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/validators.d.ts +0 -2
- package/dist/transactionIntent/validators.d.ts.map +1 -1
- package/dist/transactions.d.ts +2 -2
- package/dist/transactions.d.ts.map +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/wallets.d.ts +1 -0
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/AddressWalletIcon.d.ts +6 -0
- package/dist/widget/components/AddressWalletIcon.d.ts.map +1 -0
- package/dist/widget/components/ChainFilterDropdown.d.ts +2 -6
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ChainImage.d.ts.map +1 -1
- package/dist/widget/components/ChainList.d.ts +0 -5
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +6 -6
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/DebugMenu.d.ts +1 -1
- package/dist/widget/components/DebugMenu.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
- package/dist/widget/components/DepositTracker.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts +5 -5
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.d.ts +1 -1
- package/dist/widget/components/FeeOption.d.ts.map +1 -1
- package/dist/widget/components/FeeOptions.d.ts +2 -2
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/Footer.d.ts +1 -1
- package/dist/widget/components/Footer.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +5 -5
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts +0 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundSwap.d.ts +6 -6
- package/dist/widget/components/FundSwap.d.ts.map +1 -1
- package/dist/widget/components/HookModalContent.d.ts +8 -0
- package/dist/widget/components/HookModalContent.d.ts.map +1 -0
- package/dist/widget/components/OriginSelectionAmount.d.ts +11 -0
- package/dist/widget/components/OriginSelectionAmount.d.ts.map +1 -0
- package/dist/widget/components/Pay.d.ts +5 -5
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +5 -5
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PoolWithdraw.d.ts +3 -3
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts +2 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/RecentTokens.d.ts +4 -4
- package/dist/widget/components/RecentTokens.d.ts.map +1 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/ShadowPortal.d.ts +6 -0
- package/dist/widget/components/ShadowPortal.d.ts.map +1 -0
- package/dist/widget/components/Swap.d.ts +6 -6
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/TokenList.d.ts +3 -4
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts +3 -4
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/Tooltip.d.ts +6 -1
- package/dist/widget/components/Tooltip.d.ts.map +1 -1
- package/dist/widget/components/TrailsHookModal.d.ts +10 -0
- package/dist/widget/components/TrailsHookModal.d.ts.map +1 -0
- package/dist/widget/components/WaasFeeOptions.d.ts +3 -0
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WidgetProviders.d.ts +14 -0
- package/dist/widget/components/WidgetProviders.d.ts.map +1 -0
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useAddressWalletIcon.d.ts +10 -0
- package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +1 -0
- package/dist/widget/hooks/useBalanceVisible.d.ts +1 -1
- package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
- package/dist/widget/hooks/useChainFilter.d.ts +1 -1
- package/dist/widget/hooks/useChainFilter.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts +13 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useConnector.d.ts +4 -0
- package/dist/widget/hooks/useConnector.d.ts.map +1 -0
- package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
- package/dist/widget/hooks/useCustomTokenFetch.d.ts +19 -0
- package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +1 -0
- package/dist/widget/hooks/useCustomTokenSearch.d.ts +20 -0
- package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -0
- package/dist/widget/hooks/useDebounce.d.ts +10 -0
- package/dist/widget/hooks/useDebounce.d.ts.map +1 -0
- package/dist/widget/hooks/useDebugScreens.d.ts +7 -2
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts +3 -19
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useDestinationSelectedToken.d.ts +1 -14
- package/dist/widget/hooks/useDestinationSelectedToken.d.ts.map +1 -1
- package/dist/widget/hooks/useEarnPool.d.ts +1 -1
- package/dist/widget/hooks/useEarnPool.d.ts.map +1 -1
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useIsMobile.d.ts +5 -0
- package/dist/widget/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/widget/hooks/useMode.d.ts +2 -2
- package/dist/widget/hooks/useMode.d.ts.map +1 -1
- package/dist/widget/hooks/useOriginSelectedToken.d.ts +2 -15
- package/dist/widget/hooks/useOriginSelectedToken.d.ts.map +1 -1
- package/dist/widget/hooks/usePayMessage.d.ts.map +1 -1
- package/dist/widget/hooks/usePriceImpactWarning.d.ts +1 -1
- package/dist/widget/hooks/usePriceImpactWarning.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +173 -4
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useRecentTokens.d.ts +3 -3
- package/dist/widget/hooks/useRecentTokens.d.ts.map +1 -1
- package/dist/widget/hooks/useRecipients.d.ts +1 -1
- package/dist/widget/hooks/useRecipients.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFeeOption.d.ts +2 -2
- package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedRecipient.d.ts +1 -1
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +9 -31
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -1
- package/dist/widget/hooks/useTheme.d.ts +1 -1
- package/dist/widget/hooks/useTheme.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +7 -31
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts +83 -0
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -0
- package/dist/widget/hooks/useWalletConnectUri.d.ts +11 -0
- package/dist/widget/hooks/useWalletConnectUri.d.ts.map +1 -0
- package/dist/widget/hooks/useWidgetProps.d.ts +5 -0
- package/dist/widget/hooks/useWidgetProps.d.ts.map +1 -1
- package/dist/widget/index.d.ts +2 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +8 -5
- package/dist/widget/providers/TrailsModalProvider.d.ts +65 -0
- package/dist/widget/providers/TrailsModalProvider.d.ts.map +1 -0
- package/dist/widget/providers/TrailsProvider.d.ts +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/types.d.ts +11 -18
- package/dist/widget/types.d.ts.map +1 -1
- package/dist/widget/widget.d.ts +20 -11
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +45 -49
- package/src/aave.ts +387 -138
- package/src/analytics.ts +208 -2
- package/src/chains.ts +65 -64
- package/src/constants.ts +18 -14
- package/src/customTokens.ts +151 -0
- package/src/decoders.ts +4 -7
- package/src/error.ts +7 -3
- package/src/fees.ts +239 -125
- package/src/gasless.ts +54 -108
- package/src/index.ts +29 -9
- package/src/indexerClient.ts +2 -0
- package/src/intentReceiptMonitor.ts +1 -4
- package/src/intentReceiptPoller.ts +2 -2
- package/src/intents.ts +16 -5
- package/src/mode.ts +1 -1
- package/src/mutations.ts +7 -3
- package/src/prepareSend.ts +19 -14
- package/src/prices.ts +1 -1
- package/src/sequenceWallet.ts +2 -2
- package/src/time.ts +28 -0
- package/src/tokenBalances.ts +348 -153
- package/src/tokens.ts +393 -142
- package/src/trailsClient.ts +1 -1
- package/src/trailsRouter.ts +4 -5
- package/src/transactionIntent/deposits/depositOrchestrator.ts +6 -2
- package/src/transactionIntent/deposits/gaslessDeposit.ts +13 -7
- package/src/transactionIntent/deposits/standardDeposit.ts +1 -1
- package/src/transactionIntent/execution/transactionState.ts +1 -1
- package/src/transactionIntent/handlers/crossChain.ts +75 -37
- package/src/transactionIntent/handlers/sameChainSameToken.ts +66 -20
- package/src/transactionIntent/quote/feeExtractors.ts +1 -29
- package/src/transactionIntent/quote/normalizeQuote.ts +99 -7
- package/src/transactionIntent/quote/quoteHelpers.ts +1 -1
- package/src/transactionIntent/types.ts +31 -6
- package/src/transactionIntent/utils/testnetHelpers.ts +0 -5
- package/src/transactionIntent/validators.ts +0 -30
- package/src/transactions.ts +3 -3
- package/src/utils.ts +18 -0
- package/src/wallets.ts +32 -10
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +2 -1
- package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +2 -2
- package/src/widget/components/AddressWalletIcon.tsx +29 -0
- package/src/widget/components/ChainFilterDropdown.tsx +2 -8
- package/src/widget/components/ChainImage.tsx +8 -5
- package/src/widget/components/ChainList.tsx +6 -8
- package/src/widget/components/ClassicSwap.tsx +93 -85
- package/src/widget/components/ConnectWallet.tsx +1 -2
- package/src/widget/components/ConnectedWallets.tsx +17 -4
- package/src/widget/components/DebugMenu.tsx +2 -2
- package/src/widget/components/DebugScreensList.tsx +0 -1
- package/src/widget/components/DepositTracker.tsx +20 -34
- package/src/widget/components/Earn.tsx +7 -6
- package/src/widget/components/FeeOption.tsx +4 -4
- package/src/widget/components/FeeOptions.tsx +19 -39
- package/src/widget/components/Footer.tsx +1 -1
- package/src/widget/components/Fund.tsx +23 -119
- package/src/widget/components/FundMethods.tsx +9 -6
- package/src/widget/components/FundSwap.tsx +6 -5
- package/src/widget/components/FundingMethodSelectorButton.tsx +2 -2
- package/src/widget/components/HookModalContent.tsx +306 -0
- package/src/widget/components/Modal.tsx +1 -1
- package/src/widget/components/OriginSelectionAmount.tsx +135 -0
- package/src/widget/components/Pay.tsx +66 -124
- package/src/widget/components/PoolDeposit.tsx +11 -55
- package/src/widget/components/PoolWithdraw.tsx +3 -3
- package/src/widget/components/QuoteDetails.tsx +473 -728
- package/src/widget/components/Receipt.tsx +74 -7
- package/src/widget/components/RecentTokens.tsx +8 -8
- package/src/widget/components/RecipientSelectorButton.tsx +4 -2
- package/src/widget/components/ScreenHeader.tsx +2 -2
- package/src/widget/components/SearchInputField.tsx +1 -1
- package/src/widget/components/ShadowPortal.tsx +58 -0
- package/src/widget/components/Swap.tsx +6 -5
- package/src/widget/components/ThemeProvider.tsx +1 -1
- package/src/widget/components/TokenList.tsx +3 -4
- package/src/widget/components/TokenSelector.tsx +211 -80
- package/src/widget/components/Tooltip.tsx +18 -7
- package/src/widget/components/TrailsHookModal.tsx +118 -0
- package/src/widget/components/WaasFeeOptions.tsx +333 -138
- package/src/widget/components/WalletConfirmation.tsx +7 -2
- package/src/widget/components/WalletConnect.tsx +197 -235
- package/src/widget/components/WidgetProviders.tsx +75 -0
- package/src/widget/hooks/useAddressWalletIcon.ts +53 -0
- package/src/widget/hooks/useBalanceVisible.tsx +1 -1
- package/src/widget/hooks/useChainFilter.tsx +1 -1
- package/src/widget/hooks/useCheckout.ts +13 -1
- package/src/widget/hooks/useConnector.tsx +18 -0
- package/src/widget/hooks/useCurrentScreen.tsx +3 -3
- package/src/widget/hooks/useCustomTokenFetch.tsx +72 -0
- package/src/widget/hooks/useCustomTokenSearch.tsx +402 -0
- package/src/widget/hooks/useDebounce.ts +25 -0
- package/src/widget/hooks/useDebugScreens.ts +26 -10
- package/src/widget/hooks/useDefaultTokenSelection.tsx +99 -143
- package/src/widget/hooks/useDestinationSelectedToken.tsx +1 -14
- package/src/widget/hooks/useEarnPool.tsx +1 -1
- package/src/widget/hooks/useIntentTransactionHistory.ts +20 -11
- package/src/widget/hooks/useIsMobile.tsx +50 -0
- package/src/widget/hooks/useMode.ts +2 -3
- package/src/widget/hooks/useOriginSelectedToken.tsx +2 -15
- package/src/widget/hooks/usePayMessage.tsx +31 -11
- package/src/widget/hooks/usePriceImpactWarning.ts +1 -1
- package/src/widget/hooks/useQuote.ts +189 -6
- package/src/widget/hooks/useRecentTokens.ts +6 -6
- package/src/widget/hooks/useRecipients.ts +1 -1
- package/src/widget/hooks/useSelectedFeeOption.tsx +2 -2
- package/src/widget/hooks/useSelectedFundMethod.tsx +1 -1
- package/src/widget/hooks/useSelectedRecipient.tsx +1 -1
- package/src/widget/hooks/useSendForm.ts +328 -152
- package/src/widget/hooks/useSwapAmount.tsx +1 -1
- package/src/widget/hooks/useTheme.tsx +1 -1
- package/src/widget/hooks/useTokenList.ts +672 -400
- package/src/widget/hooks/useTrailsSendTransaction.ts +949 -0
- package/src/widget/hooks/useWalletConnectUri.tsx +228 -0
- package/src/widget/hooks/useWidgetProps.tsx +3 -1
- package/src/widget/index.tsx +12 -0
- package/src/widget/providers/TrailsModalProvider.tsx +195 -0
- package/src/widget/providers/TrailsProvider.tsx +9 -3
- package/src/widget/types.ts +12 -20
- package/src/widget/widget.tsx +598 -385
- package/dist/cctp.d.ts +0 -3
- package/dist/cctp.d.ts.map +0 -1
- package/dist/lifi.d.ts +0 -4
- package/dist/lifi.d.ts.map +0 -1
- package/dist/meshconnect.d.ts +0 -171
- package/dist/meshconnect.d.ts.map +0 -1
- package/dist/relaySdk.d.ts +0 -87
- package/dist/relaySdk.d.ts.map +0 -1
- package/dist/widget/components/MeshConnectExchanges.d.ts +0 -7
- package/dist/widget/components/MeshConnectExchanges.d.ts.map +0 -1
- package/dist/widget/components/MeshConnectFlow.d.ts +0 -13
- package/dist/widget/components/MeshConnectFlow.d.ts.map +0 -1
- package/dist/widget/components/MeshConnectIframe.d.ts +0 -15
- package/dist/widget/components/MeshConnectIframe.d.ts.map +0 -1
- package/dist/widget/components/Receive.d.ts +0 -12
- package/dist/widget/components/Receive.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts +0 -14
- package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +0 -1
- package/src/cctp.ts +0 -54
- package/src/lifi.ts +0 -108
- package/src/meshconnect.ts +0 -531
- package/src/relaySdk.ts +0 -703
- package/src/widget/components/MeshConnectExchanges.tsx +0 -290
- package/src/widget/components/MeshConnectFlow.tsx +0 -90
- package/src/widget/components/MeshConnectIframe.tsx +0 -500
- package/src/widget/components/Receive.tsx +0 -175
- package/src/widget/hooks/useSelectedMeshExchange.tsx +0 -46
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { useEffect, useState } from "react"
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from "react"
|
|
2
2
|
import { useWaasFeeOptions } from "@0xsequence/connect"
|
|
3
3
|
import { TokenImage } from "./TokenImage.js"
|
|
4
4
|
import { ChevronDown, ChevronUp, Copy } from "lucide-react"
|
|
5
5
|
import { formatUnits } from "viem"
|
|
6
|
+
import { logger, type Token } from "../../index.js"
|
|
7
|
+
import { formatAmountDisplay } from "../../tokenBalances.js"
|
|
8
|
+
import Tooltip from "./Tooltip.js"
|
|
9
|
+
import { truncateAddress } from "../../utils.js"
|
|
6
10
|
|
|
7
|
-
//
|
|
8
|
-
interface
|
|
11
|
+
// WaaS-specific fee types based on the @0xsequence/connect documentation
|
|
12
|
+
interface WaasFeeToken {
|
|
9
13
|
symbol: string
|
|
10
14
|
contractAddress?: string
|
|
11
15
|
name?: string
|
|
@@ -13,20 +17,115 @@ interface FeeToken {
|
|
|
13
17
|
imageUrl?: string
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
interface
|
|
17
|
-
token:
|
|
20
|
+
interface WaasFeeOption {
|
|
21
|
+
token: WaasFeeToken
|
|
18
22
|
amount?: string
|
|
19
23
|
amountUSD?: number
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
interface
|
|
26
|
+
interface WaasFeeOptionExtended extends WaasFeeOption {
|
|
23
27
|
balance: string
|
|
24
28
|
balanceFormatted: string
|
|
25
29
|
hasEnoughBalanceForFee: boolean
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
const getTokenAddressLabel = (token?: WaasFeeToken) => {
|
|
33
|
+
if (token?.contractAddress) {
|
|
34
|
+
return truncateAddress(token.contractAddress)
|
|
35
|
+
}
|
|
36
|
+
return "Native Token"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type FeeDisplayValues = {
|
|
40
|
+
feeAmountFormatted: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface FeeOptionCardProps {
|
|
44
|
+
option: any
|
|
45
|
+
chainId?: number
|
|
46
|
+
feeDisplay: FeeDisplayValues
|
|
47
|
+
isSelected?: boolean
|
|
48
|
+
isDisabled?: boolean
|
|
49
|
+
showRadio?: boolean
|
|
50
|
+
radioName?: string
|
|
51
|
+
onSelect?: () => void
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const FeeOptionCard: React.FC<FeeOptionCardProps> = ({
|
|
55
|
+
option,
|
|
56
|
+
chainId,
|
|
57
|
+
feeDisplay,
|
|
58
|
+
isSelected = false,
|
|
59
|
+
isDisabled = false,
|
|
60
|
+
showRadio = false,
|
|
61
|
+
radioName = "feeOption",
|
|
62
|
+
onSelect,
|
|
63
|
+
}) => {
|
|
64
|
+
const handleSelect = (
|
|
65
|
+
event?:
|
|
66
|
+
| React.MouseEvent<HTMLDivElement>
|
|
67
|
+
| React.ChangeEvent<HTMLInputElement>,
|
|
68
|
+
) => {
|
|
69
|
+
event?.stopPropagation()
|
|
70
|
+
if (isDisabled) return
|
|
71
|
+
onSelect?.()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
className={`px-4 py-3 flex flex-col space-y-3 border border-gray-200 dark:border-gray-800 rounded-lg transition-all duration-200 ${
|
|
77
|
+
isDisabled
|
|
78
|
+
? "opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900/30"
|
|
79
|
+
: "bg-white dark:bg-gray-900 hover:shadow-sm"
|
|
80
|
+
}`}
|
|
81
|
+
role={showRadio ? "radio" : undefined}
|
|
82
|
+
aria-disabled={isDisabled}
|
|
83
|
+
onClick={showRadio ? handleSelect : undefined}
|
|
84
|
+
>
|
|
85
|
+
<div className="flex items-start justify-between gap-3">
|
|
86
|
+
<div className="flex items-center space-x-3">
|
|
87
|
+
<TokenImage
|
|
88
|
+
symbol={option.token.symbol}
|
|
89
|
+
imageUrl={(option.token as any).logoURL}
|
|
90
|
+
chainId={chainId}
|
|
91
|
+
size={32}
|
|
92
|
+
/>
|
|
93
|
+
<div className="ml-2 text-left">
|
|
94
|
+
<div className="text-sm font-semibold">{option.token.symbol}</div>
|
|
95
|
+
<div className="text-xs trails-text-muted">
|
|
96
|
+
{getTokenAddressLabel(option.token)}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
<div className="flex items-center space-x-3">
|
|
101
|
+
<div className="text-right">
|
|
102
|
+
<div className="text-[10px] uppercase tracking-wide trails-text-muted">
|
|
103
|
+
Fee to pay
|
|
104
|
+
</div>
|
|
105
|
+
<div className="text-base font-semibold">
|
|
106
|
+
{feeDisplay.feeAmountFormatted} {option.token.symbol}
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
{showRadio && (
|
|
110
|
+
<input
|
|
111
|
+
type="radio"
|
|
112
|
+
name={radioName}
|
|
113
|
+
checked={isSelected}
|
|
114
|
+
disabled={isDisabled}
|
|
115
|
+
onChange={handleSelect}
|
|
116
|
+
className="w-4 h-4 text-trails-primary focus:ring-trails-primary"
|
|
117
|
+
/>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
28
125
|
interface WaasFeeOptionsProps {
|
|
29
126
|
chainId?: number
|
|
127
|
+
originToken?: Token
|
|
128
|
+
originTokenAmount?: string
|
|
30
129
|
setIsFeeOptionConfirmed: (isFeeOptionConfirmed: boolean) => void
|
|
31
130
|
onFeeOptionsLoaded?: () => void
|
|
32
131
|
setIsError?: (isError: boolean) => void
|
|
@@ -34,6 +133,8 @@ interface WaasFeeOptionsProps {
|
|
|
34
133
|
|
|
35
134
|
export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
36
135
|
chainId,
|
|
136
|
+
originToken,
|
|
137
|
+
originTokenAmount,
|
|
37
138
|
setIsFeeOptionConfirmed,
|
|
38
139
|
onFeeOptionsLoaded,
|
|
39
140
|
setIsError,
|
|
@@ -51,23 +152,130 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
51
152
|
const [isLoading, setIsLoading] = useState(false)
|
|
52
153
|
const [copiedAddress, setCopiedAddress] = useState<string | null>(null)
|
|
53
154
|
|
|
155
|
+
const originTokenAddress = useMemo(
|
|
156
|
+
() => originToken?.contractAddress?.toLowerCase() || null,
|
|
157
|
+
[originToken?.contractAddress],
|
|
158
|
+
)
|
|
159
|
+
const originAmountBigInt = useMemo(() => {
|
|
160
|
+
if (!originTokenAmount) {
|
|
161
|
+
return null
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
return BigInt(originTokenAmount)
|
|
166
|
+
} catch (error) {
|
|
167
|
+
logger.console.error(
|
|
168
|
+
"[trails-sdk] Failed to parse origin token amount for fee comparison",
|
|
169
|
+
{
|
|
170
|
+
originTokenAmount,
|
|
171
|
+
error,
|
|
172
|
+
},
|
|
173
|
+
)
|
|
174
|
+
return null
|
|
175
|
+
}
|
|
176
|
+
}, [originTokenAmount])
|
|
177
|
+
|
|
178
|
+
const isFeeOptionSameAsOriginToken = useCallback(
|
|
179
|
+
(option: any) => {
|
|
180
|
+
if (!originToken || !option?.token) {
|
|
181
|
+
return false
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const optionAddress = option.token.contractAddress
|
|
185
|
+
? option.token.contractAddress.toLowerCase()
|
|
186
|
+
: null
|
|
187
|
+
|
|
188
|
+
if (originTokenAddress && optionAddress) {
|
|
189
|
+
return originTokenAddress === optionAddress
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return false
|
|
193
|
+
},
|
|
194
|
+
[originToken, originTokenAddress],
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
const isFeeOptionDisabledForOriginBalance = useCallback(
|
|
198
|
+
(option: any) => {
|
|
199
|
+
if (!originAmountBigInt || originAmountBigInt <= 0n) {
|
|
200
|
+
return false
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!isFeeOptionSameAsOriginToken(option)) {
|
|
204
|
+
return false
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (!option?.balance || !option?.value) {
|
|
208
|
+
return false
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
const optionBalance = BigInt(option.balance)
|
|
213
|
+
const optionFeeValue = BigInt(option.value)
|
|
214
|
+
const combinedRequirement = optionFeeValue + originAmountBigInt
|
|
215
|
+
|
|
216
|
+
return optionBalance < combinedRequirement
|
|
217
|
+
} catch (error) {
|
|
218
|
+
logger.console.error(
|
|
219
|
+
"[trails-sdk] Failed to compare origin amount plus fee with balance",
|
|
220
|
+
{
|
|
221
|
+
balance: option?.balance,
|
|
222
|
+
value: option?.value,
|
|
223
|
+
originAmount: originTokenAmount,
|
|
224
|
+
error,
|
|
225
|
+
},
|
|
226
|
+
)
|
|
227
|
+
return false
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
[isFeeOptionSameAsOriginToken, originAmountBigInt, originTokenAmount],
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
const getFeeDisplayValues = useCallback((option: any) => {
|
|
234
|
+
const decimals = option.token.decimals ?? 18
|
|
235
|
+
|
|
236
|
+
const rawValue = option.value ?? option.amount ?? "0"
|
|
237
|
+
|
|
238
|
+
let feeAmountFormatted = "0"
|
|
239
|
+
try {
|
|
240
|
+
const formattedUnits = formatUnits(BigInt(rawValue), decimals)
|
|
241
|
+
feeAmountFormatted = formatAmountDisplay(formattedUnits, {
|
|
242
|
+
maxFractionDigits: Math.min(decimals, 6),
|
|
243
|
+
minFractionDigits: 0,
|
|
244
|
+
})
|
|
245
|
+
} catch (error) {
|
|
246
|
+
logger.console.warn("[trails-sdk] Failed to format fee option amount", {
|
|
247
|
+
error,
|
|
248
|
+
value: rawValue,
|
|
249
|
+
decimals,
|
|
250
|
+
token: option?.token?.symbol,
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return {
|
|
255
|
+
feeAmountFormatted,
|
|
256
|
+
}
|
|
257
|
+
}, [])
|
|
258
|
+
|
|
54
259
|
// Debug logging
|
|
55
260
|
useEffect(() => {
|
|
56
|
-
console.log(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
261
|
+
logger.console.log(
|
|
262
|
+
"[trails-sdk] WaasFeeOptions component mounted/updated:",
|
|
263
|
+
{
|
|
264
|
+
chainId,
|
|
265
|
+
pendingFeeOptionConfirmation: !!pendingFeeOptionConfirmation,
|
|
266
|
+
optionsCount: pendingFeeOptionConfirmation?.options?.length || 0,
|
|
267
|
+
hasOptions: !!pendingFeeOptionConfirmation?.options,
|
|
268
|
+
confirmationId: pendingFeeOptionConfirmation?.id,
|
|
269
|
+
isLoading,
|
|
270
|
+
isProcessing,
|
|
271
|
+
},
|
|
272
|
+
)
|
|
65
273
|
}, [chainId, pendingFeeOptionConfirmation, isLoading, isProcessing])
|
|
66
274
|
|
|
67
275
|
// Log when component renders but has no pending confirmation
|
|
68
276
|
useEffect(() => {
|
|
69
277
|
if (!pendingFeeOptionConfirmation) {
|
|
70
|
-
console.log(
|
|
278
|
+
logger.console.log(
|
|
71
279
|
"[trails-sdk] WaasFeeOptions: No pending fee confirmation - this is normal until a transaction requires fee payment",
|
|
72
280
|
)
|
|
73
281
|
}
|
|
@@ -92,7 +300,7 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
92
300
|
// Initialize with first option when fee options become available
|
|
93
301
|
useEffect(() => {
|
|
94
302
|
if (pendingFeeOptionConfirmation) {
|
|
95
|
-
console.log(
|
|
303
|
+
logger.console.log(
|
|
96
304
|
"[trails-sdk] Pending fee options: ",
|
|
97
305
|
pendingFeeOptionConfirmation.options,
|
|
98
306
|
)
|
|
@@ -108,17 +316,31 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
108
316
|
onFeeOptionsLoaded()
|
|
109
317
|
}
|
|
110
318
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
319
|
+
if (
|
|
320
|
+
pendingFeeOptionConfirmation.options.length > 0 &&
|
|
321
|
+
!selectedFeeOptionTokenName
|
|
322
|
+
) {
|
|
323
|
+
const firstAvailableOption = pendingFeeOptionConfirmation.options.find(
|
|
114
324
|
(option: any) => option.hasEnoughBalanceForFee,
|
|
115
|
-
)
|
|
116
|
-
if (
|
|
117
|
-
setSelectedFeeOptionTokenName(
|
|
325
|
+
)
|
|
326
|
+
if (firstAvailableOption?.token?.symbol) {
|
|
327
|
+
setSelectedFeeOptionTokenName(firstAvailableOption.token.symbol)
|
|
118
328
|
}
|
|
119
329
|
}
|
|
120
330
|
}
|
|
121
|
-
}, [
|
|
331
|
+
}, [
|
|
332
|
+
pendingFeeOptionConfirmation,
|
|
333
|
+
onFeeOptionsLoaded,
|
|
334
|
+
selectedFeeOptionTokenName,
|
|
335
|
+
])
|
|
336
|
+
|
|
337
|
+
// Reset parent confirmation state whenever a new fee confirmation arrives
|
|
338
|
+
useEffect(() => {
|
|
339
|
+
if (pendingFeeOptionConfirmation?.id) {
|
|
340
|
+
setIsFeeOptionConfirmed(false)
|
|
341
|
+
setSelectedFeeOptionTokenName(undefined)
|
|
342
|
+
}
|
|
343
|
+
}, [pendingFeeOptionConfirmation?.id, setIsFeeOptionConfirmed])
|
|
122
344
|
|
|
123
345
|
// Handle fee option selection and confirmation
|
|
124
346
|
const handleConfirmFee = async (tokenAddress: string | null) => {
|
|
@@ -189,9 +411,17 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
189
411
|
const selectedOption = pendingFeeOptionConfirmation.options
|
|
190
412
|
.filter((option: any) => option.hasEnoughBalanceForFee)
|
|
191
413
|
.find((option) => option.token.symbol === selectedFeeOptionTokenName) as
|
|
192
|
-
|
|
|
414
|
+
| WaasFeeOptionExtended
|
|
193
415
|
| undefined
|
|
194
416
|
|
|
417
|
+
const selectedOptionDisplayValues = selectedOption
|
|
418
|
+
? getFeeDisplayValues(selectedOption)
|
|
419
|
+
: null
|
|
420
|
+
|
|
421
|
+
const shouldShowBalanceWarning = selectedOption
|
|
422
|
+
? isFeeOptionDisabledForOriginBalance(selectedOption)
|
|
423
|
+
: false
|
|
424
|
+
|
|
195
425
|
const hasTokenForFee = pendingFeeOptionConfirmation.options.find(
|
|
196
426
|
(option: any) => option.hasEnoughBalanceForFee,
|
|
197
427
|
)
|
|
@@ -319,135 +549,100 @@ export const WaasFeeOptions: React.FC<WaasFeeOptionsProps> = ({
|
|
|
319
549
|
</div>
|
|
320
550
|
|
|
321
551
|
{/* Selected Option Display */}
|
|
322
|
-
{selectedOption?.hasEnoughBalanceForFee &&
|
|
323
|
-
|
|
324
|
-
<
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
<div className="font-medium trails-text-primary text-sm">
|
|
334
|
-
{selectedOption.token.symbol}
|
|
335
|
-
</div>
|
|
336
|
-
<div className="text-xs trails-text-muted">
|
|
337
|
-
{selectedOption.token.contractAddress
|
|
338
|
-
? `${selectedOption.token.contractAddress.slice(0, 6)}...${selectedOption.token.contractAddress.slice(-4)}`
|
|
339
|
-
: "Native Token"}
|
|
340
|
-
</div>
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
{/* Display balance info if available */}
|
|
344
|
-
{selectedOption && "balanceFormatted" in selectedOption && (
|
|
345
|
-
<div className="text-right">
|
|
346
|
-
<div className="text-xs text-gray-500 dark:text-gray-400">
|
|
347
|
-
Balance: {String(selectedOption.balanceFormatted)}
|
|
348
|
-
</div>
|
|
349
|
-
{!selectedOption.hasEnoughBalanceForFee && (
|
|
350
|
-
<div className="text-xs text-red-500">
|
|
351
|
-
Insufficient balance
|
|
352
|
-
</div>
|
|
353
|
-
)}
|
|
354
|
-
</div>
|
|
355
|
-
)}
|
|
356
|
-
</div>
|
|
357
|
-
</div>
|
|
358
|
-
)}
|
|
552
|
+
{selectedOption?.hasEnoughBalanceForFee &&
|
|
553
|
+
selectedOptionDisplayValues && (
|
|
554
|
+
<FeeOptionCard
|
|
555
|
+
option={selectedOption}
|
|
556
|
+
chainId={chainId}
|
|
557
|
+
feeDisplay={selectedOptionDisplayValues}
|
|
558
|
+
isSelected
|
|
559
|
+
isDisabled={shouldShowBalanceWarning}
|
|
560
|
+
showRadio={false}
|
|
561
|
+
/>
|
|
562
|
+
)}
|
|
359
563
|
|
|
360
564
|
{/* Expanded Options */}
|
|
361
565
|
{isExpanded && (
|
|
362
566
|
<div className="space-y-2">
|
|
363
567
|
{pendingFeeOptionConfirmation.options
|
|
364
568
|
.filter((option: any) => option.hasEnoughBalanceForFee)
|
|
365
|
-
.map((option) =>
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
569
|
+
.map((option: any) => {
|
|
570
|
+
const optionDisabled = isFeeOptionDisabledForOriginBalance(option)
|
|
571
|
+
const feeDisplay = getFeeDisplayValues(option)
|
|
572
|
+
if (optionDisabled) {
|
|
573
|
+
return (
|
|
574
|
+
<Tooltip
|
|
575
|
+
key={option.token.symbol}
|
|
576
|
+
message="Not enough balance to cover sell amount and fee"
|
|
577
|
+
>
|
|
578
|
+
<FeeOptionCard
|
|
579
|
+
key={option.token.symbol || option.token.contractAddress}
|
|
580
|
+
option={option}
|
|
581
|
+
chainId={chainId}
|
|
582
|
+
feeDisplay={feeDisplay}
|
|
583
|
+
isSelected={
|
|
584
|
+
selectedFeeOptionTokenName === option.token.symbol
|
|
585
|
+
}
|
|
586
|
+
isDisabled={optionDisabled}
|
|
587
|
+
showRadio
|
|
588
|
+
onSelect={() =>
|
|
589
|
+
setSelectedFeeOptionTokenName(option.token.symbol)
|
|
590
|
+
}
|
|
591
|
+
/>
|
|
592
|
+
</Tooltip>
|
|
593
|
+
)
|
|
594
|
+
} else {
|
|
595
|
+
return (
|
|
596
|
+
<FeeOptionCard
|
|
597
|
+
key={option.token.symbol || option.token.contractAddress}
|
|
598
|
+
option={option}
|
|
387
599
|
chainId={chainId}
|
|
388
|
-
|
|
600
|
+
feeDisplay={feeDisplay}
|
|
601
|
+
isSelected={
|
|
602
|
+
selectedFeeOptionTokenName === option.token.symbol
|
|
603
|
+
}
|
|
604
|
+
isDisabled={optionDisabled}
|
|
605
|
+
showRadio
|
|
606
|
+
onSelect={() =>
|
|
607
|
+
setSelectedFeeOptionTokenName(option.token.symbol)
|
|
608
|
+
}
|
|
389
609
|
/>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
</div>
|
|
394
|
-
<div className="text-xs trails-text-muted">
|
|
395
|
-
{option.token.contractAddress
|
|
396
|
-
? `${option.token.contractAddress.slice(0, 6)}...${option.token.contractAddress.slice(-4)}`
|
|
397
|
-
: "Native Token"}
|
|
398
|
-
</div>
|
|
399
|
-
</div>
|
|
400
|
-
</div>
|
|
401
|
-
{/* Display balance info if available */}
|
|
402
|
-
{"balanceFormatted" in option && (
|
|
403
|
-
<div className="text-right">
|
|
404
|
-
<div className="text-xs text-gray-500 dark:text-gray-400">
|
|
405
|
-
Balance: {String(option.balanceFormatted)}
|
|
406
|
-
</div>
|
|
407
|
-
<div className="text-xs trails-text-muted">
|
|
408
|
-
Cost:{" "}
|
|
409
|
-
{String(
|
|
410
|
-
formatUnits(
|
|
411
|
-
BigInt(option.value),
|
|
412
|
-
option.token.decimals || 18,
|
|
413
|
-
),
|
|
414
|
-
)}
|
|
415
|
-
</div>
|
|
416
|
-
{!("hasEnoughBalanceForFee" in option) ||
|
|
417
|
-
!option.hasEnoughBalanceForFee ? (
|
|
418
|
-
<div className="text-xs text-red-500">Insufficient</div>
|
|
419
|
-
) : null}
|
|
420
|
-
</div>
|
|
421
|
-
)}
|
|
422
|
-
</label>
|
|
423
|
-
))}
|
|
610
|
+
)
|
|
611
|
+
}
|
|
612
|
+
})}
|
|
424
613
|
</div>
|
|
425
614
|
)}
|
|
426
615
|
|
|
427
616
|
{/* Action Buttons */}
|
|
428
|
-
<div className="flex space-x-3">
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
617
|
+
<div className="flex flex-col space-y-3 sm:flex-row sm:space-y-0 sm:space-x-3">
|
|
618
|
+
{!shouldShowBalanceWarning && (
|
|
619
|
+
<div className="flex-1">
|
|
620
|
+
<button
|
|
621
|
+
type="button"
|
|
622
|
+
onClick={() =>
|
|
623
|
+
handleConfirmFee(selectedOption?.token.contractAddress || null)
|
|
624
|
+
}
|
|
625
|
+
disabled={!selectedOption || isProcessing}
|
|
626
|
+
className="w-full py-3 px-6 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-300 disabled:text-gray-500 text-white font-semibold rounded-lg transition-all duration-200 cursor-pointer disabled:cursor-not-allowed shadow-sm hover:shadow-md disabled:shadow-none flex items-center justify-center"
|
|
627
|
+
>
|
|
628
|
+
{isProcessing ? (
|
|
629
|
+
<>
|
|
630
|
+
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
|
631
|
+
Processing...
|
|
632
|
+
</>
|
|
633
|
+
) : (
|
|
634
|
+
"Confirm Fee"
|
|
635
|
+
)}
|
|
636
|
+
</button>
|
|
637
|
+
</div>
|
|
638
|
+
)}
|
|
446
639
|
<button
|
|
447
640
|
type="button"
|
|
448
641
|
onClick={handleRejectFee}
|
|
449
642
|
disabled={isProcessing}
|
|
450
|
-
className=
|
|
643
|
+
className={`px-6 py-3 bg-gray-100 hover:bg-gray-200 disabled:bg-gray-50 text-gray-700 font-semibold rounded-lg transition-all duration-200 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50 flex items-center justify-center border border-gray-300 ${
|
|
644
|
+
shouldShowBalanceWarning ? "w-full sm:flex-1" : ""
|
|
645
|
+
}`}
|
|
451
646
|
>
|
|
452
647
|
{isProcessing ? (
|
|
453
648
|
<>
|
|
@@ -7,6 +7,7 @@ import type { PrepareSendQuote } from "../../prepareSend.js"
|
|
|
7
7
|
import { QuoteDetails } from "./QuoteDetails.js"
|
|
8
8
|
import { WaasFeeOptions } from "./WaasFeeOptions.js"
|
|
9
9
|
import { useAccount } from "wagmi"
|
|
10
|
+
import { logger } from "../../logger.js"
|
|
10
11
|
|
|
11
12
|
interface WalletConfirmationProps {
|
|
12
13
|
onBack?: () => void
|
|
@@ -56,7 +57,7 @@ export const WalletConfirmation: React.FC<WalletConfirmationProps> = ({
|
|
|
56
57
|
connectorId.includes("waas") ||
|
|
57
58
|
connectorId === "sequence-waas"
|
|
58
59
|
|
|
59
|
-
console.log("[trails-sdk] Sequence WaaS detection:", {
|
|
60
|
+
logger.console.log("[trails-sdk] Sequence WaaS detection:", {
|
|
60
61
|
connectorName,
|
|
61
62
|
connectorId,
|
|
62
63
|
isSequenceWaas,
|
|
@@ -135,10 +136,14 @@ export const WalletConfirmation: React.FC<WalletConfirmationProps> = ({
|
|
|
135
136
|
>
|
|
136
137
|
<WaasFeeOptions
|
|
137
138
|
chainId={quote?.originChain.id}
|
|
139
|
+
originTokenAmount={quote?.originAmount}
|
|
140
|
+
originToken={quote?.originToken}
|
|
138
141
|
setIsFeeOptionConfirmed={setIsFeeOptionConfirmed}
|
|
139
142
|
setIsError={setFeeOptionsError}
|
|
140
143
|
onFeeOptionsLoaded={() => {
|
|
141
|
-
console.log(
|
|
144
|
+
logger.console.log(
|
|
145
|
+
"[trails-sdk] Fee options loaded callback called",
|
|
146
|
+
)
|
|
142
147
|
setAreFeeOptionsLoaded(true)
|
|
143
148
|
}}
|
|
144
149
|
/>
|