@bwalletx/connect 0.5.0 → 0.5.4

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.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { WalletInterface, WalletProtocol } from '@bsv/sdk';
2
- import { f as PairingOptions, W as WalletOption } from './wallets-VOKIKBbO.cjs';
3
- export { g as BRC29_PROTOCOL, i as Brc29Remittance, B as BuyTokenRequest, C as ConnectedWallet, D as DiscoverWalletsOptions, H as HandCashAdapterOptions, L as LegacyPayer, j as PairConnectionOptions, k as PairStorage, l as PairedWallet, b as PayOptions, m as PayOutput, P as PayRequest, a as PayResult, n as PaySource, c as PaymentError, o as PaymentErrorCode, S as SocketFactory, q as SocketLike, T as TokenQuote, r as WalletKind, s as amountInSats, d as brc100Option, t as buyToken, u as clearPairing, e as discoverWallets, h as handcashAdapter, v as isIdentityKeyHex, w as isPaymail, x as pairBwalletX, p as pairingOption, y as pay, z as resolvePaymailP2P, A as restorePairing, E as tip } from './wallets-VOKIKBbO.cjs';
2
+ import { f as PairingOptions, W as WalletOption } from './wallets-CbzMtxrf.cjs';
3
+ export { g as BRC29_PROTOCOL, i as Brc29Remittance, B as BuyTokenRequest, C as ConnectedWallet, D as DiscoverWalletsOptions, H as HandCashAdapterOptions, L as LegacyPayer, j as PairConnectionOptions, k as PairStorage, l as PairedWallet, b as PayOptions, m as PayOutput, P as PayRequest, a as PayResult, n as PaySource, c as PaymentError, o as PaymentErrorCode, S as SocketFactory, q as SocketLike, T as TokenQuote, r as WalletKind, s as amountInSats, d as brc100Option, t as buyToken, u as clearPairing, e as discoverWallets, h as handcashAdapter, v as isIdentityKeyHex, w as isPaymail, x as pairBwalletX, p as pairingOption, y as pay, z as resolvePaymailP2P, A as restorePairing, E as tip } from './wallets-CbzMtxrf.cjs';
4
4
  export { AuthorizeParams, GET_URL, SIGNIN_CSS, SIGNIN_TAG, SigninBrand, SigninLabel, SigninSize, SigninTheme, WEB_WALLET_URL, buildAuthorizeUrl, defineBwalletxSignin, markSvg, signinText } from './element.cjs';
5
- import { b as AccessResponse, H as HoldingProof, A as AccessError } from './access-Z6xQwKVF.cjs';
6
- export { c as ACCESS_ERROR_STATUS, d as ACCESS_PROTOCOL, e as ACCESS_VERSION, f as AccessChallenge, g as AccessErrorBody, h as AccessErrorCode, i as AccessKind, a as AccessRequirement, P as PROTOCOL_MEDIA, T as TokenRequirement, j as accessErrorMessage, k as canonicalJson, p as protocolMediaUrl } from './access-Z6xQwKVF.cjs';
5
+ import { b as AccessResponse, H as HoldingProof, A as AccessError } from './access-Dp0eKIOc.cjs';
6
+ export { f as ACCESS_ERROR_STATUS, d as ACCESS_PROTOCOL, g as ACCESS_VERSION, h as AccessChallenge, i as AccessErrorBody, j as AccessErrorCode, c as AccessKind, a as AccessRequirement, P as PROTOCOL_MEDIA, T as TokenRequirement, k as accessErrorMessage, m as canonicalJson, r as protocolMediaUrl } from './access-Dp0eKIOc.cjs';
7
7
 
8
8
  /** Ids bWalletX announces in BRC-100 wallet discovery. */
9
9
  declare const RDNS_EXTENSION = "com.bwalletx.extension";
@@ -16,10 +16,17 @@ interface FoundWallet {
16
16
  method: FoundBy;
17
17
  rdns: string | null;
18
18
  }
19
+ /**
20
+ * Default wait for a wallet that has not answered yet, ms. bWalletX for Chrome answers `brc100:requestWallet`
21
+ * synchronously and the in-app browser sets `window.CWI` before the page runs, so a found wallet resolves at once;
22
+ * this is only how long "nothing here" takes before the pairing QR shows. Was 1200 (0.5.3 and earlier).
23
+ */
24
+ declare const DEFAULT_DISCOVER_MS = 300;
19
25
  /**
20
26
  * Like findBwalletX, but also says which bWalletX answered.
21
- * Order: a BRC-100 announcement with a bWalletX rdns; then `window.CWI` (set by the in-app
22
- * browser, and by older builds that do not announce); otherwise null.
27
+ * Order: a BRC-100 announcement with a bWalletX rdns (answered at once by the extension); then `window.CWI` (set by
28
+ * the in-app browser, and by older builds that do not announce), taken straight away; then, only when framed, the
29
+ * parent's XDM answer (probed in parallel with the wait). Otherwise null after `ms`.
23
30
  */
