@bwalletx/connect 0.4.1 → 0.5.3
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 +20 -0
- package/README.md +6 -2
- package/assets/protocol/401.jpg +0 -0
- package/assets/protocol/401.mp4 +0 -0
- package/assets/protocol/402.jpg +0 -0
- package/assets/protocol/402.mp4 +0 -0
- package/assets/protocol/403.jpg +0 -0
- package/assets/protocol/403.mp4 +0 -0
- package/dist/access-Dp0eKIOc.d.cts +118 -0
- package/dist/access-Dp0eKIOc.d.ts +118 -0
- package/dist/bwalletx-connect.global.js +20 -17
- package/dist/bwalletx-connect.global.js.map +1 -1
- package/dist/{chunk-NNMUSWPG.js → chunk-IUDD7YTQ.js} +200 -10
- package/dist/chunk-IUDD7YTQ.js.map +1 -0
- package/dist/chunk-MWD4BCO5.js +182 -0
- package/dist/chunk-MWD4BCO5.js.map +1 -0
- package/dist/{chunk-FUQ46RJV.js → chunk-PI42H3XY.js} +65 -10
- package/dist/chunk-PI42H3XY.js.map +1 -0
- package/dist/{chunk-7NAKOJGZ.js → chunk-QRXFL66W.js} +220 -10
- package/dist/chunk-QRXFL66W.js.map +1 -0
- package/dist/element.cjs +290 -14
- package/dist/element.cjs.map +1 -1
- package/dist/element.js +2 -1
- package/dist/element.js.map +1 -1
- package/dist/index.cjs +437 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -1
- package/dist/index.d.ts +71 -1
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +377 -9
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +52 -2
- package/dist/next.d.ts +52 -2
- package/dist/next.js +92 -1
- package/dist/next.js.map +1 -1
- package/dist/react.cjs +561 -226
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -0
- package/dist/react.d.ts +5 -0
- package/dist/react.js +12 -3
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +406 -9
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +111 -1
- package/dist/server.d.ts +111 -1
- package/dist/server.js +47 -1
- package/package.json +12 -11
- package/dist/chunk-7NAKOJGZ.js.map +0 -1
- package/dist/chunk-FUQ46RJV.js.map +0 -1
- package/dist/chunk-NNMUSWPG.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,8 @@ import { WalletInterface, WalletProtocol } from '@bsv/sdk';
|
|
|
2
2
|
import { f as PairingOptions, W as WalletOption } from './wallets-VOKIKBbO.cjs';
|
|
3
3
|
export { g as BRC29_PROTOCOL, i as Brc29Remittance, B as BuyTokenRequest, C as ConnectedWallet, D as DiscoverWalletsOptions, H as HandCashAdapterOptions, L as LegacyPayer, j as PairConnectionOptions, k as PairStorage, l as PairedWallet, b as PayOptions, m as PayOutput, P as PayRequest, a as PayResult, n as PaySource, c as PaymentError, o as PaymentErrorCode, S as SocketFactory, q as SocketLike, T as TokenQuote, r as WalletKind, s as amountInSats, d as brc100Option, t as buyToken, u as clearPairing, e as discoverWallets, h as handcashAdapter, v as isIdentityKeyHex, w as isPaymail, x as pairBwalletX, p as pairingOption, y as pay, z as resolvePaymailP2P, A as restorePairing, E as tip } from './wallets-VOKIKBbO.cjs';
|
|
4
4
|
export { AuthorizeParams, GET_URL, SIGNIN_CSS, SIGNIN_TAG, SigninBrand, SigninLabel, SigninSize, SigninTheme, WEB_WALLET_URL, buildAuthorizeUrl, defineBwalletxSignin, markSvg, signinText } from './element.cjs';
|
|
5
|
+
import { b as AccessResponse, H as HoldingProof, A as AccessError } from './access-Dp0eKIOc.cjs';
|
|
6
|
+
export { f as ACCESS_ERROR_STATUS, d as ACCESS_PROTOCOL, g as ACCESS_VERSION, h as AccessChallenge, i as AccessErrorBody, j as AccessErrorCode, c as AccessKind, a as AccessRequirement, P as PROTOCOL_MEDIA, T as TokenRequirement, k as accessErrorMessage, m as canonicalJson, r as protocolMediaUrl } from './access-Dp0eKIOc.cjs';
|
|
5
7
|
|
|
6
8
|
/** Ids bWalletX announces in BRC-100 wallet discovery. */
|
|
7
9
|
declare const RDNS_EXTENSION = "com.bwalletx.extension";
|
|
@@ -67,6 +69,8 @@ declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing'
|
|
|
67
69
|
* identityKey, nonce and signature to your verify route.
|
|
68
70
|
*/
|
|
69
71
|
declare function signInWithBwalletX(opts: SignInOptions): Promise<SignInResult>;
|
|
72
|
+
/** Where a sign-in failed: the wallet's identity prompt, the site's challenge endpoint, or the wallet's signature. */
|
|
73
|
+
type SignInStage = 'identity' | 'challenge' | 'signature' | 'verify';
|
|
70
74
|
|
|
71
75
|
declare const LOGO_URL = "https://bwalletx.com/logo.svg";
|
|
72
76
|
interface ButtonOptions {
|
|
@@ -89,8 +93,23 @@ declare function inOrder<T>(handle: (frame: T) => Promise<void> | void, onError?
|
|
|
89
93
|
|
|
90
94
|
/** An SVG QR code for `text` (error correction M). */
|
|
91
95
|
declare function qrSvg(text: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* True on a phone or tablet: a coarse pointer with no hover, or a mobile user agent (iPadOS reports
|
|
98
|
+
* a Mac UA, so touch points count too). Scanning a QR shown on the same screen is impossible there.
|
|
99
|
+
*/
|
|
100
|
+
declare function isTouchDevice(env?: {
|
|
101
|
+
navigator?: Navigator;
|
|
102
|
+
matchMedia?: (q: string) => MediaQueryList;
|
|
103
|
+
}): boolean;
|
|
92
104
|
interface PairingModalOptions {
|
|
93
105
|
title?: string;
|
|
106
|
+
/**
|
|
107
|
+
* 'qr' shows the pairing QR (desktop). 'app' hands off to the bWalletX app on this device: the
|
|
108
|
+
* pairing link is a universal link / Android app link that opens the app, and the bwallet.space
|
|
109
|
+
* page behind it explains what to do when the app is not installed. Default 'auto': 'app' on touch
|
|
110
|
+
* devices, 'qr' elsewhere.
|
|
111
|
+
*/
|
|
112
|
+
mode?: 'auto' | 'qr' | 'app';
|
|
94
113
|
/** Called when the user closes the modal (the pairing is then aborted). */
|
|
95
114
|
onCancel?: () => void;
|
|
96
115
|
}
|
|
@@ -107,4 +126,55 @@ declare function pickWallet(options: WalletOption[], o?: {
|
|
|
107
126
|
title?: string;
|
|
108
127
|
}): Promise<WalletOption | null>;
|
|
109
128
|
|
|
110
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Browser side of the access protocol: ask the wallet to sign the site's challenge and prove the
|
|
131
|
+
* keys holding the required token, using standard BRC-100 calls only (so any BRC-100 wallet works).
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
/** The challenge route's answer (createAccessChallenge). */
|
|
135
|
+
interface AccessChallengeLike {
|
|
136
|
+
challenge: string;
|
|
137
|
+
}
|
|
138
|
+
interface RequestAccessOptions {
|
|
139
|
+
/** Ask your server for a challenge. Gets the wallet's identity key. */
|
|
140
|
+
challenge: (identityKey: string) => Promise<AccessChallengeLike>;
|
|
141
|
+
/** Post the signed response to your server. Throw AccessError (or return an error body) to refuse. */
|
|
142
|
+
verify?: (response: AccessResponse) => Promise<unknown>;
|
|
143
|
+
wallet?: WalletInterface;
|
|
144
|
+
pairing?: SignInOptions['pairing'];
|
|
145
|
+
discoverMs?: number;
|
|
146
|
+
/** Basket holding BSV-21 outputs. Default 'bsv21' (bWalletX, 1Sat wallets). */
|
|
147
|
+
tokenBasket?: string;
|
|
148
|
+
}
|
|
149
|
+
interface RequestAccessResult {
|
|
150
|
+
response: AccessResponse;
|
|
151
|
+
/** Whatever `verify` returned. */
|
|
152
|
+
verified?: unknown;
|
|
153
|
+
wallet: WalletInterface;
|
|
154
|
+
}
|
|
155
|
+
/** Map a wallet / fetch failure to a protocol error. */
|
|
156
|
+
declare function toAccessError(e: unknown): AccessError;
|
|
157
|
+
/** Read an AccessErrorBody from a server answer and throw it as AccessError. */
|
|
158
|
+
declare function throwIfAccessError(body: unknown): void;
|
|
159
|
+
/**
|
|
160
|
+
* Sign the challenge with every key that locks an output of `tokenId` in the wallet's token basket.
|
|
161
|
+
* Outputs whose derivation can't be reproduced are skipped (the server counts only what is proven).
|
|
162
|
+
*/
|
|
163
|
+
declare function proveHoldings(wallet: WalletInterface, challenge: string, tokenId: string, basket?: string): Promise<HoldingProof[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Run the whole flow: find the wallet, get a challenge, sign it, prove holdings, post to verify.
|
|
166
|
+
* Throws AccessError with a protocol code on every failure.
|
|
167
|
+
*/
|
|
168
|
+
declare function requestAccess(o: RequestAccessOptions): Promise<RequestAccessResult>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Site theme for the wallet. A site may ask bWalletX to wear one of the themes the wallet already bundles
|
|
172
|
+
* (e.g. 'npgx') while the site is connected and is the active tab; the wallet puts the user's own theme back on
|
|
173
|
+
* any other site or when this declaration is removed. Only an id is declared: the wallet decides whether this
|
|
174
|
+
* origin may wear it (brand editions are locked to their own sites) and never loads colours, CSS or URLs from here.
|
|
175
|
+
*/
|
|
176
|
+
declare const WALLET_THEME_META = "bwalletx-theme";
|
|
177
|
+
/** Declare (or with null, withdraw) the theme the wallet should wear for this page. No-op outside a browser. */
|
|
178
|
+
declare function declareWalletTheme(theme: string | null | undefined): void;
|
|
179
|
+
|
|
180
|
+
export { type AccessChallengeLike, AccessError, AccessResponse, BWALLETX_RDNS, type ButtonOptions, type Challenge, type FoundBy, type FoundWallet, HoldingProof, LOGIN_PROTOCOL, LOGO_URL, type PairingModalOptions, PairingOptions, RDNS_EXTENSION, RDNS_MOBILE, type RequestAccessOptions, type RequestAccessResult, type SignInMethod, type SignInOptions, type SignInResult, type SignInStage, WALLET_THEME_META, WalletOption, connectBwalletX, declareWalletTheme, discoverBwalletX, findBwalletX, inOrder, isTouchDevice, pairingModal, pickWallet, proveHoldings, qrSvg, renderButton, requestAccess, signInWithBwalletX, throwIfAccessError, toAccessError };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { WalletInterface, WalletProtocol } from '@bsv/sdk';
|
|
|
2
2
|
import { f as PairingOptions, W as WalletOption } from './wallets-VOKIKBbO.js';
|
|
3
3
|
export { g as BRC29_PROTOCOL, i as Brc29Remittance, B as BuyTokenRequest, C as ConnectedWallet, D as DiscoverWalletsOptions, H as HandCashAdapterOptions, L as LegacyPayer, j as PairConnectionOptions, k as PairStorage, l as PairedWallet, b as PayOptions, m as PayOutput, P as PayRequest, a as PayResult, n as PaySource, c as PaymentError, o as PaymentErrorCode, S as SocketFactory, q as SocketLike, T as TokenQuote, r as WalletKind, s as amountInSats, d as brc100Option, t as buyToken, u as clearPairing, e as discoverWallets, h as handcashAdapter, v as isIdentityKeyHex, w as isPaymail, x as pairBwalletX, p as pairingOption, y as pay, z as resolvePaymailP2P, A as restorePairing, E as tip } from './wallets-VOKIKBbO.js';
|
|
4
4
|
export { AuthorizeParams, GET_URL, SIGNIN_CSS, SIGNIN_TAG, SigninBrand, SigninLabel, SigninSize, SigninTheme, WEB_WALLET_URL, buildAuthorizeUrl, defineBwalletxSignin, markSvg, signinText } from './element.js';
|
|
5
|
+
import { b as AccessResponse, H as HoldingProof, A as AccessError } from './access-Dp0eKIOc.js';
|
|
6
|
+
export { f as ACCESS_ERROR_STATUS, d as ACCESS_PROTOCOL, g as ACCESS_VERSION, h as AccessChallenge, i as AccessErrorBody, j as AccessErrorCode, c as AccessKind, a as AccessRequirement, P as PROTOCOL_MEDIA, T as TokenRequirement, k as accessErrorMessage, m as canonicalJson, r as protocolMediaUrl } from './access-Dp0eKIOc.js';
|
|
5
7
|
|
|
6
8
|
/** Ids bWalletX announces in BRC-100 wallet discovery. */
|
|
7
9
|
declare const RDNS_EXTENSION = "com.bwalletx.extension";
|
|
@@ -67,6 +69,8 @@ declare function connectBwalletX(opts?: Pick<SignInOptions, 'wallet' | 'pairing'
|
|
|
67
69
|
* identityKey, nonce and signature to your verify route.
|
|
68
70
|
*/
|
|
69
71
|
declare function signInWithBwalletX(opts: SignInOptions): Promise<SignInResult>;
|
|
72
|
+
/** Where a sign-in failed: the wallet's identity prompt, the site's challenge endpoint, or the wallet's signature. */
|
|
73
|
+
type SignInStage = 'identity' | 'challenge' | 'signature' | 'verify';
|
|
70
74
|
|
|
71
75
|
declare const LOGO_URL = "https://bwalletx.com/logo.svg";
|
|
72
76
|
interface ButtonOptions {
|
|
@@ -89,8 +93,23 @@ declare function inOrder<T>(handle: (frame: T) => Promise<void> | void, onError?
|
|
|
89
93
|
|
|
90
94
|
/** An SVG QR code for `text` (error correction M). */
|
|
91
95
|
declare function qrSvg(text: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* True on a phone or tablet: a coarse pointer with no hover, or a mobile user agent (iPadOS reports
|
|
98
|
+
* a Mac UA, so touch points count too). Scanning a QR shown on the same screen is impossible there.
|
|
99
|
+
*/
|
|
100
|
+
declare function isTouchDevice(env?: {
|
|
101
|
+
navigator?: Navigator;
|
|
102
|
+
matchMedia?: (q: string) => MediaQueryList;
|
|
103
|
+
}): boolean;
|
|
92
104
|
interface PairingModalOptions {
|
|
93
105
|
title?: string;
|
|
106
|
+
/**
|
|
107
|
+
* 'qr' shows the pairing QR (desktop). 'app' hands off to the bWalletX app on this device: the
|
|
108
|
+
* pairing link is a universal link / Android app link that opens the app, and the bwallet.space
|
|
109
|
+
* page behind it explains what to do when the app is not installed. Default 'auto': 'app' on touch
|
|
110
|
+
* devices, 'qr' elsewhere.
|
|
111
|
+
*/
|
|
112
|
+
mode?: 'auto' | 'qr' | 'app';
|
|
94
113
|
/** Called when the user closes the modal (the pairing is then aborted). */
|
|
95
114
|
onCancel?: () => void;
|
|
96
115
|
}
|
|
@@ -107,4 +126,55 @@ declare function pickWallet(options: WalletOption[], o?: {
|
|
|
107
126
|
title?: string;
|
|
108
127
|
}): Promise<WalletOption | null>;
|
|
109
128
|
|
|
110
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Browser side of the access protocol: ask the wallet to sign the site's challenge and prove the
|
|
131
|
+
* keys holding the required token, using standard BRC-100 calls only (so any BRC-100 wallet works).
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
/** The challenge route's answer (createAccessChallenge). */
|
|
135
|
+
interface AccessChallengeLike {
|
|
136
|
+
challenge: string;
|
|
137
|
+
}
|
|
138
|
+
interface RequestAccessOptions {
|
|
139
|
+
/** Ask your server for a challenge. Gets the wallet's identity key. */
|
|
140
|
+
challenge: (identityKey: string) => Promise<AccessChallengeLike>;
|
|
141
|
+
/** Post the signed response to your server. Throw AccessError (or return an error body) to refuse. */
|
|
142
|
+
verify?: (response: AccessResponse) => Promise<unknown>;
|
|
143
|
+
wallet?: WalletInterface;
|
|
144
|
+
pairing?: SignInOptions['pairing'];
|
|
145
|
+
discoverMs?: number;
|
|
146
|
+
/** Basket holding BSV-21 outputs. Default 'bsv21' (bWalletX, 1Sat wallets). */
|
|
147
|
+
tokenBasket?: string;
|
|
148
|
+
}
|
|
149
|
+
interface RequestAccessResult {
|
|
150
|
+
response: AccessResponse;
|
|
151
|
+
/** Whatever `verify` returned. */
|
|
152
|
+
verified?: unknown;
|
|
153
|
+
wallet: WalletInterface;
|
|
154
|
+
}
|
|
155
|
+
/** Map a wallet / fetch failure to a protocol error. */
|
|
156
|
+
declare function toAccessError(e: unknown): AccessError;
|
|
157
|
+
/** Read an AccessErrorBody from a server answer and throw it as AccessError. */
|
|
158
|
+
declare function throwIfAccessError(body: unknown): void;
|
|
159
|
+
/**
|
|
160
|
+
* Sign the challenge with every key that locks an output of `tokenId` in the wallet's token basket.
|
|
161
|
+
* Outputs whose derivation can't be reproduced are skipped (the server counts only what is proven).
|
|
162
|
+
*/
|
|
163
|
+
declare function proveHoldings(wallet: WalletInterface, challenge: string, tokenId: string, basket?: string): Promise<HoldingProof[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Run the whole flow: find the wallet, get a challenge, sign it, prove holdings, post to verify.
|
|
166
|
+
* Throws AccessError with a protocol code on every failure.
|
|
167
|
+
*/
|
|
168
|
+
declare function requestAccess(o: RequestAccessOptions): Promise<RequestAccessResult>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Site theme for the wallet. A site may ask bWalletX to wear one of the themes the wallet already bundles
|
|
172
|
+
* (e.g. 'npgx') while the site is connected and is the active tab; the wallet puts the user's own theme back on
|
|
173
|
+
* any other site or when this declaration is removed. Only an id is declared: the wallet decides whether this
|
|
174
|
+
* origin may wear it (brand editions are locked to their own sites) and never loads colours, CSS or URLs from here.
|
|
175
|
+
*/
|
|
176
|
+
declare const WALLET_THEME_META = "bwalletx-theme";
|
|
177
|
+
/** Declare (or with null, withdraw) the theme the wallet should wear for this page. No-op outside a browser. */
|
|
178
|
+
declare function declareWalletTheme(theme: string | null | undefined): void;
|
|
179
|
+
|
|
180
|
+
export { type AccessChallengeLike, AccessError, AccessResponse, BWALLETX_RDNS, type ButtonOptions, type Challenge, type FoundBy, type FoundWallet, HoldingProof, LOGIN_PROTOCOL, LOGO_URL, type PairingModalOptions, PairingOptions, RDNS_EXTENSION, RDNS_MOBILE, type RequestAccessOptions, type RequestAccessResult, type SignInMethod, type SignInOptions, type SignInResult, type SignInStage, WALLET_THEME_META, WalletOption, connectBwalletX, declareWalletTheme, discoverBwalletX, findBwalletX, inOrder, isTouchDevice, pairingModal, pickWallet, proveHoldings, qrSvg, renderButton, requestAccess, signInWithBwalletX, throwIfAccessError, toAccessError };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BRC29_PROTOCOL,
|
|
3
3
|
PaymentError,
|
|
4
|
+
WALLET_THEME_META,
|
|
4
5
|
amountInSats,
|
|
5
6
|
brc100Option,
|
|
6
7
|
buyToken,
|
|
8
|
+
declareWalletTheme,
|
|
7
9
|
discoverWallets,
|
|
8
10
|
handcashAdapter,
|
|
9
11
|
isIdentityKeyHex,
|
|
10
12
|
isPaymail,
|
|
13
|
+
isTouchDevice,
|
|
11
14
|
pairingModal,
|
|
12
15
|
pairingOption,
|
|
13
16
|
pay,
|
|
@@ -15,7 +18,7 @@ import {
|
|
|
15
18
|
qrSvg,
|
|
16
19
|
resolvePaymailP2P,
|
|
17
20
|
tip
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PI42H3XY.js";
|
|
19
22
|
import {
|
|
20
23
|
BWALLETX_RDNS,
|
|
21
24
|
GET_URL,
|
|
@@ -34,10 +37,24 @@ import {
|
|
|
34
37
|
inOrder,
|
|
35
38
|
markSvg,
|
|
36
39
|
pairBwalletX,
|
|
40
|
+
proveHoldings,
|
|
41
|
+
requestAccess,
|
|
37
42
|
restorePairing,
|
|
38
43
|
signInWithBwalletX,
|
|
39
|
-
signinText
|
|
40
|
-
|
|
44
|
+
signinText,
|
|
45
|
+
throwIfAccessError,
|
|
46
|
+
toAccessError
|
|
47
|
+
} from "./chunk-IUDD7YTQ.js";
|
|
48
|
+
import {
|
|
49
|
+
ACCESS_ERROR_STATUS,
|
|
50
|
+
ACCESS_PROTOCOL,
|
|
51
|
+
ACCESS_VERSION,
|
|
52
|
+
AccessError,
|
|
53
|
+
PROTOCOL_MEDIA,
|
|
54
|
+
accessErrorMessage,
|
|
55
|
+
canonicalJson,
|
|
56
|
+
protocolMediaUrl
|
|
57
|
+
} from "./chunk-MWD4BCO5.js";
|
|
41
58
|
|
|
42
59
|
// src/button.ts
|
|
43
60
|
var CSS = `
|
|
@@ -83,23 +100,32 @@ function renderButton(el, opts = {}) {
|
|
|
83
100
|
return b;
|
|
84
101
|
}
|
|
85
102
|
export {
|
|
103
|
+
ACCESS_ERROR_STATUS,
|
|
104
|
+
ACCESS_PROTOCOL,
|
|
105
|
+
ACCESS_VERSION,
|
|
106
|
+
AccessError,
|
|
86
107
|
BRC29_PROTOCOL,
|
|
87
108
|
BWALLETX_RDNS,
|
|
88
109
|
GET_URL,
|
|
89
110
|
LOGIN_PROTOCOL,
|
|
90
111
|
LOGO_URL,
|
|
112
|
+
PROTOCOL_MEDIA,
|
|
91
113
|
PaymentError,
|
|
92
114
|
RDNS_EXTENSION,
|
|
93
115
|
RDNS_MOBILE,
|
|
94
116
|
SIGNIN_CSS,
|
|
95
117
|
SIGNIN_TAG,
|
|
118
|
+
WALLET_THEME_META,
|
|
96
119
|
WEB_WALLET_URL,
|
|
120
|
+
accessErrorMessage,
|
|
97
121
|
amountInSats,
|
|
98
122
|
brc100Option,
|
|
99
123
|
buildAuthorizeUrl,
|
|
100
124
|
buyToken,
|
|
125
|
+
canonicalJson,
|
|
101
126
|
clearPairing,
|
|
102
127
|
connectBwalletX,
|
|
128
|
+
declareWalletTheme,
|
|
103
129
|
defineBwalletxSignin,
|
|
104
130
|
discoverBwalletX,
|
|
105
131
|
discoverWallets,
|
|
@@ -108,18 +134,24 @@ export {
|
|
|
108
134
|
inOrder,
|
|
109
135
|
isIdentityKeyHex,
|
|
110
136
|
isPaymail,
|
|
137
|
+
isTouchDevice,
|
|
111
138
|
markSvg,
|
|
112
139
|
pairBwalletX,
|
|
113
140
|
pairingModal,
|
|
114
141
|
pairingOption,
|
|
115
142
|
pay,
|
|
116
143
|
pickWallet,
|
|
144
|
+
protocolMediaUrl,
|
|
145
|
+
proveHoldings,
|
|
117
146
|
qrSvg,
|
|
118
147
|
renderButton,
|
|
148
|
+
requestAccess,
|
|
119
149
|
resolvePaymailP2P,
|
|
120
150
|
restorePairing,
|
|
121
151
|
signInWithBwalletX,
|
|
122
152
|
signinText,
|
|
123
|
-
|
|
153
|
+
throwIfAccessError,
|
|
154
|
+
tip,
|
|
155
|
+
toAccessError
|
|
124
156
|
};
|
|
125
157
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/button.ts"],"sourcesContent":["const CSS = `\n.bwx-signin{display:inline-flex;align-items:center;gap:12px;min-height:48px;padding:10px 22px 10px 10px;border:0;border-radius:12px;cursor:pointer;background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;text-align:left;font:700 16px/1.2 system-ui,-apple-system,\"Segoe UI\",sans-serif;box-shadow:0 8px 24px rgba(245,158,11,.2)}\n.bwx-signin:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}\n.bwx-signin:focus-visible{outline:2px solid #ffd24d;outline-offset:3px}\n.bwx-signin:disabled{opacity:.6;cursor:wait}\n.bwx-signin .bwx-mark{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:#000;flex:none}\n.bwx-signin small{display:block;font-size:11px;font-weight:500;color:rgba(0,0,0,.6)}`;\n\nexport const LOGO_URL = 'https://bwalletx.com/logo.svg';\n\nexport interface ButtonOptions {\n /** Second line under the label. Default \"also works with bWallet\". false hides it. */\n subtitle?: string | false;\n onClick?: (button: HTMLButtonElement) => void;\n}\n\n/** Put the gold \"Sign in with bWalletX\" button into `el` (replacing its contents). */\nexport function renderButton(el: HTMLElement | string, opts: ButtonOptions = {}): HTMLButtonElement {\n const host = typeof el === 'string' ? document.querySelector<HTMLElement>(el) : el;\n if (!host) throw new Error(`renderButton: no element ${String(el)}`);\n if (!document.getElementById('bwx-signin-css')) {\n const style = document.createElement('style');\n style.id = 'bwx-signin-css';\n style.textContent = CSS;\n document.head.appendChild(style);\n }\n const b = document.createElement('button');\n b.type = 'button';\n b.className = 'bwx-signin';\n const mark = document.createElement('span');\n mark.className = 'bwx-mark';\n const img = document.createElement('img');\n img.src = LOGO_URL;\n img.alt = '';\n img.width = 15;\n img.height = 20;\n mark.appendChild(img);\n const label = document.createElement('span');\n label.className = 'bwx-label';\n label.textContent = 'Sign in with bWalletX';\n const sub = opts.subtitle === undefined ? 'also works with bWallet' : opts.subtitle;\n if (sub) {\n const small = document.createElement('small');\n small.textContent = sub;\n label.appendChild(small);\n }\n b.append(mark, label);\n if (opts.onClick) b.addEventListener('click', () => opts.onClick!(b));\n host.replaceChildren(b);\n return b;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/button.ts"],"sourcesContent":["const CSS = `\n.bwx-signin{display:inline-flex;align-items:center;gap:12px;min-height:48px;padding:10px 22px 10px 10px;border:0;border-radius:12px;cursor:pointer;background:linear-gradient(180deg,#fcd34d,#f59e0b);color:#000;text-align:left;font:700 16px/1.2 system-ui,-apple-system,\"Segoe UI\",sans-serif;box-shadow:0 8px 24px rgba(245,158,11,.2)}\n.bwx-signin:hover{background:linear-gradient(180deg,#fde68a,#fbbf24)}\n.bwx-signin:focus-visible{outline:2px solid #ffd24d;outline-offset:3px}\n.bwx-signin:disabled{opacity:.6;cursor:wait}\n.bwx-signin .bwx-mark{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;background:#000;flex:none}\n.bwx-signin small{display:block;font-size:11px;font-weight:500;color:rgba(0,0,0,.6)}`;\n\nexport const LOGO_URL = 'https://bwalletx.com/logo.svg';\n\nexport interface ButtonOptions {\n /** Second line under the label. Default \"also works with bWallet\". false hides it. */\n subtitle?: string | false;\n onClick?: (button: HTMLButtonElement) => void;\n}\n\n/** Put the gold \"Sign in with bWalletX\" button into `el` (replacing its contents). */\nexport function renderButton(el: HTMLElement | string, opts: ButtonOptions = {}): HTMLButtonElement {\n const host = typeof el === 'string' ? document.querySelector<HTMLElement>(el) : el;\n if (!host) throw new Error(`renderButton: no element ${String(el)}`);\n if (!document.getElementById('bwx-signin-css')) {\n const style = document.createElement('style');\n style.id = 'bwx-signin-css';\n style.textContent = CSS;\n document.head.appendChild(style);\n }\n const b = document.createElement('button');\n b.type = 'button';\n b.className = 'bwx-signin';\n const mark = document.createElement('span');\n mark.className = 'bwx-mark';\n const img = document.createElement('img');\n img.src = LOGO_URL;\n img.alt = '';\n img.width = 15;\n img.height = 20;\n mark.appendChild(img);\n const label = document.createElement('span');\n label.className = 'bwx-label';\n label.textContent = 'Sign in with bWalletX';\n const sub = opts.subtitle === undefined ? 'also works with bWallet' : opts.subtitle;\n if (sub) {\n const small = document.createElement('small');\n small.textContent = sub;\n label.appendChild(small);\n }\n b.append(mark, label);\n if (opts.onClick) b.addEventListener('click', () => opts.onClick!(b));\n host.replaceChildren(b);\n return b;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQL,IAAM,WAAW;AASjB,SAAS,aAAa,IAA0B,OAAsB,CAAC,GAAsB;AAClG,QAAM,OAAO,OAAO,OAAO,WAAW,SAAS,cAA2B,EAAE,IAAI;AAChF,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,4BAA4B,OAAO,EAAE,CAAC,EAAE;AACnE,MAAI,CAAC,SAAS,eAAe,gBAAgB,GAAG;AAC9C,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,KAAK;AACX,UAAM,cAAc;AACpB,aAAS,KAAK,YAAY,KAAK;AAAA,EACjC;AACA,QAAM,IAAI,SAAS,cAAc,QAAQ;AACzC,IAAE,OAAO;AACT,IAAE,YAAY;AACd,QAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,OAAK,YAAY;AACjB,QAAM,MAAM,SAAS,cAAc,KAAK;AACxC,MAAI,MAAM;AACV,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,OAAK,YAAY,GAAG;AACpB,QAAM,QAAQ,SAAS,cAAc,MAAM;AAC3C,QAAM,YAAY;AAClB,QAAM,cAAc;AACpB,QAAM,MAAM,KAAK,aAAa,SAAY,4BAA4B,KAAK;AAC3E,MAAI,KAAK;AACP,UAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,UAAM,cAAc;AACpB,UAAM,YAAY,KAAK;AAAA,EACzB;AACA,IAAE,OAAO,MAAM,KAAK;AACpB,MAAI,KAAK,QAAS,GAAE,iBAAiB,SAAS,MAAM,KAAK,QAAS,CAAC,CAAC;AACpE,OAAK,gBAAgB,CAAC;AACtB,SAAO;AACT;","names":[]}
|