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
package/src/index.ts
CHANGED
|
@@ -4,6 +4,17 @@ export {
|
|
|
4
4
|
InsufficientBalanceError,
|
|
5
5
|
UserRejectionError,
|
|
6
6
|
getIsUserRejectionError,
|
|
7
|
+
getIsBalanceTooLowError,
|
|
8
|
+
getIsApiError,
|
|
9
|
+
getIsRateLimitedError,
|
|
10
|
+
getIsRequiredAmountNotMetError,
|
|
11
|
+
getIsNoAvailableQuoteError,
|
|
12
|
+
getIsQuoteFailedError,
|
|
13
|
+
getIsQuoteTokenError,
|
|
14
|
+
getIsQuoteInputError,
|
|
15
|
+
getIsInsufficientLiquidityError,
|
|
16
|
+
getIsWalletAlreadyConnectedError,
|
|
17
|
+
getPrettifiedErrorMessage,
|
|
7
18
|
} from "./error.js"
|
|
8
19
|
export {
|
|
9
20
|
getSupportedChains,
|
|
@@ -41,6 +52,12 @@ export type {
|
|
|
41
52
|
SwapReturn,
|
|
42
53
|
Quote,
|
|
43
54
|
} from "./prepareSend.js"
|
|
55
|
+
export { useTrailsSendTransaction } from "./widget/hooks/useTrailsSendTransaction.js"
|
|
56
|
+
export type {
|
|
57
|
+
UseTrailsSendTransactionParameters,
|
|
58
|
+
UseTrailsSendTransactionReturnType,
|
|
59
|
+
TrailsSendTransactionVariables,
|
|
60
|
+
} from "./widget/hooks/useTrailsSendTransaction.js"
|
|
44
61
|
export type {
|
|
45
62
|
TransactionState,
|
|
46
63
|
IntentTransaction,
|
|
@@ -71,26 +88,28 @@ export {
|
|
|
71
88
|
export type {
|
|
72
89
|
NativeTokenBalance,
|
|
73
90
|
TokenBalance,
|
|
74
|
-
TokenBalanceExtended,
|
|
75
91
|
} from "./tokenBalances.js"
|
|
76
92
|
export {
|
|
77
93
|
getSupportedTokens,
|
|
78
94
|
useSupportedTokens,
|
|
79
95
|
useTokenList,
|
|
80
96
|
useGetTokenImageUrl,
|
|
97
|
+
useTokenAddress,
|
|
98
|
+
useTokenInfo,
|
|
99
|
+
convertApiTokenInfoToToken,
|
|
81
100
|
} from "./tokens.js"
|
|
82
|
-
export type {
|
|
101
|
+
export type { Token } from "./tokens.js"
|
|
102
|
+
export {
|
|
103
|
+
formatBalanceFields,
|
|
104
|
+
formatUsdFields,
|
|
105
|
+
formatPriceFields,
|
|
106
|
+
formatUsdAmountFormatted,
|
|
107
|
+
} from "./tokenBalances.js"
|
|
83
108
|
export { getTxTimeDiff } from "./transactions.js"
|
|
84
109
|
export { useCommitIntent, useExecuteIntent } from "./mutations.js"
|
|
85
110
|
export type { Mode } from "./mode.js"
|
|
86
111
|
export { TRAILS_ROUTER_PLACEHOLDER_AMOUNT } from "./trailsRouter.js"
|
|
87
112
|
export { getERC20TransferData } from "./encoders.js"
|
|
88
|
-
// Config functions - getters are deprecated, use TrailsProvider context instead
|
|
89
|
-
export {
|
|
90
|
-
getSlippageTolerance,
|
|
91
|
-
getDebug,
|
|
92
|
-
getCommitHash,
|
|
93
|
-
} from "./config.js"
|
|
94
113
|
export * from "./widget/index.js"
|
|
95
114
|
export { TrailsProvider } from "./widget/providers/TrailsProvider.js"
|
|
96
115
|
export type {
|
|
@@ -116,4 +135,5 @@ export type {
|
|
|
116
135
|
Intent,
|
|
117
136
|
ExecuteIntentRequest,
|
|
118
137
|
ExecuteIntentResponse,
|
|
119
|
-
|
|
138
|
+
TrailsContracts,
|
|
139
|
+
} from "@0xtrails/api"
|
package/src/indexerClient.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
bsc,
|
|
17
17
|
etherlink,
|
|
18
18
|
katana,
|
|
19
|
+
monad,
|
|
19
20
|
} from "viem/chains"
|
|
20
21
|
|
|
21
22
|
export type IndexerGatewayConfig = {
|
|
@@ -92,6 +93,7 @@ export function getChainIndexerUrl(
|
|
|
92
93
|
421613: "arbitrum-nova-sepolia",
|
|
93
94
|
[etherlink.id]: "etherlink",
|
|
94
95
|
[katana.id]: "katana",
|
|
96
|
+
[monad.id]: "monad",
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
const chainSlug = chainIdToSlug[chainId]
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { TrailsClient } from "./trailsClient.js"
|
|
2
|
-
import type {
|
|
3
|
-
IntentReceipt,
|
|
4
|
-
WaitIntentReceiptResponse,
|
|
5
|
-
} from "@0xsequence/trails-api"
|
|
2
|
+
import type { IntentReceipt, WaitIntentReceiptResponse } from "@0xtrails/api"
|
|
6
3
|
import { type Query, useQuery } from "@tanstack/react-query"
|
|
7
4
|
import { logger } from "./logger.js"
|
|
8
5
|
|
|
@@ -3,11 +3,11 @@ import type {
|
|
|
3
3
|
IntentReceipt,
|
|
4
4
|
WaitIntentReceiptResponse,
|
|
5
5
|
TransactionStatus,
|
|
6
|
-
} from "@
|
|
6
|
+
} from "@0xtrails/api"
|
|
7
7
|
import { logger } from "./logger.js"
|
|
8
8
|
|
|
9
9
|
const POLL_INTERVAL = 150 // 150 ms
|
|
10
|
-
const MAX_WAIT_TIME =
|
|
10
|
+
const MAX_WAIT_TIME = 15 * 60 * 1000 // 15 minutes
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Callback invoked when the deposit transaction hash is discovered (for gasless flows).
|
package/src/intents.ts
CHANGED
|
@@ -7,8 +7,9 @@ import type {
|
|
|
7
7
|
ExecuteIntentRequest,
|
|
8
8
|
GasFeeOptions,
|
|
9
9
|
DepositSignature,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
TrailsContracts,
|
|
11
|
+
} from "@0xtrails/api"
|
|
12
|
+
import { JsonEncode } from "@0xtrails/api"
|
|
12
13
|
import type { TrailsClient } from "./trailsClient.js"
|
|
13
14
|
import { logger } from "./logger.js"
|
|
14
15
|
|
|
@@ -21,7 +22,10 @@ import {
|
|
|
21
22
|
type WalletClient,
|
|
22
23
|
} from "viem"
|
|
23
24
|
import { getChainInfo, getChainRpcClient } from "./chains.js"
|
|
24
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
SEQUENCE_V3_CONTRACT_ADDRESSES,
|
|
27
|
+
TRAILS_CONTRACTS,
|
|
28
|
+
} from "./constants.js"
|
|
25
29
|
import {
|
|
26
30
|
trackTransactionStarted,
|
|
27
31
|
trackTransactionSubmitted,
|
|
@@ -119,7 +123,11 @@ export async function quoteIntent(
|
|
|
119
123
|
trailsClient: TrailsApi,
|
|
120
124
|
args: QuoteIntentRequest,
|
|
121
125
|
additionalTrackingProps: Record<string, string> = {},
|
|
122
|
-
): Promise<{
|
|
126
|
+
): Promise<{
|
|
127
|
+
intent: Intent
|
|
128
|
+
gasFeeOptions?: GasFeeOptions
|
|
129
|
+
trailsContracts?: TrailsContracts
|
|
130
|
+
}> {
|
|
123
131
|
// Track intent quote request
|
|
124
132
|
trackIntentQuoteRequested({
|
|
125
133
|
originChainId: args.originChainId || 0,
|
|
@@ -383,7 +391,10 @@ export async function commitIntent(
|
|
|
383
391
|
})
|
|
384
392
|
|
|
385
393
|
// Commit the intent that was returned from quoteIntent
|
|
386
|
-
const response = await trailsClient.commitIntent({
|
|
394
|
+
const response = await trailsClient.commitIntent({
|
|
395
|
+
intent,
|
|
396
|
+
trailsContracts: TRAILS_CONTRACTS,
|
|
397
|
+
})
|
|
387
398
|
|
|
388
399
|
// Track successful intent commit
|
|
389
400
|
trackIntentCommitCompleted({
|
package/src/mode.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type Mode = "pay" | "fund" | "earn" | "swap"
|
|
1
|
+
export type Mode = "pay" | "fund" | "earn" | "swap"
|
package/src/mutations.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query"
|
|
2
|
-
import type { Intent, DepositSignature } from "@
|
|
2
|
+
import type { Intent, DepositSignature } from "@0xtrails/api"
|
|
3
3
|
import { useTrailsClient } from "./trailsClient.js"
|
|
4
4
|
import { logger } from "./logger.js"
|
|
5
5
|
import { getFullErrorMessage } from "./error.js"
|
|
6
|
+
import { TRAILS_CONTRACTS } from "./constants.js"
|
|
6
7
|
import {
|
|
7
8
|
trackIntentCommitStarted,
|
|
8
9
|
trackIntentCommitCompleted,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
type ExecuteIntentResponse,
|
|
13
14
|
type IntentStatus,
|
|
14
15
|
IntentStatusError,
|
|
15
|
-
} from "@
|
|
16
|
+
} from "@0xtrails/api"
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Hook for committing an intent to the Trails API
|
|
@@ -46,7 +47,10 @@ export function useCommitIntent() {
|
|
|
46
47
|
})
|
|
47
48
|
|
|
48
49
|
// Commit the intent
|
|
49
|
-
const response = await trailsClient.commitIntent({
|
|
50
|
+
const response = await trailsClient.commitIntent({
|
|
51
|
+
intent,
|
|
52
|
+
trailsContracts: TRAILS_CONTRACTS,
|
|
53
|
+
})
|
|
50
54
|
|
|
51
55
|
logger.console.log("[trails-sdk] useCommitIntent: Commit successful", {
|
|
52
56
|
intentId: intent.intentId,
|
package/src/prepareSend.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { TransactionState } from "./transactions.js"
|
|
|
12
12
|
import { logger } from "./logger.js"
|
|
13
13
|
import { getIsCustomCalldata } from "./contractUtils.js"
|
|
14
14
|
import { getChainInfo, getChainRpcClient } from "./chains.js"
|
|
15
|
+
import { TRAILS_CONTRACTS } from "./constants.js"
|
|
15
16
|
|
|
16
17
|
// Import from transactionIntent module
|
|
17
18
|
import {
|
|
@@ -22,7 +23,6 @@ import {
|
|
|
22
23
|
handleCrossChain,
|
|
23
24
|
isSameChain,
|
|
24
25
|
isSameToken,
|
|
25
|
-
validateCctpDestinationToken,
|
|
26
26
|
} from "./transactionIntent/index.js"
|
|
27
27
|
|
|
28
28
|
// Re-export types for backward compatibility
|
|
@@ -39,7 +39,6 @@ export type {
|
|
|
39
39
|
export {
|
|
40
40
|
isSameChain,
|
|
41
41
|
isSameToken,
|
|
42
|
-
validateCctpDestinationToken,
|
|
43
42
|
} from "./transactionIntent/index.js"
|
|
44
43
|
|
|
45
44
|
export async function prepareSend(
|
|
@@ -86,6 +85,8 @@ export async function prepareSend(
|
|
|
86
85
|
sequenceProjectAccessKey,
|
|
87
86
|
sequenceIndexerUrl,
|
|
88
87
|
isSmartWallet,
|
|
88
|
+
trailsApiKey,
|
|
89
|
+
trailsApiUrl,
|
|
89
90
|
} = options
|
|
90
91
|
let { sourceTokenPriceUsd, destinationTokenPriceUsd } = options
|
|
91
92
|
|
|
@@ -139,13 +140,6 @@ export async function prepareSend(
|
|
|
139
140
|
throw new Error("Recipient address cannot be zero address")
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
// Validate CCTP destination token requirement
|
|
143
|
-
validateCctpDestinationToken(
|
|
144
|
-
destinationTokenAddress,
|
|
145
|
-
destinationChainId,
|
|
146
|
-
quoteProvider,
|
|
147
|
-
)
|
|
148
|
-
|
|
149
143
|
let effectiveDestinationAddress = recipient
|
|
150
144
|
let effectiveDestinationCalldata = destinationCalldata
|
|
151
145
|
|
|
@@ -189,6 +183,7 @@ export async function prepareSend(
|
|
|
189
183
|
destinationChainId,
|
|
190
184
|
originTokenAddress,
|
|
191
185
|
destinationTokenAddress,
|
|
186
|
+
trailsRouterAddress: TRAILS_CONTRACTS.trailsRouterAddress,
|
|
192
187
|
})
|
|
193
188
|
|
|
194
189
|
if (wrapResult) {
|
|
@@ -247,18 +242,28 @@ export async function prepareSend(
|
|
|
247
242
|
}
|
|
248
243
|
|
|
249
244
|
// Track payment start
|
|
245
|
+
// For EXACT_INPUT, swapAmount is the origin amount, not destination amount
|
|
246
|
+
// We don't know the destination amount yet until we get the quote
|
|
247
|
+
// For EXACT_OUTPUT, swapAmount is the destination amount, so it's correct
|
|
248
|
+
// For EXACT_OUTPUT, we don't know the origin amount until we get the quote
|
|
250
249
|
trackPaymentStarted({
|
|
251
250
|
userAddress: account.address,
|
|
252
251
|
originChainId,
|
|
253
252
|
destinationChainId,
|
|
254
253
|
originTokenAddress,
|
|
254
|
+
originTokenAmount:
|
|
255
|
+
tradeType === TradeType.EXACT_INPUT ? swapAmount : undefined,
|
|
256
|
+
originTokenDecimals: sourceTokenDecimals,
|
|
255
257
|
destinationTokenAddress,
|
|
256
258
|
destinationTokenSymbol: destinationTokenSymbol || "",
|
|
257
|
-
destinationTokenAmount:
|
|
259
|
+
destinationTokenAmount:
|
|
260
|
+
tradeType === TradeType.EXACT_OUTPUT ? swapAmount : undefined,
|
|
261
|
+
destinationTokenDecimals: destinationTokenDecimals,
|
|
258
262
|
mode,
|
|
259
263
|
fundMethod,
|
|
260
264
|
sourceTokenPriceUsd: sourceTokenPriceUsd?.toString(),
|
|
261
265
|
destinationTokenPriceUsd: destinationTokenPriceUsd?.toString(),
|
|
266
|
+
tradeType: tradeType.toString(),
|
|
262
267
|
})
|
|
263
268
|
|
|
264
269
|
// Note: Disable this check for now to allow fetching a quote even when the origin balance is zero
|
|
@@ -429,6 +434,8 @@ export async function prepareSend(
|
|
|
429
434
|
sequenceProjectAccessKey,
|
|
430
435
|
sequenceIndexerUrl,
|
|
431
436
|
isSmartWallet,
|
|
437
|
+
trailsApiKey,
|
|
438
|
+
trailsApiUrl,
|
|
432
439
|
})
|
|
433
440
|
}
|
|
434
441
|
|
|
@@ -473,6 +480,8 @@ export async function prepareSend(
|
|
|
473
480
|
sequenceProjectAccessKey,
|
|
474
481
|
sequenceIndexerUrl,
|
|
475
482
|
isSmartWallet,
|
|
483
|
+
trailsApiKey,
|
|
484
|
+
trailsApiUrl,
|
|
476
485
|
})
|
|
477
486
|
}
|
|
478
487
|
|
|
@@ -492,10 +501,6 @@ export {
|
|
|
492
501
|
getSlippageToleranceFromIntent,
|
|
493
502
|
getPriceImpactFromIntent,
|
|
494
503
|
getPriceImpactUsdFromIntent,
|
|
495
|
-
getFeesFromRelaySdkQuote,
|
|
496
|
-
getSlippageToleranceFromRelaySdkQuote,
|
|
497
|
-
getPriceImpactFromRelaySdkQuote,
|
|
498
|
-
getPriceImpactUsdFromRelaySdkQuote,
|
|
499
504
|
getZeroFees,
|
|
500
505
|
getCompletionEstimateSeconds,
|
|
501
506
|
getNormalizedQuoteObject,
|
package/src/prices.ts
CHANGED
package/src/sequenceWallet.ts
CHANGED
|
@@ -439,9 +439,9 @@ export class StaticSigner implements signers.SapientSigner {
|
|
|
439
439
|
|
|
440
440
|
constructor(
|
|
441
441
|
private readonly address: string,
|
|
442
|
-
|
|
442
|
+
readonly _signature: string,
|
|
443
443
|
) {
|
|
444
|
-
const raw = hexToBytes(this.
|
|
444
|
+
const raw = hexToBytes(this._signature as `0x${string}`)
|
|
445
445
|
|
|
446
446
|
// Separate last byte as suffix
|
|
447
447
|
this.savedSuffix = raw.slice(-1)
|
package/src/time.ts
CHANGED
|
@@ -43,3 +43,31 @@ export const formatRelativeDate = (dateString?: string) => {
|
|
|
43
43
|
return { relative: null, full: null }
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Format completion time estimate in seconds to a human-readable string
|
|
49
|
+
* @param seconds - The number of seconds for completion estimate
|
|
50
|
+
* @returns Formatted string like "30s", "5m", "1h30m", etc.
|
|
51
|
+
*/
|
|
52
|
+
export const formatCompletionTime = (seconds: number): string => {
|
|
53
|
+
if (seconds < 60) {
|
|
54
|
+
return `${seconds}s`
|
|
55
|
+
} else if (seconds < 3600) {
|
|
56
|
+
const minutes = Math.floor(seconds / 60)
|
|
57
|
+
const remainingSeconds = seconds % 60
|
|
58
|
+
return remainingSeconds > 0
|
|
59
|
+
? `${minutes}m${remainingSeconds}s`
|
|
60
|
+
: `${minutes}m`
|
|
61
|
+
} else {
|
|
62
|
+
const hours = Math.floor(seconds / 3600)
|
|
63
|
+
const remainingMinutes = Math.floor((seconds % 3600) / 60)
|
|
64
|
+
const remainingSeconds = seconds % 60
|
|
65
|
+
if (remainingMinutes > 0 || remainingSeconds > 0) {
|
|
66
|
+
return `${hours}h${remainingMinutes}m${
|
|
67
|
+
remainingSeconds > 0 ? `${remainingSeconds}s` : ""
|
|
68
|
+
}`
|
|
69
|
+
} else {
|
|
70
|
+
return `${hours}h`
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|