@openfort/react 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/icons.js +1 -1
- package/build/assets/logos.d.ts +12 -0
- package/build/assets/logos.js +7 -0
- package/build/assets/logos.js.map +1 -1
- package/build/components/Common/CopyToClipboard/CopyIconButton.d.ts +3 -1
- package/build/components/Common/CopyToClipboard/CopyIconButton.js +4 -4
- package/build/components/Common/CustomQRCode/index.d.ts +1 -1
- package/build/components/Common/CustomQRCode/index.js +3 -3
- package/build/components/Common/CustomQRCode/styles.d.ts +1 -0
- package/build/components/Common/CustomQRCode/styles.js +4 -4
- package/build/components/Common/CustomQRCode/types.d.ts +2 -0
- package/build/components/Common/Modal/styles.js +4 -1
- package/build/components/Common/Modal/styles.js.map +1 -1
- package/build/components/ConnectModal/index.js +14 -2
- package/build/components/ConnectModal/index.js.map +1 -1
- package/build/components/Openfort/OpenfortProvider.js +4 -1
- package/build/components/Openfort/OpenfortProvider.js.map +1 -1
- package/build/components/Openfort/types.d.ts +86 -0
- package/build/components/Openfort/types.js +22 -1
- package/build/components/Openfort/types.js.map +1 -1
- package/build/components/Pages/AssetInventory/SolanaAssetInventory.d.ts +6 -0
- package/build/components/Pages/AssetInventory/SolanaAssetInventory.js +42 -0
- package/build/components/Pages/AssetInventory/SolanaAssetInventory.js.map +1 -0
- package/build/components/Pages/Buy/index.js +3 -2
- package/build/components/Pages/Buy/index.js.map +1 -1
- package/build/components/Pages/BuySelectProvider/index.js +1 -1
- package/build/components/Pages/Connected/EthereumConnected.js +8 -32
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -1
- package/build/components/Pages/Connected/SolanaConnected.js +9 -4
- package/build/components/Pages/Connected/SolanaConnected.js.map +1 -1
- package/build/components/Pages/Deposit/AddressPageLink.d.ts +7 -0
- package/build/components/Pages/Deposit/AddressPageLink.js +17 -0
- package/build/components/Pages/Deposit/AddressPageLink.js.map +1 -0
- package/build/components/Pages/Deposit/AssetChainLogo.d.ts +9 -0
- package/build/components/Pages/Deposit/AssetChainLogo.js +24 -0
- package/build/components/Pages/Deposit/AssetChainLogo.js.map +1 -0
- package/build/components/Pages/Deposit/DepositAddressBlock.d.ts +21 -0
- package/build/components/Pages/Deposit/DepositAddressBlock.js +28 -0
- package/build/components/Pages/Deposit/DepositAddressBlock.js.map +1 -0
- package/build/components/Pages/Deposit/DepositProgress.d.ts +15 -0
- package/build/components/Pages/Deposit/DepositProgress.js +110 -0
- package/build/components/Pages/Deposit/DepositProgress.js.map +1 -0
- package/build/components/Pages/Deposit/DepositStatus.d.ts +9 -0
- package/build/components/Pages/Deposit/DepositStatus.js +43 -0
- package/build/components/Pages/Deposit/DepositStatus.js.map +1 -0
- package/build/components/Pages/Deposit/DepositSuccess.d.ts +6 -0
- package/build/components/Pages/Deposit/DepositSuccess.js +24 -0
- package/build/components/Pages/Deposit/DepositSuccess.js.map +1 -0
- package/build/components/Pages/Deposit/Details.d.ts +12 -0
- package/build/components/Pages/Deposit/Details.js +40 -0
- package/build/components/Pages/Deposit/Details.js.map +1 -0
- package/build/components/Pages/Deposit/LogoSelect.d.ts +12 -0
- package/build/components/Pages/Deposit/LogoSelect.js +95 -0
- package/build/components/Pages/Deposit/LogoSelect.js.map +1 -0
- package/build/components/Pages/Deposit/OrDivider.d.ts +2 -0
- package/build/components/Pages/Deposit/OrDivider.js +10 -0
- package/build/components/Pages/Deposit/OrDivider.js.map +1 -0
- package/build/components/Pages/Deposit/RouteSelectors.d.ts +13 -0
- package/build/components/Pages/Deposit/RouteSelectors.js +19 -0
- package/build/components/Pages/Deposit/RouteSelectors.js.map +1 -0
- package/build/components/Pages/Deposit/cexChains.d.ts +9 -0
- package/build/components/Pages/Deposit/cexChains.js +23 -0
- package/build/components/Pages/Deposit/cexChains.js.map +1 -0
- package/build/components/Pages/Deposit/formStyles.d.ts +24 -0
- package/build/components/Pages/Deposit/formStyles.js +83 -0
- package/build/components/Pages/Deposit/formStyles.js.map +1 -0
- package/build/components/Pages/Deposit/index.d.ts +7 -0
- package/build/components/Pages/Deposit/index.js +100 -0
- package/build/components/Pages/Deposit/index.js.map +1 -0
- package/build/components/Pages/Deposit/paymentOptions.d.ts +49 -0
- package/build/components/Pages/Deposit/paymentOptions.js +63 -0
- package/build/components/Pages/Deposit/paymentOptions.js.map +1 -0
- package/build/components/Pages/Deposit/sources.d.ts +17 -0
- package/build/components/Pages/Deposit/sources.js +22 -0
- package/build/components/Pages/Deposit/sources.js.map +1 -0
- package/build/components/Pages/Deposit/styles.d.ts +25 -0
- package/build/components/Pages/Deposit/styles.js +167 -0
- package/build/components/Pages/Deposit/styles.js.map +1 -0
- package/build/components/Pages/Deposit/useDepositRoute.d.ts +35 -0
- package/build/components/Pages/Deposit/useDepositRoute.js +107 -0
- package/build/components/Pages/Deposit/useDepositRoute.js.map +1 -0
- package/build/components/Pages/Deposit/useFundingTarget.d.ts +13 -0
- package/build/components/Pages/Deposit/useFundingTarget.js +27 -0
- package/build/components/Pages/Deposit/useFundingTarget.js.map +1 -0
- package/build/components/Pages/DepositCex/index.d.ts +11 -0
- package/build/components/Pages/DepositCex/index.js +230 -0
- package/build/components/Pages/DepositCex/index.js.map +1 -0
- package/build/components/Pages/DepositCrypto/index.d.ts +8 -0
- package/build/components/Pages/DepositCrypto/index.js +31 -0
- package/build/components/Pages/DepositCrypto/index.js.map +1 -0
- package/build/components/Pages/DepositWallet/DepositWalletDesktop.d.ts +17 -0
- package/build/components/Pages/DepositWallet/DepositWalletDesktop.js +148 -0
- package/build/components/Pages/DepositWallet/DepositWalletDesktop.js.map +1 -0
- package/build/components/Pages/DepositWallet/index.d.ts +9 -0
- package/build/components/Pages/DepositWallet/index.js +102 -0
- package/build/components/Pages/DepositWallet/index.js.map +1 -0
- package/build/components/Pages/DepositWallet/walletDeeplinks.d.ts +48 -0
- package/build/components/Pages/DepositWallet/walletDeeplinks.js +107 -0
- package/build/components/Pages/DepositWallet/walletDeeplinks.js.map +1 -0
- package/build/components/Pages/ExportKey/index.js +10 -2
- package/build/components/Pages/ExportKey/index.js.map +1 -1
- package/build/components/Pages/NoAssetsAvailable/index.js +5 -21
- package/build/components/Pages/NoAssetsAvailable/index.js.map +1 -1
- package/build/components/Pages/SelectToken/styles.js +1 -1
- package/build/components/Pages/Send/SolanaSend.d.ts +1 -0
- package/build/components/Pages/Send/SolanaSend.js +88 -0
- package/build/components/Pages/Send/SolanaSend.js.map +1 -0
- package/build/components/Pages/Send/index.d.ts +2 -1
- package/build/components/Pages/Send/index.js +0 -1
- package/build/components/Pages/Send/index.js.map +1 -1
- package/build/components/Pages/SendConfirmation/EstimatedFees.js +5 -3
- package/build/components/Pages/SendConfirmation/EstimatedFees.js.map +1 -1
- package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.d.ts +1 -0
- package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js +77 -0
- package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js.map +1 -0
- package/build/components/Pages/SendConfirmation/index.js +4 -3
- package/build/components/Pages/SendConfirmation/index.js.map +1 -1
- package/build/components/Pages/SendConfirmation/styles.d.ts +5 -0
- package/build/components/Pages/SendConfirmation/styles.js +39 -1
- package/build/components/Pages/SendConfirmation/styles.js.map +1 -1
- package/build/constants/logos.js +1 -0
- package/build/constants/logos.js.map +1 -1
- package/build/ethereum/hooks/useEthereumWalletAssets.js +212 -95
- package/build/ethereum/hooks/useEthereumWalletAssets.js.map +1 -1
- package/build/hooks/openfort/fundingClient.d.ts +34 -0
- package/build/hooks/openfort/fundingClient.js +60 -0
- package/build/hooks/openfort/fundingClient.js.map +1 -0
- package/build/hooks/openfort/useFunding.d.ts +159 -0
- package/build/hooks/openfort/useFunding.js +204 -0
- package/build/hooks/openfort/useFunding.js.map +1 -0
- package/build/hooks/openfort/useFundingChains.d.ts +49 -0
- package/build/hooks/openfort/useFundingChains.js +102 -0
- package/build/hooks/openfort/useFundingChains.js.map +1 -0
- package/build/hooks/useBalance.js +6 -1
- package/build/hooks/useBalance.js.map +1 -1
- package/build/index.d.ts +4 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/shared/hooks/useAsyncData.d.ts +11 -0
- package/build/shared/hooks/useAsyncData.js +60 -13
- package/build/shared/hooks/useAsyncData.js.map +1 -1
- package/build/solana/hooks/useSolanaWalletAssets.d.ts +24 -0
- package/build/solana/hooks/useSolanaWalletAssets.js +86 -0
- package/build/solana/hooks/useSolanaWalletAssets.js.map +1 -0
- package/build/solana/transfer.d.ts +32 -0
- package/build/solana/transfer.js +125 -0
- package/build/solana/transfer.js.map +1 -0
- package/build/utils/index.d.ts +2 -1
- package/build/utils/index.js +1 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/build/wagmi/defaultConnectors.js +5 -1
- package/build/wagmi/defaultConnectors.js.map +1 -1
- package/package.json +9 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
-
import {
|
|
4
|
-
import { lazy, useEffect, useMemo, useState, Suspense } from 'react';
|
|
3
|
+
import { lazy, useEffect, useMemo, Suspense } from 'react';
|
|
5
4
|
import { formatUnits } from 'viem';
|
|
6
|
-
import { UserRoundIcon, SendIcon, ReceiveIcon
|
|
5
|
+
import { UserRoundIcon, SendIcon, ReceiveIcon } from '../../../assets/icons.js';
|
|
7
6
|
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
8
7
|
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
9
8
|
import { useEthereumBridge } from '../../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
@@ -17,7 +16,6 @@ import Button from '../../Common/Button/index.js';
|
|
|
17
16
|
import { TextLinkButton } from '../../Common/Button/styles.js';
|
|
18
17
|
import Chain from '../../Common/Chain/index.js';
|
|
19
18
|
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
20
|
-
import { ModalBody } from '../../Common/Modal/styles.js';
|
|
21
19
|
import { useThemeContext } from '../../ConnectKitThemeProvider/ConnectKitThemeProvider.js';
|
|
22
20
|
import { routes, defaultSendFormState } from '../../Openfort/types.js';
|
|
23
21
|
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
@@ -32,7 +30,7 @@ function getFirstBalanceAsset(assets) {
|
|
|
32
30
|
return assets === null || assets === void 0 ? void 0 : assets.find((a) => a.balance && a.balance > BigInt(0));
|
|
33
31
|
}
|
|
34
32
|
const EthereumConnected = () => {
|
|
35
|
-
var _a, _b, _c
|
|
33
|
+
var _a, _b, _c;
|
|
36
34
|
const context = useOpenfort();
|
|
37
35
|
const { setHeaderLeftSlot, setRoute, chains } = context;
|
|
38
36
|
const themeContext = useThemeContext();
|
|
@@ -64,7 +62,7 @@ const EthereumConnected = () => {
|
|
|
64
62
|
enabled: isConnected && !!address,
|
|
65
63
|
});
|
|
66
64
|
const ensName = identity.status === 'success' ? identity.name : undefined;
|
|
67
|
-
const { data: assets, isLoading
|
|
65
|
+
const { data: assets, isLoading } = useEthereumWalletAssets();
|
|
68
66
|
const totalBalanceUsd = useMemo(() => {
|
|
69
67
|
if (!assets)
|
|
70
68
|
return 0;
|
|
@@ -79,31 +77,9 @@ const EthereumConnected = () => {
|
|
|
79
77
|
return acc + price * balance;
|
|
80
78
|
}, 0);
|
|
81
79
|
}, [assets]);
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
if (isConnected) {
|
|
84
|
-
refetch();
|
|
85
|
-
}
|
|
86
|
-
}, [isConnected, refetch]);
|
|
87
|
-
const isTestnet = (_b = chain === null || chain === void 0 ? void 0 : chain.testnet) !== null && _b !== void 0 ? _b : false;
|
|
88
|
-
const [showTestnetMessage, setShowTestnetMessage] = useState(false);
|
|
89
80
|
useEffect(() => {
|
|
90
81
|
context.triggerResize();
|
|
91
|
-
|
|
92
|
-
const timer = setTimeout(() => {
|
|
93
|
-
setShowTestnetMessage(false);
|
|
94
|
-
}, 2000);
|
|
95
|
-
return () => clearTimeout(timer);
|
|
96
|
-
}
|
|
97
|
-
}, [showTestnetMessage, context.triggerResize]);
|
|
98
|
-
const handleBuyClick = (e) => {
|
|
99
|
-
if (!chain || isTestnet) {
|
|
100
|
-
e.preventDefault();
|
|
101
|
-
setShowTestnetMessage(true);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
context.setRoute(routes.BUY);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
82
|
+
}, [context.triggerResize]);
|
|
107
83
|
useEffect(() => {
|
|
108
84
|
if (!address) {
|
|
109
85
|
setHeaderLeftSlot(null);
|
|
@@ -115,11 +91,11 @@ const EthereumConnected = () => {
|
|
|
115
91
|
};
|
|
116
92
|
}, [address, setHeaderLeftSlot, setRoute]);
|
|
117
93
|
const { setSendForm } = context;
|
|
118
|
-
const separator = ['web95', 'rounded', 'minimal'].includes((
|
|
94
|
+
const separator = ['web95', 'rounded', 'minimal'].includes((_c = (_b = themeContext.theme) !== null && _b !== void 0 ? _b : context.uiConfig.theme) !== null && _c !== void 0 ? _c : '')
|
|
119
95
|
? '....'
|
|
120
96
|
: undefined;
|
|
121
97
|
const locales = useLocales();
|
|
122
|
-
const balanceNode =
|
|
98
|
+
const balanceNode = assets && !isLoading ? (jsx(TextLinkButton, { type: "button", onClick: () => {
|
|
123
99
|
const firstBalanceAsset = getFirstBalanceAsset(assets);
|
|
124
100
|
if (!firstBalanceAsset) {
|
|
125
101
|
setRoute(routes.NO_ASSETS_AVAILABLE);
|
|
@@ -136,7 +112,7 @@ const EthereumConnected = () => {
|
|
|
136
112
|
}
|
|
137
113
|
setSendForm({ ...defaultSendFormState, asset: firstBalanceAsset });
|
|
138
114
|
context.setRoute(routes.SEND);
|
|
139
|
-
}, children: "Send" }), jsx(ActionButton, { icon: jsx(ReceiveIcon, {}), onClick: () => context.setRoute(routes.
|
|
115
|
+
}, children: "Send" }), jsx(ActionButton, { icon: jsx(ReceiveIcon, {}), onClick: () => context.setRoute(routes.DEPOSIT), children: "Deposit" })] }), hideBalance: context === null || context === void 0 ? void 0 : context.uiConfig.hideBalance, isBalanceLoading: isLoading, noWalletFallback: noWalletFallback }) }));
|
|
140
116
|
};
|
|
141
117
|
|
|
142
118
|
export { EthereumConnected as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
-
import { UserRoundIcon, ReceiveIcon } from '../../../assets/icons.js';
|
|
4
|
+
import { UserRoundIcon, SendIcon, ReceiveIcon } from '../../../assets/icons.js';
|
|
5
5
|
import { BALANCE_INVALIDATE_EVENT, fetchSolanaBalance } from '../../../hooks/useBalance.js';
|
|
6
6
|
import useLocales from '../../../hooks/useLocales.js';
|
|
7
7
|
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
@@ -13,6 +13,7 @@ import { nFormatter } from '../../../utils/index.js';
|
|
|
13
13
|
import { logger } from '../../../utils/logger.js';
|
|
14
14
|
import Avatar from '../../Common/Avatar/index.js';
|
|
15
15
|
import Button from '../../Common/Button/index.js';
|
|
16
|
+
import { TextLinkButton } from '../../Common/Button/styles.js';
|
|
16
17
|
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
17
18
|
import { useThemeContext } from '../../ConnectKitThemeProvider/ConnectKitThemeProvider.js';
|
|
18
19
|
import { routes } from '../../Openfort/types.js';
|
|
@@ -88,8 +89,12 @@ const SolanaConnected = () => {
|
|
|
88
89
|
? '....'
|
|
89
90
|
: undefined;
|
|
90
91
|
const avatar = address ? CustomAvatar ? jsx(CustomAvatar, { address: address }) : jsx(Avatar, { address: address }) : jsx("span", {});
|
|
91
|
-
const balanceNode = balanceSol != null && !isBalanceLoading ? (jsxs(Balance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: [nFormatter(Number(balanceSol)), " SOL"] }, "solana-balance")) : null;
|
|
92
|
-
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: truncateSolanaAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: avatar, balance: balanceNode, actions:
|
|
92
|
+
const balanceNode = balanceSol != null && !isBalanceLoading ? (jsx(TextLinkButton, { type: "button", onClick: () => setRoute(routes.SOL_ASSET_INVENTORY), children: jsxs(Balance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: [nFormatter(Number(balanceSol)), " SOL"] }, "solana-balance") })) : null;
|
|
93
|
+
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: truncateSolanaAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: avatar, balance: balanceNode, actions: jsxs(Fragment, { children: [jsx(ActionButton, { icon: jsx(SendIcon, {}), onClick: () => {
|
|
94
|
+
// Nothing to send on an empty wallet — prompt to add funds first (mirrors EVM).
|
|
95
|
+
const hasBalance = lamports != null && BigInt(lamports) > BigInt(0);
|
|
96
|
+
context.setRoute(hasBalance ? routes.SOL_SEND : routes.NO_ASSETS_AVAILABLE);
|
|
97
|
+
}, children: "Send" }), jsx(ActionButton, { icon: jsx(ReceiveIcon, {}), onClick: () => context.setRoute(routes.DEPOSIT), children: "Deposit" })] }), hideBalance: context === null || context === void 0 ? void 0 : context.uiConfig.hideBalance, isBalanceLoading: isBalanceLoading, isAddressLoading: isAddressLoading, noWalletFallback: hasSolanaWallets ? (jsx(Button, { onClick: () => setRoute(routes.SELECT_WALLET_TO_RECOVER), children: "Manage wallets" })) : (jsx(Button, { onClick: () => setRoute(routes.SOL_CREATE_WALLET), children: "Create Solana Wallet" })) }) }));
|
|
93
98
|
};
|
|
94
99
|
|
|
95
100
|
export { SolanaConnected as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SolanaConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row that navigates to the standalone "Transfer from address" page (deposit
|
|
3
|
+
* address + QR), instead of disclosing it inline beneath the current tab.
|
|
4
|
+
*/
|
|
5
|
+
export declare function AddressPageLink({ label }: {
|
|
6
|
+
label: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { routes } from '../../Openfort/types.js';
|
|
3
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
4
|
+
import { detailsToggle, chevron } from './formStyles.js';
|
|
5
|
+
import { OrDivider } from './OrDivider.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Row that navigates to the standalone "Transfer from address" page (deposit
|
|
9
|
+
* address + QR), instead of disclosing it inline beneath the current tab.
|
|
10
|
+
*/
|
|
11
|
+
function AddressPageLink({ label }) {
|
|
12
|
+
const { setRoute } = useOpenfort();
|
|
13
|
+
return (jsxs(Fragment, { children: [jsx(OrDivider, {}), jsxs("button", { type: "button", style: detailsToggle, onClick: () => setRoute(routes.DEPOSIT_CRYPTO), children: [jsx("span", { children: label }), jsx("span", { style: chevron, children: "\u203A" })] })] }));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { AddressPageLink };
|
|
17
|
+
//# sourceMappingURL=AddressPageLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddressPageLink.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Center logo for the deposit QR: the asset logo with the chain logo as a small
|
|
3
|
+
* badge bottom-left, so scanners can confirm the right token + network at a glance.
|
|
4
|
+
* Kept fully within the logo slot (no overflow) so it never covers QR data modules.
|
|
5
|
+
*/
|
|
6
|
+
export declare function AssetChainLogo({ assetLogo, chainLogo }: {
|
|
7
|
+
assetLogo: string;
|
|
8
|
+
chainLogo: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
const hide = (e) => {
|
|
4
|
+
e.currentTarget.style.display = 'none';
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Center logo for the deposit QR: the asset logo with the chain logo as a small
|
|
8
|
+
* badge bottom-left, so scanners can confirm the right token + network at a glance.
|
|
9
|
+
* Kept fully within the logo slot (no overflow) so it never covers QR data modules.
|
|
10
|
+
*/
|
|
11
|
+
function AssetChainLogo({ assetLogo, chainLogo }) {
|
|
12
|
+
return (jsxs("div", { style: { position: 'relative', width: '100%' }, children: [jsx("img", { src: assetLogo, alt: "", onError: hide, style: { display: 'block', width: '100%', borderRadius: '50%' } }), jsx("img", { src: chainLogo, alt: "", onError: hide, style: {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
bottom: 0,
|
|
15
|
+
left: 0,
|
|
16
|
+
width: '42%',
|
|
17
|
+
borderRadius: '50%',
|
|
18
|
+
border: '2px solid #fff',
|
|
19
|
+
background: '#fff',
|
|
20
|
+
} })] }));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { AssetChainLogo };
|
|
24
|
+
//# sourceMappingURL=AssetChainLogo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetChainLogo.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PaymentMethod, SessionStatus } from '../../../hooks/openfort/useFunding';
|
|
2
|
+
type DepositAddressBlockProps = {
|
|
3
|
+
/** Logo URLs for the QR badge (token over chain). */
|
|
4
|
+
assetLogo: string | null;
|
|
5
|
+
chainLogo: string | null;
|
|
6
|
+
receiverAddress: string | null;
|
|
7
|
+
pm: PaymentMethod | null;
|
|
8
|
+
/** Source currency (symbol + decimals) for formatting the Details fee/min. */
|
|
9
|
+
sourceCurrency: {
|
|
10
|
+
symbol: string;
|
|
11
|
+
decimals: number;
|
|
12
|
+
} | null;
|
|
13
|
+
/** Cross-chain routes carry a fee/min Details panel; same-chain transfers don't. */
|
|
14
|
+
sameChain: boolean;
|
|
15
|
+
loading: boolean;
|
|
16
|
+
/** Live session status, rendered as the "Waiting for your deposit…" line under the address. */
|
|
17
|
+
status?: SessionStatus | 'idle';
|
|
18
|
+
};
|
|
19
|
+
/** The QR + copyable deposit address (plus cross-chain Details) for a route. */
|
|
20
|
+
export declare function DepositAddressBlock({ assetLogo, chainLogo, receiverAddress, pm, sourceCurrency, sameChain, loading, status, }: DepositAddressBlockProps): import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { CopyIconButton } from '../../Common/CopyToClipboard/CopyIconButton.js';
|
|
3
|
+
import CustomQRCode from '../../Common/CustomQRCode/index.js';
|
|
4
|
+
import { AssetChainLogo } from './AssetChainLogo.js';
|
|
5
|
+
import { DepositStatus } from './DepositStatus.js';
|
|
6
|
+
import { DepositDetails } from './Details.js';
|
|
7
|
+
import { depositAddressLabel, addressBox, codeStyle } from './formStyles.js';
|
|
8
|
+
import { Skeleton, QRWrapper } from './styles.js';
|
|
9
|
+
|
|
10
|
+
/** The QR + copyable deposit address (plus cross-chain Details) for a route. */
|
|
11
|
+
function DepositAddressBlock({ assetLogo, chainLogo, receiverAddress, pm, sourceCurrency, sameChain, loading, status, }) {
|
|
12
|
+
var _a;
|
|
13
|
+
if (loading && !sameChain && !pm) {
|
|
14
|
+
return (jsxs(Fragment, { children: [jsx("div", { style: { display: 'flex', justifyContent: 'center', margin: '14px 0' }, children: jsx(Skeleton, { "$w": "220px", "$h": "220px", "$r": "12px" }) }), jsx("div", { style: depositAddressLabel, children: "Your deposit address" }), jsx(Skeleton, { "$h": "44px", "$r": "12px" })] }));
|
|
15
|
+
}
|
|
16
|
+
if (!receiverAddress)
|
|
17
|
+
return null;
|
|
18
|
+
return (jsxs(Fragment, { children: [jsx(QRWrapper, { children: jsx(CustomQRCode
|
|
19
|
+
// Encode the EIP-681 / Solana Pay URI (address + amount + network) so a
|
|
20
|
+
// scanner prefills the send; fall back to the bare address same-chain.
|
|
21
|
+
, {
|
|
22
|
+
// Encode the EIP-681 / Solana Pay URI (address + amount + network) so a
|
|
23
|
+
// scanner prefills the send; fall back to the bare address same-chain.
|
|
24
|
+
value: (_a = pm === null || pm === void 0 ? void 0 : pm.addressUri) !== null && _a !== void 0 ? _a : receiverAddress, image: jsx(AssetChainLogo, { assetLogo: assetLogo !== null && assetLogo !== void 0 ? assetLogo : '', chainLogo: chainLogo !== null && chainLogo !== void 0 ? chainLogo : '' }), imageClip: false }) }), jsx("div", { style: depositAddressLabel, children: "Your deposit address" }), jsxs("div", { style: addressBox, children: [jsx("code", { style: codeStyle, children: receiverAddress }), jsx(CopyIconButton, { value: receiverAddress, size: 28 })] }), status && jsx(DepositStatus, { status: status }), !sameChain && pm && jsx(DepositDetails, { pm: pm, sourceCurrency: sourceCurrency })] }));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { DepositAddressBlock };
|
|
28
|
+
//# sourceMappingURL=DepositAddressBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepositAddressBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SessionStatus } from '../../../hooks/openfort/useFunding';
|
|
2
|
+
/**
|
|
3
|
+
* Statuses that take over the whole modal with the compact flow view: once a
|
|
4
|
+
* deposit is detected the form is gone and only progress/outcome is shown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isDepositFlowActive(status: SessionStatus | 'idle'): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Compact flow view shown once a deposit is detected. `processing` renders a live
|
|
9
|
+
* stepper (payment received → bridging → delivering); on `succeeded` the third
|
|
10
|
+
* step holds active briefly so the user sees it, then the tick + "See balance"
|
|
11
|
+
* screen takes over. `bounced`/`expired` show the outcome with a way out.
|
|
12
|
+
*/
|
|
13
|
+
export declare function DepositProgress({ status }: {
|
|
14
|
+
status: SessionStatus | 'idle';
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import styled from '../../../styles/styled/index.js';
|
|
4
|
+
import { logger } from '../../../utils/logger.js';
|
|
5
|
+
import Button from '../../Common/Button/index.js';
|
|
6
|
+
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
7
|
+
import { Spinner } from '../../Common/Spinner/index.js';
|
|
8
|
+
import { routes } from '../../Openfort/types.js';
|
|
9
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
10
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
11
|
+
import { DepositSuccess } from './DepositSuccess.js';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Statuses that take over the whole modal with the compact flow view: once a
|
|
15
|
+
* deposit is detected the form is gone and only progress/outcome is shown.
|
|
16
|
+
*/
|
|
17
|
+
function isDepositFlowActive(status) {
|
|
18
|
+
return status === 'processing' || status === 'succeeded' || status === 'bounced' || status === 'expired';
|
|
19
|
+
}
|
|
20
|
+
/** How long the final "Delivering" step stays visible before the confirmed screen. */
|
|
21
|
+
const DELIVERING_HOLD_MS = 1200;
|
|
22
|
+
const STEPS = [
|
|
23
|
+
{ key: 'received', label: 'Payment received' },
|
|
24
|
+
{ key: 'bridging', label: 'Bridging across chains' },
|
|
25
|
+
{ key: 'delivering', label: 'Delivering to your wallet' },
|
|
26
|
+
];
|
|
27
|
+
function stepStateFor(index, activeStep) {
|
|
28
|
+
if (index < activeStep)
|
|
29
|
+
return 'done';
|
|
30
|
+
if (index === activeStep)
|
|
31
|
+
return 'active';
|
|
32
|
+
return 'pending';
|
|
33
|
+
}
|
|
34
|
+
const StepList = styled.div `
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
gap: 4px;
|
|
39
|
+
margin: 18px 0 8px;
|
|
40
|
+
width: 100%;
|
|
41
|
+
text-align: left;
|
|
42
|
+
`;
|
|
43
|
+
const StepRow = styled.div `
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 12px;
|
|
47
|
+
padding: 10px 12px;
|
|
48
|
+
border-radius: 10px;
|
|
49
|
+
font-size: 14px;
|
|
50
|
+
background: ${(p) => (p.$state === 'active' ? 'var(--ck-body-background-secondary, #fafafa)' : 'transparent')};
|
|
51
|
+
color: ${(p) => (p.$state === 'pending' ? 'var(--ck-body-color-muted, #9ca3af)' : 'var(--ck-body-color, #111)')};
|
|
52
|
+
font-weight: ${(p) => (p.$state === 'active' ? 600 : 400)};
|
|
53
|
+
`;
|
|
54
|
+
const StepMark = styled.span `
|
|
55
|
+
flex: 0 0 20px;
|
|
56
|
+
width: 20px;
|
|
57
|
+
height: 20px;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
font-size: 12px;
|
|
63
|
+
color: #fff;
|
|
64
|
+
background: ${(p) => p.$state === 'done' ? '#16a34a' : p.$state === 'pending' ? 'var(--ck-body-divider, #e4e4e7)' : 'transparent'};
|
|
65
|
+
`;
|
|
66
|
+
/** Outcome copy for the non-success terminal states. */
|
|
67
|
+
const OUTCOME = {
|
|
68
|
+
bounced: { heading: 'Deposit refunded', body: 'The bridge bounced your deposit and refunded it to your wallet.' },
|
|
69
|
+
expired: { heading: 'Session expired', body: 'Reopen the deposit to get a fresh address.' },
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Compact flow view shown once a deposit is detected. `processing` renders a live
|
|
73
|
+
* stepper (payment received → bridging → delivering); on `succeeded` the third
|
|
74
|
+
* step holds active briefly so the user sees it, then the tick + "See balance"
|
|
75
|
+
* screen takes over. `bounced`/`expired` show the outcome with a way out.
|
|
76
|
+
*/
|
|
77
|
+
function DepositProgress({ status }) {
|
|
78
|
+
const { setRoute, triggerResize } = useOpenfort();
|
|
79
|
+
const [delivered, setDelivered] = useState(false);
|
|
80
|
+
// On success, hold on the "Delivering" step for a beat before the confirmed
|
|
81
|
+
// screen — otherwise the flow jumps straight from bridging to confirmed.
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (status !== 'succeeded')
|
|
84
|
+
return;
|
|
85
|
+
const id = setTimeout(() => setDelivered(true), DELIVERING_HOLD_MS);
|
|
86
|
+
return () => clearTimeout(id);
|
|
87
|
+
}, [status]);
|
|
88
|
+
// Resize the modal whenever the visible step / screen changes.
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
triggerResize();
|
|
91
|
+
// Correlate the perceived terminal (incl. the 1.2s delivering hold) with the
|
|
92
|
+
// data-layer terminal from useFunding; UI is unchanged.
|
|
93
|
+
logger.log('[funding:progress] render', { status, delivered });
|
|
94
|
+
}, [status, delivered, triggerResize]);
|
|
95
|
+
if (status === 'succeeded' && delivered)
|
|
96
|
+
return jsx(DepositSuccess, {});
|
|
97
|
+
if (status === 'bounced' || status === 'expired') {
|
|
98
|
+
const ui = OUTCOME[status];
|
|
99
|
+
return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: ui === null || ui === void 0 ? void 0 : ui.heading }), jsx(ModalBody, { children: ui === null || ui === void 0 ? void 0 : ui.body }), jsx(Button, { variant: "primary", onClick: () => setRoute(status === 'expired' ? routes.DEPOSIT : routes.CONNECTED), children: status === 'expired' ? 'Start over' : 'See balance' })] }));
|
|
100
|
+
}
|
|
101
|
+
// processing → bridging active (step 1); succeeded (pre-confirmed) → delivering active (step 2).
|
|
102
|
+
const activeStep = status === 'succeeded' ? 2 : 1;
|
|
103
|
+
return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: "Completing your deposit" }), jsx(ModalBody, { children: "Keep this open \u2014 your funds are on the way." }), jsx(StepList, { children: STEPS.map((step, i) => {
|
|
104
|
+
const state = stepStateFor(i, activeStep);
|
|
105
|
+
return (jsxs(StepRow, { "$state": state, children: [state === 'active' ? jsx(Spinner, {}) : jsx(StepMark, { "$state": state, children: state === 'done' ? '✓' : '' }), jsx("span", { children: step.label })] }, step.key));
|
|
106
|
+
}) })] }));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export { DepositProgress, isDepositFlowActive };
|
|
110
|
+
//# sourceMappingURL=DepositProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepositProgress.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SessionStatus } from '../../../hooks/openfort/useFunding';
|
|
2
|
+
/**
|
|
3
|
+
* Live funding status shown once a deposit address exists, so the user sees the
|
|
4
|
+
* flow progress (waiting → bridging → delivered) and the terminal outcome.
|
|
5
|
+
* Renders nothing before a payment method is set (`idle`/`requires_payment_method`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function DepositStatus({ status }: {
|
|
8
|
+
status: SessionStatus | 'idle';
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import styled from '../../../styles/styled/index.js';
|
|
3
|
+
import { Spinner } from '../../Common/Spinner/index.js';
|
|
4
|
+
|
|
5
|
+
/** Live, user-facing copy for each non-initial session status. */
|
|
6
|
+
const STATUS_UI = {
|
|
7
|
+
waiting_payment: { label: 'Waiting for your deposit…', tone: 'pending' },
|
|
8
|
+
processing: { label: 'Bridging your funds…', tone: 'pending' },
|
|
9
|
+
succeeded: { label: 'Funds delivered to your wallet', tone: 'success' },
|
|
10
|
+
bounced: { label: 'Deposit bounced — refunded to your wallet', tone: 'warn' },
|
|
11
|
+
expired: { label: 'Session expired — reopen for a fresh address', tone: 'muted' },
|
|
12
|
+
};
|
|
13
|
+
const TONE_COLOR = {
|
|
14
|
+
pending: 'var(--ck-body-color-muted, #6b7280)',
|
|
15
|
+
success: '#16a34a',
|
|
16
|
+
warn: '#d97706',
|
|
17
|
+
muted: 'var(--ck-body-color-muted, #6b7280)',
|
|
18
|
+
};
|
|
19
|
+
const Banner = styled.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 8px;
|
|
23
|
+
margin-top: 14px;
|
|
24
|
+
padding: 10px 12px;
|
|
25
|
+
border-radius: 10px;
|
|
26
|
+
border: 1px solid var(--ck-body-divider, #e4e4e7);
|
|
27
|
+
background: var(--ck-body-background-secondary, #fafafa);
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
`;
|
|
30
|
+
/**
|
|
31
|
+
* Live funding status shown once a deposit address exists, so the user sees the
|
|
32
|
+
* flow progress (waiting → bridging → delivered) and the terminal outcome.
|
|
33
|
+
* Renders nothing before a payment method is set (`idle`/`requires_payment_method`).
|
|
34
|
+
*/
|
|
35
|
+
function DepositStatus({ status }) {
|
|
36
|
+
const ui = status === 'idle' ? undefined : STATUS_UI[status];
|
|
37
|
+
if (!ui)
|
|
38
|
+
return null;
|
|
39
|
+
return (jsxs(Banner, { style: { color: TONE_COLOR[ui.tone] }, children: [ui.tone === 'pending' ? jsx(Spinner, {}) : jsx("span", { "aria-hidden": true, children: ui.tone === 'success' ? '✓' : '!' }), jsx("span", { children: ui.label })] }));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { DepositStatus };
|
|
43
|
+
//# sourceMappingURL=DepositStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepositStatus.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal success screen for a funding deposit. Replaces the deposit form once
|
|
3
|
+
* Relay reports the funds delivered, collapsing the modal to the compact
|
|
4
|
+
* confirmation size with a tick animation and a shortcut back to the balance.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DepositSuccess(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import Button from '../../Common/Button/index.js';
|
|
4
|
+
import Loader from '../../Common/Loading/index.js';
|
|
5
|
+
import { routes } from '../../Openfort/types.js';
|
|
6
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
7
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Terminal success screen for a funding deposit. Replaces the deposit form once
|
|
11
|
+
* Relay reports the funds delivered, collapsing the modal to the compact
|
|
12
|
+
* confirmation size with a tick animation and a shortcut back to the balance.
|
|
13
|
+
*/
|
|
14
|
+
function DepositSuccess() {
|
|
15
|
+
const { setRoute, triggerResize } = useOpenfort();
|
|
16
|
+
// Collapse the modal from the tall deposit form down to the compact card.
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
triggerResize();
|
|
19
|
+
}, [triggerResize]);
|
|
20
|
+
return (jsxs(PageContent, { children: [jsx(Loader, { isSuccess: true, header: "Deposit received", description: "Funds delivered to your wallet" }), jsx(Button, { variant: "primary", onClick: () => setRoute(routes.ASSET_INVENTORY), children: "See balance" })] }));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { DepositSuccess };
|
|
24
|
+
//# sourceMappingURL=DepositSuccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DepositSuccess.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PaymentMethod } from '../../../hooks/openfort/useFunding';
|
|
2
|
+
type SourceCurrency = {
|
|
3
|
+
symbol: string;
|
|
4
|
+
decimals: number;
|
|
5
|
+
};
|
|
6
|
+
/** Collapsible details: minimum amount, rail fee, time to receive, max deposit.
|
|
7
|
+
* Pulls the minimum and fee from the live quote (`pm`) when available. */
|
|
8
|
+
export declare function DepositDetails({ pm, sourceCurrency, }: {
|
|
9
|
+
pm: PaymentMethod | null;
|
|
10
|
+
sourceCurrency: SourceCurrency | null;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { formatUnits } from 'viem';
|
|
4
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
5
|
+
import { detailsBox, detailsToggle, chevron, detailsRow, detailsLabel, detailsValue } from './formStyles.js';
|
|
6
|
+
|
|
7
|
+
function Row({ label, value }) {
|
|
8
|
+
return (jsxs("div", { style: detailsRow, children: [jsx("span", { style: detailsLabel, children: label }), jsx("span", { style: detailsValue, children: value })] }));
|
|
9
|
+
}
|
|
10
|
+
/** Rail fees charged in the source currency (relayer gas + service). Origin-chain
|
|
11
|
+
* gas is paid by the sender's own transaction, so it's not summed here. */
|
|
12
|
+
function formatRailFee(pm, currency) {
|
|
13
|
+
const total = pm.fees
|
|
14
|
+
.filter((fee) => fee.currency === currency.symbol)
|
|
15
|
+
.reduce((sum, fee) => sum + BigInt(fee.amount), BigInt(0));
|
|
16
|
+
if (total === BigInt(0))
|
|
17
|
+
return 'Free';
|
|
18
|
+
return `≈ ${formatUnits(total, currency.decimals)} ${currency.symbol}`;
|
|
19
|
+
}
|
|
20
|
+
function formatMin(pm, currency) {
|
|
21
|
+
if (!pm.minAmount)
|
|
22
|
+
return 'None';
|
|
23
|
+
return `${formatUnits(BigInt(pm.minAmount), currency.decimals)} ${currency.symbol}`;
|
|
24
|
+
}
|
|
25
|
+
/** Collapsible details: minimum amount, rail fee, time to receive, max deposit.
|
|
26
|
+
* Pulls the minimum and fee from the live quote (`pm`) when available. */
|
|
27
|
+
function DepositDetails({ pm, sourceCurrency, }) {
|
|
28
|
+
const [open, setOpen] = useState(true);
|
|
29
|
+
const { triggerResize } = useOpenfort();
|
|
30
|
+
// Grow/shrink the modal to fit the expanded rows.
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
triggerResize();
|
|
33
|
+
}, [open, triggerResize]);
|
|
34
|
+
const fee = pm && sourceCurrency ? formatRailFee(pm, sourceCurrency) : '—';
|
|
35
|
+
const min = pm && sourceCurrency ? formatMin(pm, sourceCurrency) : '—';
|
|
36
|
+
return (jsxs("div", { style: detailsBox, children: [jsxs("button", { type: "button", style: detailsToggle, onClick: () => setOpen((o) => !o), children: [jsx("span", { children: "Details" }), jsx("span", { style: chevron, children: open ? '▴' : '▾' })] }), open && (jsxs("div", { children: [jsx(Row, { label: "Minimum amount", value: min }), jsx(Row, { label: "Fee", value: fee }), jsx(Row, { label: "Time to receive", value: "~10 sec" }), jsx(Row, { label: "Max deposit", value: "No limit" })] }))] }));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { DepositDetails };
|
|
40
|
+
//# sourceMappingURL=Details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Details.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type LogoOption = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
logo: string | null;
|
|
5
|
+
};
|
|
6
|
+
/** A select-like dropdown that shows a logo next to the trigger and each option. */
|
|
7
|
+
export declare function LogoSelect({ value, options, onChange, }: {
|
|
8
|
+
value: string;
|
|
9
|
+
options: LogoOption[];
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|