@openfort/react 1.2.0 → 1.3.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.
Files changed (86) hide show
  1. package/build/assets/logos.d.ts +3 -0
  2. package/build/assets/logos.js +2 -0
  3. package/build/assets/logos.js.map +1 -1
  4. package/build/components/Common/SolanaChain/index.d.ts +8 -0
  5. package/build/components/Common/SolanaChain/index.js +40 -0
  6. package/build/components/Common/SolanaChain/index.js.map +1 -0
  7. package/build/components/ConnectModal/index.js +2 -0
  8. package/build/components/ConnectModal/index.js.map +1 -1
  9. package/build/components/Openfort/types.d.ts +17 -11
  10. package/build/components/Openfort/types.js +1 -0
  11. package/build/components/Openfort/types.js.map +1 -1
  12. package/build/components/Pages/Buy/coinbaseApi.d.ts +1 -1
  13. package/build/components/Pages/Buy/coinbaseApi.js +2 -13
  14. package/build/components/Pages/Buy/coinbaseApi.js.map +1 -1
  15. package/build/components/Pages/Buy/evmCurrencies.d.ts +11 -0
  16. package/build/components/Pages/Buy/evmCurrencies.js +27 -0
  17. package/build/components/Pages/Buy/evmCurrencies.js.map +1 -0
  18. package/build/components/Pages/Buy/index.js +8 -1
  19. package/build/components/Pages/Buy/index.js.map +1 -1
  20. package/build/components/Pages/Buy/onrampApi.d.ts +8 -1
  21. package/build/components/Pages/Buy/onrampApi.js +24 -14
  22. package/build/components/Pages/Buy/onrampApi.js.map +1 -1
  23. package/build/components/Pages/Buy/solanaCurrencies.d.ts +9 -0
  24. package/build/components/Pages/Buy/solanaCurrencies.js +25 -0
  25. package/build/components/Pages/Buy/solanaCurrencies.js.map +1 -0
  26. package/build/components/Pages/Buy/stripeApi.d.ts +1 -1
  27. package/build/components/Pages/Buy/stripeApi.js +2 -13
  28. package/build/components/Pages/Buy/stripeApi.js.map +1 -1
  29. package/build/components/Pages/BuyComplete/index.js +7 -1
  30. package/build/components/Pages/BuyComplete/index.js.map +1 -1
  31. package/build/components/Pages/BuyProcessing/index.js +9 -5
  32. package/build/components/Pages/BuyProcessing/index.js.map +1 -1
  33. package/build/components/Pages/BuySelectProvider/index.js +10 -5
  34. package/build/components/Pages/BuySelectProvider/index.js.map +1 -1
  35. package/build/components/Pages/Connected/SolanaConnected.js +3 -2
  36. package/build/components/Pages/Connected/SolanaConnected.js.map +1 -1
  37. package/build/components/Pages/Deposit/DepositProgress.js +3 -2
  38. package/build/components/Pages/Deposit/DepositProgress.js.map +1 -1
  39. package/build/components/Pages/Deposit/DepositSuccess.js +2 -1
  40. package/build/components/Pages/Deposit/DepositSuccess.js.map +1 -1
  41. package/build/components/Pages/Deposit/index.js +16 -2
  42. package/build/components/Pages/Deposit/index.js.map +1 -1
  43. package/build/components/Pages/Deposit/paymentOptions.js +3 -3
  44. package/build/components/Pages/Deposit/useDepositRoute.d.ts +0 -1
  45. package/build/components/Pages/Deposit/useDepositRoute.js +10 -11
  46. package/build/components/Pages/Deposit/useDepositRoute.js.map +1 -1
  47. package/build/components/Pages/Deposit/useFundingTarget.d.ts +2 -4
  48. package/build/components/Pages/Deposit/useFundingTarget.js +3 -5
  49. package/build/components/Pages/Deposit/useFundingTarget.js.map +1 -1
  50. package/build/components/Pages/DepositCex/index.js +7 -8
  51. package/build/components/Pages/DepositCex/index.js.map +1 -1
  52. package/build/components/Pages/DepositWallet/DepositWalletDesktop.d.ts +4 -1
  53. package/build/components/Pages/DepositWallet/DepositWalletDesktop.js +11 -20
  54. package/build/components/Pages/DepositWallet/DepositWalletDesktop.js.map +1 -1
  55. package/build/components/Pages/DepositWallet/index.d.ts +5 -5
  56. package/build/components/Pages/DepositWallet/index.js +36 -31
  57. package/build/components/Pages/DepositWallet/index.js.map +1 -1
  58. package/build/components/Pages/DepositWallet/walletDeeplinks.d.ts +6 -4
  59. package/build/components/Pages/DepositWallet/walletDeeplinks.js +3 -1
  60. package/build/components/Pages/DepositWallet/walletDeeplinks.js.map +1 -1
  61. package/build/components/Pages/SelectToken/SolanaSelectToken.d.ts +1 -0
  62. package/build/components/Pages/SelectToken/SolanaSelectToken.js +50 -0
  63. package/build/components/Pages/SelectToken/SolanaSelectToken.js.map +1 -0
  64. package/build/components/Pages/SelectToken/index.js +13 -2
  65. package/build/components/Pages/SelectToken/index.js.map +1 -1
  66. package/build/components/Pages/Send/SolanaSend.js +32 -31
  67. package/build/components/Pages/Send/SolanaSend.js.map +1 -1
  68. package/build/components/Pages/Send/utils.js +4 -1
  69. package/build/components/Pages/Send/utils.js.map +1 -1
  70. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js +57 -13
  71. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js.map +1 -1
  72. package/build/components/Pages/SendConfirmation/styles.d.ts +0 -5
  73. package/build/components/Pages/SendConfirmation/styles.js +1 -39
  74. package/build/components/Pages/SendConfirmation/styles.js.map +1 -1
  75. package/build/hooks/openfort/useFunding.js +7 -7
  76. package/build/hooks/openfort/useFundingChains.js +4 -6
  77. package/build/hooks/openfort/useFundingChains.js.map +1 -1
  78. package/build/shared/hooks/useAsyncData.js +15 -2
  79. package/build/shared/hooks/useAsyncData.js.map +1 -1
  80. package/build/solana/transfer.d.ts +35 -6
  81. package/build/solana/transfer.js +112 -18
  82. package/build/solana/transfer.js.map +1 -1
  83. package/build/solana/types.d.ts +8 -0
  84. package/build/version.d.ts +1 -1
  85. package/build/version.js +1 -1
  86. package/package.json +5 -1
