@openfort/react 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/build/assets/icons.js +1 -1
  2. package/build/assets/logos.d.ts +12 -0
  3. package/build/assets/logos.js +7 -0
  4. package/build/assets/logos.js.map +1 -1
  5. package/build/components/Common/CopyToClipboard/CopyIconButton.d.ts +3 -1
  6. package/build/components/Common/CopyToClipboard/CopyIconButton.js +4 -4
  7. package/build/components/Common/CustomQRCode/index.d.ts +1 -1
  8. package/build/components/Common/CustomQRCode/index.js +3 -3
  9. package/build/components/Common/CustomQRCode/styles.d.ts +1 -0
  10. package/build/components/Common/CustomQRCode/styles.js +4 -4
  11. package/build/components/Common/CustomQRCode/types.d.ts +2 -0
  12. package/build/components/Common/Modal/styles.js +4 -1
  13. package/build/components/Common/Modal/styles.js.map +1 -1
  14. package/build/components/ConnectModal/index.js +14 -2
  15. package/build/components/ConnectModal/index.js.map +1 -1
  16. package/build/components/Openfort/OpenfortProvider.js +4 -1
  17. package/build/components/Openfort/OpenfortProvider.js.map +1 -1
  18. package/build/components/Openfort/types.d.ts +86 -0
  19. package/build/components/Openfort/types.js +22 -1
  20. package/build/components/Openfort/types.js.map +1 -1
  21. package/build/components/Pages/AssetInventory/SolanaAssetInventory.d.ts +6 -0
  22. package/build/components/Pages/AssetInventory/SolanaAssetInventory.js +42 -0
  23. package/build/components/Pages/AssetInventory/SolanaAssetInventory.js.map +1 -0
  24. package/build/components/Pages/Buy/index.js +3 -2
  25. package/build/components/Pages/Buy/index.js.map +1 -1
  26. package/build/components/Pages/BuySelectProvider/index.js +1 -1
  27. package/build/components/Pages/Connected/EthereumConnected.js +8 -32
  28. package/build/components/Pages/Connected/EthereumConnected.js.map +1 -1
  29. package/build/components/Pages/Connected/SolanaConnected.js +9 -4
  30. package/build/components/Pages/Connected/SolanaConnected.js.map +1 -1
  31. package/build/components/Pages/Deposit/AddressPageLink.d.ts +7 -0
  32. package/build/components/Pages/Deposit/AddressPageLink.js +17 -0
  33. package/build/components/Pages/Deposit/AddressPageLink.js.map +1 -0
  34. package/build/components/Pages/Deposit/AssetChainLogo.d.ts +9 -0
  35. package/build/components/Pages/Deposit/AssetChainLogo.js +24 -0
  36. package/build/components/Pages/Deposit/AssetChainLogo.js.map +1 -0
  37. package/build/components/Pages/Deposit/DepositAddressBlock.d.ts +21 -0
  38. package/build/components/Pages/Deposit/DepositAddressBlock.js +28 -0
  39. package/build/components/Pages/Deposit/DepositAddressBlock.js.map +1 -0
  40. package/build/components/Pages/Deposit/DepositProgress.d.ts +15 -0
  41. package/build/components/Pages/Deposit/DepositProgress.js +110 -0
  42. package/build/components/Pages/Deposit/DepositProgress.js.map +1 -0
  43. package/build/components/Pages/Deposit/DepositStatus.d.ts +9 -0
  44. package/build/components/Pages/Deposit/DepositStatus.js +43 -0
  45. package/build/components/Pages/Deposit/DepositStatus.js.map +1 -0
  46. package/build/components/Pages/Deposit/DepositSuccess.d.ts +6 -0
  47. package/build/components/Pages/Deposit/DepositSuccess.js +24 -0
  48. package/build/components/Pages/Deposit/DepositSuccess.js.map +1 -0
  49. package/build/components/Pages/Deposit/Details.d.ts +12 -0
  50. package/build/components/Pages/Deposit/Details.js +40 -0
  51. package/build/components/Pages/Deposit/Details.js.map +1 -0
  52. package/build/components/Pages/Deposit/LogoSelect.d.ts +12 -0
  53. package/build/components/Pages/Deposit/LogoSelect.js +95 -0
  54. package/build/components/Pages/Deposit/LogoSelect.js.map +1 -0
  55. package/build/components/Pages/Deposit/OrDivider.d.ts +2 -0
  56. package/build/components/Pages/Deposit/OrDivider.js +10 -0
  57. package/build/components/Pages/Deposit/OrDivider.js.map +1 -0
  58. package/build/components/Pages/Deposit/RouteSelectors.d.ts +13 -0
  59. package/build/components/Pages/Deposit/RouteSelectors.js +19 -0
  60. package/build/components/Pages/Deposit/RouteSelectors.js.map +1 -0
  61. package/build/components/Pages/Deposit/cexChains.d.ts +9 -0
  62. package/build/components/Pages/Deposit/cexChains.js +23 -0
  63. package/build/components/Pages/Deposit/cexChains.js.map +1 -0
  64. package/build/components/Pages/Deposit/formStyles.d.ts +24 -0
  65. package/build/components/Pages/Deposit/formStyles.js +83 -0
  66. package/build/components/Pages/Deposit/formStyles.js.map +1 -0
  67. package/build/components/Pages/Deposit/index.d.ts +7 -0
  68. package/build/components/Pages/Deposit/index.js +100 -0
  69. package/build/components/Pages/Deposit/index.js.map +1 -0
  70. package/build/components/Pages/Deposit/paymentOptions.d.ts +49 -0
  71. package/build/components/Pages/Deposit/paymentOptions.js +63 -0
  72. package/build/components/Pages/Deposit/paymentOptions.js.map +1 -0
  73. package/build/components/Pages/Deposit/sources.d.ts +17 -0
  74. package/build/components/Pages/Deposit/sources.js +22 -0
  75. package/build/components/Pages/Deposit/sources.js.map +1 -0
  76. package/build/components/Pages/Deposit/styles.d.ts +25 -0
  77. package/build/components/Pages/Deposit/styles.js +167 -0
  78. package/build/components/Pages/Deposit/styles.js.map +1 -0
  79. package/build/components/Pages/Deposit/useDepositRoute.d.ts +35 -0
  80. package/build/components/Pages/Deposit/useDepositRoute.js +107 -0
  81. package/build/components/Pages/Deposit/useDepositRoute.js.map +1 -0
  82. package/build/components/Pages/Deposit/useFundingTarget.d.ts +13 -0
  83. package/build/components/Pages/Deposit/useFundingTarget.js +27 -0
  84. package/build/components/Pages/Deposit/useFundingTarget.js.map +1 -0
  85. package/build/components/Pages/DepositCex/index.d.ts +11 -0
  86. package/build/components/Pages/DepositCex/index.js +230 -0
  87. package/build/components/Pages/DepositCex/index.js.map +1 -0
  88. package/build/components/Pages/DepositCrypto/index.d.ts +8 -0
  89. package/build/components/Pages/DepositCrypto/index.js +31 -0
  90. package/build/components/Pages/DepositCrypto/index.js.map +1 -0
  91. package/build/components/Pages/DepositWallet/DepositWalletDesktop.d.ts +17 -0
  92. package/build/components/Pages/DepositWallet/DepositWalletDesktop.js +148 -0
  93. package/build/components/Pages/DepositWallet/DepositWalletDesktop.js.map +1 -0
  94. package/build/components/Pages/DepositWallet/index.d.ts +9 -0
  95. package/build/components/Pages/DepositWallet/index.js +102 -0
  96. package/build/components/Pages/DepositWallet/index.js.map +1 -0
  97. package/build/components/Pages/DepositWallet/walletDeeplinks.d.ts +48 -0
  98. package/build/components/Pages/DepositWallet/walletDeeplinks.js +107 -0
  99. package/build/components/Pages/DepositWallet/walletDeeplinks.js.map +1 -0
  100. package/build/components/Pages/ExportKey/index.js +10 -2
  101. package/build/components/Pages/ExportKey/index.js.map +1 -1
  102. package/build/components/Pages/NoAssetsAvailable/index.js +5 -21
  103. package/build/components/Pages/NoAssetsAvailable/index.js.map +1 -1
  104. package/build/components/Pages/SelectToken/styles.js +1 -1
  105. package/build/components/Pages/Send/SolanaSend.d.ts +1 -0
  106. package/build/components/Pages/Send/SolanaSend.js +88 -0
  107. package/build/components/Pages/Send/SolanaSend.js.map +1 -0
  108. package/build/components/Pages/Send/index.d.ts +2 -1
  109. package/build/components/Pages/Send/index.js +0 -1
  110. package/build/components/Pages/Send/index.js.map +1 -1
  111. package/build/components/Pages/SendConfirmation/EstimatedFees.js +5 -3
  112. package/build/components/Pages/SendConfirmation/EstimatedFees.js.map +1 -1
  113. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.d.ts +1 -0
  114. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js +77 -0
  115. package/build/components/Pages/SendConfirmation/SolanaSendConfirmation.js.map +1 -0
  116. package/build/components/Pages/SendConfirmation/index.js +4 -3
  117. package/build/components/Pages/SendConfirmation/index.js.map +1 -1
  118. package/build/components/Pages/SendConfirmation/styles.d.ts +5 -0
  119. package/build/components/Pages/SendConfirmation/styles.js +39 -1
  120. package/build/components/Pages/SendConfirmation/styles.js.map +1 -1
  121. package/build/constants/logos.js +1 -0
  122. package/build/constants/logos.js.map +1 -1
  123. package/build/ethereum/hooks/useEthereumWalletAssets.js +212 -95
  124. package/build/ethereum/hooks/useEthereumWalletAssets.js.map +1 -1
  125. package/build/hooks/openfort/fundingClient.d.ts +34 -0
  126. package/build/hooks/openfort/fundingClient.js +60 -0
  127. package/build/hooks/openfort/fundingClient.js.map +1 -0
  128. package/build/hooks/openfort/useFunding.d.ts +159 -0
  129. package/build/hooks/openfort/useFunding.js +204 -0
  130. package/build/hooks/openfort/useFunding.js.map +1 -0
  131. package/build/hooks/openfort/useFundingChains.d.ts +49 -0
  132. package/build/hooks/openfort/useFundingChains.js +102 -0
  133. package/build/hooks/openfort/useFundingChains.js.map +1 -0
  134. package/build/hooks/useBalance.js +6 -1
  135. package/build/hooks/useBalance.js.map +1 -1
  136. package/build/index.d.ts +4 -1
  137. package/build/index.js +2 -1
  138. package/build/index.js.map +1 -1
  139. package/build/shared/hooks/useAsyncData.d.ts +11 -0
  140. package/build/shared/hooks/useAsyncData.js +60 -13
  141. package/build/shared/hooks/useAsyncData.js.map +1 -1
  142. package/build/solana/hooks/useSolanaWalletAssets.d.ts +24 -0
  143. package/build/solana/hooks/useSolanaWalletAssets.js +86 -0
  144. package/build/solana/hooks/useSolanaWalletAssets.js.map +1 -0
  145. package/build/solana/transfer.d.ts +32 -0
  146. package/build/solana/transfer.js +125 -0
  147. package/build/solana/transfer.js.map +1 -0
  148. package/build/utils/index.d.ts +2 -1
  149. package/build/utils/index.js +1 -1
  150. package/build/version.d.ts +1 -1
  151. package/build/version.js +1 -1
  152. package/build/wagmi/defaultConnectors.js +5 -1
  153. package/build/wagmi/defaultConnectors.js.map +1 -1
  154. package/package.json +10 -2
