@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
|
@@ -156,142 +156,11 @@ function detectAndroid() {
|
|
|
156
156
|
return false;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
// Default test wallet address (Solana devnet address)
|
|
160
|
-
const DEFAULT_TEST_ADDRESS = 'HKbZbRR7jWWR5VRN8KFjvTCHEzJQgameYxKQxh2gPoof';
|
|
161
|
-
// Session storage key to track if user explicitly called login()
|
|
162
|
-
const EXPLICIT_LOGIN_KEY = 'mock-auth-explicit-login';
|
|
163
|
-
/**
|
|
164
|
-
* MockAuthProvider bypasses real wallet authentication for testing purposes.
|
|
165
|
-
* Uses session storage to simulate logged-in user, with fallback to default test address.
|
|
166
|
-
*
|
|
167
|
-
* This is enabled by passing mockAuth: true to init()
|
|
168
|
-
*/
|
|
169
|
-
class MockAuthProvider {
|
|
170
|
-
/**
|
|
171
|
-
* Mock login - reads user from session storage or uses default test address
|
|
172
|
-
*/
|
|
173
|
-
async login() {
|
|
174
|
-
let address = getPlatform().sessionStorage.getItem('test-user-address');
|
|
175
|
-
if (!address) {
|
|
176
|
-
address = DEFAULT_TEST_ADDRESS;
|
|
177
|
-
// Store default address in session storage so it gets used in API calls
|
|
178
|
-
getPlatform().sessionStorage.setItem('test-user-address', DEFAULT_TEST_ADDRESS);
|
|
179
|
-
console.log('[MockAuth] Using default test address:', address);
|
|
180
|
-
}
|
|
181
|
-
// Mark that user explicitly called login() - allows restoreSession on refresh
|
|
182
|
-
getPlatform().sessionStorage.setItem(EXPLICIT_LOGIN_KEY, 'true');
|
|
183
|
-
console.log('[MockAuth] Mock login successful:', address);
|
|
184
|
-
return {
|
|
185
|
-
address,
|
|
186
|
-
provider: this
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Mock transaction - returns fake signature without actual blockchain interaction
|
|
191
|
-
* The real transaction will be handled by the backend using test headers
|
|
192
|
-
*/
|
|
193
|
-
async runTransaction(evmTransactionData, solTransactionData, options) {
|
|
194
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
|
|
195
|
-
// Generate a fake transaction signature
|
|
196
|
-
const fakeSignature = `mock_tx_${Math.random().toString(36).substring(2, 15)}`;
|
|
197
|
-
console.log('[MockAuth] Mock transaction executed:', {
|
|
198
|
-
address,
|
|
199
|
-
signature: fakeSignature,
|
|
200
|
-
evmTx: evmTransactionData,
|
|
201
|
-
solTx: solTransactionData
|
|
202
|
-
});
|
|
203
|
-
return {
|
|
204
|
-
transactionSignature: fakeSignature,
|
|
205
|
-
signedTransaction: fakeSignature,
|
|
206
|
-
blockNumber: 0,
|
|
207
|
-
gasUsed: '0'
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Mock message signing
|
|
212
|
-
*/
|
|
213
|
-
async signMessage(message) {
|
|
214
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
|
|
215
|
-
// Generate a fake signature
|
|
216
|
-
const fakeSignature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
|
|
217
|
-
console.log('[MockAuth] Mock message signed:', {
|
|
218
|
-
address,
|
|
219
|
-
message,
|
|
220
|
-
signature: fakeSignature
|
|
221
|
-
});
|
|
222
|
-
return fakeSignature;
|
|
223
|
-
}
|
|
224
|
-
async signMessageMock(message) {
|
|
225
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address') || DEFAULT_TEST_ADDRESS;
|
|
226
|
-
const signature = `mock_sig_${Math.random().toString(36).substring(2, 15)}`;
|
|
227
|
-
console.log('[MockAuth] Mock message signed:', {
|
|
228
|
-
address,
|
|
229
|
-
message,
|
|
230
|
-
signature
|
|
231
|
-
});
|
|
232
|
-
return signature;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Mock transaction signing - returns the transaction as-is (no actual signing)
|
|
236
|
-
*/
|
|
237
|
-
async signTransaction(transaction) {
|
|
238
|
-
console.log('[MockAuth] Mock transaction signing (no-op)');
|
|
239
|
-
return transaction;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Sign and submit transaction - not supported in mock environment.
|
|
243
|
-
* See the real providers (PhantomWalletProvider, SolanaKeypairProvider)
|
|
244
|
-
* for the full implementation with blockhash handling and feePayer support.
|
|
245
|
-
*/
|
|
246
|
-
async signAndSubmitTransaction(_transaction, _feePayer) {
|
|
247
|
-
throw new Error('signAndSubmitTransaction is not supported in the mock environment');
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Restore session - only restores if user previously called login() explicitly.
|
|
251
|
-
* This prevents auto-login on first page load, but allows session persistence after login.
|
|
252
|
-
*/
|
|
253
|
-
async restoreSession() {
|
|
254
|
-
const explicitlyLoggedIn = getPlatform().sessionStorage.getItem(EXPLICIT_LOGIN_KEY);
|
|
255
|
-
if (!explicitlyLoggedIn) {
|
|
256
|
-
console.log('[MockAuth] No explicit login found. Call login() to authenticate.');
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
const address = getPlatform().sessionStorage.getItem('test-user-address');
|
|
260
|
-
if (!address) {
|
|
261
|
-
console.log('[MockAuth] No previous session found');
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
console.log('[MockAuth] Session restored:', address);
|
|
265
|
-
return {
|
|
266
|
-
address,
|
|
267
|
-
provider: this
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Mock logout - clears test user from session storage
|
|
272
|
-
*/
|
|
273
|
-
async logout() {
|
|
274
|
-
getPlatform().sessionStorage.removeItem('test-user-address');
|
|
275
|
-
getPlatform().sessionStorage.removeItem('test-user-id');
|
|
276
|
-
getPlatform().sessionStorage.removeItem(EXPLICIT_LOGIN_KEY);
|
|
277
|
-
console.log('[MockAuth] Mock logout successful');
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Get native wallet methods (not needed for mock auth)
|
|
281
|
-
*/
|
|
282
|
-
async getNativeMethods() {
|
|
283
|
-
return {
|
|
284
|
-
// Return empty object - no native methods needed for mock auth
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
159
|
/**
|
|
290
160
|
* OffchainAuthProvider wraps a real auth provider (e.g., Phantom) for the poofnet environment.
|
|
291
161
|
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* transaction message.
|
|
162
|
+
* signMessage shows a custom confirmation modal and then delegates to the wrapped
|
|
163
|
+
* provider for a real detached signature over the exact offchain transaction message.
|
|
295
164
|
*/
|
|
296
165
|
class OffchainAuthProvider {
|
|
297
166
|
constructor(wrappedProvider, config = {}) {
|
|
@@ -342,13 +211,7 @@ class OffchainAuthProvider {
|
|
|
342
211
|
}
|
|
343
212
|
// ============ signMessage delegates to wrapped provider ============
|
|
344
213
|
async signMessage(message) {
|
|
345
|
-
// Delegate to wrapped provider for real wallet signing
|
|
346
|
-
return this.wrappedProvider.signMessage(message);
|
|
347
|
-
}
|
|
348
|
-
// ============ Mock signMessage with Custom Modal for Offchain Transactions ============
|
|
349
|
-
async signMessageMock(message) {
|
|
350
214
|
var _a, _b, _c, _d, _e, _f;
|
|
351
|
-
// Callback: signing started
|
|
352
215
|
(_b = (_a = this.config).onSigningStart) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
353
216
|
try {
|
|
354
217
|
// On RN (no DOM), auto-confirm — there's no modal to show.
|
|
@@ -365,7 +228,6 @@ class OffchainAuthProvider {
|
|
|
365
228
|
return signature;
|
|
366
229
|
}
|
|
367
230
|
catch (error) {
|
|
368
|
-
// Callback: signing error
|
|
369
231
|
(_f = (_e = this.config).onSigningError) === null || _f === void 0 ? void 0 : _f.call(_e, error);
|
|
370
232
|
throw error;
|
|
371
233
|
}
|
|
@@ -4605,17 +4467,17 @@ function clearIncompatibleSession() {
|
|
|
4605
4467
|
// Lazy loaders for web-only providers.
|
|
4606
4468
|
// Using dynamic import() ensures Metro (RN) never resolves these modules.
|
|
4607
4469
|
async function loadPhantomWalletProvider() {
|
|
4608
|
-
const mod = await import('./phantom-wallet-provider-
|
|
4470
|
+
const mod = await import('./phantom-wallet-provider-BT2V4EU5.mjs');
|
|
4609
4471
|
return { PhantomWalletProvider: mod.PhantomWalletProvider };
|
|
4610
4472
|
}
|
|
4611
4473
|
// Web Privy provider (depends on react-dom + @privy-io/react-auth). Lazy so Metro
|
|
4612
4474
|
// never bundles it into the RN build — RN uses the @privy-io/expo provider instead.
|
|
4613
4475
|
async function loadPrivyWalletProvider() {
|
|
4614
|
-
const mod = await import('./privy-wallet-provider-
|
|
4476
|
+
const mod = await import('./privy-wallet-provider-LV1X7hZe.mjs');
|
|
4615
4477
|
return mod.PrivyWalletProvider;
|
|
4616
4478
|
}
|
|
4617
4479
|
async function loadSolanaMobileWalletProvider() {
|
|
4618
|
-
const mod = await import('./solana-mobile-wallet-provider-
|
|
4480
|
+
const mod = await import('./solana-mobile-wallet-provider-NLe9_mEn.mjs');
|
|
4619
4481
|
return mod.SolanaMobileWalletProvider;
|
|
4620
4482
|
}
|
|
4621
4483
|
function requireWebPrivyConfig(config) {
|
|
@@ -4661,38 +4523,6 @@ function requireMobileWalletConfig(config) {
|
|
|
4661
4523
|
}
|
|
4662
4524
|
return Object.assign(Object.assign({}, ((_c = config.mobileWalletConfig) !== null && _c !== void 0 ? _c : {})), { cluster });
|
|
4663
4525
|
}
|
|
4664
|
-
function isLocalOrTestUrl(value) {
|
|
4665
|
-
if (!value)
|
|
4666
|
-
return false;
|
|
4667
|
-
try {
|
|
4668
|
-
const hostname = new URL(value).hostname.toLowerCase();
|
|
4669
|
-
return hostname === 'localhost' ||
|
|
4670
|
-
hostname === '127.0.0.1' ||
|
|
4671
|
-
hostname === '::1' ||
|
|
4672
|
-
hostname.endsWith('.localhost') ||
|
|
4673
|
-
hostname.endsWith('.test');
|
|
4674
|
-
}
|
|
4675
|
-
catch (_a) {
|
|
4676
|
-
return false;
|
|
4677
|
-
}
|
|
4678
|
-
}
|
|
4679
|
-
function assertMockAuthLocalOnly(config) {
|
|
4680
|
-
const requiredEndpoints = [
|
|
4681
|
-
config.apiUrl,
|
|
4682
|
-
config.wsApiUrl,
|
|
4683
|
-
config.authApiUrl,
|
|
4684
|
-
];
|
|
4685
|
-
const optionalEndpoints = [
|
|
4686
|
-
config.rpcUrl,
|
|
4687
|
-
config.humanAuthApiUrl,
|
|
4688
|
-
config.functionsUrl,
|
|
4689
|
-
].filter((value) => typeof value === 'string' && value.trim() !== '');
|
|
4690
|
-
if (requiredEndpoints.every(isLocalOrTestUrl) && optionalEndpoints.every(isLocalOrTestUrl)) {
|
|
4691
|
-
return;
|
|
4692
|
-
}
|
|
4693
|
-
throw new Error("mockAuth is local/test-only. Pass explicit localhost/.test apiUrl, wsApiUrl, and authApiUrl values; " +
|
|
4694
|
-
"mockAuth cannot be used with Bounded production or staging endpoints.");
|
|
4695
|
-
}
|
|
4696
4526
|
async function hotSwapToMWAProvider(config) {
|
|
4697
4527
|
var _a;
|
|
4698
4528
|
const rpcUrl = normalizeSolanaRpcUrl(config.rpcUrl);
|
|
@@ -4734,13 +4564,6 @@ async function getAuthProvider(config) {
|
|
|
4734
4564
|
throw new Error("Config is required to initialize auth provider");
|
|
4735
4565
|
}
|
|
4736
4566
|
initConfig = config;
|
|
4737
|
-
// If mockAuth is enabled, use MockAuthProvider regardless of authMethod
|
|
4738
|
-
if (config.mockAuth) {
|
|
4739
|
-
assertMockAuthLocalOnly(config);
|
|
4740
|
-
console.log("[MockAuth] Mock authentication enabled");
|
|
4741
|
-
currentAuthProvider = new MockAuthProvider();
|
|
4742
|
-
return currentAuthProvider;
|
|
4743
|
-
}
|
|
4744
4567
|
const authMethod = config.authMethod;
|
|
4745
4568
|
if (!authMethod) {
|
|
4746
4569
|
throw new Error("authMethod is required to initialize auth provider; configure the single intended auth method explicitly.");
|
|
@@ -5683,5 +5506,5 @@ class PrivyExpoProvider {
|
|
|
5683
5506
|
}
|
|
5684
5507
|
}
|
|
5685
5508
|
|
|
5686
|
-
export { loginWithRedirect as A, linkWithRedirect as B, completeLoginFromRedirect as C, loginWithPopup as D, completeLoginInPopup as E, useAuth as F, deserializeTransaction as G, getIdToken as H, setPlatform as I,
|
|
5687
|
-
//# sourceMappingURL=index.native-
|
|
5509
|
+
export { loginWithRedirect as A, linkWithRedirect as B, completeLoginFromRedirect as C, loginWithPopup as D, completeLoginInPopup as E, useAuth as F, deserializeTransaction as G, getIdToken as H, setPlatform as I, index as J, OffchainAuthProvider as O, PrivyExpoProvider as P, SURFNET_RPC_URL as S, detectAndroid as a, bufferExports as b, confirmAndCheckTransaction as c, detectMobile as d, setAuthLoading as e, resolveSolanaWalletStandardChain as f, getPlatform as g, bs58 as h, init as i, getCurrentUser as j, onAuthLoadingChanged as k, getAuthLoading as l, login as m, normalizeSolanaRpcUrl as n, onAuthStateChanged as o, logout as p, getAuthProvider as q, resolveSolanaRpcUrl as r, setCurrentUser as s, signInAnonymously as t, sendEmailOtp as u, sendTextOtp as v, verifyEmailOtp as w, verifyTextOtp as x, linkEmail as y, loginWithPrivy as z };
|
|
5510
|
+
//# sourceMappingURL=index.native-w12aoVNW.mjs.map
|