@1sat/connect 0.0.67 → 0.0.68

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.
@@ -46,6 +46,11 @@ export declare function getAvailableProviders(config?: ConnectWalletConfig): Ava
46
46
  *
47
47
  * If the last successful provider is known, it's attempted first
48
48
  * before falling back to the full race.
49
+ *
50
+ * Returns null when the race completes with no successful connection
51
+ * (no wallet installed, configured providers can't auto-connect).
52
+ * Callers should treat null as "show the provider picker." Genuine
53
+ * misuse — e.g. autoDetect disabled with no providers — still throws.
49
54
  */
50
- export declare function connectWallet(config?: ConnectWalletConfig): Promise<ConnectWalletResult>;
55
+ export declare function connectWallet(config?: ConnectWalletConfig): Promise<ConnectWalletResult | null>;
51
56
  //# sourceMappingURL=connectWallet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectWallet.d.ts","sourceRoot":"","sources":["../src/connectWallet.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,WAAW,oBAAoB;IACpC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,mBAAmB;IACnC;;0DAEsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sDAAsD;IACtD,SAAS,CAAC,EAAE,oBAAoB,EAAE,CAAA;CAClC;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,eAAe,CAAA;IACvB,uFAAuF;IACvF,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,U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AAW,iBAAkB,SAAQ,oBAAoB;IAC9D,OAAO,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAA;CAC3C;AAED,kDAAkD;AAClD,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,CAAA;AAWtD,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAOhD;AAkDD;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,CAAC,EAAE,mBAAmB,GAC1B,iBAAiB,EAAE,CAWrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAClC,MAAM,CAAC,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAwCrC"}
package/dist/index.js CHANGED
@@ -100636,9 +100636,9 @@ async function connectWallet(config) {
100636
100636
  const lastConfig = providers.find((p) => p.type === lastType);
100637
100637
  if (lastConfig) {
100638
100638
  try {
100639
- const result2 = await buildConnector(lastConfig)();
100640
- saveLastProvider(result2.provider);
100641
- return result2;
100639
+ const result = await buildConnector(lastConfig)();
100640
+ saveLastProvider(result.provider);
100641
+ return result;
100642
100642
  } catch {}
100643
100643
  }
100644
100644
  }
@@ -100652,9 +100652,13 @@ async function connectWallet(config) {
100652
100652
  if (attempts.length === 0) {
100653
100653
  throw new Error("No wallet providers configured and autoDetect is disabled");
100654
100654
  }
100655
- const result = await Promise.any(attempts);
100656
- saveLastProvider(result.provider);
100657
- return result;
100655
+ try {
100656
+ const result = await Promise.any(attempts);
100657
+ saveLastProvider(result.provider);
100658
+ return result;
100659
+ } catch {
100660
+ return null;
100661
+ }
100658
100662
  }
100659
100663
  // ../../node_modules/.bun/nanostores@1.3.0/node_modules/nanostores/clean-stores/index.js
100660
100664
  var clean2 = Symbol("clean");
@@ -100802,7 +100806,7 @@ var onMount = ($store, initialize) => {
100802
100806
  };
100803
100807
  });
100804
100808
  };
100805
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/query.mjs
100809
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/query.mjs
100806
100810
  var isServer = () => typeof window === "undefined";
