0xtrails 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/analytics.d.ts +1 -0
  2. package/dist/analytics.d.ts.map +1 -1
  3. package/dist/{ccip-D6ToCrWc.js → ccip-BbfANth7.js} +1 -1
  4. package/dist/chains.d.ts.map +1 -1
  5. package/dist/config.d.ts +1 -2
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/constants.d.ts +2 -2
  8. package/dist/constants.d.ts.map +1 -1
  9. package/dist/gasless.d.ts +19 -7
  10. package/dist/gasless.d.ts.map +1 -1
  11. package/dist/{index-BqgeTLL8.js → index-WpIVoh3X.js} +27626 -26572
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +68 -68
  15. package/dist/indexerClient.d.ts +10 -0
  16. package/dist/indexerClient.d.ts.map +1 -1
  17. package/dist/intentEntrypoint.d.ts +40 -14
  18. package/dist/intentEntrypoint.d.ts.map +1 -1
  19. package/dist/intents.d.ts.map +1 -1
  20. package/dist/prepareSend.d.ts +11 -8
  21. package/dist/prepareSend.d.ts.map +1 -1
  22. package/dist/relayer.d.ts.map +1 -1
  23. package/dist/trails.d.ts.map +1 -1
  24. package/dist/trailsClient.d.ts.map +1 -1
  25. package/dist/trailsRouter.d.ts +22 -0
  26. package/dist/trailsRouter.d.ts.map +1 -0
  27. package/dist/transactions.d.ts +0 -1
  28. package/dist/transactions.d.ts.map +1 -1
  29. package/dist/widget/components/AccountSettings.d.ts.map +1 -1
  30. package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
  31. package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
  32. package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
  33. package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
  34. package/dist/widget/components/Earn.d.ts.map +1 -1
  35. package/dist/widget/components/FeeOption.d.ts +22 -0
  36. package/dist/widget/components/FeeOption.d.ts.map +1 -0
  37. package/dist/widget/components/FeeOptions.d.ts +13 -17
  38. package/dist/widget/components/FeeOptions.d.ts.map +1 -1
  39. package/dist/widget/components/Fund.d.ts.map +1 -1
  40. package/dist/widget/components/FundMethods.d.ts +1 -1
  41. package/dist/widget/components/FundMethods.d.ts.map +1 -1
  42. package/dist/widget/components/FundSendForm.d.ts.map +1 -1
  43. package/dist/widget/components/MeshConnectExchanges.d.ts +5 -2
  44. package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
  45. package/dist/widget/components/MeshConnectFlow.d.ts +2 -0
  46. package/dist/widget/components/MeshConnectFlow.d.ts.map +1 -1
  47. package/dist/widget/components/NativeGasOption.d.ts +12 -0
  48. package/dist/widget/components/NativeGasOption.d.ts.map +1 -0
  49. package/dist/widget/components/Pay.d.ts.map +1 -1
  50. package/dist/widget/components/PaySendForm.d.ts.map +1 -1
  51. package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
  52. package/dist/widget/components/TokenSelector.d.ts.map +1 -1
  53. package/dist/widget/components/UserPreferences.d.ts.map +1 -1
  54. package/dist/widget/hooks/useBack.d.ts +2 -0
  55. package/dist/widget/hooks/useBack.d.ts.map +1 -1
  56. package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
  57. package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
  58. package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
  59. package/dist/widget/hooks/useSelectedFeeToken.d.ts +32 -0
  60. package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -0
  61. package/dist/widget/hooks/useSelectedMeshExchange.d.ts +14 -0
  62. package/dist/widget/hooks/useSelectedMeshExchange.d.ts.map +1 -0
  63. package/dist/widget/hooks/useSendForm.d.ts +8 -13
  64. package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
  65. package/dist/widget/index.js +1 -1
  66. package/dist/widget/widget.d.ts.map +1 -1
  67. package/package.json +29 -28
  68. package/src/analytics.ts +6 -0
  69. package/src/chains.ts +10 -0
  70. package/src/config.ts +25 -10
  71. package/src/constants.ts +11 -10
  72. package/src/gasless.ts +162 -109
  73. package/src/index.ts +1 -1
  74. package/src/indexerClient.ts +73 -1
  75. package/src/intentEntrypoint.ts +66 -101
  76. package/src/intents.ts +0 -2
  77. package/src/prepareSend.ts +1409 -887
  78. package/src/relayer.ts +4 -3
  79. package/src/trails.ts +1 -3
  80. package/src/trailsClient.ts +4 -1
  81. package/src/{balanceInjector.ts → trailsRouter.ts} +14 -14
  82. package/src/transactions.ts +4 -54
  83. package/src/widget/compiled.css +1 -1
  84. package/src/widget/components/AccountSettings.tsx +7 -1
  85. package/src/widget/components/ClassicSwap.tsx +173 -175
  86. package/src/widget/components/ConfigDisplay.tsx +34 -1
  87. package/src/widget/components/ConnectWallet.tsx +168 -11
  88. package/src/widget/components/ConnectedWallets.tsx +184 -102
  89. package/src/widget/components/DebugToast.tsx +3 -3
  90. package/src/widget/components/Earn.tsx +4 -27
  91. package/src/widget/components/FeeOption.tsx +78 -0
  92. package/src/widget/components/FeeOptions.tsx +192 -127
  93. package/src/widget/components/Fund.tsx +18 -27
  94. package/src/widget/components/FundMethods.tsx +3 -3
  95. package/src/widget/components/FundSendForm.tsx +0 -33
  96. package/src/widget/components/MeshConnectExchanges.tsx +32 -3
  97. package/src/widget/components/MeshConnectFlow.tsx +23 -4
  98. package/src/widget/components/NativeGasOption.tsx +99 -0
  99. package/src/widget/components/Pay.tsx +36 -32
  100. package/src/widget/components/PaySendForm.tsx +0 -37
  101. package/src/widget/components/QuoteDetails.tsx +0 -29
  102. package/src/widget/components/TokenSelector.tsx +11 -0
  103. package/src/widget/components/TransferPendingVertical.tsx +1 -1
  104. package/src/widget/components/UserPreferences.tsx +3 -4
  105. package/src/widget/hooks/useBack.tsx +4 -0
  106. package/src/widget/hooks/useCurrentScreen.tsx +1 -0
  107. package/src/widget/hooks/useDefaultTokenSelection.tsx +3 -7
  108. package/src/widget/hooks/useSelectedFeeToken.tsx +299 -0
  109. package/src/widget/hooks/useSelectedMeshExchange.tsx +46 -0
  110. package/src/widget/hooks/useSendForm.ts +78 -23
  111. package/src/widget/widget.tsx +173 -111
  112. package/dist/balanceInjector.d.ts +0 -22
  113. package/dist/balanceInjector.d.ts.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import type React from "react"
