@openfort/react 1.6.0 → 1.6.1

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 (48) hide show
  1. package/build/components/Common/Modal/index.js +14 -0
  2. package/build/components/Common/Modal/index.js.map +1 -1
  3. package/build/components/Openfort/types.d.ts +1 -1
  4. package/build/components/Pages/AssetInventory/SolanaAssetInventory.js +7 -7
  5. package/build/components/Pages/DepositWallet/index.js +15 -10
  6. package/build/components/Pages/DepositWallet/index.js.map +1 -1
  7. package/build/components/Pages/ExportKey/index.js +44 -4
  8. package/build/components/Pages/ExportKey/index.js.map +1 -1
  9. package/build/components/Pages/ExportKey/styles.d.ts +5 -0
  10. package/build/components/Pages/ExportKey/styles.js +47 -0
  11. package/build/components/Pages/ExportKey/styles.js.map +1 -0
  12. package/build/components/Pages/Receive/index.js +2 -2
  13. package/build/components/Pages/SelectToken/SolanaSelectToken.js +7 -7
  14. package/build/components/Pages/SelectToken/index.js +7 -3
  15. package/build/components/Pages/SelectToken/index.js.map +1 -1
  16. package/build/components/Pages/Send/EthereumSend.js +25 -5
  17. package/build/components/Pages/Send/EthereumSend.js.map +1 -1
  18. package/build/components/Pages/Send/SolanaSend.js +23 -4
  19. package/build/components/Pages/Send/SolanaSend.js.map +1 -1
  20. package/build/components/Pages/Send/styles.d.ts +17 -11
  21. package/build/components/Pages/Send/styles.js +104 -49
  22. package/build/components/Pages/Send/styles.js.map +1 -1
  23. package/build/components/Pages/SendConfirmation/ConfirmationSummary.d.ts +3 -1
  24. package/build/components/Pages/SendConfirmation/ConfirmationSummary.js +2 -2
  25. package/build/components/Pages/SendConfirmation/EstimatedFees.d.ts +3 -1
  26. package/build/components/Pages/SendConfirmation/EstimatedFees.js +22 -15
  27. package/build/components/Pages/SendConfirmation/EstimatedFees.js.map +1 -1
  28. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js +17 -5
  29. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js.map +1 -1
  30. package/build/components/Pages/SendConfirmation/index.js +11 -5
  31. package/build/components/Pages/SendConfirmation/index.js.map +1 -1
  32. package/build/components/Pages/SendConfirmation/styles.d.ts +3 -1
  33. package/build/components/Pages/SendConfirmation/styles.js +20 -6
  34. package/build/components/Pages/SendConfirmation/styles.js.map +1 -1
  35. package/build/components/Pages/SignMessage/index.js +44 -19
  36. package/build/components/Pages/SignMessage/index.js.map +1 -1
  37. package/build/components/Pages/SignMessage/styles.d.ts +2 -3
  38. package/build/components/Pages/SignMessage/styles.js +19 -2
  39. package/build/components/Pages/SignMessage/styles.js.map +1 -1
  40. package/build/hooks/openfort/useSignMessage.d.ts +2 -2
  41. package/build/hooks/openfort/useUI.js +4 -2
  42. package/build/hooks/openfort/useUI.js.map +1 -1
  43. package/build/solana/transfer.d.ts +12 -0
  44. package/build/solana/transfer.js +29 -1
  45. package/build/solana/transfer.js.map +1 -1
  46. package/build/version.d.ts +1 -1
  47. package/build/version.js +1 -1
  48. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,8 +1,7 @@
1
1
  export declare const SignContent: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  export declare const Subtitle: import("styled-components").StyledComponent<"p", any, {}, never>;
3
- export declare const MessageBox: import("styled-components").StyledComponent<"div", any, {
4
- $scroll?: boolean;
5
- }, never>;
3
+ export declare const MessageBox: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const Footer: import("styled-components").StyledComponent<"div", any, {}, never>;
6
5
  export declare const DataList: import("styled-components").StyledComponent<"ul", any, {}, never>;
7
6
  export declare const DataItem: import("styled-components").StyledComponent<"li", any, {}, never>;