100807
100811
  var useAuthQuery = (initializedAtom, path, $fetch, options) => {
100808
100812
  const value = atom({
@@ -101025,7 +101029,7 @@ var BetterAuthError = class extends Error {
101025
101029
  }
101026
101030
  };
101027
101031
 
101028
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+8619505015901e84/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101032
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+e3c0a3b6c61993ab/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101029
101033
  class LocalServerSigner {
101030
101034
  baseUrl;
101031
101035
  timeout;
@@ -101253,7 +101257,7 @@ class LocalServerSigner {
101253
101257
  }
101254
101258
  }
101255
101259
 
101256
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+8619505015901e84/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101260
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+e3c0a3b6c61993ab/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101257
101261
  var isRecord3 = (v) => typeof v === "object" && v !== null;
101258
101262
  var isResponse3 = (v) => isRecord3(v) && v.type === "CWI" && v.isInvocation === false && typeof v.id === "string";
101259
101263
  var isState3 = (v) => isRecord3(v) && v.type === "CWI" && isRecord3(v.cwiState);
@@ -101494,7 +101498,7 @@ class SigmaCWISigner {
101494
101498
  this.pending.clear();
101495
101499
  }
101496
101500
  }
101497
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+8619505015901e84/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101501
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+e3c0a3b6c61993ab/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101498
101502
  class SigmaIframeSigner {
101499
101503
  iframe = null;
101500
101504
  pendingRequests = new Map;
@@ -101892,7 +101896,7 @@ class SigmaIframeSigner {
101892
101896
  this.rejectAllPending(new Error("Signer destroyed"));
101893
101897
  }
101894
101898
  }
101895
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+8619505015901e84/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101899
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+e3c0a3b6c61993ab/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101896
101900
  var signer = null;
101897
101901
  var signerType = null;
101898
101902
  var storedBapId = null;
@@ -102400,7 +102404,7 @@ Backend: ${status} (${endpoint})`;
102400
102404
  };
102401
102405
  };
102402
102406
 
102403
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/broadcast-channel.mjs
102407
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/broadcast-channel.mjs
102404
102408
  var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
102405
102409
  var now = () => Math.floor(Date.now() / 1000);
102406
102410
  var WindowBroadcastChannel = class {
@@ -102448,7 +102452,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
102448
102452
  return globalThis[kBroadcastChannel];
102449
102453
  }
102450
102454
 
102451
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/focus-manager.mjs
102455
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/focus-manager.mjs
102452
102456
  var kFocusManager = Symbol.for("better-auth:focus-manager");
102453
102457
  var WindowFocusManager = class {
102454
102458
  listeners = /* @__PURE__ */ new Set;
@@ -102480,7 +102484,7 @@ function getGlobalFocusManager() {
102480
102484
  return globalThis[kFocusManager];
102481
102485
  }
102482
102486
 
102483
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/online-manager.mjs
102487
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/online-manager.mjs
102484
102488
  var kOnlineManager = Symbol.for("better-auth:online-manager");
102485
102489
  var WindowOnlineManager = class {
102486
102490
  listeners = /* @__PURE__ */ new Set;
@@ -102514,7 +102518,7 @@ function getGlobalOnlineManager() {
102514
102518
  return globalThis[kOnlineManager];
102515
102519
  }
102516
102520
 
102517
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/parser.mjs
102521
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/parser.mjs
102518
102522
  var PROTO_POLLUTION_PATTERNS = {
102519
102523
  proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
102520
102524
  constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
@@ -102594,7 +102598,7 @@ function parseJSON(value, options = { strict: true }) {
102594
102598
  return betterJSONParse(value, options);
102595
102599
  }
102596
102600
 
102597
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/session-refresh.mjs
102601
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/session-refresh.mjs
102598
102602
  var now2 = () => Math.floor(Date.now() / 1000);
102599
102603
  function normalizeSessionResponse(res) {
102600
102604
  if (typeof res === "object" && res !== null && "data" in res && "error" in res)
@@ -102794,7 +102798,7 @@ var ENV = Object.freeze({
102794
102798
  return getEnvVar("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
102795
102799
  }
102796
102800
  });
102797
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/utils/url.mjs
102801
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/utils/url.mjs
102798
102802
  function checkHasPath(url) {
102799
102803
  try {
102800
102804
  return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
@@ -102878,7 +102882,7 @@ function getOrigin(url) {
102878
102882
  }
102879
102883
  }
102880
102884
 
102881
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/fetch-plugins.mjs
102885
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/fetch-plugins.mjs
102882
102886
  var redirectPlugin = {
102883
102887
  id: "redirect",
102884
102888
  name: "Redirect",
@@ -102894,7 +102898,7 @@ var redirectPlugin = {
102894
102898
  } }
102895
102899
  };
102896
102900
 
102897
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/session-atom.mjs
102901
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/session-atom.mjs
102898
102902
  function getSessionAtom($fetch, options) {
102899
102903
  const $signal = atom(false);
102900
102904
  const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
@@ -103550,7 +103554,7 @@ var betterFetch = async (url, options) => {
103550
103554
  };
103551
103555
  };
103552
103556
 
103553
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/config.mjs
103557
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/config.mjs
103554
103558
  var resolvePublicAuthUrl = (basePath) => {
103555
103559
  if (typeof process === "undefined")
103556
103560
  return;
@@ -103660,12 +103664,12 @@ var getClientConfig = (options, loadEnv) => {
103660
103664
  };
103661
103665
  };
103662
103666
 
103663
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/utils/is-atom.mjs
103667
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/utils/is-atom.mjs
103664
103668
  function isAtom(value) {
103665
103669
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
103666
103670
  }
103667
103671
 
103668
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/proxy.mjs
103672
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/proxy.mjs
103669
103673
  function getMethod3(path, knownPathMethods, args) {
103670
103674
  const method = knownPathMethods[path];
103671
103675
  const { fetchOptions, query: _query, ...body } = args || {};
@@ -103752,7 +103756,7 @@ function capitalizeFirstLetter(str) {
103752
103756
  return str.charAt(0).toUpperCase() + str.slice(1);
103753
103757
  }
103754
103758
 
103755
- // ../../node_modules/.bun/better-auth@1.6.11+e3d396d6826938b1/node_modules/better-auth/dist/client/vanilla.mjs
103759
+ // ../../node_modules/.bun/better-auth@1.6.11+42e9eb66878ac32a/node_modules/better-auth/dist/client/vanilla.mjs
103756
103760
  function createAuthClient(options) {
103757
103761
  const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
103758
103762
  const resolvedHooks = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/connect",
3
- "version": "0.0.67",
3
+ "version": "0.0.68",
4
4
  "description": "Connection layer for 1Sat wallet - popup flow, events, session management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@1sat/wallet": "0.0.84",
31
+ "@1sat/wallet": "0.0.85",
32
32
  "@sigma-auth/better-auth-plugin": "^0.0.84",
33
33
  "better-auth": "^1.5.4",
34
34
  "eventemitter3": "^5.0.1"