@@ -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;
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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, {}),
@@ -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 openfort-funding backend (e.g. `https://funding.openfort.io`).
303
- * Powers the Deposit hub's crypto/CEX rails (session API). When omitted, those
304
- * rails are unavailable and the network layer is a no-op.
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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
- chainId: number;
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, chainId, publishableKey, ...rest } = params;
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: getNetworkName(chainId),
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 { data: assets } = useEthereumWalletAssets();
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
- chainId: number;
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
- // Map chain IDs to 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';
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, chainId, publishableKey, sourceCurrency, sourceAmount } = params;
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: getNetworkName(chainId),
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":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -21,7 +21,7 @@ export declare const isStripeSupported: (token: Asset) => boolean;
21
21
  */
22
22
  export declare const createStripeSession: (params: Omit<CreateStripeSessionParams, "destinationCurrency" | "destinationNetwork"> & {
23
23
  token: Asset;
24
- chainId: number;
24
+ network: string;
25
25
  publishableKey: string;
26
26
  }) => Promise<StripeOnrampResponse>;
27
27
  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 Stripe 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
  // Stripe supported currencies
20
9
  const STRIPE_SUPPORTED_CURRENCIES = ['btc', 'eth', 'xlm', 'matic', 'pol', 'sol', 'usdc', 'avax', 'wld'];
21
10
  // Check if a token is supported by Stripe
