@bounded-sh/client 0.0.117 → 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 (52) hide show
  1. package/dist/auth/bounded-login-widget.d.ts +5 -0
  2. package/dist/auth/providers/transaction-utils.d.ts +5 -3
  3. package/dist/connections.d.ts +5 -1
  4. package/dist/{email-auth-provider-CMfwB-Uj.mjs → email-auth-provider-B9cZ-puM.mjs} +2 -2
  5. package/dist/{email-auth-provider-C5bYKzpN.mjs.map → email-auth-provider-B9cZ-puM.mjs.map} +1 -1
  6. package/dist/{email-auth-provider-BCWTczE2.js → email-auth-provider-BYiK3ZCv.js} +2 -2
  7. package/dist/{email-auth-provider-BCWTczE2.js.map → email-auth-provider-BYiK3ZCv.js.map} +1 -1
  8. package/dist/{email-auth-provider-3tuw_aDK.js → email-auth-provider-C-qQ46kD.js} +2 -2
  9. package/dist/{email-auth-provider-3tuw_aDK.js.map → email-auth-provider-C-qQ46kD.js.map} +1 -1
  10. package/dist/{email-auth-provider-C5bYKzpN.mjs → email-auth-provider-DFHalX9c.mjs} +2 -2
  11. package/dist/{email-auth-provider-CMfwB-Uj.mjs.map → email-auth-provider-DFHalX9c.mjs.map} +1 -1
  12. package/dist/{guest-auth-provider-CsM_SuGH.mjs → guest-auth-provider-BRq3JB0_.mjs} +2 -2
  13. package/dist/{guest-auth-provider-CsM_SuGH.mjs.map → guest-auth-provider-BRq3JB0_.mjs.map} +1 -1
  14. package/dist/{guest-auth-provider-DkX8cQqr.js → guest-auth-provider-D1q3C5uC.js} +2 -2
  15. package/dist/{guest-auth-provider-DkX8cQqr.js.map → guest-auth-provider-D1q3C5uC.js.map} +1 -1
  16. package/dist/{guest-auth-provider-_jdqZKUo.js → guest-auth-provider-g5-T58yA.js} +2 -2
  17. package/dist/{guest-auth-provider-_jdqZKUo.js.map → guest-auth-provider-g5-T58yA.js.map} +1 -1
  18. package/dist/{guest-auth-provider-DH4iA0oS.mjs → guest-auth-provider-i8-RL0js.mjs} +2 -2
  19. package/dist/{guest-auth-provider-DH4iA0oS.mjs.map → guest-auth-provider-i8-RL0js.mjs.map} +1 -1
  20. package/dist/{index-DrVV40Si.js → index-eMCWYiRe.js} +83 -66
  21. package/dist/index-eMCWYiRe.js.map +1 -0
  22. package/dist/{index-Sx-Caknc.mjs → index-xNGb1ROp.mjs} +84 -67
  23. package/dist/index-xNGb1ROp.mjs.map +1 -0
  24. package/dist/index.js +1 -1
  25. package/dist/index.mjs +1 -1
  26. package/dist/{index.native-CMNMw3Pe.js → index.native-ByI3rRu4.js} +47 -50
  27. package/dist/index.native-ByI3rRu4.js.map +1 -0
  28. package/dist/{index.native-DfDVa7MG.mjs → index.native-YmmnwqEw.mjs} +48 -51
  29. package/dist/index.native-YmmnwqEw.mjs.map +1 -0
  30. package/dist/index.native.js +1 -1
  31. package/dist/index.native.mjs +1 -1
  32. package/dist/{injected-evm-wallet-provider-BCZQuyPF.mjs → injected-evm-wallet-provider--x3yWNps.mjs} +2 -2
  33. package/dist/{injected-evm-wallet-provider-BCZQuyPF.mjs.map → injected-evm-wallet-provider--x3yWNps.mjs.map} +1 -1
  34. package/dist/{injected-evm-wallet-provider-CVMhv4xf.js → injected-evm-wallet-provider-BIYAL_NZ.js} +2 -2
  35. package/dist/{injected-evm-wallet-provider-CVMhv4xf.js.map → injected-evm-wallet-provider-BIYAL_NZ.js.map} +1 -1
  36. package/dist/{injected-evm-wallet-provider-CUNTCT-a.js → injected-evm-wallet-provider-BMjQaUiB.js} +2 -2
  37. package/dist/{injected-evm-wallet-provider-CUNTCT-a.js.map → injected-evm-wallet-provider-BMjQaUiB.js.map} +1 -1
  38. package/dist/{injected-evm-wallet-provider-E7eCpvLr.mjs → injected-evm-wallet-provider-BoLGCVqD.mjs} +2 -2
  39. package/dist/{injected-evm-wallet-provider-E7eCpvLr.mjs.map → injected-evm-wallet-provider-BoLGCVqD.mjs.map} +1 -1
  40. package/dist/{injected-wallet-provider-BroBvwi6.js → injected-wallet-provider-D3fVFadN.js} +14 -5
  41. package/dist/{injected-wallet-provider-BroBvwi6.js.map → injected-wallet-provider-D3fVFadN.js.map} +1 -1
  42. package/dist/{injected-wallet-provider-BoRoxrEl.mjs → injected-wallet-provider-DSOjJP3u.mjs} +14 -5
  43. package/dist/{injected-wallet-provider-BoRoxrEl.mjs.map → injected-wallet-provider-DSOjJP3u.mjs.map} +1 -1
  44. package/dist/{injected-wallet-provider-ezYLhye8.mjs → injected-wallet-provider-DuWTw-fM.mjs} +14 -5
  45. package/dist/{injected-wallet-provider-ezYLhye8.mjs.map → injected-wallet-provider-DuWTw-fM.mjs.map} +1 -1
  46. package/dist/{injected-wallet-provider-BqYJQDGu.js → injected-wallet-provider-zXw__lyf.js} +14 -5
  47. package/dist/{injected-wallet-provider-BqYJQDGu.js.map → injected-wallet-provider-zXw__lyf.js.map} +1 -1
  48. package/package.json +2 -2
  49. package/dist/index-DrVV40Si.js.map +0 -1
  50. package/dist/index-Sx-Caknc.mjs.map +0 -1
  51. package/dist/index.native-CMNMw3Pe.js.map +0 -1
  52. package/dist/index.native-DfDVa7MG.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getConfig, getActiveSessionManager, WebSessionManager, ReactNativeSessionManager, revokeSession, reconnectWithNewAuth, init as init$1, deriveUserIdentityFromIdToken, onSessionCleared, onSessionChange, subscribe, getFreshAuthToken, getSessionGeneration, getIdToken as getIdToken$1, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
