0xtrails 0.1.2 → 0.1.3
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 +68 -1
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-BmFTEOaB.js → ccip-CWd4g9uZ.js} +1 -1
- package/dist/chains.d.ts +9 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/ens.d.ts +7 -0
- package/dist/ens.d.ts.map +1 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/{index-BPsVj7zK.js → index-BTUBzx4R.js} +23624 -21770
- package/dist/index.js +2 -2
- package/dist/lifi.d.ts +4 -0
- package/dist/lifi.d.ts.map +1 -0
- package/dist/mode.d.ts +1 -1
- package/dist/mode.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +3 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +2 -0
- package/dist/prices.d.ts.map +1 -1
- package/dist/relaySdk.d.ts.map +1 -1
- package/dist/relayer.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +2 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +3 -3
- package/dist/trails.d.ts.map +1 -1
- package/dist/transactions.d.ts.map +1 -1
- package/dist/wallets.d.ts +247 -5
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/ChainFilterDropdown.d.ts +2 -0
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts +1 -0
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensDropdown.d.ts.map +1 -1
- package/dist/widget/components/FundSendForm.d.ts +2 -2
- package/dist/widget/components/FundSendForm.d.ts.map +1 -1
- package/dist/widget/components/PaySendForm.d.ts +2 -2
- package/dist/widget/components/PaySendForm.d.ts.map +1 -1
- package/dist/widget/components/QrCode.d.ts +1 -1
- package/dist/widget/components/QrCode.d.ts.map +1 -1
- package/dist/widget/components/RefundAddressInput.d.ts +13 -0
- package/dist/widget/components/RefundAddressInput.d.ts.map +1 -0
- package/dist/widget/components/Swap.d.ts +43 -0
- package/dist/widget/components/Swap.d.ts.map +1 -0
- package/dist/widget/components/TokenList.d.ts +0 -2
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TokenSelector.d.ts +26 -0
- package/dist/widget/components/TokenSelector.d.ts.map +1 -0
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/components/WalletConnectionPending.d.ts +12 -0
- package/dist/widget/components/WalletConnectionPending.d.ts.map +1 -0
- package/dist/widget/components/WalletList.d.ts.map +1 -1
- package/dist/widget/hooks/useAmountUsd.d.ts +1 -3
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +6 -4
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts +2 -3
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/aave.ts +13 -13
- package/src/analytics.ts +87 -4
- package/src/chains.ts +45 -7
- package/src/constants.ts +4 -4
- package/src/ens.ts +17 -0
- package/src/error.ts +16 -1
- package/src/lifi.ts +58 -0
- package/src/mode.ts +1 -1
- package/src/morpho.ts +3 -3
- package/src/pools.ts +18 -18
- package/src/prepareSend.ts +35 -3
- package/src/prices.ts +21 -0
- package/src/relaySdk.ts +1 -0
- package/src/relayer.ts +8 -0
- package/src/tokenBalances.ts +3 -0
- package/src/tokens.ts +85 -19
- package/src/trails.ts +2 -2
- package/src/transactions.ts +1 -0
- package/src/wallets.ts +275 -35
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/ChainFilterDropdown.tsx +42 -33
- package/src/widget/components/ChainImage.tsx +1 -1
- package/src/widget/components/ConnectWallet.tsx +92 -128
- package/src/widget/components/DebugScreensDropdown.tsx +3 -0
- package/src/widget/components/FundSendForm.tsx +17 -3
- package/src/widget/components/PaySendForm.tsx +16 -2
- package/src/widget/components/QRCodeDeposit.tsx +1 -1
- package/src/widget/components/QrCode.tsx +277 -16
- package/src/widget/components/Receipt.tsx +1 -1
- package/src/widget/components/RefundAddressInput.tsx +149 -0
- package/src/widget/components/Swap.tsx +648 -0
- package/src/widget/components/TokenList.tsx +27 -363
- package/src/widget/components/TokenSelector.tsx +405 -0
- package/src/widget/components/WalletConnect.tsx +9 -7
- package/src/widget/components/WalletConnectionPending.tsx +157 -0
- package/src/widget/components/WalletList.tsx +6 -5
- package/src/widget/hooks/useAmountUsd.ts +3 -8
- package/src/widget/hooks/useCheckout.ts +3 -2
- package/src/widget/hooks/useSendForm.ts +66 -32
- package/src/widget/hooks/useTokenList.ts +158 -106
- package/src/widget/widget.tsx +335 -72
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react"
|
|
2
2
|
import { ChevronRight, Copy, LogOut } from "lucide-react"
|
|
3
3
|
import { useAccount, useDisconnect } from "wagmi"
|
|
4
|
-
import MetaMaskFox from "../assets/MetaMask-icon-fox.svg"
|
|
5
|
-
import WalletConnectLogoWhite from "../assets/WalletConnect-logo-white.svg"
|
|
6
4
|
import { AlignJustify, Wallet } from "lucide-react"
|
|
7
5
|
import { ScreenHeader } from "./ScreenHeader.js"
|
|
6
|
+
import { useWallets, wagmiConnectorToWalletId } from "../../wallets.js"
|
|
8
7
|
|
|
9
8
|
export interface WalletOption {
|
|
10
9
|
id: string
|
|
@@ -18,6 +17,7 @@ export interface ConnectWalletProps {
|
|
|
18
17
|
onContinue: () => void
|
|
19
18
|
onError: (error: Error) => void
|
|
20
19
|
walletOptions: WalletOption[]
|
|
20
|
+
lastClickedWallet?: string | null
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export const ConnectWallet: React.FC<ConnectWalletProps> = ({
|
|
@@ -25,25 +25,12 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = ({
|
|
|
25
25
|
onDisconnect,
|
|
26
26
|
onContinue,
|
|
27
27
|
onError,
|
|
28
|
-
|
|
28
|
+
lastClickedWallet,
|
|
29
29
|
}) => {
|
|
30
30
|
const { isConnected, address, connector } = useAccount()
|
|
31
31
|
const { disconnect } = useDisconnect()
|
|
32
|
+
const { wallets: allWallets } = useWallets()
|
|
32
33
|
const [error, setError] = useState<string | null>(null)
|
|
33
|
-
const [lastClickedWallet, setLastClickedWallet] = useState<string | null>(
|
|
34
|
-
() => {
|
|
35
|
-
// Initialize from localStorage if available
|
|
36
|
-
if (typeof window !== "undefined") {
|
|
37
|
-
try {
|
|
38
|
-
return localStorage.getItem("trails-last-wallet") || null
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error("[trails-sdk] Failed to read from localStorage:", error)
|
|
41
|
-
return null
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return null
|
|
45
|
-
},
|
|
46
|
-
)
|
|
47
34
|
const [showCopied, setShowCopied] = useState(false)
|
|
48
35
|
|
|
49
36
|
useEffect(() => {
|
|
@@ -55,15 +42,6 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = ({
|
|
|
55
42
|
}, [error, onError])
|
|
56
43
|
|
|
57
44
|
const handleWalletConnect = (walletId: string) => {
|
|
58
|
-
setLastClickedWallet(walletId)
|
|
59
|
-
// Save to localStorage
|
|
60
|
-
if (typeof window !== "undefined") {
|
|
61
|
-
try {
|
|
62
|
-
localStorage.setItem("trails-last-wallet", walletId)
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error("[trails-sdk] Failed to save to localStorage:", error)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
45
|
onConnect(walletId)
|
|
68
46
|
}
|
|
69
47
|
|
|
@@ -92,24 +70,48 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = ({
|
|
|
92
70
|
}
|
|
93
71
|
}
|
|
94
72
|
|
|
95
|
-
// Get the wallet
|
|
96
|
-
const
|
|
97
|
-
if (!connector?.
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
if (name.includes("walletconnect")) return "walletconnect"
|
|
101
|
-
return "injected"
|
|
73
|
+
// Get the wallet config for the current connector
|
|
74
|
+
const getCurrentWalletConfig = () => {
|
|
75
|
+
if (!connector?.id) return null
|
|
76
|
+
const walletId = wagmiConnectorToWalletId(connector)
|
|
77
|
+
return allWallets.find((wallet) => wallet.id === walletId) || null
|
|
102
78
|
}
|
|
103
79
|
|
|
104
|
-
//
|
|
80
|
+
// Create wallet options from allWallets and always prepend recent wallet
|
|
105
81
|
const orderedWalletOptions = React.useMemo(() => {
|
|
106
|
-
|
|
82
|
+
// Convert allWallets to wallet options format
|
|
83
|
+
const walletOptionsFromAllWallets = allWallets.map((wallet) => ({
|
|
84
|
+
id: wallet.id,
|
|
85
|
+
name: wallet.name,
|
|
86
|
+
connector: () => wallet.connector?.connect?.(),
|
|
87
|
+
}))
|
|
107
88
|
|
|
108
|
-
const
|
|
109
|
-
const
|
|
89
|
+
const alwaysShowWallets = ["metamask", "walletconnect"]
|
|
90
|
+
const filteredWallets = walletOptionsFromAllWallets
|
|
91
|
+
.filter((wallet) => alwaysShowWallets.includes(wallet.id))
|
|
92
|
+
.sort((a, b) => {
|
|
93
|
+
const aIndex = alwaysShowWallets.indexOf(a.id)
|
|
94
|
+
const bIndex = alwaysShowWallets.indexOf(b.id)
|
|
95
|
+
return aIndex - bIndex
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Always prepend recent wallet if it exists, regardless of allowed list
|
|
99
|
+
if (lastClickedWallet) {
|
|
100
|
+
console.log("lastClickedWallet", lastClickedWallet)
|
|
101
|
+
const recentWallet = walletOptionsFromAllWallets.find(
|
|
102
|
+
(w) => w.id === lastClickedWallet,
|
|
103
|
+
)
|
|
104
|
+
const otherWallets = filteredWallets.filter(
|
|
105
|
+
(w) => w.id !== lastClickedWallet,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
if (recentWallet) {
|
|
109
|
+
return [recentWallet, ...otherWallets]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
110
112
|
|
|
111
|
-
return
|
|
112
|
-
}, [
|
|
113
|
+
return filteredWallets
|
|
114
|
+
}, [lastClickedWallet, allWallets])
|
|
113
115
|
|
|
114
116
|
return (
|
|
115
117
|
<div className="space-y-6">
|
|
@@ -136,48 +138,30 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = ({
|
|
|
136
138
|
className="w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-bg-secondary trails-hover-bg trails-text-primary"
|
|
137
139
|
>
|
|
138
140
|
<div className="flex items-center space-x-3">
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<div className="flex items-center space-x-2">
|
|
164
|
-
<span>WalletConnect</span>
|
|
165
|
-
<span className="text-xs bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 trails-border-radius-container font-normal">
|
|
166
|
-
Connected
|
|
167
|
-
</span>
|
|
168
|
-
</div>
|
|
169
|
-
</>
|
|
170
|
-
) : (
|
|
171
|
-
<>
|
|
172
|
-
<Wallet className="h-6 w-6 text-gray-600 dark:text-gray-400" />
|
|
173
|
-
<div className="flex items-center space-x-2">
|
|
174
|
-
<span>{connector?.name || "Wallet"}</span>
|
|
175
|
-
<span className="text-xs bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 trails-border-radius-container font-normal">
|
|
176
|
-
Connected
|
|
177
|
-
</span>
|
|
178
|
-
</div>
|
|
179
|
-
</>
|
|
180
|
-
)}
|
|
141
|
+
{(() => {
|
|
142
|
+
const walletConfig = getCurrentWalletConfig()
|
|
143
|
+
return (
|
|
144
|
+
<>
|
|
145
|
+
{typeof walletConfig?.icon === "string" ? (
|
|
146
|
+
<img
|
|
147
|
+
src={walletConfig?.icon}
|
|
148
|
+
alt={walletConfig?.name}
|
|
149
|
+
className="h-6 w-6"
|
|
150
|
+
/>
|
|
151
|
+
) : (
|
|
152
|
+
<Wallet className="h-6 w-6 text-gray-600 dark:text-gray-400" />
|
|
153
|
+
)}
|
|
154
|
+
<div className="flex items-center space-x-2">
|
|
155
|
+
<span>
|
|
156
|
+
{walletConfig?.name || connector?.name || "Wallet"}
|
|
157
|
+
</span>
|
|
158
|
+
<span className="text-xs bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 px-2 py-1 trails-border-radius-container font-normal">
|
|
159
|
+
Connected
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
</>
|
|
163
|
+
)
|
|
164
|
+
})()}
|
|
181
165
|
</div>
|
|
182
166
|
|
|
183
167
|
<ChevronRight className="h-5 w-5 text-gray-400" />
|
|
@@ -246,64 +230,44 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = ({
|
|
|
246
230
|
<button
|
|
247
231
|
type="button"
|
|
248
232
|
key={wallet.id}
|
|
233
|
+
data-wallet-id={wallet.id}
|
|
249
234
|
onClick={() => handleWalletConnect(wallet.id)}
|
|
250
235
|
className={`w-full flex items-center justify-between cursor-pointer font-semibold py-4 px-6 trails-border-radius-large-button transition-all duration-200 trails-bg-secondary trails-hover-bg trails-text-primary`}
|
|
251
236
|
>
|
|
252
237
|
<div className="flex items-center space-x-3">
|
|
253
|
-
{
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
</div>
|
|
268
|
-
</>
|
|
269
|
-
) : wallet.id === "walletconnect" ? (
|
|
270
|
-
<>
|
|
271
|
-
<div className="h-6 w-6 bg-[#3B99FC] rounded flex items-center justify-center">
|
|
272
|
-
<img
|
|
273
|
-
src={WalletConnectLogoWhite}
|
|
274
|
-
alt="WalletConnect"
|
|
275
|
-
className="h-4 w-4"
|
|
276
|
-
/>
|
|
277
|
-
</div>
|
|
278
|
-
<div className="flex items-center space-x-2">
|
|
279
|
-
<span>WalletConnect</span>
|
|
280
|
-
{lastClickedWallet === wallet.id && (
|
|
281
|
-
<span className="text-xs bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 px-2 py-1 trails-border-radius-container font-normal">
|
|
282
|
-
Recent
|
|
283
|
-
</span>
|
|
284
|
-
)}
|
|
285
|
-
</div>
|
|
286
|
-
</>
|
|
287
|
-
) : (
|
|
288
|
-
<>
|
|
289
|
-
<Wallet className="h-6 w-6 text-gray-600 dark:text-gray-400" />
|
|
290
|
-
<div className="flex items-center space-x-2">
|
|
291
|
-
<span>{wallet.name}</span>
|
|
292
|
-
{lastClickedWallet === wallet.id && (
|
|
293
|
-
<span className="text-xs bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 px-2 py-1 trails-border-radius-container font-normal">
|
|
294
|
-
Recent
|
|
295
|
-
</span>
|
|
238
|
+
{(() => {
|
|
239
|
+
const walletConfig = allWallets.find(
|
|
240
|
+
(w) => w.id === wallet.id,
|
|
241
|
+
)
|
|
242
|
+
return (
|
|
243
|
+
<>
|
|
244
|
+
{typeof walletConfig?.icon === "string" ? (
|
|
245
|
+
<img
|
|
246
|
+
src={walletConfig?.icon}
|
|
247
|
+
alt={walletConfig?.name}
|
|
248
|
+
className="h-6 w-6"
|
|
249
|
+
/>
|
|
250
|
+
) : (
|
|
251
|
+
<Wallet className="h-6 w-6 text-gray-600 dark:text-gray-400" />
|
|
296
252
|
)}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
253
|
+
<div className="flex items-center space-x-2">
|
|
254
|
+
<span>{walletConfig?.name || wallet.name}</span>
|
|
255
|
+
{lastClickedWallet === wallet.id && (
|
|
256
|
+
<span className="text-xs bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300 px-2 py-1 trails-border-radius-container font-normal">
|
|
257
|
+
Recent
|
|
258
|
+
</span>
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
</>
|
|
262
|
+
)
|
|
263
|
+
})()}
|
|
300
264
|
</div>
|
|
301
265
|
<ChevronRight className="h-5 w-5 text-gray-400" />
|
|
302
266
|
</button>
|
|
303
267
|
))}
|
|
304
268
|
|
|
305
269
|
{/* More Wallets Link - only show if more than 1 wallet option */}
|
|
306
|
-
{orderedWalletOptions.length >
|
|
270
|
+
{orderedWalletOptions.length > 0 && (
|
|
307
271
|
<button
|
|
308
272
|
type="button"
|
|
309
273
|
onClick={() => onConnect("wallet-list")}
|
|
@@ -13,10 +13,13 @@ const SCREENS = [
|
|
|
13
13
|
"Mesh Connect",
|
|
14
14
|
"Wallet Connect",
|
|
15
15
|
"Wallet List",
|
|
16
|
+
"Wallet Connection Pending",
|
|
17
|
+
"Wallet Connection Pending Retry",
|
|
16
18
|
"Tokens",
|
|
17
19
|
"Send Form",
|
|
18
20
|
"Fund Form",
|
|
19
21
|
"Earn Pools",
|
|
22
|
+
"Swap",
|
|
20
23
|
"Wallet Confirmation",
|
|
21
24
|
"Wallet Confirmation Retry",
|
|
22
25
|
"Pending 1-item-0-confirmed",
|
|
@@ -11,6 +11,7 @@ import { ChainImage } from "./ChainImage.js"
|
|
|
11
11
|
import { TokenImage } from "./TokenImage.js"
|
|
12
12
|
import { QuoteDetails } from "./QuoteDetails.js"
|
|
13
13
|
import { TruncatedAddress } from "./TruncatedAddress.js"
|
|
14
|
+
// import { RefundAddressInput } from "./RefundAddressInput.js"
|
|
14
15
|
import { TradeType } from "../../prepareSend.js"
|
|
15
16
|
import type { PrepareSendQuote } from "../../prepareSend.js"
|
|
16
17
|
import { formatAmount, formatUsdAmountDisplay } from "../../tokenBalances.js"
|
|
@@ -36,8 +37,8 @@ interface FundSendFormProps {
|
|
|
36
37
|
gasless?: boolean
|
|
37
38
|
setWalletConfirmRetryHandler: (handler: () => Promise<void>) => void
|
|
38
39
|
quoteProvider?: string
|
|
39
|
-
fundMethod?: string
|
|
40
|
-
mode?: "pay" | "fund" | "earn"
|
|
40
|
+
fundMethod?: string
|
|
41
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
41
42
|
onNavigateToMeshConnect?: (
|
|
42
43
|
props: {
|
|
43
44
|
toTokenSymbol: string
|
|
@@ -77,6 +78,8 @@ export const FundSendForm: React.FC<FundSendFormProps> = ({
|
|
|
77
78
|
}) => {
|
|
78
79
|
// Local state for fund-specific functionality
|
|
79
80
|
const [isInputTypeUsd, setIsInputTypeUsd] = useState(false)
|
|
81
|
+
// const [isRefundAddressOpen, setIsRefundAddressOpen] = useState(false)
|
|
82
|
+
// const [refundAddress, setRefundAddress] = useState<string>(account.address)
|
|
80
83
|
|
|
81
84
|
const [tokenAmountForBackend, setTokenAmountForBackend] = useState("")
|
|
82
85
|
const [inputDisplayValue, setInputDisplayValue] = useState("")
|
|
@@ -126,6 +129,7 @@ export const FundSendForm: React.FC<FundSendFormProps> = ({
|
|
|
126
129
|
toChainId,
|
|
127
130
|
toToken,
|
|
128
131
|
toCalldata,
|
|
132
|
+
// refundAddress,
|
|
129
133
|
walletClient,
|
|
130
134
|
onTransactionStateChange,
|
|
131
135
|
onError,
|
|
@@ -479,7 +483,7 @@ export const FundSendForm: React.FC<FundSendFormProps> = ({
|
|
|
479
483
|
|
|
480
484
|
{/* Percentage Buttons */}
|
|
481
485
|
<div className="flex space-x-1 justify-center">
|
|
482
|
-
{[25, 50, 100].map((percentage) => (
|
|
486
|
+
{[25, 50, 75, 100].map((percentage) => (
|
|
483
487
|
<button
|
|
484
488
|
key={percentage}
|
|
485
489
|
type="button"
|
|
@@ -688,6 +692,16 @@ export const FundSendForm: React.FC<FundSendFormProps> = ({
|
|
|
688
692
|
</div>
|
|
689
693
|
)}
|
|
690
694
|
|
|
695
|
+
{/* Refund Address Input */}
|
|
696
|
+
{/* <RefundAddressInput
|
|
697
|
+
account={account}
|
|
698
|
+
isOpen={isRefundAddressOpen}
|
|
699
|
+
onToggle={() => setIsRefundAddressOpen(!isRefundAddressOpen)}
|
|
700
|
+
refundAddress={refundAddress}
|
|
701
|
+
onRefundAddressChange={setRefundAddress}
|
|
702
|
+
chainId={selectedDestinationChain.id}
|
|
703
|
+
/> */}
|
|
704
|
+
|
|
691
705
|
{/* Warning Messages - Show only one at a time */}
|
|
692
706
|
{prepareSendQuote?.noSufficientBalance ? (
|
|
693
707
|
<div className="px-2 py-3 rounded-lg bg-amber-500/10 border border-solid border-amber-500/30">
|
|
@@ -12,6 +12,7 @@ import { FeeOptions } from "./FeeOptions.js"
|
|
|
12
12
|
import { TokenImage } from "./TokenImage.js"
|
|
13
13
|
import { QuoteDetails } from "./QuoteDetails.js"
|
|
14
14
|
import { TruncatedAddress } from "./TruncatedAddress.js"
|
|
15
|
+
// import { RefundAddressInput } from "./RefundAddressInput.js"
|
|
15
16
|
import { type PrepareSendQuote, TradeType } from "../../prepareSend.js"
|
|
16
17
|
import { getChainInfo, getChainColor } from "../../chains.js"
|
|
17
18
|
import { formatTvl } from "../../prices.js"
|
|
@@ -41,7 +42,7 @@ interface PaySendFormProps {
|
|
|
41
42
|
gasless?: boolean
|
|
42
43
|
setWalletConfirmRetryHandler: (handler: () => Promise<void>) => void
|
|
43
44
|
quoteProvider?: string
|
|
44
|
-
fundMethod?: string
|
|
45
|
+
fundMethod?: string
|
|
45
46
|
onNavigateToMeshConnect?: (
|
|
46
47
|
props: {
|
|
47
48
|
toTokenSymbol: string
|
|
@@ -52,7 +53,7 @@ interface PaySendFormProps {
|
|
|
52
53
|
quote?: PrepareSendQuote | null,
|
|
53
54
|
) => void
|
|
54
55
|
onAmountUpdate?: (amount: string) => void
|
|
55
|
-
mode?: "pay" | "fund" | "earn"
|
|
56
|
+
mode?: "pay" | "fund" | "earn" | "swap"
|
|
56
57
|
selectedPool?: {
|
|
57
58
|
id: string
|
|
58
59
|
name: string
|
|
@@ -102,6 +103,8 @@ export const PaySendForm: React.FC<PaySendFormProps> = ({
|
|
|
102
103
|
selectedPool,
|
|
103
104
|
checkoutOnHandlers,
|
|
104
105
|
}) => {
|
|
106
|
+
// const [isRefundAddressOpen, setIsRefundAddressOpen] = useState(false)
|
|
107
|
+
// const [refundAddress, setRefundAddress] = useState<string>(account.address)
|
|
105
108
|
const {
|
|
106
109
|
amount,
|
|
107
110
|
amountRaw,
|
|
@@ -145,6 +148,7 @@ export const PaySendForm: React.FC<PaySendFormProps> = ({
|
|
|
145
148
|
toChainId,
|
|
146
149
|
toToken,
|
|
147
150
|
toCalldata,
|
|
151
|
+
// refundAddress,
|
|
148
152
|
walletClient,
|
|
149
153
|
onTransactionStateChange,
|
|
150
154
|
onError,
|
|
@@ -653,6 +657,16 @@ export const PaySendForm: React.FC<PaySendFormProps> = ({
|
|
|
653
657
|
</div>
|
|
654
658
|
)}
|
|
655
659
|
|
|
660
|
+
{/* Refund Address Input */}
|
|
661
|
+
{/* <RefundAddressInput
|
|
662
|
+
account={account}
|
|
663
|
+
isOpen={isRefundAddressOpen}
|
|
664
|
+
onToggle={() => setIsRefundAddressOpen(!isRefundAddressOpen)}
|
|
665
|
+
refundAddress={refundAddress}
|
|
666
|
+
onRefundAddressChange={setRefundAddress}
|
|
667
|
+
chainId={selectedDestinationChain.id}
|
|
668
|
+
/> */}
|
|
669
|
+
|
|
656
670
|
{/* Fee Options */}
|
|
657
671
|
<FeeOptions
|
|
658
672
|
options={FEE_TOKENS}
|