@lukso/up-connector 0.4.0-dev.a8c9315
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/LICENSE +201 -0
- package/README.md +280 -0
- package/dist/account-modal.cjs +9 -0
- package/dist/account-modal.cjs.map +1 -0
- package/dist/account-modal.d.cts +16 -0
- package/dist/account-modal.d.ts +16 -0
- package/dist/account-modal.js +9 -0
- package/dist/account-modal.js.map +1 -0
- package/dist/auto-setup.cjs +17 -0
- package/dist/auto-setup.cjs.map +1 -0
- package/dist/auto-setup.d.cts +123 -0
- package/dist/auto-setup.d.ts +123 -0
- package/dist/auto-setup.js +17 -0
- package/dist/auto-setup.js.map +1 -0
- package/dist/avatar-CmUCtW_w.d.cts +205 -0
- package/dist/avatar-CmUCtW_w.d.ts +205 -0
- package/dist/avatar.cjs +12 -0
- package/dist/avatar.cjs.map +1 -0
- package/dist/avatar.d.cts +1 -0
- package/dist/avatar.d.ts +1 -0
- package/dist/avatar.js +12 -0
- package/dist/avatar.js.map +1 -0
- package/dist/backup-modal.cjs +9 -0
- package/dist/backup-modal.cjs.map +1 -0
- package/dist/backup-modal.d.cts +41 -0
- package/dist/backup-modal.d.ts +41 -0
- package/dist/backup-modal.js +9 -0
- package/dist/backup-modal.js.map +1 -0
- package/dist/chunk-3SGSPHOZ.js +595 -0
- package/dist/chunk-3SGSPHOZ.js.map +1 -0
- package/dist/chunk-6AYZOIFY.js +181 -0
- package/dist/chunk-6AYZOIFY.js.map +1 -0
- package/dist/chunk-6N35TCFT.js +852 -0
- package/dist/chunk-6N35TCFT.js.map +1 -0
- package/dist/chunk-7ETKG6KR.cjs +387 -0
- package/dist/chunk-7ETKG6KR.cjs.map +1 -0
- package/dist/chunk-EUXUH3YW.js +15 -0
- package/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/chunk-GFVUWAG4.cjs +158 -0
- package/dist/chunk-GFVUWAG4.cjs.map +1 -0
- package/dist/chunk-IAKQFHFD.cjs +595 -0
- package/dist/chunk-IAKQFHFD.cjs.map +1 -0
- package/dist/chunk-MH7MP7XK.cjs +181 -0
- package/dist/chunk-MH7MP7XK.cjs.map +1 -0
- package/dist/chunk-NWCNJSG3.js +387 -0
- package/dist/chunk-NWCNJSG3.js.map +1 -0
- package/dist/chunk-NXU2DQAV.js +1128 -0
- package/dist/chunk-NXU2DQAV.js.map +1 -0
- package/dist/chunk-ORJK2YGG.cjs +852 -0
- package/dist/chunk-ORJK2YGG.cjs.map +1 -0
- package/dist/chunk-RFA6SEIS.cjs +1128 -0
- package/dist/chunk-RFA6SEIS.cjs.map +1 -0
- package/dist/chunk-XGIT7YUY.js +31 -0
- package/dist/chunk-XGIT7YUY.js.map +1 -0
- package/dist/chunk-XOKG3KIL.cjs +31 -0
- package/dist/chunk-XOKG3KIL.cjs.map +1 -0
- package/dist/chunk-YIWSPI4I.js +158 -0
- package/dist/chunk-YIWSPI4I.js.map +1 -0
- package/dist/chunk-ZBDE64SD.cjs +15 -0
- package/dist/chunk-ZBDE64SD.cjs.map +1 -0
- package/dist/connect-modal/index.cjs +20 -0
- package/dist/connect-modal/index.cjs.map +1 -0
- package/dist/connect-modal/index.d.cts +9 -0
- package/dist/connect-modal/index.d.ts +9 -0
- package/dist/connect-modal/index.js +20 -0
- package/dist/connect-modal/index.js.map +1 -0
- package/dist/index-D2orHGFi.d.cts +8 -0
- package/dist/index-D2orHGFi.d.ts +8 -0
- package/dist/index.cjs +793 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +189 -0
- package/dist/index.d.ts +189 -0
- package/dist/index.js +793 -0
- package/dist/index.js.map +1 -0
- package/dist/restore-modal.cjs +9 -0
- package/dist/restore-modal.cjs.map +1 -0
- package/dist/restore-modal.d.cts +68 -0
- package/dist/restore-modal.d.ts +68 -0
- package/dist/restore-modal.js +9 -0
- package/dist/restore-modal.js.map +1 -0
- package/dist/wagmi-CVuDs_0h.d.cts +386 -0
- package/dist/wagmi-CVuDs_0h.d.ts +386 -0
- package/package.json +158 -0
- package/src/account-modal.ts +142 -0
- package/src/auto-setup.ts +362 -0
- package/src/avatar.ts +1135 -0
- package/src/backup-modal.ts +439 -0
- package/src/connect-modal/components/connection-view.ts +398 -0
- package/src/connect-modal/components/eoa-connection-view.ts +408 -0
- package/src/connect-modal/components/qr-code-view.ts +71 -0
- package/src/connect-modal/connect-modal.base.ts +18 -0
- package/src/connect-modal/connect-modal.config.ts +27 -0
- package/src/connect-modal/connect-modal.templates.ts +21 -0
- package/src/connect-modal/connect-modal.ts +270 -0
- package/src/connect-modal/connect-modal.types.ts +104 -0
- package/src/connect-modal/images/up-cube-glass.png +0 -0
- package/src/connect-modal/index.ts +23 -0
- package/src/connect-modal/services/wagmi.ts +266 -0
- package/src/connect-modal/styles/styles.css +1 -0
- package/src/connect-modal/utils/walletConnectDeepLinkUrl.ts +43 -0
- package/src/connector.ts +544 -0
- package/src/index.ts +62 -0
- package/src/popup-instance.ts +537 -0
- package/src/restore-modal.ts +702 -0
- package/src/styles/index.ts +28 -0
- package/src/styles/styles.css +1 -0
- package/src/types/css-raw.d.ts +4 -0
- package/src/types/images.d.ts +4 -0
- package/src/types.ts +168 -0
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
|
|
3
|
+
interface WalletConnector {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
rdns?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
type: 'embedded' | 'extension' | 'mobile' | 'injected' | 'walletconnect';
|
|
9
|
+
connect: () => Promise<void>;
|
|
10
|
+
getProvider?: () => Promise<any>;
|
|
11
|
+
}
|
|
12
|
+
interface ConnectModalSetup {
|
|
13
|
+
/**
|
|
14
|
+
* Wagmi config instance
|
|
15
|
+
*/
|
|
16
|
+
wagmiConfig: any;
|
|
17
|
+
/**
|
|
18
|
+
* Optional chain ID to use for connections (defaults to first chain in config)
|
|
19
|
+
*/
|
|
20
|
+
chainId?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Optional embedded wallet ID (to identify it in wagmi connectors)
|
|
23
|
+
* If provided, this connector will be shown first as "Create Passkey Wallet"
|
|
24
|
+
* Example: 'dev.lukso.auth'
|
|
25
|
+
*/
|
|
26
|
+
embeddedWalletId?: string;
|
|
27
|
+
}
|
|
28
|
+
interface WagmiConnector {
|
|
29
|
+
uid: string;
|
|
30
|
+
name: string;
|
|
31
|
+
id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
36
|
+
type ConnectModalTheme = 'light' | 'dark' | 'auto';
|
|
37
|
+
type ConnectionModalView = 'up_connection' | 'qr_code' | 'eoa_connection';
|
|
38
|
+
type Wallet = {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
slug: string;
|
|
42
|
+
description: string;
|
|
43
|
+
homepage: string;
|
|
44
|
+
chains: string[];
|
|
45
|
+
versions: string[];
|
|
46
|
+
sdks: string[];
|
|
47
|
+
app_type: string;
|
|
48
|
+
category: string;
|
|
49
|
+
image_id: string;
|
|
50
|
+
image_url: WalletImageUrl;
|
|
51
|
+
app: WalletApp;
|
|
52
|
+
rdns: string;
|
|
53
|
+
mobile: WalletMobile;
|
|
54
|
+
desktop: WalletDesktop;
|
|
55
|
+
isInstalled: boolean;
|
|
56
|
+
connector: WalletConnector | undefined;
|
|
57
|
+
};
|
|
58
|
+
type WalletImageUrl = {
|
|
59
|
+
sm: string;
|
|
60
|
+
md: string;
|
|
61
|
+
lg: string;
|
|
62
|
+
};
|
|
63
|
+
type WalletAppType = 'browser' | 'ios' | 'android' | 'mac' | 'windows' | 'linux' | 'chrome' | 'firefox' | 'safari' | 'edge' | 'opera';
|
|
64
|
+
type WalletApp = {
|
|
65
|
+
[key in WalletAppType]?: string;
|
|
66
|
+
};
|
|
67
|
+
interface WalletMobile {
|
|
68
|
+
native?: string;
|
|
69
|
+
universal?: string;
|
|
70
|
+
}
|
|
71
|
+
interface WalletDesktop {
|
|
72
|
+
native?: string;
|
|
73
|
+
universal?: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* EOA Connection View - Lit Component
|
|
78
|
+
*
|
|
79
|
+
* Displays available EOA (Externally Owned Account) wallets for connection.
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
declare const EoaConnectionView_base: any;
|
|
83
|
+
declare class EoaConnectionView extends EoaConnectionView_base {
|
|
84
|
+
connectors: WalletConnector[];
|
|
85
|
+
private isConnecting;
|
|
86
|
+
private connectingRdns;
|
|
87
|
+
/**
|
|
88
|
+
* Get WalletConnect connector
|
|
89
|
+
*/
|
|
90
|
+
private get walletConnectConnector();
|
|
91
|
+
/**
|
|
92
|
+
* Get EOA connectors
|
|
93
|
+
*/
|
|
94
|
+
private get eoaConnectors();
|
|
95
|
+
/**
|
|
96
|
+
* Get supported wallet IDs based on device type
|
|
97
|
+
*
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
private supportedWalletIds;
|
|
101
|
+
/**
|
|
102
|
+
* Task to fetch EOA wallets - handles loading/error states automatically
|
|
103
|
+
*/
|
|
104
|
+
private walletsTask;
|
|
105
|
+
/**
|
|
106
|
+
* Get device type
|
|
107
|
+
*/
|
|
108
|
+
private deviceType;
|
|
109
|
+
/**
|
|
110
|
+
* Close modal
|
|
111
|
+
*/
|
|
112
|
+
private handleClose;
|
|
113
|
+
/**
|
|
114
|
+
* Back to initial screen
|
|
115
|
+
*/
|
|
116
|
+
private handleBack;
|
|
117
|
+
/**
|
|
118
|
+
* Handle wallet connect click
|
|
119
|
+
*
|
|
120
|
+
* @param wallet
|
|
121
|
+
*/
|
|
122
|
+
private handleConnect;
|
|
123
|
+
/**
|
|
124
|
+
* Connect to wallet on desktop using selected connector
|
|
125
|
+
*
|
|
126
|
+
* @param wallet
|
|
127
|
+
*/
|
|
128
|
+
private connectDesktop;
|
|
129
|
+
/**
|
|
130
|
+
* Connect to wallet on mobile using WalletConnect
|
|
131
|
+
*/
|
|
132
|
+
private connectMobile;
|
|
133
|
+
/**
|
|
134
|
+
* Render the list of EOA wallets
|
|
135
|
+
*/
|
|
136
|
+
private renderWalletsList;
|
|
137
|
+
/**
|
|
138
|
+
* Main render method
|
|
139
|
+
*/
|
|
140
|
+
render(): TemplateResult<1>;
|
|
141
|
+
}
|
|
142
|
+
declare global {
|
|
143
|
+
interface HTMLElementTagNameMap {
|
|
144
|
+
'eoa-connection-view': EoaConnectionView;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Connection View - Lit Component
|
|
150
|
+
*
|
|
151
|
+
* Main connection view displaying primary Lukso connectors and option to show EOA connectors.
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
declare const ConnectionView_base: any;
|
|
155
|
+
declare class ConnectionView extends ConnectionView_base {
|
|
156
|
+
isConnecting: boolean;
|
|
157
|
+
connectingRdns: string | undefined;
|
|
158
|
+
connectors: WalletConnector[];
|
|
159
|
+
/**
|
|
160
|
+
* Get WalletConnect connector
|
|
161
|
+
*/
|
|
162
|
+
private get walletConnectConnector();
|
|
163
|
+
/**
|
|
164
|
+
* Universal Profile browser extension connector
|
|
165
|
+
*/
|
|
166
|
+
private get upExtensionConnector();
|
|
167
|
+
/**
|
|
168
|
+
* Passkey / Embedded wallet connector
|
|
169
|
+
*/
|
|
170
|
+
private get embeddedWalletConnector();
|
|
171
|
+
/**
|
|
172
|
+
* Get browser extension store info
|
|
173
|
+
*/
|
|
174
|
+
private get extensionStore();
|
|
175
|
+
/**
|
|
176
|
+
* Check if browser supports extension installation
|
|
177
|
+
*/
|
|
178
|
+
private get browserSupportExtension();
|
|
179
|
+
/**
|
|
180
|
+
* Handle connect via embedded wallet
|
|
181
|
+
*/
|
|
182
|
+
private handleConnectEmbedded;
|
|
183
|
+
/**
|
|
184
|
+
* Handle connect via UP Extension
|
|
185
|
+
*/
|
|
186
|
+
private handleConnectExtension;
|
|
187
|
+
/**
|
|
188
|
+
* Handle connect via UP Mobile (WalletConnect)
|
|
189
|
+
*/
|
|
190
|
+
private handleConnectMobile;
|
|
191
|
+
/**
|
|
192
|
+
* Close modal
|
|
193
|
+
*/
|
|
194
|
+
private handleClose;
|
|
195
|
+
/**
|
|
196
|
+
* Handle showing EOA connections
|
|
197
|
+
*/
|
|
198
|
+
private handleShowEoaConnections;
|
|
199
|
+
/**
|
|
200
|
+
* Handle showing QR code
|
|
201
|
+
*/
|
|
202
|
+
private handleShowQrCode;
|
|
203
|
+
/**
|
|
204
|
+
* Render connector button
|
|
205
|
+
*
|
|
206
|
+
* @param iconName
|
|
207
|
+
* @param label
|
|
208
|
+
* @param onClick
|
|
209
|
+
* @param isLoading
|
|
210
|
+
* @param isDisabled
|
|
211
|
+
*/
|
|
212
|
+
private renderConnectorButton;
|
|
213
|
+
private renderConnectors;
|
|
214
|
+
/**
|
|
215
|
+
* Render divider with text
|
|
216
|
+
*/
|
|
217
|
+
private renderDivider;
|
|
218
|
+
render(): TemplateResult<1>;
|
|
219
|
+
}
|
|
220
|
+
declare global {
|
|
221
|
+
interface HTMLElementTagNameMap {
|
|
222
|
+
'connection-view': ConnectionView;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* QR Code View - Lit Component
|
|
228
|
+
*
|
|
229
|
+
* Displays Wallet Connect QR code for mobile connection.
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
declare const QrCodeView_base: any;
|
|
233
|
+
declare class QrCodeView extends QrCodeView_base {
|
|
234
|
+
data: string | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Back to initial screen
|
|
237
|
+
*/
|
|
238
|
+
private handleBack;
|
|
239
|
+
/**
|
|
240
|
+
* Close modal
|
|
241
|
+
*/
|
|
242
|
+
private handleClose;
|
|
243
|
+
render(): TemplateResult<1>;
|
|
244
|
+
}
|
|
245
|
+
declare global {
|
|
246
|
+
interface HTMLElementTagNameMap {
|
|
247
|
+
'qr-code-view': QrCodeView;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Connect Modal - Lit Component
|
|
253
|
+
*
|
|
254
|
+
* Framework-agnostic connection modal for wallet/profile connections.
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
declare const ConnectModal_base: any;
|
|
258
|
+
declare class ConnectModal extends ConnectModal_base {
|
|
259
|
+
open: boolean;
|
|
260
|
+
theme: ConnectModalTheme;
|
|
261
|
+
private connectors;
|
|
262
|
+
private isDark;
|
|
263
|
+
private modalView;
|
|
264
|
+
private qrCodeData;
|
|
265
|
+
private mediaQueryList;
|
|
266
|
+
updated(changedProperties: Map<string, any>): void;
|
|
267
|
+
connectedCallback(): void;
|
|
268
|
+
disconnectedCallback(): void;
|
|
269
|
+
/**
|
|
270
|
+
* Handle system theme changes
|
|
271
|
+
*
|
|
272
|
+
* @param event
|
|
273
|
+
*/
|
|
274
|
+
private handleMediaQueryChange;
|
|
275
|
+
/**
|
|
276
|
+
* Close modal
|
|
277
|
+
*/
|
|
278
|
+
handleClose(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Update isDark state based on theme property
|
|
281
|
+
*/
|
|
282
|
+
private updateTheme;
|
|
283
|
+
private loadConnectors;
|
|
284
|
+
/**
|
|
285
|
+
* Successful connection handler
|
|
286
|
+
*
|
|
287
|
+
* @param connector
|
|
288
|
+
*/
|
|
289
|
+
private handleOnConnectSuccess;
|
|
290
|
+
/**
|
|
291
|
+
* Error connection handler
|
|
292
|
+
*
|
|
293
|
+
* @param error
|
|
294
|
+
*/
|
|
295
|
+
private handleOnConnectError;
|
|
296
|
+
private handleBackToConnectionView;
|
|
297
|
+
private handleShowEoaConnectionsView;
|
|
298
|
+
private handleShowQrCodeView;
|
|
299
|
+
/**
|
|
300
|
+
* Render modal content based on current view flag
|
|
301
|
+
*/
|
|
302
|
+
private renderModalContent;
|
|
303
|
+
render(): TemplateResult<1>;
|
|
304
|
+
}
|
|
305
|
+
declare global {
|
|
306
|
+
interface HTMLElementTagNameMap {
|
|
307
|
+
'connect-modal': ConnectModal;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Wagmi Connector Adapter
|
|
313
|
+
* Converts wagmi/viem connectors to our WalletConnector format
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Convert a wagmi connector to our WalletConnector format
|
|
318
|
+
* @param connector - Wagmi connector instance
|
|
319
|
+
* @param connectFn - Function to call connect (from wagmi's useConnect)
|
|
320
|
+
* @param chainId - Optional chain ID to use for connection
|
|
321
|
+
*/
|
|
322
|
+
declare function fromWagmiConnector(connector: WagmiConnector, connectFn: (options: {
|
|
323
|
+
connector: WagmiConnector;
|
|
324
|
+
chainId?: number;
|
|
325
|
+
}) => Promise<any>, chainId?: number): WalletConnector;
|
|
326
|
+
/**
|
|
327
|
+
* Convert array of wagmi connectors to WalletConnector array
|
|
328
|
+
* @param connectors - Array of wagmi connectors
|
|
329
|
+
* @param connectFn - Function to call connect (from wagmi's useConnect)
|
|
330
|
+
* @param chainId - Optional chain ID to use for connection
|
|
331
|
+
* @param embeddedWalletId - Optional embedded wallet ID to identify it (e.g., 'dev.lukso.auth')
|
|
332
|
+
*/
|
|
333
|
+
declare function fromWagmiConnectors(connectors: WagmiConnector[], connectFn: (options: {
|
|
334
|
+
connector: WagmiConnector;
|
|
335
|
+
chainId?: number;
|
|
336
|
+
}) => Promise<any>, chainId?: number, embeddedWalletId?: string): WalletConnector[];
|
|
337
|
+
/**
|
|
338
|
+
* Setup wagmi for connect modal
|
|
339
|
+
* Call this once from your app initialization with wagmi config
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* import { setupConnectModal } from '@lukso/up-connector'
|
|
344
|
+
* import { wagmiConfig } from './wagmi-config'
|
|
345
|
+
*
|
|
346
|
+
* setupConnectModal({
|
|
347
|
+
* wagmiConfig,
|
|
348
|
+
* chainId: 42, // Optional: LUKSO mainnet
|
|
349
|
+
* embeddedWalletConnect: async () => {
|
|
350
|
+
* // Your passkey wallet logic
|
|
351
|
+
* }
|
|
352
|
+
* })
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
declare function setupConnectModal(setup: ConnectModalSetup): void;
|
|
356
|
+
/**
|
|
357
|
+
* Get the current wagmi setup (for internal use by connector)
|
|
358
|
+
*/
|
|
359
|
+
declare function getWagmiSetup(): ConnectModalSetup | null;
|
|
360
|
+
/**
|
|
361
|
+
* Get current wagmi account state
|
|
362
|
+
* Returns null if wagmi is not set up
|
|
363
|
+
*/
|
|
364
|
+
declare function getWagmiAccount(): Promise<{
|
|
365
|
+
isConnected: boolean;
|
|
366
|
+
address?: string;
|
|
367
|
+
chainId?: number;
|
|
368
|
+
connector?: any;
|
|
369
|
+
} | null>;
|
|
370
|
+
/**
|
|
371
|
+
* Subscribe to wagmi account changes
|
|
372
|
+
* Returns unsubscribe function
|
|
373
|
+
*/
|
|
374
|
+
declare function watchWagmiAccount(callback: (account: {
|
|
375
|
+
isConnected: boolean;
|
|
376
|
+
address?: string;
|
|
377
|
+
chainId?: number;
|
|
378
|
+
connector?: any;
|
|
379
|
+
}) => void): Promise<(() => void) | null>;
|
|
380
|
+
/**
|
|
381
|
+
* Disconnect from wagmi
|
|
382
|
+
* Returns true if disconnect was successful
|
|
383
|
+
*/
|
|
384
|
+
declare function disconnectWagmi(): Promise<boolean>;
|
|
385
|
+
|
|
386
|
+
export { ConnectModal as C, type WalletConnector as W, type WagmiConnector as a, type ConnectionModalView as b, type ConnectModalSetup as c, type ConnectModalTheme as d, disconnectWagmi as e, getWagmiSetup as f, getWagmiAccount as g, fromWagmiConnector as h, fromWagmiConnectors as i, type Wallet as j, setupConnectModal as s, watchWagmiAccount as w };
|
package/package.json
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lukso/up-connector",
|
|
3
|
+
"version": "0.4.0-dev.a8c9315",
|
|
4
|
+
"description": "Universal Profile connector with draggable avatar and connection modal",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./avatar": {
|
|
16
|
+
"types": "./dist/avatar.d.ts",
|
|
17
|
+
"import": "./dist/avatar.js",
|
|
18
|
+
"require": "./dist/avatar.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./intl": {
|
|
21
|
+
"types": "./dist/intl.d.ts",
|
|
22
|
+
"import": "./dist/intl.js",
|
|
23
|
+
"require": "./dist/intl.cjs"
|
|
24
|
+
},
|
|
25
|
+
"./device": {
|
|
26
|
+
"types": "./dist/device.d.ts",
|
|
27
|
+
"import": "./dist/device.js",
|
|
28
|
+
"require": "./dist/device.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./modal": {
|
|
31
|
+
"types": "./dist/modal.d.ts",
|
|
32
|
+
"import": "./dist/modal.js",
|
|
33
|
+
"require": "./dist/modal.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./backup-modal": {
|
|
36
|
+
"types": "./dist/backup-modal.d.ts",
|
|
37
|
+
"import": "./dist/backup-modal.js",
|
|
38
|
+
"require": "./dist/backup-modal.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./restore-modal": {
|
|
41
|
+
"types": "./dist/restore-modal.d.ts",
|
|
42
|
+
"import": "./dist/restore-modal.js",
|
|
43
|
+
"require": "./dist/restore-modal.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./connect-modal": {
|
|
46
|
+
"types": "./dist/connect-modal/index.d.ts",
|
|
47
|
+
"import": "./dist/connect-modal/index.js",
|
|
48
|
+
"require": "./dist/connect-modal/index.cjs"
|
|
49
|
+
},
|
|
50
|
+
"./auto-setup": {
|
|
51
|
+
"types": "./dist/auto-setup.d.ts",
|
|
52
|
+
"import": "./dist/auto-setup.js",
|
|
53
|
+
"require": "./dist/auto-setup.cjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"dist",
|
|
58
|
+
"src",
|
|
59
|
+
"README.md"
|
|
60
|
+
],
|
|
61
|
+
"keywords": [
|
|
62
|
+
"lukso",
|
|
63
|
+
"universal-profile",
|
|
64
|
+
"web3",
|
|
65
|
+
"wallet",
|
|
66
|
+
"connector",
|
|
67
|
+
"avatar",
|
|
68
|
+
"modal",
|
|
69
|
+
"blockchain"
|
|
70
|
+
],
|
|
71
|
+
"author": "LUKSO",
|
|
72
|
+
"license": "MIT",
|
|
73
|
+
"repository": {
|
|
74
|
+
"type": "git",
|
|
75
|
+
"url": "https://github.com/lukso-network/up-connector.git"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@lit/task": "^1.0.3",
|
|
79
|
+
"@lukso/up-provider": "npm:@lukso-network/up-provider@0.3.5-main.c50af46",
|
|
80
|
+
"@lukso/web-components": "^1.171.2",
|
|
81
|
+
"debug": "^4.4.3",
|
|
82
|
+
"lit": "^3.3.1",
|
|
83
|
+
"ws": "^8.18.3",
|
|
84
|
+
"zxcvbn": "^4.4.2",
|
|
85
|
+
"@lukso/core": "0.1.0-dev.a8c9315",
|
|
86
|
+
"@lukso/passkey-auth": "1.0.2-dev.a8c9315",
|
|
87
|
+
"@lukso/transaction-view-core": "0.3.1-dev.a8c9315",
|
|
88
|
+
"@lukso/transaction-view-headless": "0.2.2-dev.a8c9315"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"@wagmi/connectors": "^7.0.0",
|
|
92
|
+
"@wagmi/core": "^3.0.0",
|
|
93
|
+
"viem": "^2.0.0"
|
|
94
|
+
},
|
|
95
|
+
"peerDependenciesMeta": {
|
|
96
|
+
"@wagmi/connectors": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"@wagmi/core": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"viem": {
|
|
103
|
+
"optional": true
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"devDependencies": {
|
|
107
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
108
|
+
"@types/debug": "^4.1.12",
|
|
109
|
+
"@types/zxcvbn": "^4.4.5",
|
|
110
|
+
"@wagmi/connectors": "^7.0.2",
|
|
111
|
+
"@wagmi/core": "^3.0.0",
|
|
112
|
+
"autoprefixer": "^10.4.22",
|
|
113
|
+
"postcss": "^8.5.6",
|
|
114
|
+
"postcss-import": "^16.1.1",
|
|
115
|
+
"tailwindcss": "^3.4.18",
|
|
116
|
+
"tsup": "^8.5.1",
|
|
117
|
+
"typescript": "^5.9.3",
|
|
118
|
+
"viem": "^2.41.2",
|
|
119
|
+
"vitest": "^4.0.15"
|
|
120
|
+
},
|
|
121
|
+
"tsup": {
|
|
122
|
+
"entry": [
|
|
123
|
+
"src/index.ts",
|
|
124
|
+
"src/avatar.ts",
|
|
125
|
+
"src/intl.ts",
|
|
126
|
+
"src/device.ts",
|
|
127
|
+
"src/modal.ts",
|
|
128
|
+
"src/backup-modal.ts",
|
|
129
|
+
"src/restore-modal.ts",
|
|
130
|
+
"src/connect-modal/index.ts",
|
|
131
|
+
"src/wagmi-adapter.ts",
|
|
132
|
+
"src/auto-setup.ts"
|
|
133
|
+
],
|
|
134
|
+
"format": [
|
|
135
|
+
"cjs",
|
|
136
|
+
"esm"
|
|
137
|
+
],
|
|
138
|
+
"dts": true,
|
|
139
|
+
"splitting": true,
|
|
140
|
+
"sourcemap": true,
|
|
141
|
+
"clean": false,
|
|
142
|
+
"minify": false,
|
|
143
|
+
"external": [
|
|
144
|
+
"@lukso/transaction-view-core"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"scripts": {
|
|
148
|
+
"build": "tsup",
|
|
149
|
+
"dev": "tsup --watch",
|
|
150
|
+
"dev-alt": "tsup --watch",
|
|
151
|
+
"serve": "node dev-server.js",
|
|
152
|
+
"dev:serve": "pnpm build && pnpm serve",
|
|
153
|
+
"clean": "rm -rf dist",
|
|
154
|
+
"deploy:prepare": "./deploy.sh",
|
|
155
|
+
"test": "vitest",
|
|
156
|
+
"test:run": "vitest run"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account Modal - Lit Component
|
|
3
|
+
*
|
|
4
|
+
* Framework-agnostic account management modal showing connected wallet details.
|
|
5
|
+
* Uses lukso-modal from @lukso/web-components for consistent UI.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { html } from 'lit'
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js'
|
|
10
|
+
import { CoreLitElement } from './styles'
|
|
11
|
+
|
|
12
|
+
// Import lukso web components
|
|
13
|
+
import '@lukso/web-components/dist/components/lukso-modal'
|
|
14
|
+
import '@lukso/web-components/dist/components/lukso-button'
|
|
15
|
+
|
|
16
|
+
@customElement('account-modal')
|
|
17
|
+
export class AccountModal extends CoreLitElement {
|
|
18
|
+
// Public properties
|
|
19
|
+
@property({ type: Boolean, reflect: true }) open = false
|
|
20
|
+
@property({ type: String }) theme: 'light' | 'dark' | 'auto' = 'auto'
|
|
21
|
+
@property({ type: String }) address = ''
|
|
22
|
+
@property({ type: Number }) chainId?: number
|
|
23
|
+
@property({ type: String }) connectorName = ''
|
|
24
|
+
|
|
25
|
+
private close() {
|
|
26
|
+
this.open = false
|
|
27
|
+
this.dispatchEvent(new CustomEvent('close'))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private handleDisconnect() {
|
|
31
|
+
this.dispatchEvent(new CustomEvent('disconnect'))
|
|
32
|
+
this.close()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private getChainName(): string {
|
|
36
|
+
switch (this.chainId) {
|
|
37
|
+
case 42:
|
|
38
|
+
return 'LUKSO Mainnet'
|
|
39
|
+
case 4201:
|
|
40
|
+
return 'LUKSO Testnet'
|
|
41
|
+
default:
|
|
42
|
+
return this.chainId ? `Chain ${this.chainId}` : 'Unknown Network'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
render() {
|
|
47
|
+
return html`
|
|
48
|
+
<lukso-modal
|
|
49
|
+
?is-open=${this.open}
|
|
50
|
+
size="small"
|
|
51
|
+
@on-backdrop-click=${this.close}
|
|
52
|
+
>
|
|
53
|
+
<div class="p-6">
|
|
54
|
+
<!-- Header with close button -->
|
|
55
|
+
<div class="flex justify-between items-center mb-6">
|
|
56
|
+
<h2 class="text-xl font-semibold">Connected Account</h2>
|
|
57
|
+
<button
|
|
58
|
+
@click=${this.close}
|
|
59
|
+
class="text-neutral-50 hover:text-neutral-20 transition-colors"
|
|
60
|
+
aria-label="Close"
|
|
61
|
+
>
|
|
62
|
+
<svg
|
|
63
|
+
width="24"
|
|
64
|
+
height="24"
|
|
65
|
+
viewBox="0 0 24 24"
|
|
66
|
+
fill="none"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
stroke-width="2"
|
|
69
|
+
stroke-linecap="round"
|
|
70
|
+
stroke-linejoin="round"
|
|
71
|
+
>
|
|
72
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
73
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
74
|
+
</svg>
|
|
75
|
+
</button>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<!-- Connection Status -->
|
|
79
|
+
<div class="flex items-center gap-2 mb-5">
|
|
80
|
+
<div
|
|
81
|
+
class="w-2 h-2 rounded-full"
|
|
82
|
+
style="background: #10b981;"
|
|
83
|
+
></div>
|
|
84
|
+
<span class="text-sm font-semibold" style="color: #10b981;">
|
|
85
|
+
Connected
|
|
86
|
+
</span>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<!-- Address -->
|
|
90
|
+
<div
|
|
91
|
+
class="mb-4 p-3 rounded-lg bg-neutral-98 border border-neutral-90"
|
|
92
|
+
>
|
|
93
|
+
<div
|
|
94
|
+
class="text-xs font-semibold text-neutral-50 mb-1.5 uppercase"
|
|
95
|
+
>
|
|
96
|
+
Address
|
|
97
|
+
</div>
|
|
98
|
+
<div
|
|
99
|
+
class="text-xs font-mono text-neutral-20 break-all leading-relaxed"
|
|
100
|
+
>
|
|
101
|
+
${this.address}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<!-- Network & Connector Info -->
|
|
106
|
+
<div class="grid grid-cols-2 gap-3 mb-5">
|
|
107
|
+
<div class="p-3 rounded-lg bg-neutral-98 border border-neutral-90">
|
|
108
|
+
<div
|
|
109
|
+
class="text-xs font-semibold text-neutral-50 mb-1.5 uppercase"
|
|
110
|
+
>
|
|
111
|
+
Network
|
|
112
|
+
</div>
|
|
113
|
+
<div class="text-sm font-semibold text-neutral-20">
|
|
114
|
+
${this.getChainName()}
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div class="p-3 rounded-lg bg-neutral-98 border border-neutral-90">
|
|
119
|
+
<div
|
|
120
|
+
class="text-xs font-semibold text-neutral-50 mb-1.5 uppercase"
|
|
121
|
+
>
|
|
122
|
+
Connector
|
|
123
|
+
</div>
|
|
124
|
+
<div class="text-sm font-semibold text-neutral-20">
|
|
125
|
+
${this.connectorName || 'Unknown'}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<!-- Disconnect Button -->
|
|
131
|
+
<lukso-button
|
|
132
|
+
variant="danger"
|
|
133
|
+
is-full-width
|
|
134
|
+
@click=${this.handleDisconnect}
|
|
135
|
+
>
|
|
136
|
+
Disconnect
|
|
137
|
+
</lukso-button>
|
|
138
|
+
</div>
|
|
139
|
+
</lukso-modal>
|
|
140
|
+
`
|
|
141
|
+
}
|
|
142
|
+
}
|