@bounded-sh/client 0.0.6 → 0.0.8

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 (55) hide show
  1. package/dist/auth/index.d.ts +15 -0
  2. package/dist/auth/oidc-auth.d.ts +25 -11
  3. package/dist/auth/providers/email-auth-provider.d.ts +10 -0
  4. package/dist/auth/providers/mock-auth-provider.d.ts +1 -0
  5. package/dist/auth/providers/privy-wallet-provider.d.ts +2 -0
  6. package/dist/index.d.ts +2 -1
  7. package/dist/index.esm.js +24058 -7
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +24177 -108
  10. package/dist/index.js.map +1 -1
  11. package/dist/{index.native-Lrhg8G-G.js → index.native-C-duG1XV.js} +494 -2625
  12. package/dist/index.native-C-duG1XV.js.map +1 -0
  13. package/dist/{index.native-Y7aFGpZp.esm.js → index.native-DnVLH-7o.esm.js} +492 -2624
  14. package/dist/index.native-DnVLH-7o.esm.js.map +1 -0
  15. package/dist/index.native.d.ts +2 -1
  16. package/dist/index.native.esm.js +1 -1
  17. package/dist/index.native.js +3 -1
  18. package/dist/index.native.js.map +1 -1
  19. package/dist/{phantom-wallet-provider-DQDZjZkl.js → phantom-wallet-provider-DKScS8m6.js} +3 -3
  20. package/dist/{phantom-wallet-provider-DQDZjZkl.js.map → phantom-wallet-provider-DKScS8m6.js.map} +1 -1
  21. package/dist/{phantom-wallet-provider-K10GQBxk.esm.js → phantom-wallet-provider-DfTqdjx7.esm.js} +3 -3
  22. package/dist/{phantom-wallet-provider-K10GQBxk.esm.js.map → phantom-wallet-provider-DfTqdjx7.esm.js.map} +1 -1
  23. package/dist/{privy-wallet-provider-scXNSzjF.esm.js → privy-wallet-provider-BpPAZyUD.esm.js} +43 -23
  24. package/dist/privy-wallet-provider-BpPAZyUD.esm.js.map +1 -0
  25. package/dist/{privy-wallet-provider-Dh_jHrsq.js → privy-wallet-provider-wCTdqpRq.js} +43 -23
  26. package/dist/privy-wallet-provider-wCTdqpRq.js.map +1 -0
  27. package/dist/{solana-mobile-wallet-provider-DMXR_nmz.js → solana-mobile-wallet-provider-DZx3xVit.js} +5 -5
  28. package/dist/{solana-mobile-wallet-provider-DMXR_nmz.js.map → solana-mobile-wallet-provider-DZx3xVit.js.map} +1 -1
  29. package/dist/{solana-mobile-wallet-provider-BlwQuB4D.esm.js → solana-mobile-wallet-provider-xmASWrPf.esm.js} +5 -5
  30. package/dist/{solana-mobile-wallet-provider-BlwQuB4D.esm.js.map → solana-mobile-wallet-provider-xmASWrPf.esm.js.map} +1 -1
  31. package/package.json +23 -12
  32. package/dist/index-BzOrZU4R.esm.js +0 -16841
  33. package/dist/index-BzOrZU4R.esm.js.map +0 -1
  34. package/dist/index-CSUmsmHJ.js +0 -16884
  35. package/dist/index-CSUmsmHJ.js.map +0 -1
  36. package/dist/index-CtMYXtmh.js +0 -16882
  37. package/dist/index-CtMYXtmh.js.map +0 -1
  38. package/dist/index-DAI10qql.esm.js +0 -16843
  39. package/dist/index-DAI10qql.esm.js.map +0 -1
  40. package/dist/index-Dj2C_uV6.js +0 -26293
  41. package/dist/index-Dj2C_uV6.js.map +0 -1
  42. package/dist/index-Oc5pQUDo.esm.js +0 -26171
  43. package/dist/index-Oc5pQUDo.esm.js.map +0 -1
  44. package/dist/index.browser-BxwM4axz.esm.js +0 -5064
  45. package/dist/index.browser-BxwM4axz.esm.js.map +0 -1
  46. package/dist/index.browser-C_TToxuO.esm.js +0 -4208
  47. package/dist/index.browser-C_TToxuO.esm.js.map +0 -1
  48. package/dist/index.browser-Cp6PqsEM.js +0 -5074
  49. package/dist/index.browser-Cp6PqsEM.js.map +0 -1
  50. package/dist/index.browser-DcHalmEf.js +0 -4213
  51. package/dist/index.browser-DcHalmEf.js.map +0 -1
  52. package/dist/index.native-Lrhg8G-G.js.map +0 -1
  53. package/dist/index.native-Y7aFGpZp.esm.js.map +0 -1
  54. package/dist/privy-wallet-provider-Dh_jHrsq.js.map +0 -1
  55. package/dist/privy-wallet-provider-scXNSzjF.esm.js.map +0 -1
@@ -1,7 +1,6 @@
1
- import { e as SOLANA_MAINNET_RPC_URL, S as SOLANA_DEVNET_RPC_URL, n as getActiveSessionManager, c as convertRemainingAccounts, b as bufferExports, a as buildSetDocumentsTransaction, o as bs582, d as confirmAndCheckTransaction, s as setCurrentUser, i as getPlatform, k as genAuthNonce, l as genSolanaMessage, m as createSessionWithSignature } from './index.native-Y7aFGpZp.esm.js';
1
+ import { S as SOLANA_DEVNET_RPC_URL, e as SOLANA_MAINNET_RPC_URL, n as getActiveSessionManager, c as convertRemainingAccounts, b as bufferExports, a as buildSetDocumentsTransaction, o as bs58, d as confirmAndCheckTransaction, s as setCurrentUser, i as getPlatform, k as genAuthNonce, l as genSolanaMessage, m as createSessionWithSignature } from './index.native-DnVLH-7o.esm.js';
2
2
  import { Connection, VersionedTransaction, PublicKey, Transaction } from '@solana/web3.js';
3
3
  import * as anchor from '@coral-xyz/anchor';
4
- import { createSolanaRpcSubscriptions, createSolanaRpc } from '@solana/kit';
5
4
  import * as React from 'react';
6
5
  import * as ReactDOM from 'react-dom/client';
7
6
  import 'axios';
@@ -26,6 +25,19 @@ async function loadPrivyModules() {
26
25
  import('@privy-io/react-auth/solana'),
27
26
  ]);
28
27
  }
