0xtrails 0.4.3 → 0.6.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/analytics.d.ts +8 -3
- package/dist/analytics.d.ts.map +1 -1
- package/dist/{ccip-C9CA3tIi.js → ccip-Dw5AN7oU.js} +27 -27
- package/dist/cctp.d.ts +0 -149
- package/dist/cctp.d.ts.map +1 -1
- package/dist/chains.d.ts +31 -4
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +28 -52
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -7
- package/dist/constants.d.ts.map +1 -1
- package/dist/contractUtils.d.ts.map +1 -1
- package/dist/estimate.d.ts.map +1 -1
- package/dist/fees.d.ts.map +1 -1
- package/dist/gasless.d.ts +12 -0
- package/dist/gasless.d.ts.map +1 -1
- package/dist/{index-CNB57v0n.js → index-BtVUTbEZ.js} +32255 -40547
- package/dist/index.d.ts +13 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +320 -944
- package/dist/indexerClient.d.ts +9 -6
- package/dist/indexerClient.d.ts.map +1 -1
- package/dist/intents.d.ts +0 -18
- package/dist/intents.d.ts.map +1 -1
- package/dist/mutations.d.ts.map +1 -1
- package/dist/paymasterSend.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/sendUserOp.d.ts +0 -18
- package/dist/sendUserOp.d.ts.map +1 -1
- package/dist/sequenceWallet.d.ts +1 -1
- package/dist/sequenceWallet.d.ts.map +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +10 -8
- package/dist/tokens.d.ts.map +1 -1
- package/dist/trailsClient.d.ts +3 -3
- package/dist/trailsClient.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts +4 -5
- package/dist/transactionIntent/deposits/depositOrchestrator.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts +4 -5
- package/dist/transactionIntent/deposits/gaslessDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/deposits/standardDeposit.d.ts +2 -2
- package/dist/transactionIntent/deposits/standardDeposit.d.ts.map +1 -1
- package/dist/transactionIntent/execution/transactionState.d.ts +2 -2
- package/dist/transactionIntent/execution/transactionState.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +6 -4
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/index.d.ts +0 -1
- package/dist/transactionIntent/handlers/index.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +4 -34
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +2 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +7 -19
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactionIntent/utils/index.d.ts +0 -1
- package/dist/transactionIntent/utils/index.d.ts.map +1 -1
- package/dist/transactions.d.ts +6 -18
- package/dist/transactions.d.ts.map +1 -1
- package/dist/utils.d.ts +8 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/walletUtils.d.ts +21 -0
- package/dist/walletUtils.d.ts.map +1 -0
- package/dist/wallets.d.ts +33 -240
- package/dist/wallets.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/ConfigDisplay.d.ts.map +1 -1
- package/dist/widget/components/FeeOption.d.ts +8 -13
- package/dist/widget/components/FeeOption.d.ts.map +1 -1
- package/dist/widget/components/FeeOptions.d.ts +11 -5
- package/dist/widget/components/FeeOptions.d.ts.map +1 -1
- package/dist/widget/components/NativeGasOption.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/QRCodeDeposit.d.ts +5 -0
- package/dist/widget/components/QRCodeDeposit.d.ts.map +1 -1
- package/dist/widget/components/QRCodeWalletSelect.d.ts +13 -0
- package/dist/widget/components/QRCodeWalletSelect.d.ts.map +1 -0
- 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/ScreenHeader.d.ts +1 -1
- package/dist/widget/components/ScreenHeader.d.ts.map +1 -1
- package/dist/widget/components/SlippageToleranceSettings.d.ts +1 -0
- package/dist/widget/components/SlippageToleranceSettings.d.ts.map +1 -1
- package/dist/widget/components/Toast.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.d.ts.map +1 -1
- package/dist/widget/components/WalletConnect.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useCheckout.d.ts +15 -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/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts +7 -0
- package/dist/widget/hooks/useIsConnectedWalletSmartContract.d.ts.map +1 -0
- package/dist/widget/hooks/useIsSequenceWallet.d.ts +6 -0
- package/dist/widget/hooks/useIsSequenceWallet.d.ts.map +1 -0
- package/dist/widget/hooks/useQuote.d.ts +6 -11
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useRecentTokens.d.ts.map +1 -1
- package/dist/widget/hooks/useSelectedFeeOption.d.ts +30 -0
- package/dist/widget/hooks/useSelectedFeeOption.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.d.ts +6 -15
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/index.d.ts +1 -0
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +4 -2
- package/dist/widget/providers/TrailsProvider.d.ts +29 -0
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -0
- package/dist/widget/widget.d.ts +14 -3
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/analytics.ts +53 -21
- package/src/cctp.ts +0 -1016
- package/src/chains.ts +155 -68
- package/src/config.ts +51 -207
- package/src/constants.ts +1 -13
- package/src/contractUtils.ts +6 -6
- package/src/estimate.ts +3 -6
- package/src/fees.ts +5 -10
- package/src/gasless.ts +45 -0
- package/src/index.ts +18 -40
- package/src/indexerClient.ts +39 -48
- package/src/intents.ts +51 -226
- package/src/mutations.ts +3 -2
- package/src/paymasterSend.ts +2 -5
- package/src/prepareSend.ts +21 -14
- package/src/sendUserOp.ts +3 -64
- package/src/sequenceWallet.ts +1 -2
- package/src/tokenBalances.ts +2 -1
- package/src/tokens.ts +62 -133
- package/src/trailsClient.ts +17 -12
- package/src/transactionIntent/deposits/depositOrchestrator.ts +14 -15
- package/src/transactionIntent/deposits/gaslessDeposit.ts +70 -100
- package/src/transactionIntent/deposits/standardDeposit.ts +22 -28
- package/src/transactionIntent/execution/transactionState.ts +2 -2
- package/src/transactionIntent/handlers/crossChain.ts +179 -381
- package/src/transactionIntent/handlers/index.ts +0 -1
- package/src/transactionIntent/handlers/sameChainSameToken.ts +228 -94
- package/src/transactionIntent/quote/normalizeQuote.ts +4 -6
- package/src/transactionIntent/quote/quoteHelpers.ts +35 -3
- package/src/transactionIntent/types.ts +7 -27
- package/src/transactionIntent/utils/index.ts +0 -1
- package/src/transactions.ts +19 -118
- package/src/umd.tsx +1 -3
- package/src/utils.ts +28 -8
- package/src/walletUtils.ts +42 -0
- package/src/wallets.ts +365 -208
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +78 -4
- package/src/widget/components/AccountSettings.tsx +17 -17
- package/src/widget/components/ChainList.tsx +3 -3
- package/src/widget/components/ClassicSwap.tsx +19 -10
- package/src/widget/components/ConfigDisplay.tsx +19 -59
- package/src/widget/components/FeeOption.tsx +63 -20
- package/src/widget/components/FeeOptions.tsx +54 -123
- package/src/widget/components/NativeGasOption.tsx +3 -1
- package/src/widget/components/Pay.tsx +18 -11
- package/src/widget/components/PoolDeposit.tsx +23 -10
- package/src/widget/components/QRCodeDeposit.tsx +50 -30
- package/src/widget/components/QRCodeWalletSelect.tsx +77 -0
- package/src/widget/components/QrCode.tsx +188 -233
- package/src/widget/components/QuoteDetails.tsx +48 -2
- package/src/widget/components/Receipt.tsx +5 -2
- package/src/widget/components/ScreenHeader.tsx +10 -8
- package/src/widget/components/SlippageToleranceSettings.tsx +63 -14
- package/src/widget/components/Toast.tsx +10 -0
- package/src/widget/components/TokenImage.tsx +56 -13
- package/src/widget/components/WalletConnect.tsx +37 -99
- package/src/widget/hooks/useCheckout.ts +71 -0
- package/src/widget/hooks/useCurrentScreen.tsx +1 -0
- package/src/widget/hooks/useDebugScreens.ts +5 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +790 -412
- package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +43 -0
- package/src/widget/hooks/useIsSequenceWallet.ts +17 -0
- package/src/widget/hooks/useQuote.ts +27 -34
- package/src/widget/hooks/useRecentTokens.ts +2 -1
- package/src/widget/hooks/useSelectedFeeOption.tsx +257 -0
- package/src/widget/hooks/useSendForm.ts +175 -46
- package/src/widget/hooks/useTokenList.ts +15 -2
- package/src/widget/index.tsx +8 -0
- package/src/widget/providers/TrailsProvider.tsx +123 -0
- package/src/widget/widget.tsx +165 -143
- package/dist/cctpqueue.d.ts +0 -18
- package/dist/cctpqueue.d.ts.map +0 -1
- package/dist/preconditions.d.ts +0 -12
- package/dist/preconditions.d.ts.map +0 -1
- package/dist/trails.d.ts +0 -110
- package/dist/trails.d.ts.map +0 -1
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts +0 -62
- package/dist/transactionIntent/handlers/sameChainDifferentToken.d.ts.map +0 -1
- package/dist/transactionIntent/utils/lifiHelpers.d.ts +0 -10
- package/dist/transactionIntent/utils/lifiHelpers.d.ts.map +0 -1
- package/dist/widget/hooks/useSelectedFeeToken.d.ts +0 -33
- package/dist/widget/hooks/useSelectedFeeToken.d.ts.map +0 -1
- package/src/cctpqueue.ts +0 -66
- package/src/preconditions.ts +0 -47
- package/src/trails.ts +0 -1303
- package/src/transactionIntent/handlers/sameChainDifferentToken.ts +0 -323
- package/src/transactionIntent/utils/lifiHelpers.ts +0 -68
- package/src/widget/hooks/useSelectedFeeToken.tsx +0 -288
|
@@ -194,9 +194,9 @@ export const Pay: React.FC<PayProps> = ({
|
|
|
194
194
|
isValidCustomToken,
|
|
195
195
|
isSenderContractOnOrigin,
|
|
196
196
|
isSenderContractOnDestination,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
processedFeeOptions,
|
|
198
|
+
selectedFeeOption,
|
|
199
|
+
setSelectedFeeOption,
|
|
200
200
|
} = useSendForm({
|
|
201
201
|
account,
|
|
202
202
|
toAmount: tokenAmountForBackend || toAmount, // Use the input amount as target amount for EXACT_OUTPUT
|
|
@@ -672,7 +672,7 @@ export const Pay: React.FC<PayProps> = ({
|
|
|
672
672
|
{/* Payment Request Header */}
|
|
673
673
|
<div className="space-y-1 trails-bg-secondary trails-border-radius-container p-3">
|
|
674
674
|
<div className="flex justify-start">
|
|
675
|
-
<div className="flex items-center font-medium trails-text-primary text-sm whitespace-
|
|
675
|
+
<div className="flex items-center font-medium trails-text-primary text-sm flex-wrap whitespace-break-spaces break-all min-w-full">
|
|
676
676
|
{payMessage}
|
|
677
677
|
</div>
|
|
678
678
|
</div>
|
|
@@ -1019,13 +1019,20 @@ export const Pay: React.FC<PayProps> = ({
|
|
|
1019
1019
|
) : null}
|
|
1020
1020
|
|
|
1021
1021
|
{/* Fee Options */}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1022
|
+
{fundMethod !== "qr-code" && fundMethod !== "exchange" && (
|
|
1023
|
+
<FeeOptions
|
|
1024
|
+
processedFeeOptions={processedFeeOptions}
|
|
1025
|
+
selectedFeeOption={selectedFeeOption}
|
|
1026
|
+
setSelectedFeeOption={(feeOption) => setSelectedFeeOption(feeOption)}
|
|
1027
|
+
chainId={originToken?.chainId}
|
|
1028
|
+
isRefetching={isLoadingQuote}
|
|
1029
|
+
originTokenInfo={{
|
|
1030
|
+
originToken: originToken!,
|
|
1031
|
+
originTokenBalance: originToken?.balance ?? "0",
|
|
1032
|
+
originTokenAmount: tokenAmountForBackend ?? "0",
|
|
1033
|
+
}}
|
|
1034
|
+
/>
|
|
1035
|
+
)}
|
|
1029
1036
|
|
|
1030
1037
|
{/* Quote Details */}
|
|
1031
1038
|
{prepareSendQuote && (
|
|
@@ -39,6 +39,7 @@ import { FeeOptions } from "./FeeOptions.js"
|
|
|
39
39
|
import { generateAaveDepositCalldata } from "../../aave.js"
|
|
40
40
|
import { generateMorphoDepositCalldata } from "../../morpho.js"
|
|
41
41
|
import { TRAILS_ROUTER_PLACEHOLDER_AMOUNT } from "../../trailsRouter.js"
|
|
42
|
+
import { ScreenHeader } from "./ScreenHeader.js"
|
|
42
43
|
|
|
43
44
|
interface PoolDepositProps {
|
|
44
45
|
account?: Account
|
|
@@ -180,9 +181,9 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
180
181
|
isSubmitting,
|
|
181
182
|
buttonText,
|
|
182
183
|
isValidRecipient,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
processedFeeOptions,
|
|
185
|
+
selectedFeeOption,
|
|
186
|
+
setSelectedFeeOption,
|
|
186
187
|
} = useSendForm({
|
|
187
188
|
account,
|
|
188
189
|
toAmount: undefined,
|
|
@@ -320,6 +321,11 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
320
321
|
if (showOriginTokenSelector) {
|
|
321
322
|
return (
|
|
322
323
|
<div className="space-y-2">
|
|
324
|
+
<ScreenHeader
|
|
325
|
+
onBack={() => setShowOriginTokenSelector(false)}
|
|
326
|
+
headerContent="Select Token"
|
|
327
|
+
headerContentAlign="left"
|
|
328
|
+
/>
|
|
323
329
|
<TokenSelector
|
|
324
330
|
onTokenSelect={handleOriginTokenSelect}
|
|
325
331
|
onError={onError}
|
|
@@ -583,13 +589,20 @@ export const PoolDeposit: React.FC<PoolDepositProps> = ({
|
|
|
583
589
|
) : null}
|
|
584
590
|
|
|
585
591
|
{/* Fee Options */}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
592
|
+
{fundMethod !== "qr-code" && fundMethod !== "exchange" && (
|
|
593
|
+
<FeeOptions
|
|
594
|
+
processedFeeOptions={processedFeeOptions}
|
|
595
|
+
selectedFeeOption={selectedFeeOption as any}
|
|
596
|
+
setSelectedFeeOption={(feeOption) => setSelectedFeeOption(feeOption)}
|
|
597
|
+
chainId={originToken?.chainId}
|
|
598
|
+
isRefetching={isLoadingQuote}
|
|
599
|
+
originTokenInfo={{
|
|
600
|
+
originToken: originToken!,
|
|
601
|
+
originTokenBalance: originToken?.balance ?? "0",
|
|
602
|
+
originTokenAmount: amount ?? "0",
|
|
603
|
+
}}
|
|
604
|
+
/>
|
|
605
|
+
)}
|
|
593
606
|
|
|
594
607
|
{/* Quote Details */}
|
|
595
608
|
{prepareSendQuote && (
|
|
@@ -2,35 +2,68 @@ import { TokenImage } from "./TokenImage.js"
|
|
|
2
2
|
import { ChainImage } from "./ChainImage.js"
|
|
3
3
|
import { ExternalLink } from "lucide-react"
|
|
4
4
|
import type React from "react"
|
|
5
|
-
import {
|
|
5
|
+
import { useMemo } from "react"
|
|
6
6
|
import type { PrepareSendQuote } from "../../prepareSend.js"
|
|
7
7
|
import { QuoteDetails } from "./QuoteDetails.js"
|
|
8
8
|
import { QrCode } from "./QrCode.js"
|
|
9
|
-
import { formatUnits } from "viem"
|
|
9
|
+
import { formatUnits, getAddress, zeroAddress } from "viem"
|
|
10
10
|
import { getExplorerUrlForAddress } from "../../explorer.js"
|
|
11
11
|
import { ScreenHeader } from "./ScreenHeader.js"
|
|
12
|
+
import { useQRCodeWallets, type QRCodeWalletOption } from "../../wallets.js"
|
|
12
13
|
|
|
13
14
|
interface QRCodeDepositProps {
|
|
14
15
|
onBack?: () => void
|
|
16
|
+
onChangeWallet?: () => void
|
|
15
17
|
quote?: PrepareSendQuote | null
|
|
18
|
+
use681QrCode?: boolean
|
|
19
|
+
selectedWalletId?: string | null
|
|
20
|
+
walletOptions?: QRCodeWalletOption[]
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
export const QRCodeDeposit: React.FC<QRCodeDepositProps> = ({
|
|
19
24
|
onBack,
|
|
25
|
+
onChangeWallet,
|
|
20
26
|
quote,
|
|
27
|
+
use681QrCode,
|
|
28
|
+
selectedWalletId,
|
|
29
|
+
walletOptions,
|
|
21
30
|
}) => {
|
|
22
|
-
const
|
|
31
|
+
const defaultQrCodeWallets = useQRCodeWallets()
|
|
32
|
+
const defaultWalletOptions = walletOptions || defaultQrCodeWallets
|
|
33
|
+
const selectedWalletOption =
|
|
34
|
+
defaultWalletOptions.find((option) => option.id === selectedWalletId) ??
|
|
35
|
+
defaultWalletOptions[0]
|
|
36
|
+
|
|
37
|
+
const shouldUseEip681 =
|
|
38
|
+
use681QrCode ?? selectedWalletOption?.usesEip681 ?? true
|
|
23
39
|
|
|
24
40
|
const eip631Url = useMemo(() => {
|
|
25
41
|
if (!quote) return ""
|
|
26
|
-
|
|
42
|
+
const depositAddress = getAddress(quote.originDepositAddress)
|
|
43
|
+
return `ethereum:${depositAddress}@${quote.originChain.id}`
|
|
27
44
|
}, [quote])
|
|
28
45
|
|
|
29
46
|
const eip681Url = useMemo(() => {
|
|
30
47
|
if (!quote) return ""
|
|
31
|
-
|
|
48
|
+
|
|
49
|
+
const tokenAddress = getAddress(quote.originToken.contractAddress)
|
|
50
|
+
const depositAddress = getAddress(quote.originDepositAddress)
|
|
51
|
+
|
|
52
|
+
if (tokenAddress === zeroAddress) {
|
|
53
|
+
return `ethereum:${depositAddress}@${quote.originChain.id}?value=${quote.originAmount}`
|
|
54
|
+
} else {
|
|
55
|
+
return `ethereum:${tokenAddress}@${quote.originChain.id}/transfer?address=${depositAddress}&uint256=${quote.originAmount}`
|
|
56
|
+
}
|
|
32
57
|
}, [quote])
|
|
33
58
|
|
|
59
|
+
const qrCodeUrl = useMemo(() => {
|
|
60
|
+
if (!quote) return ""
|
|
61
|
+
if (shouldUseEip681) return eip681Url
|
|
62
|
+
return eip631Url
|
|
63
|
+
}, [quote, shouldUseEip681, eip631Url, eip681Url])
|
|
64
|
+
|
|
65
|
+
const walletIcon = selectedWalletOption?.icon
|
|
66
|
+
|
|
34
67
|
return (
|
|
35
68
|
<div className="space-y-6">
|
|
36
69
|
<ScreenHeader
|
|
@@ -48,36 +81,23 @@ export const QRCodeDeposit: React.FC<QRCodeDepositProps> = ({
|
|
|
48
81
|
</p>
|
|
49
82
|
</div>
|
|
50
83
|
|
|
51
|
-
{/* QR Code Section
|
|
84
|
+
{/* QR Code Section */}
|
|
52
85
|
<div className="space-y-3 p-4 bg-gray-50 dark:bg-gray-800 rounded-lg">
|
|
53
|
-
<div className="flex
|
|
54
|
-
|
|
86
|
+
<div className="flex flex-col items-center gap-3 text-center">
|
|
87
|
+
{onChangeWallet && use681QrCode === undefined && (
|
|
55
88
|
<button
|
|
56
89
|
type="button"
|
|
57
|
-
onClick={
|
|
58
|
-
className="
|
|
59
|
-
title={
|
|
60
|
-
useSimpleQrCode
|
|
61
|
-
? `Click to show detailed transfer QR code (EIP-681). Current URL: ${eip631Url}`
|
|
62
|
-
: `Click to show simple address QR code (EIP-631). Current URL: ${eip681Url}`
|
|
63
|
-
}
|
|
90
|
+
onClick={onChangeWallet}
|
|
91
|
+
className="text-xs font-medium text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 transition-colors cursor-pointer"
|
|
64
92
|
>
|
|
65
|
-
|
|
66
|
-
url={useSimpleQrCode ? eip631Url : eip681Url}
|
|
67
|
-
size={300}
|
|
68
|
-
/>
|
|
93
|
+
Choose a different wallet
|
|
69
94
|
</button>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
>
|
|
77
|
-
EIP-681
|
|
78
|
-
<ExternalLink className="w-3 h-3" />
|
|
79
|
-
</a>
|
|
80
|
-
)}
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div className="flex justify-center">
|
|
99
|
+
<div className="flex flex-col items-center">
|
|
100
|
+
<QrCode url={qrCodeUrl} size={300} imageUrl={walletIcon} />
|
|
81
101
|
</div>
|
|
82
102
|
</div>
|
|
83
103
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type React from "react"
|
|
2
|
+
import { ScreenHeader } from "./ScreenHeader.js"
|
|
3
|
+
import { useQRCodeWallets, type QRCodeWalletOption } from "../../wallets.js"
|
|
4
|
+
|
|
5
|
+
interface QRCodeWalletSelectProps {
|
|
6
|
+
onBack?: () => void
|
|
7
|
+
onSelect: (walletId: string) => void
|
|
8
|
+
selectedWalletId?: string | null
|
|
9
|
+
walletOptions?: QRCodeWalletOption[]
|
|
10
|
+
title?: string
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const QRCodeWalletSelect: React.FC<QRCodeWalletSelectProps> = ({
|
|
15
|
+
onBack,
|
|
16
|
+
onSelect,
|
|
17
|
+
selectedWalletId,
|
|
18
|
+
walletOptions,
|
|
19
|
+
title = "Which wallet will scan the QR code?",
|
|
20
|
+
disabled = false,
|
|
21
|
+
}) => {
|
|
22
|
+
const defaultQrCodeWallets = useQRCodeWallets()
|
|
23
|
+
const defaultWalletOptions = walletOptions || defaultQrCodeWallets
|
|
24
|
+
return (
|
|
25
|
+
<div className="space-y-6">
|
|
26
|
+
<ScreenHeader
|
|
27
|
+
onBack={onBack}
|
|
28
|
+
headerContent="Deposit"
|
|
29
|
+
headerContentAlign="left"
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<div className="space-y-6">
|
|
33
|
+
<div className="text-center px-4">
|
|
34
|
+
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100">
|
|
35
|
+
{title}
|
|
36
|
+
</h2>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div className="grid grid-cols-2 gap-3">
|
|
40
|
+
{defaultWalletOptions.map((wallet) => {
|
|
41
|
+
const isSelected = wallet.id === selectedWalletId
|
|
42
|
+
return (
|
|
43
|
+
<button
|
|
44
|
+
key={wallet.id}
|
|
45
|
+
type="button"
|
|
46
|
+
onClick={() => !disabled && onSelect(wallet.id)}
|
|
47
|
+
disabled={disabled}
|
|
48
|
+
className={`flex flex-col items-center justify-center gap-3 rounded-xl border px-4 py-6 text-center transition-all duration-200 min-h-[120px] ${
|
|
49
|
+
isSelected
|
|
50
|
+
? "border-blue-500 bg-blue-50 shadow-md dark:border-blue-400 dark:bg-blue-900/30"
|
|
51
|
+
: "border-gray-200 bg-white hover:bg-gray-50 hover:shadow-sm active:scale-[0.98] dark:border-gray-700 dark:bg-gray-900 dark:hover:bg-gray-800"
|
|
52
|
+
} ${disabled ? "opacity-60 cursor-not-allowed" : "cursor-pointer"}`}
|
|
53
|
+
>
|
|
54
|
+
{wallet.icon ? (
|
|
55
|
+
<img
|
|
56
|
+
src={wallet.icon}
|
|
57
|
+
alt={wallet.label}
|
|
58
|
+
className="h-12 w-12 rounded-full object-contain shrink-0"
|
|
59
|
+
/>
|
|
60
|
+
) : (
|
|
61
|
+
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-gray-200 text-sm font-semibold text-gray-600 dark:bg-gray-700 dark:text-gray-200 shrink-0">
|
|
62
|
+
{wallet.label.charAt(0).toUpperCase()}
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
<div className="text-sm font-semibold text-gray-900 dark:text-gray-100">
|
|
66
|
+
{wallet.label}
|
|
67
|
+
</div>
|
|
68
|
+
</button>
|
|
69
|
+
)
|
|
70
|
+
})}
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default QRCodeWalletSelect
|