0xtrails 0.2.5 → 0.3.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 +2 -0
- package/dist/aave.d.ts.map +1 -1
- package/dist/abortController.d.ts +8 -0
- package/dist/abortController.d.ts.map +1 -0
- package/dist/{ccip-CXlshvBY.js → ccip-BMB3uDZt.js} +1 -1
- package/dist/config.d.ts +0 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +4 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/error.d.ts +4 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/fees.d.ts +19 -0
- package/dist/fees.d.ts.map +1 -0
- package/dist/{index-_QuyGrjU.js → index-QXPUrZVv.js} +48719 -50852
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +811 -784
- package/dist/intentReceiptMonitor.d.ts +24 -0
- package/dist/intentReceiptMonitor.d.ts.map +1 -0
- package/dist/intentReceiptPoller.d.ts +69 -0
- package/dist/intentReceiptPoller.d.ts.map +1 -0
- package/dist/intents.d.ts +15 -11
- package/dist/intents.d.ts.map +1 -1
- package/dist/morpho.d.ts +6 -5
- package/dist/morpho.d.ts.map +1 -1
- package/dist/mutations.d.ts +16 -0
- package/dist/mutations.d.ts.map +1 -0
- package/dist/preconditions.d.ts +5 -4
- package/dist/preconditions.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +7 -258
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +9 -6
- package/dist/prices.d.ts.map +1 -1
- package/dist/sequenceWallet.d.ts +3 -16
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts +17 -13
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/trails.d.ts +24 -40
- package/dist/trails.d.ts.map +1 -1
- package/dist/transactionIntent/constants.d.ts +7 -0
- package/dist/transactionIntent/constants.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +44 -0
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +30 -0
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/index.d.ts +4 -0
- package/dist/transactionIntent/deposits/index.d.ts.map +1 -0
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +30 -0
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -0
- package/dist/transactionIntent/execution/index.d.ts +2 -0
- package/dist/transactionIntent/execution/index.d.ts.map +1 -0
- package/dist/transactionIntent/execution/transactionState.d.ts +5 -0
- package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/crossChain.d.ts +82 -0
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/index.d.ts +4 -0
- package/dist/transactionIntent/handlers/index.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts +62 -0
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts.map +1 -0
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +72 -0
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -0
- package/dist/transactionIntent/index.d.ts +9 -0
- package/dist/transactionIntent/index.d.ts.map +1 -0
- package/dist/transactionIntent/quote/feeExtractors.d.ts +17 -0
- package/dist/transactionIntent/quote/feeExtractors.d.ts.map +1 -0
- package/dist/transactionIntent/quote/index.d.ts +4 -0
- package/dist/transactionIntent/quote/index.d.ts.map +1 -0
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +34 -0
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -0
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +5 -0
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -0
- package/dist/transactionIntent/types.d.ts +131 -0
- package/dist/transactionIntent/types.d.ts.map +1 -0
- package/dist/transactionIntent/utils/balanceChecker.d.ts +18 -0
- package/dist/transactionIntent/utils/balanceChecker.d.ts.map +1 -0
- package/dist/transactionIntent/utils/index.d.ts +4 -0
- package/dist/transactionIntent/utils/index.d.ts.map +1 -0
- package/dist/transactionIntent/utils/lifiHelpers.d.ts +10 -0
- package/dist/transactionIntent/utils/lifiHelpers.d.ts.map +1 -0
- package/dist/transactionIntent/utils/testnetHelpers.d.ts +3 -0
- package/dist/transactionIntent/utils/testnetHelpers.d.ts.map +1 -0
- package/dist/transactionIntent/validators.d.ts +6 -0
- package/dist/transactionIntent/validators.d.ts.map +1 -0
- package/dist/transactions.d.ts +6 -3
- package/dist/transactions.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts +4 -0
- package/dist/widget/components/AccountIntentTransactionHistoryButton.d.ts.map +1 -0
- package/dist/widget/components/AccountSettings.d.ts.map +1 -1
- package/dist/widget/components/ChainFilterDropdown.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +2 -3
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -1
- package/dist/widget/components/ConnectedWallets.d.ts.map +1 -1
- package/dist/widget/components/DynamicInputStyles.d.ts +18 -0
- package/dist/widget/components/DynamicInputStyles.d.ts.map +1 -0
- package/dist/widget/components/DynamicSizeInputField.d.ts +13 -0
- package/dist/widget/components/DynamicSizeInputField.d.ts.map +1 -0
- package/dist/widget/components/Earn.d.ts +2 -3
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/ErrorAnimationIcon.d.ts +2 -0
- package/dist/widget/components/ErrorAnimationIcon.d.ts.map +1 -0
- package/dist/widget/components/FeeBreakdown.d.ts +9 -0
- package/dist/widget/components/FeeBreakdown.d.ts.map +1 -0
- package/dist/widget/components/FeeOptions.d.ts +5 -13
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +2 -3
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundMethods.d.ts.map +1 -1
- package/dist/widget/components/FundSwap.d.ts +2 -3
- package/dist/widget/components/FundSwap.d.ts.map +1 -1
- package/dist/widget/components/FundingMethodSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Identicon.d.ts.map +1 -1
- package/dist/widget/components/MeshConnectExchanges.d.ts +0 -3
- package/dist/widget/components/MeshConnectExchanges.d.ts.map +1 -1
- package/dist/widget/components/Modal.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts +2 -3
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +3 -3
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/PoolWithdraw.d.ts +3 -20
- package/dist/widget/components/PoolWithdraw.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts +2 -0
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Receipt.d.ts.map +1 -1
- package/dist/widget/components/RecipientSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -3
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/ThemeProvider.d.ts.map +1 -1
- package/dist/widget/components/TokenDisplayNonSelectable.d.ts +11 -0
- package/dist/widget/components/TokenDisplayNonSelectable.d.ts.map +1 -0
- package/dist/widget/components/TokenSelector.d.ts.map +1 -1
- package/dist/widget/components/TokenSelectorButton.d.ts.map +1 -1
- package/dist/widget/components/Tooltip.d.ts +9 -0
- package/dist/widget/components/Tooltip.d.ts.map +1 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -1
- package/dist/widget/components/WaasFeeOptions.d.ts +1 -0
- package/dist/widget/components/WaasFeeOptions.d.ts.map +1 -1
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +2 -2
- package/dist/widget/hooks/useCheckout.d.ts +17 -4
- package/dist/widget/hooks/useCheckout.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +82 -0
- package/dist/widget/hooks/useQuote.d.ts.map +1 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts +1 -0
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +5 -6
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useWalletConnectionContext.d.ts +25 -0
- package/dist/widget/hooks/useWalletConnectionContext.d.ts.map +1 -0
- package/dist/widget/index.js +2 -2
- package/dist/widget/widget.d.ts +17 -7
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +19 -21
- package/src/aave.ts +54 -1
- package/src/abortController.ts +35 -0
- package/src/config.ts +57 -58
- package/src/constants.ts +11 -9
- package/src/error.ts +21 -3
- package/src/fees.ts +210 -0
- package/src/index.ts +35 -13
- package/src/intentReceiptMonitor.ts +102 -0
- package/src/intentReceiptPoller.ts +299 -0
- package/src/intents.ts +205 -171
- package/src/morpho.ts +58 -9
- package/src/mutations.ts +129 -0
- package/src/preconditions.ts +16 -21
- package/src/prepareSend.ts +92 -4699
- package/src/prices.ts +26 -22
- package/src/relaySdk.ts +2 -2
- package/src/sequenceWallet.ts +6 -73
- package/src/tokenBalances.ts +175 -69
- package/src/trails.ts +230 -722
- package/src/transactionIntent/constants.ts +11 -0
- package/src/transactionIntent/deposits/depositOrchestrator.ts +210 -0
- package/src/transactionIntent/deposits/gaslessDeposit.ts +588 -0
- package/src/transactionIntent/deposits/index.ts +3 -0
- package/src/transactionIntent/deposits/standardDeposit.ts +379 -0
- package/src/transactionIntent/execution/index.ts +1 -0
- package/src/transactionIntent/execution/transactionState.ts +35 -0
- package/src/transactionIntent/handlers/crossChain.ts +1707 -0
- package/src/transactionIntent/handlers/index.ts +3 -0
- package/src/transactionIntent/handlers/sameChainDifferentToken.ts +323 -0
- package/src/transactionIntent/handlers/sameChainSameToken.ts +712 -0
- package/src/transactionIntent/index.ts +9 -0
- package/src/transactionIntent/quote/feeExtractors.ts +81 -0
- package/src/transactionIntent/quote/index.ts +3 -0
- package/src/transactionIntent/quote/normalizeQuote.ts +367 -0
- package/src/transactionIntent/quote/quoteHelpers.ts +53 -0
- package/src/transactionIntent/types.ts +157 -0
- package/src/transactionIntent/utils/balanceChecker.ts +96 -0
- package/src/transactionIntent/utils/index.ts +3 -0
- package/src/transactionIntent/utils/lifiHelpers.ts +68 -0
- package/src/transactionIntent/utils/testnetHelpers.ts +10 -0
- package/src/transactionIntent/validators.ts +57 -0
- package/src/transactions.ts +98 -71
- package/src/widget/compiled.css +2 -2
- package/src/widget/components/AccountIntentTransactionHistory.tsx +36 -36
- package/src/widget/components/AccountIntentTransactionHistoryButton.tsx +22 -0
- package/src/widget/components/AccountSettings.tsx +70 -41
- package/src/widget/components/ChainFilterDropdown.tsx +24 -3
- package/src/widget/components/ClassicSwap.tsx +44 -107
- package/src/widget/components/ConfigDisplay.tsx +0 -11
- package/src/widget/components/ConnectWallet.tsx +4 -1
- package/src/widget/components/ConnectedWallets.tsx +51 -25
- package/src/widget/components/DynamicInputStyles.tsx +76 -0
- package/src/widget/components/DynamicSizeInputField.tsx +109 -0
- package/src/widget/components/Earn.tsx +34 -45
- package/src/widget/components/ErrorAnimationIcon.tsx +130 -0
- package/src/widget/components/FeeBreakdown.tsx +155 -0
- package/src/widget/components/FeeOption.tsx +2 -2
- package/src/widget/components/FeeOptions.tsx +151 -112
- package/src/widget/components/Fund.tsx +10 -29
- package/src/widget/components/FundMethods.tsx +4 -3
- package/src/widget/components/FundSwap.tsx +2 -3
- package/src/widget/components/FundingMethodSelectorButton.tsx +24 -14
- package/src/widget/components/Identicon.tsx +164 -95
- package/src/widget/components/MeshConnectExchanges.tsx +2 -15
- package/src/widget/components/Modal.tsx +0 -12
- package/src/widget/components/Pay.tsx +72 -75
- package/src/widget/components/PoolDeposit.tsx +221 -242
- package/src/widget/components/PoolWithdraw.tsx +347 -469
- package/src/widget/components/PriceImpactWarning.tsx +1 -1
- package/src/widget/components/QuoteDetails.tsx +906 -484
- package/src/widget/components/Receipt.tsx +16 -2
- package/src/widget/components/RecipientSelectorButton.tsx +7 -5
- package/src/widget/components/Recipients.tsx +1 -1
- package/src/widget/components/ScreenHeader.tsx +60 -36
- package/src/widget/components/Swap.tsx +2 -3
- package/src/widget/components/ThemeProvider.tsx +2 -1
- package/src/widget/components/TokenDisplayNonSelectable.tsx +40 -0
- package/src/widget/components/TokenImage.tsx +1 -1
- package/src/widget/components/TokenSelector.tsx +62 -53
- package/src/widget/components/TokenSelectorButton.tsx +38 -15
- package/src/widget/components/Tooltip.tsx +51 -0
- package/src/widget/components/TransferPendingVertical.tsx +12 -8
- package/src/widget/components/WaasFeeOptions.tsx +139 -4
- package/src/widget/components/WalletConfirmation.tsx +23 -13
- package/src/widget/components/WalletConnect.tsx +93 -29
- package/src/widget/hooks/useAmountUsd.ts +9 -9
- package/src/widget/hooks/useCheckout.ts +97 -9
- package/src/widget/hooks/useDefaultTokenSelection.tsx +27 -21
- package/src/widget/hooks/useQuote.ts +466 -0
- package/src/widget/hooks/useSelectedFeeToken.tsx +32 -37
- package/src/widget/hooks/useSendForm.ts +45 -51
- package/src/widget/hooks/useTokenList.ts +34 -26
- package/src/widget/hooks/useWalletConnectionContext.tsx +128 -0
- package/src/widget/widget.tsx +365 -390
- package/dist/apiClient.d.ts +0 -9
- package/dist/apiClient.d.ts.map +0 -1
- package/dist/intentEntrypoint.d.ts +0 -114
- package/dist/intentEntrypoint.d.ts.map +0 -1
- package/dist/metaTxnMonitor.d.ts +0 -15
- package/dist/metaTxnMonitor.d.ts.map +0 -1
- package/dist/metaTxns.d.ts +0 -11
- package/dist/metaTxns.d.ts.map +0 -1
- package/dist/relayer.d.ts +0 -43
- package/dist/relayer.d.ts.map +0 -1
- package/src/apiClient.ts +0 -35
- package/src/intentEntrypoint.ts +0 -203
- package/src/metaTxnMonitor.ts +0 -171
- package/src/metaTxns.ts +0 -45
- package/src/relayer.ts +0 -289
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { ChevronRight, QrCode, Send } from "lucide-react"
|
|
2
2
|
import type React from "react"
|
|
3
3
|
import { truncateAddress } from "../../utils.js"
|
|
4
|
-
import { useAccount } from "wagmi"
|
|
4
|
+
import { useAccount, useConnections } from "wagmi"
|
|
5
5
|
import { Identicon } from "./Identicon.js"
|
|
6
6
|
import { useBack } from "../hooks/useBack.js"
|
|
7
7
|
import { useSelectedFundMethod } from "../hooks/useSelectedFundMethod.js"
|
|
8
8
|
|
|
9
9
|
export const FundingMethodSelectorButton: React.FC = () => {
|
|
10
|
-
const
|
|
10
|
+
const connections = useConnections()
|
|
11
|
+
const { address } = useAccount()
|
|
11
12
|
const { setCurrentScreenWithBack } = useBack()
|
|
12
13
|
const { selectedFundMethod } = useSelectedFundMethod()
|
|
13
14
|
|
|
15
|
+
// Check if there are any connected accounts across all connectors
|
|
16
|
+
const isConnected = connections.length > 0
|
|
17
|
+
// Use the active account from useAccount(), fallback to first connection if needed
|
|
18
|
+
const activeAddress = address || connections[0]?.accounts[0]
|
|
19
|
+
|
|
14
20
|
const handleClick = () => {
|
|
15
|
-
if (isConnected &&
|
|
21
|
+
if (isConnected && activeAddress) {
|
|
16
22
|
// If wallet is connected, go to fund methods
|
|
17
23
|
setCurrentScreenWithBack("fund-methods")
|
|
18
24
|
} else {
|
|
@@ -27,32 +33,36 @@ export const FundingMethodSelectorButton: React.FC = () => {
|
|
|
27
33
|
onClick={handleClick}
|
|
28
34
|
className="flex items-center space-x-2 text-blue-500 hover:text-blue-600 transition-colors cursor-pointer bg-transparent border-none p-0"
|
|
29
35
|
title={
|
|
30
|
-
isConnected &&
|
|
36
|
+
isConnected && activeAddress
|
|
37
|
+
? "Select funding method"
|
|
38
|
+
: "Connect wallet"
|
|
31
39
|
}
|
|
32
40
|
>
|
|
33
|
-
{isConnected &&
|
|
41
|
+
{isConnected && activeAddress ? (
|
|
34
42
|
selectedFundMethod === "qr-code" ? (
|
|
35
43
|
<>
|
|
36
|
-
<QrCode className="w-4 h-4" />
|
|
37
|
-
<span className="text-sm font-medium">QR Code</span>
|
|
44
|
+
<QrCode className="w-4 h-4 mr-1" />
|
|
45
|
+
<span className="text-sm font-medium m-0">QR Code</span>
|
|
38
46
|
</>
|
|
39
47
|
) : selectedFundMethod === "exchange" ? (
|
|
40
48
|
<>
|
|
41
|
-
<Send className="w-4 h-4" />
|
|
42
|
-
<span className="text-sm font-medium">Exchange</span>
|
|
49
|
+
<Send className="w-4 h-4 mr-1" />
|
|
50
|
+
<span className="text-sm font-medium m-0">Exchange</span>
|
|
43
51
|
</>
|
|
44
52
|
) : (
|
|
45
53
|
<>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
<div className="flex items-center mr-1">
|
|
55
|
+
<Identicon value={activeAddress} size={16} />
|
|
56
|
+
</div>
|
|
57
|
+
<span className="text-sm font-medium m-0">
|
|
58
|
+
{truncateAddress(activeAddress, 4, 4)}
|
|
49
59
|
</span>
|
|
50
60
|
</>
|
|
51
61
|
)
|
|
52
62
|
) : (
|
|
53
|
-
<span className="text-sm font-medium">Connect Wallet</span>
|
|
63
|
+
<span className="text-sm font-medium mr-1">Connect Wallet</span>
|
|
54
64
|
)}
|
|
55
|
-
<ChevronRight className="w-4 h-4" />
|
|
65
|
+
<ChevronRight className="w-4 h-4 m-0" />
|
|
56
66
|
</button>
|
|
57
67
|
)
|
|
58
68
|
}
|
|
@@ -1,81 +1,99 @@
|
|
|
1
1
|
import type React from "react"
|
|
2
|
+
import { useId } from "react"
|
|
3
|
+
|
|
4
|
+
const MOD = 1000
|
|
5
|
+
const SIZE = 64
|
|
6
|
+
const RADIUS = SIZE / 2
|
|
7
|
+
const prefix = "gradient-avatar-"
|
|
8
|
+
|
|
9
|
+
const scaledMod = (value: number, mod: number = MOD): number => {
|
|
10
|
+
return (value % mod) / (MOD / SIZE)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const cyrb53 = (str: string, seed: number = 0): number => {
|
|
14
|
+
let h1 = 0xdeadbeef ^ seed
|
|
15
|
+
let h2 = 0x41c6ce57 ^ seed
|
|
2
16
|
|
|
3
|
-
// MetaMask-style hash function
|
|
4
|
-
const hashCode = (str: string): number => {
|
|
5
|
-
let hash = 0
|
|
6
17
|
for (let i = 0; i < str.length; i++) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
const ch = str.charCodeAt(i)
|
|
19
|
+
h1 = Math.imul(h1 ^ ch, 2654435761)
|
|
20
|
+
h2 = Math.imul(h2 ^ ch, 1597334677)
|
|
10
21
|
}
|
|
11
|
-
|
|
22
|
+
|
|
23
|
+
h1 =
|
|
24
|
+
Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^
|
|
25
|
+
Math.imul(h2 ^ (h2 >>> 13), 3266489909)
|
|
26
|
+
h2 =
|
|
27
|
+
Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^
|
|
28
|
+
Math.imul(h1 ^ (h1 >>> 13), 3266489909)
|
|
29
|
+
|
|
30
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0)
|
|
12
31
|
}
|
|
13
32
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 }
|
|
33
|
+
const createId = (name: string, id: string): string => `${prefix}${name}${id}`
|
|
34
|
+
|
|
35
|
+
const createHues = (a: number, _b: number, c: number) => {
|
|
36
|
+
const hueA = a % 360
|
|
37
|
+
const hueB = (a + 120) % 360
|
|
38
|
+
const hueC = c % 360
|
|
39
|
+
return { hueA, hueB, hueC }
|
|
43
40
|
}
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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)
|
|
42
|
+
interface Gradient {
|
|
43
|
+
id: string
|
|
44
|
+
stopColor0: string
|
|
45
|
+
stopColor1: string
|
|
46
|
+
cx: number
|
|
47
|
+
cy: number
|
|
48
|
+
r: number
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface Gradients {
|
|
52
|
+
background: Gradient
|
|
53
|
+
primary: Gradient
|
|
54
|
+
secondary: Gradient
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const createGradients = (id: string, address: string): Gradients => {
|
|
58
|
+
const hash = {
|
|
59
|
+
a: cyrb53(`${address}a`, 0),
|
|
60
|
+
b: cyrb53(`${address}b`, 1),
|
|
61
|
+
c: cyrb53(`${address}c`, 2),
|
|
62
|
+
x: cyrb53(`${address}d`, 3),
|
|
63
|
+
y: cyrb53(`${address}e`, 4),
|
|
64
|
+
r: cyrb53(`${address}f`, 5),
|
|
73
65
|
}
|
|
74
66
|
|
|
67
|
+
const { hueA, hueB, hueC } = createHues(hash.a, hash.b, hash.c)
|
|
68
|
+
const cx = scaledMod(hash.x)
|
|
69
|
+
const cy = scaledMod(hash.y)
|
|
70
|
+
const r = SIZE / 10 + scaledMod(hash.r, MOD * 1.5)
|
|
71
|
+
|
|
75
72
|
return {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
background: {
|
|
74
|
+
id: createId("background", id),
|
|
75
|
+
stopColor0: `hsl(${hueC}deg 100% 50% / 1)`,
|
|
76
|
+
stopColor1: `hsl(${hueA}deg 100% 50% / 1)`,
|
|
77
|
+
cx,
|
|
78
|
+
cy,
|
|
79
|
+
r,
|
|
80
|
+
},
|
|
81
|
+
primary: {
|
|
82
|
+
id: createId("primary", id),
|
|
83
|
+
stopColor0: `hsl(${hueA}deg 100% 50% / 1)`,
|
|
84
|
+
stopColor1: `hsl(${hueB}deg 100% 50% / 1)`,
|
|
85
|
+
cx,
|
|
86
|
+
cy,
|
|
87
|
+
r,
|
|
88
|
+
},
|
|
89
|
+
secondary: {
|
|
90
|
+
id: createId("secondary", id),
|
|
91
|
+
stopColor0: `hsl(${hueC}deg 100% 50% / 1)`,
|
|
92
|
+
stopColor1: `hsl(${hueB}deg 100% 50% / 1)`,
|
|
93
|
+
cx: cy,
|
|
94
|
+
cy: cx,
|
|
95
|
+
r: r / 2,
|
|
96
|
+
},
|
|
79
97
|
}
|
|
80
98
|
}
|
|
81
99
|
|
|
@@ -90,6 +108,8 @@ export const Identicon: React.FC<IdenticonProps> = ({
|
|
|
90
108
|
size = 64,
|
|
91
109
|
className = "",
|
|
92
110
|
}) => {
|
|
111
|
+
const id = useId()
|
|
112
|
+
|
|
93
113
|
if (!value || typeof value !== "string") {
|
|
94
114
|
return (
|
|
95
115
|
<div
|
|
@@ -104,10 +124,8 @@ export const Identicon: React.FC<IdenticonProps> = ({
|
|
|
104
124
|
)
|
|
105
125
|
}
|
|
106
126
|
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
const gridSize = 8
|
|
110
|
-
const cellSize = size / gridSize
|
|
127
|
+
const gradients = createGradients(id, value.toLowerCase())
|
|
128
|
+
const getId = (name: string) => createId(name, id)
|
|
111
129
|
|
|
112
130
|
return (
|
|
113
131
|
<div
|
|
@@ -117,39 +135,90 @@ export const Identicon: React.FC<IdenticonProps> = ({
|
|
|
117
135
|
height: size,
|
|
118
136
|
borderRadius: "50%",
|
|
119
137
|
overflow: "hidden",
|
|
120
|
-
|
|
138
|
+
flexShrink: 0,
|
|
121
139
|
}}
|
|
122
140
|
>
|
|
123
141
|
<svg
|
|
124
142
|
width={size}
|
|
125
143
|
height={size}
|
|
144
|
+
viewBox={`0 0 ${SIZE} ${SIZE}`}
|
|
126
145
|
style={{ display: "block" }}
|
|
146
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
127
147
|
aria-label={`Identicon for ${value}`}
|
|
128
148
|
>
|
|
129
149
|
<title>Identicon for {value}</title>
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
|
|
151
|
+
<defs>
|
|
152
|
+
<clipPath id={getId("circle-clip")}>
|
|
153
|
+
<circle cx={RADIUS} cy={RADIUS} r={RADIUS} />
|
|
154
|
+
</clipPath>
|
|
155
|
+
|
|
156
|
+
<filter
|
|
157
|
+
id={getId("blur-xs")}
|
|
158
|
+
x="-10%"
|
|
159
|
+
y="-10%"
|
|
160
|
+
width="120%"
|
|
161
|
+
height="120%"
|
|
162
|
+
filterUnits="userSpaceOnUse"
|
|
163
|
+
colorInterpolationFilters="sRGB"
|
|
164
|
+
>
|
|
165
|
+
<feFlood floodOpacity="0" result="BackgroundImageFix" />
|
|
166
|
+
<feBlend
|
|
167
|
+
mode="normal"
|
|
168
|
+
in="SourceGraphic"
|
|
169
|
+
in2="BackgroundImageFix"
|
|
170
|
+
result="shape"
|
|
171
|
+
/>
|
|
172
|
+
<feGaussianBlur
|
|
173
|
+
stdDeviation={SIZE / 10}
|
|
174
|
+
result="effect1_foregroundBlur"
|
|
175
|
+
/>
|
|
176
|
+
</filter>
|
|
177
|
+
|
|
178
|
+
<linearGradient
|
|
179
|
+
id={gradients.background.id}
|
|
180
|
+
x1="0"
|
|
181
|
+
y1="0"
|
|
182
|
+
x2="1"
|
|
183
|
+
y2="1"
|
|
184
|
+
>
|
|
185
|
+
<stop offset="0" stopColor={gradients.background.stopColor0} />
|
|
186
|
+
<stop offset="1" stopColor={gradients.background.stopColor1} />
|
|
187
|
+
</linearGradient>
|
|
188
|
+
|
|
189
|
+
<radialGradient id={gradients.primary.id}>
|
|
190
|
+
<stop offset="0" stopColor={gradients.primary.stopColor0} />
|
|
191
|
+
<stop offset="1" stopColor={gradients.primary.stopColor1} />
|
|
192
|
+
</radialGradient>
|
|
193
|
+
|
|
194
|
+
<radialGradient id={gradients.secondary.id}>
|
|
195
|
+
<stop offset="0" stopColor={gradients.secondary.stopColor0} />
|
|
196
|
+
<stop offset="1" stopColor={gradients.secondary.stopColor1} />
|
|
197
|
+
</radialGradient>
|
|
198
|
+
</defs>
|
|
199
|
+
|
|
200
|
+
<g clipPath={`url(#${getId("circle-clip")})`}>
|
|
201
|
+
<rect
|
|
202
|
+
width="100%"
|
|
203
|
+
height="100%"
|
|
204
|
+
fill={`url(#${gradients.background.id})`}
|
|
205
|
+
/>
|
|
206
|
+
|
|
207
|
+
<g filter={`url(#${getId("blur-xs")})`}>
|
|
208
|
+
<circle
|
|
209
|
+
fill={`url(#${gradients.primary.id})`}
|
|
210
|
+
cx={gradients.primary.cx}
|
|
211
|
+
cy={gradients.primary.cy}
|
|
212
|
+
r={gradients.primary.r}
|
|
213
|
+
/>
|
|
214
|
+
<circle
|
|
215
|
+
fill={`url(#${gradients.secondary.id})`}
|
|
216
|
+
cx={gradients.secondary.cx}
|
|
217
|
+
cy={gradients.secondary.cy}
|
|
218
|
+
r={gradients.secondary.r}
|
|
219
|
+
/>
|
|
220
|
+
</g>
|
|
221
|
+
</g>
|
|
153
222
|
</svg>
|
|
154
223
|
</div>
|
|
155
224
|
)
|
|
@@ -12,24 +12,18 @@ import CoinbaseLogo from "../assets/Coinbase_Icon_Logo.svg"
|
|
|
12
12
|
import { ScreenHeader } from "./ScreenHeader.js"
|
|
13
13
|
import { logger } from "../../logger.js"
|
|
14
14
|
import { useSelectedMeshExchange } from "../hooks/useSelectedMeshExchange.js"
|
|
15
|
-
import { useMode } from "../hooks/useMode.js"
|
|
16
15
|
import { useCurrentScreen } from "../hooks/useCurrentScreen.js"
|
|
17
|
-
import type { Mode } from "../../mode.js"
|
|
18
|
-
import type { Screen } from "../hooks/useCurrentScreen.js"
|
|
19
16
|
|
|
20
17
|
export interface MeshConnectExchangesProps {
|
|
21
18
|
onBack?: () => void
|
|
22
19
|
onSelectExchange?: (integrationId: string, exchangeName: string) => void
|
|
23
|
-
getInitialScreenForMode?: (mode: Mode) => Screen
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
export const MeshConnectExchanges: React.FC<MeshConnectExchangesProps> = ({
|
|
27
23
|
onBack,
|
|
28
24
|
onSelectExchange,
|
|
29
|
-
getInitialScreenForMode,
|
|
30
25
|
}) => {
|
|
31
26
|
const { setSelectedExchange } = useSelectedMeshExchange()
|
|
32
|
-
const { mode } = useMode()
|
|
33
27
|
const { setCurrentScreen } = useCurrentScreen()
|
|
34
28
|
const [coinbaseId, setCoinbaseId] = useState<string | null>(null)
|
|
35
29
|
const [binanceId, setBinanceId] = useState<string | null>(null)
|
|
@@ -94,15 +88,8 @@ export const MeshConnectExchanges: React.FC<MeshConnectExchangesProps> = ({
|
|
|
94
88
|
// Store the selected exchange
|
|
95
89
|
setSelectedExchange({ integrationId, exchangeName })
|
|
96
90
|
|
|
97
|
-
// Navigate to
|
|
98
|
-
|
|
99
|
-
const currentMode = (mode || "pay") as Mode
|
|
100
|
-
const initialScreen = getInitialScreenForMode(currentMode)
|
|
101
|
-
logger.console.log(
|
|
102
|
-
`[trails-sdk] Navigating to initial screen for mode ${currentMode}: ${initialScreen}`,
|
|
103
|
-
)
|
|
104
|
-
setCurrentScreen(initialScreen)
|
|
105
|
-
}
|
|
91
|
+
// Navigate to home screen
|
|
92
|
+
setCurrentScreen("home")
|
|
106
93
|
}
|
|
107
94
|
|
|
108
95
|
if (loading) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { X } from "lucide-react"
|
|
2
1
|
import { AnimatePresence, motion } from "motion/react"
|
|
3
2
|
import type React from "react"
|
|
4
3
|
import { useEffect, useRef } from "react"
|
|
@@ -70,17 +69,6 @@ const Modal: React.FC<ModalProps> = ({ isOpen, onClose, children }) => {
|
|
|
70
69
|
layoutId="modal-content"
|
|
71
70
|
layout="preserve-aspect"
|
|
72
71
|
>
|
|
73
|
-
<button
|
|
74
|
-
type="button"
|
|
75
|
-
onClick={onClose}
|
|
76
|
-
className="absolute right-4 top-6 flex h-8 w-8 justify-center items-center rounded-full bg-gray-50 dark:bg-gray-700 cursor-pointer transition-colors text-gray-900 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-600 z-20"
|
|
77
|
-
title="Close"
|
|
78
|
-
>
|
|
79
|
-
<X
|
|
80
|
-
className="h-4 w-4"
|
|
81
|
-
style={{ transform: "translate(0, -2px)" }}
|
|
82
|
-
/>
|
|
83
|
-
</button>
|
|
84
72
|
{children}
|
|
85
73
|
</motion.div>
|
|
86
74
|
</div>
|