@@ -0,0 +1,86 @@
1
+ import { useEffect } from 'react';
2
+ import { BALANCE_INVALIDATE_EVENT } from '../../hooks/useBalance.js';
3
+ import { useAsyncData } from '../../shared/hooks/useAsyncData.js';
4
+ import { useSolanaContext } from '../SolanaContext.js';
5
+ import { useSolanaEmbeddedWallet } from './useSolanaEmbeddedWallet.js';
6
+
7
+ /** SPL Token + Token-2022 program ids — token accounts live under one of these. */
8
+ const TOKEN_PROGRAMS = ['TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA', 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'];
9
+ /**
10
+ * Known SPL mints → display metadata. An SPL token account carries only the mint
11
+ * and amount on-chain (no symbol/name), so common mints are mapped here; unknown
12
+ * mints fall back to a truncated mint address.
13
+ */
14
+ const KNOWN_MINTS = {
15
+ EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v: { symbol: 'USDC', name: 'USD Coin' },
16
+ Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB: { symbol: 'USDT', name: 'Tether USD' },
17
+ // Circle's devnet USDC mint (same UI label).
18
+ '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU': { symbol: 'USDC', name: 'USD Coin' },
19
+ };
20
+ async function fetchSolanaAssets(addressStr, rpcUrl) {
21
+ var _a, _b;
22
+ const { address, createSolanaRpc } = await import('@solana/kit');
23
+ const rpc = createSolanaRpc(rpcUrl);
24
+ const owner = address(addressStr);
25
+ const out = [];
26
+ // Native SOL — always listed (even at zero) so it anchors the view.
27
+ const { value: lamports } = await rpc.getBalance(owner, { commitment: 'confirmed' }).send();
28
+ out.push({ mint: 'native', symbol: 'SOL', name: 'Solana', amount: BigInt(lamports), decimals: 9, isNative: true });
29
+ // SPL token balances across both token programs. The jsonParsed encoding yields
30
+ // a typed account whose `data.parsed.info` carries the mint and token amount.
31
+ for (const program of TOKEN_PROGRAMS) {
32
+ try {
33
+ const { value: accounts } = await rpc
34
+ .getTokenAccountsByOwner(owner, { programId: address(program) }, { encoding: 'jsonParsed', commitment: 'confirmed' })
35
+ .send();
36
+ for (const acc of accounts) {
37
+ const info = acc.account.data.parsed.info;
38
+ const amount = BigInt(info.tokenAmount.amount);
39
+ if (amount === BigInt(0))
40
+ continue;
41
+ const mint = info.mint;
42
+ const known = KNOWN_MINTS[mint];
43
+ out.push({
44
+ mint,
45
+ symbol: (_a = known === null || known === void 0 ? void 0 : known.symbol) !== null && _a !== void 0 ? _a : `${mint.slice(0, 4)}…${mint.slice(-4)}`,
46
+ name: (_b = known === null || known === void 0 ? void 0 : known.name) !== null && _b !== void 0 ? _b : 'SPL Token',
47
+ amount,
48
+ decimals: info.tokenAmount.decimals,
49
+ isNative: false,
50
+ });
51
+ }
52
+ }
53
+ catch {
54
+ // Program absent or RPC hiccup — skip this program, keep what we have.
55
+ }
56
+ }
57
+ return out;
58
+ }
59
+ /**
60
+ * Returns the connected Solana wallet's balances: native SOL plus SPL token
61
+ * holdings, read directly from the cluster RPC. The SVM counterpart of
62
+ * {@link useEthereumWalletAssets}, feeding the Solana asset inventory. Refreshes
63
+ * on BALANCE_INVALIDATE_EVENT (e.g. after a deposit/send).
64
+ */
65
+ function useSolanaWalletAssets() {
66
+ const wallet = useSolanaEmbeddedWallet();
67
+ const { rpcUrl } = useSolanaContext();
68
+ const address = wallet.status === 'connected' && wallet.address ? wallet.address : undefined;
69
+ const { data, error, isLoading, refetch } = useAsyncData({
70
+ queryKey: ['solana-assets', address, rpcUrl],
71
+ queryFn: () => (address && rpcUrl ? fetchSolanaAssets(address, rpcUrl) : Promise.resolve([])),
72
+ enabled: Boolean(address && rpcUrl),
73
+ staleTime: 30000,
74
+ });
75
+ useEffect(() => {
76
+ if (!address)
77
+ return;
78
+ const handler = () => refetch().catch(() => { });
79
+ window.addEventListener(BALANCE_INVALIDATE_EVENT, handler);
80
+ return () => window.removeEventListener(BALANCE_INVALIDATE_EVENT, handler);
81
+ }, [address, refetch]);
82
+ return { data: data !== null && data !== void 0 ? data : null, isLoading, isError: Boolean(error), refetch };
83
+ }
84
+
85
+ export { useSolanaWalletAssets };
86
+ //# sourceMappingURL=useSolanaWalletAssets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSolanaWalletAssets.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,32 @@
1
+ import type { OpenfortEmbeddedSolanaWalletProvider, SolanaCluster } from './types';
2
+ type SendSolParams = {
3
+ from: string;
4
+ to: string;
5
+ amountSol: number;
6
+ provider: OpenfortEmbeddedSolanaWalletProvider;
7
+ rpcUrl: string;
8
+ commitment?: 'processed' | 'confirmed' | 'finalized';
9
+ };
10
+ /**
11
+ * Build, sign, and broadcast a native SOL transfer. Returns the transaction
12
+ * signature (base58). The wallet pays the network fee — use {@link sendSolGasless}
13
+ * to sponsor it.
14
+ */
15
+ export declare function sendSol({ from, to, amountSol, provider, rpcUrl, commitment, }: SendSolParams): Promise<string>;
16
+ type SendSolGaslessParams = {
17
+ from: string;
18
+ to: string;
19
+ amountSol: number;
20
+ provider: OpenfortEmbeddedSolanaWalletProvider;
21
+ cluster: SolanaCluster;
22
+ /** Project publishable key; sent to the Openfort Solana paymaster (Kora) as a Bearer token. */
23
+ publishableKey: string;
24
+ };
25
+ /**
26
+ * Send a native SOL transfer with fees sponsored by the Openfort Solana paymaster
27
+ * (Kora): Kora is the fee payer, the user signs their part with the embedded wallet,
28
+ * and Kora co-signs + broadcasts. Requires a `sponsorSolTransaction` policy on the
29
+ * project. Returns the transaction signature (base58).
30
+ */
31
+ export declare function sendSolGasless({ from, to, amountSol, provider, cluster, publishableKey, }: SendSolGaslessParams): Promise<string>;
32
+ export {};
@@ -0,0 +1,125 @@
1
+ /** The System program id — the "token" for a native SOL transfer through Kora. */
2
+ const SYSTEM_PROGRAM_ID = '11111111111111111111111111111111';
3
+ const SEND_TIMEOUT_MS = 60000;
4
+ /** Decimal SOL → lamports, without floating-point loss. */
5
+ function solToLamports(amountSol) {
6
+ const [whole, frac = ''] = amountSol.toString().split('.');
7
+ const padded = (frac + '0'.repeat(9)).slice(0, 9);
8
+ return BigInt(`${whole || '0'}${padded}`);
9
+ }
10
+ /** Ed25519 signatures are 64 bytes; trim a trailing recovery byte if one is present. */
11
+ function toEd25519Signature(raw) {
12
+ const trimmed = raw.length === 65 ? raw.slice(0, 64) : raw;
13
+ if (trimmed.length !== 64) {
14
+ throw new Error(`Invalid Ed25519 signature: expected 64 bytes, got ${trimmed.length}`);
15
+ }
16
+ return trimmed;
17
+ }
18
+ /** Solana confirmation needs a wss endpoint; public cluster RPCs serve one at the same host. */
19
+ function deriveWssUrl(rpcUrl) {
20
+ return rpcUrl.replace(/^https?:\/\//, 'wss://');
21
+ }
22
+ /**
23
+ * Build, sign, and broadcast a native SOL transfer. Returns the transaction
24
+ * signature (base58). The wallet pays the network fee — use {@link sendSolGasless}
25
+ * to sponsor it.
26
+ */
27
+ async function sendSol({ from, to, amountSol, provider, rpcUrl, commitment = 'confirmed', }) {
28
+ const kit = await import('@solana/kit');
29
+ const { getTransferSolInstruction } = await import('@solana-program/system');
30
+ const fromAddress = kit.address(from);
31
+ const rpc = kit.createSolanaRpc(rpcUrl);
32
+ const rpcSubscriptions = kit.createSolanaRpcSubscriptions(deriveWssUrl(rpcUrl));
33
+ const signer = {
34
+ address: fromAddress,
35
+ signTransactions: async (transactions) => Promise.all(transactions.map(async (transaction) => {
36
+ const { signature } = await provider.signTransaction({
37
+ messageBytes: new Uint8Array(transaction.messageBytes),
38
+ });
39
+ const bytes = toEd25519Signature(new Uint8Array(kit.getBase58Encoder().encode(signature)));
40
+ return Object.freeze({ [fromAddress]: bytes });
41
+ })),
42
+ };
43
+ const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
44
+ const message = kit.pipe(kit.createTransactionMessage({ version: 0 }), (tx) => kit.setTransactionMessageFeePayer(fromAddress, tx), (tx) => kit.setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx), (tx) => kit.appendTransactionMessageInstruction(getTransferSolInstruction({
45
+ source: signer,
46
+ destination: kit.address(to),
47
+ amount: kit.lamports(solToLamports(amountSol)),
48
+ }), tx));
49
+ const signedTransaction = await kit.signTransactionMessageWithSigners(message);
50
+ const sendAndConfirm = kit.sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });
51
+ const abortController = new AbortController();
52
+ const timeout = setTimeout(() => abortController.abort(), SEND_TIMEOUT_MS);
53
+ try {
54
+ await sendAndConfirm(signedTransaction, {
55
+ commitment,
56
+ abortSignal: abortController.signal,
57
+ });
58
+ }
59
+ finally {
60
+ clearTimeout(timeout);
61
+ }
62
+ return kit.getSignatureFromTransaction(signedTransaction);
63
+ }
64
+ /** The Openfort Solana paymaster (Kora) endpoint for a cluster. */
65
+ function koraRpcUrl(cluster) {
66
+ const segment = cluster === 'mainnet-beta' ? 'mainnet' : cluster;
67
+ return `https://api.openfort.io/rpc/solana/${segment}`;
68
+ }
69
+ /**
70
+ * Send a native SOL transfer with fees sponsored by the Openfort Solana paymaster
71
+ * (Kora): Kora is the fee payer, the user signs their part with the embedded wallet,
72
+ * and Kora co-signs + broadcasts. Requires a `sponsorSolTransaction` policy on the
73
+ * project. Returns the transaction signature (base58).
74
+ */
75
+ async function sendSolGasless({ from, to, amountSol, provider, cluster, publishableKey, }) {
76
+ const kit = await import('@solana/kit');
77
+ const { KoraClient } = await import('@solana/kora');
78
+ const client = new KoraClient({ rpcUrl: koraRpcUrl(cluster), apiKey: `Bearer ${publishableKey}` });
79
+ // 1. Kora's fee-payer signer.
80
+ const { signer_address } = await client.getPayerSigner();
81
+ const feePayer = kit.createNoopSigner(signer_address);
82
+ // 2. A sponsored native SOL transfer, with Kora as the fee payer.
83
+ const { instructions } = await client.transferTransaction({
84
+ amount: Number(solToLamports(amountSol)),
85
+ token: SYSTEM_PROGRAM_ID,
86
+ source: from,
87
+ destination: to,
88
+ signer_key: signer_address,
89
+ });
90
+ // 3. Build the message with Kora as fee payer.
91
+ const { blockhash } = await client.getBlockhash();
92
+ const message = kit.pipe(kit.createTransactionMessage({ version: 0 }), (tx) => kit.setTransactionMessageFeePayerSigner(feePayer, tx), (tx) => kit.setTransactionMessageLifetimeUsingBlockhash({
93
+ blockhash: blockhash,
94
+ lastValidBlockHeight: BigInt(0),
95
+ }, tx), (tx) => kit.appendTransactionMessageInstructions(instructions, tx));
96
+ // 4. Inject the user's Ed25519 signature alongside Kora's placeholder.
97
+ const partiallySigned = await kit.partiallySignTransactionMessageWithSigners(message);
98
+ const { signature } = await provider.signTransaction(new Uint8Array(partiallySigned.messageBytes));
99
+ const userSigned = {
100
+ ...partiallySigned,
101
+ signatures: {
102
+ ...partiallySigned.signatures,
103
+ [from]: toEd25519Signature(new Uint8Array(kit.getBase58Encoder().encode(signature))),
104
+ },
105
+ };
106
+ const wire = kit.getBase64EncodedWireTransaction(userSigned);
107
+ // 5. Kora co-signs (as fee payer) and broadcasts.
108
+ const response = (await client.signAndSendTransaction({
109
+ transaction: wire,
110
+ signer_key: signer_address,
111
+ }));
112
+ const direct = response.signature;
113
+ if (direct)
114
+ return direct;
115
+ const signedTxB64 = response.signed_transaction;
116
+ if (signedTxB64) {
117
+ // Wire format: [sigCount(1)][signature(64)]... — the first signature is the tx id.
118
+ const wireBytes = Uint8Array.from(atob(signedTxB64), (c) => c.charCodeAt(0));
119
+ return kit.getBase58Decoder().decode(wireBytes.slice(1, 65));
120
+ }
121
+ throw new Error('Failed to extract transaction signature from the Kora response');
122
+ }
123
+
124
+ export { sendSol, sendSolGasless };
125
+ //# sourceMappingURL=transfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { truncateEthAddress, truncateSolanaAddress } from './format';
3
3
  declare const nFormatter: (num: number, digits?: number) => string;
