0xtrails 0.15.0 → 0.15.1
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/README.md +458 -9
- package/dist/_virtual/_@oxc-project_runtime@0.126.0/helpers/defineProperty.js +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.126.0/helpers/toPrimitive.js +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.126.0/helpers/toPropertyKey.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.126.0/helpers/typeof.js +11 -0
- package/dist/abis/requireUtils.js +168 -0
- package/dist/abis/trailsRouter.js +66 -0
- package/dist/abortController.js +23 -0
- package/dist/actions/actionBuilder.js +161 -0
- package/dist/actions/constants.d.ts +9 -9
- package/dist/actions/constants.d.ts.map +1 -1
- package/dist/actions/constants.js +38 -0
- package/dist/actions/custom-integrations/sushiswapV3/addresses.js +33 -0
- package/dist/actions/custom-integrations/sushiswapV3/calldata.js +124 -0
- package/dist/actions/custom-integrations/sushiswapV3/calls.js +27 -0
- package/dist/actions/custom-integrations/sushiswapV3/helpers.js +27 -0
- package/dist/actions/custom-integrations/sushiswapV3/sushiswapV3.js +246 -0
- package/dist/actions/custom-integrations/uniswapV3/addresses.js +33 -0
- package/dist/actions/custom-integrations/uniswapV3/calldata.js +190 -0
- package/dist/actions/custom-integrations/uniswapV3/calls.js +27 -0
- package/dist/actions/custom-integrations/uniswapV3/helpers.js +27 -0
- package/dist/actions/custom-integrations/uniswapV3/uniswapV3.js +244 -0
- package/dist/actions/destinationCalls.js +36 -0
- package/dist/actions/dynamic.js +27 -0
- package/dist/actions/hooks/useEarnBalances.js +37 -0
- package/dist/actions/hooks/useEarnMarkets.js +30 -0
- package/dist/actions/hooks/useEarnProviders.js +25 -0
- package/dist/actions/hooks/useResolveActions.js +238 -0
- package/dist/actions/index.d.ts +12 -3
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +28 -11
- package/dist/actions/resolvers.js +161 -0
- package/dist/actions/types.js +24 -0
- package/dist/actions/utils.js +193 -0
- package/dist/analytics/hooks/useWidgetAnalytics.js +41 -0
- package/dist/analytics.js +881 -0
- package/dist/chainSwitch.js +66 -0
- package/dist/chains.js +252 -0
- package/dist/committedIntentStore.js +52 -0
- package/dist/config.js +53 -0
- package/dist/constants.js +194 -0
- package/dist/contractUtils.js +19 -0
- package/dist/cssUtils.js +7 -0
- package/dist/customChains.js +20 -0
- package/dist/customTokens.js +64 -0
- package/dist/decoders.js +181 -0
- package/dist/ens.js +69 -0
- package/dist/error.js +298 -0
- package/dist/estimate.js +147 -0
- package/dist/explorer.js +15 -0
- package/dist/fees.js +160 -0
- package/dist/gasless.js +314 -0
- package/dist/hooks/index.d.ts +38 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +66 -0
- package/dist/hooks/persistedToken.js +65 -0
- package/dist/hooks/prepareTrailsSendTransactionDestination.js +33 -0
- package/dist/hooks/useAddressWalletIcon.js +33 -0
- package/dist/hooks/useAmountUsd.js +21 -0
- package/dist/hooks/useBalanceVisible.js +46 -0
- package/dist/hooks/useChainFilter.js +24 -0
- package/dist/hooks/useCheckout.js +118 -0
- package/dist/hooks/useClickTracking.js +37 -0
- package/dist/hooks/useCombinedHistory.js +160 -0
- package/dist/hooks/useConnector.js +11 -0
- package/dist/hooks/useCustomTokenSearch.d.ts.map +1 -1
- package/dist/hooks/useCustomTokenSearch.js +167 -0
- package/dist/hooks/useDebounce.js +15 -0
- package/dist/hooks/useDebugScreens.js +412 -0
- package/dist/hooks/useDefaultDestinationToken.js +60 -0
- package/dist/hooks/useDefaultOriginToken.js +127 -0
- package/dist/hooks/useDepositMonitor.js +54 -0
- package/dist/hooks/useDestinationSelectedToken.js +144 -0
- package/dist/hooks/useDisplayCurrencyPreference.js +57 -0
- package/dist/hooks/useEarnPool.js +21 -0
- package/dist/hooks/useEffectiveFundBalance.js +24 -0
- package/dist/hooks/useExternalFundingReceiptSync.js +32 -0
- package/dist/hooks/useFiatOnRampCurrencies.js +14 -0
- package/dist/hooks/useFiatSelectedCurrency.js +55 -0
- package/dist/hooks/useGetIntent.js +26 -0
- package/dist/hooks/useIntentReceiptBalances.js +77 -0
- package/dist/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/hooks/useIntentTransactionHistory.js +332 -0
- package/dist/hooks/useIsMobile.js +21 -0
- package/dist/hooks/useIsSequenceWallet.js +10 -0
- package/dist/hooks/useLocalePreference.js +193 -0
- package/dist/hooks/useMeldTransactionHistory.js +71 -0
- package/dist/hooks/useMeldTransactionStatus.js +284 -0
- package/dist/hooks/useOnRampCountryDefaults.js +20 -0
- package/dist/hooks/useOnRampPaymentMethods.js +27 -0
- package/dist/hooks/useOnRampProviderWidget.js +70 -0
- package/dist/hooks/useOnRampQuote.js +159 -0
- package/dist/hooks/useOriginSelectedToken.js +61 -0
- package/dist/hooks/usePayMessage.js +333 -0
- package/dist/hooks/usePriceImpactWarning.js +9 -0
- package/dist/hooks/useQuote.js +595 -0
- package/dist/hooks/useRecentTokens.js +82 -0
- package/dist/hooks/useRecipients.js +75 -0
- package/dist/hooks/useSelectedFeeOption.js +113 -0
- package/dist/hooks/useSelectedFundMethod.js +42 -0
- package/dist/hooks/useSelectedRecipient.js +39 -0
- package/dist/hooks/useSendForm.d.ts.map +1 -1
- package/dist/hooks/useSendForm.js +585 -0
- package/dist/hooks/useSwapAmount.js +24 -0
- package/dist/hooks/useSwapState.js +44 -0
- package/dist/hooks/useTargetAmount.js +17 -0
- package/dist/hooks/useTheme.js +47 -0
- package/dist/hooks/useTokenList.d.ts +3 -1
- package/dist/hooks/useTokenList.d.ts.map +1 -1
- package/dist/hooks/useTokenList.js +461 -0
- package/dist/hooks/useTokens.d.ts +52 -0
- package/dist/hooks/useTokens.d.ts.map +1 -0
- package/dist/hooks/useTokens.js +166 -0
- package/dist/hooks/useTrailsSendTransaction.d.ts +2 -0
- package/dist/hooks/useTrailsSendTransaction.d.ts.map +1 -1
- package/dist/hooks/useTrailsSendTransaction.js +435 -0
- package/dist/hooks/useViewManager.js +274 -0
- package/dist/hooks/useWalletConnectUri.js +122 -0
- package/dist/hooks/useWalletConnectionContext.js +53 -0
- package/dist/hooks/useWidgetProps.js +18 -0
- package/dist/hydrate/builder.js +210 -0
- package/dist/hydrate/constants.js +5 -0
- package/dist/hydrate/encodeExecute.js +60 -0
- package/dist/hydrate/index.js +16 -11
- package/dist/hydrate/multicall.js +131 -0
- package/dist/hydrate/payload.js +26 -0
- package/dist/hydrate/selectors.js +326 -0
- package/dist/hydrate/source.js +19 -0
- package/dist/hydrate/utils.js +23 -0
- package/dist/index.d.ts +14 -52
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +263 -188
- package/dist/indexerClient.js +42 -0
- package/dist/intentConfigStore.js +40 -0
- package/dist/intentProtocolApi.js +11 -0
- package/dist/intentProtocolEncoding.js +114 -0
- package/dist/intentProtocolResolver.js +34 -0
- package/dist/intentReceiptMonitor.js +30 -0
- package/dist/intentReceiptPoller.js +162 -0
- package/dist/intentValidation.js +19 -0
- package/dist/intents.js +396 -0
- package/dist/keyMachineClient.js +13 -0
- package/dist/keymachine/index.js +92 -0
- package/dist/keymachine/key-machine.gen.js +164 -0
- package/dist/localeUtils.js +60 -0
- package/dist/logger/index.js +57 -0
- package/dist/logger/useSyncLoggerDebug.js +9 -0
- package/dist/meld/components/MeldCountriesList.js +167 -0
- package/dist/meld/components/MeldFundMethods.js +163 -0
- package/dist/meld/components/MeldProvidersList.js +145 -0
- package/dist/meld/components/MeldTokensList.js +215 -0
- package/dist/meld/components/SimpleHeader.js +18 -0
- package/dist/meld/utils/meld.js +24 -0
- package/dist/mutations.js +91 -0
- package/dist/offlineRecovery.d.ts.map +1 -1
- package/dist/offlineRecovery.js +224 -0
- package/dist/onramp/MeshConnectFlow.js +41 -0
- package/dist/onramp/MeshConnectIframe.d.ts.map +1 -1
- package/dist/onramp/MeshConnectIframe.js +434 -0
- package/dist/onramp/SendFromExchangeButton.js +36 -0
- package/dist/onramp/TrailsOnRampProvider.js +25 -0
- package/dist/onramp/mesh/components/MeshExchangeConfirmation.js +62 -0
- package/dist/onramp/mesh/components/MeshExchangeIcon.js +54 -0
- package/dist/onramp/mesh/components/MeshExchangeSelection.js +135 -0
- package/dist/onramp/mesh/components/MeshSessionOptions.js +68 -0
- package/dist/onramp/mesh/hooks/useMeshAccessTokens.js +38 -0
- package/dist/onramp/mesh/hooks/useMeshFundingSelection.js +21 -0
- package/dist/onramp/mesh/hooks/useMeshOnrampFlow.js +168 -0
- package/dist/onramp/mesh/hooks/useMeshOnrampSessionState.js +28 -0
- package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.js +57 -0
- package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.js +45 -0
- package/dist/onramp/mesh/hooks/useMeshSessionStorage.js +20 -0
- package/dist/onramp/meshSessionStorage.js +165 -0
- package/dist/onramp/meshconnect.js +124 -0
- package/dist/onramp/trailsOnramp.js +60 -0
- package/dist/onramp-client/index.js +19 -0
- package/dist/onrampClient.js +27 -0
- package/dist/package.js +121 -0
- package/dist/placeholder.js +95 -0
- package/dist/poolUtils.js +87 -0
- package/dist/pools.js +77 -0
- package/dist/prepareSend.js +206 -0
- package/dist/query/balance.fetchers.js +289 -0
- package/dist/query/balance.hooks.js +123 -0
- package/dist/query/balance.queries.js +142 -0
- package/dist/query/chains.hooks.js +39 -0
- package/dist/query/chains.queries.js +17 -0
- package/dist/query/client.js +15 -0
- package/dist/query/fiat.fetchers.js +10 -0
- package/dist/query/fiat.hooks.js +20 -0
- package/dist/query/fiat.queries.js +39 -0
- package/dist/query/geo.fetchers.js +61 -0
- package/dist/query/geo.hooks.js +17 -0
- package/dist/query/geo.queries.js +33 -0
- package/dist/query/helpers.js +31 -0
- package/dist/query/intentProtocol.queries.js +41 -0
- package/dist/query/meld.fetchers.js +41 -0
- package/dist/query/meld.hooks.js +15 -0
- package/dist/query/meld.queries.js +97 -0
- package/dist/query/persister.d.ts +1 -0
- package/dist/query/persister.d.ts.map +1 -1
- package/dist/query/persister.js +13 -0
- package/dist/query/price.fetchers.js +26 -0
- package/dist/query/price.hooks.js +35 -0
- package/dist/query/price.queries.d.ts.map +1 -1
- package/dist/query/price.queries.js +139 -0
- package/dist/query/tokenList.queries.js +77 -0
- package/dist/queryParams.d.ts +1 -1
- package/dist/queryParams.d.ts.map +1 -1
- package/dist/queryParamsCore.d.ts +2 -0
- package/dist/queryParamsCore.d.ts.map +1 -0
- package/dist/queryParamsCore.js +10 -0
- package/dist/recover.js +641 -0
- package/dist/toast.js +31 -0
- package/dist/tokens.d.ts +20 -71
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +899 -0
- package/dist/tokensApi.d.ts +8 -0
- package/dist/tokensApi.d.ts.map +1 -0
- package/dist/tokensApi.js +56 -0
- package/dist/trailsClient.js +29 -0
- package/dist/transactionIntent/constants.js +11 -0
- package/dist/transactionIntent/deposits/depositOrchestrator.js +88 -0
- package/dist/transactionIntent/deposits/gaslessDeposit.js +215 -0
- package/dist/transactionIntent/deposits/standardDeposit.js +131 -0
- package/dist/transactionIntent/execution/transactionState.js +21 -0
- package/dist/transactionIntent/handlers/intentHandler.js +533 -0
- package/dist/transactionIntent/helpers/transactionStateHelpers.js +124 -0
- package/dist/transactionIntent/quote/feeExtractors.js +41 -0
- package/dist/transactionIntent/quote/normalizeQuote.js +214 -0
- package/dist/transactionIntent/quote/quoteHelpers.js +44 -0
- package/dist/transactionIntent/types.js +21 -0
- package/dist/transactionIntent/utils/balanceChecker.js +55 -0
- package/dist/transactionIntent/utils/resilientDepositTracker.js +62 -0
- package/dist/transactionIntent/validators.js +11 -0
- package/dist/transactions.js +115 -0
- package/dist/umd/trails.min.js +246 -259
- package/dist/utils/address.js +30 -0
- package/dist/utils/fiat.js +30 -0
- package/dist/utils/format.js +274 -0
- package/dist/utils/localStorageGc.js +53 -0
- package/dist/utils/passthrough.js +20 -0
- package/dist/utils/time.js +68 -0
- package/dist/utils/validation.js +80 -0
- package/dist/utils.js +58 -0
- package/dist/version.js +9 -0
- package/dist/walletUtils.js +110 -0
- package/dist/wallets.js +236 -0
- package/dist/widget/assets/FundMethod-card-brands.js +4 -0
- package/dist/widget/assets/FundMethod-exchange-brands.js +4 -0
- package/dist/widget/assets/Trails-logo-black.js +4 -0
- package/dist/widget/assets/Trails-logo-white.js +4 -0
- package/dist/widget/assets/aave.js +4 -0
- package/dist/widget/assets/morpho.js +4 -0
- package/dist/widget/components/AccountActionsDropdown.js +23 -0
- package/dist/widget/components/AccountIntentTransactionHistory.js +473 -0
- package/dist/widget/components/AccountIntentTransactionHistoryButton.js +23 -0
- package/dist/widget/components/AccountSettings.js +105 -0
- package/dist/widget/components/AddressOrEnsName.js +13 -0
- package/dist/widget/components/AddressWalletIcon.js +32 -0
- package/dist/widget/components/AllChainsIcon.js +31 -0
- package/dist/widget/components/ChainFilterDropdown.js +124 -0
- package/dist/widget/components/ChainImage.js +24 -0
- package/dist/widget/components/ChainList.js +139 -0
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.js +777 -0
- package/dist/widget/components/ConfigDisplay.js +122 -0
- package/dist/widget/components/ConnectWallet.js +270 -0
- package/dist/widget/components/ConnectedWallets.js +174 -0
- package/dist/widget/components/CopyButton.js +51 -0
- package/dist/widget/components/CountryFilterDropdown.js +93 -0
- package/dist/widget/components/DebugMenu.js +33 -0
- package/dist/widget/components/DebugScreensList.js +56 -0
- package/dist/widget/components/DebugToast.js +46 -0
- package/dist/widget/components/DepositTracker.js +194 -0
- package/dist/widget/components/DirectTransfer.js +218 -0
- package/dist/widget/components/Disconnect.js +37 -0
- package/dist/widget/components/DynamicInputStyles.js +27 -0
- package/dist/widget/components/DynamicSizeInputField.js +125 -0
- package/dist/widget/components/ENSAvatar.js +22 -0
- package/dist/widget/components/Earn.js +79 -0
- package/dist/widget/components/EarnMarkets.js +299 -0
- package/dist/widget/components/EarnPools.js +236 -0
- package/dist/widget/components/EarnPoolsFilters.js +103 -0
- package/dist/widget/components/EarnWithdraw.js +476 -0
- package/dist/widget/components/ErrorAnimationIcon.js +148 -0
- package/dist/widget/components/ErrorDisplay.js +104 -0
- package/dist/widget/components/ExecutionStatusBadge.js +45 -0
- package/dist/widget/components/FeeOption.js +71 -0
- package/dist/widget/components/FeeOptions.js +99 -0
- package/dist/widget/components/FiatSelector.js +171 -0
- package/dist/widget/components/FiatSelectorButton.js +41 -0
- package/dist/widget/components/Footer.js +64 -0
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/Fund.js +1091 -0
- package/dist/widget/components/FundMethodIcons.d.ts +4 -0
- package/dist/widget/components/FundMethodIcons.d.ts.map +1 -0
- package/dist/widget/components/FundMethodIcons.js +60 -0
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.js +218 -0
- package/dist/widget/components/FundWalletSelection.js +39 -0
- package/dist/widget/components/FundingMethodSelectorButton.js +55 -0
- package/dist/widget/components/GreenCheckAnimation.js +135 -0
- package/dist/widget/components/HighPriceImpactBlock.js +33 -0
- package/dist/widget/components/HookModalContent.js +237 -0
- package/dist/widget/components/Identicon.js +176 -0
- package/dist/widget/components/LoadingSpinner.js +5 -0
- package/dist/widget/components/MeldForm.js +447 -0
- package/dist/widget/components/MeldHistory.js +307 -0
- package/dist/widget/components/MeldStepsFlow.js +785 -0
- package/dist/widget/components/MeldTransactionStatus.js +157 -0
- package/dist/widget/components/MeshExchangeAccountHeader.js +30 -0
- package/dist/widget/components/Modal.js +65 -0
- package/dist/widget/components/OFTProgressBar.js +49 -0
- package/dist/widget/components/OnRampProviderSelector.js +144 -0
- package/dist/widget/components/OnrampErrorScreen.js +102 -0
- package/dist/widget/components/OnrampHistoryRow.js +249 -0
- package/dist/widget/components/OnrampPaymentMethods.js +54 -0
- package/dist/widget/components/OnrampProviderConfirmation.js +705 -0
- package/dist/widget/components/OriginSelectionAmount.js +104 -0
- package/dist/widget/components/OriginTransferInformation.js +56 -0
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/Pay.js +642 -0
- package/dist/widget/components/PaymentMethods.js +119 -0
- package/dist/widget/components/PercentageMaxButtons.js +62 -0
- package/dist/widget/components/PoolDeposit.js +426 -0
- package/dist/widget/components/PriceImpactWarning.js +58 -0
- package/dist/widget/components/PulsatingButton.js +48 -0
- package/dist/widget/components/QRCodeOptions.js +57 -0
- package/dist/widget/components/QRCodeWalletSelect.js +45 -0
- package/dist/widget/components/QrCode.js +69 -0
- package/dist/widget/components/QuoteDetails.js +720 -0
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/Receipt.js +443 -0
- package/dist/widget/components/ReceiptRecoverableFunds.js +75 -0
- package/dist/widget/components/RecentTokens.js +37 -0
- package/dist/widget/components/RecipientSelectorButton.js +36 -0
- package/dist/widget/components/Recipients.js +226 -0
- package/dist/widget/components/RefundWarning.js +33 -0
- package/dist/widget/components/RequiredPropsError.js +14 -0
- package/dist/widget/components/ScreenHeader.js +64 -0
- package/dist/widget/components/SearchInputField.js +51 -0
- package/dist/widget/components/SessionTimeoutScreen.js +64 -0
- package/dist/widget/components/ShadowPortal.js +52 -0
- package/dist/widget/components/ShadowRootContext.js +12 -0
- package/dist/widget/components/SimpleRecipientInputScreen.js +48 -0
- package/dist/widget/components/SlippageToleranceSettings.js +159 -0
- package/dist/widget/components/Swap.js +6 -0
- package/dist/widget/components/SwapDisplay.js +72 -0
- package/dist/widget/components/ThemeProvider.js +52 -0
- package/dist/widget/components/ThemeSyncer.js +25 -0
- package/dist/widget/components/Toast.js +206 -0
- package/dist/widget/components/TokenDisplayNonSelectable.js +30 -0
- package/dist/widget/components/TokenImage.js +96 -0
- package/dist/widget/components/TokenList.js +45 -0
- package/dist/widget/components/TokenSelector.d.ts +3 -0
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.js +468 -0
- package/dist/widget/components/TokenSelectorButton.js +64 -0
- package/dist/widget/components/TokenSkeleton.js +36 -0
- package/dist/widget/components/Tooltip.js +38 -0
- package/dist/widget/components/TrailsHookModal.js +57 -0
- package/dist/widget/components/TransactionDetails.js +482 -0
- package/dist/widget/components/TransactionHistoryItem.js +457 -0
- package/dist/widget/components/TransferPendingVertical.js +356 -0
- package/dist/widget/components/TruncatedTransactionHash.js +36 -0
- package/dist/widget/components/UserPreferences.js +282 -0
- package/dist/widget/components/WaasFeeOptions.js +300 -0
- package/dist/widget/components/WalletAccountHeader.d.ts +2 -1
- package/dist/widget/components/WalletAccountHeader.d.ts.map +1 -1
- package/dist/widget/components/WalletAccountHeader.js +45 -0
- package/dist/widget/components/WalletConfirmation.js +146 -0
- package/dist/widget/components/WalletConnect.js +216 -0
- package/dist/widget/components/WalletConnectionPending.js +124 -0
- package/dist/widget/components/WalletList.js +60 -0
- package/dist/widget/components/WidgetProviders.js +39 -0
- package/dist/widget/components/Withdraw.d.ts.map +1 -1
- package/dist/widget/components/Withdraw.js +544 -0
- package/dist/widget/components/YellowWarningAnimation.js +167 -0
- package/dist/widget/components/earnMarketUtils.js +48 -0
- package/dist/widget/components/earnNetworks.js +33 -0
- package/dist/widget/index.js +25 -16
- package/dist/widget/modes/EarnWidget.js +39 -0
- package/dist/widget/modes/FundWidget.js +46 -0
- package/dist/widget/modes/PayWidget.js +38 -0
- package/dist/widget/modes/SwapWidget.js +40 -0
- package/dist/widget/modes/WithdrawWidget.js +36 -0
- package/dist/widget/providers/TrailsModalProvider.js +57 -0
- package/dist/widget/providers/TrailsProvider.js +83 -0
- package/dist/widget/providers/UserActivityProvider.js +38 -0
- package/dist/widget/providers/WidgetProviderTree.js +51 -0
- package/dist/widget/shared/destinationDefaultToken.js +19 -0
- package/dist/widget/shared/mapSharedProps.js +22 -0
- package/dist/widget/shared/methodMap.js +25 -0
- package/dist/widget/shared/resolution.js +83 -0
- package/dist/widget/shared/resolvePaymentSource.js +19 -0
- package/dist/widget/shared/tokenAllowlist.js +60 -0
- package/dist/widget/styles.gen.js +29 -0
- package/dist/widget/utils/countryUtils.js +14 -0
- package/dist/widget/utils/createWagmiConfig.js +18 -0
- package/dist/widget/utils/forexRateStore.js +59 -0
- package/dist/widget/utils/fundMethodSwitchState.js +6 -0
- package/dist/widget/utils/historyFilters.js +108 -0
- package/dist/widget/utils/localeStore.js +39 -0
- package/dist/widget/utils/meldProviderUtils.js +9 -0
- package/dist/widget/utils/meshSupportedTokens.js +12 -0
- package/dist/widget/utils/onrampConfig.js +6 -0
- package/dist/widget/utils/statusLabel.js +6 -0
- package/dist/widget/utils/tokens.js +30 -0
- package/dist/widget/utils/trailsOnrampConfig.js +7 -0
- package/dist/widget/utils/transactionFailure.js +12 -0
- package/dist/widget/utils/viewManagerGuards.js +23 -0
- package/dist/widget/utils/windowUtils.js +84 -0
- package/dist/widget/widget.js +1539 -0
- package/package.json +26 -21
- package/dist/chains-DttlfV-6.js +0 -4
- package/dist/chains-ccVR_-73.js +0 -655
- package/dist/hydrate-BsQ8nPlI.js +0 -882
- package/dist/src-CQhZqidH.js +0 -51593
package/README.md
CHANGED
|
@@ -1,29 +1,475 @@
|
|
|
1
1
|
# 0xtrails
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Trails SDK for cross-chain orchestration, fund, swap, pay, earn with any token from any chain. Use the embeddable widget for a pre-built UI experience, or compose your own UI with React hooks and utilities.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install 0xtrails
|
|
9
|
+
pnpm add 0xtrails
|
|
10
|
+
yarn add 0xtrails
|
|
11
|
+
bun add 0xtrails
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
`0xtrails` expects React, React DOM, wagmi, viem, and TanStack Query to be provided by your app.
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
## Quick Start
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
### Widget
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
The widget is the fastest integration path. Pick a mode and pass the props.
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { Pay } from "0xtrails/widget"
|
|
24
|
+
|
|
25
|
+
export function Checkout() {
|
|
26
|
+
return (
|
|
27
|
+
<Pay
|
|
28
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
29
|
+
to={{
|
|
30
|
+
recipient: "0xRecipientAddress",
|
|
31
|
+
chain: "base",
|
|
32
|
+
token: "USDC",
|
|
33
|
+
amount: "25",
|
|
34
|
+
}}
|
|
35
|
+
payMessage="Pay for order #1234"
|
|
36
|
+
onPaymentSuccess={(data) => console.log("Paid", data.sessionId)}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Hooks
|
|
43
|
+
|
|
44
|
+
Hooks are for custom UI. Wrap your app with your existing wagmi and React Query providers, then add `TrailsProvider`.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
|
48
|
+
import { WagmiProvider } from "wagmi"
|
|
49
|
+
import { TrailsProvider } from "0xtrails"
|
|
50
|
+
import { wagmiConfig } from "./wagmi"
|
|
51
|
+
|
|
52
|
+
const queryClient = new QueryClient()
|
|
53
|
+
|
|
54
|
+
export function App() {
|
|
55
|
+
return (
|
|
56
|
+
<WagmiProvider config={wagmiConfig}>
|
|
57
|
+
<QueryClientProvider client={queryClient}>
|
|
58
|
+
<TrailsProvider config={{ trailsApiKey: "<YOUR_TRAILS_API_KEY>" }}>
|
|
59
|
+
<YourRoutes />
|
|
60
|
+
</TrailsProvider>
|
|
61
|
+
</QueryClientProvider>
|
|
62
|
+
</WagmiProvider>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Widget Modes
|
|
68
|
+
|
|
69
|
+
Import mode-specific wrappers from `0xtrails/widget`.
|
|
70
|
+
|
|
71
|
+
### Pay
|
|
72
|
+
|
|
73
|
+
Use `Pay` when your app knows the exact recipient, destination token, chain, and amount.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { Pay } from "0xtrails/widget"
|
|
77
|
+
|
|
78
|
+
export function PayInvoice() {
|
|
79
|
+
return (
|
|
80
|
+
<Pay
|
|
81
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
82
|
+
to={{
|
|
83
|
+
recipient: "0xMerchantAddress",
|
|
84
|
+
chain: "base",
|
|
85
|
+
token: "USDC",
|
|
86
|
+
amount: "49.99",
|
|
87
|
+
}}
|
|
88
|
+
from={{ chain: "arbitrum", token: "ETH" }}
|
|
89
|
+
paymentMethod="CONNECTED_WALLET"
|
|
90
|
+
payMessage="Invoice #INV-1001"
|
|
91
|
+
buttonText="Pay now"
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Fund
|
|
98
|
+
|
|
99
|
+
Use `Fund` to let a user add funds to a wallet or destination account. You can allow different payment methods, use a connected wallet, qr code transfers, exchanges, or fiat on ramp.
|
|
100
|
+
|
|
101
|
+
The user selects payment method in the widget UI
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { Fund } from "0xtrails/widget"
|
|
105
|
+
|
|
106
|
+
export function FundWallet() {
|
|
107
|
+
return (
|
|
108
|
+
<Fund
|
|
109
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
110
|
+
to={{
|
|
111
|
+
recipient: "0xUserWallet",
|
|
112
|
+
chain: "base",
|
|
113
|
+
token: "USDC",
|
|
114
|
+
}}
|
|
115
|
+
onFundingSuccess={(data) => console.log("Funded", data.sessionId)}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The host app pre-selects paymentMethod to credit card for funding crypto with 100 USD.
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { Fund } from "0xtrails/widget"
|
|
125
|
+
|
|
126
|
+
export function FundWallet() {
|
|
127
|
+
return (
|
|
128
|
+
<Fund
|
|
129
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
130
|
+
paymentMethod="CREDIT_DEBIT_CARD"
|
|
131
|
+
from={{
|
|
132
|
+
currency="USD",
|
|
133
|
+
amount="100"
|
|
134
|
+
}}
|
|
135
|
+
to={{
|
|
136
|
+
recipient: "0xUserWallet",
|
|
137
|
+
chain: "base",
|
|
138
|
+
token: "USDC",
|
|
139
|
+
}}
|
|
140
|
+
onFundingSuccess={(data) => console.log("Funded", data.sessionId)}
|
|
141
|
+
/>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Swap
|
|
147
|
+
|
|
148
|
+
Use `Swap` for same-chain and cross-chain token swaps.
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
import { Swap } from "0xtrails/widget"
|
|
152
|
+
|
|
153
|
+
export function SwapToBaseUsdc() {
|
|
154
|
+
return (
|
|
155
|
+
<Swap
|
|
156
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
157
|
+
onSwapSuccess={(data) => console.log("Swap complete", data.sessionId)}
|
|
158
|
+
/>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Earn
|
|
164
|
+
|
|
165
|
+
Use `Earn` for a built-in UI cross-chain experience for earning yield.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
import { Earn } from "0xtrails/widget"
|
|
169
|
+
|
|
170
|
+
export function EarnUsdc() {
|
|
171
|
+
return (
|
|
172
|
+
<Earn
|
|
173
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
174
|
+
buttonText="Deposit into a protocol"
|
|
175
|
+
onEarnSuccess={(data) => console.log("Earn deposit", data.sessionId)}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Withdraw
|
|
182
|
+
|
|
183
|
+
Use `Withdraw` for crypto withdrawal flows. Let users withdraw and swap their assets to any token on any chain.
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { Withdraw } from "0xtrails/widget"
|
|
187
|
+
|
|
188
|
+
export function WithdrawToBase() {
|
|
189
|
+
return (
|
|
190
|
+
<Withdraw
|
|
191
|
+
apiKey="<YOUR_TRAILS_API_KEY>"
|
|
192
|
+
onWithdrawSuccess={(data) => console.log("Withdrawn", data.sessionId)}
|
|
193
|
+
/>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## `useQuote`
|
|
199
|
+
|
|
200
|
+
`useQuote` gives you a quote and an executable `send` function for a fully custom UI. Exactly one amount should be provided: `from.amount` or `from.amountRaw` for exact-input, or `to.amount` or `to.amountRaw` for exact-output. You can use "feeOptions" to allow paying gas in stablecoins.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { useQuote, QuoteError } from "0xtrails"
|
|
204
|
+
import { useAccount, useWalletClient } from "wagmi"
|
|
205
|
+
|
|
206
|
+
export function CustomSwap() {
|
|
207
|
+
const { address } = useAccount()
|
|
208
|
+
const { data: walletClient } = useWalletClient()
|
|
209
|
+
|
|
210
|
+
const {
|
|
211
|
+
quote,
|
|
212
|
+
send,
|
|
213
|
+
isLoadingQuote,
|
|
214
|
+
quoteError,
|
|
215
|
+
quoteErrorPrettified,
|
|
216
|
+
feeOptions,
|
|
217
|
+
refetchQuote,
|
|
218
|
+
abort,
|
|
219
|
+
} = useQuote({
|
|
220
|
+
from: {
|
|
221
|
+
chain: "base",
|
|
222
|
+
token: "USDC",
|
|
223
|
+
amount: "10",
|
|
224
|
+
},
|
|
225
|
+
to: {
|
|
226
|
+
chain: "arbitrum",
|
|
227
|
+
token: "ETH",
|
|
228
|
+
recipient: address,
|
|
229
|
+
},
|
|
230
|
+
onStatusUpdate: (states) => console.log("status", states),
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
if (quoteError instanceof QuoteError) {
|
|
234
|
+
console.log("Quote failed with code", quoteError.code)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<section>
|
|
239
|
+
{isLoadingQuote && <p>Loading quote...</p>}
|
|
240
|
+
{quoteErrorPrettified && <p>{quoteErrorPrettified}</p>}
|
|
241
|
+
|
|
242
|
+
{quote && (
|
|
243
|
+
<>
|
|
244
|
+
<p>
|
|
245
|
+
Spend {quote.originAmountDisplay} for{" "}
|
|
246
|
+
{quote.destinationAmountDisplay}
|
|
247
|
+
</p>
|
|
248
|
+
<p>Estimated time: {quote.completionEstimateDisplay}</p>
|
|
249
|
+
<p>Fee options: {feeOptions.length}</p>
|
|
250
|
+
</>
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
<button disabled={!send} onClick={() => send?.()}>
|
|
254
|
+
Send
|
|
255
|
+
</button>
|
|
256
|
+
<button onClick={() => refetchQuote()}>Refresh</button>
|
|
257
|
+
<button onClick={() => abort()}>Abort</button>
|
|
258
|
+
</section>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
For previewing a quote, without needing a connected wallet, pass `walletAddress`.
|
|
264
|
+
|
|
265
|
+
## `useTrailsSendTransaction`
|
|
266
|
+
|
|
267
|
+
`useTrailsSendTransaction` is a wagmi-like transaction hook with Trails routing. It can open the Trails widget modal when the user needs to choose the origin chain, token, or amount so you don't have to build this step.
|
|
268
|
+
|
|
269
|
+
Render `TrailsHookModal` once inside `TrailsProvider` so modal-driven sends have somewhere to mount.
|
|
270
|
+
|
|
271
|
+
To request a destination token and let the user pick how to pay, provide `tokenAddress` and `tokenAmount`.
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
import { useTrailsSendTransaction } from "0xtrails"
|
|
275
|
+
|
|
276
|
+
export function RequestUsdcPayment() {
|
|
277
|
+
const { sendTransaction, isPending } = useTrailsSendTransaction({
|
|
278
|
+
receiptActionButtonText: "Back to app",
|
|
279
|
+
})
|
|
19
280
|
|
|
20
|
-
export const App = () => {
|
|
21
281
|
return (
|
|
22
|
-
|
|
282
|
+
<>
|
|
283
|
+
<button
|
|
284
|
+
disabled={isPending}
|
|
285
|
+
onClick={() =>
|
|
286
|
+
sendTransaction({
|
|
287
|
+
to: "0xMerchantAddress",
|
|
288
|
+
tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
289
|
+
tokenAmount: "25"
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
>
|
|
293
|
+
Pay 25 USDC
|
|
294
|
+
</button>
|
|
295
|
+
</>
|
|
23
296
|
)
|
|
24
297
|
}
|
|
25
298
|
```
|
|
26
299
|
|
|
300
|
+
Use `fromTokenAddress`, `fromChainId`, and `fromAmount` when your app already knows the source asset. Use the `*Raw` fields when you already have smallest-unit amounts.
|
|
301
|
+
|
|
302
|
+
## Composable Actions
|
|
303
|
+
|
|
304
|
+
Composable actions describe what should happen after funds arrive on the destination chain. They are resolved into destination calls by the SDK and can be used from both `useQuote` and `useTrailsSendTransaction`.
|
|
305
|
+
|
|
306
|
+
Available action builders include:
|
|
307
|
+
|
|
308
|
+
- `swap` for destination-chain swaps.
|
|
309
|
+
- `lend` and `deposit` for supported earn markets.
|
|
310
|
+
- `custom` for bulding your own action.
|
|
311
|
+
- `assertCondition` for runtime checks.
|
|
312
|
+
- `dynamic()` to spend the intent wallet's runtime balance when value amounts are unknown.
|
|
313
|
+
|
|
314
|
+
### Quote And Execute Actions
|
|
315
|
+
|
|
316
|
+
```tsx
|
|
317
|
+
import {
|
|
318
|
+
assertCondition,
|
|
319
|
+
dynamic,
|
|
320
|
+
lend,
|
|
321
|
+
swap,
|
|
322
|
+
useQuote,
|
|
323
|
+
} from "0xtrails"
|
|
324
|
+
import { useAccount, useWalletClient } from "wagmi"
|
|
325
|
+
|
|
326
|
+
export function QuoteActions() {
|
|
327
|
+
const { address } = useAccount()
|
|
328
|
+
const { data: walletClient } = useWalletClient()
|
|
329
|
+
|
|
330
|
+
const actions = [
|
|
331
|
+
// Check if we received enough USDC on the destination chain
|
|
332
|
+
assertCondition({
|
|
333
|
+
erc20Balance: { token: "USDC", gte: "100" },
|
|
334
|
+
}),
|
|
335
|
+
// Swap 100 USDC in WETH (defaults to Uniswap V3)
|
|
336
|
+
swap({
|
|
337
|
+
tokenIn: "USDC",
|
|
338
|
+
tokenOut: "WETH",
|
|
339
|
+
amountIn: "100",
|
|
340
|
+
fee: "0.05"
|
|
341
|
+
}),
|
|
342
|
+
// Lend all WETH received from the swap
|
|
343
|
+
lend({
|
|
344
|
+
marketId: "base-weth-aave-v3-lending",
|
|
345
|
+
amount: dynamic(),
|
|
346
|
+
receiverAddress: address,
|
|
347
|
+
}),
|
|
348
|
+
]
|
|
349
|
+
|
|
350
|
+
const { quote, send, isLoadingQuote } = useQuote({
|
|
351
|
+
from: { chain: "base", token: "USDC" },
|
|
352
|
+
to: { chain: "base", token: "USDC", amount: "100" },
|
|
353
|
+
actions,
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
return (
|
|
357
|
+
<button disabled={!send || isLoadingQuote} onClick={() => send?.()}>
|
|
358
|
+
{quote ? "Execute recipe" : "Get quote"}
|
|
359
|
+
</button>
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
`actions` is mutually exclusive with `to.calls` and deprecated `to.calldata`.
|
|
365
|
+
|
|
366
|
+
### Execute Actions With The Widget Modal
|
|
367
|
+
|
|
368
|
+
```tsx
|
|
369
|
+
import { dynamic, erc20Utils, lend, swap, useTrailsSendTransaction } from "0xtrails"
|
|
370
|
+
|
|
371
|
+
export function WidgetActionRecipe({ userAddress }: { userAddress: `0x${string}` }) {
|
|
372
|
+
const actions = [
|
|
373
|
+
swap({
|
|
374
|
+
tokenIn: "USDC",
|
|
375
|
+
tokenOut: "USDT",
|
|
376
|
+
amountIn: dynamic(),
|
|
377
|
+
fee: "0.05",
|
|
378
|
+
}),
|
|
379
|
+
lend({
|
|
380
|
+
marketId: "polygon-usdt-fluid-lending",
|
|
381
|
+
amount: dynamic(),
|
|
382
|
+
receiverAddress: userAddress,
|
|
383
|
+
}),
|
|
384
|
+
]
|
|
385
|
+
|
|
386
|
+
const { sendTransaction, isPending } = useTrailsSendTransaction({
|
|
387
|
+
actions,
|
|
388
|
+
receiptActionButtonText: "Done",
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
return (
|
|
392
|
+
<>
|
|
393
|
+
<button
|
|
394
|
+
disabled={isPending}
|
|
395
|
+
onClick={() =>
|
|
396
|
+
sendTransaction({
|
|
397
|
+
to: userAddress,
|
|
398
|
+
tokenAddress: erc20Utils.USDC.addressOn("polygon"),
|
|
399
|
+
tokenAmount: "50",
|
|
400
|
+
tokenDecimals: erc20Utils.USDC.decimalsOn("polygon"),
|
|
401
|
+
})
|
|
402
|
+
}
|
|
403
|
+
>
|
|
404
|
+
Choose payment token
|
|
405
|
+
</button>
|
|
406
|
+
</>
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Raw Destination Calls
|
|
412
|
+
|
|
413
|
+
Use `to.calls` when you need low-level ABI-encoded calls instead of action builders.
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
import { buildApproveAndCall, buildCall, erc20Utils, useQuote } from "0xtrails"
|
|
417
|
+
import { useAccount } from "wagmi"
|
|
418
|
+
import { stakingAbi } from "./stakingAbi"
|
|
419
|
+
|
|
420
|
+
export function RawCallsQuote() {
|
|
421
|
+
const { address } = useAccount()
|
|
422
|
+
|
|
423
|
+
const stakingCall = buildCall({
|
|
424
|
+
to: "0xStakingContract",
|
|
425
|
+
data: {
|
|
426
|
+
abi: stakingAbi,
|
|
427
|
+
functionName: "stake",
|
|
428
|
+
args: [1_000_000n],
|
|
429
|
+
},
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
const calls = buildApproveAndCall({
|
|
433
|
+
token: erc20Utils.USDC.addressOn("base"),
|
|
434
|
+
call: stakingCall,
|
|
435
|
+
})
|
|
436
|
+
|
|
437
|
+
const { quote, send } = useQuote({
|
|
438
|
+
from: { chain: "base", token: "USDC" },
|
|
439
|
+
to: {
|
|
440
|
+
chain: "base",
|
|
441
|
+
token: "USDC",
|
|
442
|
+
amount: "1",
|
|
443
|
+
calls,
|
|
444
|
+
},
|
|
445
|
+
})
|
|
446
|
+
|
|
447
|
+
return (
|
|
448
|
+
<button disabled={!send} onClick={() => send?.()}>
|
|
449
|
+
{quote ? "Stake USDC" : "Loading quote"}
|
|
450
|
+
</button>
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Utilities
|
|
456
|
+
|
|
457
|
+
Common exports from `0xtrails`:
|
|
458
|
+
|
|
459
|
+
- `getSupportedChains`, `useSupportedChains`, and `resolveChainId`.
|
|
460
|
+
- `getChainInfo`, `getAllChains`, and `attemptSwitchChain`.
|
|
461
|
+
- `useTokenList`, `useSupportedTokens`, `useTokenBalances`, `useTokenBalancesForMultipleAccounts`, `useAccountTotalBalanceUsd`, `useHasSufficientBalanceToken`, and `useHasSufficientBalanceUsd`.
|
|
462
|
+
- `getTokenPrice`, `getTokenPrices`, `useTokenPrice`, `useTokenPrices`
|
|
463
|
+
- `erc20Utils`, `buildCall`, `buildApproveAndCall`, `buildErc20Approve`, and `getAmountWithSlippage` for token metadata, ERC-20 calls, approvals, and custom calldata.
|
|
464
|
+
- `uniswapV3` and `sushiswapV3` for custom Uniswap V3 / SushiSwap V3 pool lookup, quote, and swap call construction.
|
|
465
|
+
- `useEarnProviders`, `useEarnMarkets`, `useEarnBalances`, `getEarnProviders`, `getEarnMarkets`, and `getEarnBalances`.
|
|
466
|
+
- `useResolveActions`, `encodeDestinationForIntentProtocol`, `createHydratePayload`, and `encodeMulticallHydrateExecute` for advanced destination-call and hydrate flows.
|
|
467
|
+
- `prepareSend`, `commitIntent`, `quoteIntent`, `sendOriginTransaction`, `getIntent`, `useGetIntent`, `pollIntentReceipt`, and `useIntentReceiptMonitor`.
|
|
468
|
+
- `getAccountTransactionHistory`, `useAccountTransactionHistory`, `useIntentTransactionHistory`, and `getTxTimeDiff`.
|
|
469
|
+
- `useFiatCurrencyList`, `useExchangeRate`, `getCurrencyInfo`
|
|
470
|
+
- `getTrailsClient`, `useTrailsClient`, `TrailsClient`
|
|
471
|
+
- `useIntentRecover`, `useIntentRecoverWithAddress`, `buildRefundTransactionWithSignature`, and `signPayload`.
|
|
472
|
+
|
|
27
473
|
## Development
|
|
28
474
|
|
|
29
475
|
```bash
|
|
@@ -35,8 +481,11 @@ pnpm run build
|
|
|
35
481
|
|
|
36
482
|
# Run tests
|
|
37
483
|
pnpm test
|
|
484
|
+
|
|
485
|
+
# Run the SDK in dev mode
|
|
486
|
+
pnpm dev
|
|
38
487
|
```
|
|
39
488
|
|
|
40
489
|
## License
|
|
41
490
|
|
|
42
|
-
|
|
491
|
+
Apache-2.0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { toPropertyKey as t } from "./toPropertyKey.js";
|
|
2
|
+
function i(e, r, o) {
|
|
3
|
+
return (r = t(r)) in e ? Object.defineProperty(e, r, {
|
|
4
|
+
value: o,
|
|
5
|
+
enumerable: !0,
|
|
6
|
+
configurable: !0,
|
|
7
|
+
writable: !0
|
|
8
|
+
}) : e[r] = o, e;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
i as _defineProperty
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { _typeof as o } from "./typeof.js";
|
|
2
|
+
function n(r, i) {
|
|
3
|
+
if (o(r) != "object" || !r) return r;
|
|
4
|
+
var e = r[Symbol.toPrimitive];
|
|
5
|
+
if (e !== void 0) {
|
|
6
|
+
var t = e.call(r, i || "default");
|
|
7
|
+
if (o(t) != "object") return t;
|
|
8
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
9
|
+
}
|
|
10
|
+
return (i === "string" ? String : Number)(r);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
n as toPrimitive
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function t(e) {
|
|
2
|
+
"@babel/helpers - typeof";
|
|
3
|
+
return t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
4
|
+
return typeof o;
|
|
5
|
+
} : function(o) {
|
|
6
|
+
return o && typeof Symbol == "function" && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7
|
+
}, t(e);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
t as _typeof
|
|
11
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var e = [
|
|
2
|
+
{
|
|
3
|
+
type: "function",
|
|
4
|
+
name: "requireNonExpired",
|
|
5
|
+
inputs: [{
|
|
6
|
+
name: "expiration",
|
|
7
|
+
type: "uint256"
|
|
8
|
+
}],
|
|
9
|
+
outputs: [],
|
|
10
|
+
stateMutability: "view"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: "function",
|
|
14
|
+
name: "requireMinBalance",
|
|
15
|
+
inputs: [{
|
|
16
|
+
name: "owner",
|
|
17
|
+
type: "address"
|
|
18
|
+
}, {
|
|
19
|
+
name: "minBalance",
|
|
20
|
+
type: "uint256"
|
|
21
|
+
}],
|
|
22
|
+
outputs: [],
|
|
23
|
+
stateMutability: "view"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "function",
|
|
27
|
+
name: "requireMinBalanceSelf",
|
|
28
|
+
inputs: [{
|
|
29
|
+
name: "minBalance",
|
|
30
|
+
type: "uint256"
|
|
31
|
+
}],
|
|
32
|
+
outputs: [],
|
|
33
|
+
stateMutability: "view"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: "function",
|
|
37
|
+
name: "requireMinERC20Balance",
|
|
38
|
+
inputs: [
|
|
39
|
+
{
|
|
40
|
+
name: "token",
|
|
41
|
+
type: "address"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "owner",
|
|
45
|
+
type: "address"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "minBalance",
|
|
49
|
+
type: "uint256"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
outputs: [],
|
|
53
|
+
stateMutability: "view"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "function",
|
|
57
|
+
name: "requireMinERC20BalanceSelf",
|
|
58
|
+
inputs: [{
|
|
59
|
+
name: "token",
|
|
60
|
+
type: "address"
|
|
61
|
+
}, {
|
|
62
|
+
name: "minBalance",
|
|
63
|
+
type: "uint256"
|
|
64
|
+
}],
|
|
65
|
+
outputs: [],
|
|
66
|
+
stateMutability: "view"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "function",
|
|
70
|
+
name: "requireMinERC20Allowance",
|
|
71
|
+
inputs: [
|
|
72
|
+
{
|
|
73
|
+
name: "token",
|
|
74
|
+
type: "address"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "owner",
|
|
78
|
+
type: "address"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "spender",
|
|
82
|
+
type: "address"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "minAllowance",
|
|
86
|
+
type: "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
outputs: [],
|
|
90
|
+
stateMutability: "view"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: "function",
|
|
94
|
+
name: "requireMinERC20AllowanceSelf",
|
|
95
|
+
inputs: [
|
|
96
|
+
{
|
|
97
|
+
name: "token",
|
|
98
|
+
type: "address"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "spender",
|
|
102
|
+
type: "address"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "minAllowance",
|
|
106
|
+
type: "uint256"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
outputs: [],
|
|
110
|
+
stateMutability: "view"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: "function",
|
|
114
|
+
name: "requireMinERC20BalanceAllowanceSelf",
|
|
115
|
+
inputs: [
|
|
116
|
+
{
|
|
117
|
+
name: "token",
|
|
118
|
+
type: "address"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "spender",
|
|
122
|
+
type: "address"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "minAmount",
|
|
126
|
+
type: "uint256"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
outputs: [],
|
|
130
|
+
stateMutability: "view"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: "function",
|
|
134
|
+
name: "requireERC721OwnerSelf",
|
|
135
|
+
inputs: [{
|
|
136
|
+
name: "token",
|
|
137
|
+
type: "address"
|
|
138
|
+
}, {
|
|
139
|
+
name: "tokenId",
|
|
140
|
+
type: "uint256"
|
|
141
|
+
}],
|
|
142
|
+
outputs: [],
|
|
143
|
+
stateMutability: "view"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: "function",
|
|
147
|
+
name: "requireMinERC1155BalanceSelf",
|
|
148
|
+
inputs: [
|
|
149
|
+
{
|
|
150
|
+
name: "token",
|
|
151
|
+
type: "address"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "tokenId",
|
|
155
|
+
type: "uint256"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "minBalance",
|
|
159
|
+
type: "uint256"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
outputs: [],
|
|
163
|
+
stateMutability: "view"
|
|
164
|
+
}
|
|
165
|
+
];
|
|
166
|
+
export {
|
|
167
|
+
e as requireUtilsAbi
|
|
168
|
+
};
|