24
31
  declare function discoverBwalletX(ms?: number): Promise<FoundWallet | null>;
25
32
  /**
@@ -27,6 +34,15 @@ declare function discoverBwalletX(ms?: number): Promise<FoundWallet | null>;
27
34
  * open in bWalletX's in-app browser. Resolves null if nothing answered within `ms`.
28
35
  */
29
36
  declare function findBwalletX(ms?: number): Promise<WalletInterface | null>;
37
+ /**
38
+ * Wake the wallet before the click (call on pointerenter / focus / touchstart of your Connect button). Chrome stops an
39
+ * idle extension worker after ~30 s, and a cold worker needs 1-3 s to reopen the wallet; this sends a liveness call
40
+ * (isAuthenticated: never shows a prompt, never reveals a key) so that work starts while the pointer is on its way.
41
+ * At most once every 20 s. Does nothing when no bWalletX is in the page.
42
+ */
43
+ declare function prewarmBwalletX(): void;
44
+ /** Prewarm on hover, keyboard focus and touch. Returns a function that removes the listeners. */
45
+ declare function bindPrewarm(el: EventTarget): () => void;
30
46
 
31
47
  /** Security level 2, a protocol name used for nothing else. */
32
48
  declare const LOGIN_PROTOCOL: WalletProtocol;
@@ -38,6 +54,12 @@ interface Challenge {
38
54
  protocolID?: WalletProtocol;
39
55
  }
40
56
  type SignInMethod = 'extension' | 'in-app' | 'pairing' | 'wallet';