4
4
  declare const detectBrowser: () => "" | import("detect-browser").Browser | "bot" | "node" | "react-native";
5
+ declare const isIOS: () => boolean;
5
6
  declare const isAndroid: () => boolean;
6
7
  declare const isMobile: () => boolean;
7
8
  type ReactChildArray = ReturnType<typeof React.Children.toArray>;
@@ -9,4 +10,4 @@ declare function flattenChildren(children: React.ReactNode): ReactChildArray;
9
10
  export declare const isWalletConnectConnector: (connectorId?: string) => connectorId is "walletConnect";
10
11
  export declare const isCoinbaseWalletConnector: (connectorId?: string) => connectorId is "coinbaseWalletSDK";
11
12
  export declare const isInjectedConnector: (connectorId?: string) => connectorId is "injected";
12
- export { detectBrowser, flattenChildren, isAndroid, isMobile, nFormatter, truncateEthAddress, truncateSolanaAddress };
13
+ export { detectBrowser, flattenChildren, isAndroid, isIOS, isMobile, nFormatter, truncateEthAddress, truncateSolanaAddress, };
@@ -63,5 +63,5 @@ const isWalletConnectConnector = (connectorId) => connectorId === 'walletConnect
63
63
  const isCoinbaseWalletConnector = (connectorId) => connectorId === 'coinbaseWalletSDK';
