0xtrails 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ccip-Cg9-lJ6K.js → ccip-CT_An6eM.js} +39 -39
- package/dist/chains.d.ts +4 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/customTokens.d.ts.map +1 -1
- package/dist/error.d.ts +1 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/gasless.d.ts +1 -2
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-DEojZg7b.js → index-RfqL5Foz.js} +56672 -43550
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +385 -333
- package/dist/intents.d.ts +8 -2
- package/dist/intents.d.ts.map +1 -1
- package/dist/keyMachineClient.d.ts +9 -0
- package/dist/keyMachineClient.d.ts.map +1 -0
- package/dist/keymachine/index.d.ts +14 -0
- package/dist/keymachine/index.d.ts.map +1 -0
- package/dist/keymachine/key-machine.gen.d.ts +461 -0
- package/dist/keymachine/key-machine.gen.d.ts.map +1 -0
- package/dist/onramp/MeshConnectFlow.d.ts +18 -0
- package/dist/onramp/MeshConnectFlow.d.ts.map +1 -0
- package/dist/onramp/MeshConnectIframe.d.ts +13 -0
- package/dist/onramp/MeshConnectIframe.d.ts.map +1 -0
- package/dist/onramp/SendFromExchangeButton.d.ts +16 -0
- package/dist/onramp/SendFromExchangeButton.d.ts.map +1 -0
- package/dist/onramp/TrailsOnRampProvider.d.ts +31 -0
- package/dist/onramp/TrailsOnRampProvider.d.ts.map +1 -0
- package/dist/onramp/index.d.ts +13 -0
- package/dist/onramp/index.d.ts.map +1 -0
- package/dist/onramp/meshconnect.d.ts +30 -0
- package/dist/onramp/meshconnect.d.ts.map +1 -0
- package/dist/onramp/trailsOnramp.d.ts +24 -0
- package/dist/onramp/trailsOnramp.d.ts.map +1 -0
- package/dist/onramp-client/index.d.ts +3 -3
- package/dist/onramp-client/index.d.ts.map +1 -1
- package/dist/paymasterSend.d.ts.map +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/query/balance.fetchers.d.ts +31 -2
- package/dist/query/balance.fetchers.d.ts.map +1 -1
- package/dist/query/balance.hooks.d.ts +21 -2
- package/dist/query/balance.hooks.d.ts.map +1 -1
- package/dist/query/balance.queries.d.ts +18 -1
- package/dist/query/balance.queries.d.ts.map +1 -1
- package/dist/query/chains.queries.d.ts.map +1 -1
- package/dist/query/meld.fetchers.d.ts +1 -1
- package/dist/query/meld.fetchers.d.ts.map +1 -1
- package/dist/query/meld.hooks.d.ts +3 -3
- package/dist/query/meld.hooks.d.ts.map +1 -1
- package/dist/query/meld.queries.d.ts +1 -1
- package/dist/query/meld.queries.d.ts.map +1 -1
- package/dist/query/price.fetchers.d.ts +15 -0
- package/dist/query/price.fetchers.d.ts.map +1 -0
- package/dist/query/price.hooks.d.ts +352 -0
- package/dist/query/price.hooks.d.ts.map +1 -0
- package/dist/query/price.queries.d.ts +34 -0
- package/dist/query/price.queries.d.ts.map +1 -0
- package/dist/query/tokenList.queries.d.ts +54 -0
- package/dist/query/tokenList.queries.d.ts.map +1 -0
- package/dist/recover.d.ts +6 -4
- package/dist/recover.d.ts.map +1 -1
- package/dist/tokens.d.ts +13 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +2 -2
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +2 -2
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
- package/dist/transactionIntent/helpers/transactionStateHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +1 -1
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactions.d.ts +4 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/umd/trails.min.js +291 -202
- package/dist/utils/format.d.ts +7 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/walletUtils.d.ts +2 -1
- package/dist/walletUtils.d.ts.map +1 -1
- package/dist/wallets.d.ts +13 -54
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/DirectTransfer.d.ts +1 -1
- package/dist/widget/components/DirectTransfer.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/ExecutionStatusBadge.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/HighPriceImpactBlock.d.ts +7 -0
- package/dist/widget/components/HighPriceImpactBlock.d.ts.map +1 -0
- package/dist/widget/components/MeldHistory.d.ts.map +1 -1
- package/dist/widget/components/MeshExchangeSelection.d.ts +11 -0
- package/dist/widget/components/MeshExchangeSelection.d.ts.map +1 -0
- package/dist/widget/components/OnrampHistoryRow.d.ts +1 -1
- package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts.map +1 -1
- package/dist/widget/components/RefundWarning.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TransactionHistoryItem.d.ts +2 -0
- package/dist/widget/components/TransactionHistoryItem.d.ts.map +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts +1 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WalletImage.d.ts.map +1 -1
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/components/Withdraw.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useAddressWalletIcon.d.ts.map +1 -1
- package/dist/widget/hooks/useCombinedHistory.d.ts +6 -5
- package/dist/widget/hooks/useCombinedHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useCustomTokenSearch.d.ts +6 -1
- package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultDestinationToken.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultOriginToken.d.ts.map +1 -1
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts +1 -1
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +1 -1
- package/dist/widget/hooks/useGetIntent.d.ts +3 -2
- package/dist/widget/hooks/useGetIntent.d.ts.map +1 -1
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts +1 -1
- package/dist/widget/hooks/useIntentReceiptBalances.d.ts.map +1 -1
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts +3 -2
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useMeldTransactionHistory.d.ts +1 -1
- package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useMeldTransactionStatus.d.ts +1 -1
- package/dist/widget/hooks/useMeldTransactionStatus.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampQuote.d.ts +1 -1
- package/dist/widget/hooks/useOnRampQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampTransactionStatus.d.ts +1 -1
- package/dist/widget/hooks/useOnRampTransactionStatus.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +2 -2
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFundMethod.d.ts +7 -0
- package/dist/widget/hooks/useSelectedFundMethod.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +0 -1
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +7 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useViewManager.d.ts +1 -1
- package/dist/widget/hooks/useViewManager.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts +2 -0
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/utils/createWagmiConfig.d.ts +2 -2
- package/dist/widget/utils/createWagmiConfig.d.ts.map +1 -1
- package/dist/widget/utils/fundMethodSwitchState.d.ts +1 -0
- package/dist/widget/utils/fundMethodSwitchState.d.ts.map +1 -1
- package/dist/widget/utils/historyFilters.d.ts +13 -0
- package/dist/widget/utils/historyFilters.d.ts.map +1 -0
- package/dist/widget/utils/meldProviderUtils.d.ts +1 -1
- package/dist/widget/utils/meldProviderUtils.d.ts.map +1 -1
- package/dist/widget/utils/meshSupportedTokens.d.ts +4 -0
- package/dist/widget/utils/meshSupportedTokens.d.ts.map +1 -0
- package/dist/widget/utils/onrampConfig.d.ts +11 -0
- package/dist/widget/utils/onrampConfig.d.ts.map +1 -0
- package/dist/widget/utils/statusLabel.d.ts +2 -0
- package/dist/widget/utils/statusLabel.d.ts.map +1 -0
- package/dist/widget/utils/trailsOnrampConfig.d.ts +18 -0
- package/dist/widget/utils/trailsOnrampConfig.d.ts.map +1 -0
- package/dist/widget/widget.d.ts +24 -8
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +9 -7
- package/src/chains.ts +26 -9
- package/src/constants.ts +2 -0
- package/src/customTokens.ts +22 -7
- package/src/error.ts +7 -0
- package/src/gasless.ts +5 -2
- package/src/index.ts +8 -5
- package/src/intents.ts +56 -60
- package/src/keyMachineClient.ts +29 -0
- package/src/keymachine/index.ts +175 -0
- package/src/keymachine/key-machine.gen.ts +993 -0
- package/src/onramp/MeshConnectFlow.tsx +86 -0
- package/src/onramp/MeshConnectIframe.tsx +661 -0
- package/src/onramp/SendFromExchangeButton.tsx +81 -0
- package/src/onramp/TrailsOnRampProvider.tsx +59 -0
- package/src/onramp/index.ts +31 -0
- package/src/onramp/meshconnect.ts +277 -0
- package/src/onramp/trailsOnramp.tsx +130 -0
- package/src/onramp-client/index.ts +4 -6
- package/src/paymasterSend.ts +0 -5
- package/src/prepareSend.ts +45 -44
- package/src/query/balance.fetchers.ts +172 -17
- package/src/query/balance.hooks.ts +69 -6
- package/src/query/balance.queries.ts +63 -0
- package/src/query/chains.queries.ts +1 -6
- package/src/query/meld.fetchers.ts +1 -1
- package/src/query/meld.hooks.ts +1 -1
- package/src/query/meld.queries.ts +1 -1
- package/src/query/price.fetchers.ts +53 -0
- package/src/query/price.hooks.ts +46 -0
- package/src/query/price.queries.ts +364 -0
- package/src/query/tokenList.queries.ts +118 -0
- package/src/recover.ts +89 -26
- package/src/tokens.ts +108 -26
- package/src/transactionIntent/deposits/depositOrchestrator.ts +11 -11
- package/src/transactionIntent/deposits/gaslessDeposit.ts +38 -39
- package/src/transactionIntent/deposits/standardDeposit.ts +5 -30
- package/src/transactionIntent/handlers/intentHandler.ts +29 -12
- package/src/transactionIntent/helpers/transactionStateHelpers.ts +5 -2
- package/src/transactionIntent/quote/normalizeQuote.ts +11 -5
- package/src/transactionIntent/types.ts +1 -1
- package/src/transactions.ts +5 -1
- package/src/utils/format.ts +85 -1
- package/src/walletUtils.ts +2 -1
- package/src/wallets.ts +184 -380
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +134 -109
- package/src/widget/components/ClassicSwap.tsx +26 -24
- package/src/widget/components/ConnectWallet.tsx +4 -2
- package/src/widget/components/ConnectedWallets.tsx +2 -5
- package/src/widget/components/DirectTransfer.tsx +5 -2
- package/src/widget/components/EarnPools.tsx +1 -2
- package/src/widget/components/ExecutionStatusBadge.tsx +10 -4
- package/src/widget/components/Fund.tsx +169 -110
- package/src/widget/components/FundMethods.tsx +5 -9
- package/src/widget/components/HighPriceImpactBlock.tsx +44 -0
- package/src/widget/components/MeldHistory.tsx +4 -28
- package/src/widget/components/MeshExchangeSelection.tsx +218 -0
- package/src/widget/components/OnrampHistoryRow.tsx +3 -27
- package/src/widget/components/OnrampProviderConfirmation.tsx +0 -25
- package/src/widget/components/Pay.tsx +20 -36
- package/src/widget/components/PoolDeposit.tsx +14 -24
- package/src/widget/components/PoolWithdraw.tsx +1 -63
- package/src/widget/components/QRCodeWalletSelect.tsx +5 -2
- package/src/widget/components/QuoteDetails.tsx +113 -106
- package/src/widget/components/Receipt.tsx +0 -11
- package/src/widget/components/Recipients.tsx +2 -1
- package/src/widget/components/RefundWarning.tsx +5 -10
- package/src/widget/components/ThemeProvider.tsx +4 -4
- package/src/widget/components/TokenSelector.tsx +85 -16
- package/src/widget/components/TransactionDetails.tsx +46 -0
- package/src/widget/components/TransactionHistoryItem.tsx +14 -23
- package/src/widget/components/TransferPendingVertical.tsx +17 -11
- package/src/widget/components/WaasFeeOptions.tsx +4 -42
- package/src/widget/components/WalletConnect.tsx +2 -5
- package/src/widget/components/WalletImage.tsx +6 -18
- package/src/widget/components/WalletList.tsx +1 -1
- package/src/widget/components/Withdraw.tsx +22 -23
- package/src/widget/hooks/useAddressWalletIcon.ts +2 -1
- package/src/widget/hooks/useAmountUsd.ts +1 -1
- package/src/widget/hooks/useCombinedHistory.ts +37 -93
- package/src/widget/hooks/useCustomTokenSearch.tsx +63 -33
- package/src/widget/hooks/useDefaultDestinationToken.tsx +2 -5
- package/src/widget/hooks/useDefaultOriginToken.tsx +2 -5
- package/src/widget/hooks/useFiatOnRampCurrencies.ts +1 -1
- package/src/widget/hooks/useGetIntent.ts +5 -4
- package/src/widget/hooks/useIntentReceiptBalances.ts +3 -3
- package/src/widget/hooks/useIntentTransactionHistory.ts +24 -47
- package/src/widget/hooks/useMeldTransactionHistory.ts +4 -2
- package/src/widget/hooks/useMeldTransactionStatus.ts +13 -11
- package/src/widget/hooks/useOnRampQuote.ts +3 -3
- package/src/widget/hooks/useOnRampTransactionStatus.ts +8 -6
- package/src/widget/hooks/useQuote.ts +56 -48
- package/src/widget/hooks/useSelectedFundMethod.tsx +14 -1
- package/src/widget/hooks/useSendForm.ts +52 -31
- package/src/widget/hooks/useTokenList.ts +209 -140
- package/src/widget/hooks/useTrailsSendTransaction.ts +1 -1
- package/src/widget/hooks/useViewManager.tsx +1 -0
- package/src/widget/providers/TrailsProvider.tsx +5 -0
- package/src/widget/styles.ts +1 -1
- package/src/widget/utils/createWagmiConfig.ts +7 -2
- package/src/widget/utils/fundMethodSwitchState.ts +2 -0
- package/src/widget/utils/historyFilters.ts +157 -0
- package/src/widget/utils/meldProviderUtils.ts +8 -2
- package/src/widget/utils/meshSupportedTokens.ts +28 -0
- package/src/widget/utils/onrampConfig.ts +15 -0
- package/src/widget/utils/statusLabel.ts +3 -0
- package/src/widget/utils/trailsOnrampConfig.ts +39 -0
- package/src/widget/widget.tsx +235 -185
- package/dist/onramp-client/trails-onramp.gen.d.ts +0 -570
- package/dist/onramp-client/trails-onramp.gen.d.ts.map +0 -1
- package/dist/prices.d.ts +0 -34
- package/dist/prices.d.ts.map +0 -1
- package/dist/useGasEstimation.d.ts +0 -34
- package/dist/useGasEstimation.d.ts.map +0 -1
- package/dist/widget/hooks/useCustomTokenFetch.d.ts +0 -19
- package/dist/widget/hooks/useCustomTokenFetch.d.ts.map +0 -1
- package/dist/widget/hooks/useTokenWithFreshBalance.d.ts +0 -18
- package/dist/widget/hooks/useTokenWithFreshBalance.d.ts.map +0 -1
- package/src/onramp-client/trails-onramp.gen.ts +0 -1320
- package/src/prices.ts +0 -528
- package/src/useGasEstimation.ts +0 -147
- package/src/widget/assets/Binance_Icon_Logo.svg +0 -14
- package/src/widget/assets/Bitfinex_Icon_Logo.svg +0 -5
- package/src/widget/assets/Coinbase_Icon_Logo.svg +0 -1
- package/src/widget/assets/WalletConnect-logo-blue-bg.svg +0 -11
- package/src/widget/assets/sequence-logo.svg +0 -15
- package/src/widget/hooks/useCustomTokenFetch.tsx +0 -74
- package/src/widget/hooks/useTokenWithFreshBalance.ts +0 -246
package/dist/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { u as
|
|
3
|
-
import { I as
|
|
4
|
-
import { useQueryClient as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import { useWalletClient as
|
|
7
|
-
import { zeroAddress as
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { u as we, a as Re, b as Pe, c as Ue, d as He, e as Oe, f as Me, l as m, g as b, h as G, i as oe, j as F, k as X, T as N, m as re, n as ie, o as Ne, p as De, q as L, r as Be, C as be, A as Fe, s as Le, t as We } from "./index-RfqL5Foz.js";
|
|
3
|
+
import { I as ct, M as dt, v as lt, w as ut, S as mt, x as ft, y as gt, z as Tt, B as ht, D as kt, E as At, F as Ct, G as It, H as Et, U as St, W as yt, J as pt, K as xt, L as wt, N as Rt, O as Pt, P as Ut, Q as Ht, R as Ot, V as Mt, X as Nt, Y as Dt, Z as Bt, _ as bt, $ as Ft, a0 as Lt, a1 as Wt, a2 as Qt, a3 as qt, a4 as _t, a5 as jt, a6 as Kt, a7 as vt, a8 as Vt, a9 as Gt, aa as Xt, ab as Yt, ac as $t, ad as zt, ae as Jt, af as Zt, ag as en, ah as tn, ai as nn, aj as sn, ak as an, al as on, am as rn, an as cn, ao as dn, ap as ln, aq as un, ar as mn, as as fn, at as gn, au as Tn, av as hn, aw as kn, ax as An, ay as Cn, az as In, aA as En, aB as Sn, aC as yn, aD as pn, aE as xn, aF as wn, aG as Rn, aH as Pn, aI as Un, aJ as Hn, aK as On, aL as Mn, aM as Nn, aN as Dn, aO as Bn, aP as bn, aQ as Fn, aR as Ln, aS as Wn, aT as Qn, aU as qn, aV as _n, aW as jn, aX as Kn, aY as vn, aZ as Vn, a_ as Gn, a$ as Xn, b0 as Yn, b1 as $n, b2 as zn, b3 as Jn, b4 as Zn, b5 as es, b6 as ts, b7 as ns, b8 as ss, b9 as as, ba as os, bb as rs, bc as is, bd as cs, be as ds, bf as ls, bg as us, bh as ms } from "./index-RfqL5Foz.js";
|
|
4
|
+
import { useQueryClient as Qe, useMutation as qe } from "@tanstack/react-query";
|
|
5
|
+
import { useRef as _e, useCallback as W } from "react";
|
|
6
|
+
import { useWalletClient as je, useAccount as Ke, useChainId as ve } from "wagmi";
|
|
7
|
+
import { zeroAddress as x, erc20Abi as Ve } from "viem";
|
|
8
|
+
import { jsxs as w, Fragment as ce, jsx as E } from "react/jsx-runtime";
|
|
9
|
+
function st(o) {
|
|
10
|
+
const { data: f } = je(), { chainId: y } = Ke(), R = ve(), P = we(), { trailsApiKey: de, sequenceIndexerUrl: le, sequenceMetadataUrl: ue } = Re(), U = Qe(), {
|
|
10
11
|
openModal: Y,
|
|
11
|
-
setPendingSelection:
|
|
12
|
+
setPendingSelection: me,
|
|
12
13
|
setHostTransactionState: $,
|
|
13
|
-
setHostTransactionQuote:
|
|
14
|
-
setHostTransactionStates:
|
|
15
|
-
setHostTransactionTimestamp:
|
|
14
|
+
setHostTransactionQuote: Q,
|
|
15
|
+
setHostTransactionStates: q,
|
|
16
|
+
setHostTransactionTimestamp: _,
|
|
16
17
|
hostTransactionState: D,
|
|
17
|
-
setReceiptActionButtonText:
|
|
18
|
-
setOnReceiptAction:
|
|
18
|
+
setReceiptActionButtonText: fe,
|
|
19
|
+
setOnReceiptAction: ge,
|
|
19
20
|
retryTransactionRef: Te,
|
|
20
|
-
repeatTransactionRef:
|
|
21
|
-
setLastOriginSelection:
|
|
22
|
-
} =
|
|
21
|
+
repeatTransactionRef: he,
|
|
22
|
+
setLastOriginSelection: ke
|
|
23
|
+
} = Pe(), j = Ue(), { supportedTokens: H } = He(), Ae = Oe(), Ce = Me(), B = _e(null), g = W(
|
|
23
24
|
(e) => {
|
|
24
25
|
$((n) => ({
|
|
25
26
|
status: e.status ?? n.status,
|
|
@@ -31,330 +32,330 @@ function $e(i) {
|
|
|
31
32
|
},
|
|
32
33
|
[$]
|
|
33
34
|
), z = async (e, n, s) => {
|
|
34
|
-
if (
|
|
35
|
+
if (m.console.log(
|
|
35
36
|
"[trails-sdk] [useTrailsSendTransaction] Executing transaction",
|
|
36
37
|
{ variables: e, originSelection: n }
|
|
37
|
-
), !
|
|
38
|
+
), !f || !f.account)
|
|
38
39
|
throw new Error(
|
|
39
40
|
"Wallet client not available. Please connect your wallet."
|
|
40
41
|
);
|
|
41
42
|
if (!e.to)
|
|
42
43
|
throw new Error("Transaction 'to' address is required.");
|
|
43
|
-
let
|
|
44
|
+
let r, a, T;
|
|
44
45
|
if (n)
|
|
45
|
-
|
|
46
|
+
r = n.fromTokenAddress, a = n.fromChainId, T = n.fromAmount;
|
|
46
47
|
else if (e.fromTokenAddress && e.fromChainId && e.fromAmount)
|
|
47
|
-
|
|
48
|
+
r = e.fromTokenAddress, a = e.fromChainId, T = e.fromAmount;
|
|
48
49
|
else if (e.to && e.value !== void 0) {
|
|
49
|
-
const t =
|
|
50
|
+
const t = y || R;
|
|
50
51
|
if (!t)
|
|
51
52
|
throw new Error("Chain ID not available. Please connect your wallet.");
|
|
52
|
-
|
|
53
|
+
a = t, r = x, T = e.value.toString();
|
|
53
54
|
} else
|
|
54
55
|
throw new Error(
|
|
55
56
|
"Origin token parameters are required. Please provide 'value' (native token), or 'fromTokenAddress'/'fromChainId'/'fromAmount' (ERC20 token), or select via modal."
|
|
56
57
|
);
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
58
|
+
const C = y || R;
|
|
59
|
+
if (!C)
|
|
59
60
|
throw new Error("Chain ID not available. Please connect your wallet.");
|
|
60
|
-
let
|
|
61
|
+
let A, h, i, k;
|
|
61
62
|
if (e.tokenAddress && e.tokenAmount)
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
A = e.tokenAddress, h = b(
|
|
64
|
+
H,
|
|
64
65
|
e.tokenAddress
|
|
65
|
-
)?.chainId ??
|
|
66
|
+
)?.chainId ?? C, i = e.tokenAmount, k = e.to;
|
|
66
67
|
else if (e.to && e.value !== void 0)
|
|
67
|
-
|
|
68
|
+
A = x, h = C, i = e.value.toString(), k = e.to;
|
|
68
69
|
else
|
|
69
70
|
throw new Error(
|
|
70
71
|
"Either 'value' or 'tokenAddress'/'tokenAmount' must be provided."
|
|
71
72
|
);
|
|
72
|
-
const u = e.tokenAddress && e.tokenAmount ?
|
|
73
|
-
if (u ===
|
|
73
|
+
const u = e.tokenAddress && e.tokenAmount ? N.EXACT_OUTPUT : N.EXACT_INPUT;
|
|
74
|
+
if (u === N.EXACT_INPUT && !T)
|
|
74
75
|
throw new Error(
|
|
75
76
|
"Origin amount is required for this transaction. Please provide 'value' or 'fromAmount'."
|
|
76
77
|
);
|
|
77
|
-
const
|
|
78
|
+
const p = u === N.EXACT_OUTPUT ? i : T;
|
|
78
79
|
let d = [];
|
|
79
80
|
try {
|
|
80
|
-
d = (await
|
|
81
|
+
d = (await U.ensureQueryData(
|
|
81
82
|
G.withPrices(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
f.account.address,
|
|
84
|
+
j,
|
|
85
|
+
P
|
|
85
86
|
)
|
|
86
87
|
)).balances;
|
|
87
88
|
} catch (t) {
|
|
88
|
-
|
|
89
|
+
m.console.warn(
|
|
89
90
|
"[trails-sdk] [useTrailsSendTransaction] Error fetching balances, proceeding with zero balance",
|
|
90
91
|
t
|
|
91
92
|
), d = [];
|
|
92
93
|
}
|
|
93
94
|
const J = d.find(
|
|
94
|
-
(t) => t.chainId ===
|
|
95
|
+
(t) => t.chainId === a && (re(t.contractAddress, r) || !t.contractAddress && r === x)
|
|
95
96
|
)?.balance ?? "0";
|
|
96
|
-
let
|
|
97
|
+
let Z = 0;
|
|
97
98
|
try {
|
|
98
|
-
const c =
|
|
99
|
-
c && (
|
|
99
|
+
const c = ie(a)?.nativeCurrency?.symbol ?? "";
|
|
100
|
+
c && (Z = (await Ne(P, {
|
|
100
101
|
tokenSymbol: c,
|
|
101
|
-
tokenAddress:
|
|
102
|
-
chainId:
|
|
102
|
+
tokenAddress: x,
|
|
103
|
+
chainId: a
|
|
103
104
|
}))?.priceUsd ?? 0);
|
|
104
105
|
} catch (t) {
|
|
105
|
-
|
|
106
|
+
m.console.warn(
|
|
106
107
|
"[trails-sdk] [useTrailsSendTransaction] Error getting native token price",
|
|
107
108
|
t
|
|
108
109
|
);
|
|
109
110
|
}
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
), { getChainRpcClient: V } = await import("./index-
|
|
111
|
+
const ee = b(
|
|
112
|
+
H,
|
|
113
|
+
r,
|
|
114
|
+
a
|
|
115
|
+
), te = b(
|
|
116
|
+
H,
|
|
117
|
+
A,
|
|
118
|
+
h
|
|
119
|
+
), { getChainRpcClient: V } = await import("./index-RfqL5Foz.js").then((t) => t.bG), ne = V(a), se = V(h), ae = async (t, c) => {
|
|
119
120
|
try {
|
|
120
|
-
const
|
|
121
|
-
return
|
|
121
|
+
const S = c === a ? ne : c === h ? se : V(c);
|
|
122
|
+
return S ? re(t, x) ? ie(c)?.nativeCurrency.decimals ?? 18 : await S.readContract({
|
|
122
123
|
address: t,
|
|
123
|
-
abi:
|
|
124
|
+
abi: Ve,
|
|
124
125
|
functionName: "decimals"
|
|
125
126
|
}) : null;
|
|
126
|
-
} catch (
|
|
127
|
-
return
|
|
127
|
+
} catch (S) {
|
|
128
|
+
return m.console.error(
|
|
128
129
|
`[trails-sdk] Error fetching decimals on-chain for token ${t} on chain ${c}:`,
|
|
129
|
-
|
|
130
|
+
S
|
|
130
131
|
), null;
|
|
131
132
|
}
|
|
132
133
|
};
|
|
133
|
-
let
|
|
134
|
-
if (!
|
|
135
|
-
const t = await
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
let O = ee?.decimals;
|
|
135
|
+
if (!O && r) {
|
|
136
|
+
const t = await ae(
|
|
137
|
+
r,
|
|
138
|
+
a
|
|
138
139
|
);
|
|
139
|
-
t !== null && (
|
|
140
|
+
t !== null && (O = t);
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
-
let
|
|
143
|
-
if (!
|
|
144
|
-
const t = await
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
O || (O = 18);
|
|
143
|
+
let M = te?.decimals;
|
|
144
|
+
if (!M && A) {
|
|
145
|
+
const t = await ae(
|
|
146
|
+
A,
|
|
147
|
+
h
|
|
147
148
|
);
|
|
148
|
-
t !== null && (
|
|
149
|
+
t !== null && (M = t);
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
s?.trackInWidget &&
|
|
153
|
-
}, { send:
|
|
154
|
-
queryClient:
|
|
155
|
-
account:
|
|
156
|
-
originTokenAddress:
|
|
157
|
-
originChainId:
|
|
151
|
+
M || (M = 18);
|
|
152
|
+
const Ee = te?.symbol ?? "", Se = ee?.symbol ?? "", ye = (t) => {
|
|
153
|
+
s?.trackInWidget && q(t), o?.onStatusUpdate?.(t);
|
|
154
|
+
}, { send: pe, quote: xe } = await De({
|
|
155
|
+
queryClient: U,
|
|
156
|
+
account: f.account,
|
|
157
|
+
originTokenAddress: r,
|
|
158
|
+
originChainId: a,
|
|
158
159
|
originTokenBalance: J,
|
|
159
|
-
destinationChainId:
|
|
160
|
+
destinationChainId: h,
|
|
160
161
|
recipient: k,
|
|
161
|
-
destinationTokenAddress:
|
|
162
|
-
swapAmount:
|
|
162
|
+
destinationTokenAddress: A,
|
|
163
|
+
swapAmount: p,
|
|
163
164
|
tradeType: u,
|
|
164
|
-
originTokenSymbol:
|
|
165
|
-
destinationTokenSymbol:
|
|
166
|
-
client:
|
|
167
|
-
trailsClient:
|
|
165
|
+
originTokenSymbol: Se,
|
|
166
|
+
destinationTokenSymbol: Ee,
|
|
167
|
+
client: f,
|
|
168
|
+
trailsClient: P,
|
|
168
169
|
destinationCalldata: e.data ? e.data.toString() : void 0,
|
|
169
|
-
onTransactionStateChange:
|
|
170
|
-
sourceTokenDecimals:
|
|
171
|
-
destinationTokenDecimals:
|
|
172
|
-
paymasterUrl:
|
|
173
|
-
slippageTolerance:
|
|
174
|
-
originNativeTokenPriceUsd:
|
|
175
|
-
swapProvider:
|
|
176
|
-
bridgeProvider:
|
|
177
|
-
commitIntentFn: (t) =>
|
|
178
|
-
executeIntentFn:
|
|
179
|
-
checkoutOnHandlers:
|
|
180
|
-
sequenceIndexerUrl:
|
|
181
|
-
sequenceMetadataUrl:
|
|
182
|
-
sequenceProjectAccessKey:
|
|
183
|
-
originPublicClient:
|
|
184
|
-
destinationPublicClient:
|
|
185
|
-
isSmartWallet:
|
|
186
|
-
mode:
|
|
170
|
+
onTransactionStateChange: ye,
|
|
171
|
+
sourceTokenDecimals: O,
|
|
172
|
+
destinationTokenDecimals: M,
|
|
173
|
+
paymasterUrl: o?.paymasterUrl,
|
|
174
|
+
slippageTolerance: o?.slippageTolerance?.toString(),
|
|
175
|
+
originNativeTokenPriceUsd: Z,
|
|
176
|
+
swapProvider: o?.swapProvider,
|
|
177
|
+
bridgeProvider: o?.bridgeProvider,
|
|
178
|
+
commitIntentFn: (t) => Ae.mutateAsync(t),
|
|
179
|
+
executeIntentFn: Ce.mutateAsync,
|
|
180
|
+
checkoutOnHandlers: o?.checkoutOnHandlers,
|
|
181
|
+
sequenceIndexerUrl: le,
|
|
182
|
+
sequenceMetadataUrl: ue,
|
|
183
|
+
sequenceProjectAccessKey: de,
|
|
184
|
+
originPublicClient: ne ?? void 0,
|
|
185
|
+
destinationPublicClient: se ?? void 0,
|
|
186
|
+
isSmartWallet: o?.isSmartWallet ?? void 0,
|
|
187
|
+
mode: o?.mode ?? void 0
|
|
187
188
|
});
|
|
188
|
-
s?.trackInWidget && (
|
|
189
|
+
s?.trackInWidget && (Q(xe ?? null), D.details || g({
|
|
189
190
|
details: {
|
|
190
191
|
to: k,
|
|
191
|
-
tokenAddress:
|
|
192
|
-
tokenAmount: u ===
|
|
193
|
-
toChainId:
|
|
192
|
+
tokenAddress: A,
|
|
193
|
+
tokenAmount: u === N.EXACT_OUTPUT ? i : void 0,
|
|
194
|
+
toChainId: h,
|
|
194
195
|
data: e.data
|
|
195
196
|
}
|
|
196
|
-
}), (!D.status || D.status === "idle") &&
|
|
197
|
+
}), (!D.status || D.status === "idle") && _(Date.now()));
|
|
197
198
|
try {
|
|
198
|
-
s?.trackInWidget &&
|
|
199
|
+
s?.trackInWidget && g({ retryEnabled: !1 });
|
|
199
200
|
const {
|
|
200
201
|
depositUserTxnReceipt: t,
|
|
201
202
|
destinationIntentTransaction: c,
|
|
202
|
-
totalCompletionSeconds:
|
|
203
|
-
} = await
|
|
203
|
+
totalCompletionSeconds: S
|
|
204
|
+
} = await pe({
|
|
204
205
|
selectedFeeOption: null,
|
|
205
206
|
// Transition to "pending" when wallet signature is complete
|
|
206
207
|
onOriginSend: () => {
|
|
207
|
-
s?.trackInWidget &&
|
|
208
|
+
s?.trackInWidget && g({ status: "pending", error: null });
|
|
208
209
|
}
|
|
209
210
|
});
|
|
210
|
-
return s?.trackInWidget &&
|
|
211
|
+
return s?.trackInWidget && g({
|
|
211
212
|
status: "success",
|
|
212
213
|
result: {
|
|
213
214
|
originTxHash: t?.transactionHash,
|
|
214
|
-
originExplorerUrl: t?.transactionHash ?
|
|
215
|
+
originExplorerUrl: t?.transactionHash ? L({
|
|
215
216
|
txHash: t.transactionHash,
|
|
216
|
-
chainId:
|
|
217
|
+
chainId: a
|
|
217
218
|
}) : void 0,
|
|
218
219
|
destinationTxHash: c?.txnHash,
|
|
219
|
-
destinationExplorerUrl: c?.txnHash ?
|
|
220
|
+
destinationExplorerUrl: c?.txnHash ? L({
|
|
220
221
|
txHash: c.txnHash,
|
|
221
|
-
chainId:
|
|
222
|
+
chainId: h
|
|
222
223
|
}) : void 0
|
|
223
224
|
}
|
|
224
225
|
}), {
|
|
225
226
|
originTransaction: {
|
|
226
227
|
transactionHash: t?.transactionHash,
|
|
227
|
-
explorerUrl:
|
|
228
|
+
explorerUrl: L({
|
|
228
229
|
txHash: t?.transactionHash,
|
|
229
|
-
chainId:
|
|
230
|
+
chainId: a
|
|
230
231
|
}),
|
|
231
232
|
receipt: t
|
|
232
233
|
},
|
|
233
234
|
destinationTransaction: {
|
|
234
235
|
transactionHash: c?.txnHash,
|
|
235
|
-
explorerUrl:
|
|
236
|
+
explorerUrl: L({
|
|
236
237
|
txHash: c?.txnHash,
|
|
237
|
-
chainId:
|
|
238
|
+
chainId: h
|
|
238
239
|
}),
|
|
239
240
|
receipt: c
|
|
240
241
|
},
|
|
241
|
-
totalCompletionSeconds:
|
|
242
|
+
totalCompletionSeconds: S
|
|
242
243
|
};
|
|
243
244
|
} catch (t) {
|
|
244
245
|
if (s?.trackInWidget) {
|
|
245
246
|
const c = X(t);
|
|
246
|
-
|
|
247
|
+
g(c ? {
|
|
247
248
|
status: "confirmation",
|
|
248
249
|
error: null,
|
|
249
250
|
retryEnabled: !0
|
|
250
251
|
} : {
|
|
251
252
|
status: "error",
|
|
252
|
-
error:
|
|
253
|
+
error: F(t),
|
|
253
254
|
retryEnabled: !1
|
|
254
255
|
});
|
|
255
256
|
}
|
|
256
257
|
throw t;
|
|
257
258
|
}
|
|
258
|
-
}, l =
|
|
259
|
+
}, l = qe({
|
|
259
260
|
mutationFn: async (e) => {
|
|
260
|
-
|
|
261
|
+
m.console.log(
|
|
261
262
|
"[trails-sdk] [useTrailsSendTransaction] Starting transaction",
|
|
262
263
|
e
|
|
263
|
-
), B.current = e,
|
|
264
|
-
|
|
265
|
-
),
|
|
266
|
-
const n = e.value !== void 0, s = e.fromTokenAddress !== void 0 && e.fromChainId !== void 0,
|
|
267
|
-
let
|
|
268
|
-
if (e.tokenAddress &&
|
|
269
|
-
const
|
|
270
|
-
|
|
264
|
+
), B.current = e, fe(
|
|
265
|
+
o?.receiptActionButtonText ?? "Transact Again"
|
|
266
|
+
), ge(o?.onReceiptAction ?? null);
|
|
267
|
+
const n = e.value !== void 0, s = e.fromTokenAddress !== void 0 && e.fromChainId !== void 0, r = n || s;
|
|
268
|
+
let a;
|
|
269
|
+
if (e.tokenAddress && H) {
|
|
270
|
+
const i = b(
|
|
271
|
+
H,
|
|
271
272
|
e.tokenAddress
|
|
272
273
|
);
|
|
273
|
-
|
|
274
|
+
i && (a = i.chainId);
|
|
274
275
|
}
|
|
275
|
-
|
|
276
|
-
let
|
|
277
|
-
if (
|
|
276
|
+
a || (a = y || R);
|
|
277
|
+
let T = !0, C = !0;
|
|
278
|
+
if (f?.account)
|
|
278
279
|
try {
|
|
279
|
-
if (
|
|
280
|
-
let
|
|
281
|
-
if (e.value !== void 0 ? (
|
|
282
|
-
const { balances:
|
|
280
|
+
if (r) {
|
|
281
|
+
let i, k, u;
|
|
282
|
+
if (e.value !== void 0 ? (i = x, k = y || R || 1, u = e.value.toString()) : e.fromTokenAddress && e.fromChainId && (i = e.fromTokenAddress, k = e.fromChainId, u = e.fromAmount), i && k && u && u !== "0") {
|
|
283
|
+
const { balances: p } = await U.ensureQueryData(
|
|
283
284
|
G.withPrices(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
f.account.address,
|
|
286
|
+
j,
|
|
287
|
+
P
|
|
287
288
|
)
|
|
288
289
|
);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
T = oe(
|
|
291
|
+
p,
|
|
292
|
+
i,
|
|
292
293
|
u,
|
|
293
294
|
k
|
|
294
|
-
),
|
|
295
|
+
), m.console.log(
|
|
295
296
|
"[trails-sdk] [useTrailsSendTransaction] Origin token balance check:",
|
|
296
297
|
{
|
|
297
|
-
tokenAddress:
|
|
298
|
+
tokenAddress: i,
|
|
298
299
|
amount: u,
|
|
299
300
|
chainId: k,
|
|
300
|
-
hasSufficientBalance:
|
|
301
|
+
hasSufficientBalance: T
|
|
301
302
|
}
|
|
302
303
|
);
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
if (
|
|
306
|
-
const
|
|
306
|
+
if (T && e.tokenAddress && e.tokenAmount) {
|
|
307
|
+
const i = await U.ensureQueryData(
|
|
307
308
|
G.withPrices(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
309
|
+
f.account.address,
|
|
310
|
+
j,
|
|
311
|
+
P
|
|
311
312
|
)
|
|
312
313
|
);
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
C = oe(
|
|
315
|
+
i.balances,
|
|
315
316
|
e.tokenAddress,
|
|
316
317
|
e.tokenAmount,
|
|
317
|
-
|
|
318
|
-
),
|
|
318
|
+
a
|
|
319
|
+
), m.console.log(
|
|
319
320
|
"[trails-sdk] [useTrailsSendTransaction] Destination token balance check:",
|
|
320
321
|
{
|
|
321
322
|
tokenAddress: e.tokenAddress,
|
|
322
323
|
tokenAmount: e.tokenAmount,
|
|
323
|
-
chainId:
|
|
324
|
-
hasSufficientBalance:
|
|
324
|
+
chainId: a,
|
|
325
|
+
hasSufficientBalance: C
|
|
325
326
|
}
|
|
326
327
|
);
|
|
327
328
|
}
|
|
328
|
-
} catch (
|
|
329
|
-
|
|
329
|
+
} catch (i) {
|
|
330
|
+
m.console.warn(
|
|
330
331
|
"[trails-sdk] [useTrailsSendTransaction] Error checking balances, defaulting to origin selection:",
|
|
331
|
-
|
|
332
|
-
),
|
|
332
|
+
i
|
|
333
|
+
), T = !1, C = !1;
|
|
333
334
|
}
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
335
|
+
const A = !r || !T || !C;
|
|
336
|
+
if (m.console.log(
|
|
336
337
|
"[trails-sdk] [useTrailsSendTransaction] Origin selection decision:",
|
|
337
338
|
{
|
|
338
|
-
hasOriginParams:
|
|
339
|
-
hasSufficientOriginBalance:
|
|
340
|
-
hasSufficientDestinationTokenBalance:
|
|
341
|
-
needsOriginSelection:
|
|
339
|
+
hasOriginParams: r,
|
|
340
|
+
hasSufficientOriginBalance: T,
|
|
341
|
+
hasSufficientDestinationTokenBalance: C,
|
|
342
|
+
needsOriginSelection: A
|
|
342
343
|
}
|
|
343
|
-
),
|
|
344
|
-
const
|
|
344
|
+
), A) {
|
|
345
|
+
const i = !(e.tokenAddress && e.tokenAmount), k = {
|
|
345
346
|
to: e.to,
|
|
346
347
|
tokenAddress: e.tokenAddress,
|
|
347
348
|
tokenAmount: e.tokenAmount,
|
|
348
|
-
toChainId:
|
|
349
|
+
toChainId: a,
|
|
349
350
|
data: e.data
|
|
350
351
|
};
|
|
351
|
-
return
|
|
352
|
+
return g({
|
|
352
353
|
status: "awaiting-origin",
|
|
353
354
|
details: k,
|
|
354
355
|
error: null,
|
|
355
356
|
result: null
|
|
356
|
-
}),
|
|
357
|
-
|
|
357
|
+
}), Q(null), q([]), _(Date.now()), new Promise((u, p) => {
|
|
358
|
+
me({
|
|
358
359
|
resolve: async (d) => {
|
|
359
360
|
try {
|
|
360
361
|
B.current = {
|
|
@@ -362,75 +363,75 @@ function $e(i) {
|
|
|
362
363
|
fromTokenAddress: d.fromTokenAddress,
|
|
363
364
|
fromChainId: d.fromChainId,
|
|
364
365
|
fromAmount: d.fromAmount
|
|
365
|
-
},
|
|
366
|
+
}, ke({
|
|
366
367
|
tokenAddress: d.fromTokenAddress,
|
|
367
368
|
chainId: d.fromChainId,
|
|
368
369
|
amount: d.fromAmount
|
|
369
|
-
}),
|
|
370
|
-
const
|
|
370
|
+
}), g({ status: "confirmation" });
|
|
371
|
+
const I = await z(e, d, {
|
|
371
372
|
trackInWidget: !0
|
|
372
373
|
});
|
|
373
|
-
u(
|
|
374
|
-
} catch (
|
|
375
|
-
X(
|
|
374
|
+
u(I);
|
|
375
|
+
} catch (I) {
|
|
376
|
+
X(I) || g({
|
|
376
377
|
status: "error",
|
|
377
|
-
error:
|
|
378
|
-
}),
|
|
378
|
+
error: F(I)
|
|
379
|
+
}), p(I);
|
|
379
380
|
}
|
|
380
381
|
},
|
|
381
382
|
reject: (d) => {
|
|
382
|
-
const
|
|
383
|
-
|
|
383
|
+
const I = d instanceof Error ? d : new Error(String(d));
|
|
384
|
+
g({
|
|
384
385
|
status: "error",
|
|
385
|
-
error:
|
|
386
|
-
}),
|
|
386
|
+
error: F(I)
|
|
387
|
+
}), p(I);
|
|
387
388
|
},
|
|
388
|
-
requireAmountInput:
|
|
389
|
+
requireAmountInput: i
|
|
389
390
|
}), setTimeout(() => {
|
|
390
|
-
|
|
391
|
+
m.console.log(
|
|
391
392
|
"[trails-sdk] [useTrailsSendTransaction] Calling openModal()"
|
|
392
393
|
), Y();
|
|
393
394
|
}, 0);
|
|
394
395
|
});
|
|
395
396
|
}
|
|
396
|
-
const
|
|
397
|
+
const h = {
|
|
397
398
|
to: e.to,
|
|
398
399
|
tokenAddress: e.tokenAddress,
|
|
399
400
|
tokenAmount: e.tokenAmount,
|
|
400
|
-
toChainId:
|
|
401
|
+
toChainId: a,
|
|
401
402
|
data: e.data
|
|
402
403
|
};
|
|
403
|
-
return
|
|
404
|
+
return g({
|
|
404
405
|
status: "confirmation",
|
|
405
|
-
details:
|
|
406
|
+
details: h,
|
|
406
407
|
error: null,
|
|
407
408
|
result: null
|
|
408
|
-
}),
|
|
409
|
+
}), Q(null), q([]), _(Date.now()), Y(), z(e, void 0, { trackInWidget: !0 });
|
|
409
410
|
},
|
|
410
411
|
onSuccess: (e, n) => {
|
|
411
|
-
|
|
412
|
+
m.console.log(
|
|
412
413
|
"[trails-sdk] [useTrailsSendTransaction] Transaction successful",
|
|
413
414
|
{ data: e, variables: n }
|
|
414
|
-
),
|
|
415
|
+
), U.invalidateQueries({ queryKey: ["prepareSend"] }), o?.onSuccess?.(e, n);
|
|
415
416
|
},
|
|
416
417
|
onError: (e, n) => {
|
|
417
|
-
|
|
418
|
+
m.console.error(
|
|
418
419
|
"[trails-sdk] [useTrailsSendTransaction] Transaction error",
|
|
419
420
|
{ error: e, variables: n }
|
|
420
421
|
);
|
|
421
|
-
const s =
|
|
422
|
-
D.status !== "idle" && !
|
|
422
|
+
const s = F(e), r = X(e);
|
|
423
|
+
D.status !== "idle" && !r && g({
|
|
423
424
|
status: "error",
|
|
424
425
|
error: s
|
|
425
|
-
}),
|
|
426
|
+
}), o?.onError?.(new Error(s), n);
|
|
426
427
|
},
|
|
427
428
|
onSettled: (e, n, s) => {
|
|
428
|
-
|
|
429
|
+
m.console.log(
|
|
429
430
|
"[trails-sdk] [useTrailsSendTransaction] Transaction settled",
|
|
430
431
|
{ data: e, error: n, variables: s }
|
|
431
|
-
),
|
|
432
|
+
), o?.onSettled?.(e, n, s);
|
|
432
433
|
}
|
|
433
|
-
}), K =
|
|
434
|
+
}), K = W(
|
|
434
435
|
(e, n) => {
|
|
435
436
|
l.mutate(e, {
|
|
436
437
|
onSuccess: (s) => {
|
|
@@ -439,13 +440,13 @@ function $e(i) {
|
|
|
439
440
|
onError: (s) => {
|
|
440
441
|
n?.onError?.(s);
|
|
441
442
|
},
|
|
442
|
-
onSettled: (s,
|
|
443
|
-
n?.onSettled?.(s,
|
|
443
|
+
onSettled: (s, r) => {
|
|
444
|
+
n?.onSettled?.(s, r);
|
|
444
445
|
}
|
|
445
446
|
});
|
|
446
447
|
},
|
|
447
448
|
[l]
|
|
448
|
-
),
|
|
449
|
+
), Ie = W(
|
|
449
450
|
async (e, n) => l.mutateAsync(e, {
|
|
450
451
|
onSuccess: (s) => {
|
|
451
452
|
n?.onSuccess?.(s);
|
|
@@ -453,18 +454,18 @@ function $e(i) {
|
|
|
453
454
|
onError: (s) => {
|
|
454
455
|
n?.onError?.(s);
|
|
455
456
|
},
|
|
456
|
-
onSettled: (s,
|
|
457
|
-
n?.onSettled?.(s,
|
|
457
|
+
onSettled: (s, r) => {
|
|
458
|
+
n?.onSettled?.(s, r);
|
|
458
459
|
}
|
|
459
460
|
}),
|
|
460
461
|
[l]
|
|
461
|
-
),
|
|
462
|
+
), v = W(() => {
|
|
462
463
|
B.current && K(B.current);
|
|
463
464
|
}, [K]);
|
|
464
|
-
return Te.current =
|
|
465
|
+
return Te.current = v, he.current = v, {
|
|
465
466
|
sendTransaction: K,
|
|
466
|
-
sendTransactionAsync:
|
|
467
|
-
retry:
|
|
467
|
+
sendTransactionAsync: Ie,
|
|
468
|
+
retry: v,
|
|
468
469
|
data: l.data,
|
|
469
470
|
error: l.error,
|
|
470
471
|
isPending: l.isPending,
|
|
@@ -476,7 +477,7 @@ function $e(i) {
|
|
|
476
477
|
variables: l.variables
|
|
477
478
|
};
|
|
478
479
|
}
|
|
479
|
-
const
|
|
480
|
+
const Ge = ["JPY", "KRW", "VND", "CLP", "ISK"], Xe = {
|
|
480
481
|
USD: "$",
|
|
481
482
|
EUR: "€",
|
|
482
483
|
GBP: "£",
|
|
@@ -491,123 +492,174 @@ const Qe = ["JPY", "KRW", "VND", "CLP", "ISK"], qe = {
|
|
|
491
492
|
NOK: "kr",
|
|
492
493
|
DKK: "kr"
|
|
493
494
|
};
|
|
494
|
-
function
|
|
495
|
+
function at(o) {
|
|
495
496
|
return {
|
|
496
|
-
decimals:
|
|
497
|
-
symbol:
|
|
497
|
+
decimals: Ge.includes(o) ? 0 : 2,
|
|
498
|
+
symbol: Xe[o] || o
|
|
498
499
|
};
|
|
499
500
|
}
|
|
501
|
+
const ot = ({
|
|
502
|
+
onNavigateToOnramp: o
|
|
503
|
+
}) => {
|
|
504
|
+
const f = Be(), y = f?.config.mesh?.exchanges && f.config.mesh.exchanges.length > 0;
|
|
505
|
+
return We(f?.config) ? y ? o ? /* @__PURE__ */ w(ce, { children: [
|
|
506
|
+
/* @__PURE__ */ E("div", { className: "border-b border-gray-200 dark:border-gray-700" }),
|
|
507
|
+
/* @__PURE__ */ w(
|
|
508
|
+
"button",
|
|
509
|
+
{
|
|
510
|
+
type: "button",
|
|
511
|
+
onClick: o,
|
|
512
|
+
className: "w-full text-left px-3 py-4 text-sm flex items-center justify-between cursor-pointer transition-colors trails-text-primary trails-hover-bg",
|
|
513
|
+
children: [
|
|
514
|
+
/* @__PURE__ */ w("div", { className: "flex items-center gap-3", children: [
|
|
515
|
+
/* @__PURE__ */ E(Fe, { className: "w-4 h-4" }),
|
|
516
|
+
/* @__PURE__ */ E("span", { className: "text-sm font-bold", children: "Send from Exchange" })
|
|
517
|
+
] }),
|
|
518
|
+
/* @__PURE__ */ E(Le, { className: "w-5 h-5 text-gray-400" })
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
] }) : null : /* @__PURE__ */ w(ce, { children: [
|
|
523
|
+
/* @__PURE__ */ E("div", { className: "border-b border-gray-200 dark:border-gray-700" }),
|
|
524
|
+
/* @__PURE__ */ E("div", { className: "px-3 py-4 text-sm", children: /* @__PURE__ */ w("div", { className: "flex items-center gap-3 text-amber-600 dark:text-amber-400", children: [
|
|
525
|
+
/* @__PURE__ */ E(be, { className: "w-4 h-4 flex-shrink-0" }),
|
|
526
|
+
/* @__PURE__ */ w("div", { className: "flex-1", children: [
|
|
527
|
+
/* @__PURE__ */ E("p", { className: "font-medium", children: "Exchange list not configured" }),
|
|
528
|
+
/* @__PURE__ */ E("p", { className: "text-xs mt-1 text-amber-500 dark:text-amber-500", children: "Please configure at least one exchange in the onramp settings." })
|
|
529
|
+
] })
|
|
530
|
+
] }) })
|
|
531
|
+
] }) : null;
|
|
532
|
+
};
|
|
500
533
|
export {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
534
|
+
ct as InsufficientBalanceError,
|
|
535
|
+
dt as MIN_REFETCH_INTERVAL,
|
|
536
|
+
lt as MeshConnectFlow,
|
|
537
|
+
ut as MeshConnectIframe,
|
|
538
|
+
mt as SDK_VERSION,
|
|
539
|
+
ot as SendFromExchangeButton,
|
|
540
|
+
ft as SimpleHeader,
|
|
541
|
+
gt as TRAILS_ROUTER_PLACEHOLDER_AMOUNT,
|
|
542
|
+
N as TradeType,
|
|
543
|
+
Tt as TrailsClient,
|
|
544
|
+
ht as TrailsHookModal,
|
|
545
|
+
kt as TrailsModalProvider,
|
|
546
|
+
At as TrailsOnRampProvider,
|
|
547
|
+
Ct as TrailsOnramp,
|
|
548
|
+
It as TrailsProvider,
|
|
549
|
+
Et as TrailsWidget,
|
|
550
|
+
St as UserRejectionError,
|
|
551
|
+
yt as WidgetFundMethod,
|
|
552
|
+
pt as attemptSwitchChain,
|
|
515
553
|
G as balanceQueries,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
554
|
+
xt as buildRefundTransactionWithSignature,
|
|
555
|
+
wt as calcAmountUsdPrice,
|
|
556
|
+
Rt as calculateOriginAndDestinationIntentAddresses,
|
|
557
|
+
Pt as chainQueries,
|
|
558
|
+
Ut as commitIntent,
|
|
559
|
+
Ht as convertApiTokenInfoToToken,
|
|
560
|
+
Ot as createMeshLinkToken,
|
|
561
|
+
Mt as createModalController,
|
|
562
|
+
Nt as determineRefundCall,
|
|
563
|
+
Dt as fetchCountryCode,
|
|
564
|
+
Bt as fiatQueries,
|
|
565
|
+
bt as formatBalanceFields,
|
|
566
|
+
Ft as formatPriceFields,
|
|
567
|
+
Lt as formatTvl,
|
|
568
|
+
Wt as formatUsdAmountFormatted,
|
|
569
|
+
Qt as formatUsdAmountLocaleDisplay,
|
|
570
|
+
qt as formatUsdFields,
|
|
571
|
+
_t as geoQueries,
|
|
572
|
+
jt as getAccountTotalBalanceUsd,
|
|
573
|
+
Kt as getAccountTransactionHistory,
|
|
574
|
+
vt as getActiveMeshMode,
|
|
575
|
+
Vt as getAllChains,
|
|
576
|
+
Gt as getBinanceIntegrationId,
|
|
577
|
+
Xt as getBitfinexIntegrationId,
|
|
578
|
+
ie as getChainInfo,
|
|
579
|
+
Yt as getChainRpcClient,
|
|
580
|
+
$t as getCoinbaseIntegrationId,
|
|
581
|
+
at as getCurrencyInfo,
|
|
582
|
+
zt as getERC20TransferData,
|
|
583
|
+
Jt as getHasSufficientBalanceToken,
|
|
584
|
+
Zt as getHasSufficientBalanceUsd,
|
|
585
|
+
en as getIntent,
|
|
586
|
+
tn as getIntentConfigurationFromCalls,
|
|
587
|
+
nn as getIsApiError,
|
|
588
|
+
sn as getIsBalanceTooLowError,
|
|
589
|
+
an as getIsInsufficientLiquidityError,
|
|
590
|
+
on as getIsNoAvailableQuoteError,
|
|
591
|
+
rn as getIsQuoteFailedError,
|
|
592
|
+
cn as getIsQuoteInputError,
|
|
593
|
+
dn as getIsQuoteTokenError,
|
|
594
|
+
ln as getIsRateLimitedError,
|
|
595
|
+
un as getIsRequiredAmountNotMetError,
|
|
553
596
|
X as getIsUserRejectionError,
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
597
|
+
mn as getIsWalletAlreadyConnectedError,
|
|
598
|
+
fn as getMeshIntegrationId,
|
|
599
|
+
gn as getMeshIntegrations,
|
|
600
|
+
Tn as getMeshSupportedTokens,
|
|
601
|
+
hn as getMinLogLevel,
|
|
602
|
+
kn as getOnrampClient,
|
|
603
|
+
An as getPrettifiedErrorMessage,
|
|
604
|
+
Cn as getRpcUrl,
|
|
605
|
+
In as getSupportedChains,
|
|
606
|
+
En as getSupportedTokens,
|
|
607
|
+
Ne as getTokenPrice,
|
|
608
|
+
Sn as getTokenPrices,
|
|
609
|
+
yn as getTrailsClient,
|
|
610
|
+
pn as getTrailsOnrampConfig,
|
|
611
|
+
xn as getTxTimeDiff,
|
|
612
|
+
wn as getVersion,
|
|
613
|
+
Rn as invalidateTokenBalancesCache,
|
|
614
|
+
Pn as invalidateTokenPricesCache,
|
|
615
|
+
We as isMeshEnabled,
|
|
616
|
+
Un as isValidInteger,
|
|
617
|
+
Hn as isValidNumeric,
|
|
618
|
+
m as logger,
|
|
619
|
+
On as meldQueries,
|
|
620
|
+
Mn as normalizeNumber,
|
|
621
|
+
Nn as normalizeTrailsOnrampConfig,
|
|
622
|
+
Dn as pollIntentReceipt,
|
|
623
|
+
De as prepareSend,
|
|
624
|
+
Bn as priceQueries,
|
|
625
|
+
bn as quoteIntent,
|
|
626
|
+
Fn as sendOriginTransaction,
|
|
627
|
+
Ln as signPayload,
|
|
628
|
+
Wn as trailsOnramp,
|
|
629
|
+
Qn as useAccountTotalBalanceUsd,
|
|
630
|
+
qn as useAccountTransactionHistory,
|
|
631
|
+
_n as useChainRpcClient,
|
|
632
|
+
Oe as useCommitIntent,
|
|
633
|
+
jn as useCountryCode,
|
|
634
|
+
Kn as useCountryList,
|
|
635
|
+
vn as useExchangeRate,
|
|
636
|
+
Me as useExecuteIntent,
|
|
637
|
+
Vn as useFiatCurrencyList,
|
|
638
|
+
Gn as useGetIntent,
|
|
639
|
+
Xn as useGetTokenImageUrl,
|
|
640
|
+
Yn as useHasSufficientBalanceToken,
|
|
641
|
+
$n as useHasSufficientBalanceUsd,
|
|
642
|
+
Ue as useIndexerGatewayClient,
|
|
643
|
+
zn as useIntentReceiptMonitor,
|
|
644
|
+
Jn as useIntentRecover,
|
|
645
|
+
Zn as useIntentRecoverWithAddress,
|
|
646
|
+
es as useIntentTransactionHistory,
|
|
647
|
+
ts as useMeldPaymentMethods,
|
|
648
|
+
ns as useMeldServiceProviders,
|
|
649
|
+
ss as useOnrampClient,
|
|
650
|
+
as as useQuote,
|
|
651
|
+
os as useSupportedChains,
|
|
652
|
+
He as useSupportedTokens,
|
|
653
|
+
rs as useTokenAddress,
|
|
654
|
+
is as useTokenBalances,
|
|
655
|
+
cs as useTokenBalancesForMultipleAccounts,
|
|
656
|
+
ds as useTokenInfo,
|
|
657
|
+
ls as useTokenList,
|
|
658
|
+
us as useTokenPrice,
|
|
659
|
+
ms as useTokenPrices,
|
|
660
|
+
Re as useTrails,
|
|
661
|
+
we as useTrailsClient,
|
|
662
|
+
Pe as useTrailsModal,
|
|
663
|
+
Be as useTrailsOnRamp,
|
|
664
|
+
st as useTrailsSendTransaction
|
|
613
665
|
};
|