0xtrails 0.12.0 → 0.12.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/analytics.d.ts +65 -50
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-DtfgR432.js → ccip-62W6LwH2.js} +28 -28
- package/dist/chains.d.ts.map +1 -1
- package/dist/error.d.ts +2 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/estimate.d.ts.map +1 -1
- package/dist/fees.d.ts.map +1 -1
- package/dist/{index-CHiCSmCD.js → index-C0QTNYIA.js} +43750 -41806
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +199 -171
- package/dist/localeUtils.d.ts.map +1 -1
- package/dist/meld/components/MeldCountriesList.d.ts +0 -2
- package/dist/meld/components/MeldCountriesList.d.ts.map +1 -1
- package/dist/meld/components/MeldFundMethods.d.ts.map +1 -1
- package/dist/meld/components/MeldTokensList.d.ts.map +1 -1
- package/dist/meld/utils/meld.d.ts +2 -52
- package/dist/meld/utils/meld.d.ts.map +1 -1
- package/dist/poolUtils.d.ts.map +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +1 -2
- package/dist/prices.d.ts.map +1 -1
- package/dist/query/balance.fetchers.d.ts +2 -2
- package/dist/query/balance.fetchers.d.ts.map +1 -1
- package/dist/query/fiat.fetchers.d.ts +11 -0
- package/dist/query/fiat.fetchers.d.ts.map +1 -0
- package/dist/query/fiat.hooks.d.ts +18 -0
- package/dist/query/fiat.hooks.d.ts.map +1 -0
- package/dist/query/fiat.queries.d.ts +24 -0
- package/dist/query/fiat.queries.d.ts.map +1 -0
- package/dist/query/meld.fetchers.d.ts +19 -0
- package/dist/query/meld.fetchers.d.ts.map +1 -0
- package/dist/query/meld.hooks.d.ts +4 -0
- package/dist/query/meld.hooks.d.ts.map +1 -0
- package/dist/query/meld.queries.d.ts +61 -0
- package/dist/query/meld.queries.d.ts.map +1 -0
- package/dist/recover.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +7 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/intentHandler.d.ts +2 -0
- package/dist/transactionIntent/handlers/intentHandler.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +2 -2
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +2 -0
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/utils/balanceChecker.d.ts +3 -1
- package/dist/transactionIntent/utils/balanceChecker.d.ts.map +1 -1
- package/dist/transactions.d.ts +2 -9
- package/dist/transactions.d.ts.map +1 -1
- package/dist/umd/trails.min.js +206 -152
- package/dist/utils/fiat.d.ts +8 -0
- package/dist/utils/fiat.d.ts.map +1 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/passthrough.d.ts +5 -2
- package/dist/utils/passthrough.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +33 -0
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/walletUtils.d.ts +1 -1
- package/dist/walletUtils.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/DepositTracker.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts +2 -0
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.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/HookModalContent.d.ts.map +1 -1
- package/dist/widget/components/MeldForm.d.ts.map +1 -1
- package/dist/widget/components/MeldHistory.d.ts.map +1 -1
- package/dist/widget/components/MeldStepsFlow.d.ts.map +1 -1
- package/dist/widget/components/OFTProgressBar.d.ts +2 -0
- package/dist/widget/components/OFTProgressBar.d.ts.map +1 -1
- package/dist/widget/components/OnRampProviderSelector.d.ts.map +1 -1
- package/dist/widget/components/OnrampHistoryRow.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PercentageMaxButtons.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +2 -0
- package/dist/widget/components/PoolDeposit.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/SlippageToleranceSettings.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -0
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/Withdraw.d.ts.map +1 -1
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
- package/dist/widget/hooks/useCustomTokenSearch.d.ts.map +1 -1
- package/dist/widget/hooks/useDisplayCurrencyPreference.d.ts.map +1 -1
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts +3 -21
- package/dist/widget/hooks/useFiatOnRampCurrencies.d.ts.map +1 -1
- package/dist/widget/hooks/useMeldTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampCountryDefaults.d.ts +0 -18
- package/dist/widget/hooks/useOnRampCountryDefaults.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampPaymentMethods.d.ts +2 -18
- package/dist/widget/hooks/useOnRampPaymentMethods.d.ts.map +1 -1
- package/dist/widget/hooks/useOnRampQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +5 -1
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +3 -1
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenWithFreshBalance.d.ts +3 -2
- package/dist/widget/hooks/useTokenWithFreshBalance.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/types/commonProps.d.ts +2 -0
- package/dist/widget/types/commonProps.d.ts.map +1 -1
- package/dist/widget/utils/transactionFailure.d.ts +20 -0
- package/dist/widget/utils/transactionFailure.d.ts.map +1 -0
- package/dist/widget/widget.d.ts +44 -3
- package/dist/widget/widget.d.ts.map +1 -1
- package/dist/widget/workers/intentExecutionWorker.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/analytics.ts +115 -79
- package/src/chains.ts +0 -1
- package/src/error.ts +11 -0
- package/src/estimate.ts +12 -7
- package/src/fees.ts +0 -1
- package/src/index.ts +11 -0
- package/src/localeUtils.ts +3 -1
- package/src/meld/components/MeldCountriesList.tsx +30 -15
- package/src/meld/components/MeldFundMethods.tsx +8 -4
- package/src/meld/components/MeldTokensList.tsx +90 -2
- package/src/meld/utils/meld.ts +3 -400
- package/src/poolUtils.ts +5 -19
- package/src/prepareSend.ts +32 -5
- package/src/prices.ts +7 -33
- package/src/query/balance.fetchers.ts +128 -168
- package/src/query/fiat.fetchers.ts +33 -0
- package/src/query/fiat.hooks.ts +71 -0
- package/src/query/fiat.queries.ts +67 -0
- package/src/query/meld.fetchers.ts +97 -0
- package/src/query/meld.hooks.ts +18 -0
- package/src/query/meld.queries.ts +184 -0
- package/src/recover.ts +6 -1
- package/src/tokens.ts +31 -6
- package/src/transactionIntent/deposits/depositOrchestrator.ts +2 -0
- package/src/transactionIntent/deposits/gaslessDeposit.ts +9 -2
- package/src/transactionIntent/deposits/standardDeposit.ts +35 -14
- package/src/transactionIntent/handlers/intentHandler.ts +134 -138
- package/src/transactionIntent/quote/normalizeQuote.ts +31 -22
- package/src/transactionIntent/quote/quoteHelpers.ts +24 -7
- package/src/transactionIntent/types.ts +2 -0
- package/src/transactionIntent/utils/balanceChecker.ts +10 -4
- package/src/transactions.ts +22 -13
- package/src/umd.tsx +1 -1
- package/src/utils/fiat.ts +32 -0
- package/src/utils/format.ts +1 -3
- package/src/utils/passthrough.ts +19 -3
- package/src/utils/validation.ts +88 -0
- package/src/utils.ts +2 -1
- package/src/walletUtils.ts +2 -2
- package/src/widget/components/AccountIntentTransactionHistory.tsx +2 -2
- package/src/widget/components/ClassicSwap.tsx +10 -4
- package/src/widget/components/DepositTracker.tsx +2 -5
- package/src/widget/components/Earn.tsx +6 -0
- package/src/widget/components/FeeOption.tsx +15 -8
- package/src/widget/components/Fund.tsx +16 -11
- package/src/widget/components/FundMethods.tsx +255 -192
- package/src/widget/components/HookModalContent.tsx +4 -0
- package/src/widget/components/MeldForm.tsx +44 -42
- package/src/widget/components/MeldHistory.tsx +4 -3
- package/src/widget/components/MeldStepsFlow.tsx +33 -71
- package/src/widget/components/OFTProgressBar.tsx +32 -12
- package/src/widget/components/OnRampProviderSelector.tsx +2 -1
- package/src/widget/components/OnrampHistoryRow.tsx +2 -1
- package/src/widget/components/Pay.tsx +8 -2
- package/src/widget/components/PercentageMaxButtons.tsx +5 -3
- package/src/widget/components/PoolDeposit.tsx +6 -0
- package/src/widget/components/PoolWithdraw.tsx +1 -1
- package/src/widget/components/QuoteDetails.tsx +5 -4
- package/src/widget/components/Receipt.tsx +4 -3
- package/src/widget/components/SlippageToleranceSettings.tsx +3 -2
- package/src/widget/components/Swap.tsx +2 -0
- package/src/widget/components/TransferPendingVertical.tsx +21 -28
- package/src/widget/components/UserPreferences.tsx +1 -1
- package/src/widget/components/Withdraw.tsx +20 -14
- package/src/widget/hooks/useAmountUsd.ts +3 -15
- package/src/widget/hooks/useCustomTokenSearch.tsx +2 -6
- package/src/widget/hooks/useDisplayCurrencyPreference.tsx +1 -2
- package/src/widget/hooks/useFiatOnRampCurrencies.ts +11 -76
- package/src/widget/hooks/useMeldTransactionHistory.ts +24 -89
- package/src/widget/hooks/useOnRampCountryDefaults.ts +3 -49
- package/src/widget/hooks/useOnRampPaymentMethods.ts +21 -100
- package/src/widget/hooks/useOnRampQuote.ts +2 -5
- package/src/widget/hooks/useQuote.ts +10 -12
- package/src/widget/hooks/useSendForm.ts +6 -0
- package/src/widget/hooks/useTokenList.ts +3 -6
- package/src/widget/hooks/useTokenWithFreshBalance.ts +141 -11
- package/src/widget/types/commonProps.ts +2 -0
- package/src/widget/utils/transactionFailure.ts +52 -0
- package/src/widget/widget.tsx +137 -59
- package/src/widget/workers/intentExecutionWorker.ts +3 -1
- package/dist/widget/hooks/useExchangeRate.d.ts +0 -31
- package/dist/widget/hooks/useExchangeRate.d.ts.map +0 -1
- package/dist/widget/hooks/useFiatCurrencyList.d.ts +0 -3
- package/dist/widget/hooks/useFiatCurrencyList.d.ts.map +0 -1
- package/src/widget/hooks/useExchangeRate.ts +0 -257
- package/src/widget/hooks/useFiatCurrencyList.ts +0 -66
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type React from "react"
|
|
2
|
-
import {
|
|
3
|
-
ChevronRight,
|
|
4
|
-
CreditCard,
|
|
5
|
-
Wallet,
|
|
6
|
-
Building2,
|
|
7
|
-
Smartphone,
|
|
8
|
-
ZapIcon,
|
|
9
|
-
} from "lucide-react"
|
|
2
|
+
import { ChevronRight, CreditCard, Wallet, ZapIcon } from "lucide-react"
|
|
10
3
|
import { useAccount } from "wagmi"
|
|
11
4
|
import { ScreenHeader } from "./ScreenHeader.js"
|
|
12
5
|
import { useCurrentScreen } from "../hooks/useCurrentScreen.js"
|
|
@@ -20,6 +13,8 @@ import { truncateAddress } from "../../utils/address.js"
|
|
|
20
13
|
import { useResolveEns } from "../../ens.js"
|
|
21
14
|
import { AddressWalletIcon } from "./AddressWalletIcon.js"
|
|
22
15
|
import { useWidgetProps } from "../hooks/useWidgetProps.js"
|
|
16
|
+
import type { FundMethod } from "../../transactionIntent/types.js"
|
|
17
|
+
import type { FundMethodListOption } from "../widget.js"
|
|
23
18
|
|
|
24
19
|
export interface FundMethodsProps {
|
|
25
20
|
headerContent?: string
|
|
@@ -56,6 +51,8 @@ const FundMethods: React.FC<FundMethodsProps> = ({
|
|
|
56
51
|
const { wallets: allWallets } = useWallets()
|
|
57
52
|
const { fundOptions } = useWidgetProps()
|
|
58
53
|
const hideWallets = fundOptions?.hideWallets ?? []
|
|
54
|
+
const fundMethodsList = fundOptions?.fundMethodsList
|
|
55
|
+
const hideUnlistedFundMethods = fundOptions?.hideUnlistedFundMethods ?? false
|
|
59
56
|
|
|
60
57
|
// Check if onramp is enabled based on mode
|
|
61
58
|
const isOnrampEnabled = mode === "swap" || mode === "fund"
|
|
@@ -109,57 +106,118 @@ const FundMethods: React.FC<FundMethodsProps> = ({
|
|
|
109
106
|
|
|
110
107
|
const showWalletInline = activeConnection && !isActiveWalletHidden
|
|
111
108
|
|
|
112
|
-
const displayApplePay = false
|
|
113
|
-
const displayMeldExchange = false // Meld Exchange remains disabled
|
|
114
109
|
const displayMeshExchange = !!onramp // MeshConnect Exchange enabled when onramp prop is provided
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/>
|
|
111
|
+
const fundMethodAliases: Record<FundMethodListOption, FundMethod> = {
|
|
112
|
+
"connected-wallet": "wallet",
|
|
113
|
+
"crypto-transfer": "direct-transfer",
|
|
114
|
+
"cc-onramp": "onramp-meld",
|
|
115
|
+
"exchange-onramp": "onramp-mesh",
|
|
116
|
+
}
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
118
|
+
const defaultFundMethodsOrder: FundMethod[] = [
|
|
119
|
+
"wallet",
|
|
120
|
+
"onramp-meld",
|
|
121
|
+
"direct-transfer",
|
|
122
|
+
"onramp-mesh",
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
const validFundMethods = new Set<FundMethod>([
|
|
126
|
+
"wallet",
|
|
127
|
+
"direct-transfer",
|
|
128
|
+
"onramp-mesh",
|
|
129
|
+
"onramp-meld",
|
|
130
|
+
])
|
|
131
|
+
|
|
132
|
+
const mappedConfiguredOrder =
|
|
133
|
+
fundMethodsList?.map((method) => {
|
|
134
|
+
const key = method as FundMethodListOption
|
|
135
|
+
return fundMethodAliases[key]
|
|
136
|
+
}) ?? []
|
|
137
|
+
|
|
138
|
+
const listedInternalSet = new Set<FundMethod>(
|
|
139
|
+
mappedConfiguredOrder.filter((m): m is FundMethod =>
|
|
140
|
+
validFundMethods.has(m),
|
|
141
|
+
),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
// Empty list: always show all methods (ignore hideUnlistedFundMethods)
|
|
145
|
+
const orderedFundMethods: FundMethod[] = !fundMethodsList?.length
|
|
146
|
+
? defaultFundMethodsOrder
|
|
147
|
+
: hideUnlistedFundMethods
|
|
148
|
+
? Array.from(
|
|
149
|
+
new Set(
|
|
150
|
+
mappedConfiguredOrder.filter((method): method is FundMethod =>
|
|
151
|
+
validFundMethods.has(method),
|
|
152
|
+
),
|
|
153
|
+
),
|
|
154
|
+
)
|
|
155
|
+
: [
|
|
156
|
+
...mappedConfiguredOrder.filter((m): m is FundMethod =>
|
|
157
|
+
validFundMethods.has(m),
|
|
158
|
+
),
|
|
159
|
+
...defaultFundMethodsOrder.filter((m) => !listedInternalSet.has(m)),
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
const isUnlisted = (method: FundMethod): boolean =>
|
|
163
|
+
!hideUnlistedFundMethods &&
|
|
164
|
+
listedInternalSet.size > 0 &&
|
|
165
|
+
!listedInternalSet.has(method)
|
|
166
|
+
|
|
167
|
+
const renderFundMethod = (method: FundMethod) => {
|
|
168
|
+
const forceDisabled = isUnlisted(method)
|
|
169
|
+
if (method === "wallet") {
|
|
170
|
+
if (showWalletInline) {
|
|
171
|
+
return (
|
|
172
|
+
<div
|
|
173
|
+
key="wallet-inline"
|
|
174
|
+
onClick={
|
|
175
|
+
forceDisabled
|
|
176
|
+
? undefined
|
|
177
|
+
: () => {
|
|
178
|
+
setSelectedFundMethod("wallet")
|
|
179
|
+
if (onSelectConnectedAccount) {
|
|
180
|
+
onSelectConnectedAccount()
|
|
181
|
+
}
|
|
146
182
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
183
|
+
}
|
|
184
|
+
onKeyDown={
|
|
185
|
+
forceDisabled
|
|
186
|
+
? undefined
|
|
187
|
+
: (e) => {
|
|
188
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
189
|
+
e.preventDefault()
|
|
190
|
+
setSelectedFundMethod("wallet")
|
|
191
|
+
if (onSelectConnectedAccount) {
|
|
192
|
+
onSelectConnectedAccount()
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
className={`w-full text-left px-4 py-3 flex items-center justify-between transition-colors rounded-xl trails-hover-bg ${
|
|
198
|
+
forceDisabled
|
|
199
|
+
? disabledClassname
|
|
200
|
+
: `cursor-pointer ${
|
|
201
|
+
selectedFundMethod === "wallet"
|
|
202
|
+
? "bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-600"
|
|
203
|
+
: ""
|
|
204
|
+
}`
|
|
205
|
+
}`}
|
|
206
|
+
>
|
|
207
|
+
<div className="flex items-center gap-3 flex-1">
|
|
208
|
+
<div className="flex items-center justify-center shrink-0">
|
|
209
|
+
<AddressWalletIcon
|
|
210
|
+
size={30}
|
|
211
|
+
walletAddress={activeConnection?.address as `0x${string}`}
|
|
212
|
+
/>
|
|
213
|
+
</div>
|
|
214
|
+
<span className="text-sm font-medium">
|
|
215
|
+
{activeConnection?.address
|
|
216
|
+
? ensName ||
|
|
217
|
+
`${truncateAddress(activeConnection.address)} wallet`
|
|
218
|
+
: ""}{" "}
|
|
219
|
+
</span>
|
|
220
|
+
{!forceDisabled && (
|
|
163
221
|
<button
|
|
164
222
|
type="button"
|
|
165
223
|
onClick={(e) => {
|
|
@@ -175,152 +233,157 @@ const FundMethods: React.FC<FundMethodsProps> = ({
|
|
|
175
233
|
className="w-5 h-5 dark:invert dark:brightness-150"
|
|
176
234
|
/>
|
|
177
235
|
</button>
|
|
178
|
-
|
|
179
|
-
<ChevronRight className="w-5 h-5 text-gray-400 dark:text-white" />
|
|
236
|
+
)}
|
|
180
237
|
</div>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
setCurrentScreen(
|
|
186
|
-
activeConnection ? "select-funding-wallet" : "wallet-list",
|
|
187
|
-
)
|
|
188
|
-
}}
|
|
189
|
-
className="w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl"
|
|
190
|
-
>
|
|
191
|
-
<div className="flex items-center gap-3">
|
|
192
|
-
<Wallet className="w-8 h-8 text-gray-700 dark:text-gray-200" />
|
|
193
|
-
<span className="text-sm font-medium">Crypto wallet</span>
|
|
194
|
-
</div>
|
|
195
|
-
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
196
|
-
</button>
|
|
197
|
-
)}
|
|
238
|
+
<ChevronRight className="w-5 h-5 text-gray-400 dark:text-white" />
|
|
239
|
+
</div>
|
|
240
|
+
)
|
|
241
|
+
}
|
|
198
242
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
onSelectOnrampMeld()
|
|
243
|
+
return (
|
|
244
|
+
<button
|
|
245
|
+
key="wallet-button"
|
|
246
|
+
type="button"
|
|
247
|
+
disabled={forceDisabled}
|
|
248
|
+
onClick={
|
|
249
|
+
forceDisabled
|
|
250
|
+
? undefined
|
|
251
|
+
: () => {
|
|
252
|
+
setCurrentScreen(
|
|
253
|
+
activeConnection ? "select-funding-wallet" : "wallet-list",
|
|
254
|
+
)
|
|
212
255
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
256
|
+
}
|
|
257
|
+
className={
|
|
258
|
+
forceDisabled
|
|
259
|
+
? disabledClassname
|
|
260
|
+
: "w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl"
|
|
261
|
+
}
|
|
262
|
+
>
|
|
263
|
+
<div className="flex items-center gap-3">
|
|
264
|
+
<Wallet className="w-8 h-8 text-gray-700 dark:text-gray-200" />
|
|
265
|
+
<span className="text-sm font-medium">Connected wallet</span>
|
|
266
|
+
</div>
|
|
267
|
+
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
268
|
+
</button>
|
|
269
|
+
)
|
|
270
|
+
}
|
|
227
271
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
272
|
+
if (method === "onramp-meld") {
|
|
273
|
+
if (!isOnrampEnabled) return null
|
|
274
|
+
const disabled = forceDisabled || !activeConnection
|
|
275
|
+
return (
|
|
276
|
+
<button
|
|
277
|
+
key="onramp-meld"
|
|
278
|
+
type="button"
|
|
279
|
+
disabled={disabled}
|
|
280
|
+
onClick={
|
|
281
|
+
disabled
|
|
282
|
+
? undefined
|
|
283
|
+
: () => {
|
|
284
|
+
setSelectedFundMethod("onramp-meld")
|
|
285
|
+
setIsMeldOnRamp(true)
|
|
286
|
+
setPaymentMethod({
|
|
287
|
+
id: "CREDIT_DEBIT_CARD",
|
|
288
|
+
name: "Credit/Debit Card",
|
|
289
|
+
})
|
|
290
|
+
if (onSelectOnrampMeld) {
|
|
291
|
+
onSelectOnrampMeld()
|
|
292
|
+
}
|
|
240
293
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
294
|
+
}
|
|
295
|
+
className={
|
|
296
|
+
disabled
|
|
297
|
+
? disabledClassname
|
|
298
|
+
: "w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl"
|
|
299
|
+
}
|
|
300
|
+
>
|
|
301
|
+
<div className="flex items-center gap-3">
|
|
302
|
+
<CreditCard className="w-8 h-8 text-gray-700 dark:text-gray-100" />
|
|
303
|
+
<span className="text-sm font-medium">Credit/Debit Card</span>
|
|
304
|
+
</div>
|
|
305
|
+
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
306
|
+
</button>
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (method === "direct-transfer") {
|
|
311
|
+
const disabled = forceDisabled || !activeConnection
|
|
312
|
+
return (
|
|
313
|
+
<button
|
|
314
|
+
key="direct-transfer"
|
|
315
|
+
type="button"
|
|
316
|
+
disabled={disabled}
|
|
317
|
+
onClick={disabled ? undefined : onSelectTransferCrypto}
|
|
318
|
+
className={
|
|
319
|
+
disabled
|
|
320
|
+
? disabledClassname
|
|
321
|
+
: "w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl"
|
|
322
|
+
}
|
|
323
|
+
>
|
|
324
|
+
<div className="flex items-center gap-3">
|
|
325
|
+
<ZapIcon className="w-8 h-8 text-gray-700 dark:text-gray-100" />
|
|
326
|
+
<span className="text-sm font-medium">Crypto transfer</span>
|
|
327
|
+
</div>
|
|
328
|
+
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
329
|
+
</button>
|
|
330
|
+
)
|
|
331
|
+
}
|
|
251
332
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
333
|
+
if (method === "onramp-mesh") {
|
|
334
|
+
if (mode === "pay") return null
|
|
335
|
+
const disabled = forceDisabled || !displayMeshExchange
|
|
336
|
+
return (
|
|
337
|
+
<button
|
|
338
|
+
key="onramp-mesh"
|
|
339
|
+
type="button"
|
|
340
|
+
disabled={disabled}
|
|
341
|
+
title={
|
|
342
|
+
displayMeshExchange && !forceDisabled ? undefined : "Coming soon"
|
|
343
|
+
}
|
|
344
|
+
onClick={
|
|
345
|
+
disabled
|
|
346
|
+
? undefined
|
|
347
|
+
: () => {
|
|
348
|
+
setSelectedFundMethod("onramp-mesh")
|
|
349
|
+
if (onSelectOnrampExchange) {
|
|
350
|
+
onSelectOnrampExchange()
|
|
351
|
+
}
|
|
265
352
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
353
|
+
}
|
|
354
|
+
className={
|
|
355
|
+
disabled
|
|
356
|
+
? "w-full text-left px-4 py-3 flex items-center justify-between cursor-not-allowed transition-colors trails-hover-bg rounded-xl opacity-50"
|
|
357
|
+
: "w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl"
|
|
358
|
+
}
|
|
359
|
+
>
|
|
360
|
+
<div className="flex items-center gap-3">
|
|
361
|
+
<img
|
|
362
|
+
src={ExchangeIcon}
|
|
363
|
+
alt="Exchange"
|
|
364
|
+
className="w-8 h-8 text-gray-700 dark:text-gray-100"
|
|
365
|
+
/>
|
|
366
|
+
<span className="text-sm font-medium">From Exchange</span>
|
|
367
|
+
</div>
|
|
368
|
+
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
369
|
+
</button>
|
|
370
|
+
)
|
|
371
|
+
}
|
|
276
372
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
type="button"
|
|
280
|
-
disabled={!activeConnection}
|
|
281
|
-
onClick={onSelectTransferCrypto}
|
|
282
|
-
className={
|
|
283
|
-
activeConnection
|
|
284
|
-
? `w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl`
|
|
285
|
-
: disabledClassname
|
|
286
|
-
}
|
|
287
|
-
>
|
|
288
|
-
<div className="flex items-center gap-3">
|
|
289
|
-
<ZapIcon className="w-8 h-8 text-gray-700 dark:text-gray-100" />
|
|
290
|
-
<span className="text-sm font-medium">Direct transfer</span>
|
|
291
|
-
</div>
|
|
292
|
-
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
293
|
-
</button>
|
|
373
|
+
return null
|
|
374
|
+
}
|
|
294
375
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}}
|
|
307
|
-
className={
|
|
308
|
-
displayMeshExchange
|
|
309
|
-
? "w-full text-left px-4 py-3 flex items-center justify-between cursor-pointer transition-colors trails-hover-bg rounded-xl"
|
|
310
|
-
: "w-full text-left px-4 py-3 flex items-center justify-between cursor-not-allowed transition-colors trails-hover-bg rounded-xl opacity-50"
|
|
311
|
-
}
|
|
312
|
-
>
|
|
313
|
-
<div className="flex items-center gap-3">
|
|
314
|
-
<img
|
|
315
|
-
src={ExchangeIcon}
|
|
316
|
-
alt="Exchange"
|
|
317
|
-
className="w-8 h-8 dark:invert dark:brightness-150"
|
|
318
|
-
/>
|
|
319
|
-
<span className="text-sm font-medium">From Exchange</span>
|
|
320
|
-
</div>
|
|
321
|
-
<ChevronRight className="w-5 h-5 text-gray-400" />
|
|
322
|
-
</button>
|
|
323
|
-
)}
|
|
376
|
+
return (
|
|
377
|
+
<div className="flex flex-col h-full">
|
|
378
|
+
<ScreenHeader
|
|
379
|
+
headerContent={headerContent || "Choose a funding method"}
|
|
380
|
+
headerContentAlign="left"
|
|
381
|
+
rightSideContent={<div className="w-9" />}
|
|
382
|
+
/>
|
|
383
|
+
|
|
384
|
+
<div className="flex-1">
|
|
385
|
+
<div className="flex flex-col gap-1">
|
|
386
|
+
{orderedFundMethods.map((method) => renderFundMethod(method))}
|
|
324
387
|
</div>
|
|
325
388
|
</div>
|
|
326
389
|
</div>
|
|
@@ -19,6 +19,7 @@ import Receipt from "./Receipt.js"
|
|
|
19
19
|
import { useOriginSelectedToken } from "../hooks/useOriginSelectedToken.js"
|
|
20
20
|
import { useRecentTokens } from "../hooks/useRecentTokens.js"
|
|
21
21
|
import { useWidgetProps } from "../hooks/useWidgetProps.js"
|
|
22
|
+
import { invalidateTokenBalancesCache } from "../../query/balance.queries.js"
|
|
22
23
|
|
|
23
24
|
type HookModalScreen =
|
|
24
25
|
| "select-origin-token"
|
|
@@ -220,6 +221,9 @@ export function HookModalContent() {
|
|
|
220
221
|
// Invalidate quote cache to ensure fresh quote on next transaction
|
|
221
222
|
queryClient.invalidateQueries({ queryKey: ["prepareSend"] })
|
|
222
223
|
|
|
224
|
+
// Invalidate balance cache to ensure fresh balances after completed swap
|
|
225
|
+
invalidateTokenBalancesCache()
|
|
226
|
+
|
|
223
227
|
// Call custom callback if provided
|
|
224
228
|
if (onReceiptAction) {
|
|
225
229
|
onReceiptAction()
|