64
64
  const isInjectedConnector = (connectorId) => connectorId === 'injected';
65
65
 
66
- export { detectBrowser, flattenChildren, isAndroid, isCoinbaseWalletConnector, isInjectedConnector, isMobile, isWalletConnectConnector, nFormatter };
66
+ export { detectBrowser, flattenChildren, isAndroid, isCoinbaseWalletConnector, isIOS, isInjectedConnector, isMobile, isWalletConnectConnector, nFormatter };
67
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export declare const OPENFORT_VERSION = "1.1.3";
1
+ export declare const OPENFORT_VERSION = "1.2.0";
package/build/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const OPENFORT_VERSION = '1.1.3';
1
+ const OPENFORT_VERSION = '1.2.0';
2
2
 
3
3
  export { OPENFORT_VERSION };
4
4
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- import { safe, coinbaseWallet, walletConnect } from '@wagmi/connectors';
1
+ import { safe, injected, coinbaseWallet, walletConnect } from '@wagmi/connectors';
2
2
  import { embeddedWalletConnector } from './embeddedConnector.js';
3
3
 
4
4
  const defaultConnectors = ({ app, walletConnectProjectId, coinbaseWalletPreference, }) => {
@@ -10,6 +10,10 @@ const defaultConnectors = ({ app, walletConnectProjectId, coinbaseWalletPreferen
10
10
  allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/],
11
11
  }));
