@bwalletx/connect 0.5.4 → 0.7.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 (50) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +97 -9
  3. package/dist/bwalletx-connect.global.js +97 -25
  4. package/dist/bwalletx-connect.global.js.map +1 -1
  5. package/dist/choice-B97AjqF4.d.cts +442 -0
  6. package/dist/choice-B97AjqF4.d.ts +442 -0
  7. package/dist/chunk-6EFFOIHK.js +2441 -0
  8. package/dist/chunk-6EFFOIHK.js.map +1 -0
  9. package/dist/{chunk-QRXFL66W.js → chunk-A2WLGS25.js} +6 -4
  10. package/dist/chunk-A2WLGS25.js.map +1 -0
  11. package/dist/chunk-DIKJFKND.js +239 -0
  12. package/dist/chunk-DIKJFKND.js.map +1 -0
  13. package/dist/chunk-TNRI7ARM.js +206 -0
  14. package/dist/chunk-TNRI7ARM.js.map +1 -0
  15. package/dist/element-BXEoOdXY.d.cts +53 -0
  16. package/dist/element-BXEoOdXY.d.ts +53 -0
  17. package/dist/element.cjs +1576 -60
  18. package/dist/element.cjs.map +1 -1
  19. package/dist/element.d.cts +26 -26
  20. package/dist/element.d.ts +26 -26
  21. package/dist/element.js +35 -2
  22. package/dist/element.js.map +1 -1
  23. package/dist/index.cjs +2046 -454
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +323 -16
  26. package/dist/index.d.ts +323 -16
  27. package/dist/index.js +186 -12
  28. package/dist/index.js.map +1 -1
  29. package/dist/next.cjs +5 -3
  30. package/dist/next.cjs.map +1 -1
  31. package/dist/next.js +1 -1
  32. package/dist/react.cjs +1601 -210
  33. package/dist/react.cjs.map +1 -1
  34. package/dist/react.d.cts +115 -9
  35. package/dist/react.d.ts +115 -9
  36. package/dist/react.js +262 -46
  37. package/dist/react.js.map +1 -1
  38. package/dist/server.cjs +5 -3
  39. package/dist/server.cjs.map +1 -1
  40. package/dist/server.d.cts +8 -3
  41. package/dist/server.d.ts +8 -3
  42. package/dist/server.js +1 -1
  43. package/package.json +10 -9
  44. package/dist/chunk-EXRQJTXF.js +0 -910
  45. package/dist/chunk-EXRQJTXF.js.map +0 -1
  46. package/dist/chunk-QRXFL66W.js.map +0 -1
  47. package/dist/chunk-RIOHG5JH.js +0 -459
  48. package/dist/chunk-RIOHG5JH.js.map +0 -1
  49. package/dist/wallets-CbzMtxrf.d.cts +0 -250
  50. package/dist/wallets-CbzMtxrf.d.ts +0 -250
package/dist/react.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ReactNode, ReactElement, CSSProperties } from 'react';
2
2
  import { WalletInterface } from '@bsv/sdk';
3
- import { C as ConnectedWallet, W as WalletOption, P as PayRequest, a as PayResult, B as BuyTokenRequest, b as PayOptions } from './wallets-CbzMtxrf.cjs';
4
- export { H as HandCashAdapterOptions, c as PaymentError, d as brc100Option, e as discoverWallets, h as handcashAdapter, p as pairingOption } from './wallets-CbzMtxrf.cjs';
5
- import { SigninSize, SigninTheme, SigninLabel, SigninBrand } from './element.cjs';
3
+ import { R as RememberedWallet, C as ConnectedWallet, W as WalletOption, P as PayRequest, a as PayResult, B as BuyTokenRequest, A as AttemptHook, b as PayOptions } from './choice-B97AjqF4.cjs';
4
+ export { H as HandCashAdapterOptions, c as PaymentError, d as autoChoice, e as brc100Option, f as discoverWallets, h as handcashAdapter, p as pairingOption } from './choice-B97AjqF4.cjs';
5
+ import { S as SigninSize, a as SigninTheme, b as SigninLabel, c as SigninBrand, d as SigninState } from './element-BXEoOdXY.cjs';
6
6
 
