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,290 +0,0 @@
|
|
|
1
|
-
import type React from "react"
|
|
2
|
-
import { useEffect, useState } from "react"
|
|
3
|
-
import {
|
|
4
|
-
getCoinbaseIntegrationId,
|
|
5
|
-
getBinanceIntegrationId,
|
|
6
|
-
getBitfinexIntegrationId,
|
|
7
|
-
getMeshConnectEnvironment,
|
|
8
|
-
} from "../../meshconnect.js"
|
|
9
|
-
import BitfinexLogo from "../assets/Bitfinex_Icon_Logo.svg"
|
|
10
|
-
import BinanceLogo from "../assets/Binance_Icon_Logo.svg"
|
|
11
|
-
import CoinbaseLogo from "../assets/Coinbase_Icon_Logo.svg"
|
|
12
|
-
import { ScreenHeader } from "./ScreenHeader.js"
|
|
13
|
-
import { logger } from "../../logger.js"
|
|
14
|
-
import { useSelectedMeshExchange } from "../hooks/useSelectedMeshExchange.js"
|
|
15
|
-
import { useCurrentScreen } from "../hooks/useCurrentScreen.js"
|
|
16
|
-
|
|
17
|
-
export interface MeshConnectExchangesProps {
|
|
18
|
-
onBack?: () => void
|
|
19
|
-
onSelectExchange?: (integrationId: string, exchangeName: string) => void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const MeshConnectExchanges: React.FC<MeshConnectExchangesProps> = ({
|
|
23
|
-
onBack,
|
|
24
|
-
onSelectExchange,
|
|
25
|
-
}) => {
|
|
26
|
-
const { setSelectedExchange } = useSelectedMeshExchange()
|
|
27
|
-
const { setCurrentScreen } = useCurrentScreen()
|
|
28
|
-
const [coinbaseId, setCoinbaseId] = useState<string | null>(null)
|
|
29
|
-
const [binanceId, setBinanceId] = useState<string | null>(null)
|
|
30
|
-
const [bitfinexId, setBitfinexId] = useState<string | null>(null)
|
|
31
|
-
const [loading, setLoading] = useState(true)
|
|
32
|
-
const [error, setError] = useState<string | null>(null)
|
|
33
|
-
|
|
34
|
-
// Fetch integration IDs on component mount
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const fetchIntegrationIds = async () => {
|
|
37
|
-
try {
|
|
38
|
-
setLoading(true)
|
|
39
|
-
setError(null)
|
|
40
|
-
|
|
41
|
-
const environment = getMeshConnectEnvironment()
|
|
42
|
-
|
|
43
|
-
// Fetch all integration IDs in parallel
|
|
44
|
-
const [coinbase, binance, bitfinex] = await Promise.all([
|
|
45
|
-
getCoinbaseIntegrationId(environment),
|
|
46
|
-
getBinanceIntegrationId(environment),
|
|
47
|
-
getBitfinexIntegrationId(environment),
|
|
48
|
-
])
|
|
49
|
-
|
|
50
|
-
setCoinbaseId(coinbase || null)
|
|
51
|
-
setBinanceId(binance || null)
|
|
52
|
-
setBitfinexId(bitfinex || null)
|
|
53
|
-
|
|
54
|
-
if (!coinbase && !binance && !bitfinex) {
|
|
55
|
-
setError("No supported exchanges found")
|
|
56
|
-
}
|
|
57
|
-
} catch (err) {
|
|
58
|
-
logger.console.error(
|
|
59
|
-
"[trails-sdk] Failed to fetch integration IDs:",
|
|
60
|
-
err,
|
|
61
|
-
)
|
|
62
|
-
setError(
|
|
63
|
-
err instanceof Error ? err.message : "Failed to load exchanges",
|
|
64
|
-
)
|
|
65
|
-
} finally {
|
|
66
|
-
setLoading(false)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
fetchIntegrationIds()
|
|
71
|
-
}, [])
|
|
72
|
-
|
|
73
|
-
const handleExchangeSelect = (
|
|
74
|
-
integrationId: string,
|
|
75
|
-
exchangeName: string,
|
|
76
|
-
) => {
|
|
77
|
-
logger.console.log(
|
|
78
|
-
`[trails-sdk] Selected exchange: ${exchangeName} (${integrationId})`,
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
// If a callback is provided (MeshConnectFlow), use it
|
|
82
|
-
if (onSelectExchange) {
|
|
83
|
-
onSelectExchange(integrationId, exchangeName)
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Otherwise, use the hook-based approach (main widget flow)
|
|
88
|
-
// Store the selected exchange
|
|
89
|
-
setSelectedExchange({ integrationId, exchangeName })
|
|
90
|
-
|
|
91
|
-
// Navigate to home screen
|
|
92
|
-
setCurrentScreen("home")
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (loading) {
|
|
96
|
-
return (
|
|
97
|
-
<div className="flex flex-col h-full">
|
|
98
|
-
<ScreenHeader
|
|
99
|
-
onBack={onBack}
|
|
100
|
-
headerContent="Select Exchange"
|
|
101
|
-
headerContentAlign="left"
|
|
102
|
-
/>
|
|
103
|
-
|
|
104
|
-
<div className="flex-1 flex items-center justify-center">
|
|
105
|
-
<div className="text-center">
|
|
106
|
-
<div className="w-8 h-8 border-solid border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
|
|
107
|
-
<p className="text-gray-600 dark:text-gray-400">
|
|
108
|
-
Loading available exchanges...
|
|
109
|
-
</p>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (error) {
|
|
117
|
-
return (
|
|
118
|
-
<div className="flex flex-col h-full">
|
|
119
|
-
<ScreenHeader
|
|
120
|
-
onBack={onBack}
|
|
121
|
-
headerContent="Select Exchange"
|
|
122
|
-
headerContentAlign="left"
|
|
123
|
-
/>
|
|
124
|
-
|
|
125
|
-
<div className="flex-1 flex items-center justify-center">
|
|
126
|
-
<div className="text-center p-4 border border-solid border-red-200 rounded-lg bg-red-50 dark:bg-red-900/20 dark:border-red-800">
|
|
127
|
-
<p className="text-red-600 dark:text-red-200 mb-4">{error}</p>
|
|
128
|
-
<button
|
|
129
|
-
type="button"
|
|
130
|
-
onClick={() => window.location.reload()}
|
|
131
|
-
className="px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors"
|
|
132
|
-
>
|
|
133
|
-
Try Again
|
|
134
|
-
</button>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
138
|
-
)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<div className="flex flex-col h-full">
|
|
143
|
-
<ScreenHeader
|
|
144
|
-
onBack={onBack}
|
|
145
|
-
headerContent="Select Exchange"
|
|
146
|
-
headerContentAlign="left"
|
|
147
|
-
/>
|
|
148
|
-
|
|
149
|
-
<div className="flex-1">
|
|
150
|
-
<div className="space-y-4">
|
|
151
|
-
{coinbaseId && (
|
|
152
|
-
<button
|
|
153
|
-
type="button"
|
|
154
|
-
onClick={() => handleExchangeSelect(coinbaseId, "Coinbase")}
|
|
155
|
-
className="w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-bg-secondary trails-hover-bg trails-text-primary"
|
|
156
|
-
>
|
|
157
|
-
<div className="flex items-center space-x-3 flex-1">
|
|
158
|
-
<div className="w-12 h-12 bg-[#1652f0] rounded-lg flex items-center justify-center">
|
|
159
|
-
<img src={CoinbaseLogo} alt="Coinbase" className="w-6 h-6" />
|
|
160
|
-
</div>
|
|
161
|
-
<div className="flex-1 text-left">
|
|
162
|
-
<h4 className="font-semibold text-gray-900 dark:text-gray-100">
|
|
163
|
-
Coinbase
|
|
164
|
-
</h4>
|
|
165
|
-
<p className="text-sm text-gray-600 dark:text-gray-400">
|
|
166
|
-
Connect your Coinbase account to transfer funds
|
|
167
|
-
</p>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
<div className="text-gray-400">
|
|
171
|
-
<svg
|
|
172
|
-
className="w-5 h-5"
|
|
173
|
-
fill="none"
|
|
174
|
-
stroke="currentColor"
|
|
175
|
-
viewBox="0 0 24 24"
|
|
176
|
-
aria-label="Chevron right"
|
|
177
|
-
>
|
|
178
|
-
<path
|
|
179
|
-
strokeLinecap="round"
|
|
180
|
-
strokeLinejoin="round"
|
|
181
|
-
strokeWidth={2}
|
|
182
|
-
d="M9 5l7 7-7 7"
|
|
183
|
-
/>
|
|
184
|
-
</svg>
|
|
185
|
-
</div>
|
|
186
|
-
</button>
|
|
187
|
-
)}
|
|
188
|
-
|
|
189
|
-
{binanceId && (
|
|
190
|
-
<button
|
|
191
|
-
type="button"
|
|
192
|
-
onClick={() => handleExchangeSelect(binanceId, "Binance")}
|
|
193
|
-
className="w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-bg-secondary trails-hover-bg trails-text-primary"
|
|
194
|
-
>
|
|
195
|
-
<div className="flex items-center space-x-3 flex-1">
|
|
196
|
-
<div className="w-12 h-12 bg-black rounded-lg flex items-center justify-center">
|
|
197
|
-
<img src={BinanceLogo} alt="Binance" className="w-6 h-6" />
|
|
198
|
-
</div>
|
|
199
|
-
<div className="flex-1 text-left">
|
|
200
|
-
<h4 className="font-semibold text-gray-900 dark:text-gray-100">
|
|
201
|
-
Binance
|
|
202
|
-
</h4>
|
|
203
|
-
<p className="text-sm text-gray-600 dark:text-gray-400">
|
|
204
|
-
Connect your Binance account to transfer funds
|
|
205
|
-
</p>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
<div className="text-gray-400">
|
|
209
|
-
<svg
|
|
210
|
-
className="w-5 h-5"
|
|
211
|
-
fill="none"
|
|
212
|
-
stroke="currentColor"
|
|
213
|
-
viewBox="0 0 24 24"
|
|
214
|
-
aria-label="Chevron right"
|
|
215
|
-
>
|
|
216
|
-
<path
|
|
217
|
-
strokeLinecap="round"
|
|
218
|
-
strokeLinejoin="round"
|
|
219
|
-
strokeWidth={2}
|
|
220
|
-
d="M9 5l7 7-7 7"
|
|
221
|
-
/>
|
|
222
|
-
</svg>
|
|
223
|
-
</div>
|
|
224
|
-
</button>
|
|
225
|
-
)}
|
|
226
|
-
|
|
227
|
-
{bitfinexId && (
|
|
228
|
-
<button
|
|
229
|
-
type="button"
|
|
230
|
-
onClick={() => handleExchangeSelect(bitfinexId, "Bitfinex")}
|
|
231
|
-
className="w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-bg-secondary trails-hover-bg trails-text-primary"
|
|
232
|
-
>
|
|
233
|
-
<div className="flex items-center space-x-3 flex-1">
|
|
234
|
-
<div className="w-12 h-12 bg-[#03ca9b] rounded-lg flex items-center justify-center">
|
|
235
|
-
<img src={BitfinexLogo} alt="Bitfinex" className="w-6 h-6" />
|
|
236
|
-
</div>
|
|
237
|
-
<div className="flex-1 text-left">
|
|
238
|
-
<h4 className="font-semibold text-gray-900 dark:text-gray-100">
|
|
239
|
-
Bitfinex
|
|
240
|
-
</h4>
|
|
241
|
-
<p className="text-sm text-gray-600 dark:text-gray-400">
|
|
242
|
-
Connect your Bitfinex account to transfer funds
|
|
243
|
-
</p>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
<div className="text-gray-400">
|
|
247
|
-
<svg
|
|
248
|
-
className="w-5 h-5"
|
|
249
|
-
fill="none"
|
|
250
|
-
stroke="currentColor"
|
|
251
|
-
viewBox="0 0 24 24"
|
|
252
|
-
aria-label="Chevron right"
|
|
253
|
-
>
|
|
254
|
-
<path
|
|
255
|
-
strokeLinecap="round"
|
|
256
|
-
strokeLinejoin="round"
|
|
257
|
-
strokeWidth={2}
|
|
258
|
-
d="M9 5l7 7-7 7"
|
|
259
|
-
/>
|
|
260
|
-
</svg>
|
|
261
|
-
</div>
|
|
262
|
-
</button>
|
|
263
|
-
)}
|
|
264
|
-
|
|
265
|
-
{!coinbaseId && !binanceId && !bitfinexId && (
|
|
266
|
-
<div className="text-center p-8 border border-solid border-gray-200 dark:border-gray-700 rounded-lg">
|
|
267
|
-
<p className="text-gray-600 dark:text-gray-400">
|
|
268
|
-
No supported exchanges are currently available.
|
|
269
|
-
</p>
|
|
270
|
-
</div>
|
|
271
|
-
)}
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
|
|
275
|
-
{/* Sandbox Environment Banner */}
|
|
276
|
-
{getMeshConnectEnvironment() === "sandbox" && (
|
|
277
|
-
<div className="p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-solid border-yellow-200 dark:border-yellow-800">
|
|
278
|
-
<div className="text-center">
|
|
279
|
-
<p className="text-sm font-medium text-yellow-800 dark:text-yellow-200">
|
|
280
|
-
Sandbox environment
|
|
281
|
-
</p>
|
|
282
|
-
<p className="text-xs text-yellow-600 dark:text-yellow-300">
|
|
283
|
-
No real funds are used
|
|
284
|
-
</p>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
)}
|
|
288
|
-
</div>
|
|
289
|
-
)
|
|
290
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type React from "react"
|
|
2
|
-
import { useState, useEffect } from "react"
|
|
3
|
-
import { MeshConnectExchanges } from "./MeshConnectExchanges.js"
|
|
4
|
-
import { MeshConnectIframe } from "./MeshConnectIframe.js"
|
|
5
|
-
import type { SelectedMeshExchange } from "../hooks/useSelectedMeshExchange.js"
|
|
6
|
-
|
|
7
|
-
export interface MeshConnectFlowProps {
|
|
8
|
-
onBack?: () => void
|
|
9
|
-
onComplete?: (transferData: any) => void
|
|
10
|
-
toTokenSymbol?: string
|
|
11
|
-
toTokenAmount?: string
|
|
12
|
-
toChainId?: number
|
|
13
|
-
toRecipientAddress?: string
|
|
14
|
-
selectedExchange?: SelectedMeshExchange | null
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type Screen = "exchanges" | "connect"
|
|
18
|
-
|
|
19
|
-
export const MeshConnectFlow: React.FC<MeshConnectFlowProps> = ({
|
|
20
|
-
onBack,
|
|
21
|
-
onComplete,
|
|
22
|
-
toTokenSymbol,
|
|
23
|
-
toTokenAmount,
|
|
24
|
-
toChainId,
|
|
25
|
-
toRecipientAddress,
|
|
26
|
-
selectedExchange,
|
|
27
|
-
}) => {
|
|
28
|
-
// If an exchange is already selected, start on the connect screen
|
|
29
|
-
const [currentScreen, setCurrentScreen] = useState<Screen>(
|
|
30
|
-
selectedExchange ? "connect" : "exchanges",
|
|
31
|
-
)
|
|
32
|
-
const [selectedIntegrationId, setSelectedIntegrationId] = useState<string>(
|
|
33
|
-
selectedExchange?.integrationId || "",
|
|
34
|
-
)
|
|
35
|
-
const [selectedExchangeName, setSelectedExchangeName] = useState<string>(
|
|
36
|
-
selectedExchange?.exchangeName || "",
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
// Update state when selectedExchange prop changes
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (selectedExchange) {
|
|
42
|
-
setSelectedIntegrationId(selectedExchange.integrationId)
|
|
43
|
-
setSelectedExchangeName(selectedExchange.exchangeName)
|
|
44
|
-
setCurrentScreen("connect")
|
|
45
|
-
}
|
|
46
|
-
}, [selectedExchange])
|
|
47
|
-
|
|
48
|
-
const handleSelectExchange = (
|
|
49
|
-
integrationId: string,
|
|
50
|
-
exchangeName: string,
|
|
51
|
-
) => {
|
|
52
|
-
setSelectedIntegrationId(integrationId)
|
|
53
|
-
setSelectedExchangeName(exchangeName)
|
|
54
|
-
setCurrentScreen("connect")
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const handleBackFromConnect = () => {
|
|
58
|
-
setCurrentScreen("exchanges")
|
|
59
|
-
setSelectedIntegrationId("")
|
|
60
|
-
setSelectedExchangeName("")
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const handleBackFromExchanges = () => {
|
|
64
|
-
if (onBack) {
|
|
65
|
-
onBack()
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (currentScreen === "connect") {
|
|
70
|
-
return (
|
|
71
|
-
<MeshConnectIframe
|
|
72
|
-
onBack={handleBackFromConnect}
|
|
73
|
-
onComplete={onComplete}
|
|
74
|
-
toTokenSymbol={toTokenSymbol}
|
|
75
|
-
toTokenAmount={toTokenAmount}
|
|
76
|
-
toChainId={toChainId}
|
|
77
|
-
toRecipientAddress={toRecipientAddress}
|
|
78
|
-
integrationId={selectedIntegrationId}
|
|
79
|
-
exchangeName={selectedExchangeName}
|
|
80
|
-
/>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<MeshConnectExchanges
|
|
86
|
-
onBack={handleBackFromExchanges}
|
|
87
|
-
onSelectExchange={handleSelectExchange}
|
|
88
|
-
/>
|
|
89
|
-
)
|
|
90
|
-
}
|