@openfort/react 1.2.0 → 1.4.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/logos.d.ts +3 -0
- package/build/assets/logos.js +2 -0
- package/build/assets/logos.js.map +1 -1
- package/build/components/Common/Modal/styles.js +3 -0
- package/build/components/Common/Modal/styles.js.map +1 -1
- package/build/components/Common/ScrollArea/index.d.ts +5 -1
- package/build/components/Common/ScrollArea/index.js +2 -2
- package/build/components/Common/ScrollArea/styles.d.ts +4 -1
- package/build/components/Common/ScrollArea/styles.js +19 -4
- package/build/components/Common/ScrollArea/styles.js.map +1 -1
- package/build/components/Common/SolanaChain/index.d.ts +8 -0
- package/build/components/Common/SolanaChain/index.js +40 -0
- package/build/components/Common/SolanaChain/index.js.map +1 -0
- package/build/components/ConnectModal/index.js +17 -5
- package/build/components/ConnectModal/index.js.map +1 -1
- package/build/components/Openfort/types.d.ts +17 -11
- package/build/components/Openfort/types.js +1 -0
- package/build/components/Openfort/types.js.map +1 -1
- package/build/components/PageContent/index.d.ts +2 -1
- package/build/components/PageContent/index.js +2 -2
- package/build/components/Pages/Buy/coinbaseApi.d.ts +1 -1
- package/build/components/Pages/Buy/coinbaseApi.js +2 -13
- package/build/components/Pages/Buy/coinbaseApi.js.map +1 -1
- package/build/components/Pages/Buy/evmCurrencies.d.ts +11 -0
- package/build/components/Pages/Buy/evmCurrencies.js +27 -0
- package/build/components/Pages/Buy/evmCurrencies.js.map +1 -0
- package/build/components/Pages/Buy/index.js +8 -1
- package/build/components/Pages/Buy/index.js.map +1 -1
- package/build/components/Pages/Buy/onrampApi.d.ts +8 -1
- package/build/components/Pages/Buy/onrampApi.js +24 -14
- package/build/components/Pages/Buy/onrampApi.js.map +1 -1
- package/build/components/Pages/Buy/solanaCurrencies.d.ts +9 -0
- package/build/components/Pages/Buy/solanaCurrencies.js +25 -0
- package/build/components/Pages/Buy/solanaCurrencies.js.map +1 -0
- package/build/components/Pages/Buy/stripeApi.d.ts +1 -1
- package/build/components/Pages/Buy/stripeApi.js +2 -13
- package/build/components/Pages/Buy/stripeApi.js.map +1 -1
- package/build/components/Pages/BuyComplete/index.js +7 -1
- package/build/components/Pages/BuyComplete/index.js.map +1 -1
- package/build/components/Pages/BuyProcessing/index.js +9 -5
- package/build/components/Pages/BuyProcessing/index.js.map +1 -1
- package/build/components/Pages/BuyProviderSelect/styles.d.ts +2 -1
- package/build/components/Pages/BuySelectProvider/index.js +10 -5
- package/build/components/Pages/BuySelectProvider/index.js.map +1 -1
- package/build/components/Pages/Connected/EthereumConnected.js +7 -3
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -1
- package/build/components/Pages/Connected/SolanaConnected.js +3 -2
- package/build/components/Pages/Connected/SolanaConnected.js.map +1 -1
- package/build/components/Pages/Deposit/AssetChainLogo.d.ts +5 -2
- package/build/components/Pages/Deposit/AssetChainLogo.js +21 -4
- package/build/components/Pages/Deposit/AssetChainLogo.js.map +1 -1
- package/build/components/Pages/Deposit/DepositAddressBlock.js +1 -1
- package/build/components/Pages/Deposit/DepositProgress.js +3 -2
- package/build/components/Pages/Deposit/DepositProgress.js.map +1 -1
- package/build/components/Pages/Deposit/DepositSuccess.js +2 -1
- package/build/components/Pages/Deposit/DepositSuccess.js.map +1 -1
- package/build/components/Pages/Deposit/RouteSelectors.js +11 -1
- package/build/components/Pages/Deposit/RouteSelectors.js.map +1 -1
- package/build/components/Pages/Deposit/SameChainDepositStatus.d.ts +7 -0
- package/build/components/Pages/Deposit/SameChainDepositStatus.js +34 -0
- package/build/components/Pages/Deposit/SameChainDepositStatus.js.map +1 -0
- package/build/components/Pages/Deposit/SameChainDepositSuccess.d.ts +11 -0
- package/build/components/Pages/Deposit/SameChainDepositSuccess.js +30 -0
- package/build/components/Pages/Deposit/SameChainDepositSuccess.js.map +1 -0
- package/build/components/Pages/Deposit/TestnetNotice.d.ts +10 -0
- package/build/components/Pages/Deposit/TestnetNotice.js +131 -0
- package/build/components/Pages/Deposit/TestnetNotice.js.map +1 -0
- package/build/components/Pages/Deposit/UnsupportedNetworkNotice.d.ts +12 -0
- package/build/components/Pages/Deposit/UnsupportedNetworkNotice.js +111 -0
- package/build/components/Pages/Deposit/UnsupportedNetworkNotice.js.map +1 -0
- package/build/components/Pages/Deposit/index.js +35 -5
- package/build/components/Pages/Deposit/index.js.map +1 -1
- package/build/components/Pages/Deposit/paymentOptions.d.ts +6 -0
- package/build/components/Pages/Deposit/paymentOptions.js +10 -4
- package/build/components/Pages/Deposit/paymentOptions.js.map +1 -1
- package/build/components/Pages/Deposit/useDepositRoute.d.ts +2 -1
- package/build/components/Pages/Deposit/useDepositRoute.js +36 -13
- package/build/components/Pages/Deposit/useDepositRoute.js.map +1 -1
- package/build/components/Pages/Deposit/useFundingTarget.d.ts +2 -4
- package/build/components/Pages/Deposit/useFundingTarget.js +3 -5
- package/build/components/Pages/Deposit/useFundingTarget.js.map +1 -1
- package/build/components/Pages/Deposit/useSameChainArrival.d.ts +19 -0
- package/build/components/Pages/Deposit/useSameChainArrival.js +86 -0
- package/build/components/Pages/Deposit/useSameChainArrival.js.map +1 -0
- package/build/components/Pages/DepositCex/index.js +7 -8
- package/build/components/Pages/DepositCex/index.js.map +1 -1
- package/build/components/Pages/DepositCrypto/index.js +26 -3
- package/build/components/Pages/DepositCrypto/index.js.map +1 -1
- package/build/components/Pages/DepositWallet/DepositWalletDesktop.d.ts +4 -1
- package/build/components/Pages/DepositWallet/DepositWalletDesktop.js +19 -27
- package/build/components/Pages/DepositWallet/DepositWalletDesktop.js.map +1 -1
- package/build/components/Pages/DepositWallet/index.d.ts +5 -5
- package/build/components/Pages/DepositWallet/index.js +82 -39
- package/build/components/Pages/DepositWallet/index.js.map +1 -1
- package/build/components/Pages/DepositWallet/walletDeeplinks.d.ts +6 -4
- package/build/components/Pages/DepositWallet/walletDeeplinks.js +3 -1
- package/build/components/Pages/DepositWallet/walletDeeplinks.js.map +1 -1
- package/build/components/Pages/SelectToken/SolanaSelectToken.d.ts +1 -0
- package/build/components/Pages/SelectToken/SolanaSelectToken.js +50 -0
- package/build/components/Pages/SelectToken/SolanaSelectToken.js.map +1 -0
- package/build/components/Pages/SelectToken/index.js +13 -2
- package/build/components/Pages/SelectToken/index.js.map +1 -1
- package/build/components/Pages/SelectToken/styles.d.ts +2 -1
- package/build/components/Pages/Send/SolanaSend.js +32 -31
- package/build/components/Pages/Send/SolanaSend.js.map +1 -1
- package/build/components/Pages/Send/utils.js +4 -1
- package/build/components/Pages/Send/utils.js.map +1 -1
- package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js +57 -13
- package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js.map +1 -1
- package/build/components/Pages/SendConfirmation/index.js +1 -1
- package/build/components/Pages/SendConfirmation/styles.d.ts +0 -5
- package/build/components/Pages/SendConfirmation/styles.js +1 -39
- package/build/components/Pages/SendConfirmation/styles.js.map +1 -1
- package/build/constants/chainConfigs.js +32 -32
- package/build/constants/logos.d.ts +4 -0
- package/build/constants/logos.js +25 -1
- package/build/constants/logos.js.map +1 -1
- package/build/ethereum/hooks/useEthereumWalletAssets.js +39 -3
- package/build/ethereum/hooks/useEthereumWalletAssets.js.map +1 -1
- package/build/hooks/openfort/useFunding.js +7 -7
- package/build/hooks/openfort/useFundingChains.d.ts +6 -0
- package/build/hooks/openfort/useFundingChains.js +22 -10
- package/build/hooks/openfort/useFundingChains.js.map +1 -1
- package/build/shared/hooks/useAsyncData.js +15 -2
- package/build/shared/hooks/useAsyncData.js.map +1 -1
- package/build/shared/utils/explorer.js +6 -4
- package/build/shared/utils/explorer.js.map +1 -1
- package/build/solana/transfer.d.ts +35 -6
- package/build/solana/transfer.js +112 -18
- package/build/solana/transfer.js.map +1 -1
- package/build/solana/types.d.ts +8 -0
- package/build/utils/validation.d.ts +9 -0
- package/build/utils/validation.js +14 -1
- package/build/utils/validation.js.map +1 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/build/wagmi/components/ChainSelect/index.js +3 -2
- package/build/wagmi/components/ChainSelect/index.js.map +1 -1
- package/build/wagmi/components/ChainSelectList/index.js +3 -2
- package/build/wagmi/components/ChainSelectList/index.js.map +1 -1
- package/build/wagmi/components/SwitchNetworks/index.js +3 -2
- package/build/wagmi/components/SwitchNetworks/index.js.map +1 -1
- package/build/wagmi/useSwitchChainFiltered.d.ts +199 -0
- package/build/wagmi/useSwitchChainFiltered.js +53 -0
- package/build/wagmi/useSwitchChainFiltered.js.map +1 -0
- package/package.json +5 -1
package/build/assets/logos.d.ts
CHANGED
|
@@ -82,6 +82,9 @@ declare const _default: {
|
|
|
82
82
|
[x: string]: any;
|
|
83
83
|
background?: boolean | undefined;
|
|
84
84
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
Solana: ({ ...props }: {
|
|
86
|
+
[x: string]: any;
|
|
87
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
85
88
|
PlaceHolder: () => import("react/jsx-runtime").JSX.Element;
|
|
86
89
|
Frame: ({ ...props }: {
|
|
87
90
|
[x: string]: any;
|
package/build/assets/logos.js
CHANGED
|
@@ -57,6 +57,7 @@ const Zerion = ({ ...props }) => (jsxs("svg", { ...props, width: "88", height: "
|
|
|
57
57
|
background: 'linear-gradient(120.22deg, #2962EF 0%, #255CE5 100%)',
|
|
58
58
|
}, children: [jsx("path", { d: "M19.0864 22C17.5783 22 16.9973 23.8648 18.2628 24.6438L49.9199 43.732C50.709 44.2178 51.7614 44.0258 52.3048 43.2969L66.2236 25.024C67.17 23.7545 66.2138 22 64.5757 22H19.0864Z", fill: "white" }), jsx("path", { d: "M68.8425 66C70.3503 66 70.9466 64.1252 69.6814 63.3464L38.015 44.2605C37.2259 43.7748 36.1989 43.991 35.6558 44.7198L21.7099 62.9891C20.7639 64.2582 21.7499 66 23.3877 66H68.8425Z", fill: "white" })] }));
|
|
59
59
|
const Phantom = ({ background = false, ...props }) => (jsx("svg", { ...props, width: "88", height: "88", viewBox: "0 0 88 88", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: background ? { background: '#AB9FF2' } : undefined, children: jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M37.7425 57.0705C34.1942 62.3362 28.2483 69 20.3366 69C16.5965 69 13.0001 67.5093 13 61.0322C12.9997 44.5362 36.2555 19.0003 57.8334 19C70.1084 18.9998 75 27.2474 75 36.6136C75 48.6357 66.9442 62.3824 58.9368 62.3824C56.3955 62.3824 55.1487 61.031 55.1487 58.888C55.1487 58.3288 55.2442 57.7228 55.4365 57.0705C52.7029 61.5902 47.4285 65.7849 42.4896 65.7849C38.8933 65.7849 37.0713 63.5944 37.0713 60.5187C37.0713 59.4003 37.311 58.2357 37.7425 57.0705ZM53.7586 31.6834C51.8054 31.6868 50.4738 33.2938 50.478 35.5864C50.4822 37.879 51.8198 39.5273 53.7729 39.5241C55.6789 39.5208 57.0099 37.8679 57.0058 35.5752C57.0016 33.2827 55.6646 31.6802 53.7586 31.6834ZM64.1193 31.6725C62.1661 31.6759 60.8345 33.2829 60.8387 35.5755C60.8429 37.868 62.1798 39.5164 64.1336 39.5131C66.0396 39.5099 67.3706 37.8569 67.3664 35.5643C67.3622 33.2718 66.0253 31.6693 64.1193 31.6725Z", fill: background ? '#ffffff' : 'currentColor' }) }));
|
|
60
|
+
const Solana = ({ ...props }) => (jsxs("svg", { ...props, viewBox: "0 0 398 312", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("title", { children: "Solana" }), jsx("defs", { children: jsxs("linearGradient", { id: "openfort-solana-gradient", x1: "360.879", y1: "-37.455", x2: "141.213", y2: "383.294", gradientUnits: "userSpaceOnUse", children: [jsx("stop", { stopColor: "#00FFA3" }), jsx("stop", { offset: "1", stopColor: "#DC1FFF" })] }) }), jsx("path", { fill: "url(#openfort-solana-gradient)", d: "M64.6 237.9c2.4-2.4 5.7-3.8 9.2-3.8h317.4c5.8 0 8.7 7 4.6 11.1l-62.7 62.7c-2.4 2.4-5.7 3.8-9.2 3.8H15.5c-5.8 0-8.7-7-4.6-11.1L64.6 237.9z" }), jsx("path", { fill: "url(#openfort-solana-gradient)", d: "M64.6 3.8C67.1 1.4 70.4 0 73.8 0h317.4c5.8 0 8.7 7 4.6 11.1l-62.7 62.7c-2.4 2.4-5.7 3.8-9.2 3.8H15.5c-5.8 0-8.7-7-4.6-11.1L64.6 3.8z" }), jsx("path", { fill: "url(#openfort-solana-gradient)", d: "M333.1 120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8 0-8.7 7-4.6 11.1l62.7 62.7c2.4 2.4 5.7 3.8 9.2 3.8h317.4c5.8 0 8.7-7 4.6-11.1L333.1 120.1z" })] }));
|
|
60
61
|
const PlaceHolder = () => {
|
|
61
62
|
return jsx("div", { style: { width: 80, height: 80, background: '#555' } });
|
|
62
63
|
};
|
|
@@ -155,6 +156,7 @@ var Logos = {
|
|
|
155
156
|
Frontier,
|
|
156
157
|
Zerion,
|
|
157
158
|
Phantom,
|
|
159
|
+
Solana,
|
|
158
160
|
PlaceHolder,
|
|
159
161
|
Frame,
|
|
160
162
|
Dawn,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logos.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logos.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -237,6 +237,9 @@ const BoxContainer = styled(motion.div) `
|
|
|
237
237
|
left: 50%;
|
|
238
238
|
width: var(--width);
|
|
239
239
|
height: var(--height);
|
|
240
|
+
/* Match InnerContainer's viewport cap so a tall page's card background
|
|
241
|
+
doesn't run off-screen while the content scrolls inside. */
|
|
242
|
+
max-height: 88vh;
|
|
240
243
|
transform: translateX(-50%);
|
|
241
244
|
backface-visibility: hidden;
|
|
242
245
|
transition: all 200ms ease;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
export declare const ScrollArea: ({ children, height, backgroundColor, mobileDirection, }: {
|
|
2
|
+
export declare const ScrollArea: ({ children, height, backgroundColor, mobileDirection, fill, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
height?: number;
|
|
5
5
|
backgroundColor?: string;
|
|
6
6
|
mobileDirection?: "horizontal" | "vertical";
|
|
7
|
+
/** Grow to fill a flex parent and scroll internally, instead of capping at a
|
|
8
|
+
* fixed pixel height. Use inside a bounded flex column to keep siblings (e.g.
|
|
9
|
+
* a footer) pinned while only this region scrolls. */
|
|
10
|
+
fill?: boolean;
|
|
7
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,7 @@ import useIsMobile from '../../../hooks/useIsMobile.js';
|
|
|
4
4
|
import { ScrollContainer, ScrollAreaContainer, MoreIndicator } from './styles.js';
|
|
5
5
|
|
|
6
6
|
const ArrowDown = () => (jsxs("svg", { width: "11", height: "12", viewBox: "0 0 11 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("title", { children: "Scroll down arrow" }), jsx("path", { d: "M5.49438 1L5.49438 11M5.49438 11L9.5 7M5.49438 11L1.5 7", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
7
|
-
const ScrollArea = ({ children, height, backgroundColor, mobileDirection, }) => {
|
|
7
|
+
const ScrollArea = ({ children, height, backgroundColor, mobileDirection, fill, }) => {
|
|
8
8
|
const ref = useRef(null);
|
|
9
9
|
const moreRef = useRef(null);
|
|
10
10
|
const isMobile = useIsMobile();
|
|
@@ -44,7 +44,7 @@ const ScrollArea = ({ children, height, backgroundColor, mobileDirection, }) =>
|
|
|
44
44
|
el.removeEventListener('scroll', handleScroll);
|
|
45
45
|
};
|
|
46
46
|
}, [ref.current]);
|
|
47
|
-
return (jsxs(ScrollContainer, { children: [jsx(ScrollAreaContainer, { ref: ref, "$mobile": isMobile, "$height": height, "$backgroundColor": backgroundColor, "$mobileDirection": mobileDirection, children: children }), jsx(MoreIndicator, { ref: moreRef, className: "hide", onClick: () => {
|
|
47
|
+
return (jsxs(ScrollContainer, { "$fill": fill, children: [jsx(ScrollAreaContainer, { ref: ref, "$mobile": isMobile, "$height": height, "$backgroundColor": backgroundColor, "$mobileDirection": mobileDirection, "$fill": fill, children: children }), jsx(MoreIndicator, { ref: moreRef, className: "hide", onClick: () => {
|
|
48
48
|
if (ref.current) {
|
|
49
49
|
ref.current.scrollTo({
|
|
50
50
|
top: ref.current.scrollHeight,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export declare const ScrollContainer: import("styled-components").StyledComponent<"div", any, {
|
|
1
|
+
export declare const ScrollContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
$fill?: boolean;
|
|
3
|
+
}, never>;
|
|
2
4
|
export declare const MoreIndicator: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
5
|
export declare const ScrollAreaContainer: import("styled-components").StyledComponent<"div", any, {
|
|
4
6
|
$mobile?: boolean;
|
|
5
7
|
$height?: number;
|
|
6
8
|
$backgroundColor?: string;
|
|
7
9
|
$mobileDirection?: "horizontal" | "vertical";
|
|
10
|
+
$fill?: boolean;
|
|
8
11
|
}, never>;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { css, keyframes } from 'styled-components';
|
|
2
2
|
import styled from '../../../styles/styled/index.js';
|
|
3
3
|
|
|
4
4
|
const ScrollContainer = styled.div `
|
|
5
5
|
position: relative;
|
|
6
|
+
${({ $fill }) => $fill &&
|
|
7
|
+
css `
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
flex: 1 1 auto;
|
|
11
|
+
min-height: 0;
|
|
12
|
+
`}
|
|
6
13
|
`;
|
|
7
14
|
const fadeIn = keyframes `
|
|
8
15
|
0%{ opacity:0; }
|
|
@@ -60,7 +67,7 @@ const ScrollAreaContainer = styled.div `
|
|
|
60
67
|
position: relative;
|
|
61
68
|
z-index: 1;
|
|
62
69
|
|
|
63
|
-
${({ $mobile, $height, $mobileDirection }) => $mobile && $mobileDirection === 'horizontal'
|
|
70
|
+
${({ $mobile, $height, $mobileDirection, $fill }) => $mobile && $mobileDirection === 'horizontal'
|
|
64
71
|
? css `
|
|
65
72
|
overflow-x: scroll;
|
|
66
73
|
margin: 0 -24px;
|
|
@@ -103,8 +110,16 @@ const ScrollAreaContainer = styled.div `
|
|
|
103
110
|
}
|
|
104
111
|
`
|
|
105
112
|
: css `
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
${$fill
|
|
114
|
+
? css `
|
|
115
|
+
flex: 1 1 auto;
|
|
116
|
+
min-height: 0;
|
|
117
|
+
overflow-y: scroll;
|
|
118
|
+
`
|
|
119
|
+
: css `
|
|
120
|
+
max-height: ${$height ? `${$height}px` : '310px'};
|
|
121
|
+
overflow-y: scroll;
|
|
122
|
+
`}
|
|
108
123
|
padding: 0 10px;
|
|
109
124
|
margin: calc(var(--fade-height) * -1) -16px 0 -10px;
|
|
110
125
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only Solana network indicator for the Connected modal — the Solana logo,
|
|
3
|
+
* with the active cluster shown on hover. There is no switch: the cluster is
|
|
4
|
+
* fixed by `walletConfig.solana`, and switching between Solana and EVM is
|
|
5
|
+
* intentionally unsupported.
|
|
6
|
+
*/
|
|
7
|
+
declare const SolanaChain: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default SolanaChain;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import Logos from '../../../assets/logos.js';
|
|
3
|
+
import { useSolanaContext } from '../../../solana/SolanaContext.js';
|
|
4
|
+
import styled from '../../../styles/styled/index.js';
|
|
5
|
+
import Tooltip from '../Tooltip/index.js';
|
|
6
|
+
|
|
7
|
+
/** `mainnet-beta` → "Mainnet"; otherwise capitalize the cluster name. */
|
|
8
|
+
function formatCluster(cluster) {
|
|
9
|
+
if (!cluster)
|
|
10
|
+
return '';
|
|
11
|
+
if (cluster === 'mainnet-beta')
|
|
12
|
+
return 'Mainnet';
|
|
13
|
+
return cluster.charAt(0).toUpperCase() + cluster.slice(1);
|
|
14
|
+
}
|
|
15
|
+
const Badge = styled.div `
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
width: 24px;
|
|
20
|
+
height: 24px;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
background: #131313;
|
|
23
|
+
border: 2px solid var(--ck-body-background, #fff);
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
`;
|
|
26
|
+
/**
|
|
27
|
+
* Read-only Solana network indicator for the Connected modal — the Solana logo,
|
|
28
|
+
* with the active cluster shown on hover. There is no switch: the cluster is
|
|
29
|
+
* fixed by `walletConfig.solana`, and switching between Solana and EVM is
|
|
30
|
+
* intentionally unsupported.
|
|
31
|
+
*/
|
|
32
|
+
const SolanaChain = () => {
|
|
33
|
+
var _a;
|
|
34
|
+
const cluster = (_a = useSolanaContext()) === null || _a === void 0 ? void 0 : _a.cluster;
|
|
35
|
+
const label = cluster ? `Solana · ${formatCluster(cluster)}` : 'Solana';
|
|
36
|
+
return (jsx(Tooltip, { message: label, children: jsx(Badge, { "aria-label": label, children: jsx(Logos.Solana, { style: { width: '62%', height: 'auto' } }) }) }));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { SolanaChain as default };
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -46,6 +46,7 @@ import Receive from '../Pages/Receive/index.js';
|
|
|
46
46
|
import RecoverPage from '../Pages/Recover/index.js';
|
|
47
47
|
import RemoveLinkedProvider from '../Pages/RemoveLinkedProvider/index.js';
|
|
48
48
|
import SelectToken from '../Pages/SelectToken/index.js';
|
|
49
|
+
import { SolanaSelectToken } from '../Pages/SelectToken/SolanaSelectToken.js';
|
|
49
50
|
import SelectWalletToRecover from '../Pages/SelectWalletToRecover/index.js';
|
|
50
51
|
import Send from '../Pages/Send/index.js';
|
|
51
52
|
import { SolanaSend } from '../Pages/Send/SolanaSend.js';
|
|
@@ -121,6 +122,7 @@ const CHAIN_PREFIXED_PAGES = {
|
|
|
121
122
|
'sol:createWallet': jsx(CreateWallet, {}),
|
|
122
123
|
'sol:recoverWallet': jsx(RecoverPage, {}),
|
|
123
124
|
'sol:send': jsx(SolanaSend, {}),
|
|
125
|
+
'sol:sendTokenSelect': jsx(SolanaSelectToken, {}),
|
|
124
126
|
'sol:sendConfirmation': jsx(SolanaSendConfirmation, {}),
|
|
125
127
|
'sol:receive': jsx(Receive, {}),
|
|
126
128
|
'sol:assetInventory': jsx(SolanaAssetInventory, {}),
|
|
@@ -147,17 +149,27 @@ const ConnectModal = ({ mode = 'auto', theme = 'auto', customTheme = customTheme
|
|
|
147
149
|
const isConnected = (_a = strategy === null || strategy === void 0 ? void 0 : strategy.isConnected(state)) !== null && _a !== void 0 ? _a : false;
|
|
148
150
|
const chainId = strategy === null || strategy === void 0 ? void 0 : strategy.getChainId();
|
|
149
151
|
const chainIsSupported = chainId != null && context.chains.some((c) => c.id === chainId);
|
|
150
|
-
// Auto-close when the
|
|
151
|
-
//
|
|
152
|
-
//
|
|
152
|
+
// Auto-close only when the connect/auth flow completes: the modal was opened while
|
|
153
|
+
// disconnected and then became connected. We latch the "opened-while-connected" state
|
|
154
|
+
// on each open transition, so a chain switch — which briefly drops and restores the
|
|
155
|
+
// connection while the modal is already open and connected — never triggers a close.
|
|
156
|
+
const prevOpenRef = useRef(context.open);
|
|
157
|
+
const openedConnectedRef = useRef(isConnected);
|
|
153
158
|
const prevIsConnectedRef = useRef(isConnected);
|
|
154
159
|
useEffect(() => {
|
|
160
|
+
const justOpened = context.open && !prevOpenRef.current;
|
|
161
|
+
prevOpenRef.current = context.open;
|
|
162
|
+
if (justOpened) {
|
|
163
|
+
openedConnectedRef.current = isConnected;
|
|
164
|
+
prevIsConnectedRef.current = isConnected;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
155
167
|
const wasConnected = prevIsConnectedRef.current;
|
|
156
168
|
prevIsConnectedRef.current = isConnected;
|
|
157
|
-
if (!wasConnected && isConnected && context.open) {
|
|
169
|
+
if (!openedConnectedRef.current && !wasConnected && isConnected && context.open) {
|
|
158
170
|
context.setOpen(false);
|
|
159
171
|
}
|
|
160
|
-
}, [isConnected]);
|
|
172
|
+
}, [isConnected, context.open]);
|
|
161
173
|
//if chain is unsupported we enforce a "switch chain" prompt
|
|
162
174
|
const closeable = !(context.uiConfig.enforceSupportedChains && isConnected && !chainIsSupported);
|
|
163
175
|
const route = context.route.route;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -66,6 +66,7 @@ export declare const routes: {
|
|
|
66
66
|
readonly SOL_CREATE_WALLET: "sol:createWallet";
|
|
67
67
|
readonly SOL_RECOVER_WALLET: "sol:recoverWallet";
|
|
68
68
|
readonly SOL_SEND: "sol:send";
|
|
69
|
+
readonly SOL_SEND_TOKEN_SELECT: "sol:sendTokenSelect";
|
|
69
70
|
readonly SOL_SEND_CONFIRMATION: "sol:sendConfirmation";
|
|
70
71
|
readonly SOL_RECEIVE: "sol:receive";
|
|
71
72
|
readonly SOL_ASSET_INVENTORY: "sol:assetInventory";
|
|
@@ -299,12 +300,9 @@ export type ConnectUIOptions = {
|
|
|
299
300
|
buyFromExchangeUrl?: string;
|
|
300
301
|
buyTroubleshootingUrl?: string;
|
|
301
302
|
/**
|
|
302
|
-
* Base URL of the
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* TODO(openfort-funding-backend): default this from the platform config once the
|
|
307
|
-
* backend ships, so integrators don't have to set it manually.
|
|
303
|
+
* Base URL of the funding JSON API serving `/v2/funding/*` (chains + sessions).
|
|
304
|
+
* Defaults to the SDK's backend URL (`https://api.openfort.io`); set this only to
|
|
305
|
+
* point the Deposit hub's crypto rails at a custom funding service.
|
|
308
306
|
*/
|
|
309
307
|
fundingBaseUrl?: string;
|
|
310
308
|
/** Deposit-hub funding options (destination chain/token for incoming deposits). */
|
|
@@ -346,11 +344,6 @@ export type FundingUIOptions = {
|
|
|
346
344
|
* @default USDC on Base
|
|
347
345
|
*/
|
|
348
346
|
targetCurrency?: string;
|
|
349
|
-
/**
|
|
350
|
-
* Destination wallet that receives the deposit. Optional integrator override;
|
|
351
|
-
* when unset, deposits land on the active embedded wallet for the target chain.
|
|
352
|
-
*/
|
|
353
|
-
targetAddress?: string;
|
|
354
347
|
/**
|
|
355
348
|
* Which funding methods the Deposit hub shows, and in what order. Omit to show
|
|
356
349
|
* all available methods (Apple Pay first on mobile). Mirrors `authProviders`.
|
|
@@ -457,6 +450,19 @@ export type Asset = {
|
|
|
457
450
|
};
|
|
458
451
|
};
|
|
459
452
|
raw?: getAssets.Erc20Asset;
|
|
453
|
+
} | {
|
|
454
|
+
type: 'spl';
|
|
455
|
+
address: string;
|
|
456
|
+
balance: bigint;
|
|
457
|
+
metadata: {
|
|
458
|
+
decimals: number;
|
|
459
|
+
symbol: string;
|
|
460
|
+
name: string;
|
|
461
|
+
fiat?: {
|
|
462
|
+
value: number;
|
|
463
|
+
currency: string;
|
|
464
|
+
};
|
|
465
|
+
};
|
|
460
466
|
};
|
|
461
467
|
export type MultiChainAsset = Asset & {
|
|
462
468
|
chainId: number;
|
|
@@ -56,6 +56,7 @@ const routes = {
|
|
|
56
56
|
SOL_CREATE_WALLET: 'sol:createWallet',
|
|
57
57
|
SOL_RECOVER_WALLET: 'sol:recoverWallet',
|
|
58
58
|
SOL_SEND: 'sol:send',
|
|
59
|
+
SOL_SEND_TOKEN_SELECT: 'sol:sendTokenSelect',
|
|
59
60
|
SOL_SEND_CONFIRMATION: 'sol:sendConfirmation',
|
|
60
61
|
SOL_RECEIVE: 'sol:receive',
|
|
61
62
|
SOL_ASSET_INVENTORY: 'sol:assetInventory',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,6 +6,7 @@ type PageContentProps = {
|
|
|
6
6
|
onBack?: SetOnBackFunction;
|
|
7
7
|
logoutOnBack?: boolean;
|
|
8
8
|
header?: string;
|
|
9
|
+
className?: string;
|
|
9
10
|
};
|
|
10
|
-
export declare const PageContent: ({ children, width, onBack, logoutOnBack, header }: PageContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const PageContent: ({ children, width, onBack, logoutOnBack, header, className, }: PageContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -5,7 +5,7 @@ import { ModalHeading } from '../Common/Modal/styles.js';
|
|
|
5
5
|
import { useOpenfort } from '../Openfort/useOpenfort.js';
|
|
6
6
|
import { PageContentStyle } from './styles.js';
|
|
7
7
|
|
|
8
|
-
const PageContent = ({ children, width, onBack = 'back', logoutOnBack, header }) => {
|
|
8
|
+
const PageContent = ({ children, width, onBack = 'back', logoutOnBack, header, className, }) => {
|
|
9
9
|
const { setOnBack, setRoute, setPreviousRoute, setRouteHistory } = useOpenfort();
|
|
10
10
|
const { signOut } = useSignOut();
|
|
11
11
|
useEffect(() => {
|
|
@@ -48,7 +48,7 @@ const PageContent = ({ children, width, onBack = 'back', logoutOnBack, header })
|
|
|
48
48
|
else
|
|
49
49
|
setOnBack(null);
|
|
50
50
|
}, [!!onBack, !!logoutOnBack]);
|
|
51
|
-
return (jsxs(PageContentStyle, { style: { width }, children: [header && jsx(ModalHeading, { children: header }), children] }));
|
|
51
|
+
return (jsxs(PageContentStyle, { className: className, style: { width }, children: [header && jsx(ModalHeading, { children: header }), children] }));
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export { PageContent };
|
|
@@ -25,7 +25,7 @@ export declare const isCoinbaseSupported: (token: Asset) => boolean;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare const createCoinbaseSession: (params: Omit<CreateCoinbaseSessionParams, "destinationCurrency" | "destinationNetwork"> & {
|
|
27
27
|
token: Asset;
|
|
28
|
-
|
|
28
|
+
network: string;
|
|
29
29
|
publishableKey: string;
|
|
30
30
|
}) => Promise<CoinbaseOnrampResponse>;
|
|
31
31
|
export {};
|
|
@@ -5,17 +5,6 @@ const getBackendUrl = () => {
|
|
|
5
5
|
const sdkConfig = SDKConfiguration.getInstance();
|
|
6
6
|
return (sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.backendUrl) || 'https://api.openfort.io';
|
|
7
7
|
};
|
|
8
|
-
// Map chain IDs to Coinbase network names
|
|
9
|
-
const getNetworkName = (chainId) => {
|
|
10
|
-
const networkMap = {
|
|
11
|
-
1: 'ethereum',
|
|
12
|
-
8453: 'base',
|
|
13
|
-
137: 'polygon',
|
|
14
|
-
42161: 'arbitrum',
|
|
15
|
-
10: 'optimism',
|
|
16
|
-
};
|
|
17
|
-
return networkMap[chainId] || 'base';
|
|
18
|
-
};
|
|
19
8
|
// Coinbase supported currencies (more extensive than Stripe)
|
|
20
9
|
const COINBASE_SUPPORTED_CURRENCIES = [
|
|
21
10
|
'btc',
|
|
@@ -61,7 +50,7 @@ const getCurrencyCode = (token) => {
|
|
|
61
50
|
* 3. One-click with quote: One-click + paymentMethod + country (+ subdivision for US)
|
|
62
51
|
*/
|
|
63
52
|
const createCoinbaseSession = async (params) => {
|
|
64
|
-
const { token,
|
|
53
|
+
const { token, network, publishableKey, ...rest } = params;
|
|
65
54
|
if (!publishableKey) {
|
|
66
55
|
throw new Error('Publishable key is required for authentication');
|
|
67
56
|
}
|
|
@@ -69,7 +58,7 @@ const createCoinbaseSession = async (params) => {
|
|
|
69
58
|
const requestBody = {
|
|
70
59
|
provider: 'coinbase',
|
|
71
60
|
destinationCurrency: getCurrencyCode(token),
|
|
72
|
-
destinationNetwork:
|
|
61
|
+
destinationNetwork: network,
|
|
73
62
|
destinationAddress: rest.destinationAddress,
|
|
74
63
|
};
|
|
75
64
|
// Add optional parameters only if provided
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coinbaseApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coinbaseApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Asset } from '../../Openfort/types';
|
|
2
|
+
/**
|
|
3
|
+
* Buyable EVM destination currencies for the fiat onramp. USDC is first so it is
|
|
4
|
+
* the default; both are supported by Coinbase and Stripe. Balances aren't needed
|
|
5
|
+
* (you're buying), so these carry zero balance — only the symbol feeds the onramp
|
|
6
|
+
* `destinationCurrency`. The USDC `address` is Base USDC cast to `Hex` to fit the
|
|
7
|
+
* shared `Asset` type; it's only read by `getAssetSymbol`. Mirrors
|
|
8
|
+
* {@link SOLANA_BUY_CURRENCIES} so the card/Apple Pay picker always has options,
|
|
9
|
+
* even for a freshly created wallet with no indexed token balances.
|
|
10
|
+
*/
|
|
11
|
+
export declare const EVM_BUY_CURRENCIES: Asset[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DEST_USDC } from '../Deposit/sources.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Buyable EVM destination currencies for the fiat onramp. USDC is first so it is
|
|
5
|
+
* the default; both are supported by Coinbase and Stripe. Balances aren't needed
|
|
6
|
+
* (you're buying), so these carry zero balance — only the symbol feeds the onramp
|
|
7
|
+
* `destinationCurrency`. The USDC `address` is Base USDC cast to `Hex` to fit the
|
|
8
|
+
* shared `Asset` type; it's only read by `getAssetSymbol`. Mirrors
|
|
9
|
+
* {@link SOLANA_BUY_CURRENCIES} so the card/Apple Pay picker always has options,
|
|
10
|
+
* even for a freshly created wallet with no indexed token balances.
|
|
11
|
+
*/
|
|
12
|
+
const EVM_BUY_CURRENCIES = [
|
|
13
|
+
{
|
|
14
|
+
type: 'erc20',
|
|
15
|
+
address: DEST_USDC,
|
|
16
|
+
balance: BigInt(0),
|
|
17
|
+
metadata: { symbol: 'USDC', name: 'USD Coin', decimals: 6 },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'native',
|
|
21
|
+
balance: BigInt(0),
|
|
22
|
+
metadata: { symbol: 'ETH', decimals: 18, fiat: { value: 0, currency: 'USD' } },
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export { EVM_BUY_CURRENCIES };
|
|
27
|
+
//# sourceMappingURL=evmCurrencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evmCurrencies.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
3
|
import { useState, useMemo, useEffect } from 'react';
|
|
3
4
|
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
4
5
|
import useLocales from '../../../hooks/useLocales.js';
|
|
6
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
5
7
|
import Button from '../../Common/Button/index.js';
|
|
6
8
|
import { Arrow, ArrowChevron } from '../../Common/Button/styles.js';
|
|
7
9
|
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
@@ -9,6 +11,7 @@ import { routes } from '../../Openfort/types.js';
|
|
|
9
11
|
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
10
12
|
import { PageContent } from '../../PageContent/index.js';
|
|
11
13
|
import { sanitizeForParsing, sanitizeAmountInput, isSameToken, getAssetSymbol } from '../Send/utils.js';
|
|
14
|
+
import { SOLANA_BUY_CURRENCIES } from './solanaCurrencies.js';
|
|
12
15
|
import { Section, SectionLabel, AmountCard, CurrencySymbol, AmountInput, PresetList, PresetButton, SelectorButton, SelectorContent, SelectorTitle, SelectorSubtitle, SelectorRight, ContinueButtonWrapper } from './styles.js';
|
|
13
16
|
import { createCurrencyFormatter, getCurrencySymbol } from './utils.js';
|
|
14
17
|
|
|
@@ -17,7 +20,11 @@ const Buy = () => {
|
|
|
17
20
|
var _a;
|
|
18
21
|
const { buyForm, setBuyForm, setRoute, triggerResize } = useOpenfort();
|
|
19
22
|
const locales = useLocales();
|
|
20
|
-
const {
|
|
23
|
+
const { chainType } = useOpenfortCore();
|
|
24
|
+
const { data: ethAssets } = useEthereumWalletAssets();
|
|
25
|
+
// Solana wallets buy Solana currencies (USDC default, then SOL); EVM reads its
|
|
26
|
+
// own assets. Both hooks run unconditionally; the active chain picks the list.
|
|
27
|
+
const assets = chainType === ChainTypeEnum.SVM ? SOLANA_BUY_CURRENCIES : ethAssets;
|
|
21
28
|
const [pressedPreset, setPressedPreset] = useState(null);
|
|
22
29
|
const fiatAmount = useMemo(() => {
|
|
23
30
|
const normalizedAmount = sanitizeForParsing(sanitizeAmountInput(buyForm.amount));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
1
2
|
import type { Asset } from '../../Openfort/types';
|
|
2
3
|
export type OnrampQuote = {
|
|
3
4
|
provider: string;
|
|
@@ -13,9 +14,15 @@ export type OnrampQuote = {
|
|
|
13
14
|
}>;
|
|
14
15
|
exchangeRate: string;
|
|
15
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Resolve the onramp destination network for the active chain. Solana always
|
|
19
|
+
* resolves to `solana`; an EVM wallet whose `chainId` hasn't loaded yet returns
|
|
20
|
+
* `undefined`, so callers stay gated until the chain is ready.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveOnrampNetwork(chainType: ChainTypeEnum, chainId?: number): string | undefined;
|
|
16
23
|
type GetAllQuotesParams = {
|
|
17
24
|
token: Asset;
|
|
18
|
-
|
|
25
|
+
network: string;
|
|
19
26
|
publishableKey: string;
|
|
20
27
|
sourceCurrency: string;
|
|
21
28
|
sourceAmount: string;
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
-
import { SDKConfiguration } from '@openfort/openfort-js';
|
|
1
|
+
import { ChainTypeEnum, SDKConfiguration } from '@openfort/openfort-js';
|
|
2
2
|
import { getAssetSymbol } from '../Send/utils.js';
|
|
3
3
|
|
|
4
4
|
const getBackendUrl = () => {
|
|
5
5
|
const sdkConfig = SDKConfiguration.getInstance();
|
|
6
6
|
return (sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.backendUrl) || 'https://api.openfort.io';
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
10: 'optimism',
|
|
16
|
-
};
|
|
17
|
-
return networkMap[chainId] || 'base';
|
|
8
|
+
/** EVM chain id → onramp network name. */
|
|
9
|
+
const EVM_NETWORK_MAP = {
|
|
10
|
+
1: 'ethereum',
|
|
11
|
+
8453: 'base',
|
|
12
|
+
137: 'polygon',
|
|
13
|
+
42161: 'arbitrum',
|
|
14
|
+
10: 'optimism',
|
|
18
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the onramp destination network for the active chain. Solana always
|
|
18
|
+
* resolves to `solana`; an EVM wallet whose `chainId` hasn't loaded yet returns
|
|
19
|
+
* `undefined`, so callers stay gated until the chain is ready.
|
|
20
|
+
*/
|
|
21
|
+
function resolveOnrampNetwork(chainType, chainId) {
|
|
22
|
+
var _a;
|
|
23
|
+
if (chainType === ChainTypeEnum.SVM)
|
|
24
|
+
return 'solana';
|
|
25
|
+
if (chainId == null)
|
|
26
|
+
return undefined;
|
|
27
|
+
return (_a = EVM_NETWORK_MAP[chainId]) !== null && _a !== void 0 ? _a : 'base';
|
|
28
|
+
}
|
|
19
29
|
// Map token symbol to currency code
|
|
20
30
|
const getCurrencyCode = (token) => {
|
|
21
31
|
return getAssetSymbol(token).toLowerCase();
|
|
@@ -25,14 +35,14 @@ const getCurrencyCode = (token) => {
|
|
|
25
35
|
* Calls the backend without specifying a provider to get quotes from all providers
|
|
26
36
|
*/
|
|
27
37
|
const getAllQuotes = async (params) => {
|
|
28
|
-
const { token,
|
|
38
|
+
const { token, network, publishableKey, sourceCurrency, sourceAmount } = params;
|
|
29
39
|
if (!publishableKey) {
|
|
30
40
|
throw new Error('Publishable key is required for authentication');
|
|
31
41
|
}
|
|
32
42
|
// Build request body WITHOUT provider to get all quotes
|
|
33
43
|
const requestBody = {
|
|
34
44
|
destinationCurrency: getCurrencyCode(token),
|
|
35
|
-
destinationNetwork:
|
|
45
|
+
destinationNetwork: network,
|
|
36
46
|
sourceCurrency: sourceCurrency.toLowerCase(),
|
|
37
47
|
sourceAmount,
|
|
38
48
|
};
|
|
@@ -53,5 +63,5 @@ const getAllQuotes = async (params) => {
|
|
|
53
63
|
return Array.isArray(data) ? data : [data];
|
|
54
64
|
};
|
|
55
65
|
|
|
56
|
-
export { getAllQuotes };
|
|
66
|
+
export { getAllQuotes, resolveOnrampNetwork };
|
|
57
67
|
//# sourceMappingURL=onrampApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onrampApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"onrampApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Asset } from '../../Openfort/types';
|
|
2
|
+
/**
|
|
3
|
+
* Buyable Solana destination currencies for the fiat onramp. USDC is first so it
|
|
4
|
+
* is the default; both are supported by Coinbase and Stripe on Solana. Balances
|
|
5
|
+
* aren't needed (you're buying), so these carry zero balance — only the symbol
|
|
6
|
+
* feeds the onramp `destinationCurrency`. The USDC `address` is the SPL mint cast
|
|
7
|
+
* to `Hex` to fit the shared `Asset` type; it's only read by `getAssetSymbol`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SOLANA_BUY_CURRENCIES: Asset[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DEST_USDC_SOL } from '../Deposit/sources.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Buyable Solana destination currencies for the fiat onramp. USDC is first so it
|
|
5
|
+
* is the default; both are supported by Coinbase and Stripe on Solana. Balances
|
|
6
|
+
* aren't needed (you're buying), so these carry zero balance — only the symbol
|
|
7
|
+
* feeds the onramp `destinationCurrency`. The USDC `address` is the SPL mint cast
|
|
8
|
+
* to `Hex` to fit the shared `Asset` type; it's only read by `getAssetSymbol`.
|
|
9
|
+
*/
|
|
10
|
+
const SOLANA_BUY_CURRENCIES = [
|
|
11
|
+
{
|
|
12
|
+
type: 'erc20',
|
|
13
|
+
address: DEST_USDC_SOL,
|
|
14
|
+
balance: BigInt(0),
|
|
15
|
+
metadata: { symbol: 'USDC', name: 'USD Coin', decimals: 6 },
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'native',
|
|
19
|
+
balance: BigInt(0),
|
|
20
|
+
metadata: { symbol: 'SOL', decimals: 9, fiat: { value: 0, currency: 'USD' } },
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export { SOLANA_BUY_CURRENCIES };
|
|
25
|
+
//# sourceMappingURL=solanaCurrencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solanaCurrencies.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|