8
7
  export declare const DataKey: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -4,8 +4,15 @@ const SignContent = styled.div `
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  gap: 16px;
7
+ min-height: 0;
8
+ /* Cap to the modal viewport (InnerContainer caps at 88vh) so the message body
9
+ is the only part that scrolls and the Sign button stays pinned and reachable
10
+ on small screens. 112px ≈ PageContent top padding + PageContents padding,
11
+ mirroring DepositWallet's Layout. */
12
+ max-height: calc(88vh - 112px);
7
13
  `;
8
14
  const Subtitle = styled.p `
15
+ flex-shrink: 0;
9
16
  margin: 0;
10
17
  text-align: center;
11
18
  font-size: 15px;
@@ -13,6 +20,11 @@ const Subtitle = styled.p `
13
20
  color: var(--ck-body-color-muted, #999);
14
21
  `;
15
22
  const MessageBox = styled.div `
23
+ flex: 1 1 auto;
24
+ min-height: 0;
25
+ overflow-y: auto;
26
+ -webkit-overflow-scrolling: touch;
27
+ overscroll-behavior: contain;
16
28
  padding: 16px;
17
29
  border-radius: 12px;
18
30
  background: var(--ck-body-background-secondary, rgba(0, 0, 0, 0.04));
@@ -22,7 +34,12 @@ const MessageBox = styled.div `
22
34
  text-align: left;
23
35
  word-break: break-word;
24
36
  white-space: pre-wrap;
25
- ${({ $scroll }) => $scroll && 'max-height: 320px; overflow-y: auto;'}
37
+ `;
38
+ const Footer = styled.div `
39
+ flex-shrink: 0;
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: 12px;
26
43
  `;
27
44
  const DataList = styled.ul `
28
45
  margin: 0;
@@ -78,5 +95,5 @@ const SignaturePreview = styled.code `
78
95
  text-align: center;
79
96
  `;
80
97
 
81
- export { CopyRow, DataItem, DataKey, DataList, ErrorText, MessageBox, SignContent, SignaturePreview, Subtitle, SuccessCircle, SuccessTitle, SuccessWrap };
98
+ export { CopyRow, DataItem, DataKey, DataList, ErrorText, Footer, MessageBox, SignContent, SignaturePreview, Subtitle, SuccessCircle, SuccessTitle, SuccessWrap };
82
99
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -21,7 +21,7 @@ import { type SignTypedDataPayload } from '../../components/Openfort/types';
21
21
  * ```
22
22
  */
23
23
  export declare function useSignMessage(): {
24
- signMessage: (message: string) => Promise<`0x${string}`>;
25
- signTypedData: (typedData: SignTypedDataPayload) => Promise<`0x${string}`>;
24
+ signMessage: (message: string) => Promise<string>;
25
+ signTypedData: (typedData: SignTypedDataPayload) => Promise<string>;
26
26
  isPending: boolean;
27
27
  };
@@ -22,7 +22,9 @@ const safeRoutes = {
22
22
  routes.PROVIDERS,
23
23
  routes.PROFILE,
24
24
  routes.SEND,
25
+ routes.SOL_SEND,
25
26
  routes.RECEIVE,
27
+ routes.SOL_RECEIVE,
26
28
  routes.DEPOSIT,
27
29
  routes.BUY,
28
30
  routes.EXPORT_KEY,
@@ -133,8 +135,8 @@ function useUI() {
133
135
  openSwitchNetworks: () => gotoAndOpen(routes.ETH_SWITCH_NETWORK),
134
136
  openProviders: () => gotoAndOpen(routes.PROVIDERS),
135
137
  openWallets: () => gotoAndOpen({ route: routes.CONNECTORS, connectType: 'linkIfUserConnectIfNoUser' }),
136
- openSend: (tx) => tx ? openSendPreview(tx) : gotoAndOpen(routes.SEND),
137
- openReceive: () => gotoAndOpen(routes.RECEIVE),
138
+ openSend: (tx) => tx ? openSendPreview(tx) : gotoAndOpen(chainType === ChainTypeEnum.SVM ? routes.SOL_SEND : routes.SEND),
139
+ openReceive: () => gotoAndOpen(chainType === ChainTypeEnum.SVM ? routes.SOL_RECEIVE : routes.RECEIVE),
138
140
  openFunding: () => gotoAndOpen(routes.DEPOSIT),
139
141
  openBuy: () => gotoAndOpen(routes.BUY),
140
142
  openExportKey: () => gotoAndOpen(routes.EXPORT_KEY),
@@ -1 +1 @@
1
- {"version":3,"file":"useUI.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"useUI.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -58,4 +58,16 @@ type SendSplTokenGaslessParams = {
58
58
  };
59
59
  /** Send an SPL token transfer with fees sponsored by the Openfort paymaster (Kora). */
60
60
  export declare function sendSplTokenGasless({ from, to, mint, amount, provider, cluster, publishableKey, }: SendSplTokenGaslessParams): Promise<string>;
61
+ /**
62
+ * Read the network fee (in lamports) for a single-signer transfer from the RPC
63
+ * via `getFeeForMessage`. Returns null on any failure so callers can fall back to
64
+ * a neutral "--" rather than a fabricated number. The base fee is per-signature
65
+ * and identical for native and SPL transfers (a single fee-payer signature), so a
66
+ * representative SOL transfer message is enough to price it.
67
+ */
68
+ export declare function estimateSolanaTransferFeeLamports({ from, to, rpcUrl, }: {
69
+ from: string;
70
+ to: string;
71
+ rpcUrl: string;
72
+ }): Promise<bigint | null>;
61
73
  export {};
@@ -214,6 +214,34 @@ async function sendSplTokenGasless({ from, to, mint, amount, provider, cluster,
214
214
  publishableKey,
215
215
  });
216
216
  }
217
+ /**
218
+ * Read the network fee (in lamports) for a single-signer transfer from the RPC
219
+ * via `getFeeForMessage`. Returns null on any failure so callers can fall back to
220
+ * a neutral "--" rather than a fabricated number. The base fee is per-signature
221
+ * and identical for native and SPL transfers (a single fee-payer signature), so a
222
+ * representative SOL transfer message is enough to price it.
223
+ */
224
+ async function estimateSolanaTransferFeeLamports({ from, to, rpcUrl, }) {
225
+ try {
226
+ const kit = await import('@solana/kit');
227
+ const { getTransferSolInstruction } = await import('@solana-program/system');
228
+ const fromAddress = kit.address(from);
229
+ const rpc = kit.createSolanaRpc(rpcUrl);
230
+ const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
231
+ const message = kit.pipe(kit.createTransactionMessage({ version: 0 }), (tx) => kit.setTransactionMessageFeePayer(fromAddress, tx), (tx) => kit.setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), (tx) => kit.appendTransactionMessageInstruction(getTransferSolInstruction({
232
+ source: kit.createNoopSigner(fromAddress),
233
+ destination: kit.address(to),
234
+ amount: kit.lamports(BigInt(1)),
235
+ }), tx));
236
+ const compiled = kit.compileTransactionMessage(message);
237
+ const base64Message = kit.getBase64Decoder().decode(kit.getCompiledTransactionMessageEncoder().encode(compiled));
238
+ const { value } = await rpc.getFeeForMessage(base64Message).send();
239
+ return value == null ? null : BigInt(value);
240
+ }
241
+ catch {
242
+ return null;
243
+ }
244
+ }
217
245
 
218
- export { sendSol, sendSolGasless, sendSplToken, sendSplTokenGasless };
246
+ export { estimateSolanaTransferFeeLamports, sendSol, sendSolGasless, sendSplToken, sendSplTokenGasless };
219
247
  //# sourceMappingURL=transfer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transfer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"transfer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- export declare const OPENFORT_VERSION = "1.6.0";
1
+ export declare const OPENFORT_VERSION = "1.6.1";
package/build/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const OPENFORT_VERSION = '1.6.0';
1
+ const OPENFORT_VERSION = '1.6.1';
2
2
 
3
3
  export { OPENFORT_VERSION };
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/react",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "author": "Openfort (https://www.openfort.io)",
5
5
  "license": "BSD-2-Clause license",
6
6
  "description": "The easiest way to integrate Openfort to your project.",