7
7
  /**
8
8
  * React wrapper for <bwalletx-signin>. React is an optional peer dependency; the button itself is
@@ -40,6 +40,25 @@ interface BwalletxSigninProps {
40
40
  redirectUri?: string;
41
41
  scope?: string;
42
42
  discoverMs?: number;
43
+ /** "Other wallets" link under the button: 'auto' (default: lg/md), 'on' or 'off'. */
44
+ otherWallets?: 'auto' | 'on' | 'off';
45
+ /**
46
+ * (0.7.0) "Use Metanet Desktop or another BRC-100 wallet" under the button: 'auto' (default: lg/md on a computer,
47
+ * outside any frame), 'on' or 'off'. Connects to localhost:3321 on its own tap only.
48
+ */
49
+ metanet?: 'auto' | 'on' | 'off';
50
+ /** Without a provider: GET → { identityKey, handle?, paymail? } restores the signed-in badge on load. */
51
+ sessionUrl?: string;
52
+ /** Without a provider: POST on Disconnect. */
53
+ logoutUrl?: string;
54
+ /** Paymail lookup for the badge; 'off' to skip. */
55
+ lookupUrl?: string;
56
+ /**
57
+ * Show the signed-in badge and the pending / error states (default true). Inside <BwalletXProvider> the button
58
+ * follows the provider: click → connect() (one wallet sheet), badge when signed in, Disconnect → disconnect()
59
+ * (logoutUrl). Set false for the pre-0.5.5 plain button.
60
+ */
61
+ stateful?: boolean;
43
62
  'aria-label'?: string;
44
63
  className?: string;
45
64
  style?: CSSProperties;
@@ -51,7 +70,11 @@ interface BwalletxSigninProps {
51
70
  onSignedIn?: (d: SignedInDetail) => void;
52
71
  onNotFound?: () => void;
53
72
  onError?: (error: unknown) => void;
73
+ /** After Disconnect in the badge menu. */
74
+ onSignedOut?: () => void;
54
75
  }
76
+ /** The element state for the provider's state. */
77
+ declare function signinStateFor(v: Pick<BwalletXState, 'status' | 'identityKey'>): SigninState;
55
78
  declare function BwalletxSignin(props: BwalletxSigninProps): ReactElement;
56
79
 
57
80
  type BwalletXStatus = 'idle' | 'restoring' | 'connecting' | 'connected' | 'error';
