0xtrails 0.1.2 → 0.1.4
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/address.d.ts.map +1 -1
- package/dist/analytics.d.ts +86 -1
- package/dist/analytics.d.ts.map +1 -1
- package/dist/apiClient.d.ts +1 -1
- package/dist/apiClient.d.ts.map +1 -1
- package/dist/{ccip-BmFTEOaB.js → ccip-dLSEJjCf.js} +55 -55
- package/dist/cctpqueue.d.ts +1 -1
- package/dist/cctpqueue.d.ts.map +1 -1
- package/dist/chains.d.ts +9 -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/decoders.d.ts +58 -0
- package/dist/decoders.d.ts.map +1 -0
- package/dist/ens.d.ts +13 -0
- package/dist/ens.d.ts.map +1 -0
- package/dist/error.d.ts +9 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/{index-BPsVj7zK.js → index-BXbaLmtt.js} +28779 -25738
- package/dist/index.js +2 -2
- package/dist/intents.d.ts +4 -4
- package/dist/intents.d.ts.map +1 -1
- package/dist/lifi.d.ts +4 -0
- package/dist/lifi.d.ts.map +1 -0
- package/dist/metaTxns.d.ts +1 -1
- package/dist/metaTxns.d.ts.map +1 -1
- package/dist/mode.d.ts +1 -1
- package/dist/mode.d.ts.map +1 -1
- package/dist/preconditions.d.ts +1 -1
- package/dist/preconditions.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +32 -24
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +3 -1
- package/dist/prices.d.ts.map +1 -1
- package/dist/proxyCaller.d.ts +0 -1
- package/dist/proxyCaller.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 +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 +4 -4
- package/dist/trails.d.ts.map +1 -1
- package/dist/transactions.d.ts +4 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.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/ErrorDisplay.d.ts +9 -0
- package/dist/widget/components/ErrorDisplay.d.ts.map +1 -0
- package/dist/widget/components/FundSendForm.d.ts +2 -2
- package/dist/widget/components/FundSendForm.d.ts.map +1 -1
- package/dist/widget/components/OriginTransferInformation.d.ts +10 -0
- package/dist/widget/components/OriginTransferInformation.d.ts.map +1 -0
- 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/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/Receive.d.ts +12 -0
- package/dist/widget/components/Receive.d.ts.map +1 -0
- 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 +47 -0
- package/dist/widget/components/Swap.d.ts.map +1 -0
- package/dist/widget/components/SwapDisplay.d.ts +9 -0
- package/dist/widget/components/SwapDisplay.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/TransferPendingVertical.d.ts +2 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- 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/components/YellowWarningAnimation.d.ts +2 -0
- package/dist/widget/components/YellowWarningAnimation.d.ts.map +1 -0
- 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/useDebugScreens.d.ts +22 -0
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +12 -6
- 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 +19 -15
- package/src/aave.ts +13 -13
- package/src/address.ts +3 -0
- package/src/analytics.ts +192 -8
- package/src/apiClient.ts +1 -1
- package/src/cctpqueue.ts +1 -1
- package/src/chains.ts +45 -7
- package/src/constants.ts +7 -4
- package/src/decoders.ts +310 -0
- package/src/ens.ts +32 -0
- package/src/error.ts +101 -1
- package/src/intents.ts +10 -2
- package/src/lifi.ts +58 -0
- package/src/metaTxns.ts +1 -1
- package/src/mode.ts +1 -1
- package/src/morpho.ts +3 -3
- package/src/pools.ts +18 -18
- package/src/preconditions.ts +1 -1
- package/src/prepareSend.ts +463 -113
- package/src/prices.ts +26 -1
- package/src/proxyCaller.ts +2 -14
- package/src/relaySdk.ts +1 -0
- package/src/relayer.ts +8 -0
- package/src/tokenBalances.ts +24 -17
- package/src/tokens.ts +147 -22
- package/src/trails.ts +4 -4
- package/src/transactions.ts +35 -17
- package/src/utils.ts +28 -0
- package/src/wallets.ts +275 -35
- package/src/widget/compiled.css +2 -2
- 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 +6 -0
- package/src/widget/components/ErrorDisplay.tsx +150 -0
- package/src/widget/components/FundSendForm.tsx +78 -11
- package/src/widget/components/OriginTransferInformation.tsx +59 -0
- package/src/widget/components/PaySendForm.tsx +80 -13
- package/src/widget/components/QRCodeDeposit.tsx +6 -6
- package/src/widget/components/QrCode.tsx +278 -17
- package/src/widget/components/QuoteDetails.tsx +93 -25
- package/src/widget/components/Receipt.tsx +296 -103
- package/src/widget/components/Receive.tsx +146 -0
- package/src/widget/components/RecentTokens.tsx +1 -1
- package/src/widget/components/RefundAddressInput.tsx +149 -0
- package/src/widget/components/Swap.tsx +769 -0
- package/src/widget/components/SwapDisplay.tsx +68 -0
- package/src/widget/components/TokenList.tsx +27 -363
- package/src/widget/components/TokenSelector.tsx +405 -0
- package/src/widget/components/TransferPendingVertical.tsx +162 -112
- 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/components/YellowWarningAnimation.tsx +146 -0
- package/src/widget/hooks/useAmountUsd.ts +3 -8
- package/src/widget/hooks/useCheckout.ts +3 -2
- package/src/widget/hooks/useDebugScreens.ts +583 -0
- package/src/widget/hooks/useSendForm.ts +111 -35
- package/src/widget/hooks/useTokenList.ts +155 -122
- package/src/widget/widget.tsx +503 -523
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { type CSSProperties, useEffect, useState } from "react"
|
|
2
|
+
|
|
3
|
+
export function YellowWarningAnimation() {
|
|
4
|
+
const [animate, setAnimate] = useState(false)
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const timer = setTimeout(() => {
|
|
8
|
+
setAnimate(true)
|
|
9
|
+
}, 100)
|
|
10
|
+
|
|
11
|
+
return () => clearTimeout(timer)
|
|
12
|
+
}, [])
|
|
13
|
+
|
|
14
|
+
const styles: Record<string, CSSProperties> = {
|
|
15
|
+
container: {
|
|
16
|
+
width: "80px",
|
|
17
|
+
height: "80px",
|
|
18
|
+
position: "relative" as const,
|
|
19
|
+
},
|
|
20
|
+
circleContainer: {
|
|
21
|
+
position: "relative" as const,
|
|
22
|
+
width: "100%",
|
|
23
|
+
height: "100%",
|
|
24
|
+
},
|
|
25
|
+
circleFill: {
|
|
26
|
+
position: "absolute" as const,
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
width: "100%",
|
|
30
|
+
height: "100%",
|
|
31
|
+
borderRadius: "50%",
|
|
32
|
+
backgroundColor: "#f59e0b",
|
|
33
|
+
transform: animate ? "scale(1)" : "scale(0)",
|
|
34
|
+
opacity: animate ? 1 : 0,
|
|
35
|
+
transition: "transform 0.15s ease-out 0.3s, opacity 0.15s ease-out 0.3s",
|
|
36
|
+
},
|
|
37
|
+
progressRing: {
|
|
38
|
+
position: "absolute" as const,
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
width: "100%",
|
|
42
|
+
height: "100%",
|
|
43
|
+
transform: "rotate(-90deg)",
|
|
44
|
+
},
|
|
45
|
+
circle: {
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "url(#yellowGradient)",
|
|
48
|
+
strokeWidth: 4,
|
|
49
|
+
strokeLinecap: "round" as const,
|
|
50
|
+
strokeDasharray: 226,
|
|
51
|
+
strokeDashoffset: animate ? 0 : 226,
|
|
52
|
+
transition: "stroke-dashoffset 0.3s ease-out",
|
|
53
|
+
},
|
|
54
|
+
iconContainer: {
|
|
55
|
+
position: "absolute" as const,
|
|
56
|
+
top: "50%",
|
|
57
|
+
left: "50%",
|
|
58
|
+
transform: animate
|
|
59
|
+
? "translate(-50%, -50%) scale(1)"
|
|
60
|
+
: "translate(-50%, -50%) scale(0)",
|
|
61
|
+
opacity: animate ? 1 : 0,
|
|
62
|
+
zIndex: 10,
|
|
63
|
+
transition: "transform 0.1s ease-out 0.4s, opacity 0.1s ease-out 0.4s",
|
|
64
|
+
},
|
|
65
|
+
trianglePath: {
|
|
66
|
+
fill: "none",
|
|
67
|
+
stroke: "white",
|
|
68
|
+
strokeWidth: 2.5,
|
|
69
|
+
strokeLinecap: "round" as const,
|
|
70
|
+
strokeLinejoin: "round" as const,
|
|
71
|
+
// Approx perimeter; animate drawing
|
|
72
|
+
strokeDasharray: 120,
|
|
73
|
+
strokeDashoffset: animate ? 0 : 120,
|
|
74
|
+
transition: "stroke-dashoffset 0.2s ease-out 0.45s",
|
|
75
|
+
},
|
|
76
|
+
exclamationPath: {
|
|
77
|
+
fill: "none",
|
|
78
|
+
stroke: "white",
|
|
79
|
+
strokeWidth: 2.5,
|
|
80
|
+
strokeLinecap: "round" as const,
|
|
81
|
+
strokeLinejoin: "round" as const,
|
|
82
|
+
strokeDasharray: 20,
|
|
83
|
+
strokeDashoffset: animate ? 0 : 20,
|
|
84
|
+
transition: "stroke-dashoffset 0.15s ease-out 0.55s",
|
|
85
|
+
},
|
|
86
|
+
dot: {
|
|
87
|
+
fill: "white",
|
|
88
|
+
opacity: animate ? 1 : 0,
|
|
89
|
+
transition: "opacity 0.1s ease-out 0.65s",
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div style={styles.container}>
|
|
95
|
+
<div style={styles.circleContainer}>
|
|
96
|
+
{/* Circle fill */}
|
|
97
|
+
<div style={styles.circleFill} />
|
|
98
|
+
|
|
99
|
+
{/* Progress ring */}
|
|
100
|
+
<svg style={styles.progressRing}>
|
|
101
|
+
<defs>
|
|
102
|
+
<radialGradient
|
|
103
|
+
id="yellowGradient"
|
|
104
|
+
cx="50%"
|
|
105
|
+
cy="50%"
|
|
106
|
+
r="50%"
|
|
107
|
+
gradientUnits="objectBoundingBox"
|
|
108
|
+
>
|
|
109
|
+
<stop
|
|
110
|
+
offset="0%"
|
|
111
|
+
style={{ stopColor: "#f59e0b", stopOpacity: 0 }}
|
|
112
|
+
/>
|
|
113
|
+
<stop
|
|
114
|
+
offset="70%"
|
|
115
|
+
style={{ stopColor: "#f59e0b", stopOpacity: 0.3 }}
|
|
116
|
+
/>
|
|
117
|
+
<stop
|
|
118
|
+
offset="100%"
|
|
119
|
+
style={{ stopColor: "#f59e0b", stopOpacity: 1 }}
|
|
120
|
+
/>
|
|
121
|
+
</radialGradient>
|
|
122
|
+
</defs>
|
|
123
|
+
<circle cx="40" cy="40" r="36" style={styles.circle} />
|
|
124
|
+
</svg>
|
|
125
|
+
|
|
126
|
+
{/* Warning icon */}
|
|
127
|
+
<div style={styles.iconContainer}>
|
|
128
|
+
<svg
|
|
129
|
+
width="48"
|
|
130
|
+
height="48"
|
|
131
|
+
viewBox="0 0 24 24"
|
|
132
|
+
role="img"
|
|
133
|
+
aria-labelledby="warning-icon-title"
|
|
134
|
+
>
|
|
135
|
+
<title id="warning-icon-title">Warning icon</title>
|
|
136
|
+
{/* Triangle outline */}
|
|
137
|
+
<path d="M12 3 L22 20 H2 Z" style={styles.trianglePath} />
|
|
138
|
+
{/* Exclamation mark */}
|
|
139
|
+
<path d="M12 9 L12 14" style={styles.exclamationPath} />
|
|
140
|
+
<circle cx="12" cy="17" r="1.5" style={styles.dot} />
|
|
141
|
+
</svg>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import type { SequenceAPIClient } from "@0xsequence/api"
|
|
2
1
|
import { useQuery } from "@tanstack/react-query"
|
|
3
2
|
import { useTokenPrice } from "../../prices.js"
|
|
4
3
|
import { formatUsdAmountDisplay } from "../../tokenBalances.js"
|
|
5
4
|
import { useTokenAddress } from "../../tokens.js"
|
|
5
|
+
import { useAPIClient } from "../../apiClient.js"
|
|
6
6
|
|
|
7
7
|
type UseAmountUsdProps = {
|
|
8
8
|
amount?: string | null
|
|
9
9
|
token?: string | null
|
|
10
10
|
chainId?: number | null
|
|
11
|
-
apiClient: SequenceAPIClient
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
export function useAmountUsd({
|
|
15
|
-
amount,
|
|
16
|
-
token,
|
|
17
|
-
chainId,
|
|
18
|
-
apiClient,
|
|
19
|
-
}: UseAmountUsdProps): {
|
|
13
|
+
export function useAmountUsd({ amount, token, chainId }: UseAmountUsdProps): {
|
|
20
14
|
amountUsd: number | null
|
|
21
15
|
amountUsdFormatted: string
|
|
22
16
|
} {
|
|
17
|
+
const apiClient = useAPIClient()
|
|
23
18
|
const isTokenAddress = token?.startsWith("0x")
|
|
24
19
|
const resolvedTokenAddress = useTokenAddress({
|
|
25
20
|
chainId,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useRef } from "react"
|
|
2
|
+
import { getSessionId } from "../../analytics.js"
|
|
2
3
|
|
|
3
4
|
export type CheckoutCallbacks = {
|
|
4
5
|
onCheckoutStart?: (data: { sessionId: string }) => void
|
|
@@ -38,10 +39,10 @@ export function useCheckout({
|
|
|
38
39
|
onCheckoutError,
|
|
39
40
|
onCheckoutStatusUpdate,
|
|
40
41
|
}: UseCheckoutProps): UseCheckoutReturn {
|
|
41
|
-
const sessionIdRef = useRef<string>(
|
|
42
|
+
const sessionIdRef = useRef<string>(getSessionId())
|
|
42
43
|
|
|
43
44
|
const startCheckout = useCallback(() => {
|
|
44
|
-
sessionIdRef.current =
|
|
45
|
+
sessionIdRef.current = getSessionId()
|
|
45
46
|
}, [])
|
|
46
47
|
|
|
47
48
|
const triggerCheckoutStart = useCallback(() => {
|