0xtrails 0.9.0 → 0.9.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-3JTFJIx6.js → ccip-g6lDdnrD.js} +1 -1
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/{index-DcL9VF7o.js → index-D-QngA_s.js} +66447 -66407
- package/dist/index.js +3 -3
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/widget/components/FiatSelector.d.ts.map +1 -1
- package/dist/widget/components/OnrampProviderConfirmation.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
- package/dist/widget/index.js +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts +0 -2
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/widget.d.ts +0 -1
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/constants.ts +1781 -0
- package/src/onrampClient.ts +2 -2
- package/src/prepareSend.ts +8 -5
- package/src/widget/components/FiatSelector.tsx +1 -1781
- package/src/widget/components/MeldForm.tsx +2 -2
- package/src/widget/components/MeldStepsFlow.tsx +2 -2
- package/src/widget/components/OnrampProviderConfirmation.tsx +121 -53
- package/src/widget/components/Receipt.tsx +1 -1
- package/src/widget/components/Swap.tsx +1 -1
- package/src/widget/components/TransferPendingVertical.tsx +1 -1
- package/src/widget/components/WalletConfirmation.tsx +1 -1
- package/src/widget/providers/TrailsProvider.tsx +0 -6
- package/src/widget/widget.tsx +1 -4
|
@@ -234,8 +234,8 @@ export const MeldForm: React.FC<MeldFormProps> = ({
|
|
|
234
234
|
|
|
235
235
|
// Create OnrampClient client
|
|
236
236
|
const trailsClient = useMemo(() => {
|
|
237
|
-
return getMeldOnrampClient(trailsApiKey, trailsConfig?.
|
|
238
|
-
}, [trailsApiKey, trailsConfig?.
|
|
237
|
+
return getMeldOnrampClient(trailsApiKey, trailsConfig?.trailsApiUrl)
|
|
238
|
+
}, [trailsApiKey, trailsConfig?.trailsApiUrl])
|
|
239
239
|
|
|
240
240
|
// Fetch payment methods to get details including images
|
|
241
241
|
const { paymentMethods } = useMeldPaymentMethods(trailsClient, currency)
|
|
@@ -184,9 +184,9 @@ export const MeldStepsFlow: React.FC<MeldStepsFlowProps> = ({
|
|
|
184
184
|
const trailsClient = useMemo(() => {
|
|
185
185
|
return getMeldOnrampClient(
|
|
186
186
|
trailsConfig.trailsApiKey,
|
|
187
|
-
trailsConfig.
|
|
187
|
+
trailsConfig.trailsApiUrl,
|
|
188
188
|
)
|
|
189
|
-
}, [trailsConfig.trailsApiKey, trailsConfig.
|
|
189
|
+
}, [trailsConfig.trailsApiKey, trailsConfig.trailsApiUrl])
|
|
190
190
|
|
|
191
191
|
const [currentScreen, setCurrentScreen] = useState<Screen>("menu")
|
|
192
192
|
|
|
@@ -10,7 +10,61 @@ import { useDepositMonitor } from "../hooks/useDepositMonitor.js"
|
|
|
10
10
|
import { logger } from "../../logger.js"
|
|
11
11
|
import { TruncatedTransactionHash } from "./TruncatedTransactionHash.js"
|
|
12
12
|
import { useAccount } from "wagmi"
|
|
13
|
-
import { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
13
|
+
import type { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
14
|
+
import { TokenImage } from "./TokenImage.js"
|
|
15
|
+
|
|
16
|
+
// TokenDiagram component for displaying the token flow
|
|
17
|
+
interface TokenDiagramProps {
|
|
18
|
+
onRampQuote?: OnrampQuote | null
|
|
19
|
+
quote?: PrepareSendQuote | null
|
|
20
|
+
tokenSize?: number
|
|
21
|
+
className?: string
|
|
22
|
+
textClassName?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const TokenDiagram: React.FC<TokenDiagramProps> = ({
|
|
26
|
+
onRampQuote,
|
|
27
|
+
quote,
|
|
28
|
+
tokenSize = 20,
|
|
29
|
+
className = "mt-4 text-sm text-gray-700 dark:text-gray-300 flex items-center gap-3 justify-center",
|
|
30
|
+
textClassName = "font-medium",
|
|
31
|
+
}) => {
|
|
32
|
+
if (
|
|
33
|
+
!onRampQuote?.sourceCurrencyCode ||
|
|
34
|
+
!quote?.originToken ||
|
|
35
|
+
!quote?.destinationToken
|
|
36
|
+
) {
|
|
37
|
+
return null
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className={className}>
|
|
42
|
+
<span className={textClassName}>{onRampQuote.sourceCurrencyCode}</span>
|
|
43
|
+
<span className="text-gray-500 dark:text-gray-400">→</span>
|
|
44
|
+
<div className="flex items-center gap-2">
|
|
45
|
+
<TokenImage
|
|
46
|
+
imageUrl={quote.originToken.imageUrl}
|
|
47
|
+
symbol={quote.originToken.symbol}
|
|
48
|
+
chainId={quote.originChain?.id}
|
|
49
|
+
contractAddress={quote.originToken.contractAddress}
|
|
50
|
+
size={tokenSize}
|
|
51
|
+
/>
|
|
52
|
+
<span className={textClassName}>{quote.originToken.symbol}</span>
|
|
53
|
+
</div>
|
|
54
|
+
<span className="text-gray-500 dark:text-gray-400">→</span>
|
|
55
|
+
<div className="flex items-center gap-2">
|
|
56
|
+
<TokenImage
|
|
57
|
+
imageUrl={quote.destinationToken.imageUrl}
|
|
58
|
+
symbol={quote.destinationToken.symbol}
|
|
59
|
+
chainId={quote.destinationChain?.id}
|
|
60
|
+
contractAddress={quote.destinationToken.contractAddress}
|
|
61
|
+
size={tokenSize}
|
|
62
|
+
/>
|
|
63
|
+
<span className={textClassName}>{quote.destinationToken.symbol}</span>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
14
68
|
|
|
15
69
|
// Helper function to get centered window parameters
|
|
16
70
|
const getCenteredWindowParams = (width: number, height: number): string => {
|
|
@@ -721,7 +775,7 @@ export const OnrampProviderConfirmation: React.FC<
|
|
|
721
775
|
</div>
|
|
722
776
|
|
|
723
777
|
{/* Content */}
|
|
724
|
-
<div className="flex-1">
|
|
778
|
+
<div className="flex-1 text-left">
|
|
725
779
|
<p className={`text-sm font-medium ${textColorClasses[color]}`}>
|
|
726
780
|
{getStatusMessage(transaction.status)}
|
|
727
781
|
</p>
|
|
@@ -743,14 +797,6 @@ export const OnrampProviderConfirmation: React.FC<
|
|
|
743
797
|
transaction.destinationCurrencyCode}
|
|
744
798
|
</p>
|
|
745
799
|
)}
|
|
746
|
-
{/* Session ID - subtle display */}
|
|
747
|
-
{externalSessionId && (
|
|
748
|
-
<p
|
|
749
|
-
className={`text-xs mt-2 ${textColorClasses[color]} opacity-50`}
|
|
750
|
-
>
|
|
751
|
-
Session: {externalSessionId}
|
|
752
|
-
</p>
|
|
753
|
-
)}
|
|
754
800
|
</div>
|
|
755
801
|
</div>
|
|
756
802
|
</div>
|
|
@@ -759,43 +805,50 @@ export const OnrampProviderConfirmation: React.FC<
|
|
|
759
805
|
|
|
760
806
|
// Default case: we have external session ID but no transaction yet
|
|
761
807
|
return (
|
|
762
|
-
|
|
763
|
-
<div className="
|
|
764
|
-
<div className="flex-
|
|
765
|
-
<
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
<
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
</p>
|
|
808
|
+
<>
|
|
809
|
+
<div className="mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-700">
|
|
810
|
+
<div className="flex items-start space-x-3">
|
|
811
|
+
<div className="flex-shrink-0 mt-0.5">
|
|
812
|
+
<svg
|
|
813
|
+
className="w-5 h-5 text-blue-600 dark:text-blue-400 animate-spin"
|
|
814
|
+
fill="none"
|
|
815
|
+
viewBox="0 0 24 24"
|
|
816
|
+
>
|
|
817
|
+
<title>Loading</title>
|
|
818
|
+
<circle
|
|
819
|
+
className="opacity-25"
|
|
820
|
+
cx="12"
|
|
821
|
+
cy="12"
|
|
822
|
+
r="10"
|
|
823
|
+
stroke="currentColor"
|
|
824
|
+
strokeWidth="4"
|
|
825
|
+
/>
|
|
826
|
+
<path
|
|
827
|
+
className="opacity-75"
|
|
828
|
+
fill="currentColor"
|
|
829
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
830
|
+
/>
|
|
831
|
+
</svg>
|
|
832
|
+
</div>
|
|
833
|
+
<div className="flex-1">
|
|
834
|
+
<p className="text-sm font-medium text-blue-800 dark:text-blue-200">
|
|
835
|
+
Initializing payment monitoring
|
|
836
|
+
</p>
|
|
837
|
+
<p className="text-xs mt-1 text-blue-800 dark:text-blue-200 opacity-75">
|
|
838
|
+
Status: INITIALIZING
|
|
839
|
+
</p>
|
|
840
|
+
</div>
|
|
796
841
|
</div>
|
|
797
842
|
</div>
|
|
798
|
-
|
|
843
|
+
{/* Onramp quote info - subtle display - outside status div */}
|
|
844
|
+
<TokenDiagram
|
|
845
|
+
onRampQuote={onRampQuote}
|
|
846
|
+
quote={quote}
|
|
847
|
+
tokenSize={14}
|
|
848
|
+
className="text-xs mt-2 text-gray-600 dark:text-gray-400 opacity-70 flex items-center gap-2 justify-center"
|
|
849
|
+
textClassName=""
|
|
850
|
+
/>
|
|
851
|
+
</>
|
|
799
852
|
)
|
|
800
853
|
}
|
|
801
854
|
|
|
@@ -880,13 +933,18 @@ export const OnrampProviderConfirmation: React.FC<
|
|
|
880
933
|
|
|
881
934
|
{/* Warning */}
|
|
882
935
|
{!isCountingUp && (
|
|
883
|
-
<p className="mt-4 text-sm text-gray-600 dark:text-gray-400">
|
|
884
|
-
Complete the payment within the time limit
|
|
885
|
-
|
|
936
|
+
<p className="mt-4 text-sm text-left text-gray-600 dark:text-gray-400">
|
|
937
|
+
Complete the payment within the time limit. We use USDC on Base
|
|
938
|
+
network as the intermediary token, please do not change it.
|
|
886
939
|
</p>
|
|
887
940
|
)}
|
|
941
|
+
<TokenDiagram
|
|
942
|
+
onRampQuote={onRampQuote}
|
|
943
|
+
quote={quote}
|
|
944
|
+
tokenSize={20}
|
|
945
|
+
/>
|
|
888
946
|
{isCountingUp && (
|
|
889
|
-
<p className="mt-4 text-sm text-gray-600 dark:text-gray-400">
|
|
947
|
+
<p className="mt-4 text-sm text-left text-gray-600 dark:text-gray-400">
|
|
890
948
|
Your transaction is settling with payment provider. This usually
|
|
891
949
|
takes 1-5 minutes to complete.
|
|
892
950
|
</p>
|
|
@@ -900,10 +958,20 @@ export const OnrampProviderConfirmation: React.FC<
|
|
|
900
958
|
|
|
901
959
|
{/* Important Notice - Now at the bottom */}
|
|
902
960
|
<div className="mt-3 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-700">
|
|
903
|
-
<
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
961
|
+
<div className="flex items-start space-x-3">
|
|
962
|
+
{/* Icon */}
|
|
963
|
+
<div className="flex-shrink-0 mt-0.5">
|
|
964
|
+
<span className="text-amber-600 dark:text-amber-400">⚠️</span>
|
|
965
|
+
</div>
|
|
966
|
+
|
|
967
|
+
{/* Content */}
|
|
968
|
+
<div className="flex-1 text-left">
|
|
969
|
+
<p className="text-sm font-medium text-amber-800 dark:text-amber-200">
|
|
970
|
+
Important: Do not close this window or navigate away while
|
|
971
|
+
your payment is processing.
|
|
972
|
+
</p>
|
|
973
|
+
</div>
|
|
974
|
+
</div>
|
|
907
975
|
</div>
|
|
908
976
|
</div>
|
|
909
977
|
|
|
@@ -17,7 +17,7 @@ import { useMode } from "../hooks/useMode.js"
|
|
|
17
17
|
import { ScreenHeader } from "./ScreenHeader.js"
|
|
18
18
|
import { getExplorerUrl } from "../../explorer.js"
|
|
19
19
|
import { logger } from "../../logger.js"
|
|
20
|
-
import { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
20
|
+
import type { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
21
21
|
|
|
22
22
|
interface ReceiptProps {
|
|
23
23
|
onSendAnother?: () => void
|
|
@@ -6,7 +6,7 @@ import type { Token } from "../../tokens.js"
|
|
|
6
6
|
import type { CheckoutOnHandlers } from "../hooks/useCheckout.js"
|
|
7
7
|
import type { PrepareSendQuote } from "../../prepareSend.js"
|
|
8
8
|
import { ClassicSwap } from "./ClassicSwap.js"
|
|
9
|
-
import { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
9
|
+
import type { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
10
10
|
|
|
11
11
|
interface SwapProps {
|
|
12
12
|
selectedToken: Token | null
|
|
@@ -11,7 +11,7 @@ import { ScreenHeader } from "./ScreenHeader.js"
|
|
|
11
11
|
import { ChevronRight } from "lucide-react"
|
|
12
12
|
import { useMode } from "../hooks/useMode.js"
|
|
13
13
|
import { TRAILS_SUPPORT_URL } from "../../constants.js"
|
|
14
|
-
import { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
14
|
+
import type { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
15
15
|
|
|
16
16
|
// Checkmark icon for completed steps
|
|
17
17
|
const CheckmarkIcon = () => (
|
|
@@ -8,7 +8,7 @@ import { QuoteDetails } from "./QuoteDetails.js"
|
|
|
8
8
|
import { WaasFeeOptions } from "./WaasFeeOptions.js"
|
|
9
9
|
import { useAccount } from "wagmi"
|
|
10
10
|
import { logger } from "../../logger.js"
|
|
11
|
-
import { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
11
|
+
import type { OnrampQuote } from "../hooks/useOnRampQuote.js"
|
|
12
12
|
|
|
13
13
|
interface WalletConfirmationProps {
|
|
14
14
|
onBack?: () => void
|
|
@@ -35,7 +35,6 @@ export interface TrailsConfig {
|
|
|
35
35
|
// Onramp feature flags
|
|
36
36
|
fundOnramp: boolean
|
|
37
37
|
buyCryptoOnramp: boolean
|
|
38
|
-
trailsMeldApi: string
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
export interface TrailsProviderProps {
|
|
@@ -53,8 +52,6 @@ export interface TrailsProviderProps {
|
|
|
53
52
|
// Onramp feature flags
|
|
54
53
|
fundOnramp?: boolean
|
|
55
54
|
buyCryptoOnramp?: boolean
|
|
56
|
-
// Optional Meld API URL to make it easy to test Meld integration with a local API
|
|
57
|
-
trailsMeldApi?: string
|
|
58
55
|
}
|
|
59
56
|
}
|
|
60
57
|
|
|
@@ -81,8 +78,6 @@ export const TrailsProvider = ({ children, config }: TrailsProviderProps) => {
|
|
|
81
78
|
// Onramp feature flags with defaults
|
|
82
79
|
fundOnramp: config.fundOnramp ?? false,
|
|
83
80
|
buyCryptoOnramp: config.buyCryptoOnramp ?? false,
|
|
84
|
-
trailsMeldApi:
|
|
85
|
-
config.trailsMeldApi || config.trailsApiUrl || PROD_TRAILS_API_URL,
|
|
86
81
|
} satisfies TrailsConfig
|
|
87
82
|
}, [
|
|
88
83
|
config.trailsApiKey,
|
|
@@ -96,7 +91,6 @@ export const TrailsProvider = ({ children, config }: TrailsProviderProps) => {
|
|
|
96
91
|
config.debug,
|
|
97
92
|
config.fundOnramp,
|
|
98
93
|
config.buyCryptoOnramp,
|
|
99
|
-
config.trailsMeldApi,
|
|
100
94
|
])
|
|
101
95
|
|
|
102
96
|
// Set global debug mode for backward compatibility with getDebug()
|
package/src/widget/widget.tsx
CHANGED
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
import { useTrailsModal } from "./providers/TrailsModalProvider.js"
|
|
140
140
|
import { usePreviousScreen } from "./hooks/usePreviousScreen.js"
|
|
141
141
|
import PaymentMethods from "./components/PaymentMethods.js"
|
|
142
|
-
import { OnrampQuote } from "./hooks/useOnRampQuote.js"
|
|
142
|
+
import type { OnrampQuote } from "./hooks/useOnRampQuote.js"
|
|
143
143
|
|
|
144
144
|
// Validate toToken - must be "ETH", "USDC", or a valid hex address
|
|
145
145
|
const isValidToToToken = (toToken: string | null | undefined) => {
|
|
@@ -253,8 +253,6 @@ export type TrailsWidgetProps = {
|
|
|
253
253
|
// Feature flags
|
|
254
254
|
fundOnramp?: boolean
|
|
255
255
|
buyCryptoOnramp?: boolean
|
|
256
|
-
// Optional Meld API URL to make it easy to test Meld integration with a local API
|
|
257
|
-
trailsMeldApi?: string
|
|
258
256
|
}
|
|
259
257
|
|
|
260
258
|
export interface TrailsWidgetRef {
|
|
@@ -2874,7 +2872,6 @@ export const TrailsWidget = forwardRef<TrailsWidgetRef, TrailsWidgetProps>(
|
|
|
2874
2872
|
debug: props.debug,
|
|
2875
2873
|
fundOnramp: props.fundOnramp,
|
|
2876
2874
|
buyCryptoOnramp: props.buyCryptoOnramp,
|
|
2877
|
-
trailsMeldApi: props.trailsMeldApi,
|
|
2878
2875
|
}
|
|
2879
2876
|
|
|
2880
2877
|
logger.console.log("trailsConfig", trailsConfig)
|