@bounded-sh/client 0.0.19 → 0.0.20

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 (30) hide show
  1. package/dist/auth/providers/offchain-auth-provider.d.ts +2 -4
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +2 -181
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +3 -180
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/{index.native-DI_Xgv-n.js → index.native-BtM38BVP.js} +6 -185
  8. package/dist/index.native-BtM38BVP.js.map +1 -0
  9. package/dist/{index.native-DWI_i6-6.mjs → index.native-w12aoVNW.mjs} +7 -184
  10. package/dist/index.native-w12aoVNW.mjs.map +1 -0
  11. package/dist/index.native.d.ts +0 -1
  12. package/dist/index.native.js +1 -3
  13. package/dist/index.native.js.map +1 -1
  14. package/dist/index.native.mjs +1 -1
  15. package/dist/{phantom-wallet-provider-fyOrJZP6.js → phantom-wallet-provider-BJWelaiH.js} +2 -2
  16. package/dist/{phantom-wallet-provider-fyOrJZP6.js.map → phantom-wallet-provider-BJWelaiH.js.map} +1 -1
  17. package/dist/{phantom-wallet-provider-DDwgNMg_.mjs → phantom-wallet-provider-BT2V4EU5.mjs} +2 -2
  18. package/dist/{phantom-wallet-provider-DDwgNMg_.mjs.map → phantom-wallet-provider-BT2V4EU5.mjs.map} +1 -1
  19. package/dist/{privy-wallet-provider-BIr9lDS7.js → privy-wallet-provider-BSh0aZVL.js} +3 -3
  20. package/dist/{privy-wallet-provider-BIr9lDS7.js.map → privy-wallet-provider-BSh0aZVL.js.map} +1 -1
  21. package/dist/{privy-wallet-provider-D7VoQCYf.mjs → privy-wallet-provider-LV1X7hZe.mjs} +3 -3
  22. package/dist/{privy-wallet-provider-D7VoQCYf.mjs.map → privy-wallet-provider-LV1X7hZe.mjs.map} +1 -1
  23. package/dist/{solana-mobile-wallet-provider-Cush-URL.js → solana-mobile-wallet-provider-CKsfiyDd.js} +2 -2
  24. package/dist/{solana-mobile-wallet-provider-Cush-URL.js.map → solana-mobile-wallet-provider-CKsfiyDd.js.map} +1 -1
  25. package/dist/{solana-mobile-wallet-provider-DgcGxDoL.mjs → solana-mobile-wallet-provider-NLe9_mEn.mjs} +2 -2
  26. package/dist/{solana-mobile-wallet-provider-DgcGxDoL.mjs.map → solana-mobile-wallet-provider-NLe9_mEn.mjs.map} +1 -1
  27. package/package.json +2 -2
  28. package/dist/auth/providers/mock-auth-provider.d.ts +0 -49
  29. package/dist/index.native-DI_Xgv-n.js.map +0 -1
  30. package/dist/index.native-DWI_i6-6.mjs.map +0 -1
