0xtrails 0.1.13 → 0.2.0
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/aave.d.ts.map +1 -1
- package/dist/analytics.d.ts +11 -2
- 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/{proxyCaller.d.ts → balanceInjector.d.ts} +5 -4
- package/dist/balanceInjector.d.ts.map +1 -0
- package/dist/{ccip-D3gTQONK.js → ccip-D6ToCrWc.js} +12 -12
- package/dist/cctp.d.ts.map +1 -1
- package/dist/cctpqueue.d.ts +3 -3
- package/dist/cctpqueue.d.ts.map +1 -1
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +17 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +5 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/contractUtils.d.ts +2 -0
- package/dist/contractUtils.d.ts.map +1 -1
- package/dist/customChains.d.ts +24 -0
- package/dist/customChains.d.ts.map +1 -0
- package/dist/{index-CnUM7lKf.js → index-BqgeTLL8.js} +34072 -30146
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +411 -400
- package/dist/intentEntrypoint.d.ts +96 -0
- package/dist/intentEntrypoint.d.ts.map +1 -0
- package/dist/intents.d.ts +5 -3
- package/dist/intents.d.ts.map +1 -1
- package/dist/metaTxnMonitor.d.ts.map +1 -1
- package/dist/morpho.d.ts.map +1 -1
- package/dist/pools.d.ts +3 -1
- package/dist/pools.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +8 -2
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +1 -1
- 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/toast.d.ts +9 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/tokenBalances.d.ts +6 -2
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trails.d.ts +6 -5
- package/dist/trails.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +12 -0
- package/dist/trailsClient.d.ts.map +1 -0
- package/dist/transactions.d.ts +8 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountActionsDropdown.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/AccountSettings.d.ts +7 -0
- package/dist/widget/components/AccountSettings.d.ts.map +1 -0
- package/dist/widget/components/ChainList.d.ts +0 -1
- package/dist/widget/components/ChainList.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +46 -0
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -0
- package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts +9 -0
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -0
- package/dist/widget/components/DebugMenu.d.ts.map +1 -1
- package/dist/widget/components/DebugScreensList.d.ts.map +1 -1
- package/dist/widget/components/DebugToast.d.ts +3 -0
- package/dist/widget/components/DebugToast.d.ts.map +1 -0
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/EarnPools.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +44 -0
- package/dist/widget/components/Fund.d.ts.map +1 -0
- package/dist/widget/components/Identicon.d.ts +9 -0
- package/dist/widget/components/Identicon.d.ts.map +1 -0
- package/dist/widget/components/Pay.d.ts +46 -0
- package/dist/widget/components/Pay.d.ts.map +1 -0
- package/dist/widget/components/Receive.d.ts.map +1 -1
- package/dist/widget/components/RecentTokens.d.ts.map +1 -1
- package/dist/widget/components/Recipients.d.ts +9 -0
- package/dist/widget/components/Recipients.d.ts.map +1 -0
- package/dist/widget/components/RefundWarning.d.ts +9 -0
- package/dist/widget/components/RefundWarning.d.ts.map +1 -0
- package/dist/widget/components/SimpleSwap.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/SwapSettings.d.ts +1 -5
- package/dist/widget/components/SwapSettings.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/ThemeSyncer.d.ts +6 -0
- package/dist/widget/components/ThemeSyncer.d.ts.map +1 -0
- package/dist/widget/components/Toast.d.ts +24 -0
- package/dist/widget/components/Toast.d.ts.map +1 -0
- package/dist/widget/components/TokenList.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/components/TruncatedAddress.d.ts +2 -0
- package/dist/widget/components/TruncatedAddress.d.ts.map +1 -1
- package/dist/widget/components/UserPreferences.d.ts +7 -0
- package/dist/widget/components/UserPreferences.d.ts.map +1 -0
- package/dist/widget/hooks/useBalanceVisible.d.ts +1 -0
- package/dist/widget/hooks/useBalanceVisible.d.ts.map +1 -1
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts +1 -1
- package/dist/widget/hooks/useCurrentScreen.d.ts.map +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts +1 -1
- package/dist/widget/hooks/useDebugScreens.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts +54 -0
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -0
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/usePayMessage.d.ts +34 -0
- package/dist/widget/hooks/usePayMessage.d.ts.map +1 -0
- package/dist/widget/hooks/useRecipients.d.ts +17 -0
- package/dist/widget/hooks/useRecipients.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts +12 -0
- package/dist/widget/hooks/useSelectedRecipient.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +2 -0
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useSwapAmount.d.ts +13 -0
- package/dist/widget/hooks/useSwapAmount.d.ts.map +1 -0
- package/dist/widget/hooks/useSwapSettings.d.ts +16 -0
- package/dist/widget/hooks/useSwapSettings.d.ts.map +1 -0
- package/dist/widget/hooks/useTargetAmount.d.ts +5 -0
- package/dist/widget/hooks/useTargetAmount.d.ts.map +1 -0
- package/dist/widget/hooks/useTheme.d.ts +14 -0
- package/dist/widget/hooks/useTheme.d.ts.map +1 -0
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.js +2 -2
- package/dist/widget/widget.d.ts +9 -0
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +29 -28
- package/src/aave.ts +6 -1
- package/src/analytics.ts +103 -53
- package/src/apiClient.ts +1 -1
- package/src/{proxyCaller.ts → balanceInjector.ts} +22 -17
- package/src/cctp.ts +6 -2
- package/src/cctpqueue.ts +7 -7
- package/src/chains.ts +8 -0
- package/src/config.ts +40 -9
- package/src/constants.ts +11 -8
- package/src/contractUtils.ts +33 -2
- package/src/customChains.ts +24 -0
- package/src/index.ts +11 -1
- package/src/intentEntrypoint.ts +253 -0
- package/src/intents.ts +87 -54
- package/src/metaTxnMonitor.ts +1 -0
- package/src/morpho.ts +13 -2
- package/src/pools.ts +68 -86
- package/src/prepareSend.ts +437 -207
- package/src/prices.ts +51 -7
- package/src/relaySdk.ts +6 -4
- package/src/relayer.ts +2 -0
- package/src/toast.ts +110 -0
- package/src/tokenBalances.ts +112 -20
- package/src/tokens.ts +70 -7
- package/src/trails.ts +80 -77
- package/src/trailsClient.ts +45 -0
- package/src/transactions.ts +27 -35
- package/src/umd.tsx +1 -1
- package/src/wallets.ts +2 -1
- package/src/widget/assets/sequence-logo.svg +15 -0
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/AccountActionsDropdown.tsx +18 -159
- package/src/widget/components/AccountIntentTransactionHistory.tsx +346 -63
- package/src/widget/components/AccountSettings.tsx +96 -0
- package/src/widget/components/ChainFilterDropdown.tsx +1 -1
- package/src/widget/components/ChainList.tsx +10 -20
- package/src/widget/components/ClassicSwap.tsx +923 -0
- package/src/widget/components/ConfigDisplay.tsx +8 -5
- package/src/widget/components/ConnectedWallets.tsx +260 -0
- package/src/widget/components/DebugMenu.tsx +2 -0
- package/src/widget/components/DebugScreensList.tsx +3 -0
- package/src/widget/components/DebugToast.tsx +63 -0
- package/src/widget/components/Earn.tsx +108 -116
- package/src/widget/components/EarnPools.tsx +2 -4
- package/src/widget/components/EarnPoolsFilters.tsx +6 -6
- package/src/widget/components/Fund.tsx +1245 -0
- package/src/widget/components/FundMethods.tsx +1 -1
- package/src/widget/components/FundSendForm.tsx +1 -1
- package/src/widget/components/Identicon.tsx +158 -0
- package/src/widget/components/Pay.tsx +1088 -0
- package/src/widget/components/PaySendForm.tsx +1 -1
- package/src/widget/components/QuoteDetails.tsx +1 -1
- package/src/widget/components/Receipt.tsx +1 -1
- package/src/widget/components/Receive.tsx +4 -2
- package/src/widget/components/RecentTokens.tsx +2 -1
- package/src/widget/components/Recipients.tsx +448 -0
- package/src/widget/components/RefundWarning.tsx +61 -0
- package/src/widget/components/ScreenHeader.tsx +1 -1
- package/src/widget/components/SimpleSwap.tsx +74 -58
- package/src/widget/components/Swap.tsx +35 -853
- package/src/widget/components/SwapSettings.tsx +5 -11
- package/src/widget/components/ThemeProvider.tsx +32 -0
- package/src/widget/components/ThemeSyncer.tsx +47 -0
- package/src/widget/components/Toast.tsx +315 -0
- package/src/widget/components/TokenList.tsx +2 -34
- package/src/widget/components/TokenSelector.tsx +3 -3
- package/src/widget/components/TransactionDetails.tsx +153 -13
- package/src/widget/components/TruncatedAddress.tsx +5 -1
- package/src/widget/components/UserPreferences.tsx +156 -0
- package/src/widget/components/WalletList.tsx +1 -1
- package/src/widget/hooks/useBalanceVisible.tsx +40 -2
- package/src/widget/hooks/useCheckout.ts +13 -0
- package/src/widget/hooks/useCurrentScreen.tsx +3 -0
- package/src/widget/hooks/useDebugScreens.ts +12 -2
- package/src/widget/hooks/useDefaultTokenSelection.tsx +475 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +212 -0
- package/src/widget/hooks/usePayMessage.tsx +370 -0
- package/src/widget/hooks/useRecipients.ts +168 -0
- package/src/widget/hooks/useSelectedRecipient.tsx +48 -0
- package/src/widget/hooks/useSendForm.ts +179 -26
- package/src/widget/hooks/useSwapAmount.tsx +50 -0
- package/src/widget/hooks/useSwapSettings.tsx +100 -0
- package/src/widget/hooks/useTargetAmount.ts +23 -0
- package/src/widget/hooks/useTheme.tsx +80 -0
- package/src/widget/hooks/useTokenList.ts +20 -11
- package/src/widget/index.css +45 -21
- package/src/widget/widget.tsx +164 -68
- package/dist/address.d.ts +0 -2
- package/dist/address.d.ts.map +0 -1
- package/dist/proxyCaller.d.ts.map +0 -1
- package/src/address.ts +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from "react"
|
|
2
2
|
import { Wallet, QrCode, Building2 } from "lucide-react"
|
|
3
3
|
import { useAccount } from "wagmi"
|
|
4
|
-
import { truncateAddress } from "../../
|
|
4
|
+
import { truncateAddress } from "../../utils.js"
|
|
5
5
|
import { useTheme } from "../components/ThemeProvider.js"
|
|
6
6
|
import WalletConnectLogoWhite from "../assets/WalletConnect-logo-white.svg"
|
|
7
7
|
import WalletConnectLogoBlack from "../assets/WalletConnect-logo-black.svg"
|
|
@@ -835,7 +835,7 @@ export const FundSendForm: React.FC<FundSendFormProps> = ({
|
|
|
835
835
|
{/* Warning Messages - Show only one at a time */}
|
|
836
836
|
{isSameTokenWithoutCustomCalldata ? (
|
|
837
837
|
<ErrorDisplay
|
|
838
|
-
errorPrettified="Cannot swap to the same token on the same chain without custom calldata. Please select a different
|
|
838
|
+
errorPrettified="Cannot swap to the same token on the same chain without custom calldata. Please select a different origin token."
|
|
839
839
|
severity="error"
|
|
840
840
|
/>
|
|
841
841
|
) : (
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type React from "react"
|
|
2
|
+
|
|
3
|
+
// MetaMask-style hash function
|
|
4
|
+
const hashCode = (str: string): number => {
|
|
5
|
+
let hash = 0
|
|
6
|
+
for (let i = 0; i < str.length; i++) {
|
|
7
|
+
const char = str.charCodeAt(i)
|
|
8
|
+
hash = (hash << 5) - hash + char
|
|
9
|
+
hash = hash & hash
|
|
10
|
+
}
|
|
11
|
+
return Math.abs(hash)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Generate MetaMask-style colors (bright and vibrant)
|
|
15
|
+
const generateMetaMaskColors = (seed: number) => {
|
|
16
|
+
const colors = [
|
|
17
|
+
"#FF6B6B",
|
|
18
|
+
"#4ECDC4",
|
|
19
|
+
"#45B7D1",
|
|
20
|
+
"#96CEB4",
|
|
21
|
+
"#FECA57",
|
|
22
|
+
"#FF9FF3",
|
|
23
|
+
"#54A0FF",
|
|
24
|
+
"#5F27CD",
|
|
25
|
+
"#00D2D3",
|
|
26
|
+
"#FF9F43",
|
|
27
|
+
"#10AC84",
|
|
28
|
+
"#EE5A24",
|
|
29
|
+
"#0ABDE3",
|
|
30
|
+
"#C44569",
|
|
31
|
+
"#F8B500",
|
|
32
|
+
"#6C5CE7",
|
|
33
|
+
"#A3CB38",
|
|
34
|
+
"#FD79A8",
|
|
35
|
+
"#636E72",
|
|
36
|
+
"#00B894",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
const bg = colors[seed % colors.length]
|
|
40
|
+
const spot = colors[(seed + 7) % colors.length]
|
|
41
|
+
|
|
42
|
+
return { backgroundColor: bg, spotColor: spot }
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Generate MetaMask-style pattern
|
|
46
|
+
const generateMetaMaskPattern = (address: string) => {
|
|
47
|
+
const cleanAddress = address.replace(/^0x/i, "").toLowerCase()
|
|
48
|
+
|
|
49
|
+
// Use address to generate deterministic values
|
|
50
|
+
const seed = hashCode(cleanAddress)
|
|
51
|
+
const { backgroundColor, spotColor } = generateMetaMaskColors(seed)
|
|
52
|
+
|
|
53
|
+
// Generate a 8x8 grid pattern like MetaMask
|
|
54
|
+
const size = 8
|
|
55
|
+
const pattern: boolean[][] = []
|
|
56
|
+
|
|
57
|
+
// Generate pattern with symmetry (like MetaMask)
|
|
58
|
+
for (let y = 0; y < size; y++) {
|
|
59
|
+
const row: boolean[] = []
|
|
60
|
+
for (let x = 0; x < size; x++) {
|
|
61
|
+
// Create horizontal symmetry
|
|
62
|
+
const actualX = x < 4 ? x : 7 - x
|
|
63
|
+
|
|
64
|
+
// Use different parts of address for different rows/columns
|
|
65
|
+
const addressIndex = (y * 4 + actualX) % cleanAddress.length
|
|
66
|
+
const char = cleanAddress.charCodeAt(addressIndex)
|
|
67
|
+
|
|
68
|
+
// Determine if this cell should be filled
|
|
69
|
+
const shouldFill = (char + seed) % 3 === 0
|
|
70
|
+
row.push(shouldFill)
|
|
71
|
+
}
|
|
72
|
+
pattern.push(row)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
backgroundColor,
|
|
77
|
+
spotColor,
|
|
78
|
+
pattern,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface IdenticonProps {
|
|
83
|
+
value?: string
|
|
84
|
+
size?: number
|
|
85
|
+
className?: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const Identicon: React.FC<IdenticonProps> = ({
|
|
89
|
+
value = "0x0000000000000000000000000000000000000000",
|
|
90
|
+
size = 64,
|
|
91
|
+
className = "",
|
|
92
|
+
}) => {
|
|
93
|
+
if (!value || typeof value !== "string") {
|
|
94
|
+
return (
|
|
95
|
+
<div
|
|
96
|
+
className={`inline-block ${className}`}
|
|
97
|
+
style={{
|
|
98
|
+
width: size,
|
|
99
|
+
height: size,
|
|
100
|
+
backgroundColor: "#cccccc",
|
|
101
|
+
borderRadius: "50%",
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const { backgroundColor, spotColor, pattern } = generateMetaMaskPattern(value)
|
|
108
|
+
|
|
109
|
+
const gridSize = 8
|
|
110
|
+
const cellSize = size / gridSize
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div
|
|
114
|
+
className={`inline-block ${className}`}
|
|
115
|
+
style={{
|
|
116
|
+
width: size,
|
|
117
|
+
height: size,
|
|
118
|
+
borderRadius: "50%",
|
|
119
|
+
overflow: "hidden",
|
|
120
|
+
backgroundColor: backgroundColor,
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<svg
|
|
124
|
+
width={size}
|
|
125
|
+
height={size}
|
|
126
|
+
style={{ display: "block" }}
|
|
127
|
+
aria-label={`Identicon for ${value}`}
|
|
128
|
+
>
|
|
129
|
+
<title>Identicon for {value}</title>
|
|
130
|
+
{/* Background circle */}
|
|
131
|
+
<circle
|
|
132
|
+
cx={size / 2}
|
|
133
|
+
cy={size / 2}
|
|
134
|
+
r={size / 2}
|
|
135
|
+
fill={backgroundColor}
|
|
136
|
+
/>
|
|
137
|
+
|
|
138
|
+
{/* Pattern cells */}
|
|
139
|
+
{pattern.map((row, y) =>
|
|
140
|
+
row.map((shouldFill, x) =>
|
|
141
|
+
shouldFill ? (
|
|
142
|
+
<rect
|
|
143
|
+
key={`cell-${y}-${x}-${value.slice(-8)}`}
|
|
144
|
+
x={x * cellSize}
|
|
145
|
+
y={y * cellSize}
|
|
146
|
+
width={cellSize}
|
|
147
|
+
height={cellSize}
|
|
148
|
+
fill={spotColor}
|
|
149
|
+
/>
|
|
150
|
+
) : null,
|
|
151
|
+
),
|
|
152
|
+
)}
|
|
153
|
+
</svg>
|
|
154
|
+
</div>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export default Identicon
|