@@ -38,12 +27,12 @@ const getCurrencyCode = (token) => {
38
27
  * Calls backend API to create a prefilled session with wallet addresses and amounts
39
28
  */
40
29
  const createStripeSession = async (params) => {
41
- const { token, chainId, publishableKey, destinationAddress, sourceAmount, sourceCurrency, redirectUrl } = params;
30
+ const { token, network, publishableKey, destinationAddress, sourceAmount, sourceCurrency, redirectUrl } = params;
42
31
  if (!publishableKey) {
43
32
  throw new Error('Publishable key is required for authentication');
44
33
  }
45
34
  const destinationCurrency = getCurrencyCode(token);
46
- const destinationNetwork = getNetworkName(chainId);
35
+ const destinationNetwork = network;
47
36
  // Build request body for backend API
48
37
  const requestBody = {
49
38
  provider: 'stripe',
@@ -1 +1 @@
1
- {"version":3,"file":"stripeApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"stripeApi.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -39,7 +39,13 @@ const BuyComplete = () => {
39
39
  const handleBack = () => {
40
40
  setRoute(routes.CONNECTED);
41
41
  };
42
- const blockExplorerUrl = address && chainId ? getExplorerUrl(ChainTypeEnum.EVM, { chainId, address }) : '';
42
+ const blockExplorerUrl = !address
43
+ ? ''
44
+ : chainType === ChainTypeEnum.SVM
45
+ ? getExplorerUrl(ChainTypeEnum.SVM, { address, cluster: solanaWallet.cluster })
46
+ : chainId
47
+ ? getExplorerUrl(ChainTypeEnum.EVM, { chainId, address })
48
+ : '';
43
49
  return (jsx(PageContent, { onBack: handleBack, children: jsxs(ModalContent, { style: { paddingBottom: 18, textAlign: 'center' }, children: [jsx(ModalH1, { children: "Provider Finished" }), jsx(ModalBody, { style: { marginTop: 24 }, children: "The provider flow has been completed. You can view your wallet on the block explorer to check your transactions." }), jsxs(Section, { style: { marginTop: 24 }, children: [blockExplorerUrl && (jsx(ContinueButtonWrapper, { style: { marginTop: 0 }, children: jsx(Button, { variant: "secondary", onClick: () => window.open(blockExplorerUrl, '_blank', 'noopener,noreferrer'), children: jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [jsx("span", { children: "View Wallet Transactions" }), jsx(ExternalLinkIcon, {})] }) }) })), jsx(ContinueButtonWrapper, { style: { marginTop: blockExplorerUrl ? 4 : 0 }, children: jsx(Button, { variant: "primary", onClick: handleDone, children: "Done" }) })] })] }) }));
44
50
  };
45
51
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -13,6 +13,8 @@ import { routes } from '../../Openfort/types.js';
13
13
  import { useOpenfort } from '../../Openfort/useOpenfort.js';
14
14
  import { PageContent } from '../../PageContent/index.js';
15
15
  import { createCoinbaseSession } from '../Buy/coinbaseApi.js';
16
+ import { resolveOnrampNetwork } from '../Buy/onrampApi.js';
17
+ import { SOLANA_BUY_CURRENCIES } from '../Buy/solanaCurrencies.js';
16
18
  import { createStripeSession } from '../Buy/stripeApi.js';
17
19
  import { ContinueButtonWrapper, PendingContainer, StackedButtonWrapper } from '../Buy/styles.js';
18
20
  import { isSameToken } from '../Send/utils.js';
@@ -27,11 +29,13 @@ const BuyProcessing = () => {
27
29
  const isConnected = wallet.status === 'connected';
28
30
  const address = isConnected ? wallet.address : undefined;
29
31
  const chainId = isConnected && chainType === ChainTypeEnum.EVM ? wallet.chainId : undefined;
32
+ const network = resolveOnrampNetwork(chainType, chainId);
30
33
  const [popupWindow, setPopupWindow] = useState(null);
31
34
  const [showContinueButton, setShowContinueButton] = useState(false);
32
35
  const [isCreatingSession, setIsCreatingSession] = useState(true);
33
36
  const [sessionError, setSessionError] = useState(false);
34
- const { data: assets } = useEthereumWalletAssets();
37
+ const { data: ethAssets } = useEthereumWalletAssets();
38
+ const assets = chainType === ChainTypeEnum.SVM ? SOLANA_BUY_CURRENCIES : ethAssets;
35
39
  const matchedToken = useMemo(() => assets === null || assets === void 0 ? void 0 : assets.find((asset) => isSameToken(asset, buyForm.asset)), [assets, buyForm.asset]);
36
40
  const selectedTokenOption = matchedToken !== null && matchedToken !== void 0 ? matchedToken : assets === null || assets === void 0 ? void 0 : assets[0];
37
41
  const selectedToken = selectedTokenOption !== null && selectedTokenOption !== void 0 ? selectedTokenOption : buyForm.asset;
@@ -47,7 +51,7 @@ const BuyProcessing = () => {
47
51
  // Create session and open popup once wallet is ready
48
52
  const sessionStartedRef = useRef(false);
49
53
  useEffect(() => {
50
- if (!address || !chainId)
54
+ if (!address || !network)
51
55
  return;
52
56
  if (sessionStartedRef.current)
53
57
  return;
@@ -65,7 +69,7 @@ const BuyProcessing = () => {
65
69
  if (buyForm.providerId === 'coinbase') {
66
70
  const session = await createCoinbaseSession({
67
71
  token: selectedToken,
68
- chainId,
72
+ network,
69
73
  publishableKey,
70
74
  destinationAddress: address,
71
75
  sourceAmount: fiatAmount.toFixed(2),
@@ -77,7 +81,7 @@ const BuyProcessing = () => {
77
81
  else if (buyForm.providerId === 'stripe') {
78
82
  const session = await createStripeSession({
79
83
  token: selectedToken,
80
- chainId,
84
+ network,
81
85
  publishableKey,
82
86
  destinationAddress: address,
83
87
  sourceAmount: fiatAmount.toFixed(2),
@@ -129,7 +133,7 @@ const BuyProcessing = () => {
129
133
  }
130
134
  };
131
135
  createSessionAndOpenPopup();
132
- }, [address, chainId]); // Run when wallet becomes ready
136
+ }, [address, network]); // Run when wallet becomes ready
133
137
  // Trigger resize on mount and when state changes
134
138
  useEffect(() => {
135
139
  triggerResize();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}