0xtrails 0.15.1 → 0.16.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 +63 -434
- package/dist/actions/actionBuilder.d.ts +10 -0
- package/dist/actions/actionBuilder.d.ts.map +1 -1
- package/dist/actions/actionBuilder.js +92 -80
- package/dist/actions/constants.d.ts +9 -53
- package/dist/actions/constants.d.ts.map +1 -1
- package/dist/actions/constants.js +10 -11
- package/dist/actions/custom-integrations/sushiswapV3/sushiswapV3.js +11 -11
- package/dist/actions/custom-integrations/uniswapV3/uniswapV3.js +11 -11
- package/dist/actions/destinationCalls.d.ts.map +1 -1
- package/dist/actions/destinationCalls.js +34 -27
- package/dist/actions/hooks/useEarnBalances.js +7 -7
- package/dist/actions/hooks/useEarnMarkets.js +4 -4
- package/dist/actions/hooks/useEarnProviders.js +4 -4
- package/dist/actions/hooks/useResolveActions.d.ts +2 -11
- package/dist/actions/hooks/useResolveActions.d.ts.map +1 -1
- package/dist/actions/hooks/useResolveActions.js +40 -222
- package/dist/actions/index.d.ts +6 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +35 -28
- package/dist/actions/resolveActions.d.ts +13 -0
- package/dist/actions/resolveActions.d.ts.map +1 -0
- package/dist/actions/resolveActions.js +267 -0
- package/dist/actions/resolvers.d.ts +2 -3
- package/dist/actions/resolvers.d.ts.map +1 -1
- package/dist/actions/resolvers.js +1 -1
- package/dist/actions/types.d.ts +16 -0
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/actions/utils.d.ts +5 -5
- package/dist/actions/utils.d.ts.map +1 -1
- package/dist/actions/utils.js +124 -114
- package/dist/adapters/evmAdapter.d.ts +10 -0
- package/dist/adapters/evmAdapter.d.ts.map +1 -0
- package/dist/adapters/evmAdapter.js +28 -0
- package/dist/analytics.js +8 -8
- package/dist/chainRegistry.d.ts +6 -0
- package/dist/chainRegistry.d.ts.map +1 -0
- package/dist/chainRegistry.js +47 -0
- package/dist/chainResolution.d.ts +6 -0
- package/dist/chainResolution.d.ts.map +1 -0
- package/dist/chainResolution.js +53 -0
- package/dist/chainRpcClient.d.ts +8 -0
- package/dist/chainRpcClient.d.ts.map +1 -0
- package/dist/chainRpcClient.js +67 -0
- package/dist/chains.d.ts +5 -11
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +108 -208
- package/dist/config.d.ts +1 -30
- package/dist/config.d.ts.map +1 -1
- package/dist/configDefaults.d.ts +7 -0
- package/dist/configDefaults.d.ts.map +1 -0
- package/dist/configDefaults.js +9 -0
- package/dist/configStore.d.ts +31 -0
- package/dist/configStore.d.ts.map +1 -0
- package/dist/{config.js → configStore.js} +1 -1
- package/dist/constants.d.ts +2 -14
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +21 -31
- package/dist/contractConstants.d.ts +8 -0
- package/dist/contractConstants.d.ts.map +1 -0
- package/dist/contractConstants.js +9 -0
- package/dist/contractUtils.js +5 -5
- package/dist/ens.d.ts.map +1 -1
- package/dist/ens.js +78 -55
- package/dist/estimate.js +11 -11
- package/dist/fees.d.ts.map +1 -1
- package/dist/fees.js +40 -35
- package/dist/gasless.d.ts +5 -0
- package/dist/gasless.d.ts.map +1 -1
- package/dist/gasless.js +12 -12
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +63 -62
- package/dist/hooks/prepareTrailsSendTransactionDestination.js +1 -1
- package/dist/hooks/useAmountUsd.js +5 -5
- package/dist/hooks/useBluvoTokenList.d.ts +13 -0
- package/dist/hooks/useBluvoTokenList.d.ts.map +1 -0
- package/dist/hooks/useBluvoTokenList.js +57 -0
- package/dist/hooks/useCheckout.js +6 -6
- package/dist/hooks/useCombinedHistory.d.ts.map +1 -1
- package/dist/hooks/useCombinedHistory.js +89 -81
- package/dist/hooks/useCustomTokenSearch.d.ts +4 -1
- package/dist/hooks/useCustomTokenSearch.d.ts.map +1 -1
- package/dist/hooks/useCustomTokenSearch.js +106 -108
- package/dist/hooks/useDefaultDestinationToken.js +5 -5
- package/dist/hooks/useDefaultOriginToken.d.ts.map +1 -1
- package/dist/hooks/useDefaultOriginToken.js +73 -80
- package/dist/hooks/useDepositMonitor.js +15 -15
- package/dist/hooks/useDestinationSelectedToken.d.ts +8 -2
- package/dist/hooks/useDestinationSelectedToken.d.ts.map +1 -1
- package/dist/hooks/useDestinationSelectedToken.js +150 -116
- package/dist/hooks/useExchangeFundingSelection.d.ts +17 -0
- package/dist/hooks/useExchangeFundingSelection.d.ts.map +1 -0
- package/dist/hooks/useExchangeFundingSelection.js +25 -0
- package/dist/hooks/useExternalFundingReceiptSync.js +5 -5
- package/dist/hooks/useFiatSelectedCurrency.js +1 -1
- package/dist/hooks/useGetIntent.js +3 -3
- package/dist/hooks/useIntentReceiptBalances.js +6 -6
- package/dist/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/hooks/useIntentTransactionHistory.js +207 -182
- package/dist/hooks/useMeldTransactionHistory.js +5 -5
- package/dist/hooks/useMeldTransactionStatus.js +8 -8
- package/dist/hooks/useOnRampCountryDefaults.js +4 -4
- package/dist/hooks/useOnRampQuote.js +1 -1
- package/dist/hooks/useOriginSelectedToken.d.ts +5 -0
- package/dist/hooks/useOriginSelectedToken.d.ts.map +1 -1
- package/dist/hooks/useOriginSelectedToken.js +112 -46
- package/dist/hooks/usePayMessage.js +2 -2
- package/dist/hooks/useQuote.d.ts +37 -45
- package/dist/hooks/useQuote.d.ts.map +1 -1
- package/dist/hooks/useQuote.js +249 -254
- package/dist/hooks/useRecentChains.d.ts +7 -0
- package/dist/hooks/useRecentChains.d.ts.map +1 -0
- package/dist/hooks/useRecentChains.js +52 -0
- package/dist/hooks/useSelectedFundMethod.d.ts +31 -0
- package/dist/hooks/useSelectedFundMethod.d.ts.map +1 -1
- package/dist/hooks/useSelectedFundMethod.js +35 -26
- package/dist/hooks/useSelectedRecipient.d.ts.map +1 -1
- package/dist/hooks/useSelectedRecipient.js +21 -21
- package/dist/hooks/useSendForm.d.ts +8 -1
- package/dist/hooks/useSendForm.d.ts.map +1 -1
- package/dist/hooks/useSendForm.js +266 -256
- package/dist/hooks/useSwapState.d.ts +1 -1
- package/dist/hooks/useSwapState.d.ts.map +1 -1
- package/dist/hooks/useTokenList.d.ts +4 -1
- package/dist/hooks/useTokenList.d.ts.map +1 -1
- package/dist/hooks/useTokenList.js +350 -355
- package/dist/hooks/useTrailsSendTransaction.d.ts +9 -43
- package/dist/hooks/useTrailsSendTransaction.d.ts.map +1 -1
- package/dist/hooks/useTrailsSendTransaction.js +289 -306
- package/dist/hooks/useViewManager.d.ts +1 -1
- package/dist/hooks/useViewManager.d.ts.map +1 -1
- package/dist/hooks/useWalletConnectionContext.d.ts +6 -5
- package/dist/hooks/useWalletConnectionContext.d.ts.map +1 -1
- package/dist/hooks/useWalletConnectionContext.js +3 -3
- package/dist/hydrate/multicall.d.ts.map +1 -1
- package/dist/hydrate/multicall.js +127 -91
- package/dist/index.d.ts +77 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +307 -257
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/indexerClient.js +23 -25
- package/dist/intentProtocolResolver.js +2 -2
- package/dist/intents.d.ts +3 -2
- package/dist/intents.d.ts.map +1 -1
- package/dist/intents.js +58 -63
- package/dist/logger/index.js +1 -1
- package/dist/meld/components/MeldCountriesList.js +1 -1
- package/dist/meld/components/MeldFundMethods.js +7 -7
- package/dist/meld/components/MeldProvidersList.js +1 -1
- package/dist/meld/components/MeldTokensList.js +9 -9
- package/dist/meld/components/SimpleHeader.js +4 -4
- package/dist/meld/utils/meld.js +2 -2
- package/dist/offlineRecovery.d.ts.map +1 -1
- package/dist/offlineRecovery.js +107 -112
- package/dist/onramp/MeshConnectIframe.js +1 -1
- package/dist/onramp/SendFromExchangeButton.js +1 -1
- package/dist/onramp/TrailsOnRampProvider.d.ts +7 -0
- package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -1
- package/dist/onramp/bluvo/hooks/useBluvoFundingSelection.d.ts +12 -0
- package/dist/onramp/bluvo/hooks/useBluvoFundingSelection.d.ts.map +1 -0
- package/dist/onramp/bluvo/hooks/useBluvoFundingSelection.js +18 -0
- package/dist/onramp/mesh/components/MeshExchangeSelection.js +5 -5
- package/dist/onramp/mesh/hooks/useMeshSelectedTokenBalance.js +4 -4
- package/dist/onramp/mesh/hooks/useMeshSessionAccountBalance.js +1 -1
- package/dist/onramp/trailsOnramp.d.ts.map +1 -1
- package/dist/onramp/trailsOnramp.js +22 -18
- package/dist/onrampClient.d.ts.map +1 -1
- package/dist/onrampClient.js +21 -17
- package/dist/package.js +30 -28
- package/dist/prepareSend.d.ts +4 -2
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prepareSend.js +32 -31
- package/dist/query/QueryProvider.d.ts +9 -0
- package/dist/query/QueryProvider.d.ts.map +1 -0
- package/dist/query/QueryProvider.js +13 -0
- package/dist/query/balance.fetchers.d.ts.map +1 -1
- package/dist/query/balance.fetchers.js +16 -16
- package/dist/query/balance.hooks.js +9 -9
- package/dist/query/balance.queries.js +1 -1
- package/dist/query/chains.hooks.d.ts +3 -2
- package/dist/query/chains.hooks.d.ts.map +1 -1
- package/dist/query/chains.hooks.js +25 -24
- package/dist/query/fiat.hooks.js +5 -5
- package/dist/query/geo.hooks.js +1 -1
- package/dist/query/geo.queries.js +1 -1
- package/dist/query/intentProtocol.queries.js +1 -1
- package/dist/query/persister.d.ts +0 -1
- package/dist/query/persister.d.ts.map +1 -1
- package/dist/query/persister.js +5 -5
- package/dist/query/price.hooks.js +4 -4
- package/dist/query/price.queries.js +1 -1
- package/dist/query/serialization.d.ts +3 -0
- package/dist/query/serialization.d.ts.map +1 -0
- package/dist/query/serialization.js +17 -0
- package/dist/query/token.fetchers.d.ts +13 -0
- package/dist/query/token.fetchers.d.ts.map +1 -0
- package/dist/query/token.fetchers.js +6 -0
- package/dist/{hooks/useTokens.d.ts → query/token.hooks.d.ts} +14 -25
- package/dist/query/token.hooks.d.ts.map +1 -0
- package/dist/query/token.hooks.js +68 -0
- package/dist/query/token.queries.d.ts +67 -0
- package/dist/query/token.queries.d.ts.map +1 -0
- package/dist/query/token.queries.js +144 -0
- package/dist/quoteError.d.ts +22 -0
- package/dist/quoteError.d.ts.map +1 -0
- package/dist/quoteError.js +9 -0
- package/dist/recover.d.ts +10 -3
- package/dist/recover.d.ts.map +1 -1
- package/dist/recover.js +401 -339
- package/dist/smartContractWallet.d.ts +8 -0
- package/dist/smartContractWallet.d.ts.map +1 -0
- package/dist/smartContractWallet.js +11 -0
- package/dist/tokenRegistry.d.ts +50 -0
- package/dist/tokenRegistry.d.ts.map +1 -0
- package/dist/tokenRegistry.js +589 -0
- package/dist/tokenTypes.d.ts +29 -0
- package/dist/tokenTypes.d.ts.map +1 -0
- package/dist/tokens.d.ts +10 -44
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +269 -798
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +3 -2
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +3 -2
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.js +52 -49
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +3 -2
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.js +2 -2
- package/dist/transactionIntent/handlers/intentHandler.d.ts +3 -2
- package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/intentHandler.js +193 -193
- package/dist/transactionIntent/quote/feeExtractors.d.ts +2 -1
- package/dist/transactionIntent/quote/feeExtractors.d.ts.map +1 -1
- package/dist/transactionIntent/quote/feeExtractors.js +31 -20
- package/dist/transactionIntent/quote/normalizeQuote.js +43 -43
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +3 -3
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.js +35 -32
- package/dist/transactionIntent/types.d.ts +9 -6
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/types.js +24 -7
- package/dist/transactions.d.ts +5 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +8 -8
- package/dist/umd/trails.min.js +767 -1112
- package/dist/utils/tokenResolution.d.ts +19 -0
- package/dist/utils/tokenResolution.d.ts.map +1 -0
- package/dist/utils/tokenResolution.js +53 -0
- package/dist/widget/assets/components/Aave.d.ts +8 -0
- package/dist/widget/assets/components/Aave.d.ts.map +1 -0
- package/dist/widget/assets/components/Aave.js +29 -0
- package/dist/widget/assets/components/ExchangeIconBlack.d.ts +8 -0
- package/dist/widget/assets/components/ExchangeIconBlack.d.ts.map +1 -0
- package/dist/widget/assets/components/FundMethodCardBrands.d.ts +8 -0
- package/dist/widget/assets/components/FundMethodCardBrands.d.ts.map +1 -0
- package/dist/widget/assets/components/FundMethodCardBrands.js +49 -0
- package/dist/widget/assets/components/FundMethodExchangeBrands.d.ts +8 -0
- package/dist/widget/assets/components/FundMethodExchangeBrands.d.ts.map +1 -0
- package/dist/widget/assets/components/FundMethodExchangeBrands.js +37 -0
- package/dist/widget/assets/components/MetaMaskIconFox.d.ts +8 -0
- package/dist/widget/assets/components/MetaMaskIconFox.d.ts.map +1 -0
- package/dist/widget/assets/components/MetaMaskIconFoxWithMargins.d.ts +8 -0
- package/dist/widget/assets/components/MetaMaskIconFoxWithMargins.d.ts.map +1 -0
- package/dist/widget/assets/components/MetaMaskLogoBlack.d.ts +8 -0
- package/dist/widget/assets/components/MetaMaskLogoBlack.d.ts.map +1 -0
- package/dist/widget/assets/components/MetaMaskLogoWhite.d.ts +8 -0
- package/dist/widget/assets/components/MetaMaskLogoWhite.d.ts.map +1 -0
- package/dist/widget/assets/components/Morpho.d.ts +8 -0
- package/dist/widget/assets/components/Morpho.d.ts.map +1 -0
- package/dist/widget/assets/components/Morpho.js +51 -0
- package/dist/widget/assets/components/TrailsBlack.d.ts +8 -0
- package/dist/widget/assets/components/TrailsBlack.d.ts.map +1 -0
- package/dist/widget/assets/components/TrailsBlack.js +25 -0
- package/dist/widget/assets/components/TrailsWhite.d.ts +8 -0
- package/dist/widget/assets/components/TrailsWhite.d.ts.map +1 -0
- package/dist/widget/assets/components/TrailsWhite.js +25 -0
- package/dist/widget/assets/components/WalletChangeBlack.d.ts +8 -0
- package/dist/widget/assets/components/WalletChangeBlack.d.ts.map +1 -0
- package/dist/widget/assets/components/WalletConnectLogo.d.ts +8 -0
- package/dist/widget/assets/components/WalletConnectLogo.d.ts.map +1 -0
- package/dist/widget/assets/components/WalletConnectLogoBlack.d.ts +8 -0
- package/dist/widget/assets/components/WalletConnectLogoBlack.d.ts.map +1 -0
- package/dist/widget/assets/components/WalletConnectLogoBlue.d.ts +8 -0
- package/dist/widget/assets/components/WalletConnectLogoBlue.d.ts.map +1 -0
- package/dist/widget/assets/components/WalletConnectLogoWhite.d.ts +8 -0
- package/dist/widget/assets/components/WalletConnectLogoWhite.d.ts.map +1 -0
- package/dist/widget/assets/components/index.d.ts +17 -0
- package/dist/widget/assets/components/index.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoCache.d.ts +54 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoCache.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoCache.js +68 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoFlowClient.d.ts +386 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoFlowClient.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoFlowClient.js +872 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoWebClient.d.ts +192 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoWebClient.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/BluvoWebClient.js +294 -0
- package/dist/widget/bluvo/bluvo-lib/WebSocketClient.d.ts +51 -0
- package/dist/widget/bluvo/bluvo-lib/WebSocketClient.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/WebSocketClient.js +72 -0
- package/dist/widget/bluvo/bluvo-lib/WebsocketListener.d.ts +19 -0
- package/dist/widget/bluvo/bluvo-lib/WebsocketListener.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/WebsocketListener.js +62 -0
- package/dist/widget/bluvo/bluvo-lib/WorkflowTypes.d.ts +44 -0
- package/dist/widget/bluvo/bluvo-lib/WorkflowTypes.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/WorkflowTypes.js +6 -0
- package/dist/widget/bluvo/bluvo-lib/api.types.d.ts +49 -0
- package/dist/widget/bluvo/bluvo-lib/api.types.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/balanceTransform.d.ts +84 -0
- package/dist/widget/bluvo/bluvo-lib/balanceTransform.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/balanceTransform.js +26 -0
- package/dist/widget/bluvo/bluvo-lib/createMachine.d.ts +3 -0
- package/dist/widget/bluvo/bluvo-lib/createMachine.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/createMachine.js +38 -0
- package/dist/widget/bluvo/bluvo-lib/error-codes.d.ts +156 -0
- package/dist/widget/bluvo/bluvo-lib/error-codes.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/error-codes.js +115 -0
- package/dist/widget/bluvo/bluvo-lib/flow.types.d.ts +356 -0
- package/dist/widget/bluvo/bluvo-lib/flow.types.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/flowMachine.d.ts +4 -0
- package/dist/widget/bluvo/bluvo-lib/flowMachine.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/flowMachine.js +45 -0
- package/dist/widget/bluvo/bluvo-lib/flowMachine.types.d.ts +20 -0
- package/dist/widget/bluvo/bluvo-lib/flowMachine.types.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/flowStateHandlers.d.ts +39 -0
- package/dist/widget/bluvo/bluvo-lib/flowStateHandlers.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/flowStateHandlers.js +395 -0
- package/dist/widget/bluvo/bluvo-lib/index.d.ts +5 -0
- package/dist/widget/bluvo/bluvo-lib/index.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/machine.types.d.ts +15 -0
- package/dist/widget/bluvo/bluvo-lib/machine.types.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/stateHelpers.d.ts +23 -0
- package/dist/widget/bluvo/bluvo-lib/stateHelpers.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/stateHelpers.js +24 -0
- package/dist/widget/bluvo/bluvo-lib/useBluvoFlow.d.ts +325 -0
- package/dist/widget/bluvo/bluvo-lib/useBluvoFlow.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/useBluvoFlow.js +152 -0
- package/dist/widget/bluvo/bluvo-lib/useFlowMachine.d.ts +11 -0
- package/dist/widget/bluvo/bluvo-lib/useFlowMachine.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/useFlowMachine.js +25 -0
- package/dist/widget/bluvo/bluvo-lib/useWithdrawMachine.d.ts +17 -0
- package/dist/widget/bluvo/bluvo-lib/useWithdrawMachine.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawal.types.d.ts +46 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawal.types.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawalErrorHandler.d.ts +29 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawalErrorHandler.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawalErrorHandler.js +95 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawalMachine.d.ts +3 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawalMachine.d.ts.map +1 -0
- package/dist/widget/bluvo/bluvo-lib/withdrawalMachine.js +137 -0
- package/dist/widget/bluvo/index.d.ts +2 -0
- package/dist/widget/bluvo/index.d.ts.map +1 -0
- package/dist/widget/components/AccountActionsDropdown.js +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.js +143 -190
- package/dist/widget/components/AccountIntentTransactionHistoryButton.js +1 -1
- package/dist/widget/components/AccountSettings.d.ts.map +1 -1
- package/dist/widget/components/AccountSettings.js +19 -18
- package/dist/widget/components/AddressWalletIcon.d.ts +1 -1
- package/dist/widget/components/AddressWalletIcon.d.ts.map +1 -1
- package/dist/widget/components/AddressWalletIcon.js +13 -13
- package/dist/widget/components/AllChainsIcon.d.ts.map +1 -1
- package/dist/widget/components/AllChainsIcon.js +80 -13
- package/dist/widget/components/BluvoExchangeSelection.d.ts +12 -0
- package/dist/widget/components/BluvoExchangeSelection.d.ts.map +1 -0
- package/dist/widget/components/BluvoExchangeSelection.js +131 -0
- package/dist/widget/components/BluvoExchangeSelection.lazy.d.ts +2 -0
- package/dist/widget/components/BluvoExchangeSelection.lazy.d.ts.map +1 -0
- package/dist/widget/components/BluvoExchangeSelection.lazy.js +4 -0
- package/dist/widget/components/BluvoOnrampFlow.d.ts +20 -0
- package/dist/widget/components/BluvoOnrampFlow.d.ts.map +1 -0
- package/dist/widget/components/BluvoOnrampFlow.js +1472 -0
- package/dist/widget/components/BluvoOnrampFlow.lazy.d.ts +2 -0
- package/dist/widget/components/BluvoOnrampFlow.lazy.d.ts.map +1 -0
- package/dist/widget/components/BluvoOnrampFlow.lazy.js +4 -0
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ChainFilterDropdown.js +37 -37
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ChainList.js +157 -119
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.js +309 -300
- package/dist/widget/components/ConfigDisplay.js +3 -3
- package/dist/widget/components/ConnectWallet.d.ts +1 -6
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.js +110 -165
- package/dist/widget/components/ConnectedWallets.d.ts +3 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.js +75 -100
- package/dist/widget/components/CopyButton.js +1 -1
- package/dist/widget/components/CountryFilterDropdown.js +1 -1
- package/dist/widget/components/DebugMenu.js +1 -1
- package/dist/widget/components/DepositTracker.js +1 -1
- package/dist/widget/components/DirectTransfer.d.ts +1 -1
- package/dist/widget/components/DirectTransfer.js +3 -3
- package/dist/widget/components/Earn.js +1 -1
- package/dist/widget/components/EarnMarkets.d.ts.map +1 -1
- package/dist/widget/components/EarnMarkets.js +162 -148
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.js +123 -103
- package/dist/widget/components/EarnPoolsFilters.d.ts.map +1 -1
- package/dist/widget/components/EarnPoolsFilters.js +19 -16
- package/dist/widget/components/EarnWithdraw.d.ts.map +1 -1
- package/dist/widget/components/EarnWithdraw.js +130 -129
- package/dist/widget/components/FeeOptions.js +1 -1
- package/dist/widget/components/FiatSelector.js +5 -5
- package/dist/widget/components/FiatSelectorButton.js +6 -6
- package/dist/widget/components/Footer.d.ts.map +1 -1
- package/dist/widget/components/Footer.js +47 -40
- package/dist/widget/components/Fund.d.ts +15 -11
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/Fund.js +13 -1088
- package/dist/widget/components/Fund.types.d.ts +22 -0
- package/dist/widget/components/Fund.types.d.ts.map +1 -0
- package/dist/widget/components/FundExactInput.d.ts +5 -0
- package/dist/widget/components/FundExactInput.d.ts.map +1 -0
- package/dist/widget/components/FundExactInput.js +1116 -0
- package/dist/widget/components/FundExactOutput.d.ts +5 -0
- package/dist/widget/components/FundExactOutput.d.ts.map +1 -0
- package/dist/widget/components/FundExactOutput.js +498 -0
- package/dist/widget/components/FundMethods.d.ts +2 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.js +144 -143
- package/dist/widget/components/FundWalletSelection.d.ts +1 -0
- package/dist/widget/components/FundWalletSelection.d.ts.map +1 -1
- package/dist/widget/components/FundWalletSelection.js +18 -19
- package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.js +32 -30
- package/dist/widget/components/HookModalContent.js +11 -11
- package/dist/widget/components/MeldForm.js +15 -15
- package/dist/widget/components/MeldHistory.js +5 -5
- package/dist/widget/components/MeldStepsFlow.js +8 -8
- package/dist/widget/components/MeldTransactionStatus.js +7 -7
- package/dist/widget/components/Modal.js +3 -3
- package/dist/widget/components/OnRampProviderSelector.js +1 -1
- package/dist/widget/components/OnrampErrorScreen.js +1 -1
- package/dist/widget/components/OnrampHistoryRow.js +1 -1
- package/dist/widget/components/OnrampPaymentMethods.js +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.js +7 -7
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/Pay.js +223 -216
- package/dist/widget/components/PaymentMethods.d.ts.map +1 -1
- package/dist/widget/components/PaymentMethods.js +51 -52
- package/dist/widget/components/PoolDeposit.js +35 -35
- package/dist/widget/components/QRCodeOptions.js +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts +1 -1
- package/dist/widget/components/QRCodeWalletSelect.js +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.js +195 -187
- package/dist/widget/components/QuoteInputErrorBlock.d.ts +7 -0
- package/dist/widget/components/QuoteInputErrorBlock.d.ts.map +1 -0
- package/dist/widget/components/QuoteInputErrorBlock.js +22 -0
- package/dist/widget/components/Receipt.js +15 -15
- package/dist/widget/components/RecentChains.d.ts +9 -0
- package/dist/widget/components/RecentChains.d.ts.map +1 -0
- package/dist/widget/components/RecentChains.js +28 -0
- package/dist/widget/components/RecipientSelectorButton.js +5 -5
- package/dist/widget/components/Recipients.d.ts.map +1 -1
- package/dist/widget/components/Recipients.js +84 -102
- package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
- package/dist/widget/components/ScreenHeader.js +20 -20
- package/dist/widget/components/SearchInputField.js +4 -4
- package/dist/widget/components/SessionTimeoutScreen.js +1 -1
- package/dist/widget/components/ShadowPortal.js +1 -1
- package/dist/widget/components/SlippageToleranceSettings.js +4 -4
- package/dist/widget/components/ThemeProvider.js +1 -1
- package/dist/widget/components/Toast.js +19 -19
- package/dist/widget/components/TokenImage.js +4 -4
- 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 +201 -190
- package/dist/widget/components/TokenSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/TokenSelectorButton.js +22 -22
- package/dist/widget/components/TrailsHookModal.d.ts +2 -2
- package/dist/widget/components/TrailsHookModal.d.ts.map +1 -1
- package/dist/widget/components/TrailsHookModal.js +47 -49
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.js +33 -23
- package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
- package/dist/widget/components/TransactionHistoryItem.js +278 -188
- package/dist/widget/components/TransferPendingVertical.js +2 -2
- package/dist/widget/components/UserPreferences.js +11 -11
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
- package/dist/widget/components/WaasFeeOptions.js +208 -159
- package/dist/widget/components/WalletAccountHeader.js +1 -1
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
- package/dist/widget/components/WalletConfirmation.js +46 -47
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.js +83 -135
- package/dist/widget/components/WalletConnectionPending.d.ts.map +1 -1
- package/dist/widget/components/WalletConnectionPending.js +25 -25
- package/dist/widget/components/WalletList.d.ts +8 -2
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/components/WalletList.js +61 -33
- package/dist/widget/components/WidgetProviders.d.ts +3 -1
- package/dist/widget/components/WidgetProviders.d.ts.map +1 -1
- package/dist/widget/components/WidgetProviders.js +32 -28
- package/dist/widget/components/Withdraw.d.ts.map +1 -1
- package/dist/widget/components/Withdraw.js +192 -185
- package/dist/widget/index.d.ts +3 -1
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +30 -26
- package/dist/widget/modes/EarnWidget.d.ts +4 -4
- package/dist/widget/modes/EarnWidget.d.ts.map +1 -1
- package/dist/widget/modes/EarnWidget.js +17 -15
- package/dist/widget/modes/FundWidget.d.ts +13 -0
- package/dist/widget/modes/FundWidget.d.ts.map +1 -1
- package/dist/widget/modes/FundWidget.js +30 -28
- package/dist/widget/modes/PayWidget.d.ts.map +1 -1
- package/dist/widget/modes/PayWidget.js +23 -21
- package/dist/widget/modes/SwapWidget.d.ts.map +1 -1
- package/dist/widget/modes/SwapWidget.js +19 -18
- package/dist/widget/modes/WithdrawWidget.d.ts +3 -3
- package/dist/widget/modes/WithdrawWidget.d.ts.map +1 -1
- package/dist/widget/modes/WithdrawWidget.js +15 -13
- package/dist/widget/props.d.ts +255 -0
- package/dist/widget/props.d.ts.map +1 -0
- package/dist/widget/props.js +14 -0
- package/dist/widget/providers/TrailsModalProvider.js +4 -4
- package/dist/widget/providers/TrailsProvider.d.ts +78 -16
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/providers/TrailsProvider.js +64 -46
- package/dist/widget/providers/WalletContext.d.ts +10 -0
- package/dist/widget/providers/WalletContext.d.ts.map +1 -0
- package/dist/widget/providers/WalletContext.js +23 -0
- package/dist/widget/providers/WidgetProviderTree.d.ts +9 -7
- package/dist/widget/providers/WidgetProviderTree.d.ts.map +1 -1
- package/dist/widget/providers/WidgetProviderTree.js +31 -47
- package/dist/widget/providers/adapterConfig.d.ts +13 -0
- package/dist/widget/providers/adapterConfig.d.ts.map +1 -0
- package/dist/widget/providers/adapterConfig.js +97 -0
- package/dist/widget/providers/sequenceSupport.d.ts +42 -0
- package/dist/widget/providers/sequenceSupport.d.ts.map +1 -0
- package/dist/widget/providers/walletRuntimeResolution.d.ts +10 -0
- package/dist/widget/providers/walletRuntimeResolution.d.ts.map +1 -0
- package/dist/widget/providers/walletRuntimeResolution.js +14 -0
- package/dist/widget/shared/destinationDefaultToken.d.ts.map +1 -1
- package/dist/widget/shared/destinationDefaultToken.js +12 -13
- package/dist/widget/shared/destinationSupport.d.ts +40 -0
- package/dist/widget/shared/destinationSupport.d.ts.map +1 -0
- package/dist/widget/shared/destinationSupport.js +215 -0
- package/dist/widget/shared/resolution.d.ts +2 -17
- package/dist/widget/shared/resolution.d.ts.map +1 -1
- package/dist/widget/shared/resolution.js +32 -52
- package/dist/widget/shared/resolvePaymentSource.d.ts +2 -1
- package/dist/widget/shared/resolvePaymentSource.d.ts.map +1 -1
- package/dist/widget/shared/resolvePaymentSource.js +9 -9
- package/dist/widget/shared/types.d.ts +23 -31
- package/dist/widget/shared/types.d.ts.map +1 -1
- package/dist/widget/styles.gen.d.ts.map +1 -1
- package/dist/widget/styles.gen.js +4 -4
- package/dist/widget/utils/fundMethodSwitchState.d.ts +2 -0
- package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
- package/dist/widget/utils/fundMethodSwitchState.js +3 -3
- package/dist/widget/utils/tokens.d.ts.map +1 -1
- package/dist/widget/utils/tokens.js +11 -25
- package/dist/widget/utils/trailsOnrampConfig.d.ts +5 -0
- package/dist/widget/utils/trailsOnrampConfig.d.ts.map +1 -1
- package/dist/widget/utils/viewManagerGuards.d.ts.map +1 -1
- package/dist/widget/utils/viewManagerGuards.js +5 -4
- package/dist/widget/utils/walletConnectRedirect.d.ts +19 -0
- package/dist/widget/utils/walletConnectRedirect.d.ts.map +1 -0
- package/dist/widget/utils/walletConnectRedirect.js +21 -0
- package/dist/widget/widget.d.ts +2 -224
- package/dist/widget/widget.d.ts.map +1 -1
- package/dist/widget/widget.js +995 -993
- package/dist/widgetFlowHooks.d.ts +12 -0
- package/dist/widgetFlowHooks.d.ts.map +1 -0
- package/dist/widgetFlowHooks.js +18 -0
- package/package.json +24 -22
- package/dist/hooks/useAddressWalletIcon.d.ts +0 -10
- package/dist/hooks/useAddressWalletIcon.d.ts.map +0 -1
- package/dist/hooks/useAddressWalletIcon.js +0 -33
- package/dist/hooks/useConnector.d.ts +0 -9
- package/dist/hooks/useConnector.d.ts.map +0 -1
- package/dist/hooks/useConnector.js +0 -11
- package/dist/hooks/useIsSequenceWallet.d.ts +0 -6
- package/dist/hooks/useIsSequenceWallet.d.ts.map +0 -1
- package/dist/hooks/useIsSequenceWallet.js +0 -10
- package/dist/hooks/useTokens.d.ts.map +0 -1
- package/dist/hooks/useTokens.js +0 -166
- package/dist/hooks/useWalletConnectUri.d.ts +0 -19
- package/dist/hooks/useWalletConnectUri.d.ts.map +0 -1
- package/dist/hooks/useWalletConnectUri.js +0 -122
- package/dist/query/tokenList.queries.d.ts +0 -54
- package/dist/query/tokenList.queries.d.ts.map +0 -1
- package/dist/query/tokenList.queries.js +0 -77
- package/dist/tokensApi.d.ts +0 -8
- package/dist/tokensApi.d.ts.map +0 -1
- package/dist/tokensApi.js +0 -56
- package/dist/walletUtils.d.ts +0 -42
- package/dist/walletUtils.d.ts.map +0 -1
- package/dist/walletUtils.js +0 -110
- package/dist/wallets.d.ts +0 -23
- package/dist/wallets.d.ts.map +0 -1
- package/dist/wallets.js +0 -236
- package/dist/widget/assets/FundMethod-card-brands.js +0 -4
- package/dist/widget/assets/FundMethod-exchange-brands.js +0 -4
- package/dist/widget/assets/Trails-logo-black.js +0 -4
- package/dist/widget/assets/Trails-logo-white.js +0 -4
- package/dist/widget/assets/aave.js +0 -4
- package/dist/widget/assets/morpho.js +0 -4
- package/dist/widget/components/FundMethodIcons.d.ts +0 -4
- package/dist/widget/components/FundMethodIcons.d.ts.map +0 -1
- package/dist/widget/components/FundMethodIcons.js +0 -60
- package/dist/widget/shared/tokenAllowlist.d.ts +0 -36
- package/dist/widget/shared/tokenAllowlist.d.ts.map +0 -1
- package/dist/widget/shared/tokenAllowlist.js +0 -60
- package/dist/widget/utils/createWagmiConfig.d.ts +0 -10
- package/dist/widget/utils/createWagmiConfig.d.ts.map +0 -1
- package/dist/widget/utils/createWagmiConfig.js +0 -18
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { encodeMulticallHydrateExecute as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
function
|
|
7
|
-
return
|
|
1
|
+
import { isZeroAccount as e } from "../utils/address.js";
|
|
2
|
+
import { TRAILS_CONTRACTS as l } from "../contractConstants.js";
|
|
3
|
+
import { encodeMulticallHydrateExecute as m } from "../hydrate/multicall.js";
|
|
4
|
+
import { IntentProtocolVersion as s } from "@0xtrails/api";
|
|
5
|
+
import { isAddress as t } from "viem";
|
|
6
|
+
function k(r) {
|
|
7
|
+
return r?.flat() ?? [];
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (!
|
|
11
|
-
if (!
|
|
12
|
-
if (
|
|
13
|
-
if (!
|
|
14
|
-
if (
|
|
15
|
-
for (const
|
|
16
|
-
if (!
|
|
17
|
-
if (
|
|
18
|
-
if (!
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
9
|
+
function y({ calls: r, tokenAddress: a, sweepTarget: i, intentProtocolVersion: d }) {
|
|
10
|
+
if (!r.length) throw new Error("destination calls are empty");
|
|
11
|
+
if (!t(a)) throw new Error("destination call encoding requires a valid token address");
|
|
12
|
+
if (e(a)) throw new Error("destination call encoding requires a non-zero token address (use WETH for native token flows)");
|
|
13
|
+
if (!i || !t(i) || e(i)) throw new Error("destination call encoding requires a valid sweep target");
|
|
14
|
+
if (d && d !== s.v1_5) throw new Error("destination call encoding requires v1.5 protocol");
|
|
15
|
+
for (const n of r) {
|
|
16
|
+
if (!t(n.to)) throw new Error(`Invalid destination call target: ${n.to}`);
|
|
17
|
+
if (e(n.to)) throw new Error("Destination call target must not be the zero address");
|
|
18
|
+
if (!n.data?.startsWith("0x")) throw new Error(`Invalid destination call calldata for target: ${n.to}`);
|
|
19
|
+
if (n.dynamicAmountToken && !t(n.dynamicAmountToken)) throw new Error(`Invalid destination call dynamicAmountToken: ${n.dynamicAmountToken}`);
|
|
20
|
+
if (e(n.dynamicAmountToken)) throw new Error("dynamicAmountToken must not be the zero address");
|
|
21
|
+
if (n.dynamicAmountToken !== void 0 && n.dynamicAmountTokens !== void 0) throw new Error("dynamicAmountToken and dynamicAmountTokens are mutually exclusive");
|
|
22
|
+
if (n.dynamicAmountTokens?.length === 0) throw new Error("dynamicAmountTokens must not be empty");
|
|
23
|
+
for (const o of n.dynamicAmountTokens ?? []) {
|
|
24
|
+
if (!t(o)) throw new Error(`Invalid destination call dynamicAmountTokens entry: ${o}`);
|
|
25
|
+
if (e(o)) throw new Error("dynamicAmountTokens must not contain the zero address");
|
|
26
|
+
}
|
|
27
|
+
for (const o of n.sweepTokens ?? []) if (!t(o)) throw new Error(`Invalid destination call sweepTokens entry: ${o}`);
|
|
21
28
|
}
|
|
22
29
|
return {
|
|
23
|
-
recipient:
|
|
24
|
-
destinationCalldata:
|
|
25
|
-
calls:
|
|
26
|
-
token:
|
|
27
|
-
sweepTarget:
|
|
30
|
+
recipient: l.trailsUtilsAddress,
|
|
31
|
+
destinationCalldata: m({
|
|
32
|
+
calls: r,
|
|
33
|
+
token: a,
|
|
34
|
+
sweepTarget: i
|
|
28
35
|
}),
|
|
29
36
|
isMultiCallEncoding: !0,
|
|
30
|
-
intentProtocolVersion:
|
|
37
|
+
intentProtocolVersion: d ?? s.v1_5
|
|
31
38
|
};
|
|
32
39
|
}
|
|
33
40
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
y as encodeDestinationCalls,
|
|
42
|
+
k as flattenDestinationCalls
|
|
36
43
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useTrailsClient as
|
|
3
|
-
import {
|
|
1
|
+
import { getEarnBalances as s } from "../utils.js";
|
|
2
|
+
import { useTrailsClient as u } from "../../trailsClient.js";
|
|
3
|
+
import { resolveChainId as l, resolveChainName as d } from "../../widget/shared/resolution.js";
|
|
4
4
|
import { useQuery as f } from "@tanstack/react-query";
|
|
5
5
|
var m = {
|
|
6
6
|
56: "binance",
|
|
7
7
|
43114: "avalanche-c"
|
|
8
8
|
};
|
|
9
9
|
function h(e) {
|
|
10
|
-
const n = (r) => m[r] ??
|
|
11
|
-
return typeof e == "number" ? n(e) : typeof e == "object" && "id" in e ? n(e.id) : n(
|
|
10
|
+
const n = (r) => m[r] ?? d(r);
|
|
11
|
+
return typeof e == "number" ? n(e) : typeof e == "object" && "id" in e ? n(e.id) : n(l(e));
|
|
12
12
|
}
|
|
13
13
|
function B(e) {
|
|
14
14
|
return ("chains" in e && e.chains ? e.chains : [e.chain]).map((n) => ({
|
|
@@ -19,9 +19,9 @@ function B(e) {
|
|
|
19
19
|
}));
|
|
20
20
|
}
|
|
21
21
|
function b(e) {
|
|
22
|
-
const { enabled: n = !0 } = e, r = B(e), i =
|
|
22
|
+
const { enabled: n = !0 } = e, r = B(e), i = u(), { data: t, isLoading: a, error: o, refetch: c } = f({
|
|
23
23
|
queryKey: ["earnBalances", r],
|
|
24
|
-
queryFn: () =>
|
|
24
|
+
queryFn: () => s({ queries: r }, i),
|
|
25
25
|
enabled: n && r.length > 0
|
|
26
26
|
});
|
|
27
27
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getEarnMarkets as n } from "../utils.js";
|
|
2
|
+
import { useTrailsClient as l } from "../../trailsClient.js";
|
|
3
3
|
import { useQuery as s } from "@tanstack/react-query";
|
|
4
4
|
function d(t) {
|
|
5
|
-
const i =
|
|
5
|
+
const i = l(), { data: e, isLoading: o, error: r, refetch: f } = s({
|
|
6
6
|
queryKey: [
|
|
7
7
|
"earnMarkets",
|
|
8
8
|
t.chain,
|
|
@@ -13,7 +13,7 @@ function d(t) {
|
|
|
13
13
|
t.offset,
|
|
14
14
|
t.search
|
|
15
15
|
],
|
|
16
|
-
queryFn: () =>
|
|
16
|
+
queryFn: () => n(t, i)
|
|
17
17
|
});
|
|
18
18
|
return {
|
|
19
19
|
data: e?.items,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getEarnProviders as n } from "../utils.js";
|
|
2
|
+
import { useTrailsClient as s } from "../../trailsClient.js";
|
|
3
3
|
import { useQuery as l } from "@tanstack/react-query";
|
|
4
4
|
function c(t = {}) {
|
|
5
|
-
const r =
|
|
5
|
+
const r = s(), { data: e, isLoading: i, error: o, refetch: f } = l({
|
|
6
6
|
queryKey: [
|
|
7
7
|
"earnProviders",
|
|
8
8
|
t.limit,
|
|
9
9
|
t.offset
|
|
10
10
|
],
|
|
11
|
-
queryFn: () =>
|
|
11
|
+
queryFn: () => n(t, r)
|
|
12
12
|
});
|
|
13
13
|
return {
|
|
14
14
|
data: e?.items,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicClient } from 'viem';
|
|
2
|
-
import { QuoteError } from '../../
|
|
3
|
-
import { Call, ChainIdentifier
|
|
2
|
+
import { QuoteError } from '../../quoteError.js';
|
|
3
|
+
import { ActionItem, Call, ChainIdentifier } from '../types.js';
|
|
4
4
|
import { TrailsClient } from '../../trailsClient.js';
|
|
5
5
|
export type UseResolveActionsProps = {
|
|
6
6
|
actions: ActionItem[];
|
|
@@ -15,14 +15,5 @@ export type UseResolveActionsReturn = {
|
|
|
15
15
|
isLoading: boolean;
|
|
16
16
|
error: QuoteError | null;
|
|
17
17
|
};
|
|
18
|
-
export type ResolveActionsToCallsParams = {
|
|
19
|
-
actions: ActionItem[];
|
|
20
|
-
destinationChain: ChainIdentifier;
|
|
21
|
-
userWalletAddress: `0x${string}`;
|
|
22
|
-
trailsClient: TrailsClient;
|
|
23
|
-
publicClient: PublicClient | null;
|
|
24
|
-
abortSignal?: AbortSignal;
|
|
25
|
-
};
|
|
26
|
-
export declare function resolveActionsToCalls(params: ResolveActionsToCallsParams): Promise<Call[]>;
|
|
27
18
|
export declare function useResolveActions(props: UseResolveActionsProps): UseResolveActionsReturn;
|
|
28
19
|
//# sourceMappingURL=useResolveActions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResolveActions.d.ts","sourceRoot":"","sources":["../../../src/actions/hooks/useResolveActions.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useResolveActions.d.ts","sourceRoot":"","sources":["../../../src/actions/hooks/useResolveActions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGzD,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,gBAAgB,EAAE,eAAe,CAAA;IACjC,iBAAiB,EAAE,KAAK,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5C,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;CAClC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;CACzB,CAAA;AAQD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,CAqFzB"}
|
|
@@ -1,238 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function H(t) {
|
|
13
|
-
return "type" in t && t.type === "lend";
|
|
14
|
-
}
|
|
15
|
-
function z(t) {
|
|
16
|
-
return "type" in t && t.type === "swap";
|
|
17
|
-
}
|
|
18
|
-
function W(t) {
|
|
19
|
-
return "type" in t && t.type === "deposit";
|
|
20
|
-
}
|
|
21
|
-
function J(t) {
|
|
22
|
-
return "type" in t && t.type === "custom";
|
|
23
|
-
}
|
|
24
|
-
function Q(t) {
|
|
25
|
-
return "type" in t && t.type === "assert";
|
|
26
|
-
}
|
|
27
|
-
function Y(t) {
|
|
28
|
-
return JSON.stringify(t, (e, r) => typeof r == "bigint" ? r.toString() : r);
|
|
29
|
-
}
|
|
30
|
-
function j(t, e) {
|
|
31
|
-
const r = String(t);
|
|
32
|
-
if (N(r)) return R.find((o) => o.chainId === e && o.contractAddress.toLowerCase() === r.toLowerCase())?.decimals ?? null;
|
|
33
|
-
try {
|
|
34
|
-
return $.token(t).onChain(e).decimals;
|
|
35
|
-
} catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async function G(t, e, r) {
|
|
40
|
-
const o = j(t, e);
|
|
41
|
-
if (o !== null) return o;
|
|
42
|
-
const u = String(t);
|
|
43
|
-
if (N(u) && r) try {
|
|
44
|
-
return await r.readContract({
|
|
45
|
-
address: u,
|
|
46
|
-
abi: q,
|
|
47
|
-
functionName: "decimals"
|
|
48
|
-
});
|
|
49
|
-
} catch {
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`Could not resolve decimals for token "${u}" on chain ${e}. Pass a known token symbol or address.`);
|
|
52
|
-
}
|
|
53
|
-
function K(t) {
|
|
54
|
-
const e = t.indexOf("-");
|
|
55
|
-
return e === -1 ? null : t.slice(0, e).toLowerCase();
|
|
56
|
-
}
|
|
57
|
-
function v(t) {
|
|
58
|
-
if (typeof t == "string") return t.toLowerCase();
|
|
59
|
-
try {
|
|
60
|
-
return M(k(t));
|
|
61
|
-
} catch {
|
|
62
|
-
return String(t);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function V(t, e) {
|
|
66
|
-
try {
|
|
67
|
-
return k(t) === k(e);
|
|
68
|
-
} catch {
|
|
69
|
-
return v(t) === v(e);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async function y(t, e, r, o) {
|
|
73
|
-
return S(t) ? b : typeof t == "bigint" ? t : P(t, await G(e, r, o));
|
|
74
|
-
}
|
|
75
|
-
function Z(t) {
|
|
76
|
-
return S(t) ? b : typeof t == "bigint" ? t : F(t);
|
|
77
|
-
}
|
|
78
|
-
async function tt(t, e, r) {
|
|
79
|
-
const o = _.trailsUtilsAddress;
|
|
80
|
-
if (t.assertType === "erc20Balance") return {
|
|
81
|
-
to: o,
|
|
82
|
-
data: C({
|
|
83
|
-
abi: T,
|
|
84
|
-
functionName: "requireMinERC20BalanceSelf",
|
|
85
|
-
args: [O(t.token, e), await y(t.gte, t.token, e, r)]
|
|
86
|
-
})
|
|
87
|
-
};
|
|
88
|
-
if (t.assertType === "nativeBalance") return {
|
|
89
|
-
to: o,
|
|
90
|
-
data: C({
|
|
91
|
-
abi: T,
|
|
92
|
-
functionName: "requireMinBalanceSelf",
|
|
93
|
-
args: [Z(t.gte)]
|
|
94
|
-
})
|
|
95
|
-
};
|
|
96
|
-
if (t.assertType === "notExpired") return {
|
|
97
|
-
to: o,
|
|
98
|
-
data: C({
|
|
99
|
-
abi: T,
|
|
100
|
-
functionName: "requireNonExpired",
|
|
101
|
-
args: [BigInt(t.deadline)]
|
|
102
|
-
})
|
|
103
|
-
};
|
|
104
|
-
if (t.assertType === "erc20Allowance") {
|
|
105
|
-
const u = O(t.token, e), l = await y(t.gte, t.token, e, r);
|
|
106
|
-
return {
|
|
107
|
-
to: o,
|
|
108
|
-
data: C({
|
|
109
|
-
abi: T,
|
|
110
|
-
functionName: "requireMinERC20AllowanceSelf",
|
|
111
|
-
args: [
|
|
112
|
-
u,
|
|
113
|
-
t.spender,
|
|
114
|
-
l
|
|
115
|
-
]
|
|
116
|
-
})
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
throw new Error(`Unknown assert type: ${t.assertType}`);
|
|
120
|
-
}
|
|
121
|
-
async function nt(t) {
|
|
122
|
-
const { actions: e, destinationChain: r, userWalletAddress: o, trailsClient: u, publicClient: l, abortSignal: c } = t, m = k(r), p = v(r), s = [];
|
|
123
|
-
for (let i = 0; i < e.length; i++) {
|
|
124
|
-
if (c?.aborted) return s;
|
|
125
|
-
const n = e[i];
|
|
126
|
-
if (Q(n)) {
|
|
127
|
-
const a = await tt(n, m, l);
|
|
128
|
-
s.push(a);
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (H(n) || W(n)) {
|
|
132
|
-
const a = K(n.marketId);
|
|
133
|
-
if (a && !V(a, r)) throw new I("CHAIN_MISMATCH", `Action ${i} (${n.type}): market "${n.marketId}" targets chain "${a}" but destination chain is "${p}"`);
|
|
134
|
-
const A = et(n, o), w = await x({
|
|
135
|
-
marketId: n.marketId,
|
|
136
|
-
amount: n.amount,
|
|
137
|
-
userWalletAddress: o,
|
|
138
|
-
args: A
|
|
139
|
-
}, `action[${i}].${n.type}`, u);
|
|
140
|
-
if (c?.aborted) return s;
|
|
141
|
-
s.push(...w);
|
|
142
|
-
} else if (z(n)) {
|
|
143
|
-
let a = n.swapType;
|
|
144
|
-
if (a === void 0) if (n.amountIn !== void 0) a = g.EXACT_INPUT;
|
|
145
|
-
else if (n.amountOut !== void 0) a = g.EXACT_OUTPUT;
|
|
146
|
-
else throw new Error(`Action ${i} (swap): one of amountIn or amountOut is required`);
|
|
147
|
-
let A, w, f, h;
|
|
148
|
-
if (a === g.EXACT_INPUT) {
|
|
149
|
-
if (n.amountIn === void 0) throw new Error(`Action ${i} (swap): amountIn is required for EXACT_INPUT`);
|
|
150
|
-
if (A = await y(n.amountIn, n.tokenIn, m, l), c?.aborted || (w = n.minAmountOut !== void 0 ? await y(n.minAmountOut, n.tokenOut, m, l) : 0n, c?.aborted)) return s;
|
|
151
|
-
} else {
|
|
152
|
-
if (n.amountOut === void 0) throw new Error(`Action ${i} (swap): amountOut is required for EXACT_OUTPUT`);
|
|
153
|
-
if (f = await y(n.amountOut, n.tokenOut, m, l), c?.aborted || (h = n.maxAmountIn === void 0 ? b : await y(n.maxAmountIn, n.tokenIn, m, l), c?.aborted)) return s;
|
|
154
|
-
}
|
|
155
|
-
const d = i === e.length - 1 ? o : U, L = D({
|
|
156
|
-
chain: r,
|
|
157
|
-
tokenIn: n.tokenIn,
|
|
158
|
-
tokenOut: n.tokenOut,
|
|
159
|
-
fee: n.fee,
|
|
160
|
-
recipient: n.recipient ?? d,
|
|
161
|
-
swapType: a,
|
|
162
|
-
provider: n.provider,
|
|
163
|
-
amountIn: A,
|
|
164
|
-
amountOutMinimum: w,
|
|
165
|
-
amountOut: f,
|
|
166
|
-
amountInMaximum: h
|
|
167
|
-
});
|
|
168
|
-
s.push(...L);
|
|
169
|
-
} else J(n) && s.push({
|
|
170
|
-
to: n.to,
|
|
171
|
-
data: n.data,
|
|
172
|
-
...n.value !== void 0 && { value: n.value },
|
|
173
|
-
...n.dynamicAmountToken !== void 0 && { dynamicAmountToken: n.dynamicAmountToken },
|
|
174
|
-
...n.hydrateEntries && n.hydrateEntries.length > 0 && { hydrateEntries: n.hydrateEntries }
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
if (s.length === 0 && !c?.aborted) throw new I("CALL_RESOLUTION_FAILED", "No transaction calls were produced from the actions");
|
|
178
|
-
return s;
|
|
179
|
-
}
|
|
180
|
-
function pt(t) {
|
|
181
|
-
const { actions: e, chainId: r, destinationChain: o, userWalletAddress: u, trailsClient: l, publicClient: c } = t, [m, p] = E(null), [s, i] = E(null), [n, a] = E(!1), A = X(() => e, [Y(e)]);
|
|
182
|
-
return B(() => {
|
|
183
|
-
if (!u || !r || !l) {
|
|
184
|
-
p(null), a(!1), i(null);
|
|
1
|
+
import { QuoteError as m } from "../../quoteError.js";
|
|
2
|
+
import { resolveActionsToCalls as y } from "../resolveActions.js";
|
|
3
|
+
import { useEffect as E, useMemo as L, useState as u } from "react";
|
|
4
|
+
function I(s) {
|
|
5
|
+
return JSON.stringify(s, (i, n) => typeof n == "bigint" ? n.toString() : n);
|
|
6
|
+
}
|
|
7
|
+
function _(s) {
|
|
8
|
+
const { actions: i, chainId: n, destinationChain: f, userWalletAddress: a, trailsClient: c, publicClient: g } = s, [A, r] = u(null), [C, e] = u(null), [p, o] = u(!1), d = L(() => i, [I(i)]);
|
|
9
|
+
return E(() => {
|
|
10
|
+
if (!a || !n || !c) {
|
|
11
|
+
r(null), o(!1), e(null);
|
|
185
12
|
return;
|
|
186
13
|
}
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
189
|
-
|
|
14
|
+
const b = d;
|
|
15
|
+
if (b.length === 0) {
|
|
16
|
+
r(null), o(!1), e(null);
|
|
190
17
|
return;
|
|
191
18
|
}
|
|
192
|
-
|
|
193
|
-
return
|
|
19
|
+
const l = new AbortController();
|
|
20
|
+
return o(!0), e(null), r(null), (async () => {
|
|
194
21
|
try {
|
|
195
|
-
const
|
|
196
|
-
actions:
|
|
197
|
-
destinationChain:
|
|
198
|
-
userWalletAddress:
|
|
199
|
-
trailsClient:
|
|
200
|
-
publicClient:
|
|
201
|
-
abortSignal:
|
|
202
|
-
return f;
|
|
203
|
-
} }
|
|
22
|
+
const t = await y({
|
|
23
|
+
actions: b,
|
|
24
|
+
destinationChain: f,
|
|
25
|
+
userWalletAddress: a,
|
|
26
|
+
trailsClient: c,
|
|
27
|
+
publicClient: g,
|
|
28
|
+
abortSignal: l.signal
|
|
204
29
|
});
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
} catch (
|
|
208
|
-
if (
|
|
209
|
-
|
|
30
|
+
if (l.signal.aborted) return;
|
|
31
|
+
r(t), e(null);
|
|
32
|
+
} catch (t) {
|
|
33
|
+
if (l.signal.aborted) return;
|
|
34
|
+
e(t instanceof m ? t : new m("CALL_RESOLUTION_FAILED", t instanceof Error ? t.message : "Failed to resolve actions")), r(null);
|
|
210
35
|
} finally {
|
|
211
|
-
|
|
36
|
+
l.signal.aborted || o(!1);
|
|
212
37
|
}
|
|
213
38
|
})(), () => {
|
|
214
|
-
|
|
39
|
+
l.abort();
|
|
215
40
|
};
|
|
216
41
|
}, [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
42
|
+
a,
|
|
43
|
+
d,
|
|
44
|
+
f,
|
|
45
|
+
n,
|
|
46
|
+
c,
|
|
47
|
+
g
|
|
223
48
|
]), {
|
|
224
|
-
calls:
|
|
225
|
-
isLoading:
|
|
226
|
-
error:
|
|
49
|
+
calls: A,
|
|
50
|
+
isLoading: p,
|
|
51
|
+
error: C
|
|
227
52
|
};
|
|
228
53
|
}
|
|
229
|
-
function et(t, e) {
|
|
230
|
-
const r = { amount: t.amount };
|
|
231
|
-
t.inputToken && (r.inputToken = t.inputToken), t.inputTokenNetwork && (r.inputTokenNetwork = t.inputTokenNetwork);
|
|
232
|
-
const o = t.receiverAddress ?? e;
|
|
233
|
-
return o && (r.receiverAddress = o), "useMaxAllowance" in t && t.useMaxAllowance !== void 0 && (r.useMaxAllowance = t.useMaxAllowance), r;
|
|
234
|
-
}
|
|
235
54
|
export {
|
|
236
|
-
|
|
237
|
-
pt as useResolveActions
|
|
55
|
+
_ as useResolveActions
|
|
238
56
|
};
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export type { SupportedChainName as ActionsSupportedChainName, ChainIdentifier a
|
|
|
9
9
|
export type { EarnMarket, EarnMarketToken, EarnMarketRewardRate, EarnMarketRewardRateComponent, EarnMarketStatistics, EarnMarketMetadata, EarnMarketStatus, EarnMarketArgumentField, EarnMarketArguments, EarnActionArgs, ProviderId, Provider, ProviderType, EarnType, EarnBalance, EarnBalances, EarnBalanceQuery, EarnBalanceError, } from './types/earn.js';
|
|
10
10
|
export { buildCall, buildApproveAndCall, buildErc20Approve, getAmountWithSlippage, erc20Utils, getEarnProviders, getEarnMarkets, getEarnBalances, } from './utils.js';
|
|
11
11
|
export type { GetProvidersParams, GetProvidersResult, GetMarketsParams, GetMarketsResult, GetEarnBalancesParams, GetEarnBalancesResult, } from './utils.js';
|
|
12
|
+
export { resolveActionsToCalls } from './resolveActions.js';
|
|
13
|
+
export type { ResolveActionsToCallsParams } from './resolveActions.js';
|
|
14
|
+
export { encodeDestinationCalls, flattenDestinationCalls, } from './destinationCalls.js';
|
|
15
|
+
export type { DestinationCallsInput, EncodedDestinationCalls, } from './destinationCalls.js';
|
|
16
|
+
export { QuoteError } from '../quoteError.js';
|
|
17
|
+
export type { QuoteErrorCode } from '../quoteError.js';
|
|
12
18
|
export { uniswapV3 } from './custom-integrations/uniswapV3/uniswapV3.js';
|
|
13
19
|
export type { UniswapV3ChainScoped, UniswapV3GetPoolParams, UniswapV3QuoteSwapParams, UniswapV3QuoteSwapResponse, UniswapV3QuoteSwapType, UniswapV3SwapExactInputSingleParams, UniswapV3SwapExactOutputSingleParams, } from './custom-integrations/uniswapV3/types.js';
|
|
14
20
|
export { sushiswapV3 } from './custom-integrations/sushiswapV3/sushiswapV3.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,eAAe,EACf,MAAM,GACP,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGtD,OAAO,EACL,OAAO,EACP,IAAI,EACJ,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGjD,YAAY,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,eAAe,EACf,yBAAyB,EACzB,UAAU,EACV,aAAa,EACb,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAA;AAInB,YAAY,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,eAAe,IAAI,sBAAsB,GAC1C,MAAM,YAAY,CAAA;AAGnB,YAAY,EACV,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,eAAe,EACf,MAAM,GACP,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAGtD,OAAO,EACL,OAAO,EACP,IAAI,EACJ,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGjD,YAAY,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,eAAe,EACf,yBAAyB,EACzB,UAAU,EACV,aAAa,EACb,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAA;AAInB,YAAY,EACV,kBAAkB,IAAI,yBAAyB,EAC/C,eAAe,IAAI,sBAAsB,GAC1C,MAAM,YAAY,CAAA;AAGnB,YAAY,EACV,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,6BAA6B,EAC7B,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,YAAY,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AACtE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAA;AACxE,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAC9E,YAAY,EACV,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,4CAA4C,CAAA;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/actions/index.js
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { QuoteError as r } from "../quoteError.js";
|
|
2
|
+
import { dynamic as i, isDynamicAmount as e, isSelfAddress as m, self as s } from "./dynamic.js";
|
|
3
|
+
import { TRAILS_ROUTER_ADDRESS as a } from "./constants.js";
|
|
4
|
+
import { buildApproveAndCall as n, buildCall as f, buildErc20Approve as d, erc20Utils as u, getAmountWithSlippage as A, getEarnBalances as c, getEarnMarkets as E, getEarnProviders as C } from "./utils.js";
|
|
5
|
+
import { uniswapV3 as g } from "./custom-integrations/uniswapV3/uniswapV3.js";
|
|
6
|
+
import { sushiswapV3 as v } from "./custom-integrations/sushiswapV3/sushiswapV3.js";
|
|
7
|
+
import { SwapType as R } from "./resolvers.js";
|
|
8
|
+
import { resolveActionsToCalls as b } from "./resolveActions.js";
|
|
9
|
+
import { encodeDestinationCalls as h, flattenDestinationCalls as U } from "./destinationCalls.js";
|
|
10
|
+
import { assertCondition as _, custom as k, deposit as x, lend as B, swap as I } from "./actionBuilder.js";
|
|
8
11
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
u as
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
r as QuoteError,
|
|
13
|
+
R as SwapType,
|
|
14
|
+
a as TRAILS_ROUTER_ADDRESS,
|
|
15
|
+
_ as assertCondition,
|
|
16
|
+
n as buildApproveAndCall,
|
|
17
|
+
f as buildCall,
|
|
18
|
+
d as buildErc20Approve,
|
|
19
|
+
k as custom,
|
|
20
|
+
x as deposit,
|
|
21
|
+
i as dynamic,
|
|
22
|
+
h as encodeDestinationCalls,
|
|
23
|
+
u as erc20Utils,
|
|
24
|
+
U as flattenDestinationCalls,
|
|
25
|
+
A as getAmountWithSlippage,
|
|
26
|
+
c as getEarnBalances,
|
|
27
|
+
E as getEarnMarkets,
|
|
28
|
+
C as getEarnProviders,
|
|
29
|
+
e as isDynamicAmount,
|
|
30
|
+
m as isSelfAddress,
|
|
31
|
+
B as lend,
|
|
32
|
+
b as resolveActionsToCalls,
|
|
33
|
+
s as self,
|
|
34
|
+
v as sushiswapV3,
|
|
35
|
+
I as swap,
|
|
36
|
+
g as uniswapV3
|
|
30
37
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PublicClient } from 'viem';
|
|
2
|
+
import { TrailsApi } from '@0xtrails/api';
|
|
3
|
+
import { Call, ChainIdentifier, ActionItem } from './types.js';
|
|
4
|
+
export type ResolveActionsToCallsParams = {
|
|
5
|
+
actions: ActionItem[];
|
|
6
|
+
destinationChain: ChainIdentifier;
|
|
7
|
+
userWalletAddress: `0x${string}`;
|
|
8
|
+
trailsClient: TrailsApi;
|
|
9
|
+
publicClient: PublicClient | null;
|
|
10
|
+
abortSignal?: AbortSignal;
|
|
11
|
+
};
|
|
12
|
+
export declare function resolveActionsToCalls(params: ResolveActionsToCallsParams): Promise<Call[]>;
|
|
13
|
+
//# sourceMappingURL=resolveActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveActions.d.ts","sourceRoot":"","sources":["../../src/actions/resolveActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAEV,IAAI,EACJ,eAAe,EAEf,UAAU,EAMX,MAAM,YAAY,CAAA;AAianB,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,gBAAgB,EAAE,eAAe,CAAA;IACjC,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAA;IAChC,YAAY,EAAE,SAAS,CAAA;IACvB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAMD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,IAAI,EAAE,CAAC,CAoMjB"}
|