12
12
  }
13
+ // Targeted injected connectors so the browser-extension wallets surface as
14
+ // their own entries (e.g. the deposit "transfer from wallet" list), instead of
15
+ // a single generic "Injected" provider.
16
+ connectors.push(injected({ target: 'metaMask' }), injected({ target: 'phantom' }));
13
17
  connectors.push(coinbaseWallet({
14
18
  appName: app.name,
15
19
  appLogoUrl: app.icon,
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConnectors.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"defaultConnectors.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/react",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
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.",
@@ -65,7 +65,7 @@
65
65
  "react"
66
66
  ],
67
67
  "dependencies": {
68
- "@openfort/openfort-js": "^1.3.6",
68
+ "@openfort/openfort-js": "^1.3.9",
69
69
  "buffer": "^6.0.3",
70
70
  "detect-browser": "^5.3.0",
71
71
  "fast-password-entropy": "^1.1.1",
@@ -83,7 +83,9 @@
83
83
  "@coinbase/wallet-sdk": "^4.3.6",
84
84
  "@safe-global/safe-apps-provider": "~0.18.6",
85
85
  "@safe-global/safe-apps-sdk": "^9.1.0",
86
+ "@solana-program/system": "^0.10.0",
86
87
  "@solana/kit": "^2.0.0 || ^5.0.0",
88
+ "@solana/kora": "^0.1.1",
87
89
  "@walletconnect/ethereum-provider": "^2.21.1",
88
90
  "react": "17.x || 18.x || 19.x",
89
91
  "react-dom": "17.x || 18.x || 19.x",
@@ -116,9 +118,15 @@
116
118
  "wagmi": "^3.6.16"
117
119
  },
118
120
  "peerDependenciesMeta": {
121
+ "@solana-program/system": {
122
+ "optional": true
123
+ },
119
124
  "@solana/kit": {
120
125
  "optional": true
121
126
  },
127
+ "@solana/kora": {
128
+ "optional": true
129
+ },
122
130
  "wagmi": {
123
131
  "optional": true
124
132
  },