0xtrails 0.13.2 → 0.15.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/abis/requireUtils.d.ts +134 -0
- package/dist/abis/requireUtils.d.ts.map +1 -0
- package/dist/abis/trailsHydrate.d.ts +6 -42
- package/dist/abis/trailsHydrate.d.ts.map +1 -1
- package/dist/abis/trailsRouter.d.ts +1 -1
- package/dist/abis/trailsRouter.d.ts.map +1 -1
- package/dist/actions/actionBuilder.d.ts +414 -0
- package/dist/actions/actionBuilder.d.ts.map +1 -0
- package/dist/actions/constants.d.ts +1853 -0
- package/dist/actions/constants.d.ts.map +1 -0
- package/dist/actions/custom-integrations/sushiswapV3/addresses.d.ts +4 -0
- package/dist/actions/custom-integrations/sushiswapV3/addresses.d.ts.map +1 -0
- package/dist/actions/custom-integrations/sushiswapV3/calldata.d.ts +4 -0
- package/dist/actions/custom-integrations/sushiswapV3/calldata.d.ts.map +1 -0
- package/dist/actions/custom-integrations/sushiswapV3/calls.d.ts +28 -0
- package/dist/actions/custom-integrations/sushiswapV3/calls.d.ts.map +1 -0
- package/dist/actions/custom-integrations/sushiswapV3/helpers.d.ts +15 -0
- package/dist/actions/custom-integrations/sushiswapV3/helpers.d.ts.map +1 -0
- package/dist/actions/custom-integrations/sushiswapV3/sushiswapV3.d.ts +9 -0
- package/dist/actions/custom-integrations/sushiswapV3/sushiswapV3.d.ts.map +1 -0
- package/dist/actions/custom-integrations/sushiswapV3/types.d.ts +95 -0
- package/dist/actions/custom-integrations/sushiswapV3/types.d.ts.map +1 -0
- package/dist/actions/custom-integrations/uniswapV3/addresses.d.ts +4 -0
- package/dist/actions/custom-integrations/uniswapV3/addresses.d.ts.map +1 -0
- package/dist/actions/custom-integrations/uniswapV3/calldata.d.ts +4 -0
- package/dist/actions/custom-integrations/uniswapV3/calldata.d.ts.map +1 -0
- package/dist/actions/custom-integrations/uniswapV3/calls.d.ts +50 -0
- package/dist/actions/custom-integrations/uniswapV3/calls.d.ts.map +1 -0
- package/dist/actions/custom-integrations/uniswapV3/helpers.d.ts +23 -0
- package/dist/actions/custom-integrations/uniswapV3/helpers.d.ts.map +1 -0
- package/dist/actions/custom-integrations/uniswapV3/types.d.ts +90 -0
- package/dist/actions/custom-integrations/uniswapV3/types.d.ts.map +1 -0
- package/dist/actions/custom-integrations/uniswapV3/uniswapV3.d.ts +9 -0
- package/dist/actions/custom-integrations/uniswapV3/uniswapV3.d.ts.map +1 -0
- package/dist/actions/destinationCalls.d.ts +17 -0
- package/dist/actions/destinationCalls.d.ts.map +1 -0
- package/dist/actions/dynamic.d.ts +97 -0
- package/dist/actions/dynamic.d.ts.map +1 -0
- package/dist/actions/hooks/useEarnBalances.d.ts +53 -0
- package/dist/actions/hooks/useEarnBalances.d.ts.map +1 -0
- package/dist/actions/hooks/useEarnMarkets.d.ts +29 -0
- package/dist/actions/hooks/useEarnMarkets.d.ts.map +1 -0
- package/dist/actions/hooks/useEarnProviders.d.ts +18 -0
- package/dist/actions/hooks/useEarnProviders.d.ts.map +1 -0
- package/dist/actions/hooks/useResolveActions.d.ts +28 -0
- package/dist/actions/hooks/useResolveActions.d.ts.map +1 -0
- package/dist/actions/index.d.ts +8 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +13 -0
- package/dist/actions/resolvers.d.ts +30 -0
- package/dist/actions/resolvers.d.ts.map +1 -0
- package/dist/actions/types/earn.d.ts +51 -0
- package/dist/actions/types/earn.d.ts.map +1 -0
- package/dist/actions/types.d.ts +303 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/utils.d.ts +181 -0
- package/dist/actions/utils.d.ts.map +1 -0
- package/dist/{widget/analytics → analytics/hooks}/useWidgetAnalytics.d.ts +2 -4
- package/dist/analytics/hooks/useWidgetAnalytics.d.ts.map +1 -0
- package/dist/analytics.d.ts.map +1 -1
- package/dist/chainSwitch.d.ts.map +1 -1
- package/dist/chains-DttlfV-6.js +4 -0
- package/dist/chains-ccVR_-73.js +655 -0
- package/dist/chains.d.ts +0 -1
- package/dist/chains.d.ts.map +1 -1
- package/dist/committedIntentStore.d.ts +5 -0
- package/dist/committedIntentStore.d.ts.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/error.d.ts +73 -4
- package/dist/error.d.ts.map +1 -1
- package/dist/hooks/persistedToken.d.ts +22 -0
- package/dist/hooks/persistedToken.d.ts.map +1 -0
- package/dist/hooks/prepareTrailsSendTransactionDestination.d.ts +26 -0
- package/dist/hooks/prepareTrailsSendTransactionDestination.d.ts.map +1 -0
- package/dist/hooks/useAddressWalletIcon.d.ts.map +1 -0
- package/dist/hooks/useAmountUsd.d.ts.map +1 -0
- package/dist/hooks/useBalanceVisible.d.ts.map +1 -0
- package/dist/hooks/useChainFilter.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useCheckout.d.ts +15 -15
- package/dist/hooks/useCheckout.d.ts.map +1 -0
- package/dist/hooks/useClickTracking.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useCombinedHistory.d.ts +3 -2
- package/dist/hooks/useCombinedHistory.d.ts.map +1 -0
- package/dist/hooks/useConnector.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useCustomTokenSearch.d.ts +3 -2
- package/dist/hooks/useCustomTokenSearch.d.ts.map +1 -0
- package/dist/hooks/useDebounce.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useDebugScreens.d.ts +2 -2
- package/dist/hooks/useDebugScreens.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useDefaultDestinationToken.d.ts +1 -1
- package/dist/hooks/useDefaultDestinationToken.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useDefaultOriginToken.d.ts +1 -1
- package/dist/hooks/useDefaultOriginToken.d.ts.map +1 -0
- package/dist/hooks/useDepositMonitor.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useDestinationSelectedToken.d.ts +10 -2
- package/dist/hooks/useDestinationSelectedToken.d.ts.map +1 -0
- package/dist/hooks/useDisplayCurrencyPreference.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useEarnPool.d.ts +1 -1
- package/dist/hooks/useEarnPool.d.ts.map +1 -0
- package/dist/hooks/useEffectiveFundBalance.d.ts +28 -0
- package/dist/hooks/useEffectiveFundBalance.d.ts.map +1 -0
- package/dist/hooks/useExecutingIntentsCount.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useExternalFundingReceiptSync.d.ts +1 -1
- package/dist/hooks/useExternalFundingReceiptSync.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useFiatOnRampCurrencies.d.ts +1 -1
- package/dist/hooks/useFiatOnRampCurrencies.d.ts.map +1 -0
- package/dist/hooks/useFiatSelectedCurrency.d.ts.map +1 -0
- package/dist/hooks/useGetIntent.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useIntentReceiptBalances.d.ts +1 -1
- package/dist/hooks/useIntentReceiptBalances.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useIntentTransactionHistory.d.ts +2 -1
- package/dist/hooks/useIntentTransactionHistory.d.ts.map +1 -0
- package/dist/hooks/useIsMobile.d.ts.map +1 -0
- package/dist/hooks/useIsSequenceWallet.d.ts.map +1 -0
- package/dist/hooks/useLocalePreference.d.ts.map +1 -0
- package/dist/hooks/useMeldTransactionHistory.d.ts.map +1 -0
- package/dist/hooks/useMeldTransactionStatus.d.ts.map +1 -0
- package/dist/hooks/useOnRampCountryDefaults.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useOnRampPaymentMethods.d.ts +2 -2
- package/dist/hooks/useOnRampPaymentMethods.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useOnRampProviderWidget.d.ts +1 -1
- package/dist/hooks/useOnRampProviderWidget.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useOnRampQuote.d.ts +3 -3
- package/dist/hooks/useOnRampQuote.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useOnRampTransactionStatus.d.ts +1 -1
- package/dist/hooks/useOnRampTransactionStatus.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useOriginSelectedToken.d.ts +1 -1
- package/dist/hooks/useOriginSelectedToken.d.ts.map +1 -0
- package/dist/hooks/usePayMessage.d.ts.map +1 -0
- package/dist/hooks/usePriceImpactWarning.d.ts.map +1 -0
- package/dist/hooks/useQuote.d.ts +619 -0
- package/dist/hooks/useQuote.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useRecentTokens.d.ts +1 -1
- package/dist/hooks/useRecentTokens.d.ts.map +1 -0
- package/dist/hooks/useRecipients.d.ts.map +1 -0
- package/dist/hooks/useSelectedFeeOption.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useSelectedFundMethod.d.ts +11 -1
- package/dist/hooks/useSelectedFundMethod.d.ts.map +1 -0
- package/dist/hooks/useSelectedRecipient.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useSendForm.d.ts +10 -12
- package/dist/hooks/useSendForm.d.ts.map +1 -0
- package/dist/hooks/useSwapAmount.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useSwapState.d.ts +1 -1
- package/dist/hooks/useSwapState.d.ts.map +1 -0
- package/dist/hooks/useTargetAmount.d.ts.map +1 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useTokenList.d.ts +4 -3
- package/dist/hooks/useTokenList.d.ts.map +1 -0
- package/dist/hooks/useTrailsSendTransaction.d.ts +171 -0
- package/dist/hooks/useTrailsSendTransaction.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useViewManager.d.ts +1 -1
- package/dist/hooks/useViewManager.d.ts.map +1 -0
- package/dist/hooks/useWalletConnectUri.d.ts +19 -0
- package/dist/hooks/useWalletConnectUri.d.ts.map +1 -0
- package/dist/hooks/useWalletConnectionContext.d.ts.map +1 -0
- package/dist/{widget/hooks → hooks}/useWidgetProps.d.ts +1 -1
- package/dist/hooks/useWidgetProps.d.ts.map +1 -0
- package/dist/hydrate/builder.d.ts +131 -0
- package/dist/hydrate/builder.d.ts.map +1 -0
- package/dist/hydrate/constants.d.ts +13 -0
- package/dist/hydrate/constants.d.ts.map +1 -0
- package/dist/hydrate/encodeExecute.d.ts +73 -0
- package/dist/hydrate/encodeExecute.d.ts.map +1 -0
- package/dist/hydrate/index.d.ts +8 -0
- package/dist/hydrate/index.d.ts.map +1 -0
- package/dist/hydrate/index.js +14 -0
- package/dist/hydrate/multicall.d.ts +69 -0
- package/dist/hydrate/multicall.d.ts.map +1 -0
- package/dist/hydrate/payload.d.ts +38 -0
- package/dist/hydrate/payload.d.ts.map +1 -0
- package/dist/hydrate/selectors.d.ts +28 -0
- package/dist/hydrate/selectors.d.ts.map +1 -0
- package/dist/hydrate/source.d.ts +11 -0
- package/dist/hydrate/source.d.ts.map +1 -0
- package/dist/hydrate/types.d.ts +21 -0
- package/dist/hydrate/types.d.ts.map +1 -0
- package/dist/hydrate/utils.d.ts +8 -0
- package/dist/hydrate/utils.d.ts.map +1 -0
- package/dist/hydrate-BsQ8nPlI.js +882 -0
- package/dist/index.d.ts +47 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +189 -662
- package/dist/intentConfigStore.d.ts +8 -0
- package/dist/intentConfigStore.d.ts.map +1 -0
- package/dist/intentProtocolApi.d.ts +11 -0
- package/dist/intentProtocolApi.d.ts.map +1 -0
- package/dist/intentProtocolEncoding.d.ts +30 -0
- package/dist/intentProtocolEncoding.d.ts.map +1 -0
- package/dist/intentProtocolResolver.d.ts +28 -0
- package/dist/intentProtocolResolver.d.ts.map +1 -0
- package/dist/intentReceiptPoller.d.ts.map +1 -1
- package/dist/intentValidation.d.ts +5 -0
- package/dist/intentValidation.d.ts.map +1 -0
- package/dist/intents.d.ts.map +1 -1
- package/dist/keymachine/index.d.ts +20 -0
- package/dist/keymachine/index.d.ts.map +1 -1
- package/dist/mutations.d.ts.map +1 -1
- package/dist/offlineRecovery.d.ts +24 -0
- package/dist/offlineRecovery.d.ts.map +1 -0
- package/dist/onramp/MeshConnectFlow.d.ts +9 -0
- package/dist/onramp/MeshConnectFlow.d.ts.map +1 -1
- package/dist/onramp/MeshConnectIframe.d.ts +9 -0
- package/dist/onramp/MeshConnectIframe.d.ts.map +1 -1
- package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -1
- package/dist/onramp/mesh/components/MeshExchangeConfirmation.d.ts +10 -0
- package/dist/onramp/mesh/components/MeshExchangeConfirmation.d.ts.map +1 -0
- package/dist/onramp/mesh/components/MeshExchangeIcon.d.ts +13 -0
- package/dist/onramp/mesh/components/MeshExchangeIcon.d.ts.map +1 -0
- package/dist/{widget → onramp/mesh}/components/MeshExchangeSelection.d.ts +1 -0
- package/dist/onramp/mesh/components/MeshExchangeSelection.d.ts.map +1 -0
- package/dist/onramp/mesh/components/MeshSessionOptions.d.ts +15 -0
- package/dist/onramp/mesh/components/MeshSessionOptions.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshAccessTokens.d.ts +9 -0
- package/dist/onramp/mesh/hooks/useMeshAccessTokens.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshFundingSelection.d.ts +11 -0
- package/dist/onramp/mesh/hooks/useMeshFundingSelection.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshOnrampFlow.d.ts +71 -0
- package/dist/onramp/mesh/hooks/useMeshOnrampFlow.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.d.ts +32 -0
- package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.d.ts +19 -0
- package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.d.ts +15 -0
- package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.d.ts.map +1 -0
- package/dist/onramp/mesh/hooks/useMeshSessionStorage.d.ts +7 -0
- package/dist/onramp/mesh/hooks/useMeshSessionStorage.d.ts.map +1 -0
- package/dist/onramp/meshSessionStorage.d.ts +13 -0
- package/dist/onramp/meshSessionStorage.d.ts.map +1 -0
- package/dist/onramp/meshconnect.d.ts +6 -4
- package/dist/onramp/meshconnect.d.ts.map +1 -1
- package/dist/onramp/trailsOnramp.d.ts +8 -0
- package/dist/onramp/trailsOnramp.d.ts.map +1 -1
- package/dist/onrampClient.d.ts.map +1 -1
- package/dist/placeholder.d.ts +129 -5
- package/dist/placeholder.d.ts.map +1 -1
- package/dist/poolUtils.d.ts +0 -14
- package/dist/poolUtils.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +3 -2
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/query/balance.fetchers.d.ts +7 -1
- package/dist/query/balance.fetchers.d.ts.map +1 -1
- package/dist/query/intentProtocol.queries.d.ts +32 -0
- package/dist/query/intentProtocol.queries.d.ts.map +1 -0
- package/dist/recover.d.ts +70 -24
- package/dist/recover.d.ts.map +1 -1
- package/dist/src-CQhZqidH.js +51593 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +2 -3
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -3
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +2 -5
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/intentHandler.d.ts +5 -4
- package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +2 -2
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +4 -3
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactions.d.ts +1 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/umd/trails.min.js +1371 -409
- package/dist/utils/localStorageGc.d.ts +22 -0
- package/dist/utils/localStorageGc.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +14 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/walletUtils.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/ChainList.d.ts +2 -0
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts +2 -6
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/EarnMarkets.d.ts +9 -0
- package/dist/widget/components/EarnMarkets.d.ts.map +1 -0
- package/dist/widget/components/EarnPoolsFilters.d.ts +7 -1
- package/dist/widget/components/EarnPoolsFilters.d.ts.map +1 -1
- package/dist/widget/components/{PoolWithdraw.d.ts → EarnWithdraw.d.ts} +5 -5
- package/dist/widget/components/{PoolWithdraw.d.ts.map → EarnWithdraw.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 +1 -1
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/FiatSelector.d.ts +1 -1
- package/dist/widget/components/FiatSelector.d.ts.map +1 -1
- package/dist/widget/components/FiatSelectorButton.d.ts +1 -1
- package/dist/widget/components/FiatSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +1 -1
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.d.ts +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/HookModalContent.d.ts.map +1 -1
- package/dist/widget/components/MeldHistory.d.ts +1 -1
- package/dist/widget/components/MeldHistory.d.ts.map +1 -1
- package/dist/widget/components/MeldTransactionStatus.d.ts +1 -1
- package/dist/widget/components/MeldTransactionStatus.d.ts.map +1 -1
- package/dist/widget/components/MeshExchangeAccountHeader.d.ts +9 -0
- package/dist/widget/components/MeshExchangeAccountHeader.d.ts.map +1 -0
- package/dist/widget/components/OnrampHistoryRow.d.ts +1 -1
- package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.d.ts +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +2 -6
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PulsatingButton.d.ts +9 -0
- package/dist/widget/components/PulsatingButton.d.ts.map +1 -0
- package/dist/widget/components/Receipt.d.ts +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -6
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/TokenList.d.ts +1 -0
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts +2 -2
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts +1 -0
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TransactionHistoryItem.d.ts +1 -0
- package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WalletAccountHeader.d.ts +7 -0
- package/dist/widget/components/WalletAccountHeader.d.ts.map +1 -0
- package/dist/widget/components/WalletConfirmation.d.ts +2 -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.map +1 -1
- package/dist/widget/components/Withdraw.d.ts.map +1 -1
- package/dist/widget/components/earnMarketUtils.d.ts +11 -0
- package/dist/widget/components/earnMarketUtils.d.ts.map +1 -0
- package/dist/widget/components/earnNetworks.d.ts +6 -0
- package/dist/widget/components/earnNetworks.d.ts.map +1 -0
- package/dist/widget/index.d.ts +13 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +17 -9
- package/dist/widget/modes/EarnWidget.d.ts +90 -0
- package/dist/widget/modes/EarnWidget.d.ts.map +1 -0
- package/dist/widget/modes/FundWidget.d.ts +97 -0
- package/dist/widget/modes/FundWidget.d.ts.map +1 -0
- package/dist/widget/modes/PayWidget.d.ts +80 -0
- package/dist/widget/modes/PayWidget.d.ts.map +1 -0
- package/dist/widget/modes/SwapWidget.d.ts +76 -0
- package/dist/widget/modes/SwapWidget.d.ts.map +1 -0
- package/dist/widget/modes/WithdrawWidget.d.ts +87 -0
- package/dist/widget/modes/WithdrawWidget.d.ts.map +1 -0
- package/dist/widget/providers/TrailsProvider.d.ts +3 -0
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/providers/WidgetProviderTree.d.ts.map +1 -1
- package/dist/widget/shared/destinationDefaultToken.d.ts +15 -0
- package/dist/widget/shared/destinationDefaultToken.d.ts.map +1 -0
- package/dist/widget/shared/mapSharedProps.d.ts +9 -0
- package/dist/widget/shared/mapSharedProps.d.ts.map +1 -0
- package/dist/widget/shared/methodMap.d.ts +18 -0
- package/dist/widget/shared/methodMap.d.ts.map +1 -0
- package/dist/widget/shared/resolution.d.ts +23 -0
- package/dist/widget/shared/resolution.d.ts.map +1 -0
- package/dist/widget/shared/resolvePaymentSource.d.ts +36 -0
- package/dist/widget/shared/resolvePaymentSource.d.ts.map +1 -0
- package/dist/widget/shared/tokenAllowlist.d.ts +36 -0
- package/dist/widget/shared/tokenAllowlist.d.ts.map +1 -0
- package/dist/widget/shared/types.d.ts +150 -0
- package/dist/widget/shared/types.d.ts.map +1 -0
- package/dist/widget/styles.gen.d.ts +2 -0
- package/dist/widget/styles.gen.d.ts.map +1 -0
- package/dist/widget/types/commonProps.d.ts +3 -7
- package/dist/widget/types/commonProps.d.ts.map +1 -1
- package/dist/widget/utils/fundMethodSwitchState.d.ts +1 -0
- package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
- package/dist/widget/utils/viewManagerGuards.d.ts +1 -1
- package/dist/widget/utils/viewManagerGuards.d.ts.map +1 -1
- package/dist/widget/widget.d.ts +23 -16
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +22 -23
- package/dist/buffer.d.ts +0 -3
- package/dist/buffer.d.ts.map +0 -1
- package/dist/ccip-CT_An6eM.js +0 -230
- package/dist/index-RfqL5Foz.js +0 -114567
- package/dist/paymasterSend.d.ts +0 -90
- package/dist/paymasterSend.d.ts.map +0 -1
- package/dist/sendUserOp.d.ts +0 -122
- package/dist/sendUserOp.d.ts.map +0 -1
- package/dist/toSimpleSmartAccount.d.ts +0 -95
- package/dist/toSimpleSmartAccount.d.ts.map +0 -1
- package/dist/transactionIntent/utils/erc20Approval.d.ts +0 -34
- package/dist/transactionIntent/utils/erc20Approval.d.ts.map +0 -1
- package/dist/utils/allowance.d.ts +0 -19
- package/dist/utils/allowance.d.ts.map +0 -1
- package/dist/widget/analytics/useWidgetAnalytics.d.ts.map +0 -1
- package/dist/widget/components/FeeBreakdown.d.ts +0 -9
- package/dist/widget/components/FeeBreakdown.d.ts.map +0 -1
- package/dist/widget/components/HideBalances.d.ts +0 -4
- package/dist/widget/components/HideBalances.d.ts.map +0 -1
- package/dist/widget/components/MeshExchangeSelection.d.ts.map +0 -1
- package/dist/widget/components/OnrampDeposit.d.ts +0 -10
- package/dist/widget/components/OnrampDeposit.d.ts.map +0 -1
- package/dist/widget/components/SwapSettings.d.ts +0 -4
- package/dist/widget/components/SwapSettings.d.ts.map +0 -1
- package/dist/widget/components/TruncatedAddress.d.ts +0 -12
- package/dist/widget/components/TruncatedAddress.d.ts.map +0 -1
- package/dist/widget/components/WalletImage.d.ts +0 -8
- package/dist/widget/components/WalletImage.d.ts.map +0 -1
- package/dist/widget/css/compiled.css +0 -26
- package/dist/widget/css/index.css +0 -686
- package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +0 -1
- package/dist/widget/hooks/useAmountUsd.d.ts.map +0 -1
- package/dist/widget/hooks/useBalanceVisible.d.ts.map +0 -1
- package/dist/widget/hooks/useChainFilter.d.ts.map +0 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +0 -1
- package/dist/widget/hooks/useClickTracking.d.ts.map +0 -1
- package/dist/widget/hooks/useCombinedHistory.d.ts.map +0 -1
- package/dist/widget/hooks/useConnector.d.ts.map +0 -1
- package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +0 -1
- package/dist/widget/hooks/useDebounce.d.ts.map +0 -1
- package/dist/widget/hooks/useDebugScreens.d.ts.map +0 -1
- package/dist/widget/hooks/useDefaultDestinationToken.d.ts.map +0 -1
- package/dist/widget/hooks/useDefaultOriginToken.d.ts.map +0 -1
- package/dist/widget/hooks/useDepositMonitor.d.ts.map +0 -1
- package/dist/widget/hooks/useDestinationSelectedToken.d.ts.map +0 -1
- package/dist/widget/hooks/useDisplayCurrencyPreference.d.ts.map +0 -1
- package/dist/widget/hooks/useEarnPool.d.ts.map +0 -1
- package/dist/widget/hooks/useExecutingIntentsCount.d.ts.map +0 -1
- package/dist/widget/hooks/useExternalFundingReceiptSync.d.ts.map +0 -1
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +0 -1
- package/dist/widget/hooks/useFiatSelectedCurrency.d.ts.map +0 -1
- package/dist/widget/hooks/useGetIntent.d.ts.map +0 -1
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +0 -1
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +0 -1
- package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts +0 -7
- package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts.map +0 -1
- package/dist/widget/hooks/useIsMobile.d.ts.map +0 -1
- package/dist/widget/hooks/useIsSequenceWallet.d.ts.map +0 -1
- package/dist/widget/hooks/useLocalePreference.d.ts.map +0 -1
- package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +0 -1
- package/dist/widget/hooks/useMeldTransactionStatus.d.ts.map +0 -1
- package/dist/widget/hooks/useOnRampCountryDefaults.d.ts.map +0 -1
- package/dist/widget/hooks/useOnRampPaymentMethods.d.ts.map +0 -1
- package/dist/widget/hooks/useOnRampProviderWidget.d.ts.map +0 -1
- package/dist/widget/hooks/useOnRampQuote.d.ts.map +0 -1
- package/dist/widget/hooks/useOnRampTransactionStatus.d.ts.map +0 -1
- package/dist/widget/hooks/useOriginSelectedToken.d.ts.map +0 -1
- package/dist/widget/hooks/usePayMessage.d.ts.map +0 -1
- package/dist/widget/hooks/usePriceImpactWarning.d.ts.map +0 -1
- package/dist/widget/hooks/useQuote.d.ts +0 -378
- package/dist/widget/hooks/useQuote.d.ts.map +0 -1
- package/dist/widget/hooks/useRecentTokens.d.ts.map +0 -1
- package/dist/widget/hooks/useRecipients.d.ts.map +0 -1
- package/dist/widget/hooks/useScreenTracking.d.ts +0 -2
- package/dist/widget/hooks/useScreenTracking.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +0 -1
- package/dist/widget/hooks/useSendForm.d.ts.map +0 -1
- package/dist/widget/hooks/useSwapAmount.d.ts.map +0 -1
- package/dist/widget/hooks/useSwapState.d.ts.map +0 -1
- package/dist/widget/hooks/useTargetAmount.d.ts.map +0 -1
- package/dist/widget/hooks/useTheme.d.ts.map +0 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +0 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts +0 -83
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +0 -1
- package/dist/widget/hooks/useViewManager.d.ts.map +0 -1
- package/dist/widget/hooks/useWalletConnectUri.d.ts +0 -11
- package/dist/widget/hooks/useWalletConnectUri.d.ts.map +0 -1
- package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +0 -1
- package/dist/widget/hooks/useWidgetProps.d.ts.map +0 -1
- package/dist/widget/styles.d.ts +0 -2
- package/dist/widget/styles.d.ts.map +0 -1
- package/dist/widget/types.d.ts +0 -44
- package/dist/widget/types.d.ts.map +0 -1
- package/dist/widget/utils/historyUtils.d.ts +0 -18
- package/dist/widget/utils/historyUtils.d.ts.map +0 -1
- package/src/abi.ts +0 -38
- package/src/abis/erc20.ts +0 -60
- package/src/abis/trailsHydrate.ts +0 -185
- package/src/abis/trailsRouter.ts +0 -121
- package/src/abis/trailsSweep.ts +0 -32
- package/src/abortController.ts +0 -35
- package/src/analytics.ts +0 -2029
- package/src/buffer.ts +0 -10
- package/src/chainSwitch.ts +0 -95
- package/src/chains.ts +0 -570
- package/src/config.ts +0 -118
- package/src/constants.ts +0 -239
- package/src/contractUtils.ts +0 -46
- package/src/cssUtils.ts +0 -5
- package/src/customChains.ts +0 -24
- package/src/customTokens.ts +0 -168
- package/src/decoders.ts +0 -365
- package/src/ens.ts +0 -74
- package/src/error.ts +0 -268
- package/src/estimate.ts +0 -480
- package/src/explorer.ts +0 -38
- package/src/fees.ts +0 -362
- package/src/gasless.ts +0 -638
- package/src/index.ts +0 -205
- package/src/indexerClient.ts +0 -118
- package/src/intentReceiptMonitor.ts +0 -99
- package/src/intentReceiptPoller.ts +0 -327
- package/src/intents.ts +0 -1133
- package/src/keyMachineClient.ts +0 -29
- package/src/keymachine/index.ts +0 -175
- package/src/keymachine/key-machine.gen.ts +0 -993
- package/src/localeUtils.ts +0 -244
- package/src/logger/index.ts +0 -95
- package/src/logger/useSyncLoggerDebug.ts +0 -11
- package/src/logger.ts +0 -1
- package/src/meld/components/MeldCountriesList.tsx +0 -237
- package/src/meld/components/MeldFundMethods.tsx +0 -265
- package/src/meld/components/MeldProvidersList.tsx +0 -187
- package/src/meld/components/MeldTokensList.tsx +0 -321
- package/src/meld/components/SimpleHeader.tsx +0 -35
- package/src/meld/utils/meld.ts +0 -77
- package/src/mutations.ts +0 -166
- package/src/onramp/MeshConnectFlow.tsx +0 -86
- package/src/onramp/MeshConnectIframe.tsx +0 -661
- package/src/onramp/SendFromExchangeButton.tsx +0 -81
- package/src/onramp/TrailsOnRampProvider.tsx +0 -59
- package/src/onramp/index.ts +0 -31
- package/src/onramp/meshconnect.ts +0 -277
- package/src/onramp/trailsOnramp.tsx +0 -130
- package/src/onramp-client/index.ts +0 -52
- package/src/onrampClient.ts +0 -46
- package/src/paymasterSend.ts +0 -521
- package/src/placeholder.ts +0 -92
- package/src/poolUtils.ts +0 -222
- package/src/pools.ts +0 -120
- package/src/prepareSend.ts +0 -553
- package/src/query/balance.fetchers.ts +0 -753
- package/src/query/balance.hooks.ts +0 -357
- package/src/query/balance.queries.ts +0 -307
- package/src/query/chains.hooks.ts +0 -45
- package/src/query/chains.queries.ts +0 -17
- package/src/query/client.ts +0 -20
- package/src/query/fiat.fetchers.ts +0 -33
- package/src/query/fiat.hooks.ts +0 -71
- package/src/query/fiat.queries.ts +0 -67
- package/src/query/geo.fetchers.ts +0 -100
- package/src/query/geo.hooks.ts +0 -16
- package/src/query/geo.queries.ts +0 -36
- package/src/query/helpers.ts +0 -81
- package/src/query/meld.fetchers.ts +0 -97
- package/src/query/meld.hooks.ts +0 -18
- package/src/query/meld.queries.ts +0 -184
- package/src/query/persister.ts +0 -11
- package/src/query/price.fetchers.ts +0 -53
- package/src/query/price.hooks.ts +0 -46
- package/src/query/price.queries.ts +0 -364
- package/src/query/tokenList.queries.ts +0 -118
- package/src/queryParams.ts +0 -100
- package/src/recover.ts +0 -1728
- package/src/sendUserOp.ts +0 -512
- package/src/theme.ts +0 -2
- package/src/toSimpleSmartAccount.ts +0 -567
- package/src/toast.ts +0 -110
- package/src/tokens.ts +0 -1862
- package/src/trailsClient.ts +0 -40
- package/src/transactionIntent/constants.ts +0 -15
- package/src/transactionIntent/deposits/depositOrchestrator.ts +0 -243
- package/src/transactionIntent/deposits/gaslessDeposit.ts +0 -705
- package/src/transactionIntent/deposits/index.ts +0 -3
- package/src/transactionIntent/deposits/standardDeposit.ts +0 -590
- package/src/transactionIntent/execution/index.ts +0 -1
- package/src/transactionIntent/execution/transactionState.ts +0 -38
- package/src/transactionIntent/handlers/index.ts +0 -1
- package/src/transactionIntent/handlers/intentHandler.ts +0 -1613
- package/src/transactionIntent/helpers/index.ts +0 -1
- package/src/transactionIntent/helpers/transactionStateHelpers.ts +0 -440
- package/src/transactionIntent/index.ts +0 -10
- package/src/transactionIntent/quote/feeExtractors.ts +0 -61
- package/src/transactionIntent/quote/index.ts +0 -3
- package/src/transactionIntent/quote/normalizeQuote.ts +0 -559
- package/src/transactionIntent/quote/quoteHelpers.ts +0 -117
- package/src/transactionIntent/types.ts +0 -241
- package/src/transactionIntent/utils/balanceChecker.ts +0 -103
- package/src/transactionIntent/utils/erc20Approval.ts +0 -171
- package/src/transactionIntent/utils/index.ts +0 -2
- package/src/transactionIntent/utils/resilientDepositTracker.ts +0 -171
- package/src/transactionIntent/utils/testnetHelpers.ts +0 -5
- package/src/transactionIntent/validators.ts +0 -27
- package/src/transactions.ts +0 -429
- package/src/types.d.ts +0 -16
- package/src/umd.tsx +0 -33
- package/src/utils/address.ts +0 -78
- package/src/utils/allowance.ts +0 -47
- package/src/utils/fiat.ts +0 -32
- package/src/utils/format.ts +0 -625
- package/src/utils/passthrough.ts +0 -93
- package/src/utils/time.ts +0 -118
- package/src/utils/validation.ts +0 -104
- package/src/utils.ts +0 -112
- package/src/version.ts +0 -8
- package/src/vite-env.d.ts +0 -4
- package/src/walletUtils.ts +0 -293
- package/src/wallets.ts +0 -544
- package/src/widget/analytics/useWidgetAnalytics.ts +0 -56
- package/src/widget/assets/Exchange-icon-black.svg +0 -5
- package/src/widget/assets/MetaMask-icon-fox-with-margins.svg +0 -31
- package/src/widget/assets/MetaMask-icon-fox.svg +0 -26
- package/src/widget/assets/MetaMask-logo-black.svg +0 -3
- package/src/widget/assets/MetaMask-logo-white.svg +0 -16
- package/src/widget/assets/Trails-logo-black.svg +0 -13
- package/src/widget/assets/Trails-logo-white.svg +0 -13
- package/src/widget/assets/WalletChange-black.svg +0 -5
- package/src/widget/assets/WalletConnect-logo-black.svg +0 -14
- package/src/widget/assets/WalletConnect-logo-blue.svg +0 -14
- package/src/widget/assets/WalletConnect-logo-white.svg +0 -14
- package/src/widget/assets/WalletConnect-logo.svg +0 -40
- package/src/widget/assets/aave.svg +0 -14
- package/src/widget/assets/morpho.svg +0 -14
- package/src/widget/compiled.css +0 -26
- package/src/widget/components/AccountActionsDropdown.tsx +0 -31
- package/src/widget/components/AccountIntentTransactionHistory.tsx +0 -756
- package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +0 -34
- package/src/widget/components/AccountSettings.tsx +0 -168
- package/src/widget/components/AddressOrEnsName.tsx +0 -24
- package/src/widget/components/AddressWalletIcon.tsx +0 -49
- package/src/widget/components/AllChainsIcon.tsx +0 -54
- package/src/widget/components/ChainFilterDropdown.tsx +0 -220
- package/src/widget/components/ChainImage.tsx +0 -40
- package/src/widget/components/ChainList.tsx +0 -158
- package/src/widget/components/ClassicSwap.tsx +0 -1761
- package/src/widget/components/ConfigDisplay.tsx +0 -158
- package/src/widget/components/ConnectWallet.tsx +0 -566
- package/src/widget/components/ConnectedWallets.tsx +0 -414
- package/src/widget/components/CopyButton.tsx +0 -108
- package/src/widget/components/CountryFilterDropdown.tsx +0 -179
- package/src/widget/components/DebugMenu.tsx +0 -50
- package/src/widget/components/DebugScreensList.tsx +0 -70
- package/src/widget/components/DebugToast.tsx +0 -63
- package/src/widget/components/DepositTracker.tsx +0 -326
- package/src/widget/components/DirectTransfer.tsx +0 -305
- package/src/widget/components/Disconnect.tsx +0 -68
- package/src/widget/components/DynamicInputStyles.tsx +0 -121
- package/src/widget/components/DynamicSizeInputField.tsx +0 -245
- package/src/widget/components/ENSAvatar.tsx +0 -33
- package/src/widget/components/Earn.tsx +0 -160
- package/src/widget/components/EarnPools.tsx +0 -417
- package/src/widget/components/EarnPoolsFilters.tsx +0 -165
- package/src/widget/components/ErrorAnimationIcon.tsx +0 -130
- package/src/widget/components/ErrorDisplay.tsx +0 -152
- package/src/widget/components/ExecutingIntentsBadge.tsx +0 -24
- package/src/widget/components/ExecutionStatusBadge.tsx +0 -53
- package/src/widget/components/FeeBreakdown.tsx +0 -155
- package/src/widget/components/FeeOption.tsx +0 -170
- package/src/widget/components/FeeOptions.tsx +0 -247
- package/src/widget/components/FiatSelector.tsx +0 -308
- package/src/widget/components/FiatSelectorButton.tsx +0 -68
- package/src/widget/components/Footer.tsx +0 -67
- package/src/widget/components/Fund.tsx +0 -2463
- package/src/widget/components/FundMethods.tsx +0 -423
- package/src/widget/components/FundWalletSelection.tsx +0 -60
- package/src/widget/components/FundingMethodSelectorButton.tsx +0 -106
- package/src/widget/components/GreenCheckAnimation.tsx +0 -119
- package/src/widget/components/HideBalances.tsx +0 -24
- package/src/widget/components/HighPriceImpactBlock.tsx +0 -44
- package/src/widget/components/HookModalContent.tsx +0 -377
- package/src/widget/components/Identicon.tsx +0 -228
- package/src/widget/components/LoadingSpinner.tsx +0 -9
- package/src/widget/components/MeldForm.tsx +0 -780
- package/src/widget/components/MeldHistory.tsx +0 -433
- package/src/widget/components/MeldStepsFlow.tsx +0 -1651
- package/src/widget/components/MeldTransactionStatus.tsx +0 -255
- package/src/widget/components/MeshExchangeSelection.tsx +0 -218
- package/src/widget/components/Modal.tsx +0 -86
- package/src/widget/components/OFTProgressBar.tsx +0 -89
- package/src/widget/components/OnRampProviderSelector.tsx +0 -263
- package/src/widget/components/OnrampDeposit.tsx +0 -122
- package/src/widget/components/OnrampErrorScreen.tsx +0 -163
- package/src/widget/components/OnrampHistoryRow.tsx +0 -321
- package/src/widget/components/OnrampPaymentMethods.tsx +0 -81
- package/src/widget/components/OnrampProviderConfirmation.tsx +0 -1060
- package/src/widget/components/OriginSelectionAmount.tsx +0 -144
- package/src/widget/components/OriginTransferInformation.tsx +0 -59
- package/src/widget/components/Pay.tsx +0 -1165
- package/src/widget/components/PaymentMethods.tsx +0 -198
- package/src/widget/components/PercentageMaxButtons.tsx +0 -112
- package/src/widget/components/PoolDeposit.tsx +0 -642
- package/src/widget/components/PoolWithdraw.tsx +0 -761
- package/src/widget/components/PriceImpactWarning.tsx +0 -87
- package/src/widget/components/QRCodeOptions.tsx +0 -65
- package/src/widget/components/QRCodeWalletSelect.tsx +0 -80
- package/src/widget/components/QrCode.tsx +0 -216
- package/src/widget/components/QuoteDetails.tsx +0 -1275
- package/src/widget/components/Receipt.tsx +0 -673
- package/src/widget/components/ReceiptRecoverableFunds.tsx +0 -135
- package/src/widget/components/RecentTokens.tsx +0 -66
- package/src/widget/components/RecipientSelectorButton.tsx +0 -50
- package/src/widget/components/Recipients.tsx +0 -413
- package/src/widget/components/RefundWarning.tsx +0 -61
- package/src/widget/components/RequiredPropsError.tsx +0 -33
- package/src/widget/components/ScreenHeader.tsx +0 -123
- package/src/widget/components/SearchInputField.tsx +0 -99
- package/src/widget/components/SessionTimeoutScreen.tsx +0 -103
- package/src/widget/components/ShadowPortal.tsx +0 -99
- package/src/widget/components/ShadowRootContext.tsx +0 -17
- package/src/widget/components/SimpleRecipientInputScreen.tsx +0 -91
- package/src/widget/components/SlippageToleranceSettings.tsx +0 -279
- package/src/widget/components/Swap.tsx +0 -50
- package/src/widget/components/SwapDisplay.tsx +0 -68
- package/src/widget/components/SwapSettings.tsx +0 -52
- package/src/widget/components/ThemeProvider.tsx +0 -115
- package/src/widget/components/ThemeSyncer.tsx +0 -47
- package/src/widget/components/Toast.tsx +0 -336
- package/src/widget/components/TokenDisplayNonSelectable.tsx +0 -40
- package/src/widget/components/TokenImage.tsx +0 -156
- package/src/widget/components/TokenList.tsx +0 -107
- package/src/widget/components/TokenSelector.tsx +0 -807
- package/src/widget/components/TokenSelectorButton.tsx +0 -123
- package/src/widget/components/TokenSkeleton.tsx +0 -53
- package/src/widget/components/Tooltip.tsx +0 -64
- package/src/widget/components/TrailsHookModal.tsx +0 -107
- package/src/widget/components/TransactionDetails.tsx +0 -534
- package/src/widget/components/TransactionHistoryItem.tsx +0 -767
- package/src/widget/components/TransferPendingVertical.tsx +0 -591
- package/src/widget/components/TruncatedAddress.tsx +0 -68
- package/src/widget/components/TruncatedTransactionHash.tsx +0 -74
- package/src/widget/components/UserPreferences.tsx +0 -570
- package/src/widget/components/WaasFeeOptions.tsx +0 -588
- package/src/widget/components/WalletConfirmation.tsx +0 -220
- package/src/widget/components/WalletConnect.tsx +0 -348
- package/src/widget/components/WalletConnectionPending.tsx +0 -178
- package/src/widget/components/WalletImage.tsx +0 -52
- package/src/widget/components/WalletList.tsx +0 -125
- package/src/widget/components/WidgetProviders.tsx +0 -82
- package/src/widget/components/Withdraw.tsx +0 -1106
- package/src/widget/components/YellowWarningAnimation.tsx +0 -146
- package/src/widget/hooks/useAddressWalletIcon.ts +0 -55
- package/src/widget/hooks/useAmountUsd.ts +0 -44
- package/src/widget/hooks/useBalanceVisible.tsx +0 -95
- package/src/widget/hooks/useChainFilter.tsx +0 -56
- package/src/widget/hooks/useCheckout.ts +0 -361
- package/src/widget/hooks/useClickTracking.ts +0 -74
- package/src/widget/hooks/useCombinedHistory.ts +0 -420
- package/src/widget/hooks/useConnector.tsx +0 -24
- package/src/widget/hooks/useCustomTokenSearch.tsx +0 -369
- package/src/widget/hooks/useDebounce.ts +0 -25
- package/src/widget/hooks/useDebugScreens.ts +0 -600
- package/src/widget/hooks/useDefaultDestinationToken.tsx +0 -179
- package/src/widget/hooks/useDefaultOriginToken.tsx +0 -407
- package/src/widget/hooks/useDepositMonitor.ts +0 -118
- package/src/widget/hooks/useDestinationSelectedToken.tsx +0 -310
- package/src/widget/hooks/useDisplayCurrencyPreference.tsx +0 -145
- package/src/widget/hooks/useEarnPool.tsx +0 -36
- package/src/widget/hooks/useExecutingIntentsCount.ts +0 -78
- package/src/widget/hooks/useExternalFundingReceiptSync.ts +0 -79
- package/src/widget/hooks/useFiatOnRampCurrencies.ts +0 -46
- package/src/widget/hooks/useFiatSelectedCurrency.tsx +0 -123
- package/src/widget/hooks/useGetIntent.ts +0 -54
- package/src/widget/hooks/useIntentReceiptBalances.ts +0 -141
- package/src/widget/hooks/useIntentTransactionHistory.ts +0 -790
- package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +0 -43
- package/src/widget/hooks/useIsMobile.tsx +0 -50
- package/src/widget/hooks/useIsSequenceWallet.ts +0 -17
- package/src/widget/hooks/useLocalePreference.tsx +0 -187
- package/src/widget/hooks/useMeldTransactionHistory.ts +0 -184
- package/src/widget/hooks/useMeldTransactionStatus.ts +0 -707
- package/src/widget/hooks/useOnRampCountryDefaults.ts +0 -57
- package/src/widget/hooks/useOnRampPaymentMethods.ts +0 -72
- package/src/widget/hooks/useOnRampProviderWidget.ts +0 -184
- package/src/widget/hooks/useOnRampQuote.ts +0 -340
- package/src/widget/hooks/useOnRampTransactionStatus.ts +0 -196
- package/src/widget/hooks/useOriginSelectedToken.tsx +0 -253
- package/src/widget/hooks/usePayMessage.tsx +0 -496
- package/src/widget/hooks/usePriceImpactWarning.ts +0 -17
- package/src/widget/hooks/useQuote.ts +0 -1239
- package/src/widget/hooks/useRecentTokens.ts +0 -159
- package/src/widget/hooks/useRecipients.ts +0 -167
- package/src/widget/hooks/useScreenTracking.ts +0 -14
- package/src/widget/hooks/useSelectedFeeOption.tsx +0 -323
- package/src/widget/hooks/useSelectedFundMethod.tsx +0 -93
- package/src/widget/hooks/useSelectedRecipient.tsx +0 -75
- package/src/widget/hooks/useSendForm.ts +0 -1389
- package/src/widget/hooks/useSwapAmount.tsx +0 -50
- package/src/widget/hooks/useSwapState.tsx +0 -121
- package/src/widget/hooks/useTargetAmount.ts +0 -26
- package/src/widget/hooks/useTheme.tsx +0 -80
- package/src/widget/hooks/useTokenList.ts +0 -1168
- package/src/widget/hooks/useTrailsSendTransaction.ts +0 -987
- package/src/widget/hooks/useViewManager.tsx +0 -506
- package/src/widget/hooks/useWalletConnectUri.tsx +0 -307
- package/src/widget/hooks/useWalletConnectionContext.tsx +0 -128
- package/src/widget/hooks/useWidgetProps.tsx +0 -33
- package/src/widget/index.css +0 -686
- package/src/widget/index.tsx +0 -28
- package/src/widget/providers/TrailsModalProvider.tsx +0 -238
- package/src/widget/providers/TrailsProvider.tsx +0 -155
- package/src/widget/providers/UserActivityProvider.tsx +0 -78
- package/src/widget/providers/WidgetProviderTree.tsx +0 -90
- package/src/widget/styles.ts +0 -26
- package/src/widget/types/analytics.ts +0 -22
- package/src/widget/types/commonProps.ts +0 -56
- package/src/widget/types/svg.d.ts +0 -8
- package/src/widget/types.ts +0 -51
- package/src/widget/utils/countryUtils.ts +0 -89
- package/src/widget/utils/createWagmiConfig.ts +0 -43
- package/src/widget/utils/forexRateStore.ts +0 -120
- package/src/widget/utils/fundMethodSwitchState.ts +0 -27
- package/src/widget/utils/historyFilters.ts +0 -157
- package/src/widget/utils/historyUtils.ts +0 -101
- package/src/widget/utils/localeStore.ts +0 -68
- package/src/widget/utils/meldProviderUtils.ts +0 -26
- package/src/widget/utils/meshSupportedTokens.ts +0 -28
- package/src/widget/utils/onrampConfig.ts +0 -15
- package/src/widget/utils/statusLabel.ts +0 -3
- package/src/widget/utils/tokens.ts +0 -138
- package/src/widget/utils/trailsOnrampConfig.ts +0 -39
- package/src/widget/utils/transactionFailure.ts +0 -52
- package/src/widget/utils/viewManagerGuards.ts +0 -49
- package/src/widget/utils/windowUtils.ts +0 -138
- package/src/widget/widget.tsx +0 -3400
- /package/dist/{widget/hooks → hooks}/useAddressWalletIcon.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useAmountUsd.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useBalanceVisible.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useChainFilter.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useClickTracking.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useConnector.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useDebounce.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useDepositMonitor.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useDisplayCurrencyPreference.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useExecutingIntentsCount.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useFiatSelectedCurrency.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useGetIntent.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useIsMobile.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useIsSequenceWallet.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useLocalePreference.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useMeldTransactionHistory.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useMeldTransactionStatus.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useOnRampCountryDefaults.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/usePayMessage.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/usePriceImpactWarning.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useRecipients.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useSelectedFeeOption.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useSelectedRecipient.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useSwapAmount.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useTargetAmount.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useTheme.d.ts +0 -0
- /package/dist/{widget/hooks → hooks}/useWalletConnectionContext.d.ts +0 -0
package/src/analytics.ts
DELETED
|
@@ -1,2029 +0,0 @@
|
|
|
1
|
-
import { Databeat, type Event as DatabeatEvent } from "@databeat/tracker"
|
|
2
|
-
import { Bytes, Hash } from "ox"
|
|
3
|
-
import { DATABEAT_KEY, DATABEAT_SERVER } from "./constants.js"
|
|
4
|
-
import { getQueryParam } from "./queryParams.js"
|
|
5
|
-
import { getEnvVar } from "./config.js"
|
|
6
|
-
import { logger } from "./logger.js"
|
|
7
|
-
import { getUserLocale } from "./localeUtils.js"
|
|
8
|
-
import packageJson from "../package.json" with { type: "json" }
|
|
9
|
-
import type { OnrampTrackingData } from "./widget/types/analytics.js"
|
|
10
|
-
import type { FundMethod } from "./transactionIntent/types.js"
|
|
11
|
-
import { isValidNumber, isNonNegativeNumber } from "./utils/validation.js"
|
|
12
|
-
|
|
13
|
-
import { normalizeAddress } from "./utils/address.js"
|
|
14
|
-
let checkoutIdSingleton: string | null = null
|
|
15
|
-
|
|
16
|
-
export function getSdkVersion() {
|
|
17
|
-
return packageJson.version || "dev"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function hasCheckoutId() {
|
|
21
|
-
return checkoutIdSingleton !== null
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function resetCheckoutId() {
|
|
25
|
-
checkoutIdSingleton = null
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
localStorage.removeItem("checkoutId")
|
|
29
|
-
} catch (error) {
|
|
30
|
-
logger.console.error("Error removing checkout id:", error)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getCheckoutUserId() {
|
|
35
|
-
try {
|
|
36
|
-
return localStorage.getItem("checkoutUserId")
|
|
37
|
-
} catch (error) {
|
|
38
|
-
logger.console.error("Error getting checkout user id:", error)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function getNewCheckoutId(userAddress?: string) {
|
|
43
|
-
if (userAddress) {
|
|
44
|
-
try {
|
|
45
|
-
localStorage.setItem("checkoutUserId", normalizeAddress(userAddress))
|
|
46
|
-
} catch (error) {
|
|
47
|
-
logger.console.error("Error setting checkout user id:", error)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
generateCheckoutIdAndSet()
|
|
52
|
-
|
|
53
|
-
return getCheckoutId()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function getCheckoutId() {
|
|
57
|
-
if (checkoutIdSingleton) {
|
|
58
|
-
return checkoutIdSingleton
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
checkoutIdSingleton = localStorage.getItem("checkoutId")
|
|
63
|
-
} catch (error) {
|
|
64
|
-
logger.console.error("Error getting checkout id:", error)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return checkoutIdSingleton
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function generateCheckoutIdAndSet() {
|
|
71
|
-
resetCheckoutId()
|
|
72
|
-
|
|
73
|
-
checkoutIdSingleton = generateCheckoutId()
|
|
74
|
-
try {
|
|
75
|
-
localStorage.setItem("checkoutId", checkoutIdSingleton)
|
|
76
|
-
} catch (error) {
|
|
77
|
-
logger.console.error("Error setting checkout id:", error)
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function generateCheckoutId() {
|
|
82
|
-
try {
|
|
83
|
-
return crypto.randomUUID()
|
|
84
|
-
} catch (error) {
|
|
85
|
-
logger.console.error("Error generating checkout id:", error)
|
|
86
|
-
return Date.now().toString()
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Pseudonymize sensitive data like transaction hashes and addresses
|
|
91
|
-
export function pseudonymizeSimple(value: string): string {
|
|
92
|
-
if (!value) return value
|
|
93
|
-
|
|
94
|
-
// Use ox Hash function for proper synchronous hashing
|
|
95
|
-
// Convert any string to Bytes and then to hex
|
|
96
|
-
const normalizedValue = value?.toString()?.trim().toLowerCase() || ""
|
|
97
|
-
const inputBytes = Bytes.fromString(normalizedValue)
|
|
98
|
-
const hashBytes = Hash.sha256(inputBytes)
|
|
99
|
-
const hashHex = Bytes.toHex(hashBytes)
|
|
100
|
-
const id = `anon_${hashHex.replace("0x", "")}`
|
|
101
|
-
|
|
102
|
-
return id
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Pseudonymize user address using the same logic as Databeat with userIdHash: true
|
|
106
|
-
// This replicates the genUserId function from Databeat when privacy.userIdHash is enabled
|
|
107
|
-
export function pseudonymize(
|
|
108
|
-
address: string,
|
|
109
|
-
options?: {
|
|
110
|
-
userAgentSalt?: boolean
|
|
111
|
-
extraSalt?: string
|
|
112
|
-
},
|
|
113
|
-
): string {
|
|
114
|
-
if (!address) return ""
|
|
115
|
-
|
|
116
|
-
// Normalize the address (lowercase, as done in identifyUser)
|
|
117
|
-
let seed = normalizeAddress(address)
|
|
118
|
-
|
|
119
|
-
// Add user agent salt if enabled (matches Databeat logic)
|
|
120
|
-
if (options?.userAgentSalt && typeof navigator !== "undefined") {
|
|
121
|
-
seed = `${seed}:${navigator.userAgent}`
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Add extra salt if provided (matches Databeat logic)
|
|
125
|
-
if (options?.extraSalt && options.extraSalt.length > 0) {
|
|
126
|
-
seed = `${seed}:${options.extraSalt}`
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Hash using SHA256 and convert to hex (same as Databeat)
|
|
130
|
-
const inputBytes = Bytes.fromString(seed)
|
|
131
|
-
const hashBytes = Hash.sha256(inputBytes)
|
|
132
|
-
const hashHex = Bytes.toHex(hashBytes)
|
|
133
|
-
|
|
134
|
-
// Return first 50 characters without 0x prefix (matches Databeat's substring(0, 50))
|
|
135
|
-
return hashHex.replace("0x", "").substring(0, 50)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function hashUserAddress(address: string) {
|
|
139
|
-
return pseudonymize(pseudonymize(address), {
|
|
140
|
-
userAgentSalt: false,
|
|
141
|
-
extraSalt: "s3qs4lt",
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
declare global {
|
|
146
|
-
interface Window {
|
|
147
|
-
_pseudonymize?: typeof pseudonymize
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (typeof window !== "undefined") {
|
|
152
|
-
// for debugging
|
|
153
|
-
window._pseudonymize = pseudonymize
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export const EventType = {
|
|
157
|
-
PAGEVIEW: "PAGEVIEW" as const,
|
|
158
|
-
WIDGET_SCREEN: "WIDGET_SCREEN" as const,
|
|
159
|
-
PAYMENT_STARTED: "PAYMENT_STARTED" as const,
|
|
160
|
-
PAYMENT_COMPLETED: "PAYMENT_COMPLETED" as const,
|
|
161
|
-
PAYMENT_ERROR: "PAYMENT_ERROR" as const,
|
|
162
|
-
|
|
163
|
-
// Wallet events
|
|
164
|
-
WALLET_CONNECTED: "WALLET_CONNECTED" as const,
|
|
165
|
-
WALLET_DISCONNECTED: "WALLET_DISCONNECTED" as const,
|
|
166
|
-
|
|
167
|
-
// Intent events
|
|
168
|
-
INTENT_QUOTE_REQUESTED: "INTENT_QUOTE_REQUESTED" as const,
|
|
169
|
-
INTENT_QUOTE_RECEIVED: "INTENT_QUOTE_RECEIVED" as const,
|
|
170
|
-
INTENT_QUOTE_ERROR: "INTENT_QUOTE_ERROR" as const,
|
|
171
|
-
INTENT_COMMIT_STARTED: "INTENT_COMMIT_STARTED" as const,
|
|
172
|
-
INTENT_COMMIT_COMPLETED: "INTENT_COMMIT_COMPLETED" as const,
|
|
173
|
-
INTENT_COMMIT_ERROR: "INTENT_COMMIT_ERROR" as const,
|
|
174
|
-
|
|
175
|
-
// Transaction events
|
|
176
|
-
TRANSACTION_STARTED: "TRANSACTION_STARTED" as const,
|
|
177
|
-
TRANSACTION_SIGNED: "TRANSACTION_SIGNED" as const,
|
|
178
|
-
TRANSACTION_SUBMITTED: "TRANSACTION_SUBMITTED" as const,
|
|
179
|
-
TRANSACTION_CONFIRMED: "TRANSACTION_CONFIRMED" as const,
|
|
180
|
-
TRANSACTION_ERROR: "TRANSACTION_ERROR" as const,
|
|
181
|
-
|
|
182
|
-
// Relayer events
|
|
183
|
-
RELAYER_CALL_STARTED: "RELAYER_CALL_STARTED" as const,
|
|
184
|
-
RELAYER_CALL_COMPLETED: "RELAYER_CALL_COMPLETED" as const,
|
|
185
|
-
RELAYER_CALL_ERROR: "RELAYER_CALL_ERROR" as const,
|
|
186
|
-
|
|
187
|
-
// Onramp events
|
|
188
|
-
ONRAMP_QUOTE_REQUESTED: "ONRAMP_QUOTE_REQUESTED" as const,
|
|
189
|
-
ONRAMP_QUOTE_RECEIVED: "ONRAMP_QUOTE_RECEIVED" as const,
|
|
190
|
-
ONRAMP_QUOTE_ERROR: "ONRAMP_QUOTE_ERROR" as const,
|
|
191
|
-
ONRAMP_WIDGET_SESSION: "ONRAMP_WIDGET_SESSION" as const,
|
|
192
|
-
ONRAMP_PAYMENT_COMPLETED: "ONRAMP_PAYMENT_COMPLETED" as const,
|
|
193
|
-
|
|
194
|
-
// Click tracking event
|
|
195
|
-
WIDGET_CLICK: "WIDGET_CLICK" as const,
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export type EventTypes = keyof typeof EventType
|
|
199
|
-
export type Event = DatabeatEvent<EventTypes>
|
|
200
|
-
export type AnalyticsPropValue = unknown
|
|
201
|
-
export type AnalyticsProps = Record<string, AnalyticsPropValue>
|
|
202
|
-
export type EventProps = {
|
|
203
|
-
event: EventTypes
|
|
204
|
-
props: AnalyticsProps
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function toDatabeatProps(props: AnalyticsProps): Record<string, string> {
|
|
208
|
-
const normalized: Record<string, string> = {}
|
|
209
|
-
|
|
210
|
-
for (const [key, value] of Object.entries(props)) {
|
|
211
|
-
if (value === undefined || value === null) continue
|
|
212
|
-
normalized[key] = typeof value === "string" ? value : String(value)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return normalized
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
abstract class BaseAnalytics {
|
|
219
|
-
protected sequenceProjectAccessKey: string | undefined
|
|
220
|
-
|
|
221
|
-
constructor(sequenceProjectAccessKey?: string) {
|
|
222
|
-
this.sequenceProjectAccessKey = sequenceProjectAccessKey
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
updateProjectAccessKey(sequenceProjectAccessKey: string) {
|
|
226
|
-
this.sequenceProjectAccessKey = sequenceProjectAccessKey
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Helper to auto-identify users when userAddress is provided but no ident is set
|
|
230
|
-
protected autoIdentifyIfNeeded(
|
|
231
|
-
userAddress: string | undefined,
|
|
232
|
-
eventName: string,
|
|
233
|
-
) {
|
|
234
|
-
if (!userAddress) return
|
|
235
|
-
|
|
236
|
-
const currentUserId = this.getCurrentUserId()
|
|
237
|
-
|
|
238
|
-
// Check if userId matches the expected hashed address format (52 chars like the hash)
|
|
239
|
-
// Example: "10249047220fb6b1a68f5ef6d62f109d82f71dffd587e183fb"
|
|
240
|
-
const isHashedAddressFormat =
|
|
241
|
-
currentUserId &&
|
|
242
|
-
typeof currentUserId === "string" &&
|
|
243
|
-
currentUserId.length > 20
|
|
244
|
-
|
|
245
|
-
const isIdentified =
|
|
246
|
-
currentUserId && currentUserId !== "anonymous" && isHashedAddressFormat
|
|
247
|
-
|
|
248
|
-
if (!isIdentified) {
|
|
249
|
-
logger.console.log(
|
|
250
|
-
`[trails-sdk] DEBUG: Auto-identifying from ${eventName}`,
|
|
251
|
-
{
|
|
252
|
-
userAddress,
|
|
253
|
-
currentUserId,
|
|
254
|
-
currentUserIdLength: currentUserId?.length,
|
|
255
|
-
isHashedAddressFormat,
|
|
256
|
-
timestamp: new Date().toISOString(),
|
|
257
|
-
},
|
|
258
|
-
)
|
|
259
|
-
this.identifyUser({ address: userAddress })
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
protected getCurrentUserId(): string | undefined {
|
|
264
|
-
return undefined
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
abstract identifyUser(data: { address: string }): void
|
|
268
|
-
|
|
269
|
-
private getCommonProps(): Record<string, string> {
|
|
270
|
-
return {
|
|
271
|
-
...this.getNavigatorProps(),
|
|
272
|
-
...this.getDocumentProps(),
|
|
273
|
-
...this.getWindowProps(),
|
|
274
|
-
sequenceProjectAccessKey: this.sequenceProjectAccessKey || "",
|
|
275
|
-
sdkVersion: getSdkVersion(),
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
private getNavigatorProps(): Record<string, string> {
|
|
280
|
-
if (typeof navigator === "undefined") {
|
|
281
|
-
return {
|
|
282
|
-
userAgent: "",
|
|
283
|
-
userLocale: "",
|
|
284
|
-
userLanguage: "",
|
|
285
|
-
userCountry: "",
|
|
286
|
-
userTimezone: "",
|
|
287
|
-
userTimezoneOffset: "",
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
const locale = getUserLocale()
|
|
292
|
-
// Extract country code from locale (e.g., "en-US" -> "US", "fr-FR" -> "FR")
|
|
293
|
-
const countryCode = locale.includes("-") ? locale.split("-")[1] || "" : ""
|
|
294
|
-
const languageCode = locale.includes("-")
|
|
295
|
-
? locale.split("-")[0] || locale
|
|
296
|
-
: locale
|
|
297
|
-
|
|
298
|
-
// Get timezone information
|
|
299
|
-
let timezone = ""
|
|
300
|
-
let timezoneOffset = ""
|
|
301
|
-
try {
|
|
302
|
-
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone || ""
|
|
303
|
-
timezoneOffset = new Date().getTimezoneOffset().toString() // Minutes offset from UTC
|
|
304
|
-
} catch (_e) {
|
|
305
|
-
// Intl might not be available in some environments
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
return {
|
|
309
|
-
userAgent: navigator.userAgent,
|
|
310
|
-
userLocale: locale,
|
|
311
|
-
userLanguage: languageCode,
|
|
312
|
-
userCountry: countryCode,
|
|
313
|
-
userTimezone: timezone,
|
|
314
|
-
userTimezoneOffset: timezoneOffset,
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
private getDocumentProps(): Record<string, string> {
|
|
319
|
-
if (typeof window === "undefined") {
|
|
320
|
-
return {
|
|
321
|
-
userAgent: "",
|
|
322
|
-
title: "",
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return {
|
|
327
|
-
title: document.title,
|
|
328
|
-
referrer: document.referrer,
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
private getWindowProps(): Record<string, string> {
|
|
333
|
-
if (typeof window === "undefined") {
|
|
334
|
-
return {
|
|
335
|
-
url: "",
|
|
336
|
-
origin: "",
|
|
337
|
-
hostname: "",
|
|
338
|
-
pathname: "",
|
|
339
|
-
screenWidth: "",
|
|
340
|
-
screenHeight: "",
|
|
341
|
-
screenPixelRatio: "",
|
|
342
|
-
screenResolution: "",
|
|
343
|
-
screenOrientation: "",
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
return {
|
|
348
|
-
url: window.location?.href,
|
|
349
|
-
origin: window?.origin || window?.location?.origin,
|
|
350
|
-
hostname: window.location?.hostname,
|
|
351
|
-
pathname: window.location?.pathname,
|
|
352
|
-
screenWidth: window.innerWidth?.toString(),
|
|
353
|
-
screenHeight: window.innerHeight?.toString(),
|
|
354
|
-
screenPixelRatio: window.devicePixelRatio?.toString(),
|
|
355
|
-
screenResolution: `${window.screen?.width}x${window.screen?.height}`,
|
|
356
|
-
screenOrientation: window.screen?.orientation?.type?.toString(),
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
abstract track(event: EventProps): void
|
|
361
|
-
|
|
362
|
-
trackPageview() {
|
|
363
|
-
this.track({
|
|
364
|
-
event: EventType.PAGEVIEW,
|
|
365
|
-
props: this.getCommonProps(),
|
|
366
|
-
})
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
trackWidgetScreen(data: {
|
|
370
|
-
screen: string
|
|
371
|
-
userAddress?: string
|
|
372
|
-
[key: string]: AnalyticsPropValue
|
|
373
|
-
}) {
|
|
374
|
-
// Auto-identify if userAddress provided but no ident set
|
|
375
|
-
this.autoIdentifyIfNeeded(data.userAddress, "trackWidgetScreen")
|
|
376
|
-
|
|
377
|
-
this.track({
|
|
378
|
-
event: EventType.WIDGET_SCREEN,
|
|
379
|
-
props: {
|
|
380
|
-
...this.getCommonProps(),
|
|
381
|
-
checkoutId: getCheckoutId(),
|
|
382
|
-
...data,
|
|
383
|
-
...(data.userAddress && {
|
|
384
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
385
|
-
}),
|
|
386
|
-
},
|
|
387
|
-
})
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
trackPaymentStarted(data: {
|
|
391
|
-
userAddress?: string
|
|
392
|
-
intentAddress?: string
|
|
393
|
-
originChainId?: number
|
|
394
|
-
destinationChainId?: number
|
|
395
|
-
originTokenAddress?: string
|
|
396
|
-
originTokenAmount?: string
|
|
397
|
-
originTokenDecimals?: number
|
|
398
|
-
destinationTokenSymbol?: string
|
|
399
|
-
destinationTokenAddress?: string
|
|
400
|
-
destinationTokenAmount?: string
|
|
401
|
-
destinationTokenDecimals?: number
|
|
402
|
-
mode?: string
|
|
403
|
-
fundMethod?: FundMethod
|
|
404
|
-
sourceTokenPriceUsd?: string
|
|
405
|
-
destinationTokenPriceUsd?: string
|
|
406
|
-
tradeType?: string
|
|
407
|
-
swapProvider?: string
|
|
408
|
-
bridgeProvider?: string
|
|
409
|
-
onramp?: OnrampTrackingData | null
|
|
410
|
-
walletId?: string
|
|
411
|
-
destinationCalldata?: string
|
|
412
|
-
}) {
|
|
413
|
-
// Auto-identify if userAddress provided but no ident set
|
|
414
|
-
this.autoIdentifyIfNeeded(data.userAddress, "trackPaymentStarted")
|
|
415
|
-
resetCheckoutId()
|
|
416
|
-
|
|
417
|
-
// Destructure onramp data if present and exclude it from data spread
|
|
418
|
-
const { onramp, ...dataWithoutOnramp } = data
|
|
419
|
-
const onrampProps = onramp
|
|
420
|
-
? {
|
|
421
|
-
...(onramp.sessionId && { onrampSessionId: onramp.sessionId }),
|
|
422
|
-
onrampProvider: onramp.provider,
|
|
423
|
-
onrampSourceAmount: onramp.sourceAmount,
|
|
424
|
-
onrampSourceCurrency: onramp.sourceCurrencyCode,
|
|
425
|
-
onrampDestinationAmount: onramp.destinationAmount,
|
|
426
|
-
onrampDestinationCurrency: onramp.destinationCurrencyCode,
|
|
427
|
-
onrampExchangeRate: onramp.exchangeRate,
|
|
428
|
-
...(onramp.networkFees && { onrampNetworkFees: onramp.networkFees }),
|
|
429
|
-
...(onramp.transactionFee && {
|
|
430
|
-
onrampTransactionFee: onramp.transactionFee,
|
|
431
|
-
}),
|
|
432
|
-
...(onramp.totalFees && { onrampTotalFees: onramp.totalFees }),
|
|
433
|
-
onrampCountryCode: onramp.countryCode,
|
|
434
|
-
...(onramp.paymentMethod && {
|
|
435
|
-
onrampPaymentMethod: onramp.paymentMethod,
|
|
436
|
-
}),
|
|
437
|
-
...(onramp.quoteId && { onrampQuoteId: onramp.quoteId }),
|
|
438
|
-
onrampTimestamp: onramp.timestamp,
|
|
439
|
-
}
|
|
440
|
-
: {}
|
|
441
|
-
|
|
442
|
-
this.track({
|
|
443
|
-
event: EventType.PAYMENT_STARTED,
|
|
444
|
-
props: {
|
|
445
|
-
...this.getCommonProps(),
|
|
446
|
-
checkoutId: getNewCheckoutId(data.userAddress),
|
|
447
|
-
...dataWithoutOnramp,
|
|
448
|
-
...(data.userAddress && {
|
|
449
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
450
|
-
}),
|
|
451
|
-
...(data.intentAddress && {
|
|
452
|
-
intentAddress: data.intentAddress,
|
|
453
|
-
}),
|
|
454
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
455
|
-
originChainId: data.originChainId?.toString(),
|
|
456
|
-
originTokenAmount: data.originTokenAmount?.toString(),
|
|
457
|
-
originTokenDecimals: data.originTokenDecimals?.toString(),
|
|
458
|
-
destinationTokenAmount: data.destinationTokenAmount?.toString(),
|
|
459
|
-
destinationTokenDecimals: data.destinationTokenDecimals?.toString(),
|
|
460
|
-
sourceTokenPriceUsd: data.sourceTokenPriceUsd?.toString(),
|
|
461
|
-
destinationTokenPriceUsd: data.destinationTokenPriceUsd?.toString(),
|
|
462
|
-
tradeType: data.tradeType,
|
|
463
|
-
swapProvider: data.swapProvider,
|
|
464
|
-
bridgeProvider: data.bridgeProvider,
|
|
465
|
-
...onrampProps,
|
|
466
|
-
},
|
|
467
|
-
})
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Validates USD amounts are reasonable before sending to analytics
|
|
472
|
-
* Returns undefined if the value is invalid or suspicious
|
|
473
|
-
*/
|
|
474
|
-
private validateUsdAmount(
|
|
475
|
-
usdAmount: string | number | undefined | null,
|
|
476
|
-
context: {
|
|
477
|
-
rawAmount?: string
|
|
478
|
-
formattedAmount?: string
|
|
479
|
-
decimals?: number
|
|
480
|
-
priceUsd?: string | number | null
|
|
481
|
-
tokenSymbol?: string
|
|
482
|
-
},
|
|
483
|
-
): string | undefined {
|
|
484
|
-
if (!usdAmount) return undefined
|
|
485
|
-
|
|
486
|
-
// Only accept numbers for USD amounts - no locale parsing for internal calculations
|
|
487
|
-
let numValue: number
|
|
488
|
-
if (typeof usdAmount === "number") {
|
|
489
|
-
numValue = usdAmount
|
|
490
|
-
} else if (typeof usdAmount === "string") {
|
|
491
|
-
// Try to parse as a plain number (no locale detection)
|
|
492
|
-
numValue = Number(usdAmount)
|
|
493
|
-
if (!isValidNumber(numValue)) {
|
|
494
|
-
logger.console.warn(
|
|
495
|
-
"[trails-sdk] Invalid USD amount string, expected a number:",
|
|
496
|
-
{ usdAmount, context },
|
|
497
|
-
)
|
|
498
|
-
return undefined
|
|
499
|
-
}
|
|
500
|
-
} else {
|
|
501
|
-
return undefined
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// Check for invalid numbers
|
|
505
|
-
if (!isNonNegativeNumber(numValue)) {
|
|
506
|
-
logger.console.warn(
|
|
507
|
-
"[trails-sdk] Invalid USD amount detected, not sending to analytics:",
|
|
508
|
-
{
|
|
509
|
-
usdAmount,
|
|
510
|
-
context,
|
|
511
|
-
},
|
|
512
|
-
)
|
|
513
|
-
return undefined
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// Check for suspiciously large values (more than 1 billion USD)
|
|
517
|
-
const MAX_REASONABLE_USD = 1_000_000_000
|
|
518
|
-
if (numValue > MAX_REASONABLE_USD) {
|
|
519
|
-
logger.console.warn(
|
|
520
|
-
"[trails-sdk] Suspiciously large USD amount detected, not sending to analytics:",
|
|
521
|
-
{
|
|
522
|
-
usdAmount,
|
|
523
|
-
context,
|
|
524
|
-
},
|
|
525
|
-
)
|
|
526
|
-
return undefined
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// Validate raw amount matches formatted amount (using decimals)
|
|
530
|
-
// This catches cases where wrong decimals were used
|
|
531
|
-
if (
|
|
532
|
-
context.rawAmount &&
|
|
533
|
-
context.formattedAmount &&
|
|
534
|
-
context.decimals !== undefined &&
|
|
535
|
-
context.decimals >= 0 &&
|
|
536
|
-
context.decimals <= 18
|
|
537
|
-
) {
|
|
538
|
-
try {
|
|
539
|
-
const rawAmountBig = BigInt(context.rawAmount)
|
|
540
|
-
const decimals = context.decimals
|
|
541
|
-
const divisor = BigInt(10 ** decimals)
|
|
542
|
-
const expectedFormatted = Number(rawAmountBig) / Number(divisor)
|
|
543
|
-
const actualFormatted = Number(context.formattedAmount)
|
|
544
|
-
const ratio = actualFormatted / expectedFormatted
|
|
545
|
-
|
|
546
|
-
// If formatted amount is more than 2x or less than 0.5x the expected value, it's suspicious
|
|
547
|
-
// (allowing some tolerance for rounding differences)
|
|
548
|
-
if (ratio > 2 || ratio < 0.5) {
|
|
549
|
-
logger.console.warn(
|
|
550
|
-
"[trails-sdk] Formatted amount doesn't match raw amount with decimals, not sending USD to analytics:",
|
|
551
|
-
{
|
|
552
|
-
usdAmount,
|
|
553
|
-
rawAmount: context.rawAmount,
|
|
554
|
-
formattedAmount: context.formattedAmount,
|
|
555
|
-
decimals: context.decimals,
|
|
556
|
-
expectedFormatted,
|
|
557
|
-
actualFormatted,
|
|
558
|
-
ratio,
|
|
559
|
-
context,
|
|
560
|
-
},
|
|
561
|
-
)
|
|
562
|
-
return undefined
|
|
563
|
-
}
|
|
564
|
-
} catch (err) {
|
|
565
|
-
// If parsing fails, log but don't block (might be edge case)
|
|
566
|
-
logger.console.warn(
|
|
567
|
-
"[trails-sdk] Error validating raw amount against formatted amount:",
|
|
568
|
-
err,
|
|
569
|
-
)
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// If we have formatted amount and price, validate the calculation makes sense
|
|
574
|
-
if (
|
|
575
|
-
context.formattedAmount &&
|
|
576
|
-
context.priceUsd &&
|
|
577
|
-
Number(context.formattedAmount) > 0 &&
|
|
578
|
-
Number(context.priceUsd) > 0
|
|
579
|
-
) {
|
|
580
|
-
const expectedUsd =
|
|
581
|
-
Number(context.formattedAmount) * Number(context.priceUsd)
|
|
582
|
-
const ratio = numValue / expectedUsd
|
|
583
|
-
|
|
584
|
-
// If the actual USD is more than 10x or less than 0.1x the expected value, it's suspicious
|
|
585
|
-
if (ratio > 10 || ratio < 0.1) {
|
|
586
|
-
logger.console.warn(
|
|
587
|
-
"[trails-sdk] USD amount doesn't match expected calculation, not sending to analytics:",
|
|
588
|
-
{
|
|
589
|
-
usdAmount,
|
|
590
|
-
expectedUsd,
|
|
591
|
-
ratio,
|
|
592
|
-
context,
|
|
593
|
-
},
|
|
594
|
-
)
|
|
595
|
-
return undefined
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
return numValue.toString()
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
trackPaymentCompleted(data: {
|
|
603
|
-
userAddress?: string
|
|
604
|
-
intentAddress?: string
|
|
605
|
-
mode?: string
|
|
606
|
-
fundMethod?: FundMethod
|
|
607
|
-
originTokenAddress?: string
|
|
608
|
-
originTokenSymbol?: string
|
|
609
|
-
originTokenAmount?: string
|
|
610
|
-
originTokenAmountFormatted?: string
|
|
611
|
-
depositTokenAmount?: string
|
|
612
|
-
depositTokenAmountFormatted?: string
|
|
613
|
-
depositTokenAmountUsd?: string | number
|
|
614
|
-
destinationTokenAmount?: string
|
|
615
|
-
destinationTokenAmountFormatted?: string
|
|
616
|
-
destinationTokenAmountUsd?: string | number
|
|
617
|
-
originTokenDecimals?: number
|
|
618
|
-
destinationTokenDecimals?: number
|
|
619
|
-
destinationTokenSymbol?: string
|
|
620
|
-
originChainId?: number
|
|
621
|
-
destinationChainId?: number
|
|
622
|
-
tradeType?: string
|
|
623
|
-
sourceTokenPriceUsd?: string | number | null
|
|
624
|
-
destinationTokenPriceUsd?: string | number | null
|
|
625
|
-
swapProvider?: string
|
|
626
|
-
bridgeProvider?: string
|
|
627
|
-
onramp?: OnrampTrackingData | null
|
|
628
|
-
walletId?: string
|
|
629
|
-
destinationCalldata?: string
|
|
630
|
-
[key: string]: AnalyticsPropValue
|
|
631
|
-
}) {
|
|
632
|
-
// Auto-identify if userAddress provided but no ident set
|
|
633
|
-
this.autoIdentifyIfNeeded(data.userAddress, "trackPaymentCompleted")
|
|
634
|
-
|
|
635
|
-
// Validate USD amounts before sending
|
|
636
|
-
const validatedDepositTokenAmountUsd = this.validateUsdAmount(
|
|
637
|
-
data.depositTokenAmountUsd,
|
|
638
|
-
{
|
|
639
|
-
rawAmount: data.depositTokenAmount,
|
|
640
|
-
formattedAmount: data.depositTokenAmountFormatted,
|
|
641
|
-
decimals: data.originTokenDecimals,
|
|
642
|
-
priceUsd: data.sourceTokenPriceUsd,
|
|
643
|
-
tokenSymbol: data.originTokenSymbol,
|
|
644
|
-
},
|
|
645
|
-
)
|
|
646
|
-
|
|
647
|
-
const validatedDestinationTokenAmountUsd = this.validateUsdAmount(
|
|
648
|
-
data.destinationTokenAmountUsd,
|
|
649
|
-
{
|
|
650
|
-
rawAmount: data.destinationTokenAmount,
|
|
651
|
-
formattedAmount: data.destinationTokenAmountFormatted,
|
|
652
|
-
decimals: data.destinationTokenDecimals,
|
|
653
|
-
priceUsd: data.destinationTokenPriceUsd,
|
|
654
|
-
tokenSymbol: data.destinationTokenSymbol,
|
|
655
|
-
},
|
|
656
|
-
)
|
|
657
|
-
|
|
658
|
-
// Cross-validate: destination USD shouldn't be wildly different from deposit USD
|
|
659
|
-
// (unless there's a huge price difference, but even then, 100x difference is suspicious)
|
|
660
|
-
let finalDestinationTokenAmountUsd = validatedDestinationTokenAmountUsd
|
|
661
|
-
if (validatedDepositTokenAmountUsd && validatedDestinationTokenAmountUsd) {
|
|
662
|
-
const depositUsd = Number(validatedDepositTokenAmountUsd)
|
|
663
|
-
const destUsd = Number(validatedDestinationTokenAmountUsd)
|
|
664
|
-
const ratio = destUsd / depositUsd
|
|
665
|
-
|
|
666
|
-
// If destination USD is more than 100x or less than 0.01x the deposit USD, it's suspicious
|
|
667
|
-
if (ratio > 100 || ratio < 0.01) {
|
|
668
|
-
logger.console.warn(
|
|
669
|
-
"[trails-sdk] Suspicious USD ratio between deposit and destination, not sending destination USD:",
|
|
670
|
-
{
|
|
671
|
-
depositTokenAmountUsd: validatedDepositTokenAmountUsd,
|
|
672
|
-
destinationTokenAmountUsd: validatedDestinationTokenAmountUsd,
|
|
673
|
-
ratio,
|
|
674
|
-
depositTokenAmount: data.depositTokenAmount,
|
|
675
|
-
destinationTokenAmount: data.destinationTokenAmount,
|
|
676
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
677
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
678
|
-
},
|
|
679
|
-
)
|
|
680
|
-
// Don't send the suspicious destination USD value
|
|
681
|
-
finalDestinationTokenAmountUsd = undefined
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
// Destructure onramp data if present and exclude it from data spread
|
|
686
|
-
const { onramp, ...dataWithoutOnramp } = data
|
|
687
|
-
const onrampProps = onramp
|
|
688
|
-
? {
|
|
689
|
-
...(onramp.sessionId && { onrampSessionId: onramp.sessionId }),
|
|
690
|
-
onrampProvider: onramp.provider,
|
|
691
|
-
onrampSourceAmount: onramp.sourceAmount,
|
|
692
|
-
onrampSourceCurrency: onramp.sourceCurrencyCode,
|
|
693
|
-
onrampDestinationAmount: onramp.destinationAmount,
|
|
694
|
-
onrampDestinationCurrency: onramp.destinationCurrencyCode,
|
|
695
|
-
onrampExchangeRate: onramp.exchangeRate,
|
|
696
|
-
...(onramp.networkFees && { onrampNetworkFees: onramp.networkFees }),
|
|
697
|
-
...(onramp.transactionFee && {
|
|
698
|
-
onrampTransactionFee: onramp.transactionFee,
|
|
699
|
-
}),
|
|
700
|
-
...(onramp.totalFees && { onrampTotalFees: onramp.totalFees }),
|
|
701
|
-
onrampCountryCode: onramp.countryCode,
|
|
702
|
-
...(onramp.paymentMethod && {
|
|
703
|
-
onrampPaymentMethod: onramp.paymentMethod,
|
|
704
|
-
}),
|
|
705
|
-
...(onramp.quoteId && { onrampQuoteId: onramp.quoteId }),
|
|
706
|
-
onrampTimestamp: onramp.timestamp,
|
|
707
|
-
}
|
|
708
|
-
: {}
|
|
709
|
-
|
|
710
|
-
this.track({
|
|
711
|
-
event: EventType.PAYMENT_COMPLETED,
|
|
712
|
-
props: {
|
|
713
|
-
...this.getCommonProps(),
|
|
714
|
-
checkoutId: getCheckoutId(),
|
|
715
|
-
...dataWithoutOnramp,
|
|
716
|
-
originChainId: data.originChainId?.toString(),
|
|
717
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
718
|
-
...(data.userAddress && {
|
|
719
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
720
|
-
}),
|
|
721
|
-
...(data.intentAddress && {
|
|
722
|
-
intentAddress: data.intentAddress,
|
|
723
|
-
}),
|
|
724
|
-
originTokenAddress: data.originTokenAddress,
|
|
725
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
726
|
-
originTokenAmount: data.originTokenAmount?.toString(),
|
|
727
|
-
originTokenAmountFormatted: data.originTokenAmountFormatted?.toString(),
|
|
728
|
-
depositTokenAmount: data.depositTokenAmount?.toString(),
|
|
729
|
-
depositTokenAmountFormatted:
|
|
730
|
-
data.depositTokenAmountFormatted?.toString(),
|
|
731
|
-
depositTokenAmountUsd: validatedDepositTokenAmountUsd,
|
|
732
|
-
destinationTokenAmount: data.destinationTokenAmount?.toString(),
|
|
733
|
-
destinationTokenAmountFormatted:
|
|
734
|
-
data.destinationTokenAmountFormatted?.toString(),
|
|
735
|
-
destinationTokenAmountUsd: finalDestinationTokenAmountUsd,
|
|
736
|
-
originTokenDecimals: data.originTokenDecimals?.toString(),
|
|
737
|
-
destinationTokenDecimals: data.destinationTokenDecimals?.toString(),
|
|
738
|
-
tradeType: data.tradeType,
|
|
739
|
-
sourceTokenPriceUsd: data.sourceTokenPriceUsd?.toString(),
|
|
740
|
-
destinationTokenPriceUsd: data.destinationTokenPriceUsd?.toString(),
|
|
741
|
-
swapProvider: data.swapProvider,
|
|
742
|
-
bridgeProvider: data.bridgeProvider,
|
|
743
|
-
...onrampProps,
|
|
744
|
-
},
|
|
745
|
-
})
|
|
746
|
-
resetCheckoutId()
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
trackPaymentError(data: {
|
|
750
|
-
error: string
|
|
751
|
-
userAddress?: string
|
|
752
|
-
intentAddress?: string
|
|
753
|
-
mode?: string
|
|
754
|
-
fundMethod?: FundMethod
|
|
755
|
-
originChainId?: number
|
|
756
|
-
destinationChainId?: number
|
|
757
|
-
[key: string]: AnalyticsPropValue
|
|
758
|
-
}) {
|
|
759
|
-
this.track({
|
|
760
|
-
event: EventType.PAYMENT_ERROR,
|
|
761
|
-
props: {
|
|
762
|
-
...this.getCommonProps(),
|
|
763
|
-
checkoutId: getCheckoutId(),
|
|
764
|
-
...data,
|
|
765
|
-
...(data.userAddress && {
|
|
766
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
767
|
-
}),
|
|
768
|
-
...(data.intentAddress && {
|
|
769
|
-
intentAddress: data.intentAddress,
|
|
770
|
-
}),
|
|
771
|
-
originChainId: data.originChainId?.toString(),
|
|
772
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
773
|
-
},
|
|
774
|
-
})
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// Wallet tracking methods
|
|
778
|
-
trackWalletConnected(data: {
|
|
779
|
-
walletType: string
|
|
780
|
-
address: string
|
|
781
|
-
chainId: number
|
|
782
|
-
[key: string]: AnalyticsPropValue
|
|
783
|
-
}) {
|
|
784
|
-
this.track({
|
|
785
|
-
event: EventType.WALLET_CONNECTED,
|
|
786
|
-
props: {
|
|
787
|
-
...this.getCommonProps(),
|
|
788
|
-
...data,
|
|
789
|
-
address: data.address,
|
|
790
|
-
chainId: data.chainId?.toString(),
|
|
791
|
-
},
|
|
792
|
-
})
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
trackWalletDisconnected(data?: { [key: string]: AnalyticsPropValue }) {
|
|
796
|
-
this.track({
|
|
797
|
-
event: EventType.WALLET_DISCONNECTED,
|
|
798
|
-
props: {
|
|
799
|
-
...this.getCommonProps(),
|
|
800
|
-
...(data || {}),
|
|
801
|
-
},
|
|
802
|
-
})
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
// Intent tracking methods
|
|
806
|
-
trackIntentQuoteRequested(data: {
|
|
807
|
-
originChainId: number
|
|
808
|
-
destinationChainId: number
|
|
809
|
-
originTokenAddress?: string
|
|
810
|
-
destinationTokenAddress?: string
|
|
811
|
-
userAddress?: string
|
|
812
|
-
mode?: string
|
|
813
|
-
fundMethod?: FundMethod
|
|
814
|
-
originTokenSymbol?: string
|
|
815
|
-
destinationTokenSymbol?: string
|
|
816
|
-
[key: string]: AnalyticsPropValue
|
|
817
|
-
}) {
|
|
818
|
-
// Auto-identify if userAddress provided but no ident set
|
|
819
|
-
this.autoIdentifyIfNeeded(data.userAddress, "trackIntentQuoteRequested")
|
|
820
|
-
this.track({
|
|
821
|
-
event: EventType.INTENT_QUOTE_REQUESTED,
|
|
822
|
-
props: {
|
|
823
|
-
...this.getCommonProps(),
|
|
824
|
-
checkoutId: getCheckoutId(),
|
|
825
|
-
originChainId: data.originChainId?.toString(),
|
|
826
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
827
|
-
originTokenAddress: data.originTokenAddress,
|
|
828
|
-
destinationTokenAddress: data.destinationTokenAddress,
|
|
829
|
-
...(data.userAddress && {
|
|
830
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
831
|
-
}),
|
|
832
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
833
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
834
|
-
},
|
|
835
|
-
})
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
trackIntentQuoteReceived(data: {
|
|
839
|
-
quoteId: string
|
|
840
|
-
totalFeeUSD?: string
|
|
841
|
-
trailsFixedFeeUSD?: number
|
|
842
|
-
crossChainFeeTotalUSD?: number
|
|
843
|
-
takerFeeUSD?: number
|
|
844
|
-
providerFeeUSD?: number
|
|
845
|
-
trailsSwapFeeUSD?: number
|
|
846
|
-
gasFeesPerChainUSD?: number[]
|
|
847
|
-
originTokenTotalAmount?: string
|
|
848
|
-
totalFeeAmount?: string
|
|
849
|
-
provider?: string
|
|
850
|
-
swapProvider?: string
|
|
851
|
-
bridgeProvider?: string
|
|
852
|
-
feeToken?: string
|
|
853
|
-
userAddress?: string
|
|
854
|
-
intentAddress?: string
|
|
855
|
-
mode?: string
|
|
856
|
-
fundMethod?: FundMethod
|
|
857
|
-
feeTokenSymbol?: string
|
|
858
|
-
originTokenSymbol?: string
|
|
859
|
-
destinationTokenSymbol?: string
|
|
860
|
-
depositTokenAmountUsd?: string
|
|
861
|
-
originPreconditionAmount?: string
|
|
862
|
-
destinationPreconditionAmount?: string
|
|
863
|
-
fromAmount?: string
|
|
864
|
-
fromAmountMin?: string
|
|
865
|
-
toAmount?: string
|
|
866
|
-
toAmountMin?: string
|
|
867
|
-
[key: string]: AnalyticsPropValue
|
|
868
|
-
}) {
|
|
869
|
-
// Auto-identify if userAddress provided but no ident set
|
|
870
|
-
this.autoIdentifyIfNeeded(data.userAddress, "trackIntentQuoteReceived")
|
|
871
|
-
this.track({
|
|
872
|
-
event: EventType.INTENT_QUOTE_RECEIVED,
|
|
873
|
-
props: {
|
|
874
|
-
...this.getCommonProps(),
|
|
875
|
-
quoteId: data.quoteId,
|
|
876
|
-
checkoutId: getCheckoutId(),
|
|
877
|
-
totalFeeUSD: data.totalFeeUSD?.toString(),
|
|
878
|
-
trailsFixedFeeUSD: data.trailsFixedFeeUSD?.toString(),
|
|
879
|
-
crossChainFeeTotalUSD: data.crossChainFeeTotalUSD?.toString(),
|
|
880
|
-
takerFeeUSD: data.takerFeeUSD?.toString(),
|
|
881
|
-
providerFeeUSD: data.providerFeeUSD?.toString(),
|
|
882
|
-
trailsSwapFeeUSD: data.trailsSwapFeeUSD?.toString(),
|
|
883
|
-
gasFeesPerChainUSD: data.gasFeesPerChainUSD
|
|
884
|
-
?.map((fee) => fee?.toString())
|
|
885
|
-
.join(","),
|
|
886
|
-
originTokenTotalAmount: data.originTokenTotalAmount?.toString(),
|
|
887
|
-
totalFeeAmount: data.totalFeeAmount?.toString(),
|
|
888
|
-
provider: data.provider,
|
|
889
|
-
swapProvider: data.swapProvider,
|
|
890
|
-
bridgeProvider: data.bridgeProvider,
|
|
891
|
-
feeToken: data.feeToken,
|
|
892
|
-
...(data.userAddress && {
|
|
893
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
894
|
-
}),
|
|
895
|
-
...(data.intentAddress && {
|
|
896
|
-
intentAddress: data.intentAddress,
|
|
897
|
-
}),
|
|
898
|
-
feeTokenSymbol: data.feeTokenSymbol,
|
|
899
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
900
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
901
|
-
depositTokenAmountUsd: data.depositTokenAmountUsd?.toString(),
|
|
902
|
-
originPreconditionAmount: data.originPreconditionAmount?.toString(),
|
|
903
|
-
destinationPreconditionAmount:
|
|
904
|
-
data.destinationPreconditionAmount?.toString(),
|
|
905
|
-
fromAmount: data.fromAmount?.toString(),
|
|
906
|
-
fromAmountMin: data.fromAmountMin?.toString(),
|
|
907
|
-
toAmount: data.toAmount?.toString(),
|
|
908
|
-
toAmountMin: data.toAmountMin?.toString(),
|
|
909
|
-
},
|
|
910
|
-
})
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
trackIntentQuoteError(data: {
|
|
914
|
-
error: string
|
|
915
|
-
userAddress?: string
|
|
916
|
-
originChainId?: number
|
|
917
|
-
destinationChainId?: number
|
|
918
|
-
originTokenAddress?: string
|
|
919
|
-
destinationTokenAddress?: string
|
|
920
|
-
mode?: string
|
|
921
|
-
fundMethod?: FundMethod
|
|
922
|
-
originTokenSymbol?: string
|
|
923
|
-
destinationTokenSymbol?: string
|
|
924
|
-
[key: string]: AnalyticsPropValue
|
|
925
|
-
}) {
|
|
926
|
-
this.track({
|
|
927
|
-
event: EventType.INTENT_QUOTE_ERROR,
|
|
928
|
-
props: {
|
|
929
|
-
...this.getCommonProps(),
|
|
930
|
-
checkoutId: getCheckoutId(),
|
|
931
|
-
...data,
|
|
932
|
-
...(data.userAddress && {
|
|
933
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
934
|
-
}),
|
|
935
|
-
originChainId: data.originChainId?.toString(),
|
|
936
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
937
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
938
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
939
|
-
},
|
|
940
|
-
})
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
trackIntentCommitStarted(data: {
|
|
944
|
-
intentAddress: string
|
|
945
|
-
userAddress?: string
|
|
946
|
-
originTokenSymbol?: string
|
|
947
|
-
destinationTokenSymbol?: string
|
|
948
|
-
[key: string]: AnalyticsPropValue
|
|
949
|
-
}) {
|
|
950
|
-
this.track({
|
|
951
|
-
event: EventType.INTENT_COMMIT_STARTED,
|
|
952
|
-
props: {
|
|
953
|
-
...this.getCommonProps(),
|
|
954
|
-
checkoutId: getCheckoutId(),
|
|
955
|
-
...data,
|
|
956
|
-
originChainId: data.originChainId?.toString(),
|
|
957
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
958
|
-
intentAddress: data.intentAddress,
|
|
959
|
-
...(data.userAddress && {
|
|
960
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
961
|
-
}),
|
|
962
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
963
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
964
|
-
},
|
|
965
|
-
})
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
trackIntentCommitCompleted(data: {
|
|
969
|
-
intentAddress: string
|
|
970
|
-
userAddress?: string
|
|
971
|
-
originTokenSymbol?: string
|
|
972
|
-
destinationTokenSymbol?: string
|
|
973
|
-
[key: string]: AnalyticsPropValue
|
|
974
|
-
}) {
|
|
975
|
-
this.track({
|
|
976
|
-
event: EventType.INTENT_COMMIT_COMPLETED,
|
|
977
|
-
props: {
|
|
978
|
-
...this.getCommonProps(),
|
|
979
|
-
checkoutId: getCheckoutId(),
|
|
980
|
-
...data,
|
|
981
|
-
originChainId: data.originChainId?.toString(),
|
|
982
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
983
|
-
intentAddress: data.intentAddress,
|
|
984
|
-
...(data.userAddress && {
|
|
985
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
986
|
-
}),
|
|
987
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
988
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
989
|
-
},
|
|
990
|
-
})
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
trackIntentCommitError(data: {
|
|
994
|
-
error: string
|
|
995
|
-
userAddress?: string
|
|
996
|
-
intentAddress?: string
|
|
997
|
-
originChainId?: number
|
|
998
|
-
destinationChainId?: number
|
|
999
|
-
mode?: string
|
|
1000
|
-
fundMethod?: FundMethod
|
|
1001
|
-
originTokenSymbol?: string
|
|
1002
|
-
destinationTokenSymbol?: string
|
|
1003
|
-
[key: string]: AnalyticsPropValue
|
|
1004
|
-
}) {
|
|
1005
|
-
this.track({
|
|
1006
|
-
event: EventType.INTENT_COMMIT_ERROR,
|
|
1007
|
-
props: {
|
|
1008
|
-
...this.getCommonProps(),
|
|
1009
|
-
checkoutId: getCheckoutId(),
|
|
1010
|
-
...data,
|
|
1011
|
-
...(data.userAddress && {
|
|
1012
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1013
|
-
}),
|
|
1014
|
-
...(data.intentAddress && {
|
|
1015
|
-
intentAddress: data.intentAddress,
|
|
1016
|
-
}),
|
|
1017
|
-
originChainId: data.originChainId?.toString(),
|
|
1018
|
-
destinationChainId: data.destinationChainId?.toString(),
|
|
1019
|
-
originTokenSymbol: data.originTokenSymbol,
|
|
1020
|
-
destinationTokenSymbol: data.destinationTokenSymbol,
|
|
1021
|
-
},
|
|
1022
|
-
})
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
// Transaction tracking methods
|
|
1026
|
-
trackTransactionStarted(data: {
|
|
1027
|
-
transactionType: string
|
|
1028
|
-
chainId: number
|
|
1029
|
-
userAddress?: string
|
|
1030
|
-
intentAddress?: string
|
|
1031
|
-
mode?: string
|
|
1032
|
-
fundMethod?: FundMethod
|
|
1033
|
-
depositTokenAmountUsd?: string
|
|
1034
|
-
[key: string]: AnalyticsPropValue
|
|
1035
|
-
}) {
|
|
1036
|
-
// Auto-identify if userAddress provided but no ident set
|
|
1037
|
-
this.autoIdentifyIfNeeded(data.userAddress, "trackTransactionStarted")
|
|
1038
|
-
|
|
1039
|
-
this.track({
|
|
1040
|
-
event: EventType.TRANSACTION_STARTED,
|
|
1041
|
-
props: {
|
|
1042
|
-
...this.getCommonProps(),
|
|
1043
|
-
checkoutId: getCheckoutId(),
|
|
1044
|
-
...data,
|
|
1045
|
-
...(data.userAddress && {
|
|
1046
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1047
|
-
}),
|
|
1048
|
-
...(data.intentAddress && {
|
|
1049
|
-
intentAddress: data.intentAddress,
|
|
1050
|
-
}),
|
|
1051
|
-
chainId: data.chainId?.toString(),
|
|
1052
|
-
depositTokenAmountUsd: data.depositTokenAmountUsd?.toString(),
|
|
1053
|
-
},
|
|
1054
|
-
})
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
trackTransactionSigned(data: {
|
|
1058
|
-
transactionHash: string
|
|
1059
|
-
userAddress?: string
|
|
1060
|
-
intentAddress?: string
|
|
1061
|
-
mode?: string
|
|
1062
|
-
fundMethod?: FundMethod
|
|
1063
|
-
depositTokenAmountUsd?: string
|
|
1064
|
-
[key: string]: AnalyticsPropValue
|
|
1065
|
-
}) {
|
|
1066
|
-
this.track({
|
|
1067
|
-
event: EventType.TRANSACTION_SIGNED,
|
|
1068
|
-
props: {
|
|
1069
|
-
...this.getCommonProps(),
|
|
1070
|
-
checkoutId: getCheckoutId(),
|
|
1071
|
-
...data,
|
|
1072
|
-
...(data.userAddress && {
|
|
1073
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1074
|
-
}),
|
|
1075
|
-
...(data.intentAddress && {
|
|
1076
|
-
intentAddress: data.intentAddress,
|
|
1077
|
-
}),
|
|
1078
|
-
depositTokenAmountUsd: data.depositTokenAmountUsd?.toString(),
|
|
1079
|
-
},
|
|
1080
|
-
})
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
trackTransactionSubmitted(data: {
|
|
1084
|
-
transactionHash: string
|
|
1085
|
-
chainId: number
|
|
1086
|
-
userAddress?: string
|
|
1087
|
-
intentAddress?: string
|
|
1088
|
-
mode?: string
|
|
1089
|
-
fundMethod?: FundMethod
|
|
1090
|
-
depositTokenAmountUsd?: string
|
|
1091
|
-
[key: string]: AnalyticsPropValue
|
|
1092
|
-
}) {
|
|
1093
|
-
this.track({
|
|
1094
|
-
event: EventType.TRANSACTION_SUBMITTED,
|
|
1095
|
-
props: {
|
|
1096
|
-
...this.getCommonProps(),
|
|
1097
|
-
checkoutId: getCheckoutId(),
|
|
1098
|
-
...data,
|
|
1099
|
-
...(data.userAddress && {
|
|
1100
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1101
|
-
}),
|
|
1102
|
-
...(data.intentAddress && {
|
|
1103
|
-
intentAddress: data.intentAddress,
|
|
1104
|
-
}),
|
|
1105
|
-
chainId: data.chainId?.toString(),
|
|
1106
|
-
depositTokenAmountUsd: data.depositTokenAmountUsd?.toString(),
|
|
1107
|
-
},
|
|
1108
|
-
})
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
trackTransactionConfirmed(data: {
|
|
1112
|
-
transactionHash: string
|
|
1113
|
-
blockNumber?: number
|
|
1114
|
-
userAddress?: string
|
|
1115
|
-
intentAddress?: string
|
|
1116
|
-
mode?: string
|
|
1117
|
-
fundMethod?: FundMethod
|
|
1118
|
-
depositTokenAmountUsd?: string
|
|
1119
|
-
[key: string]: AnalyticsPropValue
|
|
1120
|
-
}) {
|
|
1121
|
-
this.track({
|
|
1122
|
-
event: EventType.TRANSACTION_CONFIRMED,
|
|
1123
|
-
props: {
|
|
1124
|
-
...this.getCommonProps(),
|
|
1125
|
-
checkoutId: getCheckoutId(),
|
|
1126
|
-
...data,
|
|
1127
|
-
chainId: data.chainId?.toString(),
|
|
1128
|
-
...(data.userAddress && {
|
|
1129
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1130
|
-
}),
|
|
1131
|
-
...(data.intentAddress && {
|
|
1132
|
-
intentAddress: data.intentAddress,
|
|
1133
|
-
}),
|
|
1134
|
-
blockNumber: data.blockNumber?.toString(),
|
|
1135
|
-
depositTokenAmountUsd: data.depositTokenAmountUsd?.toString(),
|
|
1136
|
-
},
|
|
1137
|
-
})
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
trackTransactionError(data: {
|
|
1141
|
-
transactionHash: string
|
|
1142
|
-
error: string
|
|
1143
|
-
userAddress?: string
|
|
1144
|
-
intentAddress?: string
|
|
1145
|
-
mode?: string
|
|
1146
|
-
fundMethod?: FundMethod
|
|
1147
|
-
[key: string]: AnalyticsPropValue
|
|
1148
|
-
}) {
|
|
1149
|
-
this.track({
|
|
1150
|
-
event: EventType.TRANSACTION_ERROR,
|
|
1151
|
-
props: {
|
|
1152
|
-
...this.getCommonProps(),
|
|
1153
|
-
checkoutId: getCheckoutId(),
|
|
1154
|
-
...data,
|
|
1155
|
-
...(data.userAddress && {
|
|
1156
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1157
|
-
}),
|
|
1158
|
-
...(data.intentAddress && {
|
|
1159
|
-
intentAddress: data.intentAddress,
|
|
1160
|
-
}),
|
|
1161
|
-
},
|
|
1162
|
-
})
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
// Relayer tracking methods
|
|
1166
|
-
trackRelayerCallStarted(data: {
|
|
1167
|
-
walletAddress?: string
|
|
1168
|
-
contractAddress?: string
|
|
1169
|
-
chainId?: number
|
|
1170
|
-
mode?: string
|
|
1171
|
-
fundMethod?: FundMethod
|
|
1172
|
-
[key: string]: AnalyticsPropValue
|
|
1173
|
-
}) {
|
|
1174
|
-
this.track({
|
|
1175
|
-
event: EventType.RELAYER_CALL_STARTED,
|
|
1176
|
-
props: {
|
|
1177
|
-
...this.getCommonProps(),
|
|
1178
|
-
checkoutId: getCheckoutId(),
|
|
1179
|
-
...data,
|
|
1180
|
-
...(data.walletAddress && {
|
|
1181
|
-
walletAddress: data.walletAddress,
|
|
1182
|
-
}),
|
|
1183
|
-
...(data.contractAddress && {
|
|
1184
|
-
contractAddress: data.contractAddress,
|
|
1185
|
-
}),
|
|
1186
|
-
chainId: data.chainId?.toString(),
|
|
1187
|
-
},
|
|
1188
|
-
})
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
trackRelayerCallCompleted(data: {
|
|
1192
|
-
walletAddress?: string
|
|
1193
|
-
contractAddress?: string
|
|
1194
|
-
chainId?: number
|
|
1195
|
-
mode?: string
|
|
1196
|
-
fundMethod?: FundMethod
|
|
1197
|
-
[key: string]: AnalyticsPropValue
|
|
1198
|
-
}) {
|
|
1199
|
-
this.track({
|
|
1200
|
-
event: EventType.RELAYER_CALL_COMPLETED,
|
|
1201
|
-
props: {
|
|
1202
|
-
...this.getCommonProps(),
|
|
1203
|
-
checkoutId: getCheckoutId(),
|
|
1204
|
-
...data,
|
|
1205
|
-
...(data.walletAddress && {
|
|
1206
|
-
walletAddress: data.walletAddress,
|
|
1207
|
-
}),
|
|
1208
|
-
...(data.contractAddress && {
|
|
1209
|
-
contractAddress: data.contractAddress,
|
|
1210
|
-
}),
|
|
1211
|
-
chainId: data.chainId?.toString(),
|
|
1212
|
-
},
|
|
1213
|
-
})
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
trackRelayerCallError(data: {
|
|
1217
|
-
error: string
|
|
1218
|
-
walletAddress?: string
|
|
1219
|
-
contractAddress?: string
|
|
1220
|
-
chainId?: number
|
|
1221
|
-
mode?: string
|
|
1222
|
-
fundMethod?: FundMethod
|
|
1223
|
-
[key: string]: AnalyticsPropValue
|
|
1224
|
-
}) {
|
|
1225
|
-
this.track({
|
|
1226
|
-
event: EventType.RELAYER_CALL_ERROR,
|
|
1227
|
-
props: {
|
|
1228
|
-
...this.getCommonProps(),
|
|
1229
|
-
checkoutId: getCheckoutId(),
|
|
1230
|
-
...data,
|
|
1231
|
-
...(data.walletAddress && {
|
|
1232
|
-
walletAddress: data.walletAddress,
|
|
1233
|
-
}),
|
|
1234
|
-
...(data.contractAddress && {
|
|
1235
|
-
contractAddress: data.contractAddress,
|
|
1236
|
-
}),
|
|
1237
|
-
chainId: data.chainId?.toString(),
|
|
1238
|
-
},
|
|
1239
|
-
})
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
// Onramp tracking methods
|
|
1243
|
-
trackOnrampQuoteRequested(data: {
|
|
1244
|
-
sourceAmount?: string
|
|
1245
|
-
sourceCurrencyCode?: string
|
|
1246
|
-
destinationCurrencyCode?: string
|
|
1247
|
-
countryCode?: string
|
|
1248
|
-
walletAddress?: string
|
|
1249
|
-
sessionId?: string
|
|
1250
|
-
[key: string]: AnalyticsPropValue
|
|
1251
|
-
}) {
|
|
1252
|
-
this.track({
|
|
1253
|
-
event: EventType.ONRAMP_QUOTE_REQUESTED,
|
|
1254
|
-
props: {
|
|
1255
|
-
...this.getCommonProps(),
|
|
1256
|
-
checkoutId: getCheckoutId(),
|
|
1257
|
-
...data,
|
|
1258
|
-
...(data.walletAddress && {
|
|
1259
|
-
walletAddress: hashUserAddress(data.walletAddress),
|
|
1260
|
-
}),
|
|
1261
|
-
},
|
|
1262
|
-
})
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
trackOnrampQuoteReceived(data: {
|
|
1266
|
-
sessionId?: string
|
|
1267
|
-
provider?: string
|
|
1268
|
-
sourceAmount?: string
|
|
1269
|
-
sourceCurrencyCode?: string
|
|
1270
|
-
destinationAmount?: string
|
|
1271
|
-
destinationCurrencyCode?: string
|
|
1272
|
-
exchangeRate?: string
|
|
1273
|
-
networkFees?: string
|
|
1274
|
-
transactionFee?: string
|
|
1275
|
-
totalFees?: string
|
|
1276
|
-
countryCode?: string
|
|
1277
|
-
paymentMethod?: string
|
|
1278
|
-
quoteId?: string
|
|
1279
|
-
quotesCount?: number
|
|
1280
|
-
responseTime?: number
|
|
1281
|
-
walletAddress?: string
|
|
1282
|
-
[key: string]: AnalyticsPropValue
|
|
1283
|
-
}) {
|
|
1284
|
-
this.track({
|
|
1285
|
-
event: EventType.ONRAMP_QUOTE_RECEIVED,
|
|
1286
|
-
props: {
|
|
1287
|
-
...this.getCommonProps(),
|
|
1288
|
-
checkoutId: getCheckoutId(),
|
|
1289
|
-
...data,
|
|
1290
|
-
quotesCount: data.quotesCount?.toString(),
|
|
1291
|
-
responseTime: data.responseTime?.toString(),
|
|
1292
|
-
...(data.walletAddress && {
|
|
1293
|
-
walletAddress: hashUserAddress(data.walletAddress),
|
|
1294
|
-
}),
|
|
1295
|
-
},
|
|
1296
|
-
})
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
trackOnrampQuoteError(data: {
|
|
1300
|
-
error: string
|
|
1301
|
-
errorCode?: string
|
|
1302
|
-
sessionId?: string
|
|
1303
|
-
sourceAmount?: string
|
|
1304
|
-
sourceCurrencyCode?: string
|
|
1305
|
-
destinationCurrencyCode?: string
|
|
1306
|
-
countryCode?: string
|
|
1307
|
-
responseTime?: number
|
|
1308
|
-
walletAddress?: string
|
|
1309
|
-
[key: string]: AnalyticsPropValue
|
|
1310
|
-
}) {
|
|
1311
|
-
this.track({
|
|
1312
|
-
event: EventType.ONRAMP_QUOTE_ERROR,
|
|
1313
|
-
props: {
|
|
1314
|
-
...this.getCommonProps(),
|
|
1315
|
-
checkoutId: getCheckoutId(),
|
|
1316
|
-
...data,
|
|
1317
|
-
responseTime: data.responseTime?.toString(),
|
|
1318
|
-
...(data.walletAddress && {
|
|
1319
|
-
walletAddress: hashUserAddress(data.walletAddress),
|
|
1320
|
-
}),
|
|
1321
|
-
},
|
|
1322
|
-
})
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
trackWidgetClick(data: {
|
|
1326
|
-
component?: string
|
|
1327
|
-
action?: string
|
|
1328
|
-
label?: string
|
|
1329
|
-
value?: string | number
|
|
1330
|
-
userAddress?: string
|
|
1331
|
-
[key: string]: AnalyticsPropValue
|
|
1332
|
-
}) {
|
|
1333
|
-
const userAddress = data.userAddress
|
|
1334
|
-
this.autoIdentifyIfNeeded(userAddress, "trackWidgetClick")
|
|
1335
|
-
|
|
1336
|
-
this.track({
|
|
1337
|
-
event: EventType.WIDGET_CLICK,
|
|
1338
|
-
props: {
|
|
1339
|
-
...this.getCommonProps(),
|
|
1340
|
-
...data,
|
|
1341
|
-
userAddress: userAddress ? pseudonymize(userAddress) : undefined,
|
|
1342
|
-
},
|
|
1343
|
-
})
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
trackOnrampWidgetSession(data: {
|
|
1347
|
-
sessionId?: string
|
|
1348
|
-
provider?: string
|
|
1349
|
-
widgetUrl?: string
|
|
1350
|
-
depositAddress?: string
|
|
1351
|
-
userAddress?: string
|
|
1352
|
-
countryCode?: string
|
|
1353
|
-
sourceCurrencyCode?: string
|
|
1354
|
-
sourceAmount?: string
|
|
1355
|
-
destinationCurrencyCode?: string
|
|
1356
|
-
paymentMethodType?: string
|
|
1357
|
-
[key: string]: AnalyticsPropValue
|
|
1358
|
-
}) {
|
|
1359
|
-
this.track({
|
|
1360
|
-
event: EventType.ONRAMP_WIDGET_SESSION,
|
|
1361
|
-
props: {
|
|
1362
|
-
...this.getCommonProps(),
|
|
1363
|
-
checkoutId: getCheckoutId(),
|
|
1364
|
-
...data,
|
|
1365
|
-
...(data.userAddress && {
|
|
1366
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1367
|
-
}),
|
|
1368
|
-
},
|
|
1369
|
-
})
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
trackOnrampPaymentCompleted(data: {
|
|
1373
|
-
userAddress?: string
|
|
1374
|
-
intentId?: string
|
|
1375
|
-
intentAddress?: string
|
|
1376
|
-
fundMethod?: FundMethod
|
|
1377
|
-
sessionId?: string
|
|
1378
|
-
externalSessionId?: string
|
|
1379
|
-
transactionId?: string
|
|
1380
|
-
transactionHash?: string
|
|
1381
|
-
status?: string
|
|
1382
|
-
provider?: string
|
|
1383
|
-
sourceAmount?: string | number
|
|
1384
|
-
sourceCurrencyCode?: string
|
|
1385
|
-
destinationAmount?: string | number
|
|
1386
|
-
destinationCurrencyCode?: string
|
|
1387
|
-
countryCode?: string
|
|
1388
|
-
paymentMethodType?: string
|
|
1389
|
-
paymentMethod?: string
|
|
1390
|
-
[key: string]: AnalyticsPropValue
|
|
1391
|
-
}) {
|
|
1392
|
-
this.track({
|
|
1393
|
-
event: EventType.ONRAMP_PAYMENT_COMPLETED,
|
|
1394
|
-
props: {
|
|
1395
|
-
...this.getCommonProps(),
|
|
1396
|
-
checkoutId: getCheckoutId(),
|
|
1397
|
-
...data,
|
|
1398
|
-
sourceAmount: data.sourceAmount?.toString(),
|
|
1399
|
-
destinationAmount: data.destinationAmount?.toString(),
|
|
1400
|
-
...(data.userAddress && {
|
|
1401
|
-
userAddress: hashUserAddress(data.userAddress),
|
|
1402
|
-
}),
|
|
1403
|
-
},
|
|
1404
|
-
})
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
class Analytics extends BaseAnalytics {
|
|
1409
|
-
private databeat: Databeat<EventTypes>
|
|
1410
|
-
private loggingEnabled: boolean = false
|
|
1411
|
-
|
|
1412
|
-
constructor(
|
|
1413
|
-
server: string,
|
|
1414
|
-
auth: { jwt: string },
|
|
1415
|
-
config: object,
|
|
1416
|
-
sequenceProjectAccessKey?: string,
|
|
1417
|
-
) {
|
|
1418
|
-
super(sequenceProjectAccessKey)
|
|
1419
|
-
this.databeat = new Databeat<EventTypes>(server, auth, {
|
|
1420
|
-
userIdentTracking: true,
|
|
1421
|
-
privacy: {
|
|
1422
|
-
userIdHash: false, // Don't hash client-side, let server handle it
|
|
1423
|
-
userAgentSalt: false,
|
|
1424
|
-
},
|
|
1425
|
-
...config,
|
|
1426
|
-
})
|
|
1427
|
-
|
|
1428
|
-
// Emit VIEW event on instance creation
|
|
1429
|
-
setTimeout(() => {
|
|
1430
|
-
this.databeat.trackView()
|
|
1431
|
-
}, 100)
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
identifyUser({ address }: { address: string }) {
|
|
1435
|
-
if (getCheckoutUserId() !== address?.toLowerCase()) {
|
|
1436
|
-
resetCheckoutId()
|
|
1437
|
-
}
|
|
1438
|
-
const hashedAddress = hashUserAddress(address)
|
|
1439
|
-
logger.console.log("[trails-sdk] DEBUG: identifyUser called", {
|
|
1440
|
-
address,
|
|
1441
|
-
hashedAddress,
|
|
1442
|
-
timestamp: new Date().toISOString(),
|
|
1443
|
-
})
|
|
1444
|
-
this.databeat.identify(hashedAddress, {
|
|
1445
|
-
userIdHash: false,
|
|
1446
|
-
allowTracking: true,
|
|
1447
|
-
})
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
unidentifyUser() {
|
|
1451
|
-
resetCheckoutId()
|
|
1452
|
-
this.databeat.reset()
|
|
1453
|
-
this.databeat.identify()
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
protected getCurrentUserId(): string | undefined {
|
|
1457
|
-
return this.databeat.getUserId()
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
track(event: EventProps) {
|
|
1461
|
-
const databeatEvent: Event = {
|
|
1462
|
-
...event,
|
|
1463
|
-
props: toDatabeatProps(event.props),
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
return this.databeat
|
|
1467
|
-
.track(databeatEvent)
|
|
1468
|
-
.catch(() => {})
|
|
1469
|
-
.then(() => this.logEvent(event))
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
enable() {
|
|
1473
|
-
return this.databeat.enable()
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
allowTracking(allowTracking: boolean) {
|
|
1477
|
-
return this.databeat.allowTracking(allowTracking)
|
|
1478
|
-
}
|
|
1479
|
-
|
|
1480
|
-
disable() {
|
|
1481
|
-
return this.databeat.disable()
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
logEvent(event: EventProps) {
|
|
1485
|
-
if (this.loggingEnabled) {
|
|
1486
|
-
logger.console.log("[trails-sdk] Analytics track:", event)
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
getSessionId() {
|
|
1491
|
-
return this.databeat.getSessionId()
|
|
1492
|
-
}
|
|
1493
|
-
|
|
1494
|
-
getUserId() {
|
|
1495
|
-
return this.databeat.getUserId()
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
class MockAnalytics extends BaseAnalytics {
|
|
1500
|
-
private loggingEnabled: boolean = false
|
|
1501
|
-
|
|
1502
|
-
constructor({
|
|
1503
|
-
loggingEnabled,
|
|
1504
|
-
sequenceProjectAccessKey,
|
|
1505
|
-
}: {
|
|
1506
|
-
loggingEnabled: boolean
|
|
1507
|
-
sequenceProjectAccessKey?: string
|
|
1508
|
-
}) {
|
|
1509
|
-
super(sequenceProjectAccessKey)
|
|
1510
|
-
this.loggingEnabled = loggingEnabled
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
identifyUser(_data: { address: string }) {
|
|
1514
|
-
return this
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
unidentifyUser() {
|
|
1518
|
-
return this
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
enable() {
|
|
1522
|
-
return this
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
allowTracking(_allowTracking: boolean) {
|
|
1526
|
-
return this
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
track(event: EventProps) {
|
|
1530
|
-
this.logEvent(event)
|
|
1531
|
-
return this
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
disable() {
|
|
1535
|
-
return this
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
logEvent(event: EventProps) {
|
|
1539
|
-
if (this.loggingEnabled) {
|
|
1540
|
-
logger.console.log("[trails-sdk] MockAnalytics track:", event)
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
getSessionId() {
|
|
1545
|
-
return `0x${Math.random().toString(16).slice(2, 10)}`
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
getUserId() {
|
|
1549
|
-
return `0x${Math.random().toString(16).slice(2, 10)}`
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
|
|
1553
|
-
export function isLocalhost() {
|
|
1554
|
-
if (typeof window !== "undefined") {
|
|
1555
|
-
return (
|
|
1556
|
-
window.location.hostname === "localhost" ||
|
|
1557
|
-
window.location.hostname === "127.0.0.1"
|
|
1558
|
-
)
|
|
1559
|
-
}
|
|
1560
|
-
return false
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
let singleton: Analytics | MockAnalytics | null = null
|
|
1564
|
-
// Holds the key when updateProjectAccessKey is called before the singleton exists.
|
|
1565
|
-
let pendingProjectAccessKey: string | undefined
|
|
1566
|
-
|
|
1567
|
-
export const getAnalytics = (sequenceProjectAccessKey?: string) => {
|
|
1568
|
-
const debugLocalMode = getQueryParam("analyticsDebugLocal") === "true"
|
|
1569
|
-
const debugProdMode = getQueryParam("analyticsDebugProd") === "true"
|
|
1570
|
-
const isCI = getEnvVar("CI") === "true"
|
|
1571
|
-
|
|
1572
|
-
const enableMockAnalytics =
|
|
1573
|
-
(!DATABEAT_KEY || debugLocalMode || isCI) && !debugProdMode
|
|
1574
|
-
|
|
1575
|
-
// Use the pending key if no key is passed explicitly
|
|
1576
|
-
const effectiveKey = sequenceProjectAccessKey ?? pendingProjectAccessKey
|
|
1577
|
-
|
|
1578
|
-
if (!singleton) {
|
|
1579
|
-
if (enableMockAnalytics) {
|
|
1580
|
-
singleton = new MockAnalytics({
|
|
1581
|
-
loggingEnabled: !isCI,
|
|
1582
|
-
sequenceProjectAccessKey: effectiveKey,
|
|
1583
|
-
})
|
|
1584
|
-
} else {
|
|
1585
|
-
singleton = new Analytics(
|
|
1586
|
-
DATABEAT_SERVER,
|
|
1587
|
-
{
|
|
1588
|
-
jwt: DATABEAT_KEY,
|
|
1589
|
-
},
|
|
1590
|
-
{},
|
|
1591
|
-
effectiveKey,
|
|
1592
|
-
)
|
|
1593
|
-
}
|
|
1594
|
-
pendingProjectAccessKey = undefined
|
|
1595
|
-
} else if (effectiveKey) {
|
|
1596
|
-
// Update the existing singleton if a new key is provided
|
|
1597
|
-
singleton.updateProjectAccessKey(effectiveKey)
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
if (!isCI) {
|
|
1601
|
-
logger.console.log(
|
|
1602
|
-
"[trails-sdk] Analytics sessionId:",
|
|
1603
|
-
singleton.getSessionId(),
|
|
1604
|
-
"[trails-sdk] Analytics userId:",
|
|
1605
|
-
singleton.getUserId(),
|
|
1606
|
-
)
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
return singleton
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
export const updateProjectAccessKey = (sequenceProjectAccessKey: string) => {
|
|
1613
|
-
if (singleton) {
|
|
1614
|
-
singleton.updateProjectAccessKey(sequenceProjectAccessKey)
|
|
1615
|
-
} else {
|
|
1616
|
-
// Stash the key so getAnalytics() picks it up when the singleton is created
|
|
1617
|
-
pendingProjectAccessKey = sequenceProjectAccessKey
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
export const enableAnalytics = () => {
|
|
1622
|
-
const analytics = getAnalytics()
|
|
1623
|
-
analytics.enable()
|
|
1624
|
-
analytics.allowTracking(true)
|
|
1625
|
-
analytics.trackPageview()
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
export const disableAnalytics = () => {
|
|
1629
|
-
const analytics = getAnalytics()
|
|
1630
|
-
analytics.disable()
|
|
1631
|
-
analytics.allowTracking(false)
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
export const trackPageview = () => {
|
|
1635
|
-
const analytics = getAnalytics()
|
|
1636
|
-
analytics.trackPageview()
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
export const trackWidgetScreen = (data: {
|
|
1640
|
-
screen: string
|
|
1641
|
-
userAddress?: string
|
|
1642
|
-
[key: string]: AnalyticsPropValue
|
|
1643
|
-
}) => {
|
|
1644
|
-
const analytics = getAnalytics()
|
|
1645
|
-
analytics.trackWidgetScreen(data)
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
export const trackPaymentStarted = (data: {
|
|
1649
|
-
userAddress?: string
|
|
1650
|
-
intentAddress?: string
|
|
1651
|
-
originChainId?: number
|
|
1652
|
-
destinationChainId?: number
|
|
1653
|
-
originTokenAddress?: string
|
|
1654
|
-
originTokenAmount?: string
|
|
1655
|
-
originTokenDecimals?: number
|
|
1656
|
-
destinationTokenAddress?: string
|
|
1657
|
-
destinationTokenSymbol?: string
|
|
1658
|
-
destinationTokenAmount?: string
|
|
1659
|
-
destinationTokenDecimals?: number
|
|
1660
|
-
mode?: string
|
|
1661
|
-
fundMethod?: FundMethod
|
|
1662
|
-
sourceTokenPriceUsd?: string
|
|
1663
|
-
destinationTokenPriceUsd?: string
|
|
1664
|
-
tradeType?: string
|
|
1665
|
-
swapProvider?: string
|
|
1666
|
-
bridgeProvider?: string
|
|
1667
|
-
onramp?: OnrampTrackingData | null
|
|
1668
|
-
walletId?: string
|
|
1669
|
-
destinationCalldata?: string
|
|
1670
|
-
}) => {
|
|
1671
|
-
const analytics = getAnalytics()
|
|
1672
|
-
analytics.trackPaymentStarted(data)
|
|
1673
|
-
}
|
|
1674
|
-
|
|
1675
|
-
export const trackPaymentCompleted = (data: {
|
|
1676
|
-
userAddress?: string
|
|
1677
|
-
intentAddress?: string
|
|
1678
|
-
mode?: string
|
|
1679
|
-
fundMethod?: FundMethod
|
|
1680
|
-
swapProvider?: string
|
|
1681
|
-
bridgeProvider?: string
|
|
1682
|
-
onramp?: OnrampTrackingData | null
|
|
1683
|
-
[key: string]: AnalyticsPropValue
|
|
1684
|
-
}) => {
|
|
1685
|
-
const analytics = getAnalytics()
|
|
1686
|
-
analytics.trackPaymentCompleted(data)
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
export const trackPaymentError = (data: {
|
|
1690
|
-
error: string
|
|
1691
|
-
userAddress?: string
|
|
1692
|
-
intentAddress?: string
|
|
1693
|
-
mode?: string
|
|
1694
|
-
fundMethod?: FundMethod
|
|
1695
|
-
[key: string]: AnalyticsPropValue
|
|
1696
|
-
}) => {
|
|
1697
|
-
const analytics = getAnalytics()
|
|
1698
|
-
analytics.trackPaymentError(data)
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
// Wallet tracking exports
|
|
1702
|
-
export const trackWalletConnected = (data: {
|
|
1703
|
-
walletType: string
|
|
1704
|
-
address: string
|
|
1705
|
-
chainId: number
|
|
1706
|
-
[key: string]: AnalyticsPropValue
|
|
1707
|
-
}) => {
|
|
1708
|
-
const analytics = getAnalytics()
|
|
1709
|
-
analytics.identifyUser({ address: data.address })
|
|
1710
|
-
analytics.trackWalletConnected(data)
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
export const trackWalletDisconnected = (data?: {
|
|
1714
|
-
[key: string]: AnalyticsPropValue
|
|
1715
|
-
}) => {
|
|
1716
|
-
const analytics = getAnalytics()
|
|
1717
|
-
analytics.unidentifyUser()
|
|
1718
|
-
analytics.trackWalletDisconnected(data)
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
// Intent tracking exports
|
|
1722
|
-
export const trackIntentQuoteRequested = (data: {
|
|
1723
|
-
originChainId: number
|
|
1724
|
-
destinationChainId: number
|
|
1725
|
-
tokenAddress?: string
|
|
1726
|
-
userAddress?: string
|
|
1727
|
-
mode?: string
|
|
1728
|
-
fundMethod?: FundMethod
|
|
1729
|
-
[key: string]: AnalyticsPropValue
|
|
1730
|
-
}) => {
|
|
1731
|
-
const analytics = getAnalytics()
|
|
1732
|
-
analytics.trackIntentQuoteRequested(data)
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
export const trackIntentQuoteReceived = (data: {
|
|
1736
|
-
quoteId: string
|
|
1737
|
-
totalFeeUSD?: string
|
|
1738
|
-
trailsFixedFeeUSD?: number
|
|
1739
|
-
crossChainFeeTotalUSD?: number
|
|
1740
|
-
takerFeeUSD?: number
|
|
1741
|
-
providerFeeUSD?: number
|
|
1742
|
-
trailsSwapFeeUSD?: number
|
|
1743
|
-
gasFeesPerChainUSD?: number[]
|
|
1744
|
-
originTokenTotalAmount?: string
|
|
1745
|
-
destinationTokenAmount?: string
|
|
1746
|
-
provider?: string
|
|
1747
|
-
swapProvider?: string
|
|
1748
|
-
bridgeProvider?: string
|
|
1749
|
-
feeToken?: string
|
|
1750
|
-
userAddress?: string
|
|
1751
|
-
intentAddress?: string
|
|
1752
|
-
mode?: string
|
|
1753
|
-
fundMethod?: FundMethod
|
|
1754
|
-
originPreconditionAmount?: string
|
|
1755
|
-
destinationPreconditionAmount?: string
|
|
1756
|
-
[key: string]: AnalyticsPropValue
|
|
1757
|
-
}) => {
|
|
1758
|
-
const analytics = getAnalytics()
|
|
1759
|
-
analytics.trackIntentQuoteReceived(data)
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
export const trackIntentQuoteError = (data: {
|
|
1763
|
-
error: string
|
|
1764
|
-
userAddress?: string
|
|
1765
|
-
originChainId?: number
|
|
1766
|
-
destinationChainId?: number
|
|
1767
|
-
originTokenAddress?: string
|
|
1768
|
-
destinationTokenAddress?: string
|
|
1769
|
-
mode?: string
|
|
1770
|
-
fundMethod?: FundMethod
|
|
1771
|
-
[key: string]: AnalyticsPropValue
|
|
1772
|
-
}) => {
|
|
1773
|
-
const analytics = getAnalytics()
|
|
1774
|
-
analytics.trackIntentQuoteError(data)
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
export const trackIntentCommitStarted = (data: {
|
|
1778
|
-
intentAddress: string
|
|
1779
|
-
userAddress?: string
|
|
1780
|
-
originChainId?: number
|
|
1781
|
-
destinationChainId?: number
|
|
1782
|
-
mode?: string
|
|
1783
|
-
fundMethod?: FundMethod
|
|
1784
|
-
[key: string]: AnalyticsPropValue
|
|
1785
|
-
}) => {
|
|
1786
|
-
const analytics = getAnalytics()
|
|
1787
|
-
analytics.trackIntentCommitStarted(data)
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
export const trackIntentCommitCompleted = (data: {
|
|
1791
|
-
intentAddress: string
|
|
1792
|
-
userAddress?: string
|
|
1793
|
-
originChainId?: number
|
|
1794
|
-
destinationChainId?: number
|
|
1795
|
-
mode?: string
|
|
1796
|
-
fundMethod?: FundMethod
|
|
1797
|
-
[key: string]: AnalyticsPropValue
|
|
1798
|
-
}) => {
|
|
1799
|
-
const analytics = getAnalytics()
|
|
1800
|
-
analytics.trackIntentCommitCompleted(data)
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
export const trackIntentCommitError = (data: {
|
|
1804
|
-
error: string
|
|
1805
|
-
userAddress?: string
|
|
1806
|
-
intentAddress?: string
|
|
1807
|
-
originChainId?: number
|
|
1808
|
-
destinationChainId?: number
|
|
1809
|
-
mode?: string
|
|
1810
|
-
fundMethod?: FundMethod
|
|
1811
|
-
[key: string]: AnalyticsPropValue
|
|
1812
|
-
}) => {
|
|
1813
|
-
const analytics = getAnalytics()
|
|
1814
|
-
analytics.trackIntentCommitError(data)
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
// Transaction tracking exports
|
|
1818
|
-
export const trackTransactionStarted = (data: {
|
|
1819
|
-
transactionType: string
|
|
1820
|
-
chainId: number
|
|
1821
|
-
userAddress?: string
|
|
1822
|
-
intentAddress?: string
|
|
1823
|
-
mode?: string
|
|
1824
|
-
fundMethod?: FundMethod
|
|
1825
|
-
[key: string]: AnalyticsPropValue
|
|
1826
|
-
}) => {
|
|
1827
|
-
const analytics = getAnalytics()
|
|
1828
|
-
analytics.trackTransactionStarted(data)
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
export const trackTransactionSigned = (data: {
|
|
1832
|
-
transactionHash: string
|
|
1833
|
-
userAddress?: string
|
|
1834
|
-
intentAddress?: string
|
|
1835
|
-
mode?: string
|
|
1836
|
-
fundMethod?: FundMethod
|
|
1837
|
-
[key: string]: AnalyticsPropValue
|
|
1838
|
-
}) => {
|
|
1839
|
-
const analytics = getAnalytics()
|
|
1840
|
-
analytics.trackTransactionSigned(data)
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
export const trackTransactionSubmitted = (data: {
|
|
1844
|
-
transactionHash: string
|
|
1845
|
-
chainId: number
|
|
1846
|
-
userAddress?: string
|
|
1847
|
-
intentAddress?: string
|
|
1848
|
-
mode?: string
|
|
1849
|
-
fundMethod?: FundMethod
|
|
1850
|
-
[key: string]: AnalyticsPropValue
|
|
1851
|
-
}) => {
|
|
1852
|
-
const analytics = getAnalytics()
|
|
1853
|
-
analytics.trackTransactionSubmitted(data)
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
export const trackTransactionConfirmed = (data: {
|
|
1857
|
-
transactionHash: string
|
|
1858
|
-
blockNumber?: number
|
|
1859
|
-
userAddress?: string
|
|
1860
|
-
intentAddress?: string
|
|
1861
|
-
mode?: string
|
|
1862
|
-
fundMethod?: FundMethod
|
|
1863
|
-
[key: string]: AnalyticsPropValue
|
|
1864
|
-
}) => {
|
|
1865
|
-
const analytics = getAnalytics()
|
|
1866
|
-
analytics.trackTransactionConfirmed(data)
|
|
1867
|
-
}
|
|
1868
|
-
|
|
1869
|
-
export const trackTransactionError = (data: {
|
|
1870
|
-
transactionHash: string
|
|
1871
|
-
error: string
|
|
1872
|
-
userAddress?: string
|
|
1873
|
-
intentAddress?: string
|
|
1874
|
-
mode?: string
|
|
1875
|
-
fundMethod?: FundMethod
|
|
1876
|
-
[key: string]: AnalyticsPropValue
|
|
1877
|
-
}) => {
|
|
1878
|
-
const analytics = getAnalytics()
|
|
1879
|
-
analytics.trackTransactionError(data)
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
// Relayer tracking exports
|
|
1883
|
-
export const trackRelayerCallStarted = (data: {
|
|
1884
|
-
walletAddress?: string
|
|
1885
|
-
contractAddress?: string
|
|
1886
|
-
chainId?: number
|
|
1887
|
-
mode?: string
|
|
1888
|
-
fundMethod?: FundMethod
|
|
1889
|
-
[key: string]: AnalyticsPropValue
|
|
1890
|
-
}) => {
|
|
1891
|
-
const analytics = getAnalytics()
|
|
1892
|
-
analytics.trackRelayerCallStarted(data)
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
export const trackRelayerCallCompleted = (data: {
|
|
1896
|
-
walletAddress?: string
|
|
1897
|
-
contractAddress?: string
|
|
1898
|
-
chainId?: number
|
|
1899
|
-
mode?: string
|
|
1900
|
-
fundMethod?: FundMethod
|
|
1901
|
-
[key: string]: AnalyticsPropValue
|
|
1902
|
-
}) => {
|
|
1903
|
-
const analytics = getAnalytics()
|
|
1904
|
-
analytics.trackRelayerCallCompleted(data)
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
export const trackRelayerCallError = (data: {
|
|
1908
|
-
error: string
|
|
1909
|
-
walletAddress?: string
|
|
1910
|
-
contractAddress?: string
|
|
1911
|
-
chainId?: number
|
|
1912
|
-
mode?: string
|
|
1913
|
-
fundMethod?: FundMethod
|
|
1914
|
-
[key: string]: AnalyticsPropValue
|
|
1915
|
-
}) => {
|
|
1916
|
-
const analytics = getAnalytics()
|
|
1917
|
-
analytics.trackRelayerCallError(data)
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
// Onramp tracking exports
|
|
1921
|
-
export const trackOnrampQuoteRequested = (data: {
|
|
1922
|
-
sourceAmount?: string
|
|
1923
|
-
sourceCurrencyCode?: string
|
|
1924
|
-
destinationCurrencyCode?: string
|
|
1925
|
-
countryCode?: string
|
|
1926
|
-
walletAddress?: string
|
|
1927
|
-
sessionId?: string
|
|
1928
|
-
[key: string]: AnalyticsPropValue
|
|
1929
|
-
}) => {
|
|
1930
|
-
const analytics = getAnalytics()
|
|
1931
|
-
analytics.trackOnrampQuoteRequested(data)
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
export const trackOnrampQuoteReceived = (data: {
|
|
1935
|
-
sessionId?: string
|
|
1936
|
-
provider?: string
|
|
1937
|
-
sourceAmount?: string
|
|
1938
|
-
sourceCurrencyCode?: string
|
|
1939
|
-
destinationAmount?: string
|
|
1940
|
-
destinationCurrencyCode?: string
|
|
1941
|
-
exchangeRate?: string
|
|
1942
|
-
networkFees?: string
|
|
1943
|
-
transactionFee?: string
|
|
1944
|
-
totalFees?: string
|
|
1945
|
-
countryCode?: string
|
|
1946
|
-
paymentMethod?: string
|
|
1947
|
-
quoteId?: string
|
|
1948
|
-
quotesCount?: number
|
|
1949
|
-
responseTime?: number
|
|
1950
|
-
walletAddress?: string
|
|
1951
|
-
[key: string]: AnalyticsPropValue
|
|
1952
|
-
}) => {
|
|
1953
|
-
const analytics = getAnalytics()
|
|
1954
|
-
analytics.trackOnrampQuoteReceived(data)
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
export const trackOnrampQuoteError = (data: {
|
|
1958
|
-
error: string
|
|
1959
|
-
errorCode?: string
|
|
1960
|
-
sessionId?: string
|
|
1961
|
-
sourceAmount?: string
|
|
1962
|
-
sourceCurrencyCode?: string
|
|
1963
|
-
destinationCurrencyCode?: string
|
|
1964
|
-
countryCode?: string
|
|
1965
|
-
responseTime?: number
|
|
1966
|
-
walletAddress?: string
|
|
1967
|
-
[key: string]: AnalyticsPropValue
|
|
1968
|
-
}) => {
|
|
1969
|
-
const analytics = getAnalytics()
|
|
1970
|
-
analytics.trackOnrampQuoteError(data)
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
export const trackWidgetClick = (data: {
|
|
1974
|
-
component?: string
|
|
1975
|
-
action?: string
|
|
1976
|
-
label?: string
|
|
1977
|
-
value?: string | number
|
|
1978
|
-
userAddress?: string
|
|
1979
|
-
[key: string]: AnalyticsPropValue
|
|
1980
|
-
}) => {
|
|
1981
|
-
const analytics = getAnalytics()
|
|
1982
|
-
analytics.trackWidgetClick(data)
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
export const trackOnrampWidgetSession = (data: {
|
|
1986
|
-
sessionId?: string
|
|
1987
|
-
provider?: string
|
|
1988
|
-
widgetUrl?: string
|
|
1989
|
-
depositAddress?: string
|
|
1990
|
-
userAddress?: string
|
|
1991
|
-
countryCode?: string
|
|
1992
|
-
sourceCurrencyCode?: string
|
|
1993
|
-
sourceAmount?: string
|
|
1994
|
-
destinationCurrencyCode?: string
|
|
1995
|
-
paymentMethodType?: string
|
|
1996
|
-
[key: string]: AnalyticsPropValue
|
|
1997
|
-
}) => {
|
|
1998
|
-
const analytics = getAnalytics()
|
|
1999
|
-
analytics.trackOnrampWidgetSession(data)
|
|
2000
|
-
}
|
|
2001
|
-
|
|
2002
|
-
export const trackOnrampPaymentCompleted = (data: {
|
|
2003
|
-
userAddress?: string
|
|
2004
|
-
intentId?: string
|
|
2005
|
-
intentAddress?: string
|
|
2006
|
-
fundMethod?: FundMethod
|
|
2007
|
-
sessionId?: string
|
|
2008
|
-
externalSessionId?: string
|
|
2009
|
-
transactionId?: string
|
|
2010
|
-
transactionHash?: string
|
|
2011
|
-
status?: string
|
|
2012
|
-
provider?: string
|
|
2013
|
-
sourceAmount?: string | number
|
|
2014
|
-
sourceCurrencyCode?: string
|
|
2015
|
-
destinationAmount?: string | number
|
|
2016
|
-
destinationCurrencyCode?: string
|
|
2017
|
-
countryCode?: string
|
|
2018
|
-
paymentMethodType?: string
|
|
2019
|
-
paymentMethod?: string
|
|
2020
|
-
[key: string]: AnalyticsPropValue
|
|
2021
|
-
}) => {
|
|
2022
|
-
const analytics = getAnalytics()
|
|
2023
|
-
analytics.trackOnrampPaymentCompleted(data)
|
|
2024
|
-
}
|
|
2025
|
-
|
|
2026
|
-
export function getSessionId() {
|
|
2027
|
-
const analytics = getAnalytics()
|
|
2028
|
-
return analytics.getSessionId()
|
|
2029
|
-
}
|