1
+ import { getConfig, confirmSignature, getActiveSessionManager, WebSessionManager, ReactNativeSessionManager, revokeSession, reconnectWithNewAuth, init as init$1, deriveUserIdentityFromIdToken, onSessionCleared, onSessionChange, subscribe, getFreshAuthToken, getSessionGeneration, getIdToken as getIdToken$1, genAuthNonce, genSolanaMessage, createSessionWithSignature } from '@bounded-sh/core';
2
2
  import * as React from 'react';
3
3
 
4
4
  function walletContextFromClaims(claims, baseUrl, expectedAppId, tenantOrigin) {
@@ -4895,10 +4895,9 @@ async function signAndSubmitTransactionWithTurnkey(transaction, feePayer) {
4895
4895
  // has signed silently invalidates their signature - signTransactionWithTurnkey only ADDS the
4896
4896
  // Turnkey signature, it never re-signs the others. So only refresh the blockhash while the
4897
4897
  // transaction is still unsigned; once a real signature is present, preserve the caller's message
4898
- // verbatim and confirm against the blockhash it already carries.
4899
- const hasSignature = transactionHasSignature$1(transaction);
4900
- let confirmBlockhash = blockhash;
4901
- if (!hasSignature) {
4898
+ // verbatim. The confirmation is fenced on the lifetime read above either way: for a pre-signed
4899
+ // transaction that is a superset of the one its signers fenced on, never a shorter wait.
4900
+ if (!transactionHasSignature$1(transaction)) {
4902
4901
  if (isLegacy) {
4903
4902
  const legacy = transaction;
4904
4903
  legacy.recentBlockhash = blockhash;
@@ -4914,19 +4913,17 @@ async function signAndSubmitTransactionWithTurnkey(transaction, feePayer) {
4914
4913
  transaction.message.recentBlockhash = blockhash;
4915
4914
  }
4916
4915
  }
4917
- else {
4918
- confirmBlockhash = (isLegacy
4919
- ? transaction.recentBlockhash
4920
- : transaction.message.recentBlockhash) || blockhash;
4921
- }
4922
4916
  const signed = await signTransactionWithTurnkey(transaction);
4923
4917
  const signature = await connection.sendRawTransaction(signed.serialize(), {
4924
4918
  skipPreflight: false,
4925
4919
  maxRetries: 3,
4926
4920
  });
4927
- const confirmation = await connection.confirmTransaction({ signature, blockhash: confirmBlockhash, lastValidBlockHeight }, 'confirmed');
4928
- if (confirmation.value.err) {
4929
- throw new Error(`Turnkey transaction failed: ${JSON.stringify(confirmation.value.err)}`);
4921
+ const confirmation = await confirmSignature(connection, { signature, lastValidBlockHeight });
4922
+ if (!confirmation.landed) {
4923
+ throw new Error(`Turnkey transaction ${signature} was not confirmed: ${confirmation.reason}. Check its status before sending it again.`);
4924
+ }
4925
+ if (confirmation.status.err) {
4926
+ throw new Error(`Turnkey transaction failed: ${JSON.stringify(confirmation.status.err)}`);
4930
4927
  }
4931
4928
  return signature;
4932
4929
  }
@@ -6068,7 +6065,7 @@ async function getAuthProvider(config, fromStorage = false) {
6068
6065
  // manager as legacy email sessions. Human login should be started
6069
6066
  // with loginWithRedirect(); this provider is kept as the restore and
6070
6067
  // logout surface for those sessions.
6071
- currentAuthProvider = new (await import('./email-auth-provider-C5bYKzpN.mjs')).EmailAuthProvider();
6068
+ currentAuthProvider = new (await import('./email-auth-provider-DFHalX9c.mjs')).EmailAuthProvider();
6072
6069
  break;
6073
6070
  case "phantom": {
6074
6071
  // First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
@@ -6110,7 +6107,7 @@ async function getAuthProvider(config, fromStorage = false) {
6110
6107
  // (bounded-login-widget.ts), so registration never counts as
6111
6108
  // evidence the user has a wallet.
6112
6109
  await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
6113
- const { InjectedWalletProvider } = await import('./injected-wallet-provider-BoRoxrEl.mjs');
6110
+ const { InjectedWalletProvider } = await import('./injected-wallet-provider-DSOjJP3u.mjs');
6114
6111
  currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
6115
6112
  break;
6116
6113
  }
@@ -6123,7 +6120,7 @@ async function getAuthProvider(config, fromStorage = false) {
6123
6120
  // Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
6124
6121
  // to point at a specific wallet or set chainId/domain.
6125
6122
  const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
6126
- const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-E7eCpvLr.mjs');
6123
+ const { InjectedEvmWalletProvider } = await import('./injected-evm-wallet-provider-BoLGCVqD.mjs');
6127
6124
  currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
6128
6125
  break;
6129
6126
  }
@@ -6148,7 +6145,7 @@ async function getAuthProvider(config, fromStorage = false) {
6148
6145
  break;
6149
6146
  case "guest":
6150
6147
  // Anonymous auth: a device-local ed25519 keypair signs the challenge.
6151
- currentAuthProvider = new (await import('./guest-auth-provider-CsM_SuGH.mjs')).GuestAuthProvider();
6148
+ currentAuthProvider = new (await import('./guest-auth-provider-BRq3JB0_.mjs')).GuestAuthProvider();
6152
6149
  break;
6153
6150
  }
6154
6151
  if (!currentAuthProvider) {
@@ -6210,7 +6207,7 @@ async function signInAnonymously() {
6210
6207
  // Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
6211
6208
  // the main bundle for data-only apps. Specifier is a static string literal
6212
6209
  // so bundle-splitting can see it.
6213
- const provider = new (await import('./guest-auth-provider-CsM_SuGH.mjs')).GuestAuthProvider();
6210
+ const provider = new (await import('./guest-auth-provider-BRq3JB0_.mjs')).GuestAuthProvider();
6214
6211
  setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
6215
6212
  // adoptSessionProvider awaits only getConfig() (already resolved here) and then
6216
6213
  // runs every write - provider/method/config/marker/user - in one synchronous
@@ -6381,7 +6378,7 @@ function ensureSharedWalletLoginReady() {
6381
6378
  if (!sharedWalletReady) {
6382
6379
  sharedWalletReady = (async () => {
6383
6380
  await getConfig();
6384
- await import('./injected-wallet-provider-BoRoxrEl.mjs');
6381
+ await import('./injected-wallet-provider-DSOjJP3u.mjs');
6385
6382
  })().catch((error) => {
6386
6383
  sharedWalletReady = null;
6387
6384
  throw error;
@@ -8561,35 +8558,29 @@ async function getParsedTransactionCompat(connection, signature) {
8561
8558
  }
8562
8559
  }
8563
8560
  /**
8564
- * Polls getSignatureStatuses until the transaction is confirmed, then checks for errors.
8565
- * Throws if the transaction failed on-chain. Returns parsed transaction info on success.
8561
+ * Waits for a broadcast signature by HTTPS status polling, fenced on the blockhash
8562
+ * lifetime it was signed against (core's `confirmSignature`), then checks for an
8563
+ * on-chain error. Throws if the transaction failed on-chain or was not seen before
8564
+ * the fence closed. Returns parsed transaction info on success.
8566
8565
  */
8567
- async function confirmAndCheckTransaction(connection, signature) {
8566
+ async function confirmAndCheckTransaction(connection, signature, lastValidBlockHeight) {
8568
8567
  var _a;
8569
- const maxAttempts = 15;
8570
- for (let i = 0; i < maxAttempts; i++) {
8571
- const { value } = await connection.getSignatureStatuses([signature]);
8572
- const status = value[0];
8573
- if (status) {
8574
- if (status.err) {
8575
- let logMessages;
8576
- try {
8577
- const txInfo = await getParsedTransactionCompat(connection, signature);
8578
- logMessages = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.logMessages;
8579
- }
8580
- catch (_b) {
8581
- // Log retrieval is diagnostic only; the on-chain error is the verdict.
8582
- }
8583
- const errorMessage = extractTransactionError(status.err, logMessages);
8584
- throw new Error(`Transaction failed: ${errorMessage}`);
8585
- }
8586
- if (status.confirmationStatus === 'confirmed' || status.confirmationStatus === 'finalized') {
8587
- return await getParsedTransactionCompat(connection, signature);
8588
- }
8568
+ const confirmation = await confirmSignature(connection, { signature, lastValidBlockHeight });
8569
+ if (!confirmation.landed) {
8570
+ throw new Error(`Transaction ${signature} was not confirmed: ${confirmation.reason}. Check its status before sending it again.`);
8571
+ }
8572
+ if (confirmation.status.err) {
8573
+ let logMessages;
8574
+ try {
8575
+ const txInfo = await getParsedTransactionCompat(connection, signature);
8576
+ logMessages = (_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.logMessages;
8577
+ }
8578
+ catch (_b) {
8579
+ // Log retrieval is diagnostic only; the on-chain error is the verdict.
8589
8580
  }
8590
- await new Promise(resolve => setTimeout(resolve, 1000));
8581
+ throw new Error(`Transaction failed: ${extractTransactionError(confirmation.status.err, logMessages)}`);
8591
8582
  }
8592
- throw new Error('Transaction confirmation timeout');
8583
+ return getParsedTransactionCompat(connection, signature);
8593
8584
  }
8594
8585
 
8595
8586
  /**
@@ -8759,24 +8750,30 @@ class PrivyExpoProvider {
8759
8750
  // included), so refreshing the blockhash after any signer (sponsor / co-signer)
8760
8751
  // has signed silently invalidates their signature. Only refresh while the
8761
8752
  // transaction is still unsigned; once a real signature is present, submit the
8762
- // caller's transaction verbatim.
8753
+ // caller's transaction verbatim. Either way the confirmation is fenced on a
8754
+ // lifetime read now: for a pre-signed transaction that is a superset of the
8755
+ // one its signers fenced on, never a shorter wait.
8756
+ let lastValidBlockHeight;
8763
8757
  if (!transactionHasSignature(transaction)) {
8758
+ const { blockhash, lastValidBlockHeight: freshLastValid } = await connection.getLatestBlockhash('confirmed');
8759
+ lastValidBlockHeight = freshLastValid;
8764
8760
  const isLegacyTx = 'recentBlockhash' in transaction &&
8765
8761
  !('message' in transaction && 'staticAccountKeys' in transaction.message);
8766
8762
  if (isLegacyTx) {
8767
8763
  const legacyTx = transaction;
8768
- const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');
8769
8764
  legacyTx.recentBlockhash = blockhash;
8770
8765
  legacyTx.lastValidBlockHeight = lastValidBlockHeight;
8771
8766
  legacyTx.feePayer = feePayer || new PublicKey(wallet.address);
8772
8767
  }
8773
8768
  else {
8774
8769
  const versionedTx = transaction;
8775
- const { blockhash } = await connection.getLatestBlockhash('confirmed');
8776
8770
  versionedTx.message.recentBlockhash = blockhash;
8777
8771
  }
8778
8772
  }
8779
- const { signature } = await this.signAndSubmitInternal(transaction, wallet, connection);
8773
+ else {
8774
+ ({ lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed'));
8775
+ }
8776
+ const { signature } = await this.signAndSubmitInternal(transaction, wallet, connection, lastValidBlockHeight);
8780
8777
  return signature;
8781
8778
  }
8782
8779
  async restoreSession(beforeCommit) {
@@ -8847,11 +8844,11 @@ class PrivyExpoProvider {
8847
8844
  `Sign in again before ${action}.`);
8848
8845
  }
8849
8846
  }
8850
- async signAndSubmitInternal(transaction, wallet, connection) {
8847
+ async signAndSubmitInternal(transaction, wallet, connection, lastValidBlockHeight) {
8851
8848
  // Use Privy's combined sign+send
8852
8849
  const result = await wallet.signAndSendTransaction(transaction, connection);
8853
8850
  const signature = result.signature;
8854
- const txInfo = await confirmAndCheckTransaction(connection, signature);
8851
+ const txInfo = await confirmAndCheckTransaction(connection, signature, lastValidBlockHeight);
8855
8852
  return { signature, txInfo };
8856
8853
  }
8857
8854
  // The constructor rpcUrl wins, then init()'s rpcUrl, then the platform RPC
@@ -8888,4 +8885,4 @@ class PrivyExpoProvider {
8888
8885
  }
8889
8886
 
8890
8887
  export { PARK_REASONS as $, waitForAuthReady as A, login as B, logout as C, getAuthProvider as D, signInAnonymously as E, loginWithPrivy as F, loginWithRedirect as G, completeLoginFromRedirect as H, getLoginReturnError as I, loginWithPopup as J, useAuth as K, useQuery as L, useBuildRun as M, apps as N, getIdToken as O, onramp as P, onrampQuote as Q, onrampStatus as R, setPlatform as S, OffchainAuthProvider as T, PrivyExpoProvider as U, builds as V, BuildsApiError as W, mediaAgentTools as X, NON_TERMINAL_STATES as Y, TERMINAL_STATES as Z, RUN_STATES as _, signMessageWithTurnkey as a, FAILURE_REASONS as a0, BUILD_REVIEW_CAPABILITY_SCHEMA as a1, BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA as a2, BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA as a3, signTransactionWithTurnkey as b, signTransactionV1WithTurnkey as c, signAndSubmitTransactionWithTurnkey as d, bs58 as e, getWallets as f, getPlatform as g, hasTurnkeyWallet as h, solanaMobileWalletLeavesPage as i, solanaMobileWalletAnswersSignInFromCache as j, isSolanaMobileWallet as k, setAuthLoading as l, bufferExports as m, normalizeSolanaRpcUrl as n, setStoredAuthMethod as o, confirmAndCheckTransaction as p, resolveSolanaRpcUrl as q, resolveSolanaWalletStandardChain as r, setCurrentUser as s, transactionHasSignature as t, init as u, getCurrentUser as v, walletStandardFeatureName as w, onAuthStateChanged as x, onAuthLoadingChanged as y, getAuthLoading as z };
8891
- //# sourceMappingURL=index.native-DfDVa7MG.mjs.map
8888
+ //# sourceMappingURL=index.native-YmmnwqEw.mjs.map