0xtrails 0.5.0 → 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-DhEkQ6QC.js → ccip-Dw5AN7oU.js} +1 -1
- package/dist/cctp.d.ts +0 -149
- package/dist/cctp.d.ts.map +1 -1
- package/dist/chains.d.ts +28 -3
- package/dist/chains.d.ts.map +1 -1
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- 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-MhD2DA7_.js → index-BtVUTbEZ.js} +30984 -38945
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -107
- package/dist/indexerClient.d.ts +2 -2
- package/dist/intents.d.ts +0 -17
- 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/tokenBalances.d.ts.map +1 -1
- package/dist/tokens.d.ts +10 -8
- package/dist/tokens.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 +4 -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 +6 -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 +2 -20
- 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/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/Toast.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.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 +5 -8
- 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.js +1 -1
- package/dist/widget/providers/TrailsProvider.d.ts +23 -12
- package/dist/widget/providers/TrailsProvider.d.ts.map +1 -1
- package/dist/widget/widget.d.ts +11 -0
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/analytics.ts +53 -21
- package/src/cctp.ts +0 -1016
- package/src/chains.ts +93 -39
- package/src/config.ts +24 -6
- package/src/constants.ts +1 -4
- 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 +7 -6
- package/src/indexerClient.ts +2 -2
- package/src/intents.ts +52 -206
- package/src/mutations.ts +3 -2
- package/src/paymasterSend.ts +2 -5
- package/src/prepareSend.ts +9 -12
- package/src/sendUserOp.ts +3 -64
- package/src/tokenBalances.ts +2 -1
- package/src/tokens.ts +62 -133
- package/src/trailsClient.ts +1 -1
- 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 +165 -385
- 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 +6 -27
- package/src/transactionIntent/utils/index.ts +0 -1
- package/src/transactions.ts +6 -203
- package/src/umd.tsx +1 -3
- package/src/utils.ts +28 -8
- package/src/walletUtils.ts +42 -0
- package/src/wallets.ts +361 -203
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +73 -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 +1 -1
- 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/Toast.tsx +10 -0
- package/src/widget/components/TokenImage.tsx +56 -13
- 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 +788 -418
- package/src/widget/hooks/useIsConnectedWalletSmartContract.ts +43 -0
- package/src/widget/hooks/useIsSequenceWallet.ts +17 -0
- package/src/widget/hooks/useQuote.ts +16 -17
- package/src/widget/hooks/useRecentTokens.ts +2 -1
- package/src/widget/hooks/useSelectedFeeOption.tsx +257 -0
- package/src/widget/hooks/useSendForm.ts +172 -47
- package/src/widget/hooks/useTokenList.ts +15 -2
- package/src/widget/providers/TrailsProvider.tsx +53 -25
- package/src/widget/widget.tsx +119 -48
- 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/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 -69
- package/src/preconditions.ts +0 -47
- package/src/transactionIntent/handlers/sameChainDifferentToken.ts +0 -323
- package/src/transactionIntent/utils/lifiHelpers.ts +0 -68
- package/src/widget/hooks/useSelectedFeeToken.tsx +0 -288
|
@@ -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
|