@@ -9,9 +9,8 @@ export interface OffchainAuthProviderConfig {
9
9
  /**
10
10
  * OffchainAuthProvider wraps a real auth provider (e.g., Phantom) for the poofnet environment.
11
11
  *
12
- * For signMessageMock, this shows a custom confirmation modal and then delegates
13
- * to the wrapped provider for a real detached signature over the exact offchain
14
- * transaction message.
12
+ * signMessage shows a custom confirmation modal and then delegates to the wrapped
13
+ * provider for a real detached signature over the exact offchain transaction message.
15
14
  */
16
15
  export declare class OffchainAuthProvider implements AuthProvider {
17
16
  private wrappedProvider;
@@ -31,7 +30,6 @@ export declare class OffchainAuthProvider implements AuthProvider {
31
30
  signAndSubmitTransaction(_transaction: Transaction | VersionedTransaction, _feePayer?: any): Promise<string>;
32
31
  getNativeMethods(): Promise<any>;
33
32
  signMessage(message: string): Promise<string>;
34
- signMessageMock(message: string): Promise<string>;
35
33
  private showUnsupportedTransactionModal;
36
34
  private showTransactionModal;
37
35
  private closeModal;
package/dist/index.d.ts CHANGED
@@ -16,7 +16,6 @@ export { getIdToken } from "./utils";
16
16
  export { setPlatform, getPlatform } from "./platform";
17
17
  export type { PlatformAdapter, StorageAdapter } from "./platform";
18
18
  export { PhantomWalletProvider, PhantomWalletConfig, PhantomProviderType, } from "./auth/providers/phantom-wallet-provider";
19
- export { MockAuthProvider, DEFAULT_TEST_ADDRESS, } from "./auth/providers/mock-auth-provider";
20
19
  export { OffchainAuthProvider, OffchainAuthProviderConfig, } from "./auth/providers/offchain-auth-provider";
21
20
  export { SolanaMobileWalletProvider, SolanaMobileWalletConfig, isMobileWalletAvailable, registerMobileWalletAdapter, } from "./auth/providers/solana-mobile-wallet-provider";
22
21
  export { PrivyWalletProvider } from "./auth/providers/privy-wallet-provider";
package/dist/index.js CHANGED
@@ -180,142 +180,11 @@ function detectAndroid() {
180
180
  return false;
181
181
  }
182
182
 
183
- // Default test wallet address (Solana devnet address)
184
- const DEFAULT_TEST_ADDRESS = 'HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof';
185
- // Session storage key to track if user explicitly called login()
186
- const EXPLICIT_LOGIN_KEY = 'mock-auth-explicit-login';
187
- /**
188
- * MockAuthProvider bypasses real wallet authentication for testing purposes.
189
- * Uses session storage to simulate logged-in user, with fallback to default test address.
190
- *
191
- * This is enabled by passing mockAuth: true to init()
192
- */
193
- class MockAuthProvider {
194
- /**
195
- * Mock login - reads user from session storage or uses default test address
196
- */
197
- async login() {
198
- let address = getPlatform().sessionStorage.getItem('test-user-address');
199
- if (!address) {
200
- address = DEFAULT_TEST_ADDRESS;
201
- // Store default address in session storage so it gets used in API calls
202
- getPlatform().sessionStorage.setItem('test-user-address', DEFAULT_TEST_ADDRESS);
203
- console.log('[MockAuth] Using default test address:', address);
204
- }
205
- // Mark that user explicitly called login() - allows restoreSession on refresh
206
- getPlatform().sessionStorage.setItem(EXPLICIT_LOGIN_KEY, 'true');
207
- console.log('[MockAuth] Mock login successful:', address);
208
- return {
209
- address,
210
- provider: this
211
- };
212
- }
213
- /**
214
- * Mock transaction - returns fake signature without actual blockchain interaction
215
- * The real transaction will be handled by the backend using test headers
216
- */
217
- async runTransaction(evmTransactionData, solTransactionData, options) {
218
- const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
219
- // Generate a fake transaction signature
220
- const fakeSignature = `mock_tx_${Math.random().toString(36).substring(2, 15)}`;
221
- console.log('[MockAuth] Mock transaction executed:', {
222
- address,
223
- signature: fakeSignature,
224
- evmTx: evmTransactionData,
225
- solTx: solTransactionData
226
- });
227
- return {
228
- transactionSignature: fakeSignature,
229
- signedTransaction: fakeSignature,
230
- blockNumber: 0,
231
- gasUsed: '0'
232
- };
233
- }
234
- /**
235
- * Mock message signing
236
- */
237
- async signMessage(message) {
238
- const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
239
- // Generate a fake signature
240
- const fakeSignature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
241
- console.log('[MockAuth] Mock message signed:', {
242
- address,
243
- message,
244
- signature: fakeSignature
245
- });
246
- return fakeSignature;
247
- }
248
- async signMessageMock(message) {
249
- const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
250
- const signature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
251
- console.log('[MockAuth] Mock message signed:', {
252
- address,
253
- message,
254
- signature
255
- });
256
- return signature;
257
- }
258
- /**
259
- * Mock transaction signing - returns the transaction as-is (no actual signing)
260
- */
261
- async signTransaction(transaction) {
262
- console.log('[MockAuth] Mock transaction signing (no-op)');
263
- return transaction;
264
- }
265
- /**
266
- * Sign and submit transaction - not supported in mock environment.
267
- * See the real providers (PhantomWalletProvider, SolanaKeypairProvider)
268
- * for the full implementation with blockhash handling and feePayer support.
269
- */
270
- async signAndSubmitTransaction(_transaction, _feePayer) {
271
- throw new Error('signAndSubmitTransaction is not supported in the mock environment');
272
- }
273
- /**
274
- * Restore session - only restores if user previously called login() explicitly.
275
- * This prevents auto-login on first page load, but allows session persistence after login.
276
- */
277
- async restoreSession() {
278
- const explicitlyLoggedIn = getPlatform().sessionStorage.getItem(EXPLICIT_LOGIN_KEY);
279
- if (!explicitlyLoggedIn) {
280
- console.log('[MockAuth] No explicit login found. Call login() to authenticate.');
281
- return null;
282
- }
283
- const address = getPlatform().sessionStorage.getItem('test-user-address');
284
- if (!address) {
285
- console.log('[MockAuth] No previous session found');
286
- return null;
287
- }
288
- console.log('[MockAuth] Session restored:', address);
289
- return {
290
- address,
291
- provider: this
292
- };
293
- }
294
- /**
295
- * Mock logout - clears test user from session storage
296
- */
297
- async logout() {
298
- getPlatform().sessionStorage.removeItem('test-user-address');
299
- getPlatform().sessionStorage.removeItem('test-user-id');
300
- getPlatform().sessionStorage.removeItem(EXPLICIT_LOGIN_KEY);
301
- console.log('[MockAuth] Mock logout successful');
302
- }
303
- /**
304
- * Get native wallet methods (not needed for mock auth)
305
- */
306
- async getNativeMethods() {
307
- return {
308
- // Return empty object - no native methods needed for mock auth
309
- };
310
- }
311
- }
312
-
313
183
  /**
314
184
  * OffchainAuthProvider wraps a real auth provider (e.g., Phantom) for the poofnet environment.
315
185
  *
316
- * For signMessageMock, this shows a custom confirmation modal and then delegates
317
- * to the wrapped provider for a real detached signature over the exact offchain
318
- * transaction message.
186
+ * signMessage shows a custom confirmation modal and then delegates to the wrapped
187
+ * provider for a real detached signature over the exact offchain transaction message.
319
188
  */
320
189
  class OffchainAuthProvider {
321
190
  constructor(wrappedProvider, config = {}) {
@@ -366,13 +235,7 @@ class OffchainAuthProvider {
366
235
  }
367
236
  // ============ signMessage delegates to wrapped provider ============
368
237
  async signMessage(message) {
369
- // Delegate to wrapped provider for real wallet signing
370
- return this.wrappedProvider.signMessage(message);
371
- }
372
- // ============ Mock signMessage with Custom Modal for Offchain Transactions ============
373
- async signMessageMock(message) {
374
238
  var _a, _b, _c, _d, _e, _f;
375
- // Callback: signing started
376
239
  (_b = (_a = this.config).onSigningStart) === null || _b === void 0 ? void 0 : _b.call(_a);
377
240
  try {
378
241
  // On RN (no DOM), auto-confirm — there's no modal to show.
@@ -389,7 +252,6 @@ class OffchainAuthProvider {
389
252
  return signature;
390
253
  }
391
254
  catch (error) {
392
- // Callback: signing error
393
255
  (_f = (_e = this.config).onSigningError) === null || _f === void 0 ? void 0 : _f.call(_e, error);
394
256
  throw error;
395
257
  }
@@ -4685,38 +4547,6 @@ function requireMobileWalletConfig(config) {
4685
4547
  }
4686
4548
  return Object.assign(Object.assign({}, ((_c = config.mobileWalletConfig) !== null && _c !== void 0 ? _c : {})), { cluster });
4687
4549
  }
4688
- function isLocalOrTestUrl(value) {
4689
- if (!value)
4690
- return false;
4691
- try {
4692
- const hostname = new URL(value).hostname.toLowerCase();
4693
- return hostname === 'localhost' ||
4694
- hostname === '127.0.0.1' ||
4695
- hostname === '::1' ||
4696
- hostname.endsWith('.localhost') ||
4697
- hostname.endsWith('.test');
4698
- }
4699
- catch (_a) {
4700
- return false;
4701
- }
4702
- }
4703
- function assertMockAuthLocalOnly(config) {
4704
- const requiredEndpoints = [
4705
- config.apiUrl,
4706
- config.wsApiUrl,
4707
- config.authApiUrl,
4708
- ];
4709
- const optionalEndpoints = [
4710
- config.rpcUrl,
4711
- config.humanAuthApiUrl,
4712
- config.functionsUrl,
4713
- ].filter((value) => typeof value === 'string' && value.trim() !== '');
4714
- if (requiredEndpoints.every(isLocalOrTestUrl) && optionalEndpoints.every(isLocalOrTestUrl)) {
4715
- return;
4716
- }
4717
- throw new Error("mockAuth is local/test-only. Pass explicit localhost/.test apiUrl, wsApiUrl, and authApiUrl values; " +
4718
- "mockAuth cannot be used with Bounded production or staging endpoints.");
4719
- }
4720
4550
  async function hotSwapToMWAProvider(config) {
4721
4551
  var _a;
4722
4552
  const rpcUrl = normalizeSolanaRpcUrl(config.rpcUrl);
@@ -4758,13 +4588,6 @@ async function getAuthProvider(config) {
4758
4588
  throw new Error("Config is required to initialize auth provider");
4759
4589
  }
4760
4590
  initConfig = config;
4761
- // If mockAuth is enabled, use MockAuthProvider regardless of authMethod
4762
- if (config.mockAuth) {
4763
- assertMockAuthLocalOnly(config);
4764
- console.log("[MockAuth] Mock authentication enabled");
4765
- currentAuthProvider = new MockAuthProvider();
4766
- return currentAuthProvider;
4767
- }
4768
4591
  const authMethod = config.authMethod;
4769
4592
  if (!authMethod) {
4770
4593
  throw new Error("authMethod is required to initialize auth provider; configure the single intended auth method explicitly.");
@@ -9727,8 +9550,6 @@ Object.defineProperty(exports, "subscribe", {
9727
9550
  enumerable: true,
9728
9551
  get: function () { return core.subscribe; }
9729
9552
  });
9730
- exports.DEFAULT_TEST_ADDRESS = DEFAULT_TEST_ADDRESS;
9731
- exports.MockAuthProvider = MockAuthProvider;
9732
9553
  exports.OffchainAuthProvider = OffchainAuthProvider;
9733
9554
  exports.PhantomWalletProvider = PhantomWalletProvider;
9734
9555
  exports.PrivyExpoProvider = PrivyExpoProvider;