57
+ /**
58
+ * Progress for the button label. 'finding': looking for a wallet (sub-second); 'opening': a wallet was found and its
59
+ * approval is on the way ("Opening your wallet…"); 'pairing': no wallet in this browser, the QR is showing;
60
+ * 'signing': the identity key arrived, the sign-in signature is being asked for.
61
+ */
62
+ type SignInStatus = 'finding' | 'opening' | 'pairing' | 'signing';
41
63
  interface SignInOptions {
42
64
  /** Ask your server for a challenge for this identity key. */
43
65
  challenge: (identityKey: string) => Promise<Challenge>;
@@ -47,8 +69,10 @@ interface SignInOptions {
47
69
  pairing?: PairingOptions;
48
70
  /** Reuse a pairing stored by an earlier sign-in before showing a new QR. Default true. */
49
71
  reusePairing?: boolean;
50
- /** How long to wait for the extension or in-app browser to answer, in ms. Default 1200. */
72
+ /** How long to wait for a wallet that has not answered, in ms, before pairing. Default 300 (a present wallet answers at once). */
51
73
  discoverMs?: number;
74
+ /** Called as the sign-in moves on, so the button can say "Opening your wallet…" straight away. */
75
+ onStatus?: (status: SignInStatus) => void;
52
76
  }
53
77
  interface SignInResult {
54
78
  identityKey: string;
@@ -60,7 +84,7 @@ interface SignInResult {
60
84
  wallet: WalletInterface;
61
85
  }
62
86
  /** Find a wallet: extension or in-app browser first, then a stored pairing, then a new pairing. */
63
- declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing' | 'reusePairing' | 'discoverMs'>): Promise<{
87
+ declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing' | 'reusePairing' | 'discoverMs' | 'onStatus'>): Promise<{
64
88
  wallet: WalletInterface;
65
89
  method: SignInMethod;
66
90
  }>;
@@ -69,6 +93,8 @@ declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing'
69
93
  * identityKey, nonce and signature to your verify route.
70
94
  */
71
95
  declare function signInWithBwalletX(opts: SignInOptions): Promise<SignInResult>;
96
+ /** Where a sign-in failed: the wallet's identity prompt, the site's challenge endpoint, or the wallet's signature. */
97
+ type SignInStage = 'identity' | 'challenge' | 'signature' | 'verify';
72
98
 
73
99
  declare const LOGO_URL = "https://bwalletx.com/logo.svg";
74
100
  interface ButtonOptions {
@@ -91,8 +117,23 @@ declare function inOrder<T>(handle: (frame: T) => Promise<void> | void, onError?
91
117
 
92
118
  /** An SVG QR code for `text` (error correction M). */
93
119
  declare function qrSvg(text: string): string;
120
+ /**
121
+ * True on a phone or tablet: a coarse pointer with no hover, or a mobile user agent (iPadOS reports
122
+ * a Mac UA, so touch points count too). Scanning a QR shown on the same screen is impossible there.
123
+ */
124
+ declare function isTouchDevice(env?: {
125
+ navigator?: Navigator;
126
+ matchMedia?: (q: string) => MediaQueryList;
127
+ }): boolean;
94
128
  interface PairingModalOptions {
95
129
  title?: string;
130
+ /**
131
+ * 'qr' shows the pairing QR (desktop). 'app' hands off to the bWalletX app on this device: the
132
+ * pairing link is a universal link / Android app link that opens the app, and the bwallet.space
133
+ * page behind it explains what to do when the app is not installed. Default 'auto': 'app' on touch
134
+ * devices, 'qr' elsewhere.
135
+ */
136
+ mode?: 'auto' | 'qr' | 'app';
96
137
  /** Called when the user closes the modal (the pairing is then aborted). */
97
138
  onCancel?: () => void;
98
139
  }
@@ -150,4 +191,14 @@ declare function proveHoldings(wallet: WalletInterface, challenge: string, token
150
191
  */
151
192
  declare function requestAccess(o: RequestAccessOptions): Promise<RequestAccessResult>;
152
193
 
153
- export { type AccessChallengeLike, AccessError, AccessResponse, BWALLETX_RDNS, type ButtonOptions, type Challenge, type FoundBy, type FoundWallet, HoldingProof, LOGIN_PROTOCOL, LOGO_URL, type PairingModalOptions, PairingOptions, RDNS_EXTENSION, RDNS_MOBILE, type RequestAccessOptions, type RequestAccessResult, type SignInMethod, type SignInOptions, type SignInResult, WalletOption, connectBwalletX, discoverBwalletX, findBwalletX, inOrder, pairingModal, pickWallet, proveHoldings, qrSvg, renderButton, requestAccess, signInWithBwalletX, throwIfAccessError, toAccessError };
194
+ /**
195
+ * Site theme for the wallet. A site may ask bWalletX to wear one of the themes the wallet already bundles
196
+ * (e.g. 'npgx') while the site is connected and is the active tab; the wallet puts the user's own theme back on
197
+ * any other site or when this declaration is removed. Only an id is declared: the wallet decides whether this
198
+ * origin may wear it (brand editions are locked to their own sites) and never loads colours, CSS or URLs from here.
199
+ */
200
+ declare const WALLET_THEME_META = "bwalletx-theme";
201
+ /** Declare (or with null, withdraw) the theme the wallet should wear for this page. No-op outside a browser. */
202
+ declare function declareWalletTheme(theme: string | null | undefined): void;
203
+
204
+ export { type AccessChallengeLike, AccessError, AccessResponse, BWALLETX_RDNS, type ButtonOptions, type Challenge, DEFAULT_DISCOVER_MS, type FoundBy, type FoundWallet, HoldingProof, LOGIN_PROTOCOL, LOGO_URL, type PairingModalOptions, PairingOptions, RDNS_EXTENSION, RDNS_MOBILE, type RequestAccessOptions, type RequestAccessResult, type SignInMethod, type SignInOptions, type SignInResult, type SignInStage, type SignInStatus, WALLET_THEME_META, WalletOption, bindPrewarm, connectBwalletX, declareWalletTheme, discoverBwalletX, findBwalletX, inOrder, isTouchDevice, pairingModal, pickWallet, prewarmBwalletX, proveHoldings, qrSvg, renderButton, requestAccess, signInWithBwalletX, throwIfAccessError, toAccessError };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { WalletInterface, WalletProtocol } from '@bsv/sdk';
2
- import { f as PairingOptions, W as WalletOption } from './wallets-VOKIKBbO.js';
3
- export { g as BRC29_PROTOCOL, i as Brc29Remittance, B as BuyTokenRequest, C as ConnectedWallet, D as DiscoverWalletsOptions, H as HandCashAdapterOptions, L as LegacyPayer, j as PairConnectionOptions, k as PairStorage, l as PairedWallet, b as PayOptions, m as PayOutput, P as PayRequest, a as PayResult, n as PaySource, c as PaymentError, o as PaymentErrorCode, S as SocketFactory, q as SocketLike, T as TokenQuote, r as WalletKind, s as amountInSats, d as brc100Option, t as buyToken, u as clearPairing, e as discoverWallets, h as handcashAdapter, v as isIdentityKeyHex, w as isPaymail, x as pairBwalletX, p as pairingOption, y as pay, z as resolvePaymailP2P, A as restorePairing, E as tip } from './wallets-VOKIKBbO.js';
2
+ import { f as PairingOptions, W as WalletOption } from './wallets-CbzMtxrf.js';
3
+ export { g as BRC29_PROTOCOL, i as Brc29Remittance, B as BuyTokenRequest, C as ConnectedWallet, D as DiscoverWalletsOptions, H as HandCashAdapterOptions, L as LegacyPayer, j as PairConnectionOptions, k as PairStorage, l as PairedWallet, b as PayOptions, m as PayOutput, P as PayRequest, a as PayResult, n as PaySource, c as PaymentError, o as PaymentErrorCode, S as SocketFactory, q as SocketLike, T as TokenQuote, r as WalletKind, s as amountInSats, d as brc100Option, t as buyToken, u as clearPairing, e as discoverWallets, h as handcashAdapter, v as isIdentityKeyHex, w as isPaymail, x as pairBwalletX, p as pairingOption, y as pay, z as resolvePaymailP2P, A as restorePairing, E as tip } from './wallets-CbzMtxrf.js';
4
4
  export { AuthorizeParams, GET_URL, SIGNIN_CSS, SIGNIN_TAG, SigninBrand, SigninLabel, SigninSize, SigninTheme, WEB_WALLET_URL, buildAuthorizeUrl, defineBwalletxSignin, markSvg, signinText } from './element.js';
5
- import { b as AccessResponse, H as HoldingProof, A as AccessError } from './access-Z6xQwKVF.js';
6
- export { c as ACCESS_ERROR_STATUS, d as ACCESS_PROTOCOL, e as ACCESS_VERSION, f as AccessChallenge, g as AccessErrorBody, h as AccessErrorCode, i as AccessKind, a as AccessRequirement, P as PROTOCOL_MEDIA, T as TokenRequirement, j as accessErrorMessage, k as canonicalJson, p as protocolMediaUrl } from './access-Z6xQwKVF.js';
5
+ import { b as AccessResponse, H as HoldingProof, A as AccessError } from './access-Dp0eKIOc.js';
6
+ export { f as ACCESS_ERROR_STATUS, d as ACCESS_PROTOCOL, g as ACCESS_VERSION, h as AccessChallenge, i as AccessErrorBody, j as AccessErrorCode, c as AccessKind, a as AccessRequirement, P as PROTOCOL_MEDIA, T as TokenRequirement, k as accessErrorMessage, m as canonicalJson, r as protocolMediaUrl } from './access-Dp0eKIOc.js';
7
7
 
8
8
  /** Ids bWalletX announces in BRC-100 wallet discovery. */
9
9
  declare const RDNS_EXTENSION = "com.bwalletx.extension";
@@ -16,10 +16,17 @@ interface FoundWallet {
16
16
  method: FoundBy;
17
17
  rdns: string | null;
18
18
  }
19
+ /**
20
+ * Default wait for a wallet that has not answered yet, ms. bWalletX for Chrome answers `brc100:requestWallet`
21
+ * synchronously and the in-app browser sets `window.CWI` before the page runs, so a found wallet resolves at once;
22
+ * this is only how long "nothing here" takes before the pairing QR shows. Was 1200 (0.5.3 and earlier).
23
+ */
24
+ declare const DEFAULT_DISCOVER_MS = 300;
19
25
  /**
20
26
  * Like findBwalletX, but also says which bWalletX answered.
21
- * Order: a BRC-100 announcement with a bWalletX rdns; then `window.CWI` (set by the in-app
22
- * browser, and by older builds that do not announce); otherwise null.
27
+ * Order: a BRC-100 announcement with a bWalletX rdns (answered at once by the extension); then `window.CWI` (set by
28
+ * the in-app browser, and by older builds that do not announce), taken straight away; then, only when framed, the
29
+ * parent's XDM answer (probed in parallel with the wait). Otherwise null after `ms`.
23
30
  */
24
31
  declare function discoverBwalletX(ms?: number): Promise<FoundWallet | null>;
25
32
  /**
@@ -27,6 +34,15 @@ declare function discoverBwalletX(ms?: number): Promise<FoundWallet | null>;
27
34
  * open in bWalletX's in-app browser. Resolves null if nothing answered within `ms`.
28
35
  */
29
36
  declare function findBwalletX(ms?: number): Promise<WalletInterface | null>;
37
+ /**
38
+ * Wake the wallet before the click (call on pointerenter / focus / touchstart of your Connect button). Chrome stops an
39
+ * idle extension worker after ~30 s, and a cold worker needs 1-3 s to reopen the wallet; this sends a liveness call
40
+ * (isAuthenticated: never shows a prompt, never reveals a key) so that work starts while the pointer is on its way.
41
+ * At most once every 20 s. Does nothing when no bWalletX is in the page.
42
+ */
43
+ declare function prewarmBwalletX(): void;
44
+ /** Prewarm on hover, keyboard focus and touch. Returns a function that removes the listeners. */
45
+ declare function bindPrewarm(el: EventTarget): () => void;
30
46
 
31
47
  /** Security level 2, a protocol name used for nothing else. */
32
48
  declare const LOGIN_PROTOCOL: WalletProtocol;
@@ -38,6 +54,12 @@ interface Challenge {
38
54
  protocolID?: WalletProtocol;
39
55
  }
40
56
  type SignInMethod = 'extension' | 'in-app' | 'pairing' | 'wallet';
57
+ /**
58
+ * Progress for the button label. 'finding': looking for a wallet (sub-second); 'opening': a wallet was found and its
59
+ * approval is on the way ("Opening your wallet…"); 'pairing': no wallet in this browser, the QR is showing;
60
+ * 'signing': the identity key arrived, the sign-in signature is being asked for.
61
+ */
62
+ type SignInStatus = 'finding' | 'opening' | 'pairing' | 'signing';
41
63
  interface SignInOptions {
42
64
  /** Ask your server for a challenge for this identity key. */
43
65
  challenge: (identityKey: string) => Promise<Challenge>;
@@ -47,8 +69,10 @@ interface SignInOptions {
47
69
  pairing?: PairingOptions;
48
70
  /** Reuse a pairing stored by an earlier sign-in before showing a new QR. Default true. */
49
71
  reusePairing?: boolean;
50
- /** How long to wait for the extension or in-app browser to answer, in ms. Default 1200. */
72
+ /** How long to wait for a wallet that has not answered, in ms, before pairing. Default 300 (a present wallet answers at once). */
51
73
  discoverMs?: number;
74
+ /** Called as the sign-in moves on, so the button can say "Opening your wallet…" straight away. */
75
+ onStatus?: (status: SignInStatus) => void;
52
76
  }
53
77
  interface SignInResult {
54
78
  identityKey: string;
@@ -60,7 +84,7 @@ interface SignInResult {
60
84
  wallet: WalletInterface;
61
85
  }
62
86
  /** Find a wallet: extension or in-app browser first, then a stored pairing, then a new pairing. */
63
- declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing' | 'reusePairing' | 'discoverMs'>): Promise<{
87
+ declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing' | 'reusePairing' | 'discoverMs' | 'onStatus'>): Promise<{
64
88
  wallet: WalletInterface;
65
89
  method: SignInMethod;
66
90
  }>;
@@ -69,6 +93,8 @@ declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing'
69
93
  * identityKey, nonce and signature to your verify route.
70
94
  */
71
95
  declare function signInWithBwalletX(opts: SignInOptions): Promise<SignInResult>;
96
+ /** Where a sign-in failed: the wallet's identity prompt, the site's challenge endpoint, or the wallet's signature. */
97
+ type SignInStage = 'identity' | 'challenge' | 'signature' | 'verify';
72
98
 
73
99
  declare const LOGO_URL = "https://bwalletx.com/logo.svg";
74
100
  interface ButtonOptions {
@@ -91,8 +117,23 @@ declare function inOrder<T>(handle: (frame: T) => Promise<void> | void, onError?
91
117
 
92
118
  /** An SVG QR code for `text` (error correction M). */
93
119
  declare function qrSvg(text: string): string;
120
+ /**
121
+ * True on a phone or tablet: a coarse pointer with no hover, or a mobile user agent (iPadOS reports
122
+ * a Mac UA, so touch points count too). Scanning a QR shown on the same screen is impossible there.
123
+ */
124
+ declare function isTouchDevice(env?: {
125
+ navigator?: Navigator;
126
+ matchMedia?: (q: string) => MediaQueryList;
127
+ }): boolean;
94
128
  interface PairingModalOptions {
95
129
  title?: string;
130
+ /**
131
+ * 'qr' shows the pairing QR (desktop). 'app' hands off to the bWalletX app on this device: the
132
+ * pairing link is a universal link / Android app link that opens the app, and the bwallet.space
133
+ * page behind it explains what to do when the app is not installed. Default 'auto': 'app' on touch
134
+ * devices, 'qr' elsewhere.
135
+ */
136
+ mode?: 'auto' | 'qr' | 'app';
96
137
  /** Called when the user closes the modal (the pairing is then aborted). */
97
138
  onCancel?: () => void;
98
139
  }
@@ -150,4 +191,14 @@ declare function proveHoldings(wallet: WalletInterface, challenge: string, token
150
191
  */
151
192
  declare function requestAccess(o: RequestAccessOptions): Promise<RequestAccessResult>;
152
193
 
153
- export { type AccessChallengeLike, AccessError, AccessResponse, BWALLETX_RDNS, type ButtonOptions, type Challenge, type FoundBy, type FoundWallet, HoldingProof, LOGIN_PROTOCOL, LOGO_URL, type PairingModalOptions, PairingOptions, RDNS_EXTENSION, RDNS_MOBILE, type RequestAccessOptions, type RequestAccessResult, type SignInMethod, type SignInOptions, type SignInResult, WalletOption, connectBwalletX, discoverBwalletX, findBwalletX, inOrder, pairingModal, pickWallet, proveHoldings, qrSvg, renderButton, requestAccess, signInWithBwalletX, throwIfAccessError, toAccessError };
194
+ /**
195
+ * Site theme for the wallet. A site may ask bWalletX to wear one of the themes the wallet already bundles
196
+ * (e.g. 'npgx') while the site is connected and is the active tab; the wallet puts the user's own theme back on
197
+ * any other site or when this declaration is removed. Only an id is declared: the wallet decides whether this
198
+ * origin may wear it (brand editions are locked to their own sites) and never loads colours, CSS or URLs from here.
199
+ */
200
+ declare const WALLET_THEME_META = "bwalletx-theme";
201
+ /** Declare (or with null, withdraw) the theme the wallet should wear for this page. No-op outside a browser. */
202
+ declare function declareWalletTheme(theme: string | null | undefined): void;
203
+
204
+ export { type AccessChallengeLike, AccessError, AccessResponse, BWALLETX_RDNS, type ButtonOptions, type Challenge, DEFAULT_DISCOVER_MS, type FoundBy, type FoundWallet, HoldingProof, LOGIN_PROTOCOL, LOGO_URL, type PairingModalOptions, PairingOptions, RDNS_EXTENSION, RDNS_MOBILE, type RequestAccessOptions, type RequestAccessResult, type SignInMethod, type SignInOptions, type SignInResult, type SignInStage, type SignInStatus, WALLET_THEME_META, WalletOption, bindPrewarm, connectBwalletX, declareWalletTheme, discoverBwalletX, findBwalletX, inOrder, isTouchDevice, pairingModal, pickWallet, prewarmBwalletX, proveHoldings, qrSvg, renderButton, requestAccess, signInWithBwalletX, throwIfAccessError, toAccessError };
package/dist/index.js CHANGED
@@ -1,13 +1,16 @@
1
1
  import {
2
2
  BRC29_PROTOCOL,
3
3
  PaymentError,
4
+ WALLET_THEME_META,
4
5
  amountInSats,
5
6
  brc100Option,
6
7
  buyToken,
8
+ declareWalletTheme,
7
9
  discoverWallets,
8
10
  handcashAdapter,
9
11
  isIdentityKeyHex,
10
12
  isPaymail,
13
+ isTouchDevice,
11
14
  pairingModal,
12
15
  pairingOption,
13
16
  pay,
@@ -15,9 +18,10 @@ import {
15
18
  qrSvg,
16
19
  resolvePaymailP2P,
17
20
  tip
18
- } from "./chunk-GF6GUDZL.js";
21
+ } from "./chunk-RIOHG5JH.js";
19
22
  import {
20
23
  BWALLETX_RDNS,
24
+ DEFAULT_DISCOVER_MS,
21
25
  GET_URL,
22
26
  LOGIN_PROTOCOL,
23
27
  RDNS_EXTENSION,
@@ -25,6 +29,7 @@ import {
25
29
  SIGNIN_CSS,
26
30
  SIGNIN_TAG,
27
31
  WEB_WALLET_URL,
32
+ bindPrewarm,
28
33
  buildAuthorizeUrl,
29
34
  clearPairing,
30
35
  connectBwalletX,
@@ -34,6 +39,7 @@ import {
34
39
  inOrder,
35
40
  markSvg,
36
41
  pairBwalletX,
42
+ prewarmBwalletX,
37
43
  proveHoldings,
38
44
  requestAccess,
39
45
  restorePairing,
@@ -41,7 +47,7 @@ import {
41
47
  signinText,
42
48
  throwIfAccessError,
43
49
  toAccessError
44
- } from "./chunk-CVLXFNAG.js";
50
+ } from "./chunk-EXRQJTXF.js";
45
51
  import {
46
52
  ACCESS_ERROR_STATUS,
47
53
  ACCESS_PROTOCOL,
@@ -103,6 +109,7 @@ export {
103
109
  AccessError,
104
110
  BRC29_PROTOCOL,
105
111
  BWALLETX_RDNS,
112
+ DEFAULT_DISCOVER_MS,
106
113
  GET_URL,
107
114
  LOGIN_PROTOCOL,
108
115
  LOGO_URL,
@@ -112,15 +119,18 @@ export {
112
119
  RDNS_MOBILE,
113
120
  SIGNIN_CSS,
114
121
  SIGNIN_TAG,
122
+ WALLET_THEME_META,
115
123
  WEB_WALLET_URL,
116
124
  accessErrorMessage,
117
125
  amountInSats,
126
+ bindPrewarm,
118
127
  brc100Option,
119
128
  buildAuthorizeUrl,
120
129
  buyToken,
121
130
  canonicalJson,
122
131
  clearPairing,
123
132
  connectBwalletX,
133
+ declareWalletTheme,
124
134
  defineBwalletxSignin,
125
135
  discoverBwalletX,
126
136
  discoverWallets,
@@ -129,12 +139,14 @@ export {
129
139
  inOrder,
130
140
  isIdentityKeyHex,
131
141
  isPaymail,
142
+ isTouchDevice,
132
143
  markSvg,
133
144
  pairBwalletX,
134
145
  pairingModal,
135
146
  pairingOption,
136
147
  pay,
137
148
  pickWallet,
149
+ prewarmBwalletX,
138
150
  protocolMediaUrl,
139
151
  proveHoldings,
140
152
  qrSvg,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/button.ts"],"sourcesContent":["const CSS = `\n.bwx-signin{display:inline-flex;align-items:center;gap:12px;min-height:48px;padding:10px 22px 10px 10px;border:0;border-radius:12px;cursor:pointer;background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;text-align:left;font:700 16px/1.2 system-ui,-apple-system,\"Segoe UI\",sans-serif;box-shadow:0 8px 24px rgba(245,158,11,.2)}\n.bwx-signin:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}\n.bwx-signin:focus-visible{outline:2px solid #ffd24d;outline-offset:3px}\n.bwx-signin:disabled{opacity:.6;cursor:wait}\n.bwx-signin .bwx-mark{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:#000;flex:none}\n.bwx-signin small{display:block;font-size:11px;font-weight:500;color:rgba(0,0,0,.6)}`;\n\nexport const LOGO_URL = 'https://bwalletx.com/logo.svg';\n\nexport interface ButtonOptions {\n /** Second line under the label. Default \"also works with bWallet\". false hides it. */\n subtitle?: string | false;\n onClick?: (button: HTMLButtonElement) => void;\n}\n\n/** Put the gold \"Sign in with bWalletX\" button into `el` (replacing its contents). */\nexport function renderButton(el: HTMLElement | string, opts: ButtonOptions = {}): HTMLButtonElement {\n const host = typeof el === 'string' ? document.querySelector<HTMLElement>(el) : el;\n if (!host) throw new Error(`renderButton: no element ${String(el)}`);\n if (!document.getElementById('bwx-signin-css')) {\n const style = document.createElement('style');\n style.id = 'bwx-signin-css';\n style.textContent = CSS;\n document.head.appendChild(style);\n }\n const b = document.createElement('button');\n b.type = 'button';\n b.className = 'bwx-signin';\n const mark = document.createElement('span');\n mark.className = 'bwx-mark';\n const img = document.createElement('img');\n img.src = LOGO_URL;\n img.alt = '';\n img.width = 15;\n img.height = 20;\n mark.appendChild(img);\n const label = document.createElement('span');\n label.className = 'bwx-label';\n label.textContent = 'Sign in with bWalletX';\n const sub = opts.subtitle === undefined ? 'also works with bWallet' : opts.subtitle;\n if (sub) {\n const small = document.createElement('small');\n small.textContent = sub;\n label.appendChild(small);\n }\n b.append(mark, label);\n if (opts.onClick) b.addEventListener('click', () => opts.onClick!(b));\n host.replaceChildren(b);\n return b;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQL,IAAM,WAAW;AASjB,SAAS,aAAa,IAA0B,OAAsB,CAAC,GAAsB;AAClG,QAAM,OAAO,OAAO,OAAO,WAAW,SAAS,cAA2B,EAAE,IAAI;AAChF,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE,CAAC,EAAE;AACnE,MAAI,CAAC,SAAS,eAAe,gBAAgB,GAAG;AAC9C,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,KAAK;AACX,UAAM,cAAc;AACpB,aAAS,KAAK,YAAY,KAAK;AAAA,EACjC;AACA,QAAM,IAAI,SAAS,cAAc,QAAQ;AACzC,IAAE,OAAO;AACT,IAAE,YAAY;AACd,QAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,OAAK,YAAY;AACjB,QAAM,MAAM,SAAS,cAAc,KAAK;AACxC,MAAI,MAAM;AACV,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,OAAK,YAAY,GAAG;AACpB,QAAM,QAAQ,SAAS,cAAc,MAAM;AAC3C,QAAM,YAAY;AAClB,QAAM,cAAc;AACpB,QAAM,MAAM,KAAK,aAAa,SAAY,4BAA4B,KAAK;AAC3E,MAAI,KAAK;AACP,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,cAAc;AACpB,UAAM,YAAY,KAAK;AAAA,EACzB;AACA,IAAE,OAAO,MAAM,KAAK;AACpB,MAAI,KAAK,QAAS,GAAE,iBAAiB,SAAS,MAAM,KAAK,QAAS,CAAC,CAAC;AACpE,OAAK,gBAAgB,CAAC;AACtB,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/button.ts"],"sourcesContent":["const CSS = `\n.bwx-signin{display:inline-flex;align-items:center;gap:12px;min-height:48px;padding:10px 22px 10px 10px;border:0;border-radius:12px;cursor:pointer;background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;text-align:left;font:700 16px/1.2 system-ui,-apple-system,\"Segoe UI\",sans-serif;box-shadow:0 8px 24px rgba(245,158,11,.2)}\n.bwx-signin:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}\n.bwx-signin:focus-visible{outline:2px solid #ffd24d;outline-offset:3px}\n.bwx-signin:disabled{opacity:.6;cursor:wait}\n.bwx-signin .bwx-mark{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:#000;flex:none}\n.bwx-signin small{display:block;font-size:11px;font-weight:500;color:rgba(0,0,0,.6)}`;\n\nexport const LOGO_URL = 'https://bwalletx.com/logo.svg';\n\nexport interface ButtonOptions {\n /** Second line under the label. Default \"also works with bWallet\". false hides it. */\n subtitle?: string | false;\n onClick?: (button: HTMLButtonElement) => void;\n}\n\n/** Put the gold \"Sign in with bWalletX\" button into `el` (replacing its contents). */\nexport function renderButton(el: HTMLElement | string, opts: ButtonOptions = {}): HTMLButtonElement {\n const host = typeof el === 'string' ? document.querySelector<HTMLElement>(el) : el;\n if (!host) throw new Error(`renderButton: no element ${String(el)}`);\n if (!document.getElementById('bwx-signin-css')) {\n const style = document.createElement('style');\n style.id = 'bwx-signin-css';\n style.textContent = CSS;\n document.head.appendChild(style);\n }\n const b = document.createElement('button');\n b.type = 'button';\n b.className = 'bwx-signin';\n const mark = document.createElement('span');\n mark.className = 'bwx-mark';\n const img = document.createElement('img');\n img.src = LOGO_URL;\n img.alt = '';\n img.width = 15;\n img.height = 20;\n mark.appendChild(img);\n const label = document.createElement('span');\n label.className = 'bwx-label';\n label.textContent = 'Sign in with bWalletX';\n const sub = opts.subtitle === undefined ? 'also works with bWallet' : opts.subtitle;\n if (sub) {\n const small = document.createElement('small');\n small.textContent = sub;\n label.appendChild(small);\n }\n b.append(mark, label);\n if (opts.onClick) b.addEventListener('click', () => opts.onClick!(b));\n host.replaceChildren(b);\n return b;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQL,IAAM,WAAW;AASjB,SAAS,aAAa,IAA0B,OAAsB,CAAC,GAAsB;AAClG,QAAM,OAAO,OAAO,OAAO,WAAW,SAAS,cAA2B,EAAE,IAAI;AAChF,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE,CAAC,EAAE;AACnE,MAAI,CAAC,SAAS,eAAe,gBAAgB,GAAG;AAC9C,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,KAAK;AACX,UAAM,cAAc;AACpB,aAAS,KAAK,YAAY,KAAK;AAAA,EACjC;AACA,QAAM,IAAI,SAAS,cAAc,QAAQ;AACzC,IAAE,OAAO;AACT,IAAE,YAAY;AACd,QAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,OAAK,YAAY;AACjB,QAAM,MAAM,SAAS,cAAc,KAAK;AACxC,MAAI,MAAM;AACV,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,OAAK,YAAY,GAAG;AACpB,QAAM,QAAQ,SAAS,cAAc,MAAM;AAC3C,QAAM,YAAY;AAClB,QAAM,cAAc;AACpB,QAAM,MAAM,KAAK,aAAa,SAAY,4BAA4B,KAAK;AAC3E,MAAI,KAAK;AACP,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,cAAc;AACpB,UAAM,YAAY,KAAK;AAAA,EACzB;AACA,IAAE,OAAO,MAAM,KAAK;AACpB,MAAI,KAAK,QAAS,GAAE,iBAAiB,SAAS,MAAM,KAAK,QAAS,CAAC,CAAC;AACpE,OAAK,gBAAgB,CAAC;AACtB,SAAO;AACT;","names":[]}
package/dist/next.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NonceStore, AccessResolver, SessionPayload } from './server.cjs';
2
2
  export { IdentityLinkConflictError, linkIdentity, memoryStore, pgNonceTableSql, pgStore, redisStore, signInOrLink } from './server.cjs';
3
- import { A as AccessError, a as AccessRequirement } from './access-Z6xQwKVF.cjs';
3
+ import { A as AccessError, a as AccessRequirement } from './access-Dp0eKIOc.cjs';
4
4
  import '@bsv/sdk';
5
5
 
6
6
  interface VerifiedExtra {
package/dist/next.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NonceStore, AccessResolver, SessionPayload } from './server.js';
2
2
  export { IdentityLinkConflictError, linkIdentity, memoryStore, pgNonceTableSql, pgStore, redisStore, signInOrLink } from './server.js';
3
- import { A as AccessError, a as AccessRequirement } from './access-Z6xQwKVF.js';
3
+ import { A as AccessError, a as AccessRequirement } from './access-Dp0eKIOc.js';
4
4
  import '@bsv/sdk';
5
5
 
6
6
  interface VerifiedExtra {