@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.
- package/dist/auth/providers/offchain-auth-provider.d.ts +2 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -181
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -180
- package/dist/index.mjs.map +1 -1
- package/dist/{index.native-DI_Xgv-n.js → index.native-BtM38BVP.js} +6 -185
- package/dist/index.native-BtM38BVP.js.map +1 -0
- package/dist/{index.native-DWI_i6-6.mjs → index.native-w12aoVNW.mjs} +7 -184
- package/dist/index.native-w12aoVNW.mjs.map +1 -0
- package/dist/index.native.d.ts +0 -1
- package/dist/index.native.js +1 -3
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{phantom-wallet-provider-fyOrJZP6.js → phantom-wallet-provider-BJWelaiH.js} +2 -2
- package/dist/{phantom-wallet-provider-fyOrJZP6.js.map → phantom-wallet-provider-BJWelaiH.js.map} +1 -1
- package/dist/{phantom-wallet-provider-DDwgNMg_.mjs → phantom-wallet-provider-BT2V4EU5.mjs} +2 -2
- package/dist/{phantom-wallet-provider-DDwgNMg_.mjs.map → phantom-wallet-provider-BT2V4EU5.mjs.map} +1 -1
- package/dist/{privy-wallet-provider-BIr9lDS7.js → privy-wallet-provider-BSh0aZVL.js} +3 -3
- package/dist/{privy-wallet-provider-BIr9lDS7.js.map → privy-wallet-provider-BSh0aZVL.js.map} +1 -1
- package/dist/{privy-wallet-provider-D7VoQCYf.mjs → privy-wallet-provider-LV1X7hZe.mjs} +3 -3
- package/dist/{privy-wallet-provider-D7VoQCYf.mjs.map → privy-wallet-provider-LV1X7hZe.mjs.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-Cush-URL.js → solana-mobile-wallet-provider-CKsfiyDd.js} +2 -2
- package/dist/{solana-mobile-wallet-provider-Cush-URL.js.map → solana-mobile-wallet-provider-CKsfiyDd.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-DgcGxDoL.mjs → solana-mobile-wallet-provider-NLe9_mEn.mjs} +2 -2
- package/dist/{solana-mobile-wallet-provider-DgcGxDoL.mjs.map → solana-mobile-wallet-provider-NLe9_mEn.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/auth/providers/mock-auth-provider.d.ts +0 -49
- package/dist/index.native-DI_Xgv-n.js.map +0 -1
- package/dist/index.native-DWI_i6-6.mjs.map +0 -1
|
@@ -178,142 +178,11 @@ function detectAndroid() {
|
|
|
178
178
|
return false;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// Default test wallet address (Solana devnet address)
|
|
182
|
-
const DEFAULT_TEST_ADDRESS = 'HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof';
|
|
183
|
-
// Session storage key to track if user explicitly called login()
|
|
184
|
-
const EXPLICIT_LOGIN_KEY = 'mock-auth-explicit-login';
|
|
185
|
-
/**
|
|
186
|
-
* MockAuthProvider bypasses real wallet authentication for testing purposes.
|
|
187
|
-
* Uses session storage to simulate logged-in user, with fallback to default test address.
|
|
188
|
-
*
|
|
189
|
-
* This is enabled by passing mockAuth: true to init()
|
|
190
|
-
*/
|
|
191
|
-
class MockAuthProvider {
|
|
192
|
-
/**
|
|
193
|
-
* Mock login - reads user from session storage or uses default test address
|
|
194
|
-
*/
|
|
195
|
-
async login() {
|
|
196
|
-
let address = getPlatform().sessionStorage.getItem('test-user-address');
|
|
197
|
-
if (!address) {
|
|
198
|
-
address = DEFAULT_TEST_ADDRESS;
|
|
199
|
-
// Store default address in session storage so it gets used in API calls
|
|
200
|
-
getPlatform().sessionStorage.setItem('test-user-address', DEFAULT_TEST_ADDRESS);
|
|
201
|
-
console.log('[MockAuth] Using default test address:', address);
|
|
202
|
-
}
|
|
203
|
-
// Mark that user explicitly called login() - allows restoreSession on refresh
|
|
204
|
-
getPlatform().sessionStorage.setItem(EXPLICIT_LOGIN_KEY, 'true');
|
|
205
|
-
console.log('[MockAuth] Mock login successful:', address);
|
|
206
|
-
return {
|
|
207
|
-
address,
|
|
208
|
-
provider: this
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Mock transaction - returns fake signature without actual blockchain interaction
|
|
213
|
-
* The real transaction will be handled by the backend using test headers
|
|
214
|
-
*/
|
|
215
|
-
async runTransaction(evmTransactionData, solTransactionData, options) {
|
|
216
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
|
|
217
|
-
// Generate a fake transaction signature
|
|
218
|
-
const fakeSignature = `mock_tx_${Math.random().toString(36).substring(2, 15)}`;
|
|
219
|
-
console.log('[MockAuth] Mock transaction executed:', {
|
|
220
|
-
address,
|
|
221
|
-
signature: fakeSignature,
|
|
222
|
-
evmTx: evmTransactionData,
|
|
223
|
-
solTx: solTransactionData
|
|
224
|
-
});
|
|
225
|
-
return {
|
|
226
|
-
transactionSignature: fakeSignature,
|
|
227
|
-
signedTransaction: fakeSignature,
|
|
228
|
-
blockNumber: 0,
|
|
229
|
-
gasUsed: '0'
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Mock message signing
|
|
234
|
-
*/
|
|
235
|
-
async signMessage(message) {
|
|
236
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
|
|
237
|
-
// Generate a fake signature
|
|
238
|
-
const fakeSignature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
|
|
239
|
-
console.log('[MockAuth] Mock message signed:', {
|
|
240
|
-
address,
|
|
241
|
-
message,
|
|
242
|
-
signature: fakeSignature
|
|
243
|
-
});
|
|
244
|
-
return fakeSignature;
|
|
245
|
-
}
|
|
246
|
-
async signMessageMock(message) {
|
|
247
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
|
|
248
|
-
const signature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
|
|
249
|
-
console.log('[MockAuth] Mock message signed:', {
|
|
250
|
-
address,
|
|
251
|
-
message,
|
|
252
|
-
signature
|
|
253
|
-
});
|
|
254
|
-
return signature;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Mock transaction signing - returns the transaction as-is (no actual signing)
|
|
258
|
-
*/
|
|
259
|
-
async signTransaction(transaction) {
|
|
260
|
-
console.log('[MockAuth] Mock transaction signing (no-op)');
|
|
261
|
-
return transaction;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Sign and submit transaction - not supported in mock environment.
|
|
265
|
-
* See the real providers (PhantomWalletProvider, SolanaKeypairProvider)
|
|
266
|
-
* for the full implementation with blockhash handling and feePayer support.
|
|
267
|
-
*/
|
|
268
|
-
async signAndSubmitTransaction(_transaction, _feePayer) {
|
|
269
|
-
throw new Error('signAndSubmitTransaction is not supported in the mock environment');
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Restore session - only restores if user previously called login() explicitly.
|
|
273
|
-
* This prevents auto-login on first page load, but allows session persistence after login.
|
|
274
|
-
*/
|
|
275
|
-
async restoreSession() {
|
|
276
|
-
const explicitlyLoggedIn = getPlatform().sessionStorage.getItem(EXPLICIT_LOGIN_KEY);
|
|
277
|
-
if (!explicitlyLoggedIn) {
|
|
278
|
-
console.log('[MockAuth] No explicit login found. Call login() to authenticate.');
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address');
|
|
282
|
-
if (!address) {
|
|
283
|
-
console.log('[MockAuth] No previous session found');
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
console.log('[MockAuth] Session restored:', address);
|
|
287
|
-
return {
|
|
288
|
-
address,
|
|
289
|
-
provider: this
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Mock logout - clears test user from session storage
|
|
294
|
-
*/
|
|
295
|
-
async logout() {
|
|
296
|
-
getPlatform().sessionStorage.removeItem('test-user-address');
|
|
297
|
-
getPlatform().sessionStorage.removeItem('test-user-id');
|
|
298
|
-
getPlatform().sessionStorage.removeItem(EXPLICIT_LOGIN_KEY);
|
|
299
|
-
console.log('[MockAuth] Mock logout successful');
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Get native wallet methods (not needed for mock auth)
|
|
303
|
-
*/
|
|
304
|
-
async getNativeMethods() {
|
|
305
|
-
return {
|
|
306
|
-
// Return empty object - no native methods needed for mock auth
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
181
|
/**
|
|
312
182
|
* OffchainAuthProvider wraps a real auth provider (e.g., Phantom) for the poofnet environment.
|
|
313
183
|
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* transaction message.
|
|
184
|
+
* signMessage shows a custom confirmation modal and then delegates to the wrapped
|
|
185
|
+
* provider for a real detached signature over the exact offchain transaction message.
|
|
317
186
|
*/
|
|
318
187
|
class OffchainAuthProvider {
|
|
319
188
|
constructor(wrappedProvider, config = {}) {
|
|
@@ -364,13 +233,7 @@ class OffchainAuthProvider {
|
|
|
364
233
|
}
|
|
365
234
|
// ============ signMessage delegates to wrapped provider ============
|
|
366
235
|
async signMessage(message) {
|
|
367
|
-
// Delegate to wrapped provider for real wallet signing
|
|
368
|
-
return this.wrappedProvider.signMessage(message);
|
|
369
|
-
}
|
|
370
|
-
// ============ Mock signMessage with Custom Modal for Offchain Transactions ============
|
|
371
|
-
async signMessageMock(message) {
|
|
372
236
|
var _a, _b, _c, _d, _e, _f;
|
|
373
|
-
// Callback: signing started
|
|
374
237
|
(_b = (_a = this.config).onSigningStart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
375
238
|
try {
|
|
376
239
|
// On RN (no DOM), auto-confirm — there's no modal to show.
|
|
@@ -387,7 +250,6 @@ class OffchainAuthProvider {
|
|
|
387
250
|
return signature;
|
|
388
251
|
}
|
|
389
252
|
catch (error) {
|
|
390
|
-
// Callback: signing error
|
|
391
253
|
(_f = (_e = this.config).onSigningError) === null || _f === void 0 ? void 0 : _f.call(_e, error);
|
|
392
254
|
throw error;
|
|
393
255
|
}
|
|
@@ -4627,17 +4489,17 @@ function clearIncompatibleSession() {
|
|
|
4627
4489
|
// Lazy loaders for web-only providers.
|
|
4628
4490
|
// Using dynamic import() ensures Metro (RN) never resolves these modules.
|
|
4629
4491
|
async function loadPhantomWalletProvider() {
|
|
4630
|
-
const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-
|
|
4492
|
+
const mod = await Promise.resolve().then(function () { return require('./phantom-wallet-provider-BJWelaiH.js'); });
|
|
4631
4493
|
return { PhantomWalletProvider: mod.PhantomWalletProvider };
|
|
4632
4494
|
}
|
|
4633
4495
|
// Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
|
|
4634
4496
|
// never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
|
|
4635
4497
|
async function loadPrivyWalletProvider() {
|
|
4636
|
-
const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-
|
|
4498
|
+
const mod = await Promise.resolve().then(function () { return require('./privy-wallet-provider-BSh0aZVL.js'); });
|
|
4637
4499
|
return mod.PrivyWalletProvider;
|
|
4638
4500
|
}
|
|
4639
4501
|
async function loadSolanaMobileWalletProvider() {
|
|
4640
|
-
const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-
|
|
4502
|
+
const mod = await Promise.resolve().then(function () { return require('./solana-mobile-wallet-provider-CKsfiyDd.js'); });
|
|
4641
4503
|
return mod.SolanaMobileWalletProvider;
|
|
4642
4504
|
}
|
|
4643
4505
|
function requireWebPrivyConfig(config) {
|
|
@@ -4683,38 +4545,6 @@ function requireMobileWalletConfig(config) {
|
|
|
4683
4545
|
}
|
|
4684
4546
|
return Object.assign(Object.assign({}, ((_c = config.mobileWalletConfig) !== null && _c !== void 0 ? _c : {})), { cluster });
|
|
4685
4547
|
}
|
|
4686
|
-
function isLocalOrTestUrl(value) {
|
|
4687
|
-
if (!value)
|
|
4688
|
-
return false;
|
|
4689
|
-
try {
|
|
4690
|
-
const hostname = new URL(value).hostname.toLowerCase();
|
|
4691
|
-
return hostname === 'localhost' ||
|
|
4692
|
-
hostname === '127.0.0.1' ||
|
|
4693
|
-
hostname === '::1' ||
|
|
4694
|
-
hostname.endsWith('.localhost') ||
|
|
4695
|
-
hostname.endsWith('.test');
|
|
4696
|
-
}
|
|
4697
|
-
catch (_a) {
|
|
4698
|
-
return false;
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
function assertMockAuthLocalOnly(config) {
|
|
4702
|
-
const requiredEndpoints = [
|
|
4703
|
-
config.apiUrl,
|
|
4704
|
-
config.wsApiUrl,
|
|
4705
|
-
config.authApiUrl,
|
|
4706
|
-
];
|
|
4707
|
-
const optionalEndpoints = [
|
|
4708
|
-
config.rpcUrl,
|
|
4709
|
-
config.humanAuthApiUrl,
|
|
4710
|
-
config.functionsUrl,
|
|
4711
|
-
].filter((value) => typeof value === 'string' && value.trim() !== '');
|
|
4712
|
-
if (requiredEndpoints.every(isLocalOrTestUrl) && optionalEndpoints.every(isLocalOrTestUrl)) {
|
|
4713
|
-
return;
|
|
4714
|
-
}
|
|
4715
|
-
throw new Error("mockAuth is local/test-only. Pass explicit localhost/.test apiUrl, wsApiUrl, and authApiUrl values; " +
|
|
4716
|
-
"mockAuth cannot be used with Bounded production or staging endpoints.");
|
|
4717
|
-
}
|
|
4718
4548
|
async function hotSwapToMWAProvider(config) {
|
|
4719
4549
|
var _a;
|
|
4720
4550
|
const rpcUrl = normalizeSolanaRpcUrl(config.rpcUrl);
|
|
@@ -4756,13 +4586,6 @@ async function getAuthProvider(config) {
|
|
|
4756
4586
|
throw new Error("Config is required to initialize auth provider");
|
|
4757
4587
|
}
|
|
4758
4588
|
initConfig = config;
|
|
4759
|
-
// If mockAuth is enabled, use MockAuthProvider regardless of authMethod
|
|
4760
|
-
if (config.mockAuth) {
|
|
4761
|
-
assertMockAuthLocalOnly(config);
|
|
4762
|
-
console.log("[MockAuth] Mock authentication enabled");
|
|
4763
|
-
currentAuthProvider = new MockAuthProvider();
|
|
4764
|
-
return currentAuthProvider;
|
|
4765
|
-
}
|
|
4766
4589
|
const authMethod = config.authMethod;
|
|
4767
4590
|
if (!authMethod) {
|
|
4768
4591
|
throw new Error("authMethod is required to initialize auth provider; configure the single intended auth method explicitly.");
|
|
@@ -5705,8 +5528,6 @@ class PrivyExpoProvider {
|
|
|
5705
5528
|
}
|
|
5706
5529
|
}
|
|
5707
5530
|
|
|
5708
|
-
exports.DEFAULT_TEST_ADDRESS = DEFAULT_TEST_ADDRESS;
|
|
5709
|
-
exports.MockAuthProvider = MockAuthProvider;
|
|
5710
5531
|
exports.OffchainAuthProvider = OffchainAuthProvider;
|
|
5711
5532
|
exports.PrivyExpoProvider = PrivyExpoProvider;
|
|
5712
5533
|
exports.SURFNET_RPC_URL = SURFNET_RPC_URL;
|
|
@@ -5746,4 +5567,4 @@ exports.signInAnonymously = signInAnonymously;
|
|
|
5746
5567
|
exports.useAuth = useAuth;
|
|
5747
5568
|
exports.verifyEmailOtp = verifyEmailOtp;
|
|
5748
5569
|
exports.verifyTextOtp = verifyTextOtp;
|
|
5749
|
-
//# sourceMappingURL=index.native-
|
|
5570
|
+
//# sourceMappingURL=index.native-BtM38BVP.js.map
|