@bwalletx/connect 0.4.1 → 0.5.0

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 (47) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/assets/protocol/401.jpg +0 -0
  3. package/assets/protocol/401.mp4 +0 -0
  4. package/assets/protocol/402.jpg +0 -0
  5. package/assets/protocol/402.mp4 +0 -0
  6. package/assets/protocol/403.jpg +0 -0
  7. package/assets/protocol/403.mp4 +0 -0
  8. package/dist/access-Z6xQwKVF.d.cts +118 -0
  9. package/dist/access-Z6xQwKVF.d.ts +118 -0
  10. package/dist/bwalletx-connect.global.js +17 -17
  11. package/dist/bwalletx-connect.global.js.map +1 -1
  12. package/dist/{chunk-NNMUSWPG.js → chunk-CVLXFNAG.js} +123 -1
  13. package/dist/chunk-CVLXFNAG.js.map +1 -0
  14. package/dist/{chunk-FUQ46RJV.js → chunk-GF6GUDZL.js} +2 -2
  15. package/dist/chunk-MWD4BCO5.js +182 -0
  16. package/dist/chunk-MWD4BCO5.js.map +1 -0
  17. package/dist/{chunk-7NAKOJGZ.js → chunk-QRXFL66W.js} +220 -10
  18. package/dist/chunk-QRXFL66W.js.map +1 -0
  19. package/dist/element.cjs +209 -0
  20. package/dist/element.cjs.map +1 -1
  21. package/dist/element.js +2 -1
  22. package/dist/element.js.map +1 -1
  23. package/dist/index.cjs +292 -11
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +44 -1
  26. package/dist/index.d.ts +44 -1
  27. package/dist/index.js +30 -4
  28. package/dist/index.js.map +1 -1
  29. package/dist/next.cjs +377 -9
  30. package/dist/next.cjs.map +1 -1
  31. package/dist/next.d.cts +52 -2
  32. package/dist/next.d.ts +52 -2
  33. package/dist/next.js +92 -1
  34. package/dist/next.js.map +1 -1
  35. package/dist/react.cjs +209 -0
  36. package/dist/react.cjs.map +1 -1
  37. package/dist/react.js +3 -2
  38. package/dist/react.js.map +1 -1
  39. package/dist/server.cjs +406 -9
  40. package/dist/server.cjs.map +1 -1
  41. package/dist/server.d.cts +111 -1
  42. package/dist/server.d.ts +111 -1
  43. package/dist/server.js +47 -1
  44. package/package.json +10 -9
  45. package/dist/chunk-7NAKOJGZ.js.map +0 -1
  46. package/dist/chunk-NNMUSWPG.js.map +0 -1
  47. /package/dist/{chunk-FUQ46RJV.js.map → chunk-GF6GUDZL.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -30,21 +30,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ ACCESS_ERROR_STATUS: () => ACCESS_ERROR_STATUS,
34
+ ACCESS_PROTOCOL: () => ACCESS_PROTOCOL,
35
+ ACCESS_VERSION: () => ACCESS_VERSION,
36
+ AccessError: () => AccessError,
33
37
  BRC29_PROTOCOL: () => BRC29_PROTOCOL,
34
38
  BWALLETX_RDNS: () => BWALLETX_RDNS,
35
39
  GET_URL: () => GET_URL,
36
40
  LOGIN_PROTOCOL: () => LOGIN_PROTOCOL,
37
41
  LOGO_URL: () => LOGO_URL,
42
+ PROTOCOL_MEDIA: () => PROTOCOL_MEDIA,
38
43
  PaymentError: () => PaymentError,
39
44
  RDNS_EXTENSION: () => RDNS_EXTENSION,
40
45
  RDNS_MOBILE: () => RDNS_MOBILE,
41
46
  SIGNIN_CSS: () => SIGNIN_CSS,
42
47
  SIGNIN_TAG: () => SIGNIN_TAG,
43
48
  WEB_WALLET_URL: () => WEB_WALLET_URL,
49
+ accessErrorMessage: () => accessErrorMessage,
44
50
  amountInSats: () => amountInSats,
45
51
  brc100Option: () => brc100Option,
46
52
  buildAuthorizeUrl: () => buildAuthorizeUrl,
47
53
  buyToken: () => buyToken,
54
+ canonicalJson: () => canonicalJson,
48
55
  clearPairing: () => clearPairing,
49
56
  connectBwalletX: () => connectBwalletX,
50
57
  defineBwalletxSignin: () => defineBwalletxSignin,
@@ -61,13 +68,18 @@ __export(src_exports, {
61
68
  pairingOption: () => pairingOption,
62
69
  pay: () => pay,
63
70
  pickWallet: () => pickWallet,
71
+ protocolMediaUrl: () => protocolMediaUrl,
72
+ proveHoldings: () => proveHoldings,
64
73
  qrSvg: () => qrSvg,
65
74
  renderButton: () => renderButton,
75
+ requestAccess: () => requestAccess,
66
76
  resolvePaymailP2P: () => resolvePaymailP2P,
67
77
  restorePairing: () => restorePairing,
68
78
  signInWithBwalletX: () => signInWithBwalletX,
69
79
  signinText: () => signinText,
70
- tip: () => tip
80
+ throwIfAccessError: () => throwIfAccessError,
81
+ tip: () => tip,
82
+ toAccessError: () => toAccessError
71
83
  });
72
84
  module.exports = __toCommonJS(src_exports);
73
85
 
@@ -541,6 +553,239 @@ function renderButton(el2, opts = {}) {
541
553
  return b;
542
554
  }
543
555
 
556
+ // src/access-client.ts
557
+ var import_sdk3 = require("@bsv/sdk");
558
+
559
+ // src/access.ts
560
+ var ACCESS_VERSION = 1;
561
+ var ACCESS_PROTOCOL = [2, "bwalletx access"];
562
+ var MAX_HOLDING_PROOFS = 50;
563
+ var ACCESS_ERROR_STATUS = {
564
+ not_installed: 424,
565
+ user_rejected: 403,
566
+ wrong_account: 409,
567
+ insufficient_tokens: 403,
568
+ identity_level_too_low: 403,
569
+ kyc_required: 403,
570
+ indexer_unavailable: 503,
571
+ expired: 401,
572
+ replay: 401,
573
+ invalid_signature: 401,
574
+ bad_request: 400
575
+ };
576
+ var AccessError = class extends Error {
577
+ code;
578
+ have;
579
+ need;
580
+ constructor(code, message, extra = {}) {
581
+ super(message ?? code);
582
+ this.name = "AccessError";
583
+ this.code = code;
584
+ this.have = extra.have;
585
+ this.need = extra.need;
586
+ }
587
+ toJSON() {
588
+ const b = { error: this.code, message: this.message };
589
+ if (this.have !== void 0) b.have = this.have;
590
+ if (this.need !== void 0) b.need = this.need;
591
+ return b;
592
+ }
593
+ };
594
+ var PROTOCOL_MEDIA = {
595
+ "401": { name: "Identity", color: "#22c55e", video: "assets/protocol/401.mp4", poster: "assets/protocol/401.jpg" },
596
+ "402": { name: "Payment", color: "#3b82f6", video: "assets/protocol/402.mp4", poster: "assets/protocol/402.jpg" },
597
+ "403": { name: "Access", color: "#ef4444", video: "assets/protocol/403.mp4", poster: "assets/protocol/403.jpg" }
598
+ };
599
+ function protocolMediaUrl(kind, which, version = "latest") {
600
+ return `https://unpkg.com/@bwalletx/connect@${version}/${PROTOCOL_MEDIA[kind][which]}`;
601
+ }
602
+ function canonicalJson(v) {
603
+ if (v === null) return "null";
604
+ if (typeof v === "string" || typeof v === "boolean") return JSON.stringify(v);
605
+ if (typeof v === "number") {
606
+ if (!Number.isFinite(v)) throw new Error("canonicalJson: non-finite number");
607
+ return JSON.stringify(v);
608
+ }
609
+ if (Array.isArray(v)) return `[${v.map((x) => canonicalJson(x)).join(",")}]`;
610
+ if (typeof v === "object") {
611
+ const o = v;
612
+ const keys = Object.keys(o).filter((k) => o[k] !== void 0).sort();
613
+ return `{${keys.map((k) => `${JSON.stringify(k)}:${canonicalJson(o[k])}`).join(",")}}`;
614
+ }
615
+ throw new Error(`canonicalJson: unsupported ${typeof v}`);
616
+ }
617
+ function challengeBytes(challenge) {
618
+ return Array.from(new TextEncoder().encode(challenge));
619
+ }
620
+ var TOKEN_ID = /^bsv21:[0-9a-f]{64}_\d{1,6}$/;
621
+ var RAW = /^[1-9]\d{0,38}$/;
622
+ function normaliseRequirement(r) {
623
+ if (!r || typeof r !== "object") throw new AccessError("bad_request", "require must be an object");
624
+ const req = r;
625
+ const out = {};
626
+ if (req.token !== void 0) {
627
+ const t = req.token;
628
+ if (!t || typeof t !== "object" || typeof t.id !== "string") throw new AccessError("bad_request", "require.token.id is required");
629
+ const id = t.id.trim().toLowerCase();
630
+ if (!TOKEN_ID.test(id)) throw new AccessError("bad_request", "require.token.id must be 'bsv21:<txid>_<vout>'");
631
+ const hasMin = t.min !== void 0;
632
+ const hasBps = t.minBps !== void 0;
633
+ if (hasMin === hasBps) throw new AccessError("bad_request", "require.token needs exactly one of min or minBps");
634
+ out.token = { id };
635
+ if (hasMin) {
636
+ if (typeof t.min !== "string" || !RAW.test(t.min)) throw new AccessError("bad_request", "require.token.min must be a positive integer string (raw units)");
637
+ out.token.min = t.min;
638
+ } else {
639
+ if (!Number.isInteger(t.minBps) || t.minBps < 1 || t.minBps > 1e4) {
640
+ throw new AccessError("bad_request", "require.token.minBps must be an integer 1..10000");
641
+ }
642
+ out.token.minBps = t.minBps;
643
+ }
644
+ }
645
+ if (req.identityLevel !== void 0) {
646
+ if (!Number.isInteger(req.identityLevel) || req.identityLevel < 1 || req.identityLevel > 10) {
647
+ throw new AccessError("bad_request", "require.identityLevel must be an integer 1..10");
648
+ }
649
+ out.identityLevel = req.identityLevel;
650
+ }
651
+ if (req.kyc !== void 0) {
652
+ if (typeof req.kyc !== "boolean") throw new AccessError("bad_request", "require.kyc must be a boolean");
653
+ if (req.kyc) out.kyc = true;
654
+ }
655
+ if (!out.token && !out.identityLevel && !out.kyc) throw new AccessError("bad_request", "require is empty");
656
+ return out;
657
+ }
658
+ function parseAccessChallenge(s) {
659
+ if (typeof s !== "string" || s.length > 4096) throw new AccessError("bad_request", "challenge must be a string");
660
+ let c;
661
+ try {
662
+ c = JSON.parse(s);
663
+ } catch {
664
+ throw new AccessError("bad_request", "challenge is not JSON");
665
+ }
666
+ if (!c || typeof c !== "object" || c.v !== 1) throw new AccessError("bad_request", "unsupported challenge version");
667
+ if (c.kind !== "401" && c.kind !== "402" && c.kind !== "403") throw new AccessError("bad_request", "bad kind");
668
+ if (typeof c.origin !== "string" || typeof c.nonce !== "string" || !/^[A-Za-z0-9_-]{16,64}$/.test(c.nonce)) {
669
+ throw new AccessError("bad_request", "bad origin or nonce");
670
+ }
671
+ if (!Number.isInteger(c.iat) || !Number.isInteger(c.exp) || c.exp <= c.iat) throw new AccessError("bad_request", "bad iat/exp");
672
+ if (c.sub !== void 0 && (typeof c.sub !== "string" || !/^0[23][0-9a-f]{64}$/.test(c.sub))) throw new AccessError("bad_request", "bad sub");
673
+ c.require = normaliseRequirement(c.require);
674
+ if (canonicalJson(c) !== s) throw new AccessError("bad_request", "challenge is not canonical");
675
+ return c;
676
+ }
677
+ function accessErrorMessage(code, e = {}) {
678
+ switch (code) {
679
+ case "not_installed":
680
+ return "No bWalletX (or other BRC-100 wallet) was found.";
681
+ case "user_rejected":
682
+ return "The request was declined in the wallet.";
683
+ case "wrong_account":
684
+ return "The wallet is signed in to a different account than this site expects.";
685
+ case "insufficient_tokens":
686
+ return `Not enough tokens: holding ${e.have ?? 0}, need ${e.need ?? "?"}.`;
687
+ case "identity_level_too_low":
688
+ return `Identity level ${e.have ?? 0} is below the required level ${e.need ?? "?"}.`;
689
+ case "kyc_required":
690
+ return "A verified identity (KYC) is required.";
691
+ case "indexer_unavailable":
692
+ return "Holdings could not be checked right now. Try again shortly.";
693
+ case "expired":
694
+ return "The request expired. Try again.";
695
+ case "replay":
696
+ return "That request was already used. Try again.";
697
+ case "invalid_signature":
698
+ return "The wallet signature did not verify.";
699
+ case "bad_request":
700
+ return "The request was malformed.";
701
+ }
702
+ }
703
+
704
+ // src/access-client.ts
705
+ var ONESAT = [0, "onesat"];
706
+ var LEGACY_ONESAT = [0, "p 1sat"];
707
+ function toAccessError(e) {
708
+ if (e instanceof AccessError) return e;
709
+ const err = e;
710
+ const msg = String(err?.message ?? e ?? "");
711
+ if (err?.code === "NOT_FOUND") return new AccessError("not_installed", msg);
712
+ if (/reject|denied|declin|cancel|user/i.test(msg) || err?.code === "ERR_USER_REJECTED" || err?.status === 4001) {
713
+ return new AccessError("user_rejected", msg);
714
+ }
715
+ return new AccessError("bad_request", msg || "access failed");
716
+ }
717
+ function throwIfAccessError(body) {
718
+ const b = body;
719
+ if (b && typeof b.error === "string") throw new AccessError(b.error, b.message, { have: b.have, need: b.need });
720
+ }
721
+ function hash160FromP2pkh(script) {
722
+ const m = /^76a914([0-9a-f]{40})88ac$/i.exec(script.slice(-50));
723
+ return m ? m[1].toLowerCase() : null;
724
+ }
725
+ async function proveHoldings(wallet, challenge, tokenId, basket = "bsv21") {
726
+ const bare = tokenId.replace(/^bsv21:/, "");
727
+ const list = await wallet.listOutputs({ basket, include: "locking scripts", includeCustomInstructions: true, limit: 1e4 });
728
+ const byKey = /* @__PURE__ */ new Map();
729
+ const data = challengeBytes(challenge);
730
+ for (const out of list.outputs) {
731
+ if (byKey.size >= MAX_HOLDING_PROOFS) break;
732
+ let ci = {};
733
+ try {
734
+ ci = JSON.parse(out.customInstructions ?? "{}");
735
+ } catch {
736
+ continue;
737
+ }
738
+ if (ci.id !== bare || !ci.keyID) continue;
739
+ const want = out.lockingScript ? hash160FromP2pkh(out.lockingScript) : null;
740
+ const counterparty = ci.counterparty ?? "self";
741
+ for (const protocolID of ci.protocolID ? [ci.protocolID] : [ONESAT, LEGACY_ONESAT]) {
742
+ const { publicKey } = await wallet.getPublicKey({ protocolID, keyID: ci.keyID, counterparty });
743
+ const h = import_sdk3.Utils.toHex(import_sdk3.Hash.hash160(import_sdk3.PublicKey.fromString(publicKey).encode(true)));
744
+ if (want && h !== want) continue;
745
+ const existing = byKey.get(publicKey);
746
+ if (existing) {
747
+ existing.outpoints.push(out.outpoint.replace(".", "_"));
748
+ break;
749
+ }
750
+ const { signature } = await wallet.createSignature({ protocolID, keyID: ci.keyID, counterparty, data });
751
+ byKey.set(publicKey, { pubkey: publicKey, signature: Array.from(signature), outpoints: [out.outpoint.replace(".", "_")] });
752
+ break;
753
+ }
754
+ }
755
+ return [...byKey.values()];
756
+ }
757
+ async function requestAccess(o) {
758
+ let wallet;
759
+ try {
760
+ ({ wallet } = await connectBwalletX({ wallet: o.wallet, pairing: o.pairing, discoverMs: o.discoverMs }));
761
+ } catch (e) {
762
+ throw e?.code === "NOT_FOUND" ? new AccessError("not_installed") : toAccessError(e);
763
+ }
764
+ try {
765
+ const { publicKey: identityKey } = await wallet.getPublicKey({ identityKey: true });
766
+ const { challenge } = await o.challenge(identityKey);
767
+ const c = parseAccessChallenge(challenge);
768
+ if (c.sub && c.sub !== identityKey.toLowerCase()) throw new AccessError("wrong_account");
769
+ if (Date.now() / 1e3 >= c.exp) throw new AccessError("expired");
770
+ const { signature } = await wallet.createSignature({
771
+ protocolID: ACCESS_PROTOCOL,
772
+ keyID: c.nonce,
773
+ counterparty: "anyone",
774
+ data: challengeBytes(challenge)
775
+ });
776
+ const response = { v: 1, challenge, identityKey, signature: Array.from(signature) };
777
+ if (c.require.token) response.holdings = await proveHoldings(wallet, challenge, c.require.token.id, o.tokenBasket);
778
+ let verified;
779
+ if (o.verify) {
780
+ verified = await o.verify(response);
781
+ throwIfAccessError(verified);
782
+ }
783
+ return { response, verified, wallet };
784
+ } catch (e) {
785
+ throw toAccessError(e);
786
+ }
787
+ }
788
+
544
789
  // src/element.ts
545
790
  var SIGNIN_TAG = "bwalletx-signin";
546
791
  var GET_URL = "https://bwalletx.com/get";
@@ -636,6 +881,10 @@ async function postJson(url, body) {
636
881
  if (!res.ok) throw new Error(data.error ?? `HTTP ${res.status}`);
637
882
  return data;
638
883
  }
884
+ async function postAccess(url, body) {
885
+ const res = await fetch(url, { method: "POST", credentials: "include", headers: { "content-type": "application/json" }, body: JSON.stringify(body) });
886
+ return res.json().catch(() => ({ error: "bad_request", message: `HTTP ${res.status}` }));
887
+ }
639
888
  var OBSERVED = ["size", "theme", "label", "brand", "subtitle", "loading", "disabled", "full-width", "aria-label", "get-url", "web-url"];
640
889
  function createClass() {
641
890
  return class BwalletxSigninElement extends HTMLElement {
@@ -718,6 +967,26 @@ function createClass() {
718
967
  if (!found) {
719
968
  this.#notFound = true;
720
969
  this.#emit("bwalletx-not-found");
970
+ if (this.#attr("require-token")) this.#emit("bwalletx-access-denied", { code: "not_installed", message: "No wallet found" });
971
+ return;
972
+ }
973
+ const requireToken = this.#attr("require-token");
974
+ if (requireToken) {
975
+ const verifyUrl2 = this.#attr("verify-url");
976
+ const min = this.#attr("min");
977
+ const minBps = this.#attr("min-bps");
978
+ const hint = { token: { id: requireToken, ...minBps ? { minBps: Number(minBps) } : { min: min ?? "1" } } };
979
+ try {
980
+ const a = await requestAccess({
981
+ wallet: found.wallet,
982
+ challenge: (identityKey) => postJson(challengeUrl, { identityKey, require: hint }),
983
+ verify: verifyUrl2 ? (response2) => postAccess(verifyUrl2, response2) : void 0
984
+ });
985
+ this.#emit("bwalletx-access-granted", { identityKey: a.response.identityKey, response: a.verified });
986
+ } catch (e) {
987
+ const err = e instanceof AccessError ? e : new AccessError("bad_request", String(e));
988
+ this.#emit("bwalletx-access-denied", { code: err.code, message: err.message, have: err.have, need: err.need });
989
+ }
721
990
  return;
722
991
  }
723
992
  const r = await signInWithBwalletX({ wallet: found.wallet, challenge: (identityKey) => postJson(challengeUrl, { identityKey }) });
@@ -742,7 +1011,7 @@ function defineBwalletxSignin(tag = SIGNIN_TAG) {
742
1011
  }
743
1012
 
744
1013
  // src/pay.ts
745
- var import_sdk3 = require("@bsv/sdk");
1014
+ var import_sdk4 = require("@bsv/sdk");
746
1015
  var BRC29_PROTOCOL = [2, "3241645161d8"];
747
1016
  var PaymentError = class extends Error {
748
1017
  constructor(code, message, maybeSent = false, cause) {
@@ -762,13 +1031,13 @@ var isPaymail = (s) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s);
762
1031
  function randomB64(n) {
763
1032
  const b = new Uint8Array(n);
764
1033
  globalThis.crypto.getRandomValues(b);
765
- return import_sdk3.Utils.toBase64(Array.from(b));
1034
+ return import_sdk4.Utils.toBase64(Array.from(b));
766
1035
  }
767
1036
  function opReturn(text) {
768
- const d = import_sdk3.Utils.toArray(text, "utf8");
1037
+ const d = import_sdk4.Utils.toArray(text, "utf8");
769
1038
  const len = d.length;
770
1039
  const push = len < 76 ? [len] : len <= 255 ? [76, len] : [77, len & 255, len >> 8];
771
- return import_sdk3.Utils.toHex([0, 106, ...push, ...d]);
1040
+ return import_sdk4.Utils.toHex([0, 106, ...push, ...d]);
772
1041
  }
773
1042
  var clip = (s, n) => s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
774
1043
  var describe = (s) => clip(s.length < 5 ? `${s} payment`.trim() : s, 50);
@@ -864,7 +1133,7 @@ async function pay(source, req, o = {}) {
864
1133
  } catch (e) {
865
1134
  throw new PaymentError("WALLET_ERROR", `The wallet could not derive the payment key: ${e.message}`, false, e);
866
1135
  }
867
- outputs = [{ script: new import_sdk3.P2PKH().lock(import_sdk3.PublicKey.fromString(pk).toHash()).toHex(), satoshis: sats, description: "payment" }];
1136
+ outputs = [{ script: new import_sdk4.P2PKH().lock(import_sdk4.PublicKey.fromString(pk).toHash()).toHex(), satoshis: sats, description: "payment" }];
868
1137
  remittance = { senderIdentityKey: me, derivationPrefix, derivationSuffix, outputIndex: 0 };
869
1138
  } else if (isPaymail(to)) {
870
1139
  const r2 = await (o.resolvePaymail ?? ((p, s) => resolvePaymailP2P(p, s, o.fetch ?? fetch)))(to, sats);
@@ -872,7 +1141,7 @@ async function pay(source, req, o = {}) {
872
1141
  submit = r2.submit;
873
1142
  } else {
874
1143
  try {
875
- outputs = [{ script: new import_sdk3.P2PKH().lock(to).toHex(), satoshis: sats, description: "payment" }];
1144
+ outputs = [{ script: new import_sdk4.P2PKH().lock(to).toHex(), satoshis: sats, description: "payment" }];
876
1145
  } catch {
877
1146
  throw new PaymentError("BAD_REQUEST", `Not a paymail, address or identity key: ${to}`);
878
1147
  }
@@ -882,7 +1151,7 @@ async function pay(source, req, o = {}) {
882
1151
  if (!r.txid) throw new PaymentError("WALLET_ERROR", "The wallet did not return a txid", true);
883
1152
  const tx = r.tx ? Array.from(r.tx) : void 0;
884
1153
  if (submit && tx) {
885
- await submit(import_sdk3.Transaction.fromAtomicBEEF(tx).toHex()).catch(() => {
1154
+ await submit(import_sdk4.Transaction.fromAtomicBEEF(tx).toHex()).catch(() => {
886
1155
  });
887
1156
  }
888
1157
  return { txid: r.txid, tx, sats, outputs, remittance };
@@ -903,7 +1172,7 @@ async function buyToken(source, req) {
903
1172
  }
904
1173
 
905
1174
  // src/wallets.ts
906
- var import_sdk4 = require("@bsv/sdk");
1175
+ var import_sdk5 = require("@bsv/sdk");
907
1176
  async function brc100Connected(wallet, o) {
908
1177
  await wallet.waitForAuthentication({}).catch(() => {
909
1178
  });
@@ -962,7 +1231,7 @@ function handcashAdapter(o) {
962
1231
  var NAMES = { [RDNS_EXTENSION]: "bWalletX", "space.bwallet.mobile": "bWalletX" };
963
1232
  async function probe(substrate, ms) {
964
1233
  try {
965
- const w = new import_sdk4.WalletClient(substrate);
1234
+ const w = new import_sdk5.WalletClient(substrate);
966
1235
  const ok = await Promise.race([w.isAuthenticated({}).then(() => true), new Promise((r) => setTimeout(() => r(false), ms))]);
967
1236
  return ok ? w : null;
968
1237
  } catch {
@@ -1120,21 +1389,28 @@ function pickWallet(options, o = {}) {
1120
1389
  }
1121
1390
  // Annotate the CommonJS export names for ESM import in node:
1122
1391
  0 && (module.exports = {
1392
+ ACCESS_ERROR_STATUS,
1393
+ ACCESS_PROTOCOL,
1394
+ ACCESS_VERSION,
1395
+ AccessError,
1123
1396
  BRC29_PROTOCOL,
1124
1397
  BWALLETX_RDNS,
1125
1398
  GET_URL,
1126
1399
  LOGIN_PROTOCOL,
1127
1400
  LOGO_URL,
1401
+ PROTOCOL_MEDIA,
1128
1402
  PaymentError,
1129
1403
  RDNS_EXTENSION,
1130
1404
  RDNS_MOBILE,
1131
1405
  SIGNIN_CSS,
1132
1406
  SIGNIN_TAG,
1133
1407
  WEB_WALLET_URL,
1408
+ accessErrorMessage,
1134
1409
  amountInSats,
1135
1410
  brc100Option,
1136
1411
  buildAuthorizeUrl,
1137
1412
  buyToken,
1413
+ canonicalJson,
1138
1414
  clearPairing,
1139
1415
  connectBwalletX,
1140
1416
  defineBwalletxSignin,
@@ -1151,12 +1427,17 @@ function pickWallet(options, o = {}) {
1151
1427
  pairingOption,
1152
1428
  pay,
1153
1429
  pickWallet,
1430
+ protocolMediaUrl,
1431
+ proveHoldings,
1154
1432
  qrSvg,
1155
1433
  renderButton,
1434
+ requestAccess,
1156
1435
  resolvePaymailP2P,
1157
1436
  restorePairing,
1158
1437
  signInWithBwalletX,
1159
1438
  signinText,
1160
- tip
1439
+ throwIfAccessError,
1440
+ tip,
1441
+ toAccessError
1161
1442
  });
1162
1443
  //# sourceMappingURL=index.cjs.map