0xtrails 0.0.1 → 0.0.2
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/LICENSE +202 -0
- package/README.md +42 -0
- package/dist/abi.d.ts +37 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +36 -0
- package/dist/apiClient.d.ts +9 -0
- package/dist/apiClient.d.ts.map +1 -0
- package/dist/apiClient.js +18 -0
- package/dist/buffer.d.ts +3 -0
- package/dist/buffer.d.ts.map +1 -0
- package/dist/buffer.js +8 -0
- package/dist/cctp.d.ts +84 -0
- package/dist/cctp.d.ts.map +1 -0
- package/dist/cctp.js +401 -0
- package/dist/chainSwitch.d.ts +7 -0
- package/dist/chainSwitch.d.ts.map +1 -0
- package/dist/chainSwitch.js +33 -0
- package/dist/chains.d.ts +13 -0
- package/dist/chains.d.ts.map +1 -0
- package/dist/chains.js +95 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +16 -0
- package/dist/encoders.d.ts +7 -0
- package/dist/encoders.d.ts.map +1 -0
- package/dist/encoders.js +8 -0
- package/dist/error.d.ts +2 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +12 -0
- package/dist/explorer.d.ts +12 -0
- package/dist/explorer.d.ts.map +1 -0
- package/dist/explorer.js +18 -0
- package/dist/gasless.d.ts +116 -0
- package/dist/gasless.d.ts.map +1 -0
- package/dist/gasless.js +297 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/indexerClient.d.ts +9 -0
- package/dist/indexerClient.d.ts.map +1 -0
- package/dist/indexerClient.js +18 -0
- package/dist/intents.d.ts +83 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +288 -0
- package/dist/metaTxnMonitor.d.ts +14 -0
- package/dist/metaTxnMonitor.d.ts.map +1 -0
- package/dist/metaTxnMonitor.js +121 -0
- package/dist/metaTxns.d.ts +6 -0
- package/dist/metaTxns.d.ts.map +1 -0
- package/dist/metaTxns.js +4 -0
- package/dist/paymasterSend.d.ts +90 -0
- package/dist/paymasterSend.d.ts.map +1 -0
- package/dist/paymasterSend.js +329 -0
- package/dist/preconditions.d.ts +11 -0
- package/dist/preconditions.d.ts.map +1 -0
- package/dist/preconditions.js +29 -0
- package/dist/prepareSend.d.ts +102 -0
- package/dist/prepareSend.d.ts.map +1 -0
- package/dist/prepareSend.js +1080 -0
- package/dist/prices.d.ts +18 -0
- package/dist/prices.d.ts.map +1 -0
- package/dist/prices.js +142 -0
- package/dist/queryParams.d.ts +9 -0
- package/dist/queryParams.d.ts.map +1 -0
- package/dist/queryParams.js +66 -0
- package/dist/relaySdk.d.ts +65 -0
- package/dist/relaySdk.d.ts.map +1 -0
- package/dist/relaySdk.js +314 -0
- package/dist/relayer.d.ts +23 -0
- package/dist/relayer.d.ts.map +1 -0
- package/dist/relayer.js +230 -0
- package/dist/sendUserOp.d.ts +140 -0
- package/dist/sendUserOp.d.ts.map +1 -0
- package/dist/sendUserOp.js +388 -0
- package/dist/sequenceWallet.d.ts +79 -0
- package/dist/sequenceWallet.d.ts.map +1 -0
- package/dist/sequenceWallet.js +374 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +1 -0
- package/dist/toSimpleSmartAccount.d.ts +95 -0
- package/dist/toSimpleSmartAccount.d.ts.map +1 -0
- package/dist/toSimpleSmartAccount.js +373 -0
- package/dist/tokenBalances.d.ts +118 -0
- package/dist/tokenBalances.d.ts.map +1 -0
- package/dist/tokenBalances.js +492 -0
- package/dist/tokens.d.ts +50 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +356 -0
- package/dist/trails.d.ts +128 -0
- package/dist/trails.d.ts.map +1 -0
- package/dist/trails.js +1031 -0
- package/dist/umd/trails.min.js +12610 -0
- package/dist/umd/trails.min.js.map +1 -0
- package/dist/umd.d.ts +24 -0
- package/dist/umd.d.ts.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +9 -0
- package/dist/widget/ConstantsUtil-B-_-u8aQ.js +6 -0
- package/dist/widget/add-hVLs3ldJ.js +20 -0
- package/dist/widget/all-wallets-Cwxnx4BT.js +11 -0
- package/dist/widget/app-store-CAAVQjW0.js +22 -0
- package/dist/widget/apple-C3BSbglw.js +23 -0
- package/dist/widget/arrow-bottom-circle-BGU9MmsZ.js +16 -0
- package/dist/widget/arrow-bottom-hS_SA8Gp.js +13 -0
- package/dist/widget/arrow-left-CJZanWz7.js +13 -0
- package/dist/widget/arrow-right-C1qL8EMd.js +13 -0
- package/dist/widget/arrow-top-CbuCmbQs.js +13 -0
- package/dist/widget/bank-CXBEEGbb.js +19 -0
- package/dist/widget/bin-Dqzv3zCZ.js +9 -0
- package/dist/widget/bitcoin-4y3sovZp.js +18 -0
- package/dist/widget/browser-DyOl4_8m.js +1413 -0
- package/dist/widget/browser-t7Fh0sEU.js +19 -0
- package/dist/widget/card-Bo4CZkTs.js +19 -0
- package/dist/widget/ccip-BynehMIN.js +232 -0
- package/dist/widget/checkmark-DV6OKvnY.js +16 -0
- package/dist/widget/checkmark-bold-CAp1-IQ2.js +13 -0
- package/dist/widget/chevron-bottom-BjzsVzk9.js +13 -0
- package/dist/widget/chevron-left-CQZBDCiR.js +13 -0
- package/dist/widget/chevron-right-Dhg4zeZM.js +13 -0
- package/dist/widget/chevron-top-CDQmfJef.js +13 -0
- package/dist/widget/chrome-store-BNaC_b6w.js +66 -0
- package/dist/widget/circle-BC_GBj91.js +9 -0
- package/dist/widget/clock-BmF8-4a0.js +13 -0
- package/dist/widget/close-Bf61nZ8o.js +13 -0
- package/dist/widget/coinPlaceholder-7cZW2058.js +13 -0
- package/dist/widget/compass-CFC3yhnW.js +13 -0
- package/dist/widget/components/ChainImage.d.ts +8 -0
- package/dist/widget/components/ChainImage.d.ts.map +1 -0
- package/dist/widget/components/ChainImage.js +6 -0
- package/dist/widget/components/ConnectWallet.d.ts +18 -0
- package/dist/widget/components/ConnectWallet.d.ts.map +1 -0
- package/dist/widget/components/ConnectWallet.js +66 -0
- package/dist/widget/components/DebugScreensDropdown.d.ts +9 -0
- package/dist/widget/components/DebugScreensDropdown.d.ts.map +1 -0
- package/dist/widget/components/DebugScreensDropdown.js +40 -0
- package/dist/widget/components/FeeOptions.d.ts +17 -0
- package/dist/widget/components/FeeOptions.d.ts.map +1 -0
- package/dist/widget/components/FeeOptions.js +65 -0
- package/dist/widget/components/Footer.d.ts +9 -0
- package/dist/widget/components/Footer.d.ts.map +1 -0
- package/dist/widget/components/Footer.js +13 -0
- package/dist/widget/components/GreenCheckAnimation.d.ts +2 -0
- package/dist/widget/components/GreenCheckAnimation.d.ts.map +1 -0
- package/dist/widget/components/GreenCheckAnimation.js +74 -0
- package/dist/widget/components/Modal.d.ts +11 -0
- package/dist/widget/components/Modal.d.ts.map +1 -0
- package/dist/widget/components/Modal.js +36 -0
- package/dist/widget/components/Receipt.d.ts +13 -0
- package/dist/widget/components/Receipt.d.ts.map +1 -0
- package/dist/widget/components/Receipt.js +36 -0
- package/dist/widget/components/SendForm.d.ts +44 -0
- package/dist/widget/components/SendForm.d.ts.map +1 -0
- package/dist/widget/components/SendForm.js +177 -0
- package/dist/widget/components/TokenImage.d.ts +10 -0
- package/dist/widget/components/TokenImage.d.ts.map +1 -0
- package/dist/widget/components/TokenImage.js +8 -0
- package/dist/widget/components/TokenList.d.ts +16 -0
- package/dist/widget/components/TokenList.d.ts.map +1 -0
- package/dist/widget/components/TokenList.js +39 -0
- package/dist/widget/components/TransferPending.d.ts +11 -0
- package/dist/widget/components/TransferPending.d.ts.map +1 -0
- package/dist/widget/components/TransferPending.js +77 -0
- package/dist/widget/components/TransferPendingVertical.d.ts +18 -0
- package/dist/widget/components/TransferPendingVertical.d.ts.map +1 -0
- package/dist/widget/components/TransferPendingVertical.js +183 -0
- package/dist/widget/components/WalletConfirmation.d.ts +18 -0
- package/dist/widget/components/WalletConfirmation.d.ts.map +1 -0
- package/dist/widget/components/WalletConfirmation.js +22 -0
- package/dist/widget/config.d.ts +4 -0
- package/dist/widget/config.d.ts.map +1 -0
- package/dist/widget/config.js +3 -0
- package/dist/widget/copy-e0xXvKN0.js +20 -0
- package/dist/widget/cursor-CqM3v0xJ.js +8 -0
- package/dist/widget/cursor-transparent-CUQpdsCG.js +17 -0
- package/dist/widget/desktop-DUDGIRpM.js +14 -0
- package/dist/widget/disconnect-DUFST9QQ.js +13 -0
- package/dist/widget/discord-C1cj365Z.js +22 -0
- package/dist/widget/email-BHhmb_lX.js +703 -0
- package/dist/widget/embedded-wallet-CuuC4eah.js +467 -0
- package/dist/widget/ethereum-CfmBVfeB.js +15 -0
- package/dist/widget/etherscan-BSiynDhW.js +11 -0
- package/dist/widget/exclamation-triangle-DEiFNpHw.js +9 -0
- package/dist/widget/extension-mRmfCDxo.js +13 -0
- package/dist/widget/external-link-B4xMIVnW.js +13 -0
- package/dist/widget/facebook-CBAZStBR.js +31 -0
- package/dist/widget/farcaster-LHDEDf5S.js +17 -0
- package/dist/widget/filters-CBijuvFv.js +13 -0
- package/dist/widget/github-C3ILD420.js +23 -0
- package/dist/widget/google-CSj73POX.js +23 -0
- package/dist/widget/help-circle-2hdG5IdB.js +17 -0
- package/dist/widget/hooks/useAmountUsd.d.ts +13 -0
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -0
- package/dist/widget/hooks/useAmountUsd.js +35 -0
- package/dist/widget/hooks/useSendForm.d.ts +125 -0
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -0
- package/dist/widget/hooks/useSendForm.js +450 -0
- package/dist/widget/hooks/useTokenList.d.ts +52 -0
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -0
- package/dist/widget/hooks/useTokenList.js +252 -0
- package/dist/widget/id-ByYSrwsd.js +17 -0
- package/dist/widget/if-defined-DRXJEhv7.js +752 -0
- package/dist/widget/image-C90L4Rf6.js +9 -0
- package/dist/widget/index-B3SlQ9v3.js +46 -0
- package/dist/widget/index-B8LPuLXQ.js +78 -0
- package/dist/widget/index-BDbworWA.js +171 -0
- package/dist/widget/index-BTlDgFSK.js +98 -0
- package/dist/widget/index-BUCcjXbd.js +306 -0
- package/dist/widget/index-BZ34edi2.js +1055 -0
- package/dist/widget/index-BiCU29wK.js +147 -0
- package/dist/widget/index-BlmqIKsY.js +266 -0
- package/dist/widget/index-BlviH5nG.js +55 -0
- package/dist/widget/index-Bwd5X3fS.js +8306 -0
- package/dist/widget/index-C5gmknHK.js +78 -0
- package/dist/widget/index-CD6dBcRj.js +76 -0
- package/dist/widget/index-CDlhy529.js +63 -0
- package/dist/widget/index-CHXa5ke-.js +59 -0
- package/dist/widget/index-CK94R-H7.js +22498 -0
- package/dist/widget/index-CQzo3m3x.js +182 -0
- package/dist/widget/index-CRT8cAwG.js +325 -0
- package/dist/widget/index-CY7Lt2Yu.js +310 -0
- package/dist/widget/index-CiKfAu1E.js +79 -0
- package/dist/widget/index-CkCu6rMi.js +258 -0
- package/dist/widget/index-CngLTu_R.js +517 -0
- package/dist/widget/index-CsMV8-em.js +2577 -0
- package/dist/widget/index-Cu2Wva8v.js +200 -0
- package/dist/widget/index-DKBxLTEF.js +240 -0
- package/dist/widget/index-DQEVT3dx.js +511 -0
- package/dist/widget/index-DU2HcCis.js +200 -0
- package/dist/widget/index-DutZGWNW.js +321 -0
- package/dist/widget/index-O0glArmc.js +182 -0
- package/dist/widget/index-O8FmRjKe.js +63719 -0
- package/dist/widget/index-RtKXrB6I.js +576 -0
- package/dist/widget/index-TIYtS0gE.js +88 -0
- package/dist/widget/index-dQNJvWHs.js +66 -0
- package/dist/widget/index-wmEwdsq7.js +909 -0
- package/dist/widget/index.d.ts +3 -0
- package/dist/widget/index.d.ts.map +1 -0
- package/dist/widget/index.js +2 -0
- package/dist/widget/info-DMPChDjV.js +8 -0
- package/dist/widget/info-circle-DAvS_7nY.js +17 -0
- package/dist/widget/lightbulb-DnZ9mNEs.js +8 -0
- package/dist/widget/lit-html-BRjl1r6K.js +243 -0
- package/dist/widget/mail-DpaVSOP8.js +13 -0
- package/dist/widget/mobile-CRvdyu7I.js +14 -0
- package/dist/widget/more-C5VqW9PR.js +16 -0
- package/dist/widget/network-placeholder-CZ0vApma.js +19 -0
- package/dist/widget/nftPlaceholder-7jjIK2bT.js +13 -0
- package/dist/widget/off-4mHjJLLX.js +9 -0
- package/dist/widget/onramp-Bc0ozVsw.js +929 -0
- package/dist/widget/play-store-Uocul8nC.js +37 -0
- package/dist/widget/plus-DrYF7siO.js +18 -0
- package/dist/widget/prepareSend-BQJmzM5B.js +54987 -0
- package/dist/widget/qr-code-DcnGMUB3.js +11 -0
- package/dist/widget/receive-fvIVd7R_.js +184 -0
- package/dist/widget/recycle-horizontal-DrDwXC4D.js +14 -0
- package/dist/widget/ref-CXNmEjML.js +41 -0
- package/dist/widget/refresh-OK9lIPLS.js +13 -0
- package/dist/widget/reown-logo-C-Qn7mS3.js +17 -0
- package/dist/widget/search-DZqv1oKg.js +13 -0
- package/dist/widget/send-CJlmI-xe.js +1039 -0
- package/dist/widget/send-otoEC8uU.js +20 -0
- package/dist/widget/socials-BJciurWF.js +599 -0
- package/dist/widget/solana-Bv5Hs_0T.js +18 -0
- package/dist/widget/swapHorizontal-BzOPGV37.js +13 -0
- package/dist/widget/swapHorizontalBold-axyHnSmj.js +13 -0
- package/dist/widget/swapHorizontalMedium-C6YOPfPz.js +21 -0
- package/dist/widget/swapHorizontalRoundedBold-yVcLbWNT.js +13 -0
- package/dist/widget/swapVertical-BDjxt9pE.js +13 -0
- package/dist/widget/swaps-DEWNj4kd.js +1637 -0
- package/dist/widget/telegram-BQJD7dlP.js +21 -0
- package/dist/widget/three-dots-DW9jmSMG.js +10 -0
- package/dist/widget/transactions-uCseGQQt.js +38 -0
- package/dist/widget/twitch-XugxDfOE.js +23 -0
- package/dist/widget/twitterIcon-DQVObQUL.js +11 -0
- package/dist/widget/types.d.ts +51 -0
- package/dist/widget/types.d.ts.map +1 -0
- package/dist/widget/types.js +1 -0
- package/dist/widget/verify-DpMYHxLf.js +13 -0
- package/dist/widget/verify-filled-KpEL6ZJ_.js +13 -0
- package/dist/widget/w3m-modal-C8e-6Kba.js +1047 -0
- package/dist/widget/wallet-D8ssEB0o.js +13 -0
- package/dist/widget/wallet-placeholder-HtAy21Wc.js +19 -0
- package/dist/widget/walletconnect-Bp_4XfrY.js +37 -0
- package/dist/widget/warning-circle-FgYS7P7n.js +17 -0
- package/dist/widget/widget/index.js +7 -0
- package/dist/widget/widget.d.ts +47 -0
- package/dist/widget/widget.d.ts.map +1 -0
- package/dist/widget/widget.js +932 -0
- package/dist/widget/x-DlZBoP9k.js +17 -0
- package/dist/widget/x-mark-Ba9pt-_h.js +8 -0
- package/package.json +102 -8
- package/src/abi.ts +38 -0
- package/src/apiClient.ts +32 -0
- package/src/buffer.ts +10 -0
- package/src/cctp.ts +579 -0
- package/src/chainSwitch.ts +55 -0
- package/src/chains.ts +124 -0
- package/src/constants.ts +26 -0
- package/src/encoders.ts +20 -0
- package/src/error.ts +15 -0
- package/src/explorer.ts +37 -0
- package/src/gasless.ts +545 -0
- package/src/index.ts +48 -0
- package/src/indexerClient.ts +36 -0
- package/src/intents.ts +537 -0
- package/src/metaTxnMonitor.ts +163 -0
- package/src/metaTxns.ts +21 -0
- package/src/paymasterSend.ts +503 -0
- package/src/preconditions.ts +52 -0
- package/src/prepareSend.ts +1849 -0
- package/src/prices.ts +186 -0
- package/src/queryParams.ts +80 -0
- package/src/relaySdk.ts +481 -0
- package/src/relayer.ts +255 -0
- package/src/sendUserOp.ts +570 -0
- package/src/sequenceWallet.ts +579 -0
- package/src/theme.ts +2 -0
- package/src/toSimpleSmartAccount.ts +567 -0
- package/src/tokenBalances.ts +760 -0
- package/src/tokens.ts +471 -0
- package/src/trails.ts +1591 -0
- package/src/types.d.ts +11 -0
- package/src/umd.tsx +49 -0
- package/src/utils.ts +16 -0
- package/src/vite-env.d.ts +4 -0
- package/src/widget/assets/MetaMask-icon-fox-with-margins.svg +31 -0
- package/src/widget/assets/MetaMask-icon-fox.svg +26 -0
- package/src/widget/assets/MetaMask-logo-black.svg +3 -0
- package/src/widget/assets/MetaMask-logo-white.svg +16 -0
- package/src/widget/assets/Privy_Brandmark_Black.svg +9 -0
- package/src/widget/assets/Privy_Brandmark_White.svg +9 -0
- package/src/widget/assets/Trails-logo-black.svg +11 -0
- package/src/widget/assets/Trails-logo-white.svg +11 -0
- package/src/widget/components/ChainImage.tsx +28 -0
- package/src/widget/components/ConnectWallet.tsx +206 -0
- package/src/widget/components/DebugScreensDropdown.tsx +88 -0
- package/src/widget/components/FeeOptions.tsx +199 -0
- package/src/widget/components/Footer.tsx +51 -0
- package/src/widget/components/GreenCheckAnimation.tsx +119 -0
- package/src/widget/components/Modal.tsx +97 -0
- package/src/widget/components/Receipt.tsx +237 -0
- package/src/widget/components/SendForm.tsx +695 -0
- package/src/widget/components/TokenImage.tsx +37 -0
- package/src/widget/components/TokenList.tsx +287 -0
- package/src/widget/components/TransferPending.tsx +204 -0
- package/src/widget/components/TransferPendingVertical.tsx +412 -0
- package/src/widget/components/WalletConfirmation.tsx +172 -0
- package/src/widget/config.ts +5 -0
- package/src/widget/hooks/useAmountUsd.ts +59 -0
- package/src/widget/hooks/useSendForm.ts +715 -0
- package/src/widget/hooks/useTokenList.ts +397 -0
- package/src/widget/index.css +2 -0
- package/src/widget/index.tsx +8 -0
- package/src/widget/types/svg.d.ts +8 -0
- package/src/widget/types.ts +59 -0
- package/src/widget/widget.tsx +1438 -0
- package/index.js +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown } from "lucide-react";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { useQueryParams } from "../../queryParams.js";
|
|
5
|
+
const SCREENS = [
|
|
6
|
+
"Connect",
|
|
7
|
+
"Tokens",
|
|
8
|
+
"Send",
|
|
9
|
+
"Wallet Confirmation",
|
|
10
|
+
"Pending 1-item-0-confirmed",
|
|
11
|
+
"Pending 1-item-1-confirmed",
|
|
12
|
+
"Pending 2-item-0-confirmed",
|
|
13
|
+
"Pending 2-item-1-confirmed",
|
|
14
|
+
"Pending 2-item-2-confirmed",
|
|
15
|
+
"Pending 3-item-0-confirmed",
|
|
16
|
+
"Pending 3-item-1-confirmed",
|
|
17
|
+
"Pending 3-item-2-confirmed",
|
|
18
|
+
"Pending 3-item-3-confirmed",
|
|
19
|
+
"Receipt",
|
|
20
|
+
];
|
|
21
|
+
export const DebugScreensDropdown = ({ onScreenSelect, theme = "light", }) => {
|
|
22
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
23
|
+
const dropdownRef = useRef(null);
|
|
24
|
+
const { hasParam } = useQueryParams();
|
|
25
|
+
const shouldShow = hasParam("debug", "true");
|
|
26
|
+
if (!shouldShow) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return (_jsxs("div", { className: "relative", ref: dropdownRef, children: [_jsx("button", { type: "button", onClick: () => setIsOpen(!isOpen), className: `p-1 rounded-full hover:bg-opacity-10 ${theme === "dark"
|
|
30
|
+
? "hover:bg-gray-800 text-gray-200"
|
|
31
|
+
: "hover:bg-gray-100 text-gray-700"}`, children: _jsx(ChevronDown, { className: "w-4 h-4" }) }), isOpen && (_jsx("div", { className: `absolute bottom-full right-0 mb-1 w-40 border rounded-lg shadow-lg overflow-hidden max-h-[300px] overflow-y-auto ${theme === "dark"
|
|
32
|
+
? "bg-gray-800 border-gray-700 text-gray-200"
|
|
33
|
+
: "bg-white border-gray-200 text-gray-700"}`, children: SCREENS.map((screen) => (_jsx("button", { type: "button", onClick: () => {
|
|
34
|
+
onScreenSelect(screen);
|
|
35
|
+
setIsOpen(false);
|
|
36
|
+
}, className: `w-full text-left px-3 py-2 text-sm ${theme === "dark"
|
|
37
|
+
? "text-gray-200 hover:bg-gray-700"
|
|
38
|
+
: "text-gray-700 hover:bg-gray-50"}`, children: screen }, screen))) }))] }));
|
|
39
|
+
};
|
|
40
|
+
export default DebugScreensDropdown;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ActiveTheme } from "../../theme.js";
|
|
3
|
+
interface FeeToken {
|
|
4
|
+
name: string;
|
|
5
|
+
symbol: string;
|
|
6
|
+
imageUrl: string;
|
|
7
|
+
decimals: number;
|
|
8
|
+
}
|
|
9
|
+
interface FeeOptionsProps {
|
|
10
|
+
options: FeeToken[];
|
|
11
|
+
selectedOption?: FeeToken;
|
|
12
|
+
onSelect: (option: FeeToken) => void;
|
|
13
|
+
theme?: ActiveTheme;
|
|
14
|
+
}
|
|
15
|
+
export declare const FeeOptions: React.FC<FeeOptionsProps>;
|
|
16
|
+
export default FeeOptions;
|
|
17
|
+
//# sourceMappingURL=FeeOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeeOptions.d.ts","sourceRoot":"","sources":["../../../src/widget/components/FeeOptions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAajD,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,QAAQ,EAAE,CAAA;IACnB,cAAc,CAAC,EAAE,QAAQ,CAAA;IACzB,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAA;IACpC,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoKhD,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { TokenImage } from "./TokenImage.js";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { useQueryParams } from "../../queryParams.js";
|
|
6
|
+
// Simulated fee amounts and prices
|
|
7
|
+
const FEE_AMOUNTS = {
|
|
8
|
+
ETH: "0.00001",
|
|
9
|
+
USDC: "0.1",
|
|
10
|
+
};
|
|
11
|
+
const TOKEN_PRICES = {
|
|
12
|
+
ETH: 3500, // Simulated ETH price in USD
|
|
13
|
+
USDC: 1, // USDC is pegged to USD
|
|
14
|
+
};
|
|
15
|
+
export const FeeOptions = ({ options, selectedOption, onSelect, theme = "light", }) => {
|
|
16
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
17
|
+
const dropdownRef = useRef(null);
|
|
18
|
+
const { hasParam } = useQueryParams();
|
|
19
|
+
// Show fee display if feeOptions=true is in URL params
|
|
20
|
+
const shouldShowFeeDisplay = hasParam("feeOptions", "true");
|
|
21
|
+
// Calculate USD value of fee
|
|
22
|
+
const feeUsdValue = useMemo(() => {
|
|
23
|
+
if (!selectedOption)
|
|
24
|
+
return "0.00";
|
|
25
|
+
const feeAmount = parseFloat(FEE_AMOUNTS[selectedOption.symbol] || "0");
|
|
26
|
+
const tokenPrice = TOKEN_PRICES[selectedOption.symbol] || 0;
|
|
27
|
+
const usdValue = feeAmount * tokenPrice;
|
|
28
|
+
return usdValue.toFixed(2);
|
|
29
|
+
}, [selectedOption]);
|
|
30
|
+
// Set first option as default if none selected
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!selectedOption && options.length > 0) {
|
|
33
|
+
onSelect(options[0]);
|
|
34
|
+
}
|
|
35
|
+
}, [selectedOption, options, onSelect]);
|
|
36
|
+
// Handle clicking outside to close dropdown
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const handleClickOutside = (event) => {
|
|
39
|
+
if (dropdownRef.current &&
|
|
40
|
+
!dropdownRef.current.contains(event.target)) {
|
|
41
|
+
setIsDropdownOpen(false);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
45
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
46
|
+
}, []);
|
|
47
|
+
if (!shouldShowFeeDisplay) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return (_jsxs("div", { className: "space-y-1", ref: dropdownRef, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("label", { className: `block text-xs font-medium ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Pay fee with" }), selectedOption && (_jsxs("div", { className: `text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: ["Fee ", FEE_AMOUNTS[selectedOption.symbol], " ", selectedOption.symbol, _jsxs("span", { className: `ml-1 text-xs ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: ["\u2248 $", feeUsdValue] })] }))] }), _jsxs("div", { className: "relative flex justify-start", children: [_jsxs("button", { type: "button", onClick: () => setIsDropdownOpen(!isDropdownOpen), className: `w-32 flex items-center px-3 py-2 border rounded-[16px] hover:border-gray-400 cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm ${theme === "dark"
|
|
51
|
+
? "bg-gray-800 border-gray-700 text-white"
|
|
52
|
+
: "bg-white border-gray-300 text-gray-900"}`, children: [selectedOption ? (_jsxs(_Fragment, { children: [_jsx(TokenImage, { symbol: selectedOption.symbol, imageUrl: selectedOption.imageUrl, size: 16 }), _jsx("span", { className: "ml-1.5 flex-1 text-left", children: selectedOption.symbol })] })) : (_jsx("span", { className: "flex-1 text-left text-gray-400", children: "Select Fee Token" })), _jsx(ChevronDown, { className: `h-4 w-4 ${theme === "dark" ? "text-gray-400" : "text-gray-400"} transition-transform ${isDropdownOpen ? "transform rotate-180" : ""}` })] }), isDropdownOpen && (_jsx("div", { className: `absolute z-10 mt-1 border rounded-[16px] shadow-lg w-32 ${theme === "dark"
|
|
53
|
+
? "bg-gray-800 border-gray-700"
|
|
54
|
+
: "bg-white border-gray-200"}`, children: options.map((option) => (_jsxs("button", { type: "button", onClick: () => {
|
|
55
|
+
onSelect(option);
|
|
56
|
+
setIsDropdownOpen(false);
|
|
57
|
+
}, className: `w-full flex items-center px-3 py-2 cursor-pointer text-sm ${theme === "dark"
|
|
58
|
+
? selectedOption?.symbol === option.symbol
|
|
59
|
+
? "bg-gray-700 text-white"
|
|
60
|
+
: "text-white hover:bg-gray-700"
|
|
61
|
+
: selectedOption?.symbol === option.symbol
|
|
62
|
+
? "bg-gray-100 text-gray-900"
|
|
63
|
+
: "text-gray-900 hover:bg-gray-50"}`, children: [_jsx("div", { className: `w-4 h-4 rounded-full flex items-center justify-center ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: _jsx(TokenImage, { symbol: option.symbol, imageUrl: option.imageUrl, size: 16 }) }), _jsx("span", { className: "ml-1.5", children: option.symbol }), selectedOption?.symbol === option.symbol && (_jsx("span", { className: `ml-auto ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: "\u2022" }))] }, option.symbol))) }))] })] }));
|
|
64
|
+
};
|
|
65
|
+
export default FeeOptions;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ActiveTheme } from "../../theme.js";
|
|
3
|
+
interface FooterProps {
|
|
4
|
+
theme: ActiveTheme;
|
|
5
|
+
onDebugScreenSelect: (screen: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const Footer: React.FC<FooterProps>;
|
|
8
|
+
export default Footer;
|
|
9
|
+
//# sourceMappingURL=Footer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../src/widget/components/Footer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAMjD,UAAU,WAAW;IACnB,KAAK,EAAE,WAAW,CAAA;IAClB,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9C;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmCxC,CAAA;AAED,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { motion } from "motion/react";
|
|
3
|
+
import TrailsLogoBlack from "../assets/Trails-logo-black.svg";
|
|
4
|
+
import TrailsLogoWhite from "../assets/Trails-logo-white.svg";
|
|
5
|
+
import { SITE_URL } from "../config.js";
|
|
6
|
+
import DebugScreensDropdown from "./DebugScreensDropdown.js";
|
|
7
|
+
export const Footer = ({ theme, onDebugScreenSelect, }) => {
|
|
8
|
+
const TrailsLogo = theme === "dark" ? TrailsLogoWhite : TrailsLogoBlack;
|
|
9
|
+
return (_jsxs(motion.div, { initial: { opacity: 0, y: 10 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.15 }, className: `mt-auto pt-4 text-center text-sm relative flex items-center justify-center ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, layout: true, children: [_jsx("div", { className: "absolute right-0 flex items-center h-full", children: _jsx(DebugScreensDropdown, { onScreenSelect: onDebugScreenSelect, theme: theme }) }), "Powered by\u00A0", _jsx("a", { href: SITE_URL, target: "_blank", rel: "noopener noreferrer", className: `font-medium transition-colors hover:opacity-80 leading-none ${theme === "dark"
|
|
10
|
+
? "text-gray-400 hover:text-white"
|
|
11
|
+
: "text-gray-500 hover:text-black"}`, children: _jsx("img", { src: TrailsLogo, alt: "Trails", className: "h-4 inline-block" }) })] }));
|
|
12
|
+
};
|
|
13
|
+
export default Footer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GreenCheckAnimation.d.ts","sourceRoot":"","sources":["../../../src/widget/components/GreenCheckAnimation.tsx"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,4CAoHlC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
export function GreenCheckAnimation() {
|
|
4
|
+
const [animate, setAnimate] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const timer = setTimeout(() => {
|
|
7
|
+
setAnimate(true);
|
|
8
|
+
}, 100);
|
|
9
|
+
return () => clearTimeout(timer);
|
|
10
|
+
}, []);
|
|
11
|
+
const styles = {
|
|
12
|
+
container: {
|
|
13
|
+
width: "80px",
|
|
14
|
+
height: "80px",
|
|
15
|
+
position: "relative",
|
|
16
|
+
},
|
|
17
|
+
circleContainer: {
|
|
18
|
+
position: "relative",
|
|
19
|
+
width: "100%",
|
|
20
|
+
height: "100%",
|
|
21
|
+
},
|
|
22
|
+
circleFill: {
|
|
23
|
+
position: "absolute",
|
|
24
|
+
top: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: "100%",
|
|
28
|
+
borderRadius: "50%",
|
|
29
|
+
backgroundColor: "#22c55e",
|
|
30
|
+
transform: animate ? "scale(1)" : "scale(0)",
|
|
31
|
+
opacity: animate ? 1 : 0,
|
|
32
|
+
transition: "transform 0.15s ease-out 0.3s, opacity 0.15s ease-out 0.3s",
|
|
33
|
+
},
|
|
34
|
+
progressRing: {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
top: 0,
|
|
37
|
+
left: 0,
|
|
38
|
+
width: "100%",
|
|
39
|
+
height: "100%",
|
|
40
|
+
transform: "rotate(-90deg)",
|
|
41
|
+
},
|
|
42
|
+
circle: {
|
|
43
|
+
fill: "none",
|
|
44
|
+
stroke: "url(#gradient)",
|
|
45
|
+
strokeWidth: 4,
|
|
46
|
+
strokeLinecap: "round",
|
|
47
|
+
strokeDasharray: 226,
|
|
48
|
+
strokeDashoffset: animate ? 0 : 226,
|
|
49
|
+
transition: "stroke-dashoffset 0.3s ease-out",
|
|
50
|
+
},
|
|
51
|
+
checkmarkContainer: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
top: "50%",
|
|
54
|
+
left: "50%",
|
|
55
|
+
transform: animate
|
|
56
|
+
? "translate(-50%, -50%) scale(1)"
|
|
57
|
+
: "translate(-50%, -50%) scale(0)",
|
|
58
|
+
opacity: animate ? 1 : 0,
|
|
59
|
+
zIndex: 10,
|
|
60
|
+
transition: "transform 0.1s ease-out 0.4s, opacity 0.1s ease-out 0.4s",
|
|
61
|
+
},
|
|
62
|
+
checkmarkPath: {
|
|
63
|
+
fill: "none",
|
|
64
|
+
stroke: "white",
|
|
65
|
+
strokeWidth: 4,
|
|
66
|
+
strokeLinecap: "round",
|
|
67
|
+
strokeLinejoin: "round",
|
|
68
|
+
strokeDasharray: 18,
|
|
69
|
+
strokeDashoffset: animate ? 0 : 18,
|
|
70
|
+
transition: "stroke-dashoffset 0.15s ease-out 0.45s",
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
return (_jsx("div", { style: styles.container, children: _jsxs("div", { style: styles.circleContainer, children: [_jsx("div", { style: styles.circleFill }), _jsxs("svg", { style: styles.progressRing, children: [_jsx("defs", { children: _jsxs("radialGradient", { id: "gradient", cx: "50%", cy: "50%", r: "50%", gradientUnits: "objectBoundingBox", children: [_jsx("stop", { offset: "0%", style: { stopColor: "#22c55e", stopOpacity: 0 } }), _jsx("stop", { offset: "70%", style: { stopColor: "#22c55e", stopOpacity: 0.3 } }), _jsx("stop", { offset: "100%", style: { stopColor: "#22c55e", stopOpacity: 1 } })] }) }), _jsx("circle", { cx: "40", cy: "40", r: "36", style: styles.circle })] }), _jsx("div", { style: styles.checkmarkContainer, children: _jsx("svg", { width: "48", height: "48", viewBox: "0 0 24 24", children: _jsx("path", { d: "M6 14l4 4L18 8", style: styles.checkmarkPath }) }) })] }) }));
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ActiveTheme } from "../../theme.js";
|
|
3
|
+
interface ModalProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
theme?: ActiveTheme;
|
|
8
|
+
}
|
|
9
|
+
declare const Modal: React.FC<ModalProps>;
|
|
10
|
+
export default Modal;
|
|
11
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/widget/components/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,UAAU,UAAU;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB;AAED,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAiF/B,CAAA;AAED,eAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
const Modal = ({ isOpen, onClose, children, theme = "light", }) => {
|
|
6
|
+
const modalRef = useRef(null);
|
|
7
|
+
// Handle escape key
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const handleEscape = (e) => {
|
|
10
|
+
if (e.key === "Escape") {
|
|
11
|
+
onClose();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
if (isOpen) {
|
|
15
|
+
document.addEventListener("keydown", handleEscape);
|
|
16
|
+
}
|
|
17
|
+
return () => {
|
|
18
|
+
document.removeEventListener("keydown", handleEscape);
|
|
19
|
+
};
|
|
20
|
+
}, [isOpen, onClose]);
|
|
21
|
+
// Handle click outside
|
|
22
|
+
const handleClickOutside = (e) => {
|
|
23
|
+
if (modalRef.current && !modalRef.current.contains(e.target)) {
|
|
24
|
+
onClose();
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return (_jsx(AnimatePresence, { children: isOpen && (_jsxs(_Fragment, { children: [_jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, className: "fixed inset-0 bg-black/50 backdrop-blur-sm z-50", onClick: onClose }), _jsx("div", { className: `fixed inset-0 flex items-center justify-center z-50 p-2 sm:p-4 ${theme === "dark" ? "text-white" : "text-gray-900"}`, onClick: handleClickOutside, children: _jsxs(motion.div, { ref: modalRef, initial: { opacity: 0, scale: 0.95, y: 10 }, animate: { opacity: 1, scale: 1, y: 0 }, exit: { opacity: 0, scale: 0.95, y: 10 }, transition: {
|
|
28
|
+
type: "spring",
|
|
29
|
+
stiffness: 400,
|
|
30
|
+
damping: 25,
|
|
31
|
+
mass: 0.8,
|
|
32
|
+
}, className: "pointer-events-auto relative", layoutId: "modal-content", layout: "preserve-aspect", children: [_jsx("button", { type: "button", onClick: onClose, className: `absolute right-2 top-2 p-2 rounded-full transition-colors cursor-pointer z-10 ${theme === "dark"
|
|
33
|
+
? "hover:bg-gray-800 text-gray-400"
|
|
34
|
+
: "hover:bg-gray-100 text-gray-600"}`, children: _jsx(X, { className: "h-6 w-6" }) }), children] }) })] })) }));
|
|
35
|
+
};
|
|
36
|
+
export default Modal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { TransactionState } from "../../prepareSend.js";
|
|
3
|
+
import type { ActiveTheme } from "../../theme.js";
|
|
4
|
+
interface ReceiptProps {
|
|
5
|
+
onSendAnother: () => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
theme?: ActiveTheme;
|
|
8
|
+
renderInline?: boolean;
|
|
9
|
+
transactionStates?: TransactionState[];
|
|
10
|
+
}
|
|
11
|
+
export declare const Receipt: React.FC<ReceiptProps>;
|
|
12
|
+
export default Receipt;
|
|
13
|
+
//# sourceMappingURL=Receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Receipt.d.ts","sourceRoot":"","sources":["../../../src/widget/components/Receipt.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAGjD,UAAU,YAAY;IACpB,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAA;CACvC;AAED,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA4N1C,CAAA;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// biome-ignore lint/style/useImportType: False positive
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { GreenCheckAnimation } from "./GreenCheckAnimation.js";
|
|
5
|
+
export const Receipt = ({ onClose, theme = "light", renderInline = false, transactionStates = [], }) => {
|
|
6
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
7
|
+
const [showContent, setShowContent] = useState(false);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const timer = setTimeout(() => {
|
|
10
|
+
setShowContent(true);
|
|
11
|
+
}, 400);
|
|
12
|
+
return () => clearTimeout(timer);
|
|
13
|
+
}, []);
|
|
14
|
+
const finalExplorerUrl = transactionStates?.[transactionStates.length - 1]?.explorerUrl;
|
|
15
|
+
if (!finalExplorerUrl) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (_jsxs("div", { className: "flex flex-col justify-center min-h-full space-y-6 pt-8", children: [_jsxs("div", { className: "text-center", children: [_jsx("div", { className: `mx-auto flex items-center justify-center`, children: _jsx(GreenCheckAnimation, {}) }), _jsx("div", { className: `transition-all duration-500 ease-out ${showContent ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4"}`, children: _jsx("h2", { className: `mt-4 text-2xl font-bold ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: "Transaction Confirmed" }) })] }), _jsx("div", { className: `text-center transition-all duration-500 ease-out delay-100 ${showContent ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4"}`, children: _jsxs("a", { href: finalExplorerUrl, target: "_blank", rel: "noopener noreferrer", className: `inline-flex items-center gap-1 px-3 py-1.5 rounded-md font-medium transition-colors border text-sm
|
|
19
|
+
${theme === "dark"
|
|
20
|
+
? "bg-gray-900 border-gray-700 text-blue-300 hover:bg-gray-800 hover:text-blue-200"
|
|
21
|
+
: "bg-white border-gray-200 text-black hover:bg-gray-50 hover:text-gray-900"}
|
|
22
|
+
`, children: ["View on Explorer", _jsx("svg", { className: "w-4 h-4 ml-1", fill: "none", viewBox: "0 0 24 24", stroke: theme === "dark" ? "currentColor" : "black", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })] }) }), _jsxs("div", { className: `space-y-3 transition-all duration-500 ease-out delay-200 ${showContent ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4"}`, children: [!renderInline && (_jsx("button", { onClick: onClose, className: `w-full cursor-pointer font-semibold py-3 px-4 rounded-[24px] transition-colors ${theme === "dark"
|
|
23
|
+
? "bg-gray-800 hover:bg-gray-700 text-gray-300 hover:text-white"
|
|
24
|
+
: "bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-900"}`, children: "Close" })), _jsxs("button", { onClick: () => setShowDetails(!showDetails), className: `w-full flex items-center justify-center gap-2 py-2 px-4 rounded-[24px] transition-colors cursor-pointer text-sm ${theme === "dark"
|
|
25
|
+
? "text-gray-400 hover:text-gray-300"
|
|
26
|
+
: "text-gray-500 hover:text-gray-700"}`, children: [_jsx("span", { children: "More Details" }), _jsx("svg", { className: `w-4 h-4 transition-transform ${showDetails ? "rotate-180" : ""}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }), showDetails && (_jsx("div", { className: `p-4 rounded-lg text-sm space-y-4 ${theme === "dark" ? "bg-gray-800" : "bg-gray-50"}`, children: transactionStates.length > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: `font-medium ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Transactions:" }), _jsx("div", { className: "space-y-2", children: transactionStates.map((state) => (_jsxs("div", { className: `p-2 rounded ${theme === "dark" ? "bg-gray-700/50" : "bg-gray-100"}`, children: [_jsxs("div", { className: "flex justify-between items-center", children: [_jsxs("span", { className: theme === "dark" ? "text-gray-400" : "text-gray-600", children: [state.label, ":"] }), _jsx("span", { className: `px-2 py-0.5 rounded-full text-xs ${state.state === "confirmed"
|
|
27
|
+
? theme === "dark"
|
|
28
|
+
? "bg-green-900/50 text-green-400"
|
|
29
|
+
: "bg-green-100 text-green-700"
|
|
30
|
+
: theme === "dark"
|
|
31
|
+
? "bg-yellow-900/50 text-yellow-400"
|
|
32
|
+
: "bg-yellow-100 text-yellow-700"}`, children: state.state })] }), _jsxs("div", { className: "mt-1 flex justify-between items-center", children: [_jsx("span", { className: theme === "dark" ? "text-gray-400" : "text-gray-600", children: "Chain ID:" }), _jsx("span", { className: theme === "dark" ? "text-white" : "text-gray-900", children: state.chainId })] }), _jsxs("div", { className: "mt-1 flex justify-between items-center", children: [_jsx("span", { className: theme === "dark" ? "text-gray-400" : "text-gray-600", children: "Hash:" }), _jsxs("a", { href: state.explorerUrl, target: "_blank", rel: "noopener noreferrer", className: `flex items-center gap-1 hover:underline ${theme === "dark"
|
|
33
|
+
? "text-blue-400 hover:text-blue-300"
|
|
34
|
+
: "text-blue-600 hover:text-blue-700"}`, children: [_jsxs("span", { children: [state.transactionHash.slice(0, 6), "...", state.transactionHash.slice(-4)] }), _jsx("svg", { className: "w-3 h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })] })] })] }, state.transactionHash))) })] })) }))] })] }));
|
|
35
|
+
};
|
|
36
|
+
export default Receipt;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { Account, WalletClient } from "viem";
|
|
3
|
+
import type { TransactionState } from "../../prepareSend.js";
|
|
4
|
+
import type { RelayerEnv } from "../../relayer.js";
|
|
5
|
+
import type { ActiveTheme } from "../../theme.js";
|
|
6
|
+
import type { OnCompleteProps, Token } from "../hooks/useSendForm.js";
|
|
7
|
+
interface SendFormProps {
|
|
8
|
+
selectedToken: Token;
|
|
9
|
+
onSend: (amount: string, recipient: string) => void;
|
|
10
|
+
onBack: () => void;
|
|
11
|
+
onConfirm: () => void;
|
|
12
|
+
onComplete: (result: OnCompleteProps) => void;
|
|
13
|
+
account: Account;
|
|
14
|
+
sequenceProjectAccessKey: string;
|
|
15
|
+
apiUrl?: string;
|
|
16
|
+
env?: RelayerEnv;
|
|
17
|
+
toRecipient?: string;
|
|
18
|
+
toAmount?: string;
|
|
19
|
+
toChainId?: number;
|
|
20
|
+
toToken?: string;
|
|
21
|
+
toCalldata?: string;
|
|
22
|
+
walletClient: WalletClient;
|
|
23
|
+
theme?: ActiveTheme;
|
|
24
|
+
onTransactionStateChange: (transactionStates: TransactionState[]) => void;
|
|
25
|
+
useSourceTokenForButtonText?: boolean;
|
|
26
|
+
onError: (error: Error | string | null) => void;
|
|
27
|
+
onWaitingForWalletConfirm: (intentAddress?: string, originTokenInfo?: {
|
|
28
|
+
amount: string;
|
|
29
|
+
amountUsd: string;
|
|
30
|
+
tokenSymbol: string;
|
|
31
|
+
tokenName: string;
|
|
32
|
+
chainId: number;
|
|
33
|
+
imageUrl: string;
|
|
34
|
+
}) => void;
|
|
35
|
+
paymasterUrls?: Array<{
|
|
36
|
+
chainId: number;
|
|
37
|
+
url: string;
|
|
38
|
+
}>;
|
|
39
|
+
gasless?: boolean;
|
|
40
|
+
setWalletConfirmRetryHandler: (handler: () => Promise<void>) => void;
|
|
41
|
+
}
|
|
42
|
+
export declare const SendForm: React.FC<SendFormProps>;
|
|
43
|
+
export default SendForm;
|
|
44
|
+
//# sourceMappingURL=SendForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SendForm.d.ts","sourceRoot":"","sources":["../../../src/widget/components/SendForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAa,MAAM,yBAAyB,CAAA;AAMhF,UAAU,aAAa;IACrB,aAAa,EAAE,KAAK,CAAA;IACpB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,UAAU,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAA;IAC7C,OAAO,EAAE,OAAO,CAAA;IAChB,wBAAwB,EAAE,MAAM,CAAA;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,UAAU,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,wBAAwB,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,IAAI,CAAA;IACzE,2BAA2B,CAAC,EAAE,OAAO,CAAA;IACrC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IAC/C,yBAAyB,EAAE,CACzB,aAAa,CAAC,EAAE,MAAM,EACtB,eAAe,CAAC,EAAE;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,EAAE,MAAM,CAAA;QACnB,SAAS,EAAE,MAAM,CAAA;QACjB,OAAO,EAAE,MAAM,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;KACjB,KACE,IAAI,CAAA;IACT,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4BAA4B,EAAE,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAA;CACrE;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA+kB5C,CAAA;AAqDD,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown, ChevronLeft, Loader2 } from "lucide-react";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { isAddress } from "viem";
|
|
5
|
+
import { useSendForm } from "../hooks/useSendForm.js";
|
|
6
|
+
import { ChainImage } from "./ChainImage.js";
|
|
7
|
+
import { FeeOptions } from "./FeeOptions.js";
|
|
8
|
+
import { TokenImage } from "./TokenImage.js";
|
|
9
|
+
export const SendForm = ({ selectedToken, onSend, onBack, onConfirm, onComplete, account, sequenceProjectAccessKey, apiUrl, env, toAmount, toRecipient, toChainId, toToken, toCalldata, walletClient, theme = "light", onTransactionStateChange, useSourceTokenForButtonText = false, onError, onWaitingForWalletConfirm, paymasterUrls, gasless, setWalletConfirmRetryHandler, }) => {
|
|
10
|
+
const { amount, amountUsdFormatted, balanceUsdFormatted, chainInfo, balanceFormatted, handleRecipientInputChange, handleSubmit, isChainDropdownOpen, isSubmitting, isTokenDropdownOpen, recipient, recipientInput, selectedDestinationChain, selectedDestToken, setAmount, setRecipient, setRecipientInput, setSelectedDestinationChain, setSelectedDestToken, buttonText, isValidRecipient, ensAddress, selectedFeeToken, setSelectedFeeToken, FEE_TOKENS, supportedTokens, setIsChainDropdownOpen, setIsTokenDropdownOpen, toAmountFormatted, destinationTokenAddress, supportedChains, isValidCustomToken, } = useSendForm({
|
|
11
|
+
account,
|
|
12
|
+
sequenceProjectAccessKey,
|
|
13
|
+
apiUrl,
|
|
14
|
+
env,
|
|
15
|
+
toAmount,
|
|
16
|
+
toRecipient,
|
|
17
|
+
toChainId,
|
|
18
|
+
toToken,
|
|
19
|
+
toCalldata,
|
|
20
|
+
walletClient,
|
|
21
|
+
theme,
|
|
22
|
+
onTransactionStateChange,
|
|
23
|
+
useSourceTokenForButtonText,
|
|
24
|
+
onError,
|
|
25
|
+
onWaitingForWalletConfirm,
|
|
26
|
+
paymasterUrls,
|
|
27
|
+
gasless,
|
|
28
|
+
onConfirm,
|
|
29
|
+
onComplete,
|
|
30
|
+
onSend,
|
|
31
|
+
selectedToken,
|
|
32
|
+
setWalletConfirmRetryHandler,
|
|
33
|
+
});
|
|
34
|
+
console.log("[trails-sdk] SendForm", {
|
|
35
|
+
amount,
|
|
36
|
+
isValidRecipient,
|
|
37
|
+
isSubmitting,
|
|
38
|
+
destinationTokenAddress,
|
|
39
|
+
isValidCustomToken,
|
|
40
|
+
isChainDropdownOpen,
|
|
41
|
+
selectedDestinationChain,
|
|
42
|
+
supportedChains: supportedChains.length,
|
|
43
|
+
});
|
|
44
|
+
const chainDropdownRef = useRef(null);
|
|
45
|
+
const tokenDropdownRef = useRef(null);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const handleClickOutside = (event) => {
|
|
48
|
+
console.log("[trails-sdk] click outside handler called, isChainDropdownOpen:", isChainDropdownOpen);
|
|
49
|
+
if (chainDropdownRef.current &&
|
|
50
|
+
!chainDropdownRef.current.contains(event.target)) {
|
|
51
|
+
console.log("[trails-sdk] closing chain dropdown from outside click");
|
|
52
|
+
setIsChainDropdownOpen(false);
|
|
53
|
+
}
|
|
54
|
+
if (tokenDropdownRef.current &&
|
|
55
|
+
!tokenDropdownRef.current.contains(event.target)) {
|
|
56
|
+
setIsTokenDropdownOpen(false);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
if (isChainDropdownOpen || isTokenDropdownOpen) {
|
|
60
|
+
document.addEventListener("click", handleClickOutside);
|
|
61
|
+
return () => document.removeEventListener("click", handleClickOutside);
|
|
62
|
+
}
|
|
63
|
+
}, [
|
|
64
|
+
setIsChainDropdownOpen,
|
|
65
|
+
setIsTokenDropdownOpen,
|
|
66
|
+
isChainDropdownOpen,
|
|
67
|
+
isTokenDropdownOpen,
|
|
68
|
+
]);
|
|
69
|
+
if (!selectedDestinationChain) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
if (!selectedToken) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex items-center relative", children: [_jsx("button", { type: "button", onClick: onBack, className: `absolute -left-2 p-2 rounded-full transition-colors cursor-pointer ${theme === "dark"
|
|
76
|
+
? "hover:bg-gray-800 text-gray-400"
|
|
77
|
+
: "hover:bg-gray-100 text-gray-600"}`, children: _jsx(ChevronLeft, { className: "h-6 w-6" }) }), _jsx("h2", { className: `text-lg font-semibold w-full text-center ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: "Send Payment" })] }), _jsx("div", { className: `flex items-center space-x-4 p-4 rounded-lg ${theme === "dark" ? "bg-gray-800" : "bg-gray-50"}`, children: _jsxs("div", { className: "flex items-start justify-between w-full", children: [_jsx("div", { className: "flex items-start space-x-2", children: _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("div", { style: { width: "32px", height: "32px" }, children: _jsx(TokenImage, { symbol: selectedToken.symbol, imageUrl: selectedToken.imageUrl, chainId: selectedToken.chainId, size: 32 }) }), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: `text-sm font-medium max-w-[135px] truncate ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: selectedToken.name }), _jsxs("span", { className: `text-sm ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: ["on ", chainInfo?.name || "Unknown Chain"] })] })] }) }), _jsxs("div", { className: "text-right", children: [_jsxs("div", { className: `text-sm font-medium ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: [_jsxs("span", { className: `${theme === "dark" ? "text-gray-400" : "text-gray-600"}`, children: ["Balance:", " "] }), balanceUsdFormatted] }), _jsxs("div", { className: `text-sm ${theme === "dark" ? "text-gray-400" : "text-gray-600"}`, children: [balanceFormatted, " ", selectedToken.symbol] })] })] }) }), _jsxs("form", { onSubmit: handleSubmit, className: "space-y-2", children: [_jsxs("div", { className: !toChainId ? "mb-4" : undefined, children: [_jsx("label", { htmlFor: "destination-chain", className: `block text-sm font-medium mb-1 ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Destination Chain" }), toChainId ? (_jsxs("div", { className: "flex items-center px-2 py-1", children: [_jsx(ChainImage, { chainId: selectedDestinationChain.id, size: 24 }), _jsx("span", { className: `ml-2 ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: selectedDestinationChain.name })] })) : (_jsxs("div", { className: "relative", ref: chainDropdownRef, children: [_jsxs("button", { type: "button", onClick: () => setIsChainDropdownOpen(!isChainDropdownOpen), className: `w-full flex items-center px-4 py-3 border rounded-[24px] hover:border-gray-400 cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${theme === "dark"
|
|
78
|
+
? "bg-gray-800 border-gray-700 text-white"
|
|
79
|
+
: "bg-white border-gray-300 text-gray-900"}`, children: [_jsx(ChainImage, { chainId: selectedDestinationChain.id, size: 24 }), _jsx("span", { className: "ml-2 flex-1 text-left", children: selectedDestinationChain.name }), _jsx(ChevronDown, { className: `h-5 w-5 ${theme === "dark" ? "text-gray-400" : "text-gray-400"} transition-transform ${isChainDropdownOpen ? "transform rotate-180" : ""}` })] }), isChainDropdownOpen && (_jsx("div", { className: `absolute z-10 w-full mt-1 border rounded-[24px] shadow-lg max-h-60 overflow-y-auto ${theme === "dark"
|
|
80
|
+
? "bg-gray-800 border-gray-700"
|
|
81
|
+
: "bg-white border-gray-200"}`, children: supportedChains.map((chain) => (_jsxs("button", { type: "button", onClick: (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
setSelectedDestinationChain(chain);
|
|
85
|
+
setIsChainDropdownOpen(false);
|
|
86
|
+
}, onMouseDown: (e) => {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
}, className: `w-full flex items-center px-4 py-3 ${theme === "dark"
|
|
90
|
+
? selectedDestinationChain.id === chain.id
|
|
91
|
+
? "bg-gray-700 text-white"
|
|
92
|
+
: "text-white hover:bg-gray-700"
|
|
93
|
+
: selectedDestinationChain.id === chain.id
|
|
94
|
+
? "bg-gray-100 text-gray-900"
|
|
95
|
+
: "text-gray-900 hover:bg-gray-50"}`, children: [_jsx(ChainImage, { chainId: chain.id, size: 24 }), _jsx("span", { className: "ml-2", children: chain.name }), selectedDestinationChain.id === chain.id && (_jsx("span", { className: `ml-auto ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: "\u2022" }))] }, chain.id))) }))] }))] }), _jsxs("div", { className: !toToken ? "mb-4" : undefined, children: [_jsx("label", { htmlFor: "token", className: `block text-sm font-medium mb-1 ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Receive Token" }), toToken ? (_jsxs("div", { className: "flex items-center px-2 py-1", children: [_jsx(TokenImage, { symbol: selectedDestToken?.symbol, imageUrl: selectedDestToken?.imageUrl, size: 24 }), _jsxs("span", { className: `ml-2 ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: [selectedDestToken?.name ?? "Unknown Token", " (", selectedDestToken?.symbol ?? "Unknown Symbol", ")"] })] })) : (_jsxs("div", { className: "relative", ref: tokenDropdownRef, children: [_jsxs("button", { type: "button", onClick: () => setIsTokenDropdownOpen(!isTokenDropdownOpen), className: `w-full flex items-center px-4 py-3 border rounded-[24px] hover:border-gray-400 cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${theme === "dark"
|
|
96
|
+
? "bg-gray-800 border-gray-700 text-white"
|
|
97
|
+
: "bg-white border-gray-300 text-gray-900"}`, children: [_jsx("div", { className: `w-5 h-5 rounded-full flex items-center justify-center text-sm ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: _jsx(TokenImage, { symbol: selectedDestToken?.symbol, imageUrl: selectedDestToken?.imageUrl, size: 24 }) }), _jsxs("span", { className: "ml-2 flex-1 text-left", children: [selectedDestToken?.name, " (", selectedDestToken?.symbol, ")"] }), _jsx(ChevronDown, { className: `h-5 w-5 ${theme === "dark" ? "text-gray-400" : "text-gray-400"} transition-transform ${isTokenDropdownOpen ? "transform rotate-180" : ""}` })] }), isTokenDropdownOpen && (_jsx("div", { className: `absolute z-10 w-full mt-1 border rounded-[24px] shadow-lg max-h-60 overflow-y-auto ${theme === "dark"
|
|
98
|
+
? "bg-gray-800 border-gray-700"
|
|
99
|
+
: "bg-white border-gray-200"}`, children: supportedTokens.map((token) => (_jsxs("button", { type: "button", onClick: () => {
|
|
100
|
+
setSelectedDestToken(token);
|
|
101
|
+
setIsTokenDropdownOpen(false);
|
|
102
|
+
}, className: `w-full flex items-center px-4 py-3 cursor-pointer ${theme === "dark"
|
|
103
|
+
? selectedDestToken?.symbol === token.symbol
|
|
104
|
+
? "bg-gray-700 text-white"
|
|
105
|
+
: "text-white hover:bg-gray-700"
|
|
106
|
+
: selectedDestToken?.symbol === token.symbol
|
|
107
|
+
? "bg-gray-100 text-gray-900"
|
|
108
|
+
: "text-gray-900 hover:bg-gray-50"}`, children: [_jsx("div", { className: `w-5 h-5 rounded-full flex items-center justify-center text-sm ${theme === "dark" ? "bg-gray-700" : "bg-gray-100"}`, children: _jsx(TokenImage, { symbol: token.symbol, imageUrl: token.imageUrl, size: 24 }) }), _jsxs("span", { className: "ml-2", children: [token.name, " (", token.symbol, ")"] }), selectedDestToken?.symbol === token.symbol && (_jsx("span", { className: `ml-auto ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: "\u2022" }))] }, `${token.contractAddress}-${token.chainId}`))) }))] }))] }), _jsxs("div", { className: !toAmount ? "mb-2" : undefined, children: [_jsx("label", { htmlFor: "amount", className: `block text-sm font-medium mb-1 ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: "Amount to Receive" }), toAmount ? (_jsxs("div", { className: "flex items-center justify-between px-2 py-1", children: [_jsxs("span", { className: `${theme === "dark" ? "text-white" : "text-gray-900"}`, children: [toAmountFormatted, " ", selectedDestToken?.symbol] }), _jsxs("span", { className: `text-sm ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: ["\u2248 ", amountUsdFormatted] })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative rounded-lg", children: [_jsx("input", { id: "amount", type: "text", value: amount, onChange: (e) => setAmount(e.target.value), placeholder: "0.00", className: `block w-full pl-4 pr-12 py-3 border rounded-[24px] focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-lg ${theme === "dark"
|
|
109
|
+
? "bg-gray-800 border-gray-700 text-white placeholder-gray-500"
|
|
110
|
+
: "bg-white border-gray-300 text-gray-900 placeholder-gray-400"}` }), _jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-4", children: _jsx("span", { className: theme === "dark" ? "text-gray-400" : "text-gray-500", children: selectedDestToken?.symbol }) })] }), _jsx("div", { className: "h-6 mt-1", children: amount && selectedDestToken?.symbol && (_jsxs("div", { className: `text-sm ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: ["\u2248 ", amountUsdFormatted] })) })] }))] }), _jsxs("div", { className: !toRecipient ? "mb-4" : undefined, children: [_jsxs("div", { className: "flex justify-between items-center mb-1", children: [_jsxs("div", { children: [_jsx("label", { htmlFor: "recipient", className: `text-sm font-medium ${theme === "dark" ? "text-gray-300" : "text-gray-700"}`, children: toCalldata ? "Destination Address" : "Recipient Address" }), recipient &&
|
|
111
|
+
isAddress(recipient) &&
|
|
112
|
+
recipient.toLowerCase() === account.address.toLowerCase() && (_jsx("div", { className: `text-xs mt-0.5 ${theme === "dark" ? "text-gray-400" : "text-gray-500"}`, children: "Same as sender" }))] }), _jsx("div", { className: "h-7 flex items-center", children: !toRecipient && recipient !== account.address ? (_jsx("button", { type: "button", onClick: (event) => {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
setRecipientInput(account.address);
|
|
115
|
+
setRecipient(account.address);
|
|
116
|
+
}, className: `px-2 py-1 text-xs cursor-pointer rounded-[24px] transition-colors bg-blue-500 hover:bg-blue-600 text-white`, children: "Use Account" })) : null })] }), toRecipient ? (_jsx("div", { className: "px-2 py-1 font-mono text-sm", children: _jsx("span", { className: `break-all ${theme === "dark" ? "text-white" : "text-gray-900"}`, children: recipient }) })) : (_jsxs(_Fragment, { children: [_jsx("input", { id: "recipient", type: "text", value: recipientInput, onChange: handleRecipientInputChange, placeholder: "0x... or name.eth", className: `block w-full px-4 py-3 border rounded-[24px] focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono text-sm ${theme === "dark"
|
|
117
|
+
? "bg-gray-800 border-gray-700 text-white placeholder-gray-500"
|
|
118
|
+
: "bg-white border-gray-300 text-gray-900 placeholder-gray-400"}` }), ensAddress && (_jsx("p", { className: theme === "dark"
|
|
119
|
+
? "text-sm text-gray-400"
|
|
120
|
+
: "text-sm text-gray-500", children: recipient }))] }))] }), toCalldata && (_jsx("div", { className: "px-2 py-1", children: _jsx("p", { className: `text-xs ${theme === "dark" ? "text-gray-300" : "text-gray-600"}`, children: "This transaction includes custom calldata for contract interaction at the destination address" }) })), _jsx(FeeOptions, { options: FEE_TOKENS, selectedOption: selectedFeeToken ?? undefined, onSelect: setSelectedFeeToken, theme: theme }), _jsx("div", { className: "flex flex-col space-y-3 pt-2", children: _jsx("button", { type: "submit", disabled: !amount ||
|
|
121
|
+
!isValidRecipient ||
|
|
122
|
+
isSubmitting ||
|
|
123
|
+
!destinationTokenAddress ||
|
|
124
|
+
!isValidCustomToken, className: `w-full font-semibold py-3 px-4 rounded-[24px] transition-colors relative ${theme === "dark"
|
|
125
|
+
? "bg-blue-600 disabled:bg-gray-700 text-white disabled:text-gray-400 enabled:hover:bg-blue-700"
|
|
126
|
+
: "bg-blue-500 disabled:bg-gray-300 text-white disabled:text-gray-500 enabled:hover:bg-blue-600"} disabled:cursor-not-allowed cursor-pointer`, children: isSubmitting ? (_jsxs("div", { className: "flex items-center justify-center", children: [_jsx(Loader2, { className: `w-5 h-5 animate-spin mr-2 ${theme === "dark" ? "text-gray-400" : "text-white"}` }), _jsx("span", { children: buttonText })] })) : (buttonText) }) })] })] }));
|
|
127
|
+
};
|
|
128
|
+
const styles = `
|
|
129
|
+
select {
|
|
130
|
+
appearance: none;
|
|
131
|
+
border: 1px solid #e5e7eb;
|
|
132
|
+
outline: none;
|
|
133
|
+
font-size: 1rem;
|
|
134
|
+
width: 100%;
|
|
135
|
+
background-color: #fff;
|
|
136
|
+
border-radius: 0.5rem;
|
|
137
|
+
padding: 0.75rem 1rem;
|
|
138
|
+
padding-right: 2rem;
|
|
139
|
+
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
transition: all 0.2s;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
select:hover {
|
|
145
|
+
border-color: #d1d5db;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
select:focus {
|
|
149
|
+
border-color: #3b82f6;
|
|
150
|
+
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
select option {
|
|
154
|
+
padding: 0.75rem 1rem;
|
|
155
|
+
min-height: 3rem;
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
padding-left: 2.75rem;
|
|
159
|
+
position: relative;
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
select option:hover {
|
|
164
|
+
background-color: #f3f4f6;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
select option:checked {
|
|
168
|
+
background-color: #eff6ff;
|
|
169
|
+
color: #1d4ed8;
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
if (typeof document !== "undefined") {
|
|
173
|
+
const styleTag = document.createElement("style");
|
|
174
|
+
styleTag.textContent = styles;
|
|
175
|
+
document.head.appendChild(styleTag);
|
|
176
|
+
}
|
|
177
|
+
export default SendForm;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
interface TokenImageProps {
|
|
3
|
+
imageUrl?: string;
|
|
4
|
+
symbol?: string;
|
|
5
|
+
chainId?: number;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const TokenImage: React.FC<TokenImageProps>;
|
|
9
|
+
export default TokenImage;
|
|
10
|
+
//# sourceMappingURL=TokenImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenImage.d.ts","sourceRoot":"","sources":["../../../src/widget/components/TokenImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwBhD,CAAA;AAED,eAAe,UAAU,CAAA"}
|