@bounded-sh/client 0.0.118-openapps.0 → 0.0.118

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 (50) hide show
  1. package/dist/auth/providers/transaction-utils.d.ts +5 -3
  2. package/dist/{email-auth-provider-C-SGTRZe.mjs → email-auth-provider-B9cZ-puM.mjs} +2 -2
  3. package/dist/{email-auth-provider-C5bYKzpN.mjs.map → email-auth-provider-B9cZ-puM.mjs.map} +1 -1
  4. package/dist/{email-auth-provider-CjbJ8wK1.js → email-auth-provider-BYiK3ZCv.js} +2 -2
  5. package/dist/{email-auth-provider-CjbJ8wK1.js.map → email-auth-provider-BYiK3ZCv.js.map} +1 -1
  6. package/dist/{email-auth-provider-3tuw_aDK.js → email-auth-provider-C-qQ46kD.js} +2 -2
  7. package/dist/{email-auth-provider-3tuw_aDK.js.map → email-auth-provider-C-qQ46kD.js.map} +1 -1
  8. package/dist/{email-auth-provider-C5bYKzpN.mjs → email-auth-provider-DFHalX9c.mjs} +2 -2
  9. package/dist/{email-auth-provider-C-SGTRZe.mjs.map → email-auth-provider-DFHalX9c.mjs.map} +1 -1
  10. package/dist/{guest-auth-provider-CsM_SuGH.mjs → guest-auth-provider-BRq3JB0_.mjs} +2 -2
  11. package/dist/{guest-auth-provider-CsM_SuGH.mjs.map → guest-auth-provider-BRq3JB0_.mjs.map} +1 -1
  12. package/dist/{guest-auth-provider-ClCOa69H.js → guest-auth-provider-D1q3C5uC.js} +2 -2
  13. package/dist/{guest-auth-provider-ClCOa69H.js.map → guest-auth-provider-D1q3C5uC.js.map} +1 -1
  14. package/dist/{guest-auth-provider-_jdqZKUo.js → guest-auth-provider-g5-T58yA.js} +2 -2
  15. package/dist/{guest-auth-provider-_jdqZKUo.js.map → guest-auth-provider-g5-T58yA.js.map} +1 -1
  16. package/dist/{guest-auth-provider-BwEXKnNK.mjs → guest-auth-provider-i8-RL0js.mjs} +2 -2
  17. package/dist/{guest-auth-provider-BwEXKnNK.mjs.map → guest-auth-provider-i8-RL0js.mjs.map} +1 -1
  18. package/dist/{index-B2HWEA13.js → index-eMCWYiRe.js} +48 -51
  19. package/dist/index-eMCWYiRe.js.map +1 -0
  20. package/dist/{index-q9BHoxbM.mjs → index-xNGb1ROp.mjs} +49 -52
  21. package/dist/index-xNGb1ROp.mjs.map +1 -0
  22. package/dist/index.js +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/{index.native-CMNMw3Pe.js → index.native-ByI3rRu4.js} +47 -50
  25. package/dist/index.native-ByI3rRu4.js.map +1 -0
  26. package/dist/{index.native-DfDVa7MG.mjs → index.native-YmmnwqEw.mjs} +48 -51
  27. package/dist/index.native-YmmnwqEw.mjs.map +1 -0
  28. package/dist/index.native.js +1 -1
  29. package/dist/index.native.mjs +1 -1
  30. package/dist/{injected-evm-wallet-provider-AXc7Lmzk.mjs → injected-evm-wallet-provider--x3yWNps.mjs} +2 -2
  31. package/dist/{injected-evm-wallet-provider-AXc7Lmzk.mjs.map → injected-evm-wallet-provider--x3yWNps.mjs.map} +1 -1
  32. package/dist/{injected-evm-wallet-provider-qB_GQ9ih.js → injected-evm-wallet-provider-BIYAL_NZ.js} +2 -2
  33. package/dist/{injected-evm-wallet-provider-qB_GQ9ih.js.map → injected-evm-wallet-provider-BIYAL_NZ.js.map} +1 -1
  34. package/dist/{injected-evm-wallet-provider-CUNTCT-a.js → injected-evm-wallet-provider-BMjQaUiB.js} +2 -2
  35. package/dist/{injected-evm-wallet-provider-CUNTCT-a.js.map → injected-evm-wallet-provider-BMjQaUiB.js.map} +1 -1
  36. package/dist/{injected-evm-wallet-provider-E7eCpvLr.mjs → injected-evm-wallet-provider-BoLGCVqD.mjs} +2 -2
  37. package/dist/{injected-evm-wallet-provider-E7eCpvLr.mjs.map → injected-evm-wallet-provider-BoLGCVqD.mjs.map} +1 -1
  38. package/dist/{injected-wallet-provider-BEaDBzcd.js → injected-wallet-provider-D3fVFadN.js} +14 -5
  39. package/dist/{injected-wallet-provider-BEaDBzcd.js.map → injected-wallet-provider-D3fVFadN.js.map} +1 -1
  40. package/dist/{injected-wallet-provider-BoRoxrEl.mjs → injected-wallet-provider-DSOjJP3u.mjs} +14 -5
  41. package/dist/{injected-wallet-provider-BoRoxrEl.mjs.map → injected-wallet-provider-DSOjJP3u.mjs.map} +1 -1
  42. package/dist/{injected-wallet-provider-gmGZ254w.mjs → injected-wallet-provider-DuWTw-fM.mjs} +14 -5
  43. package/dist/{injected-wallet-provider-gmGZ254w.mjs.map → injected-wallet-provider-DuWTw-fM.mjs.map} +1 -1
  44. package/dist/{injected-wallet-provider-BqYJQDGu.js → injected-wallet-provider-zXw__lyf.js} +14 -5
  45. package/dist/{injected-wallet-provider-BqYJQDGu.js.map → injected-wallet-provider-zXw__lyf.js.map} +1 -1
  46. package/package.json +2 -2
  47. package/dist/index-B2HWEA13.js.map +0 -1
  48. package/dist/index-q9BHoxbM.mjs.map +0 -1
  49. package/dist/index.native-CMNMw3Pe.js.map +0 -1
  50. package/dist/index.native-DfDVa7MG.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getConfig, getActiveSessionManager, WebSessionManager, ReactNativeSessionManager, revokeSession, reconnectWithNewAuth, deriveUserIdentityFromIdToken, init as init$2, onSessionCleared, onSessionChange, subscribe, getFreshAuthToken, getSessionGeneration, getIdToken as getIdToken$1, getConfiguredAppId, setWithVenueGrant, writeNotAppliedPhase, waitForSetResult, reconcileSetResult, resolveVenueRpcUrl, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