2
- import { useState } from "react"
2
+ import { useState, useEffect } from "react"
3
3
  import { MeshConnectExchanges } from "./MeshConnectExchanges.js"
4
4
  import { MeshConnectIframe } from "./MeshConnectIframe.js"
5
+ import type { SelectedMeshExchange } from "../hooks/useSelectedMeshExchange.js"
5
6
 
6
7
  export interface MeshConnectFlowProps {
7
8
  onBack?: () => void
@@ -10,6 +11,7 @@ export interface MeshConnectFlowProps {
10
11
  toTokenAmount?: string
11
12
  toChainId?: number
12
13
  toRecipientAddress?: string
14
+ selectedExchange?: SelectedMeshExchange | null
13
15
  }
14
16
 
15
17
  type Screen = "exchanges" | "connect"
@@ -21,10 +23,27 @@ export const MeshConnectFlow: React.FC<MeshConnectFlowProps> = ({
21
23
  toTokenAmount,
22
24
  toChainId,
23
25
  toRecipientAddress,
26
+ selectedExchange,
24
27
  }) => {
25
- const [currentScreen, setCurrentScreen] = useState<Screen>("exchanges")
26
- const [selectedIntegrationId, setSelectedIntegrationId] = useState<string>("")
27
- const [selectedExchangeName, setSelectedExchangeName] = useState<string>("")
28
+ // If an exchange is already selected, start on the connect screen
29
+ const [currentScreen, setCurrentScreen] = useState<Screen>(
30
+ selectedExchange ? "connect" : "exchanges",
31
+ )
32
+ const [selectedIntegrationId, setSelectedIntegrationId] = useState<string>(
33
+ selectedExchange?.integrationId || "",
34
+ )
35
+ const [selectedExchangeName, setSelectedExchangeName] = useState<string>(
36
+ selectedExchange?.exchangeName || "",
37
+ )
38
+
39
+ // Update state when selectedExchange prop changes
40
+ useEffect(() => {
41
+ if (selectedExchange) {
42
+ setSelectedIntegrationId(selectedExchange.integrationId)
43
+ setSelectedExchangeName(selectedExchange.exchangeName)
44
+ setCurrentScreen("connect")
45
+ }
46
+ }, [selectedExchange])
28
47
 
29
48
  const handleSelectExchange = (
30
49
  integrationId: string,
@@ -0,0 +1,99 @@
1
+ import type React from "react"
2
+ import { getChainInfo } from "../../chains.js"
3
+ import { TokenImage } from "./TokenImage.js"
4
+ import { getTokenImageUrl } from "../../tokens.js"
5
+ import { zeroAddress } from "viem"
6
+
7
+ interface NativeGasOptionProps {
8
+ isSelected: boolean
9
+ gasCostUsdDisplay?: string
10
+ gasCostNativeDisplay?: string
11
+ onClick: () => void
12
+ chainId?: number
13
+ notEnoughBalance?: boolean
14
+ }
15
+
16
+ export const NativeGasOption: React.FC<NativeGasOptionProps> = ({
17
+ isSelected,
18
+ gasCostUsdDisplay,
19
+ gasCostNativeDisplay,
20
+ onClick,
21
+ chainId,
22
+ notEnoughBalance = false,
23
+ }) => {
24
+ // Helper function to get native symbol for a chain
25
+ const getNativeSymbol = (chainId?: number) => {
26
+ if (!chainId) return "ETH"
27
+ const chainInfo = getChainInfo(chainId)
28
+ return chainInfo?.nativeCurrency.symbol || "ETH"
29
+ }
30
+
31
+ const nativeSymbol = getNativeSymbol(chainId)
32
+ const nativeImageUrl = getTokenImageUrl({
33
+ chainId,
34
+ contractAddress: zeroAddress,
35
+ symbol: nativeSymbol,
36
+ })
37
+
38
+ return (
39
+ <button
40
+ type="button"
41
+ className={`w-full flex items-center justify-between p-1.5 trails-border-radius-input border transition-colors ${
42
+ notEnoughBalance
43
+ ? "cursor-not-allowed opacity-50 bg-gray-100 dark:bg-gray-800 border-gray-300 dark:border-gray-600"
44
+ : isSelected
45
+ ? "cursor-pointer trails-bg-primary/10 border-blue-500 bg-blue-50 dark:bg-blue-900/20"
46
+ : "cursor-pointer trails-bg-card trails-border-primary hover:trails-hover-bg"
47
+ }`}
48
+ onClick={notEnoughBalance ? undefined : onClick}
49
+ disabled={notEnoughBalance}
50
+ >
51
+ <div className="flex items-center space-x-2">
52
+ <TokenImage
53
+ imageUrl={nativeImageUrl}
54
+ symbol={nativeSymbol}
55
+ chainId={chainId}
56
+ size={16}
57
+ />
58
+ <div className="text-left">
59
+ <div
60
+ className={`text-xs font-medium ${
61
+ notEnoughBalance
62
+ ? "text-gray-400 dark:text-gray-500"
63
+ : "trails-text-primary"
64
+ }`}
65
+ >
66
+ {nativeSymbol}
67
+ </div>
68
+ </div>
69
+ </div>
70
+
71
+ <div className="text-right">
72
+ {gasCostNativeDisplay && (
73
+ <div
74
+ className={`text-xs font-medium ${
75
+ notEnoughBalance
76
+ ? "text-gray-400 dark:text-gray-500"
77
+ : "trails-text-primary"
78
+ }`}
79
+ >
80
+ {gasCostNativeDisplay}
81
+ </div>
82
+ )}
83
+ {gasCostUsdDisplay && (
84
+ <div
85
+ className={`text-xs ${
86
+ notEnoughBalance
87
+ ? "text-gray-400 dark:text-gray-500"
88
+ : "trails-text-muted"
89
+ }`}
90
+ >
91
+ {gasCostUsdDisplay}
92
+ </div>
93
+ )}
94
+ </div>
95
+ </button>
96
+ )
97
+ }
98
+
99
+ export default NativeGasOption
@@ -16,6 +16,7 @@ import { useMode } from "../hooks/useMode.js"
16
16
  import { useCurrentScreen } from "../hooks/useCurrentScreen.js"
17
17
  import { useDefaultTokenSelection } from "../hooks/useDefaultTokenSelection.js" // Context version
18
18
  import { usePayMessage } from "../hooks/usePayMessage.js"
19
+ import { useTargetAmount } from "../hooks/useTargetAmount.js"
19
20
  import { TokenImage } from "./TokenImage.js"
20
21
  import { Identicon } from "./Identicon.js"
21
22
  import { TokenSelector } from "./TokenSelector.js"
@@ -24,8 +25,7 @@ import { ChainList } from "./ChainList.js"
24
25
  import { QuoteDetails } from "./QuoteDetails.js"
25
26
  import { ErrorDisplay } from "./ErrorDisplay.js"
26
27
  import { getChainInfo } from "../../chains.js"
27
- import { formatUsdAmountDisplay } from "../../tokenBalances.js"
28
- import { MINIMUM_USD_AMOUNT_FOR_SWAP } from "../../constants.js"
28
+ import { FeeOptions } from "./FeeOptions.js"
29
29
  import { truncateAddress } from "../../utils.js"
30
30
  import type { PrepareSendQuote } from "../../prepareSend.js"
31
31
  import type { SupportedToken } from "../../tokens.js"
@@ -107,6 +107,7 @@ export const Pay: React.FC<PayProps> = ({
107
107
  const { selectedRecipient, setSelectedRecipient } = useSelectedRecipient()
108
108
  const { setAmount: setGlobalAmount } = useSwapAmount()
109
109
  const { setCurrentScreen } = useCurrentScreen()
110
+ const { targetAmountUsd } = useTargetAmount()
110
111
 
111
112
  // Use new default token selection hook
112
113
  const {
@@ -131,6 +132,7 @@ export const Pay: React.FC<PayProps> = ({
131
132
  const [showDestinationChainList, setShowDestinationChainList] =
132
133
  useState(false)
133
134
  const inputRef = useRef<HTMLInputElement>(null)
135
+ const paymentRequestInputRef = useRef<HTMLInputElement>(null)
134
136
  const lastAutoSelectedRef = useRef<string | null>(null)
135
137
 
136
138
  // Get sorted tokens to auto-select origin and destination tokens
@@ -156,11 +158,13 @@ export const Pay: React.FC<PayProps> = ({
156
158
  setSelectedDestinationChain,
157
159
  quoteError,
158
160
  quoteErrorPrettified,
159
- isSameTokenWithoutCustomCalldata,
160
161
  destinationTokenAddress,
161
162
  isValidCustomToken,
162
163
  isSenderContractOnOrigin,
163
164
  isSenderContractOnDestination,
165
+ feeOptions,
166
+ selectedFeeToken,
167
+ setSelectedFeeToken,
164
168
  } = useSendForm({
165
169
  account,
166
170
  toAmount: tokenAmountForBackend || toAmount, // Use the input amount as target amount for EXACT_OUTPUT
@@ -519,6 +523,7 @@ export const Pay: React.FC<PayProps> = ({
519
523
  />
520
524
  <TokenSelector
521
525
  onTokenSelect={handleOriginTokenSelect}
526
+ targetAmountUsd={targetAmountUsd}
522
527
  onError={onError}
523
528
  fundMethod={fundMethod}
524
529
  showContinueButton={false}
@@ -565,6 +570,7 @@ export const Pay: React.FC<PayProps> = ({
565
570
  />
566
571
  <TokenSelector
567
572
  onTokenSelect={handleDestinationTokenSelect}
573
+ targetAmountUsd={targetAmountUsd}
568
574
  onError={onError}
569
575
  fundMethod={fundMethod}
570
576
  showContinueButton={false}
@@ -628,15 +634,24 @@ export const Pay: React.FC<PayProps> = ({
628
634
  <div className="flex justify-between items-center mb-2">
629
635
  <div className="text-sm font-bold trails-text-secondary text-left">
630
636
  Pay with
637
+ {fundMethod === "qr-code"
638
+ ? " QR Code"
639
+ : fundMethod === "exchange"
640
+ ? " Exchange"
641
+ : ""}
631
642
  </div>
632
643
  </div>
633
644
 
634
645
  <div className="flex items-center space-x-2">
635
646
  {/* Amount Display - Non-editable */}
636
647
  <div className="flex-1">
637
- <div className="flex items-center justify-start">
648
+ <div
649
+ className="flex items-center justify-start cursor-text"
650
+ onClick={() => paymentRequestInputRef.current?.focus()}
651
+ >
638
652
  <div className="flex items-center">
639
653
  <input
654
+ ref={paymentRequestInputRef}
640
655
  type="text"
641
656
  value={prepareSendQuote?.originAmountFormatted || ""}
642
657
  readOnly={true}
@@ -803,6 +818,11 @@ export const Pay: React.FC<PayProps> = ({
803
818
  <div className="text-left">
804
819
  <div className="font-medium trails-text-primary text-sm">
805
820
  Pay with
821
+ {fundMethod === "qr-code"
822
+ ? " QR Code"
823
+ : fundMethod === "exchange"
824
+ ? " Exchange"
825
+ : ""}
806
826
  </div>
807
827
  </div>
808
828
 
@@ -857,7 +877,10 @@ export const Pay: React.FC<PayProps> = ({
857
877
  <div className="flex items-center space-x-2">
858
878
  {/* Amount Input */}
859
879
  <div className="flex-1">
860
- <div className="flex items-center justify-start">
880
+ <div
881
+ className="flex items-center justify-start cursor-text"
882
+ onClick={() => inputRef.current?.focus()}
883
+ >
861
884
  <div className="flex items-center">
862
885
  <input
863
886
  ref={inputRef}
@@ -1007,32 +1030,16 @@ export const Pay: React.FC<PayProps> = ({
1007
1030
  </p>
1008
1031
  </div>
1009
1032
  </div>
1010
- ) : prepareSendQuote?.minimumNotMet ? (
1011
- <div className="px-2 py-3 rounded-lg bg-amber-500/10 border border-solid border-amber-500/30">
1012
- <div className="flex items-center space-x-2">
1013
- <svg
1014
- className="w-4 h-4 text-amber-500 flex-shrink-0"
1015
- fill="none"
1016
- stroke="currentColor"
1017
- viewBox="0 0 24 24"
1018
- aria-hidden="true"
1019
- >
1020
- <path
1021
- strokeLinecap="round"
1022
- strokeLinejoin="round"
1023
- strokeWidth={2}
1024
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
1025
- />
1026
- </svg>
1027
- <p className="text-sm text-amber-600 dark:text-amber-400">
1028
- Please enter an amount above{" "}
1029
- {formatUsdAmountDisplay(MINIMUM_USD_AMOUNT_FOR_SWAP)} otherwise
1030
- transfer may fail
1031
- </p>
1032
- </div>
1033
- </div>
1034
1033
  ) : null}
1035
1034
 
1035
+ {/* Fee Options */}
1036
+ <FeeOptions
1037
+ feeOptions={feeOptions || []}
1038
+ selectedFeeToken={selectedFeeToken}
1039
+ setSelectedFeeToken={(token) => setSelectedFeeToken(token as any)}
1040
+ chainId={originToken?.chainId}
1041
+ />
1042
+
1036
1043
  {/* Pay Button */}
1037
1044
  <form onSubmit={handleSubmit}>
1038
1045
  <button
@@ -1046,7 +1053,6 @@ export const Pay: React.FC<PayProps> = ({
1046
1053
  !destinationTokenAddress ||
1047
1054
  !isValidCustomToken ||
1048
1055
  prepareSendQuote?.noSufficientBalance ||
1049
- isSameTokenWithoutCustomCalldata ||
1050
1056
  !prepareSendQuote
1051
1057
  }
1052
1058
  className="w-full font-semibold py-4 px-4 trails-border-radius-button transition-colors bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer relative"
@@ -1056,8 +1062,6 @@ export const Pay: React.FC<PayProps> = ({
1056
1062
  <Loader2 className="w-5 h-5 animate-spin mr-2" />
1057
1063
  <span>{buttonText}</span>
1058
1064
  </div>
1059
- ) : isSameTokenWithoutCustomCalldata ? (
1060
- "Select Different Tokens"
1061
1065
  ) : prepareSendQuote?.noSufficientBalance ? (
1062
1066
  "Insufficient Balance"
1063
1067
  ) : !selectedRecipient ? (
@@ -8,7 +8,6 @@ import type { OnCompleteProps, Token, TokenInfo } from "../hooks/useSendForm.js"
8
8
  import { useSendForm } from "../hooks/useSendForm.js"
9
9
  import type { CheckoutOnHandlers } from "../hooks/useCheckout.js"
10
10
  import { ChainImage } from "./ChainImage.js"
11
- import { FeeOptions } from "./FeeOptions.js"
12
11
  import { TokenImage } from "./TokenImage.js"
13
12
  import { QuoteDetails } from "./QuoteDetails.js"
14
13
  import { TruncatedAddress } from "./TruncatedAddress.js"
@@ -18,8 +17,6 @@ import { getChainInfo, getChainColor } from "../../chains.js"
18
17
  import { formatTvl } from "../../prices.js"
19
18
  import aaveLogo from "../assets/aave.svg"
20
19
  import morphoLogo from "../assets/morpho.svg"
21
- import { formatUsdAmountDisplay } from "../../tokenBalances.js"
22
- import { MINIMUM_USD_AMOUNT_FOR_SWAP } from "../../constants.js"
23
20
  import { ScreenHeader } from "./ScreenHeader.js"
24
21
  import { ErrorDisplay } from "./ErrorDisplay.js"
25
22
  import { useMode } from "../hooks/useMode.js"
@@ -136,9 +133,6 @@ export const PaySendForm: React.FC<PaySendFormProps> = ({
136
133
  buttonText,
137
134
  isValidRecipient,
138
135
  ensAddress,
139
- selectedFeeToken,
140
- setSelectedFeeToken,
141
- feeOptions,
142
136
  supportedTokens,
143
137
  setIsChainDropdownOpen,
144
138
  setIsTokenDropdownOpen,
@@ -744,13 +738,6 @@ export const PaySendForm: React.FC<PaySendFormProps> = ({
744
738
  chainId={selectedDestinationChain.id}
745
739
  /> */}
746
740
 
747
- {/* Fee Options */}
748
- <FeeOptions
749
- options={feeOptions}
750
- selectedOption={selectedFeeToken ?? undefined}
751
- onSelect={setSelectedFeeToken}
752
- />
753
-
754
741
  {/* Warning Messages - Show only one at a time */}
755
742
  {isSameTokenWithoutCustomCalldata ? (
756
743
  <ErrorDisplay
@@ -786,30 +773,6 @@ export const PaySendForm: React.FC<PaySendFormProps> = ({
786
773
  </p>
787
774
  </div>
788
775
  </div>
789
- ) : prepareSendQuote?.minimumNotMet ? (
790
- <div className="px-2 py-3 rounded-lg bg-amber-500/10 border border-solid border-amber-500/30">
791
- <div className="flex items-center space-x-2">
792
- <svg
793
- className="w-4 h-4 text-amber-500 flex-shrink-0"
794
- fill="none"
795
- stroke="currentColor"
796
- viewBox="0 0 24 24"
797
- aria-hidden="true"
798
- >
799
- <path
800
- strokeLinecap="round"
801
- strokeLinejoin="round"
802
- strokeWidth={2}
803
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
804
- />
805
- </svg>
806
- <p className="text-sm text-amber-600 dark:text-amber-400">
807
- Please enter an amount above{" "}
808
- {formatUsdAmountDisplay(MINIMUM_USD_AMOUNT_FOR_SWAP)} otherwise
809
- transfer may fail
810
- </p>
811
- </div>
812
- </div>
813
776
  ) : null}
814
777
 
815
778
  <button
@@ -271,35 +271,6 @@ export const QuoteDetails: React.FC<QuoteDetailsProps> = ({
271
271
  </div>
272
272
  )}
273
273
 
274
- {/* Minimum Amount Warning */}
275
- {quote?.minimumNotMet && (
276
- <div className="flex justify-between items-center">
277
- <span className="text-xs text-amber-600 dark:text-amber-400 flex items-center gap-1">
278
- Minimum Not Met:
279
- <Tooltip message="The transaction amount is below the minimum threshold and may fail">
280
- <InfoIcon className="w-3 h-3 text-amber-500 dark:text-amber-400 cursor-pointer" />
281
- </Tooltip>
282
- </span>
283
- <span className="font-medium text-xs text-amber-600 dark:text-amber-400 flex items-center gap-1">
284
- <svg
285
- className="w-3 h-3"
286
- fill="none"
287
- stroke="currentColor"
288
- viewBox="0 0 24 24"
289
- aria-hidden="true"
290
- >
291
- <path
292
- strokeLinecap="round"
293
- strokeLinejoin="round"
294
- strokeWidth={2}
295
- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
296
- />
297
- </svg>
298
- Transfer may fail
299
- </span>
300
- </div>
301
- )}
302
-
303
274
  {quote?.originTokenRate && quote?.destinationTokenRate && (
304
275
  <div className="flex justify-between items-center">
305
276
  <span className="text-xs text-gray-600 dark:text-gray-400 flex items-center gap-1">
@@ -477,6 +477,17 @@ export const TokenSelector: React.FC<TokenSelectorProps> = ({
477
477
  </div>
478
478
  )}
479
479
 
480
+ {/* Fund method label */}
481
+ {(fundMethod === "qr-code" || fundMethod === "exchange") && (
482
+ <div className="text-center pt-2 pb-1">
483
+ <p className="text-sm font-medium text-gray-600 dark:text-gray-400">
484
+ {fundMethod === "qr-code"
485
+ ? "Paying with QR Code Deposit"
486
+ : "Paying with Exchange Deposit"}
487
+ </p>
488
+ </div>
489
+ )}
490
+
480
491
  {/* Pay with another method button */}
481
492
  {onNavigateToFundMethods && !isLoadingTokens && (
482
493
  <div className="text-center pt-1">
@@ -368,7 +368,7 @@ export const TransferPending: React.FC<TransferPendingProps> = ({
368
368
  headerContent={
369
369
  mode === "swap" ? "Swap in progress" : "Transaction Status"
370
370
  }
371
- headerContentAlign="left"
371
+ headerContentAlign="center"
372
372
  />
373
373
  </div>
374
374
 
@@ -14,8 +14,7 @@ interface UserPreferencesProps {
14
14
  export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
15
15
  const { isBalanceVisible, toggleBalanceVisible, resetBalanceVisible } =
16
16
  useBalanceVisible()
17
- const { isSimpleSwapMode, toggleSimpleSwapMode, resetSwapSettings } =
18
- useSwapSettings()
17
+ const { resetSwapSettings } = useSwapSettings()
19
18
  const { selectedTheme, setSelectedTheme, resetThemePreference } =
20
19
  useThemePreference()
21
20
  const { customCss, theme: widgetTheme } = useWidgetProps()
@@ -77,7 +76,7 @@ export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
77
76
  </div>
78
77
 
79
78
  {/* Simple Swap UI Setting */}
80
- <div className="flex items-center justify-between">
79
+ {/* <div className="flex items-center justify-between">
81
80
  <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
82
81
  Simple Swap UI
83
82
  </span>
@@ -94,7 +93,7 @@ export const UserPreferences: React.FC<UserPreferencesProps> = ({ onBack }) => {
94
93
  }`}
95
94
  />
96
95
  </button>
97
- </div>
96
+ </div> */}
98
97
 
99
98
  {/* Theme Setting */}
100
99
  <div className="flex items-center justify-between">
@@ -8,6 +8,7 @@ interface BackContextType {
8
8
  canGoBack: boolean
9
9
  clearHistory: () => void
10
10
  isNavigatingBack: boolean
11
+ getHistory: () => Screen[]
11
12
  }
12
13
 
13
14
  const BackContext = createContext<BackContextType | null>(null)
@@ -83,11 +84,14 @@ export function BackProvider({ children }: BackProviderProps) {
83
84
  setHistory([currentScreen])
84
85
  }
85
86
 
87
+ const getHistory = () => history
88
+
86
89
  const value: BackContextType = {
87
90
  goBack,
88
91
  canGoBack,
89
92
  clearHistory,
90
93
  isNavigatingBack,
94
+ getHistory,
91
95
  }
92
96
 
93
97
  return <BackContext.Provider value={value}>{children}</BackContext.Provider>
@@ -16,6 +16,7 @@ export type Screen =
16
16
  | "pending"
17
17
  | "receipt"
18
18
  | "mesh-connect"
19
+ | "mesh-connect-exchanges"
19
20
  | "wallet-connect"
20
21
  | "wallet-list"
21
22
  | "wallet-connection-pending"
@@ -12,7 +12,6 @@ import { useIndexerGatewayClient } from "../../indexerClient.js"
12
12
  import { useSupportedTokens } from "../../tokens.js"
13
13
  import { getChainInfo } from "../../chains.js"
14
14
  import { logger } from "../../logger.js"
15
- import { MINIMUM_USD_AMOUNT_FOR_SWAP } from "../../constants.js"
16
15
 
17
16
  const MINIMUM_24H_VOLUME_USD = 1_000_000 // $1M
18
17
 
@@ -253,9 +252,8 @@ function useDefaultTokenSelectionInternal(): UseDefaultTokenSelectionReturn {
253
252
  if (toToken && toChainId) {
254
253
  const targetChainId = Number(toChainId)
255
254
 
256
- // Use targetAmountUsd if available, otherwise use minimum amount for swap when toToken is set
257
- const effectiveTargetAmount =
258
- targetAmountUsd ?? Number(MINIMUM_USD_AMOUNT_FOR_SWAP)
255
+ // Use targetAmountUsd if available, otherwise use a minimal threshold when toToken is set
256
+ const effectiveTargetAmount = targetAmountUsd ?? 0.01
259
257
 
260
258
  // Filter tokens that can cover the target amount
261
259
  const tokensWithSufficientBalance = tokensWithBalance.filter(
@@ -428,9 +426,7 @@ function useDefaultTokenSelectionInternal(): UseDefaultTokenSelectionReturn {
428
426
  toChainId,
429
427
  targetAmountUsd,
430
428
  effectiveTargetAmount:
431
- toToken && toChainId
432
- ? (targetAmountUsd ?? Number(MINIMUM_USD_AMOUNT_FOR_SWAP))
433
- : null,
429
+ toToken && toChainId ? (targetAmountUsd ?? 0.01) : null,
434
430
  })
435
431
 
436
432
  return {