@@ -64,6 +87,14 @@ interface BwalletXState {
64
87
  wallet: WalletInterface | null;
65
88
  /** Which option connected (e.g. 'com.bwalletx.extension', 'bwalletx-pairing', 'handcash'). */
66
89
  walletId: string | null;
90
+ /** 'bwalletx' for any bWalletX, else the wallet's rdns / option id (0.5.6). null until connect(). */
91
+ walletType: string | null;
92
+ /** (0.6.0) The wallet type picked on this origin before (no keys), or null. Read after mount. */
93
+ rememberedWallet: RememberedWallet | null;
94
+ /** (0.6.0) The connected (or remembered) wallet isn't bWalletX: show "Some features need bWalletX · Switch". */
95
+ needsBwalletX: boolean;
96
+ /** (0.7.0) "Use Metanet Desktop or another BRC-100 wallet" is offered here (a computer, outside any frame). */
97
+ metanetOffered: boolean;
67
98
  /** True while the transitional HandCash adapter is in use. */
68
99
  transitional: boolean;
69
100
  /** The server session (verifyUrl/sessionUrl) is in place. */
@@ -71,10 +102,29 @@ interface BwalletXState {
71
102
  error: Error | null;
72
103
  }
73
104
  interface BwalletXContextValue extends BwalletXState {
74
- /** Find wallets, show the picker if there is a choice, connect, and sign in if verifyUrl is set. */
105
+ /**
106
+ * Find wallets, connect, and sign in if verifyUrl is set. bWalletX in this browser is used straight away (0.5.6);
107
+ * without it the chooser opens with "Get bWalletX" first. `chooser: true` is the "Other wallets" link: the chooser
108
+ * even when bWalletX is here.
109
+ */
75
110
  connect(opts?: {
76
111
  walletId?: string;
112
+ chooser?: boolean;
113
+ bwalletx?: boolean;
114
+ metanet?: boolean;
77
115
  }): Promise<ConnectedWallet | null>;
116
+ /** (0.6.0) "Switch": sign in with bWalletX (straight to it when here, else the chooser with Get bWalletX first). */
117
+ switchToBwalletX(): Promise<ConnectedWallet | null>;
118
+ /**
119
+ * (0.7.0) "Use Metanet Desktop or another BRC-100 wallet": connect to localhost:3321 (pinned json-api) and sign in.
120
+ * Call it from the user's tap only.
121
+ */
122
+ connectMetanet(): Promise<ConnectedWallet | null>;
123
+ /**
124
+ * (0.7.0) "Not you? Use another wallet": forget the wallet remembered on this origin and drop a silent Metanet
125
+ * sign-in in flight (a session its verify already set is ended through logoutUrl).
126
+ */
127
+ forgetWallet(): void;
78
128
  disconnect(): Promise<void>;
79
129
  /** The wallets found on the last connect() (or listWallets()). */
80
130
  wallets: WalletOption[];
@@ -85,22 +135,57 @@ interface BwalletXContextValue extends BwalletXState {
85
135
  }
86
136
  interface BwalletXProviderProps {
87
137
  children?: ReactNode;
88
- /** POST { identityKey } → challenge. With verifyUrl, connect() also signs in. */
138
+ /** POST {} (or { identityKey }) → challenge. With verifyUrl, connect() also signs in, in ONE wallet sheet. */
89
139
  challengeUrl?: string;
90
140
  /** POST { identityKey, nonce, signature } → { identityKey, handle?, paymail? } and sets the cookie. */
91
141
  verifyUrl?: string;
92
- /** POST to clear the cookie on disconnect(). */
142
+ /**
143
+ * POST to clear the cookie on disconnect(). REQUIRED whenever verifyUrl is set (0.7.0): "Not you? Use another wallet"
144
+ * and disconnect() end a session the verify route created through it. Missing → a console.warn in development.
145
+ */
93
146
  logoutUrl?: string;
94
147
  /** GET → { identityKey, handle?, paymail? } to restore a session on load. */
95
148
  sessionUrl?: string;
96
149
  /** Offer phone pairing with the built-in QR modal. Default true. */
97
150
  pairing?: boolean;
98
- /** Show the built-in picker when more than one wallet is available. Default true. */
151
+ /**
152
+ * Show the built-in picker when there is a real choice. Default true. One wallet found in this browser (and no
153
+ * app-supplied option such as HandCash) is used straight away, with no picker; phone pairing is then not offered.
154
+ */
99
155
  picker?: boolean;
156
+ /**
157
+ * Your challenge route is older than 0.5.5 and needs the identity key first (two wallet sheets). Normally not
158
+ * needed: such a server is detected and retried. Upgrade the server to @bwalletx/connect 0.5.5 for one sheet.
159
+ */
160
+ challengeNeedsIdentityKey?: boolean;
161
+ /** Paymail lookup by identity key for the signed-in badge (best effort). Default pay.bwallet.space; 'off' to skip. */
162
+ lookupUrl?: string;
100
163
  /** Extra options, e.g. [handcashAdapter({ login })]. */
101
164
  extraWallets?: WalletOption[];
102
- /** Probe desktop wallets on localhost. Default false. */
165
+ /**
166
+ * Probe desktop wallets on localhost while listing. Default false, and best left off (Chrome's Local Network Access
167
+ * prompt): the chooser offers "Desktop wallet", which probes only when tapped.
168
+ */
103
169
  probeLocal?: boolean;
170
+ /**
171
+ * bWalletX first (0.5.6, default true): with bWalletX in this browser connect() goes straight to its sheet, no
172
+ * chooser; without it the chooser opens, "Get bWalletX" first, and another wallet is connected only when picked.
173
+ * false: the 0.5.5 picker rule (one detected wallet of any brand was used without asking).
174
+ */
175
+ fastPath?: boolean;
176
+ /** Called once per connect attempt with { walletType, substrate, outcome, ms }. No keys, addresses or identity data. */
177
+ onAttempt?: AttemptHook;
178
+ /**
179
+ * (0.6.0) Remember the wallet TYPE the user explicitly picked on this origin (localStorage `bwx:wallet`; never a key)
180
+ * and go straight to it on the next tap, with no chooser. Disconnect forgets it. Default true.
181
+ */
182
+ rememberChoice?: boolean;
183
+ /**
184
+ * (0.6.0) On load, for a returning visitor with a server session, pick up the remembered wallet by discovery alone
185
+ * (no wallet call, so no prompt; never a localhost probe) so pay/tip work without another tap. Without a session
186
+ * nothing fires on load: a connect would ask the wallet, so it waits for the tap. Default true.
187
+ */
188
+ autoConnect?: boolean;
104
189
  /**
105
190
  * A theme the wallet already bundles (e.g. 'npgx') for bWalletX to wear while this site is connected and is the
106
191
  * active tab. Declared only while connecting or connected; withdrawn on disconnect. See declareWalletTheme.
@@ -114,8 +199,29 @@ interface BwalletXProviderProps {
114
199
  declare function BwalletXProvider(p: BwalletXProviderProps): ReactElement;
115
200
  /** The wallet + session state. Must be inside <BwalletXProvider>. */
116
201
  declare function useBwalletX(): BwalletXContextValue;
202
+ type BwalletXAccountStatus = 'restoring' | 'signed-out' | 'pending' | 'signed-in' | 'error';
203
+ interface BwalletXAccount {
204
+ status: BwalletXAccountStatus;
205
+ identityKey: string | null;
206
+ paymail: string | null;
207
+ handle: string | null;
208
+ /** $alice, a site handle, the paymail, or a short key: what the badge shows. */
209
+ label: string | null;
210
+ /** The bAvatar picture for the identity key (gold by default), or null when signed out. */
211
+ avatarUrl: string | null;
212
+ /** One plain line for the last error ("Sign-in cancelled" for a no in the wallet), or null. */
213
+ error: string | null;
214
+ /** Sign in (the provider's connect(): one wallet sheet). Never throws; failures show in `status`/`error`. */
215
+ login(): Promise<void>;
216
+ /** Sign out: the provider's disconnect() (posts logoutUrl). */
217
+ logout(): Promise<void>;
218
+ }
219
+ /** The account view of a provider state (what useBwalletXAccount returns). */
220
+ declare function accountFor(v: BwalletXContextValue): BwalletXAccount;
221
+ /** The signed-in account for your own UI: { status, identityKey, paymail, handle, avatarUrl, logout, … }. Inside <BwalletXProvider>. */
222
+ declare function useBwalletXAccount(): BwalletXAccount;
117
223
 
118
224
  /** Alias with the casing used by <BwalletxSignin>. */
119
225
  declare const BwalletxProvider: typeof BwalletXProvider;
120
226
 
121
- export { BuyTokenRequest, type BwalletXContextValue, BwalletXProvider, type BwalletXProviderProps, type BwalletXState, type BwalletXStatus, BwalletxProvider, BwalletxSignin, type BwalletxSigninProps, ConnectedWallet, PayOptions, PayRequest, PayResult, type SignedInDetail, WalletOption, BwalletxSignin as default, useBwalletX };
227
+ export { BuyTokenRequest, type BwalletXAccount, type BwalletXAccountStatus, type BwalletXContextValue, BwalletXProvider, type BwalletXProviderProps, type BwalletXState, type BwalletXStatus, BwalletxProvider, BwalletxSignin, type BwalletxSigninProps, ConnectedWallet, PayOptions, PayRequest, PayResult, type SignedInDetail, WalletOption, accountFor, BwalletxSignin as default, signinStateFor, useBwalletX, useBwalletXAccount };
package/dist/react.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ReactNode, ReactElement, CSSProperties } from 'react';
2
2
  import { WalletInterface } from '@bsv/sdk';
3
- import { C as ConnectedWallet, W as WalletOption, P as PayRequest, a as PayResult, B as BuyTokenRequest, b as PayOptions } from './wallets-CbzMtxrf.js';
4
- export { H as HandCashAdapterOptions, c as PaymentError, d as brc100Option, e as discoverWallets, h as handcashAdapter, p as pairingOption } from './wallets-CbzMtxrf.js';
5
- import { SigninSize, SigninTheme, SigninLabel, SigninBrand } from './element.js';
3
+ import { R as RememberedWallet, C as ConnectedWallet, W as WalletOption, P as PayRequest, a as PayResult, B as BuyTokenRequest, A as AttemptHook, b as PayOptions } from './choice-B97AjqF4.js';
4
+ export { H as HandCashAdapterOptions, c as PaymentError, d as autoChoice, e as brc100Option, f as discoverWallets, h as handcashAdapter, p as pairingOption } from './choice-B97AjqF4.js';
5
+ import { S as SigninSize, a as SigninTheme, b as SigninLabel, c as SigninBrand, d as SigninState } from './element-BXEoOdXY.js';
6
6
 
7
7
  /**
8
8
  * React wrapper for <bwalletx-signin>. React is an optional peer dependency; the button itself is
@@ -40,6 +40,25 @@ interface BwalletxSigninProps {
40
40
  redirectUri?: string;
41
41
  scope?: string;
42
42
  discoverMs?: number;
43
+ /** "Other wallets" link under the button: 'auto' (default: lg/md), 'on' or 'off'. */
44
+ otherWallets?: 'auto' | 'on' | 'off';
45
+ /**
46
+ * (0.7.0) "Use Metanet Desktop or another BRC-100 wallet" under the button: 'auto' (default: lg/md on a computer,
47
+ * outside any frame), 'on' or 'off'. Connects to localhost:3321 on its own tap only.
48
+ */
49
+ metanet?: 'auto' | 'on' | 'off';
50
+ /** Without a provider: GET → { identityKey, handle?, paymail? } restores the signed-in badge on load. */
51
+ sessionUrl?: string;
52
+ /** Without a provider: POST on Disconnect. */
53
+ logoutUrl?: string;
54
+ /** Paymail lookup for the badge; 'off' to skip. */
55
+ lookupUrl?: string;
56
+ /**
57
+ * Show the signed-in badge and the pending / error states (default true). Inside <BwalletXProvider> the button
58
+ * follows the provider: click → connect() (one wallet sheet), badge when signed in, Disconnect → disconnect()
59
+ * (logoutUrl). Set false for the pre-0.5.5 plain button.
60
+ */
61
+ stateful?: boolean;
43
62
  'aria-label'?: string;
44
63
  className?: string;
45
64
  style?: CSSProperties;
@@ -51,7 +70,11 @@ interface BwalletxSigninProps {
51
70
  onSignedIn?: (d: SignedInDetail) => void;
52
71
  onNotFound?: () => void;
53
72
  onError?: (error: unknown) => void;
73
+ /** After Disconnect in the badge menu. */
74
+ onSignedOut?: () => void;
54
75
  }
76
+ /** The element state for the provider's state. */
77
+ declare function signinStateFor(v: Pick<BwalletXState, 'status' | 'identityKey'>): SigninState;
55
78
  declare function BwalletxSignin(props: BwalletxSigninProps): ReactElement;
56
79
 
57
80
  type BwalletXStatus = 'idle' | 'restoring' | 'connecting' | 'connected' | 'error';
@@ -64,6 +87,14 @@ interface BwalletXState {
64
87
  wallet: WalletInterface | null;
65
88
  /** Which option connected (e.g. 'com.bwalletx.extension', 'bwalletx-pairing', 'handcash'). */
66
89
  walletId: string | null;
90
+ /** 'bwalletx' for any bWalletX, else the wallet's rdns / option id (0.5.6). null until connect(). */
91
+ walletType: string | null;
92
+ /** (0.6.0) The wallet type picked on this origin before (no keys), or null. Read after mount. */
93
+ rememberedWallet: RememberedWallet | null;
94
+ /** (0.6.0) The connected (or remembered) wallet isn't bWalletX: show "Some features need bWalletX · Switch". */
95
+ needsBwalletX: boolean;
96
+ /** (0.7.0) "Use Metanet Desktop or another BRC-100 wallet" is offered here (a computer, outside any frame). */
97
+ metanetOffered: boolean;
67
98
  /** True while the transitional HandCash adapter is in use. */
68
99
  transitional: boolean;
69
100
  /** The server session (verifyUrl/sessionUrl) is in place. */
@@ -71,10 +102,29 @@ interface BwalletXState {
71
102
  error: Error | null;
72
103
  }
73
104
  interface BwalletXContextValue extends BwalletXState {
74
- /** Find wallets, show the picker if there is a choice, connect, and sign in if verifyUrl is set. */
105
+ /**
106
+ * Find wallets, connect, and sign in if verifyUrl is set. bWalletX in this browser is used straight away (0.5.6);
107
+ * without it the chooser opens with "Get bWalletX" first. `chooser: true` is the "Other wallets" link: the chooser
108
+ * even when bWalletX is here.
109
+ */
75
110
  connect(opts?: {
76
111
  walletId?: string;
112
+ chooser?: boolean;
113
+ bwalletx?: boolean;
114
+ metanet?: boolean;
77
115
  }): Promise<ConnectedWallet | null>;
116
+ /** (0.6.0) "Switch": sign in with bWalletX (straight to it when here, else the chooser with Get bWalletX first). */
117
+ switchToBwalletX(): Promise<ConnectedWallet | null>;
118
+ /**
119
+ * (0.7.0) "Use Metanet Desktop or another BRC-100 wallet": connect to localhost:3321 (pinned json-api) and sign in.
120
+ * Call it from the user's tap only.
121
+ */
122
+ connectMetanet(): Promise<ConnectedWallet | null>;
123
+ /**
124
+ * (0.7.0) "Not you? Use another wallet": forget the wallet remembered on this origin and drop a silent Metanet
125
+ * sign-in in flight (a session its verify already set is ended through logoutUrl).
126
+ */
127
+ forgetWallet(): void;
78
128
  disconnect(): Promise<void>;
79
129
  /** The wallets found on the last connect() (or listWallets()). */
80
130
  wallets: WalletOption[];
@@ -85,22 +135,57 @@ interface BwalletXContextValue extends BwalletXState {
85
135
  }
86
136
  interface BwalletXProviderProps {
87
137
  children?: ReactNode;
88
- /** POST { identityKey } → challenge. With verifyUrl, connect() also signs in. */
138
+ /** POST {} (or { identityKey }) → challenge. With verifyUrl, connect() also signs in, in ONE wallet sheet. */
89
139
  challengeUrl?: string;
90
140
  /** POST { identityKey, nonce, signature } → { identityKey, handle?, paymail? } and sets the cookie. */
91
141
  verifyUrl?: string;
92
- /** POST to clear the cookie on disconnect(). */
142
+ /**
143
+ * POST to clear the cookie on disconnect(). REQUIRED whenever verifyUrl is set (0.7.0): "Not you? Use another wallet"
144
+ * and disconnect() end a session the verify route created through it. Missing → a console.warn in development.
145
+ */
93
146
  logoutUrl?: string;
94
147
  /** GET → { identityKey, handle?, paymail? } to restore a session on load. */
95
148
  sessionUrl?: string;
96
149
  /** Offer phone pairing with the built-in QR modal. Default true. */
97
150
  pairing?: boolean;
98
- /** Show the built-in picker when more than one wallet is available. Default true. */
151
+ /**
152
+ * Show the built-in picker when there is a real choice. Default true. One wallet found in this browser (and no
153
+ * app-supplied option such as HandCash) is used straight away, with no picker; phone pairing is then not offered.
154
+ */
99
155
  picker?: boolean;
156
+ /**
157
+ * Your challenge route is older than 0.5.5 and needs the identity key first (two wallet sheets). Normally not
158
+ * needed: such a server is detected and retried. Upgrade the server to @bwalletx/connect 0.5.5 for one sheet.
159
+ */
160
+ challengeNeedsIdentityKey?: boolean;
161
+ /** Paymail lookup by identity key for the signed-in badge (best effort). Default pay.bwallet.space; 'off' to skip. */
162
+ lookupUrl?: string;
100
163
  /** Extra options, e.g. [handcashAdapter({ login })]. */
101
164
  extraWallets?: WalletOption[];
102
- /** Probe desktop wallets on localhost. Default false. */
165
+ /**
166
+ * Probe desktop wallets on localhost while listing. Default false, and best left off (Chrome's Local Network Access
167
+ * prompt): the chooser offers "Desktop wallet", which probes only when tapped.
168
+ */
103
169
  probeLocal?: boolean;
170
+ /**
171
+ * bWalletX first (0.5.6, default true): with bWalletX in this browser connect() goes straight to its sheet, no
172
+ * chooser; without it the chooser opens, "Get bWalletX" first, and another wallet is connected only when picked.
173
+ * false: the 0.5.5 picker rule (one detected wallet of any brand was used without asking).
174
+ */
175
+ fastPath?: boolean;
176
+ /** Called once per connect attempt with { walletType, substrate, outcome, ms }. No keys, addresses or identity data. */
177
+ onAttempt?: AttemptHook;
178
+ /**
179
+ * (0.6.0) Remember the wallet TYPE the user explicitly picked on this origin (localStorage `bwx:wallet`; never a key)
180
+ * and go straight to it on the next tap, with no chooser. Disconnect forgets it. Default true.
181
+ */
182
+ rememberChoice?: boolean;
183
+ /**
184
+ * (0.6.0) On load, for a returning visitor with a server session, pick up the remembered wallet by discovery alone
185
+ * (no wallet call, so no prompt; never a localhost probe) so pay/tip work without another tap. Without a session
186
+ * nothing fires on load: a connect would ask the wallet, so it waits for the tap. Default true.
187
+ */
188
+ autoConnect?: boolean;
104
189
  /**
105
190
  * A theme the wallet already bundles (e.g. 'npgx') for bWalletX to wear while this site is connected and is the
106
191
  * active tab. Declared only while connecting or connected; withdrawn on disconnect. See declareWalletTheme.
@@ -114,8 +199,29 @@ interface BwalletXProviderProps {
114
199
  declare function BwalletXProvider(p: BwalletXProviderProps): ReactElement;
115
200
  /** The wallet + session state. Must be inside <BwalletXProvider>. */
116
201
  declare function useBwalletX(): BwalletXContextValue;
202
+ type BwalletXAccountStatus = 'restoring' | 'signed-out' | 'pending' | 'signed-in' | 'error';
203
+ interface BwalletXAccount {
204
+ status: BwalletXAccountStatus;
205
+ identityKey: string | null;
206
+ paymail: string | null;
207
+ handle: string | null;
208
+ /** $alice, a site handle, the paymail, or a short key: what the badge shows. */
209
+ label: string | null;
210
+ /** The bAvatar picture for the identity key (gold by default), or null when signed out. */
211
+ avatarUrl: string | null;
212
+ /** One plain line for the last error ("Sign-in cancelled" for a no in the wallet), or null. */
213
+ error: string | null;
214
+ /** Sign in (the provider's connect(): one wallet sheet). Never throws; failures show in `status`/`error`. */
215
+ login(): Promise<void>;
216
+ /** Sign out: the provider's disconnect() (posts logoutUrl). */
217
+ logout(): Promise<void>;
218
+ }
219
+ /** The account view of a provider state (what useBwalletXAccount returns). */
220
+ declare function accountFor(v: BwalletXContextValue): BwalletXAccount;
221
+ /** The signed-in account for your own UI: { status, identityKey, paymail, handle, avatarUrl, logout, … }. Inside <BwalletXProvider>. */
222
+ declare function useBwalletXAccount(): BwalletXAccount;
117
223
 
118
224
  /** Alias with the casing used by <BwalletxSignin>. */
119
225
  declare const BwalletxProvider: typeof BwalletXProvider;
120
226
 
121
- export { BuyTokenRequest, type BwalletXContextValue, BwalletXProvider, type BwalletXProviderProps, type BwalletXState, type BwalletXStatus, BwalletxProvider, BwalletxSignin, type BwalletxSigninProps, ConnectedWallet, PayOptions, PayRequest, PayResult, type SignedInDetail, WalletOption, BwalletxSignin as default, useBwalletX };
227
+ export { BuyTokenRequest, type BwalletXAccount, type BwalletXAccountStatus, type BwalletXContextValue, BwalletXProvider, type BwalletXProviderProps, type BwalletXState, type BwalletXStatus, BwalletxProvider, BwalletxSignin, type BwalletxSigninProps, ConnectedWallet, PayOptions, PayRequest, PayResult, type SignedInDetail, WalletOption, accountFor, BwalletxSignin as default, signinStateFor, useBwalletX, useBwalletXAccount };