1
+ import { getConfig, getActiveSessionManager, confirmSignature, WebSessionManager, ReactNativeSessionManager, revokeSession, reconnectWithNewAuth, deriveUserIdentityFromIdToken, init as init$2, onSessionCleared, onSessionChange, subscribe, getFreshAuthToken, getSessionGeneration, getIdToken as getIdToken$1, getConfiguredAppId, setWithVenueGrant, writeNotAppliedPhase, waitForSetResult, reconcileSetResult, resolveVenueRpcUrl, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
2
2
  import * as React from 'react';
3
3
 
4
4
  function walletContextFromClaims(claims, baseUrl, expectedAppId, tenantOrigin) {
@@ -5232,10 +5232,9 @@ async function signAndSubmitTransactionWithTurnkey(transaction, feePayer) {
5232
5232
  // has signed silently invalidates their signature - signTransactionWithTurnkey only ADDS the
5233
5233
  // Turnkey signature, it never re-signs the others. So only refresh the blockhash while the
5234
5234
  // transaction is still unsigned; once a real signature is present, preserve the caller's message
5235
- // verbatim and confirm against the blockhash it already carries.
5236
- const hasSignature = transactionHasSignature$1(transaction);
5237
- let confirmBlockhash = blockhash;
5238
- if (!hasSignature) {
5235
+ // verbatim. The confirmation is fenced on the lifetime read above either way: for a pre-signed
5236
+ // transaction that is a superset of the one its signers fenced on, never a shorter wait.
5237
+ if (!transactionHasSignature$1(transaction)) {
5239
5238
  if (isLegacy) {
5240
5239
  const legacy = transaction;
5241
5240
  legacy.recentBlockhash = blockhash;
@@ -5251,19 +5250,17 @@ async function signAndSubmitTransactionWithTurnkey(transaction, feePayer) {
5251
5250
  transaction.message.recentBlockhash = blockhash;
5252
5251
  }
5253
5252
  }
5254
- else {
5255
- confirmBlockhash = (isLegacy
5256
- ? transaction.recentBlockhash
5257
- : transaction.message.recentBlockhash) || blockhash;
5258
- }
5259
5253
  const signed = await signTransactionWithTurnkey(transaction);
5260
5254
  const signature = await connection.sendRawTransaction(signed.serialize(), {
5261
5255
  skipPreflight: false,
5262
5256
  maxRetries: 3,
5263
5257
  });
5264
- const confirmation = await connection.confirmTransaction({ signature, blockhash: confirmBlockhash, lastValidBlockHeight }, 'confirmed');
5265
- if (confirmation.value.err) {
5266
- throw new Error(`Turnkey transaction failed: ${JSON.stringify(confirmation.value.err)}`);
5258
+ const confirmation = await confirmSignature(connection, { signature, lastValidBlockHeight });
5259
+ if (!confirmation.landed) {
5260
+ throw new Error(`Turnkey transaction ${signature} was not confirmed: ${confirmation.reason}. Check its status before sending it again.`);
5261
+ }
5262
+ if (confirmation.status.err) {
5263
+ throw new Error(`Turnkey transaction failed: ${JSON.stringify(confirmation.status.err)}`);
5267
5264
  }
5268
5265
  return signature;
5269
5266
  }
@@ -6475,7 +6472,7 @@ async function getAuthProvider(config, fromStorage = false) {
6475
6472
  // manager as legacy email sessions. Human login should be started
6476
6473
  // with loginWithRedirect(); this provider is kept as the restore and
6477
6474
  // logout surface for those sessions.
6478
- currentAuthProvider = new (await import('./email-auth-provider-C-SGTRZe.mjs')).EmailAuthProvider();
6475
+ currentAuthProvider = new (await import('./email-auth-provider-B9cZ-puM.mjs')).EmailAuthProvider();
6479
6476
  break;
6480
6477
  case "phantom": {
6481
6478
  // First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
@@ -6517,7 +6514,7 @@ async function getAuthProvider(config, fromStorage = false) {
6517
6514
  // (bounded-login-widget.ts), so registration never counts as
6518
6515
  // evidence the user has a wallet.
6519
6516
  await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
6520
- const { InjectedWalletProvider } = await import('./injected-wallet-provider-gmGZ254w.mjs');
6517
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-DuWTw-fM.mjs');
6521
6518
  currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
6522
6519
  break;
6523
6520
  }
@@ -6530,7 +6527,7 @@ async function getAuthProvider(config, fromStorage = false) {
6530
6527
  // Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
6531
6528
  // to point at a specific wallet or set chainId/domain.
6532
6529
  const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
6533
- const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-AXc7Lmzk.mjs');
6530
+ const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider--x3yWNps.mjs');
6534
6531
  currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
6535
6532
  break;
6536
6533
  }
@@ -6555,7 +6552,7 @@ async function getAuthProvider(config, fromStorage = false) {
6555
6552
  break;
6556
6553
  case "guest":
6557
6554
  // Anonymous auth: a device-local ed25519 keypair signs the challenge.
6558
- currentAuthProvider = new (await import('./guest-auth-provider-BwEXKnNK.mjs')).GuestAuthProvider();
6555
+ currentAuthProvider = new (await import('./guest-auth-provider-i8-RL0js.mjs')).GuestAuthProvider();
6559
6556
  break;
6560
6557
  }
6561
6558
  if (!currentAuthProvider) {
@@ -6617,7 +6614,7 @@ async function signInAnonymously() {
6617
6614
  // Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
6618
6615
  // the main bundle for data-only apps. Specifier is a static string literal
6619
6616
  // so bundle-splitting can see it.
6620
- const provider = new (await import('./guest-auth-provider-BwEXKnNK.mjs')).GuestAuthProvider();
6617
+ const provider = new (await import('./guest-auth-provider-i8-RL0js.mjs')).GuestAuthProvider();
6621
6618
  setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
6622
6619
  // adoptSessionProvider awaits only getConfig() (already resolved here) and then
6623
6620
  // runs every write - provider/method/config/marker/user - in one synchronous
@@ -6788,7 +6785,7 @@ function ensureSharedWalletLoginReady() {
6788
6785
  if (!sharedWalletReady) {
6789
6786
  sharedWalletReady = (async () => {
6790
6787
  await getConfig();
6791
- await import('./injected-wallet-provider-gmGZ254w.mjs');
6788
+ await import('./injected-wallet-provider-DuWTw-fM.mjs');
6792
6789
  })().catch((error) => {
6793
6790
  sharedWalletReady = null;
6794
6791
  throw error;
@@ -6893,7 +6890,7 @@ async function loginWithWallet(options) {
6893
6890
  await ensureSharedWalletLoginReady();
6894
6891
  else
6895
6892
  await ensureWalletLoginReady();
6896
- const { InjectedWalletProvider } = await import('./injected-wallet-provider-gmGZ254w.mjs');
6893
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-DuWTw-fM.mjs');
6897
6894
  // Keep the RAW wallet provider: the offchain wrapper forwards only a fixed
6898
6895
  // set of methods, so cleanup below must speak to the provider that actually
6899
6896
  // holds the config rather than to whatever is wrapping it.
@@ -11556,35 +11553,29 @@ async function getParsedTransactionCompat(connection, signature) {
11556
11553
  }
11557
11554
  }
11558
11555
  /**
11559
- * Polls getSignatureStatuses until the transaction is confirmed, then checks for errors.
11560
- * Throws if the transaction failed on-chain. Returns parsed transaction info on success.
11556
+ * Waits for a broadcast signature by HTTPS status polling, fenced on the blockhash
11557
+ * lifetime it was signed against (core's `confirmSignature`), then checks for an
11558
+ * on-chain error. Throws if the transaction failed on-chain or was not seen before
11559
+ * the fence closed. Returns parsed transaction info on success.
11561
11560
  */
11562
- async function confirmAndCheckTransaction(connection, signature) {
11561
+ async function confirmAndCheckTransaction(connection, signature, lastValidBlockHeight) {
11563
11562
  var _a;
11564
- const maxAttempts = 15;
11565
- for (let i = 0; i < maxAttempts; i++) {
11566
- const { value } = await connection.getSignatureStatuses([signature]);
11567
- const status = value[0];
11568
- if (status) {
11569
- if (status.err) {
11570
- let logMessages;
11571
- try {
11572
- const txInfo = await getParsedTransactionCompat(connection, signature);
11573
- logMessages = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.logMessages;
11574
- }
11575
- catch (_b) {
11576
- // Log retrieval is diagnostic only; the on-chain error is the verdict.
11577
- }
11578
- const errorMessage = extractTransactionError(status.err, logMessages);
11579
- throw new Error(`Transaction failed: ${errorMessage}`);
11580
- }
11581
- if (status.confirmationStatus === 'confirmed' || status.confirmationStatus === 'finalized') {
11582
- return await getParsedTransactionCompat(connection, signature);
11583
- }
11563
+ const confirmation = await confirmSignature(connection, { signature, lastValidBlockHeight });
11564
+ if (!confirmation.landed) {
11565
+ throw new Error(`Transaction ${signature} was not confirmed: ${confirmation.reason}. Check its status before sending it again.`);
11566
+ }
11567
+ if (confirmation.status.err) {
11568
+ let logMessages;
11569
+ try {
11570
+ const txInfo = await getParsedTransactionCompat(connection, signature);
11571
+ logMessages = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.logMessages;
11572
+ }
11573
+ catch (_b) {
11574
+ // Log retrieval is diagnostic only; the on-chain error is the verdict.
11584
11575
  }
11585
- await new Promise(resolve => setTimeout(resolve, 1000));
11576
+ throw new Error(`Transaction failed: ${extractTransactionError(confirmation.status.err, logMessages)}`);
11586
11577
  }
11587
- throw new Error('Transaction confirmation timeout');
11578
+ return getParsedTransactionCompat(connection, signature);
11588
11579
  }
11589
11580
 
11590
11581
  /**
@@ -11754,24 +11745,30 @@ class PrivyExpoProvider {
11754
11745
  // included), so refreshing the blockhash after any signer (sponsor / co-signer)
11755
11746
  // has signed silently invalidates their signature. Only refresh while the
11756
11747
  // transaction is still unsigned; once a real signature is present, submit the
11757
- // caller's transaction verbatim.
11748
+ // caller's transaction verbatim. Either way the confirmation is fenced on a
11749
+ // lifetime read now: for a pre-signed transaction that is a superset of the
11750
+ // one its signers fenced on, never a shorter wait.
11751
+ let lastValidBlockHeight;
11758
11752
  if (!transactionHasSignature(transaction)) {
11753
+ const { blockhash, lastValidBlockHeight: freshLastValid } = await connection.getLatestBlockhash('confirmed');
11754
+ lastValidBlockHeight = freshLastValid;
11759
11755
  const isLegacyTx = 'recentBlockhash' in transaction &&
11760
11756
  !('message' in transaction && 'staticAccountKeys' in transaction.message);
11761
11757
  if (isLegacyTx) {
11762
11758
  const legacyTx = transaction;
11763
- const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
11764
11759
  legacyTx.recentBlockhash = blockhash;
11765
11760
  legacyTx.lastValidBlockHeight = lastValidBlockHeight;
11766
11761
  legacyTx.feePayer = feePayer || new PublicKey(wallet.address);
11767
11762
  }
11768
11763
  else {
11769
11764
  const versionedTx = transaction;
11770
- const { blockhash } = await connection.getLatestBlockhash('confirmed');
11771
11765
  versionedTx.message.recentBlockhash = blockhash;
11772
11766
  }
11773
11767
  }
11774
- const { signature } = await this.signAndSubmitInternal(transaction, wallet, connection);
11768
+ else {
11769
+ ({ lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed'));
11770
+ }
11771
+ const { signature } = await this.signAndSubmitInternal(transaction, wallet, connection, lastValidBlockHeight);
11775
11772
  return signature;
11776
11773
  }
11777
11774
  async restoreSession(beforeCommit) {
@@ -11842,11 +11839,11 @@ class PrivyExpoProvider {
11842
11839
  `Sign in again before ${action}.`);
11843
11840
  }
11844
11841
  }
11845
- async signAndSubmitInternal(transaction, wallet, connection) {
11842
+ async signAndSubmitInternal(transaction, wallet, connection, lastValidBlockHeight) {
11846
11843
  // Use Privy's combined sign+send
11847
11844
  const result = await wallet.signAndSendTransaction(transaction, connection);
11848
11845
  const signature = result.signature;
11849
- const txInfo = await confirmAndCheckTransaction(connection, signature);
11846
+ const txInfo = await confirmAndCheckTransaction(connection, signature, lastValidBlockHeight);
11850
11847
  return { signature, txInfo };
11851
11848
  }
11852
11849
  // The constructor rpcUrl wins, then init()'s rpcUrl, then the platform RPC
@@ -12272,4 +12269,4 @@ function init(config = {}) {
12272
12269
  }
12273
12270
 
12274
12271
  export { onramp as $, logout as A, getAuthProvider as B, signInAnonymously as C, loginWithPrivy as D, loginWithWallet as E, ensureWalletLoginReady as F, ensureSharedWalletLoginReady as G, preloadWalletLogin as H, loginWithRedirect as I, completeLoginFromRedirect as J, getLoginReturnError as K, loginWithPopup as L, openBoundedWidget as M, ensureSignedIn as N, useAuth as O, useQuery as P, useBuildRun as Q, apps as R, SELECTED_WALLET_UNAVAILABLE_ERR as S, signSolanaMessageViaTurnkey as T, getOrCreateTurnkeyWallet as U, openTurnkeyKeyExport as V, WalletConfigError as W, getTurnkeyWalletSessionState as X, getTurnkeyWalletRecoveryUrl as Y, startTurnkeyEmailLogin as Z, getIdToken as _, signMessageWithTurnkey as a, onrampQuote as a0, onrampStatus as a1, connect as a2, completeConnection as a3, getConnections as a4, disconnect as a5, ConnectionError as a6, fundVenueEscrow as a7, disputeVenueEscrow as a8, getVenueEscrow as a9, VenueEscrowError as aa, setPlatform as ab, OffchainAuthProvider as ac, PrivyExpoProvider as ad, requestEip6963Providers as ae, connectBroadcast as af, connectServiceSession as ag, builds as ah, BuildsApiError as ai, mediaAgentTools as aj, NON_TERMINAL_STATES as ak, TERMINAL_STATES as al, RUN_STATES as am, PARK_REASONS as an, FAILURE_REASONS as ao, BUILD_REVIEW_CAPABILITY_SCHEMA as ap, BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA as aq, BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA as ar, signTransactionWithTurnkey as b, signTransactionV1WithTurnkey as c, signAndSubmitTransactionWithTurnkey as d, bs58 as e, defaultInjectedProvider as f, getPlatform as g, hasTurnkeyWallet as h, firstStandardWalletProvider as i, setAuthLoading as j, supportsWalletSignIn as k, bufferExports as l, setStoredAuthMethod as m, normalizeSolanaRpcUrl as n, confirmAndCheckTransaction as o, defaultInjectedEvmProvider as p, init as q, resolveSolanaRpcUrl as r, setCurrentUser as s, transactionHasSignature as t, getCurrentUser as u, onAuthStateChanged as v, onAuthLoadingChanged as w, getAuthLoading as x, waitForAuthReady as y, login as z };
12275
- //# sourceMappingURL=index-q9BHoxbM.mjs.map
12272
+ //# sourceMappingURL=index-xNGb1ROp.mjs.map