@1sat/connect 0.0.35 → 0.0.36

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 (2) hide show
  1. package/dist/index.js +42 -32
  2. package/package.json +42 -32
package/dist/index.js CHANGED
@@ -45890,6 +45890,7 @@ var require_AuthFetch = __commonJS((exports) => {
45890
45890
  }
45891
45891
  });
45892
45892
  if (response.status === 402) {
45893
+ console.error("[AuthFetch] 402 received for " + url.slice(-50));
45893
45894
  return await this.handlePaymentAndRetry(url, config, response);
45894
45895
  }
45895
45896
  return response;
@@ -46098,6 +46099,7 @@ var require_AuthFetch = __commonJS((exports) => {
46098
46099
  return context.satoshisRequired === satoshisRequired && context.serverIdentityKey === serverIdentityKey && context.derivationPrefix === derivationPrefix;
46099
46100
  }
46100
46101
  async createPaymentContext(url, config, satoshisRequired, serverIdentityKey, derivationPrefix) {
46102
+ console.error("[AuthFetch] createPaymentContext sats=" + satoshisRequired);
46101
46103
  const derivationSuffix = await (0, createNonce_js_1.createNonce)(this.wallet, undefined, this.originator);
46102
46104
  const { publicKey: derivedPublicKey } = await this.wallet.getPublicKey({
46103
46105
  protocolID: [2, "3241645161d8"],
@@ -46105,18 +46107,26 @@ var require_AuthFetch = __commonJS((exports) => {
46105
46107
  counterparty: serverIdentityKey
46106
46108
  }, this.originator);
46107
46109
  const lockingScript = new P2PKH_js_1.default().lock(PublicKey_js_1.default.fromString(derivedPublicKey).toAddress()).toHex();
46108
- const { tx } = await this.wallet.createAction({
46109
- description: `Payment for request to ${new URL(url).origin}`,
46110
- outputs: [{
46111
- satoshis: satoshisRequired,
46112
- lockingScript,
46113
- customInstructions: JSON.stringify({ derivationPrefix, derivationSuffix, payee: serverIdentityKey }),
46114
- outputDescription: "HTTP request payment"
46115
- }],
46116
- options: {
46117
- randomizeOutputs: false
46118
- }
46119
- }, this.originator);
46110
+ console.error("[AuthFetch] calling wallet.createAction for payment");
46111
+ let tx;
46112
+ try {
46113
+ ({ tx } = await this.wallet.createAction({
46114
+ description: `Payment for request to ${new URL(url).origin}`,
46115
+ outputs: [{
46116
+ satoshis: satoshisRequired,
46117
+ lockingScript,
46118
+ customInstructions: JSON.stringify({ derivationPrefix, derivationSuffix, payee: serverIdentityKey }),
46119
+ outputDescription: "HTTP request payment"
46120
+ }],
46121
+ options: {
46122
+ randomizeOutputs: false
46123
+ }
46124
+ }, this.originator));
46125
+ } catch (e) {
46126
+ console.error("[AuthFetch] wallet.createAction threw:", e?.message || e);
46127
+ throw e;
46128
+ }
46129
+ console.error("[AuthFetch] wallet.createAction returned bytes=", tx?.length);
46120
46130
  const { publicKey: clientIdentityKey } = await this.wallet.getPublicKey({ identityKey: true }, this.originator);
46121
46131
  return {
46122
46132
  satoshisRequired,
@@ -100766,7 +100776,7 @@ var onMount = ($store, initialize) => {
100766
100776
  };
100767
100777
  });
100768
100778
  };
100769
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/query.mjs
100779
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/query.mjs
100770
100780
  var isServer = () => typeof window === "undefined";
100771
100781
  var useAuthQuery = (initializedAtom, path, $fetch, options) => {
100772
100782
  const value = atom({
@@ -100979,7 +100989,7 @@ var InternalAPIError = class extends Error {
100979
100989
  var kAPIErrorHeaderSymbol = Symbol.for("better-call:api-error-headers");
100980
100990
  var APIError = makeErrorForHideStackFrame(InternalAPIError, Error);
100981
100991
 
100982
- // ../../node_modules/.bun/@better-auth+core@1.6.5+52327739b267453f/node_modules/@better-auth/core/dist/error/index.mjs
100992
+ // ../../node_modules/.bun/@better-auth+core@1.6.6+52327739b267453f/node_modules/@better-auth/core/dist/error/index.mjs
100983
100993
  var BetterAuthError = class extends Error {
100984
100994
  constructor(message, options) {
100985
100995
  super(message, options);
@@ -100989,7 +100999,7 @@ var BetterAuthError = class extends Error {
100989
100999
  }
100990
101000
  };
100991
101001
 
100992
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+da88477f301ea18f/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
101002
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+f46366cc722544fb/node_modules/@sigma-auth/better-auth-plugin/dist/client/local-signer.js
100993
101003
  class LocalServerSigner {
100994
101004
  baseUrl;
100995
101005
  timeout;
@@ -101217,7 +101227,7 @@ class LocalServerSigner {
101217
101227
  }
101218
101228
  }
101219
101229
 
101220
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+da88477f301ea18f/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101230
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+f46366cc722544fb/node_modules/@sigma-auth/better-auth-plugin/dist/client/sigma-cwi.js
101221
101231
  var isRecord3 = (v) => typeof v === "object" && v !== null;
101222
101232
  var isResponse3 = (v) => isRecord3(v) && v.type === "CWI" && v.isInvocation === false && typeof v.id === "string";
101223
101233
  var isState3 = (v) => isRecord3(v) && v.type === "CWI" && isRecord3(v.cwiState);
@@ -101458,7 +101468,7 @@ class SigmaCWISigner {
101458
101468
  this.pending.clear();
101459
101469
  }
101460
101470
  }
101461
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+da88477f301ea18f/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101471
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+f46366cc722544fb/node_modules/@sigma-auth/better-auth-plugin/dist/client/signer.js
101462
101472
  class SigmaIframeSigner {
101463
101473
  iframe = null;
101464
101474
  pendingRequests = new Map;
@@ -101856,7 +101866,7 @@ class SigmaIframeSigner {
101856
101866
  this.rejectAllPending(new Error("Signer destroyed"));
101857
101867
  }
101858
101868
  }
101859
- // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+da88477f301ea18f/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101869
+ // ../../node_modules/.bun/@sigma-auth+better-auth-plugin@0.0.84+f46366cc722544fb/node_modules/@sigma-auth/better-auth-plugin/dist/client/index.js
101860
101870
  var signer = null;
101861
101871
  var signerType = null;
101862
101872
  var storedBapId = null;
@@ -102364,7 +102374,7 @@ Backend: ${status} (${endpoint})`;
102364
102374
  };
102365
102375
  };
102366
102376
 
102367
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/broadcast-channel.mjs
102377
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/broadcast-channel.mjs
102368
102378
  var kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
102369
102379
  var now = () => Math.floor(Date.now() / 1000);
102370
102380
  var WindowBroadcastChannel = class {
@@ -102412,7 +102422,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
102412
102422
  return globalThis[kBroadcastChannel];
102413
102423
  }
102414
102424
 
102415
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/focus-manager.mjs
102425
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/focus-manager.mjs
102416
102426
  var kFocusManager = Symbol.for("better-auth:focus-manager");
102417
102427
  var WindowFocusManager = class {
102418
102428
  listeners = /* @__PURE__ */ new Set;
@@ -102444,7 +102454,7 @@ function getGlobalFocusManager() {
102444
102454
  return globalThis[kFocusManager];
102445
102455
  }
102446
102456
 
102447
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/online-manager.mjs
102457
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/online-manager.mjs
102448
102458
  var kOnlineManager = Symbol.for("better-auth:online-manager");
102449
102459
  var WindowOnlineManager = class {
102450
102460
  listeners = /* @__PURE__ */ new Set;
@@ -102478,7 +102488,7 @@ function getGlobalOnlineManager() {
102478
102488
  return globalThis[kOnlineManager];
102479
102489
  }
102480
102490
 
102481
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/parser.mjs
102491
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/parser.mjs
102482
102492
  var PROTO_POLLUTION_PATTERNS = {
102483
102493
  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*:/,
102484
102494
  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*:/,
@@ -102558,7 +102568,7 @@ function parseJSON(value, options = { strict: true }) {
102558
102568
  return betterJSONParse(value, options);
102559
102569
  }
102560
102570
 
102561
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/session-refresh.mjs
102571
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/session-refresh.mjs
102562
102572
  var now2 = () => Math.floor(Date.now() / 1000);
102563
102573
  function normalizeSessionResponse(res) {
102564
102574
  if (typeof res === "object" && res !== null && "data" in res && "error" in res)
@@ -102698,7 +102708,7 @@ function createSessionRefreshManager(opts) {
102698
102708
  };
102699
102709
  }
102700
102710
 
102701
- // ../../node_modules/.bun/@better-auth+core@1.6.5+52327739b267453f/node_modules/@better-auth/core/dist/env/env-impl.mjs
102711
+ // ../../node_modules/.bun/@better-auth+core@1.6.6+52327739b267453f/node_modules/@better-auth/core/dist/env/env-impl.mjs
102702
102712
  var _envShim = Object.create(null);
102703
102713
  var _getEnv = (useShim) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (useShim ? _envShim : globalThis);
102704
102714
  var env = new Proxy(_envShim, {
@@ -102758,7 +102768,7 @@ var ENV = Object.freeze({
102758
102768
  return getEnvVar("BETTER_AUTH_TELEMETRY_ENDPOINT", "");
102759
102769
  }
102760
102770
  });
102761
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/utils/url.mjs
102771
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/utils/url.mjs
102762
102772
  function checkHasPath(url) {
102763
102773
  try {
102764
102774
  return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
@@ -102842,7 +102852,7 @@ function getOrigin(url) {
102842
102852
  }
102843
102853
  }
102844
102854
 
102845
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/fetch-plugins.mjs
102855
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/fetch-plugins.mjs
102846
102856
  var redirectPlugin = {
102847
102857
  id: "redirect",
102848
102858
  name: "Redirect",
@@ -102858,7 +102868,7 @@ var redirectPlugin = {
102858
102868
  } }
102859
102869
  };
102860
102870
 
102861
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/session-atom.mjs
102871
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/session-atom.mjs
102862
102872
  function getSessionAtom($fetch, options) {
102863
102873
  const $signal = atom(false);
102864
102874
  const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
@@ -103514,7 +103524,7 @@ var betterFetch = async (url, options) => {
103514
103524
  };
103515
103525
  };
103516
103526
 
103517
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/config.mjs
103527
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/config.mjs
103518
103528
  var resolvePublicAuthUrl = (basePath) => {
103519
103529
  if (typeof process === "undefined")
103520
103530
  return;
@@ -103624,12 +103634,12 @@ var getClientConfig = (options, loadEnv) => {
103624
103634
  };
103625
103635
  };
103626
103636
 
103627
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/utils/is-atom.mjs
103637
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/utils/is-atom.mjs
103628
103638
  function isAtom(value) {
103629
103639
  return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
103630
103640
  }
103631
103641
 
103632
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/proxy.mjs
103642
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/proxy.mjs
103633
103643
  function getMethod3(path, knownPathMethods, args) {
103634
103644
  const method = knownPathMethods[path];
103635
103645
  const { fetchOptions, query: _query, ...body } = args || {};
@@ -103711,12 +103721,12 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
103711
103721
  return createProxy();
103712
103722
  }
103713
103723
 
103714
- // ../../node_modules/.bun/@better-auth+core@1.6.5+52327739b267453f/node_modules/@better-auth/core/dist/utils/string.mjs
103724
+ // ../../node_modules/.bun/@better-auth+core@1.6.6+52327739b267453f/node_modules/@better-auth/core/dist/utils/string.mjs
103715
103725
  function capitalizeFirstLetter(str) {
103716
103726
  return str.charAt(0).toUpperCase() + str.slice(1);
103717
103727
  }
103718
103728
 
103719
- // ../../node_modules/.bun/better-auth@1.6.5+7fd54d833fe5b310/node_modules/better-auth/dist/client/vanilla.mjs
103729
+ // ../../node_modules/.bun/better-auth@1.6.6+5b359f2b516881c0/node_modules/better-auth/dist/client/vanilla.mjs
103720
103730
  function createAuthClient(options) {
103721
103731
  const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
103722
103732
  const resolvedHooks = {};
package/package.json CHANGED
@@ -1,34 +1,44 @@
1
1
  {
2
- "name": "@1sat/connect",
3
- "version": "0.0.35",
4
- "description": "Connection layer for 1Sat wallet - popup flow, events, session management",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- }
13
- },
14
- "files": ["dist"],
15
- "scripts": {
16
- "build": "bun build ./src/index.ts --outdir ./dist --target browser && tsc --emitDeclarationOnly",
17
- "dev": "tsc --watch"
18
- },
19
- "keywords": ["1sat", "bsv", "ordinals", "wallet", "sdk", "connect"],
20
- "license": "MIT",
21
- "dependencies": {
22
- "@1sat/wallet": "0.0.47",
23
- "@sigma-auth/better-auth-plugin": "^0.0.84",
24
- "better-auth": "^1.5.4",
25
- "eventemitter3": "^5.0.1"
26
- },
27
- "peerDependencies": {
28
- "@bsv/sdk": "^2.0.13"
29
- },
30
- "devDependencies": {
31
- "@bsv/sdk": "^2.0.13",
32
- "typescript": "^5.9.3"
33
- }
2
+ "name": "@1sat/connect",
3
+ "version": "0.0.36",
4
+ "description": "Connection layer for 1Sat wallet - popup flow, events, session management",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "bun": "./src/index.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "bun build ./src/index.ts --outdir ./dist --target browser && tsc --emitDeclarationOnly",
20
+ "dev": "tsc --watch"
21
+ },
22
+ "keywords": [
23
+ "1sat",
24
+ "bsv",
25
+ "ordinals",
26
+ "wallet",
27
+ "sdk",
28
+ "connect"
29
+ ],
30
+ "license": "MIT",
31
+ "dependencies": {
32
+ "@1sat/wallet": "0.0.49",
33
+ "@sigma-auth/better-auth-plugin": "^0.0.84",
34
+ "better-auth": "^1.5.4",
35
+ "eventemitter3": "^5.0.1"
36
+ },
37
+ "peerDependencies": {
38
+ "@bsv/sdk": "^2.0.13"
39
+ },
40
+ "devDependencies": {
41
+ "@bsv/sdk": "^2.0.13",
42
+ "typescript": "^5.9.3"
43
+ }
34
44
  }