@lukso/up-connector 0.8.4 → 0.8.5-dev.2df3eae
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-modal.cjs +3 -3
- package/dist/account-modal.js +2 -2
- package/dist/auto-setup.cjs +2 -3
- package/dist/auto-setup.cjs.map +1 -1
- package/dist/auto-setup.d.cts +1 -1
- package/dist/auto-setup.d.ts +1 -1
- package/dist/auto-setup.js +1 -2
- package/dist/backup-modal.cjs +3 -3
- package/dist/backup-modal.js +2 -2
- package/dist/{chunk-DR5ABNGN.cjs → chunk-3AIZSSEE.cjs} +2 -2
- package/dist/{chunk-DR5ABNGN.cjs.map → chunk-3AIZSSEE.cjs.map} +1 -1
- package/dist/{chunk-XFMPPOEM.js → chunk-43E6AVSP.js} +5 -4
- package/dist/chunk-43E6AVSP.js.map +1 -0
- package/dist/{chunk-HROZAHML.js → chunk-D7RI2CWB.js} +5 -4
- package/dist/chunk-D7RI2CWB.js.map +1 -0
- package/dist/{chunk-47T7DEEN.js → chunk-LXK6OUTM.js} +4 -7
- package/dist/chunk-LXK6OUTM.js.map +1 -0
- package/dist/{chunk-OIB4M2BJ.cjs → chunk-PHRCQCEN.cjs} +5 -4
- package/dist/chunk-PHRCQCEN.cjs.map +1 -0
- package/dist/{chunk-DXCWF7PX.cjs → chunk-PPONAIJF.cjs} +5 -8
- package/dist/chunk-PPONAIJF.cjs.map +1 -0
- package/dist/{chunk-D4X5RQWB.cjs → chunk-UJDGQG6P.cjs} +5 -4
- package/dist/chunk-UJDGQG6P.cjs.map +1 -0
- package/dist/{chunk-EWIDQS53.cjs → chunk-XCX7QWLC.cjs} +5 -4
- package/dist/chunk-XCX7QWLC.cjs.map +1 -0
- package/dist/{chunk-A47V7DY2.js → chunk-XEZEZ62E.js} +2 -2
- package/dist/{chunk-A47V7DY2.js.map → chunk-XEZEZ62E.js.map} +1 -1
- package/dist/{chunk-PUIFBRHQ.js → chunk-XKSB6TPG.js} +5 -4
- package/dist/chunk-XKSB6TPG.js.map +1 -0
- package/dist/index.cjs +21 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +29 -19
- package/dist/index.js.map +1 -1
- package/dist/restore-modal.cjs +3 -3
- package/dist/restore-modal.js +2 -2
- package/package.json +6 -11
- package/src/account-modal.ts +3 -2
- package/src/auto-setup.ts +3 -2
- package/src/backup-modal.ts +3 -2
- package/src/connector.ts +7 -4
- package/src/index.ts +19 -19
- package/src/restore-modal.ts +3 -2
- package/dist/chunk-2BZE2DLW.js +0 -1186
- package/dist/chunk-2BZE2DLW.js.map +0 -1
- package/dist/chunk-455JZ6IZ.cjs +0 -1186
- package/dist/chunk-455JZ6IZ.cjs.map +0 -1
- package/dist/chunk-47T7DEEN.js.map +0 -1
- package/dist/chunk-D4X5RQWB.cjs.map +0 -1
- package/dist/chunk-DXCWF7PX.cjs.map +0 -1
- package/dist/chunk-EWIDQS53.cjs.map +0 -1
- package/dist/chunk-HROZAHML.js.map +0 -1
- package/dist/chunk-OIB4M2BJ.cjs.map +0 -1
- package/dist/chunk-PUIFBRHQ.js.map +0 -1
- package/dist/chunk-XFMPPOEM.js.map +0 -1
- package/dist/connect-modal/index.cjs +0 -22
- package/dist/connect-modal/index.cjs.map +0 -1
- package/dist/connect-modal/index.d.cts +0 -3
- package/dist/connect-modal/index.d.ts +0 -3
- package/dist/connect-modal/index.js +0 -22
- package/dist/connect-modal/index.js.map +0 -1
- package/dist/index-2LsIVyuU.d.cts +0 -413
- package/dist/index-2LsIVyuU.d.ts +0 -413
- package/src/connect-modal/components/connection-view.ts +0 -418
- package/src/connect-modal/components/eoa-connection-view.ts +0 -418
- package/src/connect-modal/components/qr-code-view.ts +0 -86
- package/src/connect-modal/connect-modal.base.ts +0 -18
- package/src/connect-modal/connect-modal.config.ts +0 -27
- package/src/connect-modal/connect-modal.templates.ts +0 -22
- package/src/connect-modal/connect-modal.ts +0 -227
- package/src/connect-modal/connect-modal.types.ts +0 -108
- package/src/connect-modal/images/up-cube-glass.png +0 -0
- package/src/connect-modal/index.ts +0 -25
- package/src/connect-modal/services/wagmi.ts +0 -377
- package/src/connect-modal/styles/styles.css +0 -1
- package/src/connect-modal/utils/chainParams.ts +0 -32
- package/src/connect-modal/utils/walletConnectDeepLinkUrl.ts +0 -43
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EOA Connection View - Lit Component
|
|
3
|
-
*
|
|
4
|
-
* Displays available EOA (Externally Owned Account) wallets for connection.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { Task } from '@lit/task'
|
|
8
|
-
import {
|
|
9
|
-
withDeviceService,
|
|
10
|
-
withIntlService,
|
|
11
|
-
withTheme,
|
|
12
|
-
} from '@lukso/core/mixins'
|
|
13
|
-
import debug from 'debug'
|
|
14
|
-
import { html, nothing, type TemplateResult } from 'lit'
|
|
15
|
-
import { property, state } from 'lit/decorators.js'
|
|
16
|
-
import { keyed } from 'lit/directives/keyed.js'
|
|
17
|
-
|
|
18
|
-
import { ConnectModalBase } from '../connect-modal.base'
|
|
19
|
-
import {
|
|
20
|
-
REOWN_PROJECT_ID,
|
|
21
|
-
SUPPORTED_WALLET_IDS_DESKTOP,
|
|
22
|
-
SUPPORTED_WALLET_IDS_MOBILE,
|
|
23
|
-
WALLETS_API_URL,
|
|
24
|
-
} from '../connect-modal.config'
|
|
25
|
-
import {
|
|
26
|
-
renderBackButton,
|
|
27
|
-
renderCloseButton,
|
|
28
|
-
renderLogo,
|
|
29
|
-
renderPlaceholder,
|
|
30
|
-
renderTitle,
|
|
31
|
-
} from '../connect-modal.templates'
|
|
32
|
-
import type {
|
|
33
|
-
Wallet,
|
|
34
|
-
WalletAppType,
|
|
35
|
-
WalletConnector,
|
|
36
|
-
WalletResponse,
|
|
37
|
-
} from '../connect-modal.types'
|
|
38
|
-
|
|
39
|
-
// Import lukso web components
|
|
40
|
-
import '@lukso/web-components/dist/components/lukso-button'
|
|
41
|
-
import '@lukso/web-components/dist/components/lukso-icon'
|
|
42
|
-
import '@lukso/web-components/dist/components/lukso-tag'
|
|
43
|
-
import { getWagmiSetup } from '../services/wagmi'
|
|
44
|
-
|
|
45
|
-
const logInfo = debug('connect-modal:info')
|
|
46
|
-
|
|
47
|
-
export class EoaConnectionView extends withTheme(
|
|
48
|
-
withIntlService(withDeviceService(ConnectModalBase))
|
|
49
|
-
) {
|
|
50
|
-
@property({ type: Array }) connectors: WalletConnector[] = []
|
|
51
|
-
|
|
52
|
-
@state() private isConnecting = false
|
|
53
|
-
@state() private connectingRdns: string | undefined = undefined
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get WalletConnect connector
|
|
57
|
-
*/
|
|
58
|
-
private get walletConnectConnector(): WalletConnector | undefined {
|
|
59
|
-
return this.connectors.find((connector) => connector.type === 'mobile')
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Get EOA connectors
|
|
64
|
-
*/
|
|
65
|
-
private get eoaConnectors(): WalletConnector[] {
|
|
66
|
-
return this.connectors.filter(
|
|
67
|
-
(connector) =>
|
|
68
|
-
connector.type !== 'embedded' &&
|
|
69
|
-
connector.type !== 'extension' &&
|
|
70
|
-
connector.type !== 'mobile' &&
|
|
71
|
-
connector.rdns !== 'io.lukso.up-extension' &&
|
|
72
|
-
connector.slug !== 'injected'
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Get supported wallet IDs based on device type
|
|
78
|
-
*
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
private supportedWalletIds(): string[] {
|
|
82
|
-
return this.device?.isMobile
|
|
83
|
-
? SUPPORTED_WALLET_IDS_MOBILE
|
|
84
|
-
: SUPPORTED_WALLET_IDS_DESKTOP
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Task to fetch EOA wallets - handles loading/error states automatically
|
|
89
|
-
*/
|
|
90
|
-
private walletsTask = new Task(this as any, {
|
|
91
|
-
task: async ([_isMobile], { signal }): Promise<Wallet[]> => {
|
|
92
|
-
const walletIds: string[] = this.supportedWalletIds()
|
|
93
|
-
const url = `${WALLETS_API_URL}?projectId=${REOWN_PROJECT_ID}&ids=${walletIds.join(',')}`
|
|
94
|
-
|
|
95
|
-
const response = await fetch(url, { signal })
|
|
96
|
-
|
|
97
|
-
if (!response.ok) {
|
|
98
|
-
throw new Error('Failed to fetch wallets')
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const data = (await response.json()) as WalletResponse
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
Object.entries(data.listings || {})
|
|
105
|
-
// map to attach installed status and connector
|
|
106
|
-
.map(([, wallet]) => {
|
|
107
|
-
const connector = this.eoaConnectors.find(
|
|
108
|
-
(connector: WalletConnector) => connector.rdns === wallet.rdns
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
...wallet,
|
|
113
|
-
isInstalled: connector?.rdns === wallet.rdns,
|
|
114
|
-
connector,
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
// sort by installed wallets first
|
|
118
|
-
.sort((a: Wallet, b: Wallet) =>
|
|
119
|
-
a.isInstalled === b.isInstalled ? 0 : a.isInstalled ? -1 : 1
|
|
120
|
-
)
|
|
121
|
-
)
|
|
122
|
-
},
|
|
123
|
-
args: () => [this.device?.isMobile],
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Get device type
|
|
128
|
-
*/
|
|
129
|
-
private deviceType(): WalletAppType {
|
|
130
|
-
if (this.device?.isMobile || this.device?.isTablet) {
|
|
131
|
-
if (this.device?.isIOS) {
|
|
132
|
-
return 'ios'
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return 'android'
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (this.device?.isChrome) {
|
|
139
|
-
return 'chrome'
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (this.device?.isFirefox) {
|
|
143
|
-
return 'firefox'
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (this.device?.isSafari) {
|
|
147
|
-
return 'safari'
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (this.device?.isEdge) {
|
|
151
|
-
return 'edge'
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (this.device?.isOpera) {
|
|
155
|
-
return 'opera'
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return 'browser'
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Close modal
|
|
163
|
-
*/
|
|
164
|
-
private handleClose(): void {
|
|
165
|
-
this.dispatchEvent(
|
|
166
|
-
new CustomEvent('on-close', { bubbles: true, composed: true })
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Back to initial screen
|
|
172
|
-
*/
|
|
173
|
-
private handleBack(): void {
|
|
174
|
-
this.dispatchEvent(
|
|
175
|
-
new CustomEvent('on-back', { bubbles: true, composed: true })
|
|
176
|
-
)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Handle wallet connect click
|
|
181
|
-
*
|
|
182
|
-
* @param wallet
|
|
183
|
-
*/
|
|
184
|
-
private handleConnect(wallet: Wallet, event: CustomEvent): void {
|
|
185
|
-
event.stopPropagation() // Prevent event bubbling
|
|
186
|
-
this.connectingRdns = wallet.rdns
|
|
187
|
-
|
|
188
|
-
if (this.device?.isMobile) {
|
|
189
|
-
this.connectMobile(wallet)
|
|
190
|
-
return
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
this.connectDesktop(wallet)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Connect to wallet on desktop using selected connector
|
|
198
|
-
*
|
|
199
|
-
* @param wallet
|
|
200
|
-
*/
|
|
201
|
-
private async connectDesktop(wallet: Wallet): Promise<void> {
|
|
202
|
-
// Open wallet app store link if wallet is not installed
|
|
203
|
-
if (!wallet.isInstalled) {
|
|
204
|
-
window.open(wallet.app[this.deviceType()], '_blank')
|
|
205
|
-
return
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const connector = wallet.connector
|
|
209
|
-
|
|
210
|
-
if (connector) {
|
|
211
|
-
try {
|
|
212
|
-
logInfo('Connecting via connector:', connector)
|
|
213
|
-
this.isConnecting = true
|
|
214
|
-
|
|
215
|
-
const setup = getWagmiSetup()
|
|
216
|
-
|
|
217
|
-
await connector.switchChain?.({ chainId: setup?.chainId })
|
|
218
|
-
await connector.connect()
|
|
219
|
-
|
|
220
|
-
// Dispatch connect event
|
|
221
|
-
this.dispatchEvent(
|
|
222
|
-
new CustomEvent('on-connect', {
|
|
223
|
-
detail: { connector },
|
|
224
|
-
bubbles: true,
|
|
225
|
-
composed: true,
|
|
226
|
-
})
|
|
227
|
-
)
|
|
228
|
-
} catch (error) {
|
|
229
|
-
// Dispatch error event
|
|
230
|
-
this.dispatchEvent(
|
|
231
|
-
new CustomEvent('on-error', {
|
|
232
|
-
detail: { error },
|
|
233
|
-
bubbles: true,
|
|
234
|
-
composed: true,
|
|
235
|
-
})
|
|
236
|
-
)
|
|
237
|
-
} finally {
|
|
238
|
-
this.isConnecting = false
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Connect to wallet on mobile using WalletConnect
|
|
245
|
-
*/
|
|
246
|
-
private async connectMobile(wallet: Wallet): Promise<void> {
|
|
247
|
-
const connector = this.walletConnectConnector
|
|
248
|
-
|
|
249
|
-
if (connector) {
|
|
250
|
-
try {
|
|
251
|
-
logInfo('Connecting via WalletConnect connector:', connector)
|
|
252
|
-
this.isConnecting = true
|
|
253
|
-
|
|
254
|
-
// Start the connection - this initiates the WalletConnect flow
|
|
255
|
-
// The promise will resolve when wallet approves or reject when user rejects
|
|
256
|
-
const connectPromise = connector.connect()
|
|
257
|
-
|
|
258
|
-
// Get the provider to listen for the display_uri event
|
|
259
|
-
const provider = await connector.getProvider?.()
|
|
260
|
-
|
|
261
|
-
// Listen for the display_uri event which is emitted after connect
|
|
262
|
-
if (provider) {
|
|
263
|
-
const handleDisplayUri = (displayUri: string) => {
|
|
264
|
-
logInfo('WalletConnect URI received:', displayUri)
|
|
265
|
-
|
|
266
|
-
const encodedUri = encodeURIComponent(displayUri)
|
|
267
|
-
|
|
268
|
-
// Use native deep link if available
|
|
269
|
-
if (wallet.mobile?.native) {
|
|
270
|
-
window.location.href = `${wallet.mobile.native}wc?uri=${encodedUri}`
|
|
271
|
-
} else if (wallet.rdns === 'com.coinbase.wallet') {
|
|
272
|
-
// Coinbase has no native deep link provided, use custom scheme
|
|
273
|
-
window.location.href = `cbwallet://wc?uri=${encodedUri}`
|
|
274
|
-
} else {
|
|
275
|
-
// For other wallets, use universal wc: scheme
|
|
276
|
-
window.location.href = displayUri
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Clean up listener
|
|
280
|
-
provider.off('display_uri', handleDisplayUri)
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
provider.on('display_uri', handleDisplayUri)
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Wait for the connection to complete
|
|
287
|
-
// This will throw if the user rejects the connection
|
|
288
|
-
await connectPromise
|
|
289
|
-
|
|
290
|
-
// Dispatch connect event only if connection succeeded
|
|
291
|
-
this.dispatchEvent(
|
|
292
|
-
new CustomEvent('on-connect', {
|
|
293
|
-
detail: { connector },
|
|
294
|
-
bubbles: true,
|
|
295
|
-
composed: true,
|
|
296
|
-
})
|
|
297
|
-
)
|
|
298
|
-
} catch (error) {
|
|
299
|
-
// Dispatch error event
|
|
300
|
-
this.dispatchEvent(
|
|
301
|
-
new CustomEvent('on-error', {
|
|
302
|
-
detail: { error },
|
|
303
|
-
bubbles: true,
|
|
304
|
-
composed: true,
|
|
305
|
-
})
|
|
306
|
-
)
|
|
307
|
-
} finally {
|
|
308
|
-
this.isConnecting = false
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* Render the list of EOA wallets
|
|
315
|
-
*/
|
|
316
|
-
private renderWalletsList(): TemplateResult<1> | undefined {
|
|
317
|
-
return this.walletsTask.render({
|
|
318
|
-
// Success state
|
|
319
|
-
complete: (wallets: any) =>
|
|
320
|
-
html`${wallets.map((wallet: any) => {
|
|
321
|
-
const isLoading =
|
|
322
|
-
this.isConnecting && this.connectingRdns === wallet.rdns
|
|
323
|
-
const isInstalled = this.eoaConnectors.some(
|
|
324
|
-
(connector: WalletConnector) => connector.rdns === wallet.rdns
|
|
325
|
-
)
|
|
326
|
-
const logo = wallet.image_url?.sm
|
|
327
|
-
? html`<img src="${wallet.image_url.sm}" alt="${wallet.name} logo" class="h-8 rounded-full mr-2" />`
|
|
328
|
-
: nothing
|
|
329
|
-
|
|
330
|
-
return keyed(
|
|
331
|
-
wallet.slug,
|
|
332
|
-
html`<lukso-button
|
|
333
|
-
.theme=${this.theme}
|
|
334
|
-
variant="secondary"
|
|
335
|
-
size=${this.device?.isMobile ? 'medium' : 'large'}
|
|
336
|
-
is-full-width
|
|
337
|
-
?disabled=${this.isConnecting}
|
|
338
|
-
?is-loading=${isLoading}
|
|
339
|
-
loading-text=${wallet.name}
|
|
340
|
-
@click=${(event: CustomEvent) => this.handleConnect(wallet, event)}
|
|
341
|
-
>
|
|
342
|
-
<div
|
|
343
|
-
class="grid w-full grid-cols-[max-content,auto,max-content] items-center gap-3 text-left animate-fade-in"
|
|
344
|
-
>
|
|
345
|
-
${logo}
|
|
346
|
-
<div class="truncate">${wallet.name}</div>
|
|
347
|
-
<div class="flex items-center">
|
|
348
|
-
${
|
|
349
|
-
isInstalled
|
|
350
|
-
? html`<lukso-tag
|
|
351
|
-
size="${this.device?.isMobile ? 'x-small' : 'small'}"
|
|
352
|
-
text-color="green-45"
|
|
353
|
-
background-color="${this.theme === 'dark' ? 'neutral-20' : 'neutral-100'}"
|
|
354
|
-
border-color="green-45"
|
|
355
|
-
>
|
|
356
|
-
${this.formatMessage('connect_modal_installed')}
|
|
357
|
-
</lukso-tag>`
|
|
358
|
-
: nothing
|
|
359
|
-
}
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
362
|
-
</lukso-button>`
|
|
363
|
-
)
|
|
364
|
-
})}`,
|
|
365
|
-
// Loading state
|
|
366
|
-
pending: () =>
|
|
367
|
-
html`${this.supportedWalletIds().map(() =>
|
|
368
|
-
renderPlaceholder(
|
|
369
|
-
`w-full ${this.device?.isMobile ? 'h-10 !rounded-10' : 'h-12 !rounded-12'}`
|
|
370
|
-
)
|
|
371
|
-
)}`,
|
|
372
|
-
// Error state
|
|
373
|
-
error: (_error: unknown) => {
|
|
374
|
-
return html`<div class="flex flex-col justify-center items-center py-10">
|
|
375
|
-
<div class="mb-4">${this.formatMessage('connect_modal_failed_to_load')}</div>
|
|
376
|
-
<lukso-button size="medium" variant="secondary" @click=${() => this.walletsTask.run()}>${this.formatMessage('connect_modal_try_again')}</lukso-button>
|
|
377
|
-
</div>`
|
|
378
|
-
},
|
|
379
|
-
})
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Main render method
|
|
384
|
-
*/
|
|
385
|
-
render(): TemplateResult<1> {
|
|
386
|
-
return html`
|
|
387
|
-
<div class="flex justify-between">
|
|
388
|
-
<button
|
|
389
|
-
@click=${this.handleBack}
|
|
390
|
-
>
|
|
391
|
-
${renderBackButton(this.theme)}
|
|
392
|
-
</button>
|
|
393
|
-
|
|
394
|
-
<button
|
|
395
|
-
@click=${this.handleClose}
|
|
396
|
-
>
|
|
397
|
-
${renderCloseButton(this.theme)}
|
|
398
|
-
</button>
|
|
399
|
-
</div>
|
|
400
|
-
<div class="flex flex-col items-center text-center">
|
|
401
|
-
${renderLogo()}
|
|
402
|
-
${renderTitle(this.formatMessage('connect_modal_eoa_title'))}
|
|
403
|
-
<div class="mt-2 flex w-full flex-col gap-2">
|
|
404
|
-
${this.renderWalletsList()}
|
|
405
|
-
</div>
|
|
406
|
-
</div>
|
|
407
|
-
`
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Register custom element
|
|
412
|
-
customElements.define('eoa-connection-view', EoaConnectionView as any)
|
|
413
|
-
|
|
414
|
-
declare global {
|
|
415
|
-
interface HTMLElementTagNameMap {
|
|
416
|
-
'eoa-connection-view': EoaConnectionView
|
|
417
|
-
}
|
|
418
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* QR Code View - Lit Component
|
|
3
|
-
*
|
|
4
|
-
* Displays Wallet Connect QR code for mobile connection.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { html, type TemplateResult } from 'lit'
|
|
8
|
-
|
|
9
|
-
import { ConnectModalBase } from '../connect-modal.base'
|
|
10
|
-
|
|
11
|
-
// Import lukso web components
|
|
12
|
-
import '@lukso/web-components/dist/components/lukso-qr-code'
|
|
13
|
-
import { withIntlService, withTheme } from '@lukso/core/mixins'
|
|
14
|
-
import type { QRCodeOptions } from '@lukso/web-components'
|
|
15
|
-
import { property } from 'lit/decorators.js'
|
|
16
|
-
import {
|
|
17
|
-
renderBackButton,
|
|
18
|
-
renderCloseButton,
|
|
19
|
-
renderTitle,
|
|
20
|
-
} from '../connect-modal.templates'
|
|
21
|
-
import cubeGlassImage from '../images/up-cube-glass.png'
|
|
22
|
-
|
|
23
|
-
export class QrCodeView extends withTheme(withIntlService(ConnectModalBase)) {
|
|
24
|
-
@property({ type: String }) data: string | undefined = undefined
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Back to initial screen
|
|
28
|
-
*/
|
|
29
|
-
private handleBack(): void {
|
|
30
|
-
this.dispatchEvent(
|
|
31
|
-
new CustomEvent('on-back', { bubbles: true, composed: true })
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Close modal
|
|
37
|
-
*/
|
|
38
|
-
private handleClose(): void {
|
|
39
|
-
this.dispatchEvent(
|
|
40
|
-
new CustomEvent('on-close', { bubbles: true, composed: true })
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
private get qrCodeOptions(): QRCodeOptions {
|
|
45
|
-
return {
|
|
46
|
-
dotsOptions: {
|
|
47
|
-
color: this.isDark ? '#F5F8FA' : '#243542',
|
|
48
|
-
},
|
|
49
|
-
backgroundOptions: {
|
|
50
|
-
color: this.isDark ? '#243542' : '#FFFFFF',
|
|
51
|
-
},
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render(): TemplateResult<1> {
|
|
56
|
-
return html`<div class="flex justify-between">
|
|
57
|
-
<button
|
|
58
|
-
@click=${this.handleBack}
|
|
59
|
-
>
|
|
60
|
-
${renderBackButton(this.theme)}
|
|
61
|
-
</button>
|
|
62
|
-
|
|
63
|
-
<button
|
|
64
|
-
@click=${this.handleClose}
|
|
65
|
-
>
|
|
66
|
-
${renderCloseButton(this.theme)}
|
|
67
|
-
</button>
|
|
68
|
-
</div>
|
|
69
|
-
<div class="flex flex-col items-center text-center">
|
|
70
|
-
${renderTitle(this.formatMessage('connect_modal_qr_code_title'))}
|
|
71
|
-
|
|
72
|
-
<div class="paragraph-inter-16-regular text-neutral-20 dark:text-neutral-100 mb-4">
|
|
73
|
-
${this.formatMessage('connect_modal_qr_code_description')}
|
|
74
|
-
</div>
|
|
75
|
-
<lukso-qr-code size="320" .value="${this.data}" image="${cubeGlassImage}" .options="${this.qrCodeOptions}" class="rounded-12 overflow-hidden"></lukso-qr-code></div>`
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Register custom element
|
|
80
|
-
customElements.define('qr-code-view', QrCodeView as any)
|
|
81
|
-
|
|
82
|
-
declare global {
|
|
83
|
-
interface HTMLElementTagNameMap {
|
|
84
|
-
'qr-code-view': QrCodeView
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Connect Modal Base - Lit Component
|
|
3
|
-
*
|
|
4
|
-
* Base component for Connect Modal. Provides shared styles for all components.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { css, LitElement, unsafeCSS } from 'lit'
|
|
8
|
-
import output from './styles/styles.css?raw'
|
|
9
|
-
|
|
10
|
-
const style = css`
|
|
11
|
-
${unsafeCSS(output)}
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
export class ConnectModalBase extends LitElement {
|
|
15
|
-
static styles = [style]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default style
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supported wallet IDs (from Reown) for mobile
|
|
3
|
-
*/
|
|
4
|
-
export const SUPPORTED_WALLET_IDS_MOBILE = [
|
|
5
|
-
'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // MetaMask
|
|
6
|
-
]
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Supported wallet IDs (from Reown) for desktop
|
|
10
|
-
*/
|
|
11
|
-
export const SUPPORTED_WALLET_IDS_DESKTOP = [
|
|
12
|
-
'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // MetaMask
|
|
13
|
-
'ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18', // Zerion
|
|
14
|
-
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase
|
|
15
|
-
// '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow - temporary hide due to issue in Wagmi detection of this wallet
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
// Wallets api from https://walletguide.walletconnect.network/
|
|
19
|
-
export const WALLETS_API_URL =
|
|
20
|
-
'https://explorer-api.walletconnect.com/v3/wallets'
|
|
21
|
-
|
|
22
|
-
// Reown project id
|
|
23
|
-
export const REOWN_PROJECT_ID = '68cee9cbecf1293488f207237e89f337'
|
|
24
|
-
|
|
25
|
-
// deep link prefix used by Mobile App
|
|
26
|
-
export const MOBILE_APP_DEEP_LINK_PREFIX =
|
|
27
|
-
'io.universaleverything.universalprofiles'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Theme } from '@lukso/core'
|
|
2
|
-
import { cn } from '@lukso/web-components/tools'
|
|
3
|
-
import { html } from 'lit'
|
|
4
|
-
import cubeGlassImage from './images/up-cube-glass.png'
|
|
5
|
-
|
|
6
|
-
export const renderCloseButton = (theme: Theme) =>
|
|
7
|
-
html`<lukso-icon name="close-lg"
|
|
8
|
-
class="cursor-pointer transition-opacity hover:opacity-60" color="${theme === 'dark' ? 'neutral-100' : 'neutral-20'}"></lukso-icon>`
|
|
9
|
-
|
|
10
|
-
export const renderBackButton = (theme: Theme) =>
|
|
11
|
-
html`<lukso-icon name="arrow-left-lg" class="cursor-pointer transition-opacity hover:opacity-60" color="${theme === 'dark' ? 'neutral-100' : 'neutral-20'}"></lukso-icon>`
|
|
12
|
-
|
|
13
|
-
export const renderLogo = () =>
|
|
14
|
-
html`<img src="${cubeGlassImage}" alt="" class="mb-5 w-14 animate-bounce2" />`
|
|
15
|
-
|
|
16
|
-
export const renderTitle = (title: string) =>
|
|
17
|
-
html`<h2 class="m-0 mb-4 text-neutral-20 dark:text-neutral-100 heading-inter-21-semi-bold">
|
|
18
|
-
${title}
|
|
19
|
-
</h2>`
|
|
20
|
-
|
|
21
|
-
export const renderPlaceholder = (style: string) =>
|
|
22
|
-
html`<div class="${cn('bg-neutral-90 dark:bg-neutral-20 rounded-4 animate-pulse', style)}"></div>`
|