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/trailsClient.ts
CHANGED
package/src/trailsRouter.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { encodeFunctionData, zeroAddress } from "viem"
|
|
2
|
-
import { TRAILS_ROUTER_ADDRESS } from "./constants.js"
|
|
3
2
|
|
|
4
3
|
export const TRAILS_ROUTER_PLACEHOLDER_AMOUNT =
|
|
5
4
|
0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefn
|
|
@@ -8,7 +7,7 @@ function getAmountOffset(calldata: `0x${string}`, placeholder: bigint): number {
|
|
|
8
7
|
const hex = placeholder.toString(16).padStart(64, "0")
|
|
9
8
|
const search = hex.toLowerCase()
|
|
10
9
|
const offset = calldata.toLowerCase().indexOf(search)
|
|
11
|
-
if (offset === -1)
|
|
10
|
+
if (offset === -1) return -1 // placeholder not found
|
|
12
11
|
const byteOffset = (offset - 2) / 2 // subtract '0x', convert to bytes
|
|
13
12
|
if (byteOffset < 0 || byteOffset % 1 !== 0) throw new Error("Invalid offset")
|
|
14
13
|
return byteOffset
|
|
@@ -63,6 +62,7 @@ export function wrapCalldataWithTrailsRouterIfNeeded({
|
|
|
63
62
|
amount,
|
|
64
63
|
originTokenAddress,
|
|
65
64
|
destinationTokenAddress,
|
|
65
|
+
trailsRouterAddress,
|
|
66
66
|
}: {
|
|
67
67
|
token: string
|
|
68
68
|
target: string
|
|
@@ -72,6 +72,7 @@ export function wrapCalldataWithTrailsRouterIfNeeded({
|
|
|
72
72
|
amount: string
|
|
73
73
|
originTokenAddress: string
|
|
74
74
|
destinationTokenAddress: string
|
|
75
|
+
trailsRouterAddress: string
|
|
75
76
|
}): { encodedCalldata: `0x${string}`; trailsRouterAddress: string } | null {
|
|
76
77
|
const isSameToken =
|
|
77
78
|
originTokenAddress?.toLowerCase() === destinationTokenAddress?.toLowerCase()
|
|
@@ -89,12 +90,10 @@ export function wrapCalldataWithTrailsRouterIfNeeded({
|
|
|
89
90
|
const calldataWithAmount = calldata.replace(placeholderHex, amountHex)
|
|
90
91
|
return {
|
|
91
92
|
encodedCalldata: calldataWithAmount as `0x${string}`,
|
|
92
|
-
trailsRouterAddress
|
|
93
|
+
trailsRouterAddress,
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
const trailsRouterAddress = TRAILS_ROUTER_ADDRESS
|
|
97
|
-
|
|
98
97
|
const amountOffset = isDestinationNativeToken
|
|
99
98
|
? 0
|
|
100
99
|
: getAmountOffset(calldata, BigInt(TRAILS_ROUTER_PLACEHOLDER_AMOUNT))
|
|
@@ -5,14 +5,15 @@ import type {
|
|
|
5
5
|
WalletClient,
|
|
6
6
|
TransactionReceipt,
|
|
7
7
|
} from "viem"
|
|
8
|
-
import type { FeeOption, TrailsApi } from "@
|
|
8
|
+
import type { FeeOption, TrailsApi } from "@0xtrails/api"
|
|
9
9
|
import type { TransactionState } from "../../transactions.js"
|
|
10
10
|
import type { CheckoutOnHandlers } from "../../widget/hooks/useCheckout.js"
|
|
11
11
|
import type {
|
|
12
12
|
DepositSignature,
|
|
13
13
|
GasFeeOptions,
|
|
14
14
|
ExecuteIntentResponse,
|
|
15
|
-
|
|
15
|
+
TrailsContracts,
|
|
16
|
+
} from "@0xtrails/api"
|
|
16
17
|
import { logger } from "../../logger.js"
|
|
17
18
|
import { isNativeToken } from "../../utils.js"
|
|
18
19
|
import { attemptGaslessDeposit, getDoGasless } from "./gaslessDeposit.js"
|
|
@@ -42,6 +43,7 @@ export async function attemptUserDepositTx({
|
|
|
42
43
|
destinationTokenSymbol,
|
|
43
44
|
depositAmountUsd,
|
|
44
45
|
feeOptions,
|
|
46
|
+
trailsContracts,
|
|
45
47
|
trailsClient,
|
|
46
48
|
selectedFeeOption,
|
|
47
49
|
walletId,
|
|
@@ -76,6 +78,7 @@ export async function attemptUserDepositTx({
|
|
|
76
78
|
destinationTokenSymbol: string
|
|
77
79
|
depositAmountUsd: number
|
|
78
80
|
feeOptions?: GasFeeOptions
|
|
81
|
+
trailsContracts?: TrailsContracts
|
|
79
82
|
trailsClient: TrailsApi
|
|
80
83
|
selectedFeeOption?: FeeOption | null
|
|
81
84
|
walletId?: string
|
|
@@ -158,6 +161,7 @@ export async function attemptUserDepositTx({
|
|
|
158
161
|
account,
|
|
159
162
|
trailsClient,
|
|
160
163
|
feeOptions: feeOptions,
|
|
164
|
+
trailsContracts,
|
|
161
165
|
selectedFeeOption,
|
|
162
166
|
abortSignal,
|
|
163
167
|
checkoutOnHandlers,
|
|
@@ -6,7 +6,8 @@ import type {
|
|
|
6
6
|
FeeOption,
|
|
7
7
|
DepositSignature,
|
|
8
8
|
ExecuteIntentResponse,
|
|
9
|
-
|
|
9
|
+
TrailsContracts,
|
|
10
|
+
} from "@0xtrails/api"
|
|
10
11
|
import type { CheckoutOnHandlers } from "../../widget/hooks/useCheckout.js"
|
|
11
12
|
import type { TransactionState } from "../../transactions.js"
|
|
12
13
|
import { logger } from "../../logger.js"
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
getPaymasterGaslessTransaction,
|
|
19
20
|
sendPaymasterGaslessTransaction,
|
|
20
21
|
} from "../../paymasterSend.js"
|
|
21
|
-
import { TRAILS_INTENT_ENTRYPOINT_ADDRESS } from "../../constants.js"
|
|
22
22
|
import {
|
|
23
23
|
getNeedsIntentEntrypointApproval,
|
|
24
24
|
getUserNonce,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from "../../gasless.js"
|
|
29
29
|
import { getIsUserRejectionError } from "../../error.js"
|
|
30
30
|
import { getChainRpcClient } from "../../chains.js"
|
|
31
|
+
import { TRAILS_CONTRACTS } from "../../constants.js"
|
|
31
32
|
|
|
32
33
|
export async function attemptGaslessDeposit({
|
|
33
34
|
paymasterUrl,
|
|
@@ -57,6 +58,7 @@ export async function attemptGaslessDeposit({
|
|
|
57
58
|
account: Account
|
|
58
59
|
trailsClient: TrailsApi
|
|
59
60
|
feeOptions?: GasFeeOptions
|
|
61
|
+
trailsContracts?: TrailsContracts
|
|
60
62
|
selectedFeeOption?: FeeOption | null
|
|
61
63
|
abortSignal?: AbortSignal
|
|
62
64
|
checkoutOnHandlers?: Partial<CheckoutOnHandlers>
|
|
@@ -91,7 +93,7 @@ export async function attemptGaslessDeposit({
|
|
|
91
93
|
logger.console.log("[trails-sdk] [GASLESS-FLOW] Intent entrypoint check:", {
|
|
92
94
|
chainId: chain.id,
|
|
93
95
|
chainName: chain.name,
|
|
94
|
-
intentEntrypoint:
|
|
96
|
+
intentEntrypoint: TRAILS_CONTRACTS.trailsIntentEntrypointAddress,
|
|
95
97
|
})
|
|
96
98
|
|
|
97
99
|
// NEW FLOW: Use Intent Entrypoint API with EIP-2162 permit signature support
|
|
@@ -290,7 +292,8 @@ export async function attemptGaslessDeposit({
|
|
|
290
292
|
client: publicClient,
|
|
291
293
|
token: depositTokenAddress as `0x${string}`,
|
|
292
294
|
account: account.address,
|
|
293
|
-
entrypoint:
|
|
295
|
+
entrypoint:
|
|
296
|
+
TRAILS_CONTRACTS.trailsIntentEntrypointAddress as `0x${string}`,
|
|
294
297
|
amount: requiredAmount, // Check if we have enough allowance for this specific transaction
|
|
295
298
|
})
|
|
296
299
|
|
|
@@ -343,7 +346,8 @@ export async function attemptGaslessDeposit({
|
|
|
343
346
|
publicClient,
|
|
344
347
|
walletClient,
|
|
345
348
|
signer: account.address,
|
|
346
|
-
spender:
|
|
349
|
+
spender:
|
|
350
|
+
TRAILS_CONTRACTS.trailsIntentEntrypointAddress as `0x${string}`,
|
|
347
351
|
tokenAddress: depositTokenAddress as `0x${string}`,
|
|
348
352
|
amount: permitAmount, // Infinite approval
|
|
349
353
|
chain,
|
|
@@ -375,7 +379,8 @@ export async function attemptGaslessDeposit({
|
|
|
375
379
|
const nonce = await getUserNonce({
|
|
376
380
|
publicClient,
|
|
377
381
|
userAddress: account.address,
|
|
378
|
-
intentEntrypoint:
|
|
382
|
+
intentEntrypoint:
|
|
383
|
+
TRAILS_CONTRACTS.trailsIntentEntrypointAddress as `0x${string}`,
|
|
379
384
|
})
|
|
380
385
|
logger.console.log("[trails-sdk] User nonce:", nonce.toString())
|
|
381
386
|
|
|
@@ -414,7 +419,8 @@ export async function attemptGaslessDeposit({
|
|
|
414
419
|
intentAddress: depositRecipient as `0x${string}`,
|
|
415
420
|
deadline: BigInt(deadline),
|
|
416
421
|
chainId: originChainId,
|
|
417
|
-
contractAddress:
|
|
422
|
+
contractAddress:
|
|
423
|
+
TRAILS_CONTRACTS.trailsIntentEntrypointAddress as `0x${string}`,
|
|
418
424
|
nonce,
|
|
419
425
|
feeAmount: BigInt(selectedFeeOption?.amount || "0"),
|
|
420
426
|
feeCollector: feeCollectorAddress,
|
|
@@ -71,7 +71,7 @@ export async function attemptStandardDeposit({
|
|
|
71
71
|
recipient?: string
|
|
72
72
|
destinationCalldata?: string
|
|
73
73
|
}): Promise<TransactionReceipt | null> {
|
|
74
|
-
console.log("
|
|
74
|
+
logger.console.log("[trails-sdk] [STANDARD DEPOSIT] initiating deposit...")
|
|
75
75
|
let depositUserTxnReceipt: TransactionReceipt | null = null
|
|
76
76
|
const needsNativeFee = false
|
|
77
77
|
|
|
@@ -5,10 +5,10 @@ import type {
|
|
|
5
5
|
WalletClient,
|
|
6
6
|
TransactionReceipt,
|
|
7
7
|
} from "viem"
|
|
8
|
-
import { JsonEncode } from "@
|
|
8
|
+
import { JsonEncode } from "@0xtrails/api"
|
|
9
9
|
import { getChainRpcClient } from "../../chains.js"
|
|
10
|
-
import type { FeeOption, TrailsApi } from "@
|
|
11
|
-
import type { IntentTransaction } from "@
|
|
10
|
+
import type { FeeOption, TrailsApi } from "@0xtrails/api"
|
|
11
|
+
import type { IntentTransaction } from "@0xtrails/api"
|
|
12
12
|
import type { PrepareSendReturn, SendReturn } from "../types.js"
|
|
13
13
|
import type { TransactionState } from "../../transactions.js"
|
|
14
14
|
import type { CheckoutOnHandlers } from "../../widget/hooks/useCheckout.js"
|
|
@@ -17,13 +17,10 @@ import type {
|
|
|
17
17
|
CommitIntentResponse,
|
|
18
18
|
DepositSignature,
|
|
19
19
|
ExecuteIntentResponse,
|
|
20
|
-
} from "@
|
|
20
|
+
} from "@0xtrails/api"
|
|
21
21
|
import { TradeType } from "../types.js"
|
|
22
22
|
import { logger } from "../../logger.js"
|
|
23
|
-
import {
|
|
24
|
-
isTestnetDebugMode,
|
|
25
|
-
getTestnetOriginTokenAddress,
|
|
26
|
-
} from "../utils/testnetHelpers.js"
|
|
23
|
+
import { isTestnetDebugMode } from "../utils/testnetHelpers.js"
|
|
27
24
|
import { getNormalizedQuoteObject } from "../quote/normalizeQuote.js"
|
|
28
25
|
import { getChainInfo, getTestnetChainInfo } from "../../chains.js"
|
|
29
26
|
import { getTransactionStateFromReceipt } from "../execution/transactionState.js"
|
|
@@ -34,7 +31,7 @@ import {
|
|
|
34
31
|
buildCrossChainDepositParams,
|
|
35
32
|
} from "../../intents.js"
|
|
36
33
|
import {
|
|
37
|
-
|
|
34
|
+
decodeTokenSweeperEvents,
|
|
38
35
|
decodeGuestModuleEvents,
|
|
39
36
|
} from "../../decoders.js"
|
|
40
37
|
import { updatePersistentToast } from "../../toast.js"
|
|
@@ -54,7 +51,7 @@ import {
|
|
|
54
51
|
} from "../../transactions.js"
|
|
55
52
|
import { trackPaymentCompleted, trackPaymentError } from "../../analytics.js"
|
|
56
53
|
import { pollIntentReceipt } from "../../intentReceiptPoller.js"
|
|
57
|
-
import type { IntentReceipt } from "@
|
|
54
|
+
import type { IntentReceipt } from "@0xtrails/api"
|
|
58
55
|
import { POLLING_INTERVALS } from "../constants.js"
|
|
59
56
|
|
|
60
57
|
/**
|
|
@@ -131,6 +128,8 @@ export async function handleCrossChain({
|
|
|
131
128
|
sequenceProjectAccessKey,
|
|
132
129
|
sequenceIndexerUrl,
|
|
133
130
|
isSmartWallet,
|
|
131
|
+
trailsApiKey,
|
|
132
|
+
trailsApiUrl,
|
|
134
133
|
}: {
|
|
135
134
|
mainSignerAddress: string
|
|
136
135
|
originChainId: number
|
|
@@ -162,7 +161,7 @@ export async function handleCrossChain({
|
|
|
162
161
|
originNativeTokenPriceUsd?: number | null
|
|
163
162
|
quoteProvider?: string | null
|
|
164
163
|
fundMethod?: string
|
|
165
|
-
mode?: "pay" | "fund" | "earn" | "swap"
|
|
164
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
166
165
|
checkoutOnHandlers?: Partial<CheckoutOnHandlers>
|
|
167
166
|
selectedFeeOption?: FeeOption | null
|
|
168
167
|
walletId?: string
|
|
@@ -176,6 +175,8 @@ export async function handleCrossChain({
|
|
|
176
175
|
sequenceProjectAccessKey?: string
|
|
177
176
|
sequenceIndexerUrl?: string
|
|
178
177
|
isSmartWallet?: boolean
|
|
178
|
+
trailsApiKey?: string
|
|
179
|
+
trailsApiUrl?: string
|
|
179
180
|
}): Promise<PrepareSendReturn> {
|
|
180
181
|
const salt = Date.now().toString()
|
|
181
182
|
|
|
@@ -203,7 +204,7 @@ export async function handleCrossChain({
|
|
|
203
204
|
intentArgs,
|
|
204
205
|
)
|
|
205
206
|
|
|
206
|
-
const { intent, gasFeeOptions } = await quoteIntent(
|
|
207
|
+
const { intent, gasFeeOptions, trailsContracts } = await quoteIntent(
|
|
207
208
|
trailsClient,
|
|
208
209
|
intentArgs,
|
|
209
210
|
{
|
|
@@ -214,6 +215,10 @@ export async function handleCrossChain({
|
|
|
214
215
|
)
|
|
215
216
|
logger.console.log("[trails-sdk] Quote intent:", intent)
|
|
216
217
|
logger.console.log("[trails-sdk] Quote intent gasFeeOptions:", gasFeeOptions)
|
|
218
|
+
logger.console.log(
|
|
219
|
+
"[trails-sdk] Quote intent trailsContracts:",
|
|
220
|
+
trailsContracts,
|
|
221
|
+
)
|
|
217
222
|
|
|
218
223
|
if (!intent.originPrecondition || !intent.originCalls) {
|
|
219
224
|
throw new Error("Invalid intent")
|
|
@@ -227,9 +232,17 @@ export async function handleCrossChain({
|
|
|
227
232
|
|
|
228
233
|
// Use depositTransaction amount - this is the actual amount to deposit
|
|
229
234
|
const depositAmount = intent.depositTransaction.amount?.toString()
|
|
235
|
+
if (!depositAmount) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
"Invalid intent: depositTransaction.amount is missing or undefined",
|
|
238
|
+
)
|
|
239
|
+
}
|
|
230
240
|
|
|
231
241
|
const quoteToAmount = intent.quote.toAmount
|
|
232
242
|
const quoteToAmountMin = intent.quote.toAmountMin
|
|
243
|
+
if (!quoteToAmount) {
|
|
244
|
+
throw new Error("Invalid intent: quote.toAmount is missing or undefined")
|
|
245
|
+
}
|
|
233
246
|
|
|
234
247
|
const originSendAmountFormatted = formatRawAmount(
|
|
235
248
|
depositAmount,
|
|
@@ -246,9 +259,11 @@ export async function handleCrossChain({
|
|
|
246
259
|
usdPrice: sourceTokenPriceUsd,
|
|
247
260
|
originTokenSymbol,
|
|
248
261
|
originSendAmountFormatted,
|
|
262
|
+
depositAmount,
|
|
263
|
+
sourceTokenDecimals,
|
|
249
264
|
})
|
|
250
265
|
|
|
251
|
-
const effectiveDestinationTokenAmount = quoteToAmount
|
|
266
|
+
const effectiveDestinationTokenAmount = quoteToAmount.toString()
|
|
252
267
|
const effectiveDestinationTokenAmountFormatted = formatRawAmount(
|
|
253
268
|
effectiveDestinationTokenAmount,
|
|
254
269
|
destinationTokenDecimals,
|
|
@@ -259,6 +274,18 @@ export async function handleCrossChain({
|
|
|
259
274
|
usdPrice: destinationTokenPriceUsd,
|
|
260
275
|
})
|
|
261
276
|
|
|
277
|
+
logger.console.log(
|
|
278
|
+
"[trails-sdk] effectiveDestinationTokenAmountUsd calculation",
|
|
279
|
+
{
|
|
280
|
+
effectiveDestinationTokenAmount,
|
|
281
|
+
effectiveDestinationTokenAmountFormatted,
|
|
282
|
+
destinationTokenDecimals,
|
|
283
|
+
destinationTokenPriceUsd,
|
|
284
|
+
effectiveDestinationTokenAmountUsd,
|
|
285
|
+
quoteToAmount,
|
|
286
|
+
},
|
|
287
|
+
)
|
|
288
|
+
|
|
262
289
|
logger.console.log(
|
|
263
290
|
"[trails-sdk] effectiveDestinationTokenAmountUsd",
|
|
264
291
|
effectiveDestinationTokenAmountUsd,
|
|
@@ -327,6 +354,8 @@ export async function handleCrossChain({
|
|
|
327
354
|
originDepositAddress: originIntentAddress,
|
|
328
355
|
destinationDepositAddress: intent.destinationIntentAddress,
|
|
329
356
|
destinationAddress: recipient,
|
|
357
|
+
trailsApiKey: trailsApiKey || "",
|
|
358
|
+
trailsApiUrl: trailsApiUrl || "",
|
|
330
359
|
destinationCalldata,
|
|
331
360
|
originAmount: depositAmount,
|
|
332
361
|
destinationAmount: quoteToAmount.toString(),
|
|
@@ -451,9 +480,7 @@ export async function handleCrossChain({
|
|
|
451
480
|
const effectiveOriginChain = testnet
|
|
452
481
|
? getTestnetChainInfo(chain)!
|
|
453
482
|
: chain
|
|
454
|
-
const effectiveOriginTokenAddress =
|
|
455
|
-
? getTestnetOriginTokenAddress(effectiveOriginChain.id)
|
|
456
|
-
: originTokenAddress
|
|
483
|
+
const effectiveOriginTokenAddress = originTokenAddress
|
|
457
484
|
|
|
458
485
|
logger.console.log("[trails-sdk] testnet", testnet)
|
|
459
486
|
|
|
@@ -523,6 +550,7 @@ export async function handleCrossChain({
|
|
|
523
550
|
destinationTokenSymbol,
|
|
524
551
|
depositAmountUsd,
|
|
525
552
|
feeOptions: gasFeeOptions,
|
|
553
|
+
trailsContracts,
|
|
526
554
|
checkoutOnHandlers,
|
|
527
555
|
trailsClient,
|
|
528
556
|
selectedFeeOption: effectiveSelectedFeeOption,
|
|
@@ -578,12 +606,12 @@ export async function handleCrossChain({
|
|
|
578
606
|
}
|
|
579
607
|
|
|
580
608
|
try {
|
|
581
|
-
transactionStates[0].
|
|
582
|
-
|
|
609
|
+
transactionStates[0].decodedTokenSweeperEvents =
|
|
610
|
+
decodeTokenSweeperEvents(depositUserTxnReceipt)
|
|
583
611
|
transactionStates[0].decodedGuestModuleEvents =
|
|
584
612
|
decodeGuestModuleEvents(depositUserTxnReceipt)
|
|
585
613
|
transactionStates[0].refunded =
|
|
586
|
-
transactionStates[0].
|
|
614
|
+
transactionStates[0].decodedTokenSweeperEvents.findIndex(
|
|
587
615
|
(event) =>
|
|
588
616
|
event.type === "Refund" || event.type === "RefundAndSweep",
|
|
589
617
|
) !== -1
|
|
@@ -595,7 +623,7 @@ export async function handleCrossChain({
|
|
|
595
623
|
transactionStates[0].decodedGuestModuleEvents || []
|
|
596
624
|
).filter((e: any) => e?.type === "CallFailed").length,
|
|
597
625
|
sweeperEvents: (
|
|
598
|
-
transactionStates[0].
|
|
626
|
+
transactionStates[0].decodedTokenSweeperEvents || []
|
|
599
627
|
).length,
|
|
600
628
|
refunded: transactionStates[0].refunded,
|
|
601
629
|
},
|
|
@@ -967,12 +995,12 @@ export async function handleCrossChain({
|
|
|
967
995
|
|
|
968
996
|
// Decode events for the deposit transaction
|
|
969
997
|
try {
|
|
970
|
-
transactionStates[0].
|
|
971
|
-
|
|
998
|
+
transactionStates[0].decodedTokenSweeperEvents =
|
|
999
|
+
decodeTokenSweeperEvents(depositTxReceipt)
|
|
972
1000
|
transactionStates[0].decodedGuestModuleEvents =
|
|
973
1001
|
decodeGuestModuleEvents(depositTxReceipt)
|
|
974
1002
|
transactionStates[0].refunded =
|
|
975
|
-
transactionStates[0].
|
|
1003
|
+
transactionStates[0].decodedTokenSweeperEvents.findIndex(
|
|
976
1004
|
(event) =>
|
|
977
1005
|
event.type === "Refund" ||
|
|
978
1006
|
event.type === "RefundAndSweep",
|
|
@@ -987,8 +1015,8 @@ export async function handleCrossChain({
|
|
|
987
1015
|
).filter((e: any) => e?.type === "CallFailed")
|
|
988
1016
|
.length,
|
|
989
1017
|
sweeperEvents: (
|
|
990
|
-
transactionStates[0]
|
|
991
|
-
|
|
1018
|
+
transactionStates[0].decodedTokenSweeperEvents ||
|
|
1019
|
+
[]
|
|
992
1020
|
).length,
|
|
993
1021
|
refunded: transactionStates[0].refunded,
|
|
994
1022
|
},
|
|
@@ -1082,12 +1110,12 @@ export async function handleCrossChain({
|
|
|
1082
1110
|
|
|
1083
1111
|
// Decode events for the origin transaction
|
|
1084
1112
|
try {
|
|
1085
|
-
transactionStates[1]!.
|
|
1086
|
-
|
|
1113
|
+
transactionStates[1]!.decodedTokenSweeperEvents =
|
|
1114
|
+
decodeTokenSweeperEvents(originTxnReceipt)
|
|
1087
1115
|
transactionStates[1]!.decodedGuestModuleEvents =
|
|
1088
1116
|
decodeGuestModuleEvents(originTxnReceipt)
|
|
1089
1117
|
transactionStates[1]!.refunded =
|
|
1090
|
-
transactionStates[1]!.
|
|
1118
|
+
transactionStates[1]!.decodedTokenSweeperEvents.findIndex(
|
|
1091
1119
|
(event) =>
|
|
1092
1120
|
event.type === "Refund" ||
|
|
1093
1121
|
event.type === "RefundAndSweep",
|
|
@@ -1098,8 +1126,7 @@ export async function handleCrossChain({
|
|
|
1098
1126
|
transactionStates[1]!.decodedGuestModuleEvents || []
|
|
1099
1127
|
).filter((e: any) => e?.type === "CallFailed").length,
|
|
1100
1128
|
sweeperEvents: (
|
|
1101
|
-
transactionStates[1]!.
|
|
1102
|
-
[]
|
|
1129
|
+
transactionStates[1]!.decodedTokenSweeperEvents || []
|
|
1103
1130
|
).length,
|
|
1104
1131
|
refunded: transactionStates[1]!.refunded,
|
|
1105
1132
|
})
|
|
@@ -1183,17 +1210,17 @@ export async function handleCrossChain({
|
|
|
1183
1210
|
|
|
1184
1211
|
// Decode events for the destination transaction
|
|
1185
1212
|
try {
|
|
1186
|
-
transactionStates[2]!.
|
|
1187
|
-
|
|
1213
|
+
transactionStates[2]!.decodedTokenSweeperEvents =
|
|
1214
|
+
decodeTokenSweeperEvents(destinationTxnReceipt)
|
|
1188
1215
|
transactionStates[2]!.decodedGuestModuleEvents =
|
|
1189
1216
|
decodeGuestModuleEvents(destinationTxnReceipt)
|
|
1190
1217
|
transactionStates[2]!.refunded =
|
|
1191
|
-
transactionStates[2]!.
|
|
1218
|
+
transactionStates[2]!.decodedTokenSweeperEvents.findIndex(
|
|
1192
1219
|
(event) =>
|
|
1193
1220
|
event.type === "Refund" ||
|
|
1194
1221
|
event.type === "RefundAndSweep",
|
|
1195
1222
|
) !== -1 ||
|
|
1196
|
-
(transactionStates[2]!.
|
|
1223
|
+
(transactionStates[2]!.decodedTokenSweeperEvents.findIndex(
|
|
1197
1224
|
(event) => event.type === "Sweep",
|
|
1198
1225
|
) !== -1 &&
|
|
1199
1226
|
transactionStates[2]!.decodedGuestModuleEvents.findIndex(
|
|
@@ -1207,8 +1234,7 @@ export async function handleCrossChain({
|
|
|
1207
1234
|
transactionStates[2]!.decodedGuestModuleEvents || []
|
|
1208
1235
|
).filter((e: any) => e?.type === "CallFailed").length,
|
|
1209
1236
|
sweeperEvents: (
|
|
1210
|
-
transactionStates[2]
|
|
1211
|
-
.decodedTrailsTokenSweeperEvents || []
|
|
1237
|
+
transactionStates[2]!.decodedTokenSweeperEvents || []
|
|
1212
1238
|
).length,
|
|
1213
1239
|
refunded: transactionStates[2]!.refunded,
|
|
1214
1240
|
},
|
|
@@ -1519,13 +1545,25 @@ export async function handleCrossChain({
|
|
|
1519
1545
|
destinationChainId,
|
|
1520
1546
|
mode,
|
|
1521
1547
|
fundMethod,
|
|
1522
|
-
originTokenSymbol,
|
|
1523
1548
|
originTokenAddress,
|
|
1549
|
+
originTokenSymbol,
|
|
1550
|
+
originTokenAmount: depositAmount,
|
|
1551
|
+
originTokenAmountFormatted: originSendAmountFormatted,
|
|
1524
1552
|
destinationTokenAddress,
|
|
1525
1553
|
destinationTokenSymbol,
|
|
1554
|
+
depositTokenAmount: depositAmount,
|
|
1555
|
+
depositTokenAmountFormatted: originSendAmountFormatted,
|
|
1526
1556
|
depositTokenAmountUsd: depositAmountUsd?.toString(),
|
|
1557
|
+
destinationTokenAmount: effectiveDestinationTokenAmount,
|
|
1558
|
+
destinationTokenAmountFormatted:
|
|
1559
|
+
effectiveDestinationTokenAmountFormatted,
|
|
1527
1560
|
destinationTokenAmountUsd:
|
|
1528
1561
|
effectiveDestinationTokenAmountUsd?.toString(),
|
|
1562
|
+
originTokenDecimals: sourceTokenDecimals,
|
|
1563
|
+
destinationTokenDecimals: destinationTokenDecimals,
|
|
1564
|
+
tradeType: tradeType.toString(),
|
|
1565
|
+
sourceTokenPriceUsd: sourceTokenPriceUsd,
|
|
1566
|
+
destinationTokenPriceUsd: destinationTokenPriceUsd,
|
|
1529
1567
|
})
|
|
1530
1568
|
|
|
1531
1569
|
// Call onCheckoutComplete callback with transaction status
|