28
+ // @solana/kit is an OPTIONAL wallet-only dep, used only to build the Privy
29
+ // Solana RPC transports. Loaded lazily (like the Privy SDKs) via dynamic
30
+ // import() rather than a static top-level import: a static import is hoisted by
31
+ // rollup into the entry chunk, forcing every consumer (including vanilla,
32
+ // non-wallet web apps) to have @solana/kit installed and eagerly require()d.
33
+ // Deferring it here keeps it out of the entry bundle.
34
+ let solanaKit;
35
+ async function loadSolanaKit() {
36
+ if (!solanaKit) {
37
+ solanaKit = await import('@solana/kit');
38
+ }
39
+ return solanaKit;
40
+ }
29
41
  const getDefaultPrivyConfig = () => ({
30
42
  appId: "cm4ve714908o27dk2yurpnfhd",
31
43
  config: {
@@ -47,6 +59,10 @@ class PrivyWalletProvider {
47
59
  this.root = null;
48
60
  this.privyMethods = null;
49
61
  this.pendingLogin = null;
62
+ // Resolved Solana RPC URLs (computed in the constructor; consumed in
63
+ // initialize() where @solana/kit is lazily loaded to build the transports).
64
+ this.rpcDevnetUrl = SOLANA_DEVNET_RPC_URL;
65
+ this.rpcMainnetUrl = SOLANA_MAINNET_RPC_URL;
50
66
  // This is used to store the pending transaction until the wallet is connected for workaround for the wallet not being connected after login completion
51
67
  this.pendingTransaction = null;
52
68
  // This is used to store pending signTransaction calls until the wallet is connected
@@ -77,32 +93,20 @@ class PrivyWalletProvider {
77
93
  }
78
94
  // (externalWallets connectors are configured in initialize() once the
79
95
  // Privy SDK is lazily loaded — see loadPrivyModules.)
80
- // Add Solana RPC configuration for v3
81
- let devnetUrl = SOLANA_DEVNET_RPC_URL;
82
- let mainnetUrl = SOLANA_MAINNET_RPC_URL;
96
+ // Resolve Solana RPC URLs for v3. The @solana/kit transports are built
97
+ // lazily in initialize() so a non-Privy consumer never needs @solana/kit.
98
+ this.rpcDevnetUrl = SOLANA_DEVNET_RPC_URL;
99
+ this.rpcMainnetUrl = SOLANA_MAINNET_RPC_URL;
83
100
  if (networkUrl != null) {
84
101
  if (networkUrl.includes('mainnet')) {
85
- mainnetUrl = networkUrl;
102
+ this.rpcMainnetUrl = networkUrl;
86
103
  this.chainId = 'solana:mainnet';
87
104
  }
88
105
  else if (networkUrl.includes('devnet')) {
89
- devnetUrl = networkUrl;
106
+ this.rpcDevnetUrl = networkUrl;
90
107
  this.chainId = 'solana:devnet';
91
108
  }
92
109
  }
93
- if (!this.privyConfig.config.solana) {
94
- this.privyConfig.config.solana = {};
95
- }
96
- this.privyConfig.config.solana.rpcs = {
97
- 'solana:devnet': {
98
- rpc: createSolanaRpc(devnetUrl),
99
- rpcSubscriptions: createSolanaRpcSubscriptions(devnetUrl.replace('https://', 'wss://'))
100
- },
101
- 'solana:mainnet': {
102
- rpc: createSolanaRpc(mainnetUrl),
103
- rpcSubscriptions: createSolanaRpcSubscriptions(mainnetUrl.replace('https://', 'wss://'))
104
- }
105
- };
106
110
  const existingProviders = document.querySelectorAll('[data-privy-provider]');
107
111
  existingProviders.forEach(el => el.remove());
108
112
  // Fire-and-forget: initialize() lazily loads the Privy SDK then renders
@@ -125,6 +129,22 @@ class PrivyWalletProvider {
125
129
  async initialize() {
126
130
  // Lazily load the Privy SDK (browser-only) before building the React tree.
127
131
  await loadPrivyModules();
132
+ // Build the Solana RPC transports now that we're on the async path, so
133
+ // @solana/kit can be lazily imported (kept out of the entry bundle).
134
+ const { createSolanaRpc, createSolanaRpcSubscriptions } = await loadSolanaKit();
135
+ if (!this.privyConfig.config.solana) {
136
+ this.privyConfig.config.solana = {};
137
+ }
138
+ this.privyConfig.config.solana.rpcs = {
139
+ 'solana:devnet': {
140
+ rpc: createSolanaRpc(this.rpcDevnetUrl),
141
+ rpcSubscriptions: createSolanaRpcSubscriptions(this.rpcDevnetUrl.replace('https://', 'wss://'))
142
+ },
143
+ 'solana:mainnet': {
144
+ rpc: createSolanaRpc(this.rpcMainnetUrl),
145
+ rpcSubscriptions: createSolanaRpcSubscriptions(this.rpcMainnetUrl.replace('https://', 'wss://'))
146
+ }
147
+ };
128
148
  // Ensure externalWallets connectors are always configured — required for
129
149
  // useWallets().ready to resolve even when no browser extension is present.
130
150
  if (!this.privyConfig.config.externalWallets && privySolana) {
@@ -756,7 +776,7 @@ class PrivyWalletProvider {
756
776
  // Handle case where signature might be bytes instead of string
757
777
  const rawSig = result.signature;
758
778
  if (rawSig instanceof Uint8Array || Array.isArray(rawSig)) {
759
- signature = bs582.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
779
+ signature = bs58.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
760
780
  }
761
781
  else {
762
782
  signature = rawSig;
@@ -838,7 +858,7 @@ class PrivyWalletProvider {
838
858
  }));
839
859
  // The signature is returned as a Uint8Array, encode it as base58 (standard Solana format)
840
860
  const signatureBytes = (result === null || result === void 0 ? void 0 : result.signature) || result;
841
- const bs58 = await import('./index.native-Y7aFGpZp.esm.js').then(function (n) { return n.aN; });
861
+ const bs58 = await import('./index.native-DnVLH-7o.esm.js').then(function (n) { return n.aO; });
842
862
  return bs58.default.encode(signatureBytes);
843
863
  }
844
864
  async restoreSession() {
@@ -930,4 +950,4 @@ class PrivyWalletProvider {
930
950
  PrivyWalletProvider.instance = null;
931
951
 
932
952
  export { PrivyWalletProvider };
933
- //# sourceMappingURL=privy-wallet-provider-scXNSzjF.esm.js.map
953
+ //# sourceMappingURL=privy-wallet-provider-BpPAZyUD.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privy-wallet-provider-BpPAZyUD.esm.js","sources":["../.rollup-tmp/auth/providers/privy-wallet-provider.js"],"sourcesContent":["import { getActiveSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSolanaMessage, buildSetDocumentsTransaction, convertRemainingAccounts } from '@bounded-sh/core';\nimport { Buffer } from 'buffer';\nimport { setCurrentUser } from '../../global';\nimport { getPlatform } from '../../platform';\nimport { PublicKey, Connection, Transaction, VersionedTransaction } from '@solana/web3.js';\nimport * as anchor from '@coral-xyz/anchor';\nimport { SOLANA_DEVNET_RPC_URL, SOLANA_MAINNET_RPC_URL } from '..';\nimport { confirmAndCheckTransaction } from './transaction-utils';\nimport bs58 from 'bs58';\nconst SURFNET_RPC_URL = \"https://surfpool.fly.dev\";\n// React/react-dom are externalized peer deps (see rollup.config.js\n// sharedExternal / isExternal) — rollup emits these as bare ESM imports the\n// consumer's bundler resolves; they are NOT inlined. Static top-level ESM\n// imports (instead of a runtime require() behind a `typeof window` guard) so\n// the browser ESM bundle never evaluates `require`, which is undefined in a\n// production ESM/Vite build (it would throw ReferenceError at module eval).\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom/client';\n// @privy-io/react-auth(/solana) are OPTIONAL peer deps. They are loaded lazily\n// via dynamic import() rather than a static top-level import: a static import\n// would (a) in the ESM bundle still be a bare `import` the consumer resolves —\n// fine — but (b) in the CJS bundle become an eager top-level require() that\n// throws for any consumer who hasn't installed Privy (this module is pulled\n// into the entry via a static re-export). The lazy import keeps the browser\n// ESM bundle free of any runtime `require('@privy-io...')` AND lets a consumer\n// who never uses Privy load the package without it installed. Populated once\n// in `initialize()` (browser-only) before the Privy React tree renders.\nlet privyImports;\nlet privySolana;\nasync function loadPrivyModules() {\n if (privyImports && privySolana)\n return;\n [privyImports, privySolana] = await Promise.all([\n import('@privy-io/react-auth'),\n import('@privy-io/react-auth/solana'),\n ]);\n}\n// @solana/kit is an OPTIONAL wallet-only dep, used only to build the Privy\n// Solana RPC transports. Loaded lazily (like the Privy SDKs) via dynamic\n// import() rather than a static top-level import: a static import is hoisted by\n// rollup into the entry chunk, forcing every consumer (including vanilla,\n// non-wallet web apps) to have @solana/kit installed and eagerly require()d.\n// Deferring it here keeps it out of the entry bundle.\nlet solanaKit;\nasync function loadSolanaKit() {\n if (!solanaKit) {\n solanaKit = await import('@solana/kit');\n }\n return solanaKit;\n}\nconst getDefaultPrivyConfig = () => ({\n appId: \"cm4ve714908o27dk2yurpnfhd\",\n config: {\n embeddedWallets: {\n solana: {\n createOnLogin: \"users-without-wallets\"\n }\n },\n appearance: {\n walletChainType: 'solana-only'\n },\n externalWallets: { solana: { connectors: privySolana.toSolanaWalletConnectors() } }\n }\n});\nexport class PrivyWalletProvider {\n constructor(appName, appLogoUrl, privyConfig, networkUrl = null) {\n this.containerElement = null;\n this.chainId = 'solana:mainnet';\n this.root = null;\n this.privyMethods = null;\n this.pendingLogin = null;\n // Resolved Solana RPC URLs (computed in the constructor; consumed in\n // initialize() where @solana/kit is lazily loaded to build the transports).\n this.rpcDevnetUrl = SOLANA_DEVNET_RPC_URL;\n this.rpcMainnetUrl = SOLANA_MAINNET_RPC_URL;\n // This is used to store the pending transaction until the wallet is connected for workaround for the wallet not being connected after login completion\n this.pendingTransaction = null;\n // This is used to store pending signTransaction calls until the wallet is connected\n this.pendingSignTransaction = null;\n // This is used to store pending signMessage calls until the wallet is connected\n this.pendingSignMessage = null;\n // This is used to store pending signAndSubmitTransaction calls until the wallet is connected\n this.pendingSignAndSubmitTransaction = null;\n this.networkUrl = networkUrl;\n if (typeof window === 'undefined') {\n throw new Error('PrivyWalletProvider can only be instantiated in a browser environment');\n }\n if (PrivyWalletProvider.instance) {\n return PrivyWalletProvider.instance;\n }\n this.containerElement = null;\n this.root = null;\n this.privyMethods = null;\n this.privyConfig = privyConfig !== null && privyConfig !== void 0 ? privyConfig : getDefaultPrivyConfig();\n // Only use the appName and appLogoUrl if no privyConfig is provided\n if (privyConfig == null) {\n if (appName != null && appName != '') {\n this.privyConfig.config.appearance.landingHeader = appName;\n }\n if (appLogoUrl != null && appLogoUrl != '') {\n this.privyConfig.config.appearance.logo = appLogoUrl;\n }\n }\n // (externalWallets connectors are configured in initialize() once the\n // Privy SDK is lazily loaded — see loadPrivyModules.)\n // Resolve Solana RPC URLs for v3. The @solana/kit transports are built\n // lazily in initialize() so a non-Privy consumer never needs @solana/kit.\n this.rpcDevnetUrl = SOLANA_DEVNET_RPC_URL;\n this.rpcMainnetUrl = SOLANA_MAINNET_RPC_URL;\n if (networkUrl != null) {\n if (networkUrl.includes('mainnet')) {\n this.rpcMainnetUrl = networkUrl;\n this.chainId = 'solana:mainnet';\n }\n else if (networkUrl.includes('devnet')) {\n this.rpcDevnetUrl = networkUrl;\n this.chainId = 'solana:devnet';\n }\n }\n const existingProviders = document.querySelectorAll('[data-privy-provider]');\n existingProviders.forEach(el => el.remove());\n // Fire-and-forget: initialize() lazily loads the Privy SDK then renders\n // the hidden React tree. privyMethods stays null until that render runs,\n // which the login/connect methods already wait for. Surface a clear error\n // if the optional @privy-io/react-auth peer dep isn't installed.\n this.initialize().catch((err) => {\n console.error('PrivyWalletProvider: failed to load @privy-io/react-auth — ensure it is installed to use Privy login.', err);\n });\n // Assign this instance to the static instance property\n PrivyWalletProvider.instance = this;\n }\n // Optional: Provide a static method to get the instance\n static getInstance(appName, appLogoUrl, privyConfig) {\n if (!PrivyWalletProvider.instance) {\n new PrivyWalletProvider(appName, appLogoUrl, privyConfig);\n }\n return PrivyWalletProvider.instance;\n }\n async initialize() {\n // Lazily load the Privy SDK (browser-only) before building the React tree.\n await loadPrivyModules();\n // Build the Solana RPC transports now that we're on the async path, so\n // @solana/kit can be lazily imported (kept out of the entry bundle).\n const { createSolanaRpc, createSolanaRpcSubscriptions } = await loadSolanaKit();\n if (!this.privyConfig.config.solana) {\n this.privyConfig.config.solana = {};\n }\n this.privyConfig.config.solana.rpcs = {\n 'solana:devnet': {\n rpc: createSolanaRpc(this.rpcDevnetUrl),\n rpcSubscriptions: createSolanaRpcSubscriptions(this.rpcDevnetUrl.replace('https://', 'wss://'))\n },\n 'solana:mainnet': {\n rpc: createSolanaRpc(this.rpcMainnetUrl),\n rpcSubscriptions: createSolanaRpcSubscriptions(this.rpcMainnetUrl.replace('https://', 'wss://'))\n }\n };\n // Ensure externalWallets connectors are always configured — required for\n // useWallets().ready to resolve even when no browser extension is present.\n if (!this.privyConfig.config.externalWallets && privySolana) {\n this.privyConfig.config.externalWallets = {\n solana: { connectors: privySolana.toSolanaWalletConnectors() }\n };\n }\n if (!this.containerElement) {\n this.containerElement = document.createElement('div');\n this.containerElement.setAttribute('data-privy-provider', 'true');\n document.body.appendChild(this.containerElement);\n const that = this;\n const PrivyComponent = () => {\n const privy = privyImports.usePrivy();\n const useOAuthTokens = privyImports.useOAuthTokens();\n const useFundWalletSolana = privySolana.useFundWallet();\n const useSendTransactionSolana = privySolana.useSignAndSendTransaction();\n const { signTransaction } = privySolana.useSignTransaction();\n const { signMessage: signMessageHook } = privySolana.useSignMessage();\n const { ready: walletReady, wallets } = privySolana.useWallets();\n const { createWallet } = privySolana.useCreateWallet();\n const { exportWallet } = privySolana.useExportWallet();\n const useSolanaWallets = { createWallet, exportWallet, ready: walletReady, wallets };\n const useIdentityToken = privyImports.useIdentityToken();\n const { connectWallet } = privyImports.useConnectWallet({\n onSuccess: async ({ wallet }) => {\n await that.createSession(wallet.address, await privy.getAccessToken(), useIdentityToken.identityToken);\n // If there's a pending transaction, execute it now\n if (that.pendingTransaction) {\n const { evmTransactionData, solTransactionData, options, resolve, reject } = that.pendingTransaction;\n try {\n const result = await that.runTransaction(evmTransactionData, solTransactionData, options);\n resolve(result);\n }\n catch (error) {\n reject(error);\n }\n that.pendingTransaction = null;\n }\n // If there's a pending signTransaction, execute it now\n if (that.pendingSignTransaction) {\n const { transaction, resolve, reject } = that.pendingSignTransaction;\n try {\n const result = await that.signTransaction(transaction);\n resolve(result);\n }\n catch (error) {\n reject(error);\n }\n that.pendingSignTransaction = null;\n }\n // If there's a pending signMessage, execute it now\n if (that.pendingSignMessage) {\n const { message, resolve, reject } = that.pendingSignMessage;\n try {\n const result = await that.signMessage(message);\n resolve(result);\n }\n catch (error) {\n reject(error);\n }\n that.pendingSignMessage = null;\n }\n // If there's a pending signAndSubmitTransaction, execute it now\n if (that.pendingSignAndSubmitTransaction) {\n const { transaction, feePayer, resolve, reject } = that.pendingSignAndSubmitTransaction;\n try {\n const result = await that.signAndSubmitTransaction(transaction, feePayer);\n resolve(result);\n }\n catch (error) {\n reject(error);\n }\n that.pendingSignAndSubmitTransaction = null;\n }\n },\n onError: (error) => {\n // Only log errors that aren't user-initiated cancellations\n if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {\n console.error('Wallet connection error:', error);\n }\n if (that.pendingTransaction) {\n that.pendingTransaction.reject(error);\n that.pendingTransaction = null;\n }\n if (that.pendingSignTransaction) {\n that.pendingSignTransaction.reject(error);\n that.pendingSignTransaction = null;\n }\n if (that.pendingSignMessage) {\n that.pendingSignMessage.reject(error);\n that.pendingSignMessage = null;\n }\n if (that.pendingSignAndSubmitTransaction) {\n that.pendingSignAndSubmitTransaction.reject(error);\n that.pendingSignAndSubmitTransaction = null;\n }\n }\n });\n const { login } = privyImports.useLogin({\n onComplete: async ({ user }) => {\n var _a;\n // This is a hack to indicate to the app that privy login is not complete\n // @ts-ignore\n window.runningPrivyOnComplete = true;\n if (!user) {\n SessionManager().clearSession();\n return;\n }\n const solanaLinkedAccounts = user.linkedAccounts.filter((account) => account.chainType === 'solana');\n const sortedLinkedAccounts = solanaLinkedAccounts.sort((a, b) => new Date(b.latestVerifiedAt).getTime() - new Date(a.latestVerifiedAt).getTime());\n let finalAddress = (_a = sortedLinkedAccounts[0]) === null || _a === void 0 ? void 0 : _a.address;\n if (!finalAddress) {\n const solanaWallet = await createWallet();\n finalAddress = solanaWallet.address;\n SessionManager().clearSession();\n return;\n }\n const session = await SessionManager().getSession();\n if (!session || finalAddress !== session.address) {\n try {\n const accessToken = await privy.getAccessToken();\n const idToken = useIdentityToken.identityToken;\n await that.createSession(finalAddress, accessToken, idToken);\n }\n catch (error) {\n console.error('Error creating session:', error);\n }\n }\n // @ts-ignore\n window.runningPrivyOnComplete = false;\n setCurrentUser({ address: finalAddress, provider: that });\n if (that.pendingLogin) {\n that.pendingLogin.resolve({ address: finalAddress, provider: that });\n that.pendingLogin = null;\n }\n },\n onError: (error) => {\n // Only log errors that aren't user-initiated cancellations\n if (error !== 'exited_auth_flow' && (error === null || error === void 0 ? void 0 : error.message) !== 'exited_auth_flow') {\n console.error('Login error:', error);\n }\n if (that.pendingLogin) {\n that.pendingLogin.reject(error);\n that.pendingLogin = null;\n }\n }\n });\n const { logout } = privyImports.useLogout({\n onSuccess: () => {\n SessionManager().clearSession();\n setCurrentUser(null);\n }\n });\n React.useEffect(() => {\n if (privy.ready) {\n that.privyMethods = {\n ready: privy.ready,\n walletReady: walletReady,\n authenticated: privy.authenticated,\n wallets,\n login,\n logout,\n connectWallet,\n getAccessToken: privy.getAccessToken,\n identityToken: useIdentityToken.identityToken,\n usePrivy: privy,\n useOAuthTokens: useOAuthTokens,\n useFundWalletSolana: useFundWalletSolana,\n useSendTransactionSolana: useSendTransactionSolana,\n useSolanaWallets: useSolanaWallets,\n signTransaction: signTransaction,\n signMessage: signMessageHook,\n };\n }\n }, [privy.ready, privy.authenticated, wallets, login, logout, walletReady]);\n return null;\n };\n const FinalPrivyComponent = () => {\n if (typeof window === 'undefined') {\n return null;\n }\n return React.createElement(privyImports.PrivyProvider, {\n appId: this.privyConfig.appId,\n config: this.privyConfig.config,\n children: React.createElement(PrivyComponent)\n });\n };\n this.root = ReactDOM.createRoot(this.containerElement);\n this.root.render(React.createElement(FinalPrivyComponent));\n }\n }\n async login() {\n var _a, _b;\n await this.ensureReady();\n // Check if we have a valid session that matches an authenticated wallet\n const session = await SessionManager().getSession();\n if (((_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.authenticated) && ((_b = this.privyMethods.wallets) === null || _b === void 0 ? void 0 : _b.length) > 0 && session) {\n // Find the wallet matching the session\n const matchingWallet = this.privyMethods.wallets.find((wallet) => wallet.address === session.address);\n if (matchingWallet) {\n // Valid session with matching wallet, return immediately\n setCurrentUser({ address: matchingWallet.address, provider: this });\n return {\n address: matchingWallet.address,\n provider: this\n };\n }\n // Session exists but doesn't match any connected wallet\n // This can happen after wallet switching - force fresh login\n console.log('Session wallet mismatch detected, forcing fresh login flow');\n }\n // If no valid session or wallet mismatch, force a fresh login flow\n // This ensures the user can select the correct wallet, especially after logout\n if (this.pendingLogin) {\n return new Promise((resolve, reject) => {\n this.pendingLogin.resolve = resolve;\n this.pendingLogin.reject = reject;\n });\n }\n return new Promise((resolve, reject) => {\n this.pendingLogin = { resolve, reject };\n // open Privy modal to let user select/verify wallet\n this.privyMethods.login();\n // safety timeout\n setTimeout(() => {\n if (this.pendingLogin) {\n this.pendingLogin.reject(new Error(\"Login timed out\"));\n this.pendingLogin = null;\n }\n }, 180000);\n });\n }\n async getNativeMethods() {\n var _a;\n await this.ensureReady();\n return (_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.usePrivy;\n }\n async logout() {\n await this.ensureReady();\n await this.privyMethods.logout();\n }\n async runTransaction(_evmTransactionData, solTransactionData, options) {\n var _a, _b, _c;\n await this.ensureReady({ waitForWallets: true });\n let session = await SessionManager().getSession();\n let sessionAddress = session === null || session === void 0 ? void 0 : session.address;\n let privyWallets = (_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.wallets;\n let privyWallet = privyWallets === null || privyWallets === void 0 ? void 0 : privyWallets.find((wallet) => wallet.address === sessionAddress);\n // If wallet not found yet, it may be an embedded wallet (email login) that hasn't\n // appeared in the wallets array due to React state timing. Wait for it before\n // falling back to connectWallet() which shows an unwanted wallet selection modal.\n if (!privyWallets || privyWallets.length === 0 || !privyWallet) {\n if (((_b = this.privyMethods) === null || _b === void 0 ? void 0 : _b.authenticated) && sessionAddress) {\n privyWallet = await this.waitForMatchingWallet(sessionAddress);\n }\n }\n if (!privyWallet) {\n // If there's already a pending transaction, throw an error to prevent overlapping calls\n if (this.pendingTransaction) {\n throw new Error(\"Oops... something went wrong. Please try again.\");\n }\n // Create a promise to wait for the transaction result\n return new Promise((resolve, reject) => {\n this.pendingTransaction = {\n resolve,\n reject,\n evmTransactionData: _evmTransactionData,\n solTransactionData,\n options\n };\n this.privyMethods.connectWallet();\n // Set a timeout to reject the promise if connection takes too long\n setTimeout(() => {\n if (this.pendingTransaction) {\n this.pendingTransaction.reject(new Error(\"Wallet connection timed out\"));\n this.pendingTransaction = null;\n }\n }, 30000); // 30 seconds timeout\n });\n }\n // Proceed with the transaction using privyWallet\n const wallet = privyWallet;\n if (solTransactionData == null) {\n throw new Error(\"Solana transaction data is required\");\n }\n const rpcUrl = this.getRpcUrl(solTransactionData.network);\n const connection = new Connection(rpcUrl, \"confirmed\");\n const remainingAccounts = convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);\n let app_id = solTransactionData.appId;\n if (typeof window !== 'undefined' && window.CUSTOM_BOUNDED_APP_ID_HEADER) {\n const customAppId = window.CUSTOM_BOUNDED_APP_ID_HEADER;\n if (customAppId) {\n app_id = customAppId;\n }\n }\n if (!app_id) {\n throw new Error(\"App ID is required\");\n }\n const anchorProvider = new anchor.AnchorProvider(connection, wallet.provider, anchor.AnchorProvider.defaultOptions());\n const finalDeduped = [];\n for (const acc of remainingAccounts) {\n const existing = finalDeduped.find((d) => d.pubkey.equals(acc.pubkey));\n if (existing) {\n existing.isSigner = existing.isSigner || acc.isSigner;\n existing.isWritable = existing.isWritable || acc.isWritable;\n }\n else {\n finalDeduped.push(acc);\n }\n }\n let tx;\n let blockhash;\n let lastValidBlockHeight;\n if (solTransactionData.signedTransaction) {\n // Server already set the blockhash and co-signed — do NOT overwrite\n // the blockhash or it will invalidate the server's signature.\n tx = VersionedTransaction.deserialize(Buffer.from(solTransactionData.signedTransaction, 'base64'));\n // Extract the blockhash that was baked into the signed message\n blockhash = tx.message.recentBlockhash;\n const latestBlockhash = await connection.getLatestBlockhash('confirmed');\n lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;\n }\n else {\n const result = await buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, anchorProvider, new PublicKey(wallet.address), { app_id, documents: solTransactionData.txArgs[0].setDocumentData, delete_paths: solTransactionData.txArgs[0].deletePaths, txData: solTransactionData.txArgs[0].txData }, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false, solTransactionData.additionalLutAddresses);\n tx = result.tx;\n blockhash = result.blockhash;\n lastValidBlockHeight = result.lastValidBlockHeight;\n }\n // Use duck typing instead of instanceof to handle multiple @solana/web3.js versions\n const isLegacyTx = 'recentBlockhash' in tx && !('message' in tx && 'staticAccountKeys' in tx.message);\n if (isLegacyTx) {\n tx.recentBlockhash = blockhash;\n tx.lastValidBlockHeight = lastValidBlockHeight;\n }\n else {\n tx.message.recentBlockhash = blockhash;\n }\n try {\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n // Just sign, don't submit - return raw signed bytes (same as original runTransaction)\n const signedTx = await this.signTransactionRaw(tx, privyWallet);\n return {\n signedTransaction: signedTx, // Raw Uint8Array from Privy\n blockNumber: 0,\n gasUsed: \"0\",\n data: \"\"\n };\n }\n // Sign and submit using shared helper\n const { signature, txInfo } = await this.signAndSubmitInternal(tx, privyWallet, rpcUrl, connection);\n return {\n transactionSignature: signature,\n blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,\n gasUsed: ((_c = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _c === void 0 ? void 0 : _c.fee.toString()) || '0',\n data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,\n };\n }\n catch (err) {\n console.error(err);\n throw err;\n }\n }\n /**\n * Signs a Solana transaction without submitting it.\n *\n * This method handles blockhash automatically if not set - you do NOT need to\n * set recentBlockhash on the transaction before calling this method.\n * The network/RPC URL is derived from the provider's configuration (set during initialization).\n *\n * @param transaction - The transaction to sign (Transaction or VersionedTransaction)\n * @returns The signed transaction\n */\n async signTransaction(transaction) {\n var _a, _b;\n await this.ensureReady({ waitForWallets: true });\n let privyWallets = (_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.wallets;\n let session = await SessionManager().getSession();\n let sessionAddress = session === null || session === void 0 ? void 0 : session.address;\n let privyWallet = privyWallets === null || privyWallets === void 0 ? void 0 : privyWallets.find((wallet) => wallet.address === sessionAddress);\n // If there's already a pending sign transaction, throw an error to prevent overlapping calls\n if (this.pendingSignTransaction) {\n throw new Error(\"Oops... something went wrong. Please try again.\");\n }\n // If wallet not found yet, it may be an embedded wallet (email login) that hasn't\n // appeared in the wallets array due to React state timing. Wait for it before\n // falling back to connectWallet() which shows an unwanted wallet selection modal.\n if (!privyWallets || privyWallets.length === 0 || !privyWallet) {\n if (((_b = this.privyMethods) === null || _b === void 0 ? void 0 : _b.authenticated) && sessionAddress) {\n privyWallet = await this.waitForMatchingWallet(sessionAddress);\n }\n }\n // If still no wallet after waiting, trigger connection and queue the signing\n if (!privyWallet) {\n return new Promise((resolve, reject) => {\n this.pendingSignTransaction = {\n resolve,\n reject,\n transaction\n };\n this.privyMethods.connectWallet();\n // Set a timeout to reject the promise if connection takes too long\n setTimeout(() => {\n if (this.pendingSignTransaction) {\n this.pendingSignTransaction.reject(new Error(\"Wallet connection timed out\"));\n this.pendingSignTransaction = null;\n }\n }, 30000); // 30 seconds timeout\n });\n }\n // Privy requires serialized transaction bytes, which requires a blockhash.\n // If the transaction doesn't have one, get a fresh blockhash and set it.\n // Use duck typing instead of instanceof to handle multiple @solana/web3.js versions\n const isLegacyTransaction = 'recentBlockhash' in transaction && !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacyTransaction) {\n const legacyTx = transaction;\n if (!legacyTx.recentBlockhash) {\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');\n legacyTx.recentBlockhash = blockhash;\n legacyTx.lastValidBlockHeight = lastValidBlockHeight;\n }\n // Set feePayer if not already set\n if (!legacyTx.feePayer) {\n legacyTx.feePayer = new PublicKey(privyWallet.address);\n }\n }\n else {\n // VersionedTransaction\n const versionedTx = transaction;\n if (!versionedTx.message.recentBlockhash) {\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n const { blockhash } = await connection.getLatestBlockhash('confirmed');\n versionedTx.message.recentBlockhash = blockhash;\n }\n }\n // Sign using raw method, then deserialize for the public API\n const signedTxRaw = await this.signTransactionRaw(transaction, privyWallet);\n return this.deserializeSignedTransaction(signedTxRaw);\n }\n /**\n * Signs and submits a Solana transaction to the network.\n *\n * This method handles blockhash and transaction confirmation automatically - you do NOT need to\n * set recentBlockhash or lastValidBlockHeight on the transaction before calling this method.\n * The network/RPC URL is derived from the provider's configuration (set during initialization).\n *\n * @param transaction - The transaction to sign and submit (Transaction or VersionedTransaction)\n * @param feePayer - Optional fee payer public key. If not provided and the transaction doesn't\n * already have a feePayer set, the connected wallet address will be used.\n * Useful for co-signing scenarios where a different account pays the fees.\n * @returns The transaction signature\n */\n async signAndSubmitTransaction(transaction, feePayer) {\n var _a, _b;\n await this.ensureReady({ waitForWallets: true });\n let privyWallets = (_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.wallets;\n let session = await SessionManager().getSession();\n let sessionAddress = session === null || session === void 0 ? void 0 : session.address;\n let privyWallet = privyWallets === null || privyWallets === void 0 ? void 0 : privyWallets.find((wallet) => wallet.address === sessionAddress);\n // If there's already a pending signAndSubmitTransaction, throw an error to prevent overlapping calls\n if (this.pendingSignAndSubmitTransaction) {\n throw new Error(\"Oops... something went wrong. Please try again.\");\n }\n // If wallet not found yet, it may be an embedded wallet (email login) that hasn't\n // appeared in the wallets array due to React state timing. Wait for it before\n // falling back to connectWallet() which shows an unwanted wallet selection modal.\n if (!privyWallets || privyWallets.length === 0 || !privyWallet) {\n if (((_b = this.privyMethods) === null || _b === void 0 ? void 0 : _b.authenticated) && sessionAddress) {\n privyWallet = await this.waitForMatchingWallet(sessionAddress);\n }\n }\n // If still no wallet after waiting, trigger connection and queue the signing\n if (!privyWallet) {\n return new Promise((resolve, reject) => {\n this.pendingSignAndSubmitTransaction = {\n resolve,\n reject,\n transaction,\n feePayer\n };\n this.privyMethods.connectWallet();\n // Set a timeout to reject the promise if connection takes too long\n setTimeout(() => {\n if (this.pendingSignAndSubmitTransaction) {\n this.pendingSignAndSubmitTransaction.reject(new Error(\"Wallet connection timed out\"));\n this.pendingSignAndSubmitTransaction = null;\n }\n }, 30000); // 30 seconds timeout\n });\n }\n // Get RPC URL and create connection\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n // Get fresh blockhash and set it on the transaction before signing\n const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');\n // Use duck typing instead of instanceof to handle multiple @solana/web3.js versions\n const isLegacyTransaction = 'recentBlockhash' in transaction && !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacyTransaction) {\n const legacyTx = transaction;\n legacyTx.recentBlockhash = blockhash;\n legacyTx.lastValidBlockHeight = lastValidBlockHeight;\n // Set feePayer if not already set\n if (!legacyTx.feePayer) {\n legacyTx.feePayer = feePayer !== null && feePayer !== void 0 ? feePayer : new PublicKey(privyWallet.address);\n }\n }\n else {\n // VersionedTransaction\n const versionedTx = transaction;\n versionedTx.message.recentBlockhash = blockhash;\n // Note: VersionedTransaction feePayer is set in the message at creation time\n // and cannot be modified after creation\n }\n // Use shared sign and submit logic\n const { signature } = await this.signAndSubmitInternal(transaction, privyWallet, rpcUrl, connection);\n return signature;\n }\n // ============ Private Helpers ============\n getRpcUrl(network) {\n if (this.networkUrl) {\n return this.networkUrl;\n }\n if (network === 'solana_devnet') {\n return SOLANA_DEVNET_RPC_URL;\n }\n else if (network === 'solana_mainnet') {\n return SOLANA_MAINNET_RPC_URL;\n }\n else if (network === 'surfnet') {\n return SURFNET_RPC_URL;\n }\n return SOLANA_MAINNET_RPC_URL; // default to mainnet\n }\n /**\n * Internal sign transaction - serializes and signs via Privy\n * Returns the raw result from Privy (Uint8Array)\n * This mirrors exactly what runTransaction was doing\n */\n async signTransactionRaw(transaction, privyWallet) {\n var _a;\n // Serialize the transaction\n // Use duck typing instead of instanceof to handle multiple @solana/web3.js versions\n const isLegacyTransaction = 'recentBlockhash' in transaction && !('message' in transaction && 'staticAccountKeys' in transaction.message);\n let serializedForSign;\n if (isLegacyTransaction) {\n serializedForSign = transaction.serialize({ requireAllSignatures: false, verifySignatures: false });\n }\n else {\n serializedForSign = transaction.serialize();\n }\n // Sign via Privy - returns { signedTransaction: Uint8Array }\n const result = await ((_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.signTransaction({\n transaction: serializedForSign,\n wallet: privyWallet,\n chain: this.chainId\n }));\n // Privy returns { signedTransaction: Uint8Array }, unwrap it\n const signedTx = (result === null || result === void 0 ? void 0 : result.signedTransaction) || result;\n return signedTx;\n }\n /**\n * Deserialize a signed transaction from Uint8Array to Transaction object\n */\n deserializeSignedTransaction(signedTxRaw) {\n // Handle different formats Privy might return\n let signedTx;\n if (signedTxRaw instanceof Uint8Array) {\n signedTx = signedTxRaw;\n }\n else if (Array.isArray(signedTxRaw)) {\n signedTx = new Uint8Array(signedTxRaw);\n }\n else if (signedTxRaw && typeof signedTxRaw === 'object' && 'signedTransaction' in signedTxRaw) {\n // Privy might wrap the result\n signedTx = signedTxRaw.signedTransaction instanceof Uint8Array\n ? signedTxRaw.signedTransaction\n : new Uint8Array(signedTxRaw.signedTransaction);\n }\n else if (Buffer.isBuffer(signedTxRaw)) {\n signedTx = new Uint8Array(signedTxRaw);\n }\n else {\n throw new Error(`Unexpected signed transaction format: ${typeof signedTxRaw}`);\n }\n // Try to deserialize as VersionedTransaction first, fall back to legacy Transaction\n try {\n return VersionedTransaction.deserialize(signedTx);\n }\n catch (_a) {\n return Transaction.from(signedTx);\n }\n }\n /**\n * Internal sign and submit - handles Surfnet vs non-Surfnet logic\n * This is the core submission logic used by both signAndSubmitTransaction and runTransaction\n *\n * For Surfnet: sign with signTransactionRaw, then sendRawTransaction\n * For non-Surfnet: use Privy's signAndSendTransaction (combined operation)\n */\n async signAndSubmitInternal(transaction, privyWallet, rpcUrl, connection) {\n var _a;\n const isSurfnet = rpcUrl === SURFNET_RPC_URL;\n let signature;\n if (isSurfnet) {\n // For Surfnet: sign with signTransactionRaw, then sendRawTransaction\n const signedTx = await this.signTransactionRaw(transaction, privyWallet);\n signature = await connection.sendRawTransaction(signedTx);\n }\n else {\n // For non-Surfnet: use Privy's combined signAndSendTransaction\n // Serialize the transaction for Privy API\n // Use duck typing instead of instanceof to handle multiple @solana/web3.js versions\n const isLegacyTransaction = 'recentBlockhash' in transaction && !('message' in transaction && 'staticAccountKeys' in transaction.message);\n let serializedTx;\n if (isLegacyTransaction) {\n serializedTx = transaction.serialize({ requireAllSignatures: false, verifySignatures: false });\n }\n else {\n serializedTx = transaction.serialize();\n }\n const result = await ((_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.useSendTransactionSolana.signAndSendTransaction({\n transaction: serializedTx,\n wallet: privyWallet,\n chain: this.chainId\n }));\n // Handle case where signature might be bytes instead of string\n const rawSig = result.signature;\n if (rawSig instanceof Uint8Array || Array.isArray(rawSig)) {\n signature = bs58.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));\n }\n else {\n signature = rawSig;\n }\n }\n const txInfo = await confirmAndCheckTransaction(connection, signature);\n return { signature, txInfo };\n }\n async signMessage(message) {\n var _a, _b, _c;\n await this.ensureReady({ waitForWallets: true });\n const session = await SessionManager().getSession();\n let sessionAddress = session === null || session === void 0 ? void 0 : session.address;\n // If there's already a pending sign message, throw an error to prevent overlapping calls\n if (this.pendingSignMessage) {\n throw new Error(\"Oops... something went wrong. Please try again.\");\n }\n // If no wallets connected yet, it may be an embedded wallet (email login) that hasn't\n // appeared in the wallets array due to React state timing. Wait for it before\n // falling back to connectWallet() which shows an unwanted wallet selection modal.\n if (!((_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.wallets) || this.privyMethods.wallets.length === 0) {\n if (((_b = this.privyMethods) === null || _b === void 0 ? void 0 : _b.authenticated) && sessionAddress) {\n const matchedWallet = await this.waitForMatchingWallet(sessionAddress);\n if (!matchedWallet) {\n return new Promise((resolve, reject) => {\n this.pendingSignMessage = {\n resolve,\n reject,\n message\n };\n this.privyMethods.connectWallet();\n // Set a timeout to reject the promise if connection takes too long\n setTimeout(() => {\n if (this.pendingSignMessage) {\n this.pendingSignMessage.reject(new Error(\"Wallet connection timed out\"));\n this.pendingSignMessage = null;\n }\n }, 30000); // 30 seconds timeout\n });\n }\n }\n else {\n return new Promise((resolve, reject) => {\n this.pendingSignMessage = {\n resolve,\n reject,\n message\n };\n this.privyMethods.connectWallet();\n // Set a timeout to reject the promise if connection takes too long\n setTimeout(() => {\n if (this.pendingSignMessage) {\n this.pendingSignMessage.reject(new Error(\"Wallet connection timed out\"));\n this.pendingSignMessage = null;\n }\n }, 30000); // 30 seconds timeout\n });\n }\n }\n let privyWallet = this.privyMethods.wallets.find((wallet) => wallet.address === sessionAddress);\n if (!privyWallet) {\n // Session address is not a privy wallet, just default to the first wallet\n const accessToken = await this.privyMethods.getAccessToken();\n await this.createSession(this.privyMethods.wallets[0].address, accessToken, this.privyMethods.identityToken);\n setCurrentUser({ address: this.privyMethods.wallets[0].address, provider: this });\n const session = await SessionManager().getSession();\n sessionAddress = session === null || session === void 0 ? void 0 : session.address;\n if (!sessionAddress) {\n throw new Error('No wallet connected or logged in to sign message');\n }\n privyWallet = this.privyMethods.wallets[0];\n }\n // Use the Privy signMessage hook for Solana wallets\n // The message needs to be passed as a Uint8Array\n const messageBytes = getPlatform().textEncode(message);\n const result = await ((_c = this.privyMethods) === null || _c === void 0 ? void 0 : _c.signMessage({\n message: messageBytes,\n wallet: privyWallet,\n }));\n // The signature is returned as a Uint8Array, encode it as base58 (standard Solana format)\n const signatureBytes = (result === null || result === void 0 ? void 0 : result.signature) || result;\n const bs58 = await import('bs58');\n return bs58.default.encode(signatureBytes);\n }\n async restoreSession() {\n const session = await SessionManager().getSession();\n if (session) {\n return { provider: this, address: session.address };\n }\n else {\n return null;\n }\n }\n // NOTE: accessToken/idToken are accepted for backwards-compat with existing\n // call sites but are no longer used. The session is minted by having the Privy\n // Solana wallet SIGN the canonical SIWS challenge (the same wallet-signature\n // path Phantom/MWA/guest use), so the bounded /session issuer needs no\n // Privy-specific token verification — it arrives as a Solana signature and is\n // recorded server-side as authMethod 'phantom'.\n async createSession(address, _accessToken, _idToken) {\n var _a, _b, _c, _d, _e, _f, _g;\n // Resolve the Privy wallet for this address (fall back to the first wallet).\n const privyWallet = (_c = (_b = (_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.wallets) === null || _b === void 0 ? void 0 : _b.find((w) => w.address === address)) !== null && _c !== void 0 ? _c : (_e = (_d = this.privyMethods) === null || _d === void 0 ? void 0 : _d.wallets) === null || _e === void 0 ? void 0 : _e[0];\n if (!privyWallet) {\n throw new Error('No Privy Solana wallet available to mint a session.');\n }\n const nonce = await genAuthNonce();\n const message = await genSolanaMessage(address, nonce);\n const messageBytes = getPlatform().textEncode(message);\n // Low-level Privy sign hook — signs WITHOUT touching the session (the public\n // signMessage() bootstraps sessions, which would recurse here).\n const signResult = await ((_f = this.privyMethods) === null || _f === void 0 ? void 0 : _f.signMessage({\n message: messageBytes,\n wallet: privyWallet,\n }));\n const signatureBytes = (_g = signResult === null || signResult === void 0 ? void 0 : signResult.signature) !== null && _g !== void 0 ? _g : signResult;\n // base64-encoded detached signature (matches Phantom + guest providers).\n const signature = Buffer.from(signatureBytes).toString('base64');\n const createSessionResult = await createSessionWithSignature(address, message, signature);\n if (createSessionResult) {\n await SessionManager().storeSession(address, createSessionResult.accessToken, createSessionResult.idToken, createSessionResult.refreshToken);\n }\n }\n /**\n * Waits for a wallet matching the session address to appear in the wallets array.\n * This handles the timing gap where Privy's embedded wallet (created for email login users)\n * may not yet be in the useWallets() array when signTransaction is called immediately after login.\n */\n async waitForMatchingWallet(sessionAddress, timeoutMs = 10000) {\n var _a;\n const startTime = Date.now();\n while (Date.now() - startTime < timeoutMs) {\n const wallets = (_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.wallets;\n if (wallets && wallets.length > 0) {\n const wallet = wallets.find((w) => w.address === sessionAddress);\n if (wallet)\n return wallet;\n }\n await new Promise(resolve => setTimeout(resolve, 200));\n }\n return null;\n }\n async ensureReady({ waitForWallets = false, timeoutMs = 15000 } = {}) {\n const isReady = () => {\n var _a, _b;\n if (!((_a = this.privyMethods) === null || _a === void 0 ? void 0 : _a.ready))\n return false;\n if (waitForWallets && !((_b = this.privyMethods) === null || _b === void 0 ? void 0 : _b.walletReady))\n return false;\n return true;\n };\n if (isReady())\n return;\n return new Promise((resolve, reject) => {\n const startTime = Date.now();\n const check = () => {\n if (isReady()) {\n resolve();\n }\n else if (Date.now() - startTime > timeoutMs) {\n reject(new Error('Login provider failed to initialize. This can happen in incognito mode or when third-party cookies are blocked. Try using a regular browser window.'));\n }\n else {\n setTimeout(check, 100);\n }\n };\n check();\n });\n }\n}\nPrivyWalletProvider.instance = null;\n"],"names":["SessionManager","Buffer"],"mappings":";;;;;;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M,GAAG,MAAM,GAAG,EAAE,CAAC,WAAW,CAAC;AACjH,gBAAgB,OAAO,KAAK;AAC5B,YAAY,OAAO,IAAI;AACvB,QAAQ,CAAC;AACT,QAAQ,IAAI,OAAO,EAAE;AACrB,YAAY;AACZ,QAAQ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAChD,YAAY,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE;AACxC,YAAY,MAAM,KAAK,GAAG,MAAM;AAChC,gBAAgB,IAAI,OAAO,EAAE,EAAE;AAC/B,oBAAoB,OAAO,EAAE;AAC7B,gBAAgB;AAChB,qBAAqB,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE;AAC7D,oBAAoB,MAAM,CAAC,IAAI,KAAK,CAAC,qJAAqJ,CAAC,CAAC;AAC5L,gBAAgB;AAChB,qBAAqB;AACrB,oBAAoB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;AAC1C,gBAAgB;AAChB,YAAY,CAAC;AACb,YAAY,KAAK,EAAE;AACnB,QAAQ,CAAC,CAAC;AACV,IAAI;AACJ;AACA,mBAAmB,CAAC,QAAQ,GAAG,IAAI;;;;"}
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index_native = require('./index.native-Lrhg8G-G.js');
3
+ var index_native = require('./index.native-C-duG1XV.js');
4
4
  var web3_js = require('@solana/web3.js');
5
5
  var anchor = require('@coral-xyz/anchor');
6
- var kit = require('@solana/kit');
7
6
  var React = require('react');
8
7
  var ReactDOM = require('react-dom/client');
9
8
  require('axios');
@@ -49,6 +48,19 @@ async function loadPrivyModules() {
49
48
  import('@privy-io/react-auth/solana'),
50
49
  ]);
51
50
  }
51
+ // @solana/kit is an OPTIONAL wallet-only dep, used only to build the Privy
52
+ // Solana RPC transports. Loaded lazily (like the Privy SDKs) via dynamic
53
+ // import() rather than a static top-level import: a static import is hoisted by
54
+ // rollup into the entry chunk, forcing every consumer (including vanilla,
55
+ // non-wallet web apps) to have @solana/kit installed and eagerly require()d.
56
+ // Deferring it here keeps it out of the entry bundle.
57
+ let solanaKit;
58
+ async function loadSolanaKit() {
59
+ if (!solanaKit) {
60
+ solanaKit = await import('@solana/kit');
61
+ }
62
+ return solanaKit;
63
+ }
52
64
  const getDefaultPrivyConfig = () => ({
53
65
  appId: "cm4ve714908o27dk2yurpnfhd",
54
66
  config: {
@@ -70,6 +82,10 @@ class PrivyWalletProvider {
70
82
  this.root = null;
71
83
  this.privyMethods = null;
72
84
  this.pendingLogin = null;
85
+ // Resolved Solana RPC URLs (computed in the constructor; consumed in
86
+ // initialize() where @solana/kit is lazily loaded to build the transports).
87
+ this.rpcDevnetUrl = index_native.SOLANA_DEVNET_RPC_URL;
88
+ this.rpcMainnetUrl = index_native.SOLANA_MAINNET_RPC_URL;
73
89
  // This is used to store the pending transaction until the wallet is connected for workaround for the wallet not being connected after login completion
74
90
  this.pendingTransaction = null;
75
91
  // This is used to store pending signTransaction calls until the wallet is connected
@@ -100,32 +116,20 @@ class PrivyWalletProvider {
100
116
  }
101
117
  // (externalWallets connectors are configured in initialize() once the
102
118
  // Privy SDK is lazily loaded — see loadPrivyModules.)
103
- // Add Solana RPC configuration for v3
104
- let devnetUrl = index_native.SOLANA_DEVNET_RPC_URL;
105
- let mainnetUrl = index_native.SOLANA_MAINNET_RPC_URL;
119
+ // Resolve Solana RPC URLs for v3. The @solana/kit transports are built
120
+ // lazily in initialize() so a non-Privy consumer never needs @solana/kit.
121
+ this.rpcDevnetUrl = index_native.SOLANA_DEVNET_RPC_URL;
122
+ this.rpcMainnetUrl = index_native.SOLANA_MAINNET_RPC_URL;
106
123
  if (networkUrl != null) {
107
124
  if (networkUrl.includes('mainnet')) {
108
- mainnetUrl = networkUrl;
125
+ this.rpcMainnetUrl = networkUrl;
109
126
  this.chainId = 'solana:mainnet';
110
127
  }
111
128
  else if (networkUrl.includes('devnet')) {
112
- devnetUrl = networkUrl;
129
+ this.rpcDevnetUrl = networkUrl;
113
130
  this.chainId = 'solana:devnet';
114
131
  }
115
132
  }
116
- if (!this.privyConfig.config.solana) {
117
- this.privyConfig.config.solana = {};
118
- }
119
- this.privyConfig.config.solana.rpcs = {
120
- 'solana:devnet': {
121
- rpc: kit.createSolanaRpc(devnetUrl),
122
- rpcSubscriptions: kit.createSolanaRpcSubscriptions(devnetUrl.replace('https://', 'wss://'))
123
- },
124
- 'solana:mainnet': {
125
- rpc: kit.createSolanaRpc(mainnetUrl),
126
- rpcSubscriptions: kit.createSolanaRpcSubscriptions(mainnetUrl.replace('https://', 'wss://'))
127
- }
128
- };
129
133
  const existingProviders = document.querySelectorAll('[data-privy-provider]');
130
134
  existingProviders.forEach(el => el.remove());
131
135
  // Fire-and-forget: initialize() lazily loads the Privy SDK then renders
@@ -148,6 +152,22 @@ class PrivyWalletProvider {
148
152
  async initialize() {
149
153
  // Lazily load the Privy SDK (browser-only) before building the React tree.
150
154
  await loadPrivyModules();
155
+ // Build the Solana RPC transports now that we're on the async path, so
156
+ // @solana/kit can be lazily imported (kept out of the entry bundle).
157
+ const { createSolanaRpc, createSolanaRpcSubscriptions } = await loadSolanaKit();
158
+ if (!this.privyConfig.config.solana) {
159
+ this.privyConfig.config.solana = {};
160
+ }
161
+ this.privyConfig.config.solana.rpcs = {
162
+ 'solana:devnet': {
163
+ rpc: createSolanaRpc(this.rpcDevnetUrl),
164
+ rpcSubscriptions: createSolanaRpcSubscriptions(this.rpcDevnetUrl.replace('https://', 'wss://'))
165
+ },
166
+ 'solana:mainnet': {
167
+ rpc: createSolanaRpc(this.rpcMainnetUrl),
168
+ rpcSubscriptions: createSolanaRpcSubscriptions(this.rpcMainnetUrl.replace('https://', 'wss://'))
169
+ }
170
+ };
151
171
  // Ensure externalWallets connectors are always configured — required for
152
172
  // useWallets().ready to resolve even when no browser extension is present.
153
173
  if (!this.privyConfig.config.externalWallets && privySolana) {
@@ -779,7 +799,7 @@ class PrivyWalletProvider {
779
799
  // Handle case where signature might be bytes instead of string
780
800
  const rawSig = result.signature;
781
801
  if (rawSig instanceof Uint8Array || Array.isArray(rawSig)) {
782
- signature = index_native.bs582.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
802
+ signature = index_native.bs58.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
783
803
  }
784
804
  else {
785
805
  signature = rawSig;
@@ -861,7 +881,7 @@ class PrivyWalletProvider {
861
881
  }));
862
882
  // The signature is returned as a Uint8Array, encode it as base58 (standard Solana format)
863
883
  const signatureBytes = (result === null || result === void 0 ? void 0 : result.signature) || result;
864
- const bs58 = await Promise.resolve().then(function () { return require('./index.native-Lrhg8G-G.js'); }).then(function (n) { return n.index; });
884
+ const bs58 = await Promise.resolve().then(function () { return require('./index.native-C-duG1XV.js'); }).then(function (n) { return n.index; });
865
885
  return bs58.default.encode(signatureBytes);
866
886
  }
867
887
  async restoreSession() {
@@ -953,4 +973,4 @@ class PrivyWalletProvider {
953
973
  PrivyWalletProvider.instance = null;
954
974
 
955
975
  exports.PrivyWalletProvider = PrivyWalletProvider;
956
- //# sourceMappingURL=privy-wallet-provider-Dh_jHrsq.js.map
976
+ //# sourceMappingURL=privy-wallet-provider-wCTdqpRq.js.map