@bwalletx/connect 0.5.6 → 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.
- package/CHANGELOG.md +28 -0
- package/README.md +22 -2
- package/dist/bwalletx-connect.global.js +15 -10
- package/dist/bwalletx-connect.global.js.map +1 -1
- package/dist/{choice-DCh-tgpT.d.cts → choice-B97AjqF4.d.cts} +87 -3
- package/dist/{choice-DCh-tgpT.d.ts → choice-B97AjqF4.d.ts} +87 -3
- package/dist/{chunk-LS6AYEBO.js → chunk-6EFFOIHK.js} +596 -41
- package/dist/chunk-6EFFOIHK.js.map +1 -0
- package/dist/{chunk-34DKBQNN.js → chunk-DIKJFKND.js} +22 -5
- package/dist/chunk-DIKJFKND.js.map +1 -0
- package/dist/{chunk-IFGOAROM.js → chunk-TNRI7ARM.js} +14 -63
- package/dist/chunk-TNRI7ARM.js.map +1 -0
- package/dist/{element-D9Zl-x12.d.cts → element-BXEoOdXY.d.cts} +11 -4
- package/dist/{element-D9Zl-x12.d.ts → element-BXEoOdXY.d.ts} +11 -4
- package/dist/element.cjs +480 -50
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +7 -2
- package/dist/element.d.ts +7 -2
- package/dist/element.js +8 -2
- package/dist/element.js.map +1 -1
- package/dist/index.cjs +676 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +169 -11
- package/dist/index.d.ts +169 -11
- package/dist/index.js +92 -6
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +683 -103
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +43 -4
- package/dist/react.d.ts +43 -4
- package/dist/react.js +147 -12
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-34DKBQNN.js.map +0 -1
- package/dist/chunk-IFGOAROM.js.map +0 -1
- package/dist/chunk-LS6AYEBO.js.map +0 -1
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, A as AttemptHook, b as PayOptions } from './choice-
|
|
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-
|
|
5
|
-
import { S as SigninSize, a as SigninTheme, b as SigninLabel, c as SigninBrand, d as SigninState } from './element-
|
|
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
|
|
@@ -42,6 +42,11 @@ interface BwalletxSigninProps {
|
|
|
42
42
|
discoverMs?: number;
|
|
43
43
|
/** "Other wallets" link under the button: 'auto' (default: lg/md), 'on' or 'off'. */
|
|
44
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';
|
|
45
50
|
/** Without a provider: GET → { identityKey, handle?, paymail? } restores the signed-in badge on load. */
|
|
46
51
|
sessionUrl?: string;
|
|
47
52
|
/** Without a provider: POST on Disconnect. */
|
|
@@ -84,6 +89,12 @@ interface BwalletXState {
|
|
|
84
89
|
walletId: string | null;
|
|
85
90
|
/** 'bwalletx' for any bWalletX, else the wallet's rdns / option id (0.5.6). null until connect(). */
|
|
86
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;
|
|
87
98
|
/** True while the transitional HandCash adapter is in use. */
|
|
88
99
|
transitional: boolean;
|
|
89
100
|
/** The server session (verifyUrl/sessionUrl) is in place. */
|
|
@@ -99,7 +110,21 @@ interface BwalletXContextValue extends BwalletXState {
|
|
|
99
110
|
connect(opts?: {
|
|
100
111
|
walletId?: string;
|
|
101
112
|
chooser?: boolean;
|
|
113
|
+
bwalletx?: boolean;
|
|
114
|
+
metanet?: boolean;
|
|
102
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;
|
|
103
128
|
disconnect(): Promise<void>;
|
|
104
129
|
/** The wallets found on the last connect() (or listWallets()). */
|
|
105
130
|
wallets: WalletOption[];
|
|
@@ -114,7 +139,10 @@ interface BwalletXProviderProps {
|
|
|
114
139
|
challengeUrl?: string;
|
|
115
140
|
/** POST { identityKey, nonce, signature } → { identityKey, handle?, paymail? } and sets the cookie. */
|
|
116
141
|
verifyUrl?: string;
|
|
117
|
-
/**
|
|
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
|
+
*/
|
|
118
146
|
logoutUrl?: string;
|
|
119
147
|
/** GET → { identityKey, handle?, paymail? } to restore a session on load. */
|
|
120
148
|
sessionUrl?: string;
|
|
@@ -147,6 +175,17 @@ interface BwalletXProviderProps {
|
|
|
147
175
|
fastPath?: boolean;
|
|
148
176
|
/** Called once per connect attempt with { walletType, substrate, outcome, ms }. No keys, addresses or identity data. */
|
|
149
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;
|
|
150
189
|
/**
|
|
151
190
|
* A theme the wallet already bundles (e.g. 'npgx') for bWalletX to wear while this site is connected and is the
|
|
152
191
|
* active tab. Declared only while connecting or connected; withdrawn on disconnect. See declareWalletTheme.
|
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, A as AttemptHook, b as PayOptions } from './choice-
|
|
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-
|
|
5
|
-
import { S as SigninSize, a as SigninTheme, b as SigninLabel, c as SigninBrand, d as SigninState } from './element-
|
|
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
|
|
@@ -42,6 +42,11 @@ interface BwalletxSigninProps {
|
|
|
42
42
|
discoverMs?: number;
|
|
43
43
|
/** "Other wallets" link under the button: 'auto' (default: lg/md), 'on' or 'off'. */
|
|
44
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';
|
|
45
50
|
/** Without a provider: GET → { identityKey, handle?, paymail? } restores the signed-in badge on load. */
|
|
46
51
|
sessionUrl?: string;
|
|
47
52
|
/** Without a provider: POST on Disconnect. */
|
|
@@ -84,6 +89,12 @@ interface BwalletXState {
|
|
|
84
89
|
walletId: string | null;
|
|
85
90
|
/** 'bwalletx' for any bWalletX, else the wallet's rdns / option id (0.5.6). null until connect(). */
|
|
86
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;
|
|
87
98
|
/** True while the transitional HandCash adapter is in use. */
|
|
88
99
|
transitional: boolean;
|
|
89
100
|
/** The server session (verifyUrl/sessionUrl) is in place. */
|
|
@@ -99,7 +110,21 @@ interface BwalletXContextValue extends BwalletXState {
|
|
|
99
110
|
connect(opts?: {
|
|
100
111
|
walletId?: string;
|
|
101
112
|
chooser?: boolean;
|
|
113
|
+
bwalletx?: boolean;
|
|
114
|
+
metanet?: boolean;
|
|
102
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;
|
|
103
128
|
disconnect(): Promise<void>;
|
|
104
129
|
/** The wallets found on the last connect() (or listWallets()). */
|
|
105
130
|
wallets: WalletOption[];
|
|
@@ -114,7 +139,10 @@ interface BwalletXProviderProps {
|
|
|
114
139
|
challengeUrl?: string;
|
|
115
140
|
/** POST { identityKey, nonce, signature } → { identityKey, handle?, paymail? } and sets the cookie. */
|
|
116
141
|
verifyUrl?: string;
|
|
117
|
-
/**
|
|
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
|
+
*/
|
|
118
146
|
logoutUrl?: string;
|
|
119
147
|
/** GET → { identityKey, handle?, paymail? } to restore a session on load. */
|
|
120
148
|
sessionUrl?: string;
|
|
@@ -147,6 +175,17 @@ interface BwalletXProviderProps {
|
|
|
147
175
|
fastPath?: boolean;
|
|
148
176
|
/** Called once per connect attempt with { walletType, substrate, outcome, ms }. No keys, addresses or identity data. */
|
|
149
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;
|
|
150
189
|
/**
|
|
151
190
|
* A theme the wallet already bundles (e.g. 'npgx') for bWalletX to wear while this site is connected and is the
|
|
152
191
|
* active tab. Declared only while connecting or connected; withdrawn on disconnect. See declareWalletTheme.
|
package/dist/react.js
CHANGED
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
buyToken,
|
|
4
4
|
declareWalletTheme,
|
|
5
5
|
pay,
|
|
6
|
-
runConnect,
|
|
7
6
|
tip
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-TNRI7ARM.js";
|
|
9
8
|
import {
|
|
9
|
+
METANET_TYPE,
|
|
10
10
|
accountLabel,
|
|
11
|
+
attachRemembered,
|
|
11
12
|
autoChoice,
|
|
12
13
|
avatarUrlFor,
|
|
13
14
|
brc100Option,
|
|
@@ -15,13 +16,23 @@ import {
|
|
|
15
16
|
clearPairing,
|
|
16
17
|
defineBwalletxSignin,
|
|
17
18
|
discoverWallets,
|
|
19
|
+
forgetWalletChoice,
|
|
18
20
|
handcashAdapter,
|
|
19
21
|
lookupPaymail,
|
|
22
|
+
metanetOffered,
|
|
23
|
+
needsBwalletX,
|
|
20
24
|
pairingModal,
|
|
21
25
|
pairingOption,
|
|
22
26
|
pickWallet,
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
planAutoConnect,
|
|
28
|
+
rememberedWalletChoice,
|
|
29
|
+
runConnect,
|
|
30
|
+
runSilentMetanet,
|
|
31
|
+
signInErrorText,
|
|
32
|
+
silentAttemptUsed,
|
|
33
|
+
walletTypeOf,
|
|
34
|
+
warnIfNoLogout
|
|
35
|
+
} from "./chunk-6EFFOIHK.js";
|
|
25
36
|
import "./chunk-MWD4BCO5.js";
|
|
26
37
|
|
|
27
38
|
// src/react.ts
|
|
@@ -63,7 +74,7 @@ function BwalletxSignin(props) {
|
|
|
63
74
|
if (!e.defaultPrevented && c && cb.current.stateful !== false) {
|
|
64
75
|
e.preventDefault();
|
|
65
76
|
const mode = e.detail?.mode;
|
|
66
|
-
c.connect(mode === "chooser" ? { chooser: true } : {}).catch(() => void 0);
|
|
77
|
+
c.connect(mode === "chooser" ? { chooser: true } : mode === "bwalletx" ? { bwalletx: true } : mode === "metanet" ? { metanet: true } : {}).catch(() => void 0);
|
|
67
78
|
}
|
|
68
79
|
}
|
|
69
80
|
],
|
|
@@ -80,7 +91,17 @@ function BwalletxSignin(props) {
|
|
|
80
91
|
}
|
|
81
92
|
}
|
|
82
93
|
],
|
|
83
|
-
["bwalletx-signed-out", () => cb.current.onSignedOut?.()]
|
|
94
|
+
["bwalletx-signed-out", () => cb.current.onSignedOut?.()],
|
|
95
|
+
[
|
|
96
|
+
"bwalletx-not-you",
|
|
97
|
+
(e) => {
|
|
98
|
+
const c = ctxRef.current;
|
|
99
|
+
if (c && cb.current.stateful !== false) {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
c.forgetWallet();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
]
|
|
84
105
|
];
|
|
85
106
|
for (const [t, f] of on) el.addEventListener(t, f);
|
|
86
107
|
return () => {
|
|
@@ -124,6 +145,8 @@ function BwalletxSignin(props) {
|
|
|
124
145
|
scope: p.scope,
|
|
125
146
|
"discover-ms": p.discoverMs,
|
|
126
147
|
"other-wallets": p.otherWallets,
|
|
148
|
+
metanet: p.metanet,
|
|
149
|
+
"wallet-type": driven ? ctx.walletType ?? ctx.rememberedWallet?.type ?? void 0 : void 0,
|
|
127
150
|
"aria-label": p["aria-label"]
|
|
128
151
|
});
|
|
129
152
|
}
|
|
@@ -138,7 +161,10 @@ var empty = {
|
|
|
138
161
|
walletType: null,
|
|
139
162
|
transitional: false,
|
|
140
163
|
signedIn: false,
|
|
141
|
-
error: null
|
|
164
|
+
error: null,
|
|
165
|
+
rememberedWallet: null,
|
|
166
|
+
needsBwalletX: false,
|
|
167
|
+
metanetOffered: false
|
|
142
168
|
};
|
|
143
169
|
var Ctx = createContext(null);
|
|
144
170
|
async function postJson(url, body) {
|
|
@@ -149,6 +175,10 @@ async function postJson(url, body) {
|
|
|
149
175
|
}
|
|
150
176
|
function BwalletXProvider(p) {
|
|
151
177
|
const [state, setState] = useState(empty);
|
|
178
|
+
const stateRef = useRef(state);
|
|
179
|
+
stateRef.current = state;
|
|
180
|
+
const silentRun = useRef(0);
|
|
181
|
+
const sessionChecked = useRef(!p.sessionUrl);
|
|
152
182
|
const [wallets, setWallets] = useState([]);
|
|
153
183
|
const props = useRef(p);
|
|
154
184
|
props.current = p;
|
|
@@ -159,6 +189,9 @@ function BwalletXProvider(p) {
|
|
|
159
189
|
props.current.onError?.(err);
|
|
160
190
|
return err;
|
|
161
191
|
}, []);
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
warnIfNoLogout({ verifyUrl: p.verifyUrl, logoutUrl: p.logoutUrl, where: "<BwalletXProvider>" });
|
|
194
|
+
}, [p.verifyUrl, p.logoutUrl]);
|
|
162
195
|
const themeOn = !!p.theme && (state.status === "connecting" || state.status === "connected");
|
|
163
196
|
useEffect(() => {
|
|
164
197
|
if (!themeOn) return;
|
|
@@ -172,10 +205,15 @@ function BwalletXProvider(p) {
|
|
|
172
205
|
setState((s) => ({ ...s, status: "restoring" }));
|
|
173
206
|
fetch(url, { credentials: "same-origin" }).then((r) => r.json()).then((j) => {
|
|
174
207
|
if (!live) return;
|
|
208
|
+
sessionChecked.current = true;
|
|
175
209
|
setState(
|
|
176
210
|
(s) => j.identityKey ? { ...s, status: "connected", identityKey: j.identityKey, handle: j.handle ?? null, paymail: j.paymail ?? null, signedIn: true } : { ...s, status: s.status === "restoring" ? "idle" : s.status }
|
|
177
211
|
);
|
|
178
|
-
}).catch(() =>
|
|
212
|
+
}).catch(() => {
|
|
213
|
+
if (!live) return;
|
|
214
|
+
sessionChecked.current = true;
|
|
215
|
+
setState((s) => ({ ...s, status: s.status === "restoring" ? "idle" : s.status }));
|
|
216
|
+
});
|
|
179
217
|
return () => {
|
|
180
218
|
live = false;
|
|
181
219
|
};
|
|
@@ -196,7 +234,7 @@ function BwalletXProvider(p) {
|
|
|
196
234
|
const c = props.current;
|
|
197
235
|
setState((s) => ({ ...s, status: "connecting", error: null }));
|
|
198
236
|
try {
|
|
199
|
-
const list = await listWallets();
|
|
237
|
+
const list = opts.metanet ? [] : await listWallets();
|
|
200
238
|
const fast = c.fastPath !== false;
|
|
201
239
|
const r = await runConnect({
|
|
202
240
|
list,
|
|
@@ -206,6 +244,10 @@ function BwalletXProvider(p) {
|
|
|
206
244
|
fastPath: fast,
|
|
207
245
|
pick: fast ? (l) => chooseWallet(l) : pickWallet,
|
|
208
246
|
onAttempt: c.onAttempt,
|
|
247
|
+
remembered: fast && c.rememberChoice !== false ? rememberedWalletChoice() : null,
|
|
248
|
+
remember: fast && c.rememberChoice !== false,
|
|
249
|
+
preferBwalletX: opts.bwalletx,
|
|
250
|
+
metanet: opts.metanet,
|
|
209
251
|
challengeUrl: c.challengeUrl,
|
|
210
252
|
verifyUrl: c.verifyUrl,
|
|
211
253
|
challengeNeedsIdentityKey: c.challengeNeedsIdentityKey,
|
|
@@ -227,7 +269,10 @@ function BwalletXProvider(p) {
|
|
|
227
269
|
walletType: r.walletType,
|
|
228
270
|
transitional: !!cw.transitional,
|
|
229
271
|
signedIn: r.signedIn,
|
|
230
|
-
error: null
|
|
272
|
+
error: null,
|
|
273
|
+
rememberedWallet: c.rememberChoice !== false ? rememberedWalletChoice() : null,
|
|
274
|
+
needsBwalletX: needsBwalletX(r.walletType),
|
|
275
|
+
metanetOffered: metanetOffered()
|
|
231
276
|
});
|
|
232
277
|
return { ...cw, identityKey: r.identityKey, handle: r.handle ?? void 0, paymail: r.paymail ?? void 0 };
|
|
233
278
|
} catch (e) {
|
|
@@ -245,9 +290,96 @@ function BwalletXProvider(p) {
|
|
|
245
290
|
if (c.logoutUrl) await postJson(c.logoutUrl, {}).catch(() => {
|
|
246
291
|
});
|
|
247
292
|
if (state.walletId === "bwalletx-pairing") await clearPairing();
|
|
293
|
+
if (c.rememberChoice !== false) forgetWalletChoice();
|
|
294
|
+
silentRun.current++;
|
|
248
295
|
payer.current = null;
|
|
249
|
-
setState(empty);
|
|
296
|
+
setState({ ...empty, metanetOffered: metanetOffered() });
|
|
250
297
|
}, [state.walletId]);
|
|
298
|
+
const switchToBwalletX = useCallback(() => connect({ bwalletx: true }), [connect]);
|
|
299
|
+
const connectMetanet = useCallback(() => connect({ metanet: true }), [connect]);
|
|
300
|
+
const forgetWallet = useCallback(() => {
|
|
301
|
+
if (props.current.rememberChoice !== false) forgetWalletChoice();
|
|
302
|
+
silentRun.current++;
|
|
303
|
+
setState((s) => ({
|
|
304
|
+
...s,
|
|
305
|
+
rememberedWallet: null,
|
|
306
|
+
needsBwalletX: s.walletType ? needsBwalletX(s.walletType) : false,
|
|
307
|
+
// A silent Metanet sign-in on screen goes back to the normal choice.
|
|
308
|
+
status: s.status === "connecting" && !s.wallet ? s.signedIn && s.identityKey ? "connected" : "idle" : s.status
|
|
309
|
+
}));
|
|
310
|
+
}, []);
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
setState((s) => s.metanetOffered === metanetOffered() ? s : { ...s, metanetOffered: metanetOffered() });
|
|
313
|
+
if (p.rememberChoice === false) return;
|
|
314
|
+
const r = rememberedWalletChoice();
|
|
315
|
+
if (r) setState((s) => s.rememberedWallet ? s : { ...s, rememberedWallet: r, needsBwalletX: s.walletType ? s.needsBwalletX : needsBwalletX(r.type) && r.type !== METANET_TYPE });
|
|
316
|
+
}, [p.rememberChoice]);
|
|
317
|
+
const sessionOnly = state.status === "connected" && state.signedIn && !state.wallet;
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
const c = props.current;
|
|
320
|
+
if (!sessionOnly || c.autoConnect === false || c.rememberChoice === false || c.fastPath === false) return;
|
|
321
|
+
const plan = planAutoConnect({ remembered: rememberedWalletChoice(), signedIn: true });
|
|
322
|
+
if (plan.action !== "attach" || !plan.remembered) return;
|
|
323
|
+
let live = true;
|
|
324
|
+
void attachRemembered(plan.remembered, { ms: c.discoverMs }).then((opt) => {
|
|
325
|
+
if (!live || !opt?.wallet) return;
|
|
326
|
+
payer.current = opt.wallet;
|
|
327
|
+
setState(
|
|
328
|
+
(s) => s.status === "connected" && !s.wallet ? { ...s, wallet: opt.wallet, walletId: opt.id, walletType: walletTypeOf(opt), needsBwalletX: needsBwalletX(walletTypeOf(opt)) } : s
|
|
329
|
+
);
|
|
330
|
+
});
|
|
331
|
+
return () => {
|
|
332
|
+
live = false;
|
|
333
|
+
};
|
|
334
|
+
}, [sessionOnly]);
|
|
335
|
+
const silentReady = state.status === "idle" || sessionOnly;
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
const c = props.current;
|
|
338
|
+
if (!silentReady || !sessionChecked.current || c.autoConnect === false || c.rememberChoice === false || c.fastPath === false || silentAttemptUsed()) return;
|
|
339
|
+
const plan = planAutoConnect({ remembered: rememberedWalletChoice(), signedIn: sessionOnly });
|
|
340
|
+
if (plan.action !== "silent-metanet") return;
|
|
341
|
+
const run = ++silentRun.current;
|
|
342
|
+
const live = () => run === silentRun.current;
|
|
343
|
+
let shown = false;
|
|
344
|
+
const session = stateRef.current;
|
|
345
|
+
void runSilentMetanet({
|
|
346
|
+
sessionKey: sessionOnly ? session.identityKey : null,
|
|
347
|
+
challengeUrl: c.challengeUrl,
|
|
348
|
+
verifyUrl: c.verifyUrl,
|
|
349
|
+
post: postJson,
|
|
350
|
+
onAttempt: c.onAttempt,
|
|
351
|
+
isAbandoned: () => !live(),
|
|
352
|
+
logout: () => props.current.logoutUrl ? postJson(props.current.logoutUrl, {}) : Promise.resolve(),
|
|
353
|
+
onSignIn: () => {
|
|
354
|
+
if (!live()) return;
|
|
355
|
+
shown = true;
|
|
356
|
+
setState((s) => s.status === "idle" ? { ...s, status: "connecting", error: null } : s);
|
|
357
|
+
}
|
|
358
|
+
}).then((r) => {
|
|
359
|
+
if (!live()) return;
|
|
360
|
+
if (!r) {
|
|
361
|
+
if (shown) setState((s) => s.status === "connecting" && !s.wallet ? { ...s, status: s.signedIn && s.identityKey ? "connected" : "idle" } : s);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const cw = r.connected;
|
|
365
|
+
payer.current = cw.payer;
|
|
366
|
+
setState((s) => ({
|
|
367
|
+
...s,
|
|
368
|
+
status: "connected",
|
|
369
|
+
identityKey: r.identityKey,
|
|
370
|
+
handle: r.handle ?? s.handle,
|
|
371
|
+
paymail: r.paymail ?? s.paymail,
|
|
372
|
+
wallet: cw.wallet,
|
|
373
|
+
walletId: cw.optionId,
|
|
374
|
+
walletType: r.walletType,
|
|
375
|
+
transitional: false,
|
|
376
|
+
signedIn: r.signedIn || s.signedIn,
|
|
377
|
+
error: null,
|
|
378
|
+
rememberedWallet: rememberedWalletChoice(),
|
|
379
|
+
needsBwalletX: true
|
|
380
|
+
}));
|
|
381
|
+
});
|
|
382
|
+
}, [silentReady, sessionOnly]);
|
|
251
383
|
useEffect(() => {
|
|
252
384
|
const key = state.identityKey;
|
|
253
385
|
if (!key || state.paymail || p.lookupUrl === "off") return;
|
|
@@ -269,12 +401,15 @@ function BwalletXProvider(p) {
|
|
|
269
401
|
wallets,
|
|
270
402
|
connect,
|
|
271
403
|
disconnect,
|
|
404
|
+
switchToBwalletX,
|
|
405
|
+
connectMetanet,
|
|
406
|
+
forgetWallet,
|
|
272
407
|
listWallets,
|
|
273
408
|
pay: (req) => pay(need(), req, props.current.payOptions),
|
|
274
409
|
tip: (req) => tip(need(), req, props.current.payOptions),
|
|
275
410
|
buyToken: (req) => buyToken(need(), req)
|
|
276
411
|
}),
|
|
277
|
-
[state, wallets, connect, disconnect, listWallets]
|
|
412
|
+
[state, wallets, connect, disconnect, switchToBwalletX, connectMetanet, forgetWallet, listWallets]
|
|
278
413
|
);
|
|
279
414
|
return createElement(Ctx.Provider, { value }, p.children);
|
|
280
415
|
}
|
package/dist/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react.ts"],"sourcesContent":["/**\n * React wrapper for <bwalletx-signin>. React is an optional peer dependency; the button itself is\n * the web component, so markup and behaviour are identical everywhere.\n *\n * import { BwalletxSignin } from '@bwalletx/connect/react';\n * <BwalletxSignin challengeUrl=\"/auth/bwalletx/challenge\" verifyUrl=\"/auth/bwalletx/verify\"\n * onSignedIn={(d) => router.refresh()} />\n */\nimport {\n createContext,\n createElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport type { WalletInterface } from '@bsv/sdk';\nimport { clearPairing } from './pair.js';\nimport { declareWalletTheme } from './theme.js';\nimport { runConnect } from './connect-flow.js';\nimport { chooseWallet, pairingModal, pickWallet } from './modal.js';\nimport type { AttemptHook } from './choice.js';\nimport { discoverWallets, type ConnectedWallet, type WalletOption } from './wallets.js';\nimport { accountLabel, avatarUrlFor, lookupPaymail, signInErrorText } from './account.js';\nimport { PaymentError, buyToken, pay, tip, type BuyTokenRequest, type PayOptions, type PayRequest, type PayResult } from './pay.js';\nimport { defineBwalletxSignin, type SigninBrand, type SigninLabel, type SigninMode, type SigninSize, type SigninState, type SigninTheme } from './element.js';\n\nexport interface SignedInDetail {\n identityKey: string;\n method: string;\n nonce: string;\n signature: number[];\n response: unknown;\n}\n\nexport interface BwalletxSigninProps {\n size?: SigninSize;\n theme?: SigninTheme;\n label?: SigninLabel;\n brand?: SigninBrand;\n /** true/undefined = default, false = hidden, string = custom text. */\n subtitle?: boolean | string;\n fullWidth?: boolean;\n loading?: boolean;\n disabled?: boolean;\n challengeUrl?: string;\n verifyUrl?: string;\n getUrl?: string;\n webUrl?: string;\n href?: string;\n authorizeUrl?: string;\n clientId?: string;\n redirectUri?: string;\n scope?: string;\n discoverMs?: number;\n /** \"Other wallets\" link under the button: 'auto' (default: lg/md), 'on' or 'off'. */\n otherWallets?: 'auto' | 'on' | 'off';\n /** Without a provider: GET → { identityKey, handle?, paymail? } restores the signed-in badge on load. */\n sessionUrl?: string;\n /** Without a provider: POST on Disconnect. */\n logoutUrl?: string;\n /** Paymail lookup for the badge; 'off' to skip. */\n lookupUrl?: string;\n /**\n * Show the signed-in badge and the pending / error states (default true). Inside <BwalletXProvider> the button\n * follows the provider: click → connect() (one wallet sheet), badge when signed in, Disconnect → disconnect()\n * (logoutUrl). Set false for the pre-0.5.5 plain button.\n */\n stateful?: boolean;\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n id?: string;\n /** Every click. Call e.preventDefault() to skip the built-in flow. */\n onClick?: (e: CustomEvent<{ element: HTMLElement }>) => void;\n onSignedIn?: (d: SignedInDetail) => void;\n onNotFound?: () => void;\n onError?: (error: unknown) => void;\n /** After Disconnect in the badge menu. */\n onSignedOut?: () => void;\n}\n\n/** The element state for the provider's state. */\nexport function signinStateFor(v: Pick<BwalletXState, 'status' | 'identityKey'>): SigninState {\n if (v.status === 'restoring') return 'restoring';\n if (v.status === 'connecting') return 'pending';\n if (v.status === 'error') return 'error';\n if (v.status === 'connected' && v.identityKey) return 'signed-in';\n return 'signed-out';\n}\n\nexport function BwalletxSignin(props: BwalletxSigninProps): ReactElement {\n const ref = useRef<HTMLElement>(null);\n const cb = useRef(props);\n cb.current = props;\n const ctx = useContext(Ctx);\n const ctxRef = useRef(ctx);\n ctxRef.current = ctx;\n const driven = !!ctx && props.stateful !== false;\n\n useEffect(() => {\n defineBwalletxSignin();\n const el = ref.current;\n if (!el) return;\n const on: [string, EventListener][] = [\n [\n 'bwalletx-signin',\n (e) => {\n cb.current.onClick?.(e as CustomEvent<{ element: HTMLElement }>);\n // Inside a provider the click is the provider's connect(): one wallet sheet, and this button follows it.\n // \"Other wallets\" arrives here too, as mode 'chooser'.\n const c = ctxRef.current;\n if (!e.defaultPrevented && c && cb.current.stateful !== false) {\n e.preventDefault();\n const mode = (e as CustomEvent<{ mode?: SigninMode }>).detail?.mode;\n c.connect(mode === 'chooser' ? { chooser: true } : {}).catch(() => undefined);\n }\n },\n ],\n ['bwalletx-signed-in', (e) => cb.current.onSignedIn?.((e as CustomEvent<SignedInDetail>).detail)],\n ['bwalletx-not-found', () => cb.current.onNotFound?.()],\n ['bwalletx-error', (e) => cb.current.onError?.((e as CustomEvent<{ error: unknown }>).detail.error)],\n [\n 'bwalletx-disconnect',\n (e) => {\n const c = ctxRef.current;\n if (c && cb.current.stateful !== false) {\n e.preventDefault();\n void c.disconnect().then(() => cb.current.onSignedOut?.());\n }\n },\n ],\n ['bwalletx-signed-out', () => cb.current.onSignedOut?.()],\n ];\n for (const [t, f] of on) el.addEventListener(t, f);\n return () => { for (const [t, f] of on) el.removeEventListener(t, f); };\n }, []);\n\n const p = props;\n const flag = (v: boolean | undefined) => (v ? '' : undefined);\n const state = driven ? signinStateFor(ctx) : undefined;\n return createElement('bwalletx-signin', {\n ref,\n id: p.id,\n class: p.className,\n style: p.style,\n size: p.size,\n theme: p.theme,\n label: p.label,\n brand: p.brand,\n subtitle: p.subtitle === false ? 'off' : typeof p.subtitle === 'string' ? p.subtitle : undefined,\n 'full-width': flag(p.fullWidth),\n loading: flag(p.loading),\n disabled: flag(p.disabled),\n 'challenge-url': p.challengeUrl,\n 'verify-url': p.verifyUrl,\n 'session-url': driven ? undefined : p.sessionUrl,\n 'logout-url': driven ? undefined : p.logoutUrl,\n 'lookup-url': p.lookupUrl,\n stateless: p.stateful === false ? '' : undefined,\n state,\n 'identity-key': driven ? (ctx.identityKey ?? undefined) : undefined,\n paymail: driven ? (ctx.paymail ?? undefined) : undefined,\n handle: driven ? (ctx.handle ?? undefined) : undefined,\n 'avatar-url': driven ? (avatarUrlFor(ctx.identityKey) ?? undefined) : undefined,\n error: driven && ctx.status === 'error' ? signInErrorText(ctx.error) : undefined,\n 'get-url': p.getUrl,\n 'web-url': p.webUrl,\n href: p.href,\n 'authorize-url': p.authorizeUrl,\n 'client-id': p.clientId,\n 'redirect-uri': p.redirectUri,\n scope: p.scope,\n 'discover-ms': p.discoverMs,\n 'other-wallets': p.otherWallets,\n 'aria-label': p['aria-label'],\n });\n}\n\nexport default BwalletxSignin;\n\nexport type BwalletXStatus = 'idle' | 'restoring' | 'connecting' | 'connected' | 'error';\n\nexport interface BwalletXState {\n status: BwalletXStatus;\n identityKey: string | null;\n handle: string | null;\n paymail: string | null;\n /** The BRC-100 wallet. null until connect() (a session restored from the cookie has no wallet yet). */\n wallet: WalletInterface | null;\n /** Which option connected (e.g. 'com.bwalletx.extension', 'bwalletx-pairing', 'handcash'). */\n walletId: string | null;\n /** 'bwalletx' for any bWalletX, else the wallet's rdns / option id (0.5.6). null until connect(). */\n walletType: string | null;\n /** True while the transitional HandCash adapter is in use. */\n transitional: boolean;\n /** The server session (verifyUrl/sessionUrl) is in place. */\n signedIn: boolean;\n error: Error | null;\n}\n\nexport interface BwalletXContextValue extends BwalletXState {\n /**\n * Find wallets, connect, and sign in if verifyUrl is set. bWalletX in this browser is used straight away (0.5.6);\n * without it the chooser opens with \"Get bWalletX\" first. `chooser: true` is the \"Other wallets\" link: the chooser\n * even when bWalletX is here.\n */\n connect(opts?: { walletId?: string; chooser?: boolean }): Promise<ConnectedWallet | null>;\n disconnect(): Promise<void>;\n /** The wallets found on the last connect() (or listWallets()). */\n wallets: WalletOption[];\n listWallets(): Promise<WalletOption[]>;\n pay(req: PayRequest): Promise<PayResult>;\n tip(req: PayRequest): Promise<PayResult>;\n buyToken(req: BuyTokenRequest): Promise<PayResult>;\n}\n\nexport interface BwalletXProviderProps {\n children?: ReactNode;\n /** POST {} (or { identityKey }) → challenge. With verifyUrl, connect() also signs in, in ONE wallet sheet. */\n challengeUrl?: string;\n /** POST { identityKey, nonce, signature } → { identityKey, handle?, paymail? } and sets the cookie. */\n verifyUrl?: string;\n /** POST to clear the cookie on disconnect(). */\n logoutUrl?: string;\n /** GET → { identityKey, handle?, paymail? } to restore a session on load. */\n sessionUrl?: string;\n /** Offer phone pairing with the built-in QR modal. Default true. */\n pairing?: boolean;\n /**\n * Show the built-in picker when there is a real choice. Default true. One wallet found in this browser (and no\n * app-supplied option such as HandCash) is used straight away, with no picker; phone pairing is then not offered.\n */\n picker?: boolean;\n /**\n * Your challenge route is older than 0.5.5 and needs the identity key first (two wallet sheets). Normally not\n * needed: such a server is detected and retried. Upgrade the server to @bwalletx/connect 0.5.5 for one sheet.\n */\n challengeNeedsIdentityKey?: boolean;\n /** Paymail lookup by identity key for the signed-in badge (best effort). Default pay.bwallet.space; 'off' to skip. */\n lookupUrl?: string;\n /** Extra options, e.g. [handcashAdapter({ login })]. */\n extraWallets?: WalletOption[];\n /**\n * Probe desktop wallets on localhost while listing. Default false, and best left off (Chrome's Local Network Access\n * prompt): the chooser offers \"Desktop wallet\", which probes only when tapped.\n */\n probeLocal?: boolean;\n /**\n * bWalletX first (0.5.6, default true): with bWalletX in this browser connect() goes straight to its sheet, no\n * chooser; without it the chooser opens, \"Get bWalletX\" first, and another wallet is connected only when picked.\n * false: the 0.5.5 picker rule (one detected wallet of any brand was used without asking).\n */\n fastPath?: boolean;\n /** Called once per connect attempt with { walletType, substrate, outcome, ms }. No keys, addresses or identity data. */\n onAttempt?: AttemptHook;\n /**\n * A theme the wallet already bundles (e.g. 'npgx') for bWalletX to wear while this site is connected and is the\n * active tab. Declared only while connecting or connected; withdrawn on disconnect. See declareWalletTheme.\n */\n theme?: string;\n discoverMs?: number;\n payOptions?: PayOptions;\n onError?: (e: Error) => void;\n}\n\nconst empty: BwalletXState = {\n status: 'idle', identityKey: null, handle: null, paymail: null, wallet: null, walletId: null, walletType: null, transitional: false, signedIn: false, error: null,\n};\n\nconst Ctx = createContext<BwalletXContextValue | null>(null);\n\nasync function postJson(url: string, body: unknown): Promise<Record<string, unknown>> {\n const r = await fetch(url, { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });\n const j = (await r.json().catch(() => ({}))) as Record<string, unknown>;\n if (!r.ok) throw Object.assign(new Error(String(j.error ?? `${url} answered ${r.status}`)), { status: r.status, code: j.code });\n return j;\n}\n\n/** Holds the connected wallet and session for the tree. Renders nothing itself; SSR-safe. */\nexport function BwalletXProvider(p: BwalletXProviderProps): ReactElement {\n const [state, setState] = useState<BwalletXState>(empty);\n const [wallets, setWallets] = useState<WalletOption[]>([]);\n const props = useRef(p);\n props.current = p;\n const payer = useRef<ConnectedWallet['payer']>(null);\n\n const fail = useCallback((e: unknown) => {\n const err = e instanceof Error ? e : new Error(String(e));\n setState((s) => ({ ...s, status: 'error', error: err }));\n props.current.onError?.(err);\n return err;\n }, []);\n\n const themeOn = !!p.theme && (state.status === 'connecting' || state.status === 'connected');\n useEffect(() => {\n if (!themeOn) return;\n declareWalletTheme(p.theme);\n return () => declareWalletTheme(null);\n }, [themeOn, p.theme]);\n\n useEffect(() => {\n const url = p.sessionUrl;\n if (!url) return;\n let live = true;\n setState((s) => ({ ...s, status: 'restoring' }));\n fetch(url, { credentials: 'same-origin' })\n .then((r) => r.json())\n .then((j: { identityKey?: string | null; handle?: string; paymail?: string }) => {\n if (!live) return;\n setState((s) =>\n j.identityKey\n ? { ...s, status: 'connected', identityKey: j.identityKey, handle: j.handle ?? null, paymail: j.paymail ?? null, signedIn: true }\n : { ...s, status: s.status === 'restoring' ? 'idle' : s.status },\n );\n })\n .catch(() => live && setState((s) => ({ ...s, status: s.status === 'restoring' ? 'idle' : s.status })));\n return () => {\n live = false;\n };\n }, [p.sessionUrl]);\n\n const listWallets = useCallback(async () => {\n const c = props.current;\n const list = await discoverWallets({\n ms: c.discoverMs,\n probeLocal: c.probeLocal,\n extra: c.extraWallets,\n pairing: c.pairing === false ? undefined : () => pairingModal(),\n });\n setWallets(list);\n return list;\n }, []);\n\n const connect = useCallback(\n async (opts: { walletId?: string; chooser?: boolean } = {}) => {\n const c = props.current;\n setState((s) => ({ ...s, status: 'connecting', error: null }));\n try {\n const list = await listWallets();\n const fast = c.fastPath !== false;\n const r = await runConnect({\n list,\n walletId: opts.walletId,\n chooser: opts.chooser,\n picker: c.picker,\n fastPath: fast,\n pick: fast ? (l) => chooseWallet(l) : pickWallet,\n onAttempt: c.onAttempt,\n challengeUrl: c.challengeUrl,\n verifyUrl: c.verifyUrl,\n challengeNeedsIdentityKey: c.challengeNeedsIdentityKey,\n post: postJson,\n });\n if (!r) {\n setState((s) => ({ ...s, status: s.identityKey && s.signedIn ? 'connected' : 'idle' }));\n return null;\n }\n const cw = r.connected;\n payer.current = cw.payer;\n setState({\n status: 'connected',\n identityKey: r.identityKey,\n handle: r.handle,\n paymail: r.paymail,\n wallet: cw.wallet,\n walletId: cw.optionId,\n walletType: r.walletType,\n transitional: !!cw.transitional,\n signedIn: r.signedIn,\n error: null,\n });\n return { ...cw, identityKey: r.identityKey, handle: r.handle ?? undefined, paymail: r.paymail ?? undefined };\n } catch (e) {\n if ((e as Error)?.message === 'cancelled') {\n setState((s) => ({ ...s, status: s.identityKey && s.signedIn ? 'connected' : 'idle' }));\n return null;\n }\n throw fail(e);\n }\n },\n [fail, listWallets],\n );\n\n const disconnect = useCallback(async () => {\n const c = props.current;\n if (c.logoutUrl) await postJson(c.logoutUrl, {}).catch(() => {});\n if (state.walletId === 'bwalletx-pairing') await clearPairing();\n payer.current = null;\n setState(empty);\n }, [state.walletId]);\n\n // Best-effort paymail for the badge when the server did not send one (pay.bwallet.space lookup by key).\n useEffect(() => {\n const key = state.identityKey;\n if (!key || state.paymail || p.lookupUrl === 'off') return;\n let live = true;\n void lookupPaymail(key, p.lookupUrl).then((pm) => {\n if (live && pm) setState((s) => (s.identityKey === key && !s.paymail ? { ...s, paymail: pm } : s));\n });\n return () => {\n live = false;\n };\n }, [state.identityKey, state.paymail, p.lookupUrl]);\n\n const need = () => {\n if (!payer.current) throw new PaymentError('NOT_SUPPORTED', 'Connect a wallet first (connect()).');\n return payer.current;\n };\n\n const value = useMemo<BwalletXContextValue>(\n () => ({\n ...state,\n wallets,\n connect,\n disconnect,\n listWallets,\n pay: (req) => pay(need(), req, props.current.payOptions),\n tip: (req) => tip(need(), req, props.current.payOptions),\n buyToken: (req) => buyToken(need(), req),\n }),\n [state, wallets, connect, disconnect, listWallets],\n );\n\n return createElement(Ctx.Provider, { value }, p.children);\n}\n\n/** The wallet + session state. Must be inside <BwalletXProvider>. */\nexport function useBwalletX(): BwalletXContextValue {\n const v = useContext(Ctx);\n if (!v) throw new Error('useBwalletX() must be used inside <BwalletXProvider>');\n return v;\n}\n\nexport type BwalletXAccountStatus = 'restoring' | 'signed-out' | 'pending' | 'signed-in' | 'error';\n\nexport interface BwalletXAccount {\n status: BwalletXAccountStatus;\n identityKey: string | null;\n paymail: string | null;\n handle: string | null;\n /** $alice, a site handle, the paymail, or a short key: what the badge shows. */\n label: string | null;\n /** The bAvatar picture for the identity key (gold by default), or null when signed out. */\n avatarUrl: string | null;\n /** One plain line for the last error (\"Sign-in cancelled\" for a no in the wallet), or null. */\n error: string | null;\n /** Sign in (the provider's connect(): one wallet sheet). Never throws; failures show in `status`/`error`. */\n login(): Promise<void>;\n /** Sign out: the provider's disconnect() (posts logoutUrl). */\n logout(): Promise<void>;\n}\n\n/** The account view of a provider state (what useBwalletXAccount returns). */\nexport function accountFor(v: BwalletXContextValue): BwalletXAccount {\n const status = signinStateFor(v) as BwalletXAccountStatus;\n const signedIn = status === 'signed-in';\n return {\n status,\n identityKey: signedIn ? v.identityKey : null,\n paymail: signedIn ? v.paymail : null,\n handle: signedIn ? v.handle : null,\n label: signedIn ? accountLabel(v) : null,\n avatarUrl: signedIn ? avatarUrlFor(v.identityKey) : null,\n error: status === 'error' ? signInErrorText(v.error) : null,\n login: () => v.connect().then(() => undefined, () => undefined),\n logout: () => v.disconnect(),\n };\n}\n\n/** The signed-in account for your own UI: { status, identityKey, paymail, handle, avatarUrl, logout, … }. Inside <BwalletXProvider>. */\nexport function useBwalletXAccount(): BwalletXAccount {\n return accountFor(useBwalletX());\n}\n\nexport { handcashAdapter, brc100Option, pairingOption, discoverWallets, autoChoice } from './wallets.js';\nexport type { WalletOption, ConnectedWallet, HandCashAdapterOptions } from './wallets.js';\nexport { PaymentError } from './pay.js';\nexport type { PayRequest, PayResult, BuyTokenRequest, PayOptions } from './pay.js';\n/** Alias with the casing used by <BwalletxSignin>. */\nexport const BwalletxProvider = BwalletXProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;AAAA,EACE;AAAA,EACA;AA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esContent":["/**\n * React wrapper for <bwalletx-signin>. React is an optional peer dependency; the button itself is\n * the web component, so markup and behaviour are identical everywhere.\n *\n * import { BwalletxSignin } from '@bwalletx/connect/react';\n * <BwalletxSignin challengeUrl=\"/auth/bwalletx/challenge\" verifyUrl=\"/auth/bwalletx/verify\"\n * onSignedIn={(d) => router.refresh()} />\n */\nimport {\n createContext,\n createElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport type { WalletInterface } from '@bsv/sdk';\nimport { clearPairing } from './pair.js';\nimport { declareWalletTheme } from './theme.js';\nimport { runConnect, runSilentMetanet } from './connect-flow.js';\nimport { metanetOffered, silentAttemptUsed, warnIfNoLogout, METANET_TYPE } from './metanet.js';\nimport { chooseWallet, pairingModal, pickWallet } from './modal.js';\nimport {\n attachRemembered, forgetWalletChoice, needsBwalletX, planAutoConnect, rememberedWalletChoice, walletTypeOf,\n type AttemptHook, type RememberedWallet,\n} from './choice.js';\nimport { discoverWallets, type ConnectedWallet, type WalletOption } from './wallets.js';\nimport { accountLabel, avatarUrlFor, lookupPaymail, signInErrorText } from './account.js';\nimport { PaymentError, buyToken, pay, tip, type BuyTokenRequest, type PayOptions, type PayRequest, type PayResult } from './pay.js';\nimport { defineBwalletxSignin, type SigninBrand, type SigninLabel, type SigninMode, type SigninSize, type SigninState, type SigninTheme } from './element.js';\n\nexport interface SignedInDetail {\n identityKey: string;\n method: string;\n nonce: string;\n signature: number[];\n response: unknown;\n}\n\nexport interface BwalletxSigninProps {\n size?: SigninSize;\n theme?: SigninTheme;\n label?: SigninLabel;\n brand?: SigninBrand;\n /** true/undefined = default, false = hidden, string = custom text. */\n subtitle?: boolean | string;\n fullWidth?: boolean;\n loading?: boolean;\n disabled?: boolean;\n challengeUrl?: string;\n verifyUrl?: string;\n getUrl?: string;\n webUrl?: string;\n href?: string;\n authorizeUrl?: string;\n clientId?: string;\n redirectUri?: string;\n scope?: string;\n discoverMs?: number;\n /** \"Other wallets\" link under the button: 'auto' (default: lg/md), 'on' or 'off'. */\n otherWallets?: 'auto' | 'on' | 'off';\n /**\n * (0.7.0) \"Use Metanet Desktop or another BRC-100 wallet\" under the button: 'auto' (default: lg/md on a computer,\n * outside any frame), 'on' or 'off'. Connects to localhost:3321 on its own tap only.\n */\n metanet?: 'auto' | 'on' | 'off';\n /** Without a provider: GET → { identityKey, handle?, paymail? } restores the signed-in badge on load. */\n sessionUrl?: string;\n /** Without a provider: POST on Disconnect. */\n logoutUrl?: string;\n /** Paymail lookup for the badge; 'off' to skip. */\n lookupUrl?: string;\n /**\n * Show the signed-in badge and the pending / error states (default true). Inside <BwalletXProvider> the button\n * follows the provider: click → connect() (one wallet sheet), badge when signed in, Disconnect → disconnect()\n * (logoutUrl). Set false for the pre-0.5.5 plain button.\n */\n stateful?: boolean;\n 'aria-label'?: string;\n className?: string;\n style?: CSSProperties;\n id?: string;\n /** Every click. Call e.preventDefault() to skip the built-in flow. */\n onClick?: (e: CustomEvent<{ element: HTMLElement }>) => void;\n onSignedIn?: (d: SignedInDetail) => void;\n onNotFound?: () => void;\n onError?: (error: unknown) => void;\n /** After Disconnect in the badge menu. */\n onSignedOut?: () => void;\n}\n\n/** The element state for the provider's state. */\nexport function signinStateFor(v: Pick<BwalletXState, 'status' | 'identityKey'>): SigninState {\n if (v.status === 'restoring') return 'restoring';\n if (v.status === 'connecting') return 'pending';\n if (v.status === 'error') return 'error';\n if (v.status === 'connected' && v.identityKey) return 'signed-in';\n return 'signed-out';\n}\n\nexport function BwalletxSignin(props: BwalletxSigninProps): ReactElement {\n const ref = useRef<HTMLElement>(null);\n const cb = useRef(props);\n cb.current = props;\n const ctx = useContext(Ctx);\n const ctxRef = useRef(ctx);\n ctxRef.current = ctx;\n const driven = !!ctx && props.stateful !== false;\n\n useEffect(() => {\n defineBwalletxSignin();\n const el = ref.current;\n if (!el) return;\n const on: [string, EventListener][] = [\n [\n 'bwalletx-signin',\n (e) => {\n cb.current.onClick?.(e as CustomEvent<{ element: HTMLElement }>);\n // Inside a provider the click is the provider's connect(): one wallet sheet, and this button follows it.\n // \"Other wallets\" arrives here too, as mode 'chooser'.\n const c = ctxRef.current;\n if (!e.defaultPrevented && c && cb.current.stateful !== false) {\n e.preventDefault();\n const mode = (e as CustomEvent<{ mode?: SigninMode }>).detail?.mode;\n c.connect(mode === 'chooser' ? { chooser: true } : mode === 'bwalletx' ? { bwalletx: true } : mode === 'metanet' ? { metanet: true } : {}).catch(() => undefined);\n }\n },\n ],\n ['bwalletx-signed-in', (e) => cb.current.onSignedIn?.((e as CustomEvent<SignedInDetail>).detail)],\n ['bwalletx-not-found', () => cb.current.onNotFound?.()],\n ['bwalletx-error', (e) => cb.current.onError?.((e as CustomEvent<{ error: unknown }>).detail.error)],\n [\n 'bwalletx-disconnect',\n (e) => {\n const c = ctxRef.current;\n if (c && cb.current.stateful !== false) {\n e.preventDefault();\n void c.disconnect().then(() => cb.current.onSignedOut?.());\n }\n },\n ],\n ['bwalletx-signed-out', () => cb.current.onSignedOut?.()],\n [\n 'bwalletx-not-you',\n (e) => {\n const c = ctxRef.current;\n if (c && cb.current.stateful !== false) {\n e.preventDefault();\n c.forgetWallet();\n }\n },\n ],\n ];\n for (const [t, f] of on) el.addEventListener(t, f);\n return () => { for (const [t, f] of on) el.removeEventListener(t, f); };\n }, []);\n\n const p = props;\n const flag = (v: boolean | undefined) => (v ? '' : undefined);\n const state = driven ? signinStateFor(ctx) : undefined;\n return createElement('bwalletx-signin', {\n ref,\n id: p.id,\n class: p.className,\n style: p.style,\n size: p.size,\n theme: p.theme,\n label: p.label,\n brand: p.brand,\n subtitle: p.subtitle === false ? 'off' : typeof p.subtitle === 'string' ? p.subtitle : undefined,\n 'full-width': flag(p.fullWidth),\n loading: flag(p.loading),\n disabled: flag(p.disabled),\n 'challenge-url': p.challengeUrl,\n 'verify-url': p.verifyUrl,\n 'session-url': driven ? undefined : p.sessionUrl,\n 'logout-url': driven ? undefined : p.logoutUrl,\n 'lookup-url': p.lookupUrl,\n stateless: p.stateful === false ? '' : undefined,\n state,\n 'identity-key': driven ? (ctx.identityKey ?? undefined) : undefined,\n paymail: driven ? (ctx.paymail ?? undefined) : undefined,\n handle: driven ? (ctx.handle ?? undefined) : undefined,\n 'avatar-url': driven ? (avatarUrlFor(ctx.identityKey) ?? undefined) : undefined,\n error: driven && ctx.status === 'error' ? signInErrorText(ctx.error) : undefined,\n 'get-url': p.getUrl,\n 'web-url': p.webUrl,\n href: p.href,\n 'authorize-url': p.authorizeUrl,\n 'client-id': p.clientId,\n 'redirect-uri': p.redirectUri,\n scope: p.scope,\n 'discover-ms': p.discoverMs,\n 'other-wallets': p.otherWallets,\n metanet: p.metanet,\n 'wallet-type': driven ? (ctx.walletType ?? ctx.rememberedWallet?.type ?? undefined) : undefined,\n 'aria-label': p['aria-label'],\n });\n}\n\nexport default BwalletxSignin;\n\nexport type BwalletXStatus = 'idle' | 'restoring' | 'connecting' | 'connected' | 'error';\n\nexport interface BwalletXState {\n status: BwalletXStatus;\n identityKey: string | null;\n handle: string | null;\n paymail: string | null;\n /** The BRC-100 wallet. null until connect() (a session restored from the cookie has no wallet yet). */\n wallet: WalletInterface | null;\n /** Which option connected (e.g. 'com.bwalletx.extension', 'bwalletx-pairing', 'handcash'). */\n walletId: string | null;\n /** 'bwalletx' for any bWalletX, else the wallet's rdns / option id (0.5.6). null until connect(). */\n walletType: string | null;\n /** (0.6.0) The wallet type picked on this origin before (no keys), or null. Read after mount. */\n rememberedWallet: RememberedWallet | null;\n /** (0.6.0) The connected (or remembered) wallet isn't bWalletX: show \"Some features need bWalletX · Switch\". */\n needsBwalletX: boolean;\n /** (0.7.0) \"Use Metanet Desktop or another BRC-100 wallet\" is offered here (a computer, outside any frame). */\n metanetOffered: boolean;\n /** True while the transitional HandCash adapter is in use. */\n transitional: boolean;\n /** The server session (verifyUrl/sessionUrl) is in place. */\n signedIn: boolean;\n error: Error | null;\n}\n\nexport interface BwalletXContextValue extends BwalletXState {\n /**\n * Find wallets, connect, and sign in if verifyUrl is set. bWalletX in this browser is used straight away (0.5.6);\n * without it the chooser opens with \"Get bWalletX\" first. `chooser: true` is the \"Other wallets\" link: the chooser\n * even when bWalletX is here.\n */\n connect(opts?: { walletId?: string; chooser?: boolean; bwalletx?: boolean; metanet?: boolean }): Promise<ConnectedWallet | null>;\n /** (0.6.0) \"Switch\": sign in with bWalletX (straight to it when here, else the chooser with Get bWalletX first). */\n switchToBwalletX(): Promise<ConnectedWallet | null>;\n /**\n * (0.7.0) \"Use Metanet Desktop or another BRC-100 wallet\": connect to localhost:3321 (pinned json-api) and sign in.\n * Call it from the user's tap only.\n */\n connectMetanet(): Promise<ConnectedWallet | null>;\n /**\n * (0.7.0) \"Not you? Use another wallet\": forget the wallet remembered on this origin and drop a silent Metanet\n * sign-in in flight (a session its verify already set is ended through logoutUrl).\n */\n forgetWallet(): void;\n disconnect(): Promise<void>;\n /** The wallets found on the last connect() (or listWallets()). */\n wallets: WalletOption[];\n listWallets(): Promise<WalletOption[]>;\n pay(req: PayRequest): Promise<PayResult>;\n tip(req: PayRequest): Promise<PayResult>;\n buyToken(req: BuyTokenRequest): Promise<PayResult>;\n}\n\nexport interface BwalletXProviderProps {\n children?: ReactNode;\n /** POST {} (or { identityKey }) → challenge. With verifyUrl, connect() also signs in, in ONE wallet sheet. */\n challengeUrl?: string;\n /** POST { identityKey, nonce, signature } → { identityKey, handle?, paymail? } and sets the cookie. */\n verifyUrl?: string;\n /**\n * POST to clear the cookie on disconnect(). REQUIRED whenever verifyUrl is set (0.7.0): \"Not you? Use another wallet\"\n * and disconnect() end a session the verify route created through it. Missing → a console.warn in development.\n */\n logoutUrl?: string;\n /** GET → { identityKey, handle?, paymail? } to restore a session on load. */\n sessionUrl?: string;\n /** Offer phone pairing with the built-in QR modal. Default true. */\n pairing?: boolean;\n /**\n * Show the built-in picker when there is a real choice. Default true. One wallet found in this browser (and no\n * app-supplied option such as HandCash) is used straight away, with no picker; phone pairing is then not offered.\n */\n picker?: boolean;\n /**\n * Your challenge route is older than 0.5.5 and needs the identity key first (two wallet sheets). Normally not\n * needed: such a server is detected and retried. Upgrade the server to @bwalletx/connect 0.5.5 for one sheet.\n */\n challengeNeedsIdentityKey?: boolean;\n /** Paymail lookup by identity key for the signed-in badge (best effort). Default pay.bwallet.space; 'off' to skip. */\n lookupUrl?: string;\n /** Extra options, e.g. [handcashAdapter({ login })]. */\n extraWallets?: WalletOption[];\n /**\n * Probe desktop wallets on localhost while listing. Default false, and best left off (Chrome's Local Network Access\n * prompt): the chooser offers \"Desktop wallet\", which probes only when tapped.\n */\n probeLocal?: boolean;\n /**\n * bWalletX first (0.5.6, default true): with bWalletX in this browser connect() goes straight to its sheet, no\n * chooser; without it the chooser opens, \"Get bWalletX\" first, and another wallet is connected only when picked.\n * false: the 0.5.5 picker rule (one detected wallet of any brand was used without asking).\n */\n fastPath?: boolean;\n /** Called once per connect attempt with { walletType, substrate, outcome, ms }. No keys, addresses or identity data. */\n onAttempt?: AttemptHook;\n /**\n * (0.6.0) Remember the wallet TYPE the user explicitly picked on this origin (localStorage `bwx:wallet`; never a key)\n * and go straight to it on the next tap, with no chooser. Disconnect forgets it. Default true.\n */\n rememberChoice?: boolean;\n /**\n * (0.6.0) On load, for a returning visitor with a server session, pick up the remembered wallet by discovery alone\n * (no wallet call, so no prompt; never a localhost probe) so pay/tip work without another tap. Without a session\n * nothing fires on load: a connect would ask the wallet, so it waits for the tap. Default true.\n */\n autoConnect?: boolean;\n /**\n * A theme the wallet already bundles (e.g. 'npgx') for bWalletX to wear while this site is connected and is the\n * active tab. Declared only while connecting or connected; withdrawn on disconnect. See declareWalletTheme.\n */\n theme?: string;\n discoverMs?: number;\n payOptions?: PayOptions;\n onError?: (e: Error) => void;\n}\n\nconst empty: BwalletXState = {\n status: 'idle', identityKey: null, handle: null, paymail: null, wallet: null, walletId: null, walletType: null, transitional: false, signedIn: false, error: null,\n rememberedWallet: null, needsBwalletX: false, metanetOffered: false,\n};\n\nconst Ctx = createContext<BwalletXContextValue | null>(null);\n\nasync function postJson(url: string, body: unknown): Promise<Record<string, unknown>> {\n const r = await fetch(url, { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) });\n const j = (await r.json().catch(() => ({}))) as Record<string, unknown>;\n if (!r.ok) throw Object.assign(new Error(String(j.error ?? `${url} answered ${r.status}`)), { status: r.status, code: j.code });\n return j;\n}\n\n/** Holds the connected wallet and session for the tree. Renders nothing itself; SSR-safe. */\nexport function BwalletXProvider(p: BwalletXProviderProps): ReactElement {\n const [state, setState] = useState<BwalletXState>(empty);\n const stateRef = useRef(state);\n stateRef.current = state;\n /** (0.7.0) Bumped by forgetWallet (\"Not you?\") and disconnect: a silent Metanet sign-in started before lands nobody. */\n const silentRun = useRef(0);\n /** The session check (sessionUrl) has answered, so the silent attempt knows whether a session is there. */\n const sessionChecked = useRef(!p.sessionUrl);\n const [wallets, setWallets] = useState<WalletOption[]>([]);\n const props = useRef(p);\n props.current = p;\n const payer = useRef<ConnectedWallet['payer']>(null);\n\n const fail = useCallback((e: unknown) => {\n const err = e instanceof Error ? e : new Error(String(e));\n setState((s) => ({ ...s, status: 'error', error: err }));\n props.current.onError?.(err);\n return err;\n }, []);\n\n useEffect(() => {\n warnIfNoLogout({ verifyUrl: p.verifyUrl, logoutUrl: p.logoutUrl, where: '<BwalletXProvider>' });\n }, [p.verifyUrl, p.logoutUrl]);\n\n const themeOn = !!p.theme && (state.status === 'connecting' || state.status === 'connected');\n useEffect(() => {\n if (!themeOn) return;\n declareWalletTheme(p.theme);\n return () => declareWalletTheme(null);\n }, [themeOn, p.theme]);\n\n useEffect(() => {\n const url = p.sessionUrl;\n if (!url) return;\n let live = true;\n setState((s) => ({ ...s, status: 'restoring' }));\n fetch(url, { credentials: 'same-origin' })\n .then((r) => r.json())\n .then((j: { identityKey?: string | null; handle?: string; paymail?: string }) => {\n if (!live) return;\n sessionChecked.current = true;\n setState((s) =>\n j.identityKey\n ? { ...s, status: 'connected', identityKey: j.identityKey, handle: j.handle ?? null, paymail: j.paymail ?? null, signedIn: true }\n : { ...s, status: s.status === 'restoring' ? 'idle' : s.status },\n );\n })\n .catch(() => {\n if (!live) return;\n sessionChecked.current = true;\n setState((s) => ({ ...s, status: s.status === 'restoring' ? 'idle' : s.status }));\n });\n return () => {\n live = false;\n };\n }, [p.sessionUrl]);\n\n const listWallets = useCallback(async () => {\n const c = props.current;\n const list = await discoverWallets({\n ms: c.discoverMs,\n probeLocal: c.probeLocal,\n extra: c.extraWallets,\n pairing: c.pairing === false ? undefined : () => pairingModal(),\n });\n setWallets(list);\n return list;\n }, []);\n\n const connect = useCallback(\n async (opts: { walletId?: string; chooser?: boolean; bwalletx?: boolean; metanet?: boolean } = {}) => {\n const c = props.current;\n setState((s) => ({ ...s, status: 'connecting', error: null }));\n try {\n const list = opts.metanet ? [] : await listWallets();\n const fast = c.fastPath !== false;\n const r = await runConnect({\n list,\n walletId: opts.walletId,\n chooser: opts.chooser,\n picker: c.picker,\n fastPath: fast,\n pick: fast ? (l) => chooseWallet(l) : pickWallet,\n onAttempt: c.onAttempt,\n remembered: fast && c.rememberChoice !== false ? rememberedWalletChoice() : null,\n remember: fast && c.rememberChoice !== false,\n preferBwalletX: opts.bwalletx,\n metanet: opts.metanet,\n challengeUrl: c.challengeUrl,\n verifyUrl: c.verifyUrl,\n challengeNeedsIdentityKey: c.challengeNeedsIdentityKey,\n post: postJson,\n });\n if (!r) {\n setState((s) => ({ ...s, status: s.identityKey && s.signedIn ? 'connected' : 'idle' }));\n return null;\n }\n const cw = r.connected;\n payer.current = cw.payer;\n setState({\n status: 'connected',\n identityKey: r.identityKey,\n handle: r.handle,\n paymail: r.paymail,\n wallet: cw.wallet,\n walletId: cw.optionId,\n walletType: r.walletType,\n transitional: !!cw.transitional,\n signedIn: r.signedIn,\n error: null,\n rememberedWallet: c.rememberChoice !== false ? rememberedWalletChoice() : null,\n needsBwalletX: needsBwalletX(r.walletType),\n metanetOffered: metanetOffered(),\n });\n return { ...cw, identityKey: r.identityKey, handle: r.handle ?? undefined, paymail: r.paymail ?? undefined };\n } catch (e) {\n if ((e as Error)?.message === 'cancelled') {\n setState((s) => ({ ...s, status: s.identityKey && s.signedIn ? 'connected' : 'idle' }));\n return null;\n }\n throw fail(e);\n }\n },\n [fail, listWallets],\n );\n\n const disconnect = useCallback(async () => {\n const c = props.current;\n if (c.logoutUrl) await postJson(c.logoutUrl, {}).catch(() => {});\n if (state.walletId === 'bwalletx-pairing') await clearPairing();\n // A Disconnect means \"don't connect me automatically\": the remembered wallet goes too.\n if (c.rememberChoice !== false) forgetWalletChoice();\n silentRun.current++;\n payer.current = null;\n setState({ ...empty, metanetOffered: metanetOffered() });\n }, [state.walletId]);\n\n const switchToBwalletX = useCallback(() => connect({ bwalletx: true }), [connect]);\n const connectMetanet = useCallback(() => connect({ metanet: true }), [connect]);\n\n const forgetWallet = useCallback(() => {\n if (props.current.rememberChoice !== false) forgetWalletChoice();\n silentRun.current++;\n setState((s) => ({\n ...s,\n rememberedWallet: null,\n needsBwalletX: s.walletType ? needsBwalletX(s.walletType) : false,\n // A silent Metanet sign-in on screen goes back to the normal choice.\n status: s.status === 'connecting' && !s.wallet ? (s.signedIn && s.identityKey ? 'connected' : 'idle') : s.status,\n }));\n }, []);\n\n // 0.6.0: the remembered wallet, read after mount (SSR-safe), for the \"Switch\" note.\n useEffect(() => {\n setState((s) => (s.metanetOffered === metanetOffered() ? s : { ...s, metanetOffered: metanetOffered() }));\n if (p.rememberChoice === false) return;\n const r = rememberedWalletChoice();\n // A remembered Metanet isn't where the button's tap goes, so it never shows the Switch note (0.7.0).\n if (r) setState((s) => (s.rememberedWallet ? s : { ...s, rememberedWallet: r, needsBwalletX: s.walletType ? s.needsBwalletX : needsBwalletX(r.type) && r.type !== METANET_TYPE }));\n }, [p.rememberChoice]);\n\n // 0.6.0 auto-connect: signed in from the session cookie, wallet not attached yet → pick up the remembered wallet by\n // discovery alone (no wallet call, no prompt, no localhost). Anything that would ask the wallet waits for a tap.\n const sessionOnly = state.status === 'connected' && state.signedIn && !state.wallet;\n useEffect(() => {\n const c = props.current;\n if (!sessionOnly || c.autoConnect === false || c.rememberChoice === false || c.fastPath === false) return;\n const plan = planAutoConnect({ remembered: rememberedWalletChoice(), signedIn: true });\n if (plan.action !== 'attach' || !plan.remembered) return;\n let live = true;\n void attachRemembered(plan.remembered, { ms: c.discoverMs }).then((opt) => {\n if (!live || !opt?.wallet) return;\n payer.current = opt.wallet;\n setState((s) =>\n s.status === 'connected' && !s.wallet\n ? { ...s, wallet: opt.wallet!, walletId: opt.id, walletType: walletTypeOf(opt), needsBwalletX: needsBwalletX(walletTypeOf(opt)) }\n : s,\n );\n });\n return () => {\n live = false;\n };\n }, [sessionOnly]);\n\n // 0.7.0 rule 4: Metanet Desktop remembered here → ONE silent attempt per page load (2 s, a known identity key only).\n // With a session: attach the wallet if it is the session's key. Without: sign in with the signature alone. Any stop\n // or failure is silent (no error, no onError, no retry); the normal choice stays and waits for a tap.\n const silentReady = state.status === 'idle' || sessionOnly;\n useEffect(() => {\n const c = props.current;\n if (!silentReady || !sessionChecked.current || c.autoConnect === false || c.rememberChoice === false || c.fastPath === false || silentAttemptUsed()) return;\n const plan = planAutoConnect({ remembered: rememberedWalletChoice(), signedIn: sessionOnly });\n if (plan.action !== 'silent-metanet') return;\n const run = ++silentRun.current;\n const live = () => run === silentRun.current;\n let shown = false;\n const session = stateRef.current;\n void runSilentMetanet({\n sessionKey: sessionOnly ? session.identityKey : null,\n challengeUrl: c.challengeUrl,\n verifyUrl: c.verifyUrl,\n post: postJson,\n onAttempt: c.onAttempt,\n isAbandoned: () => !live(),\n logout: () => (props.current.logoutUrl ? postJson(props.current.logoutUrl, {}) : Promise.resolve()),\n onSignIn: () => {\n if (!live()) return;\n shown = true;\n setState((s) => (s.status === 'idle' ? { ...s, status: 'connecting', error: null } : s));\n },\n }).then((r) => {\n if (!live()) return;\n if (!r) {\n if (shown) setState((s) => (s.status === 'connecting' && !s.wallet ? { ...s, status: s.signedIn && s.identityKey ? 'connected' : 'idle' } : s));\n return;\n }\n const cw = r.connected;\n payer.current = cw.payer;\n setState((s) => ({\n ...s,\n status: 'connected',\n identityKey: r.identityKey,\n handle: r.handle ?? s.handle,\n paymail: r.paymail ?? s.paymail,\n wallet: cw.wallet,\n walletId: cw.optionId,\n walletType: r.walletType,\n transitional: false,\n signedIn: r.signedIn || s.signedIn,\n error: null,\n rememberedWallet: rememberedWalletChoice(),\n needsBwalletX: true,\n }));\n });\n }, [silentReady, sessionOnly]);\n\n // Best-effort paymail for the badge when the server did not send one (pay.bwallet.space lookup by key).\n useEffect(() => {\n const key = state.identityKey;\n if (!key || state.paymail || p.lookupUrl === 'off') return;\n let live = true;\n void lookupPaymail(key, p.lookupUrl).then((pm) => {\n if (live && pm) setState((s) => (s.identityKey === key && !s.paymail ? { ...s, paymail: pm } : s));\n });\n return () => {\n live = false;\n };\n }, [state.identityKey, state.paymail, p.lookupUrl]);\n\n const need = () => {\n if (!payer.current) throw new PaymentError('NOT_SUPPORTED', 'Connect a wallet first (connect()).');\n return payer.current;\n };\n\n const value = useMemo<BwalletXContextValue>(\n () => ({\n ...state,\n wallets,\n connect,\n disconnect,\n switchToBwalletX,\n connectMetanet,\n forgetWallet,\n listWallets,\n pay: (req) => pay(need(), req, props.current.payOptions),\n tip: (req) => tip(need(), req, props.current.payOptions),\n buyToken: (req) => buyToken(need(), req),\n }),\n [state, wallets, connect, disconnect, switchToBwalletX, connectMetanet, forgetWallet, listWallets],\n );\n\n return createElement(Ctx.Provider, { value }, p.children);\n}\n\n/** The wallet + session state. Must be inside <BwalletXProvider>. */\nexport function useBwalletX(): BwalletXContextValue {\n const v = useContext(Ctx);\n if (!v) throw new Error('useBwalletX() must be used inside <BwalletXProvider>');\n return v;\n}\n\nexport type BwalletXAccountStatus = 'restoring' | 'signed-out' | 'pending' | 'signed-in' | 'error';\n\nexport interface BwalletXAccount {\n status: BwalletXAccountStatus;\n identityKey: string | null;\n paymail: string | null;\n handle: string | null;\n /** $alice, a site handle, the paymail, or a short key: what the badge shows. */\n label: string | null;\n /** The bAvatar picture for the identity key (gold by default), or null when signed out. */\n avatarUrl: string | null;\n /** One plain line for the last error (\"Sign-in cancelled\" for a no in the wallet), or null. */\n error: string | null;\n /** Sign in (the provider's connect(): one wallet sheet). Never throws; failures show in `status`/`error`. */\n login(): Promise<void>;\n /** Sign out: the provider's disconnect() (posts logoutUrl). */\n logout(): Promise<void>;\n}\n\n/** The account view of a provider state (what useBwalletXAccount returns). */\nexport function accountFor(v: BwalletXContextValue): BwalletXAccount {\n const status = signinStateFor(v) as BwalletXAccountStatus;\n const signedIn = status === 'signed-in';\n return {\n status,\n identityKey: signedIn ? v.identityKey : null,\n paymail: signedIn ? v.paymail : null,\n handle: signedIn ? v.handle : null,\n label: signedIn ? accountLabel(v) : null,\n avatarUrl: signedIn ? avatarUrlFor(v.identityKey) : null,\n error: status === 'error' ? signInErrorText(v.error) : null,\n login: () => v.connect().then(() => undefined, () => undefined),\n logout: () => v.disconnect(),\n };\n}\n\n/** The signed-in account for your own UI: { status, identityKey, paymail, handle, avatarUrl, logout, … }. Inside <BwalletXProvider>. */\nexport function useBwalletXAccount(): BwalletXAccount {\n return accountFor(useBwalletX());\n}\n\nexport { handcashAdapter, brc100Option, pairingOption, discoverWallets, autoChoice } from './wallets.js';\nexport type { WalletOption, ConnectedWallet, HandCashAdapterOptions } from './wallets.js';\nexport { PaymentError } from './pay.js';\nexport type { PayRequest, PayResult, BuyTokenRequest, PayOptions } from './pay.js';\n/** Alias with the casing used by <BwalletxSignin>. */\nexport const BwalletxProvider = BwalletXProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AA6EA,SAAS,eAAe,GAA+D;AA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AC,EAAG,OAAM,IAAI,MAAM,sDAAsD;AAC9E,SAAO;AACT;AAsBO,SAAS,WAAW,GAA0C;AACnE,QAAM,SAAS,eAAe,CAAC;AAC/B,QAAM,WAAW,WAAW;AAC5B,SAAO;AAAA,IACL;AAAA,IACA,aAAa,WAAW,EAAE,cAAc;AAAA,IACxC,SAAS,WAAW,EAAE,UAAU;AAAA,IAChC,QAAQ,WAAW,EAAE,SAAS;AAAA,IAC9B,OAAO,WAAW,aAAa,CAAC,IAAI;AAAA,IACpC,WAAW,WAAW,aAAa,EAAE,WAAW,IAAI;AAAA,IACpD,OAAO,WAAW,UAAU,gBAAgB,EAAE,KAAK,IAAI;AAAA,IACvD,OAAO,MAAM,EAAE,QAAQ,EAAE,KAAK,MAAM,QAAW,MAAM,MAAS;AAAA,IAC9D,QAAQ,MAAM,EAAE,WAAW;AAAA,EAC7B;AACF;AAGO,SAAS,qBAAsC;AACpD,SAAO,WAAW,YAAY,CAAC;AACjC;AAOO,IAAM,mBAAmB;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bwalletx/connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Sign in with bWalletX or any BRC-100 wallet: button, React provider, Next.js sessions, nonce stores, pay/tip helpers, payment verification, wallet picker, and the bApp shell",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|