@lukso/up-connector 0.5.0 → 0.5.1-dev.e515cef
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/auto-setup.cjs +3 -3
- package/dist/auto-setup.js +2 -2
- package/dist/{chunk-PB7QP3SJ.cjs → chunk-GCYDV7FB.cjs} +159 -91
- package/dist/chunk-GCYDV7FB.cjs.map +1 -0
- package/dist/{chunk-LCF5SJOE.js → chunk-KMCCANMJ.js} +4 -4
- package/dist/{chunk-LCF5SJOE.js.map → chunk-KMCCANMJ.js.map} +1 -1
- package/dist/{chunk-4PC7ZTI7.js → chunk-SAQWNAQ6.js} +138 -70
- package/dist/chunk-SAQWNAQ6.js.map +1 -0
- package/dist/{chunk-QRZDP5RR.cjs → chunk-W7QI6BTA.cjs} +3 -3
- package/dist/{chunk-QRZDP5RR.cjs.map → chunk-W7QI6BTA.cjs.map} +1 -1
- package/dist/connect-modal/index.cjs +4 -2
- package/dist/connect-modal/index.cjs.map +1 -1
- package/dist/connect-modal/index.d.cts +1 -1
- package/dist/connect-modal/index.d.ts +1 -1
- package/dist/connect-modal/index.js +11 -9
- package/dist/index.cjs +24 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -23
- package/dist/index.js.map +1 -1
- package/dist/{wagmi-BwAJkYMM.d.cts → wagmi-DgjkdmGk.d.cts} +77 -21
- package/dist/{wagmi-BwAJkYMM.d.ts → wagmi-DgjkdmGk.d.ts} +77 -21
- package/package.json +5 -5
- package/src/connect-modal/components/connection-view.ts +4 -1
- package/src/connect-modal/components/eoa-connection-view.ts +4 -0
- package/src/connect-modal/connect-modal.types.ts +4 -0
- package/src/connect-modal/index.ts +6 -4
- package/src/connect-modal/services/wagmi.ts +176 -65
- package/src/connect-modal/utils/chainParams.ts +32 -0
- package/src/connector.ts +18 -12
- package/src/index.ts +6 -4
- package/dist/chunk-4PC7ZTI7.js.map +0 -1
- package/dist/chunk-PB7QP3SJ.cjs.map +0 -1
package/dist/auto-setup.cjs
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkW7QI6BTAcjs = require('./chunk-W7QI6BTA.cjs');
|
|
8
|
+
require('./chunk-GCYDV7FB.cjs');
|
|
9
9
|
require('./chunk-ZBDE64SD.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,5 +13,5 @@ require('./chunk-ZBDE64SD.cjs');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.EMBEDDED_WALLET_ID =
|
|
16
|
+
exports.EMBEDDED_WALLET_ID = _chunkW7QI6BTAcjs.EMBEDDED_WALLET_ID; exports.EMBEDDED_WALLET_URL_DEV = _chunkW7QI6BTAcjs.EMBEDDED_WALLET_URL_DEV; exports.EMBEDDED_WALLET_URL_PROD = _chunkW7QI6BTAcjs.EMBEDDED_WALLET_URL_PROD; exports.UP_EXTENSION_ID = _chunkW7QI6BTAcjs.UP_EXTENSION_ID; exports.setupLuksoConnector = _chunkW7QI6BTAcjs.setupLuksoConnector;
|
|
17
17
|
//# sourceMappingURL=auto-setup.cjs.map
|
package/dist/auto-setup.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
EMBEDDED_WALLET_URL_PROD,
|
|
5
5
|
UP_EXTENSION_ID,
|
|
6
6
|
setupLuksoConnector
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-KMCCANMJ.js";
|
|
8
|
+
import "./chunk-SAQWNAQ6.js";
|
|
9
9
|
import "./chunk-EUXUH3YW.js";
|
|
10
10
|
export {
|
|
11
11
|
EMBEDDED_WALLET_ID,
|
|
@@ -25,9 +25,84 @@ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
|
25
25
|
var _decoratorsjs = require('lit/decorators.js');
|
|
26
26
|
|
|
27
27
|
// src/connect-modal/services/wagmi.ts
|
|
28
|
+
var _chains = require('@lukso/core/chains');
|
|
28
29
|
var _utils = require('@lukso/core/utils');
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// src/connect-modal/utils/chainParams.ts
|
|
33
|
+
function constructAddEthereumChainParameter(chain) {
|
|
34
|
+
return {
|
|
35
|
+
chainName: chain.name,
|
|
36
|
+
nativeCurrency: {
|
|
37
|
+
name: chain.nativeCurrency.name,
|
|
38
|
+
symbol: chain.nativeCurrency.symbol,
|
|
39
|
+
decimals: chain.nativeCurrency.decimals
|
|
40
|
+
},
|
|
41
|
+
rpcUrls: [...chain.rpcUrls.default.http],
|
|
42
|
+
blockExplorerUrls: _optionalChain([chain, 'access', _ => _.blockExplorers, 'optionalAccess', _2 => _2.default, 'access', _3 => _3.url]) ? [chain.blockExplorers.default.url] : void 0
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/connect-modal/services/wagmi.ts
|
|
47
|
+
var logInfo = _debug2.default.call(void 0, "connect-modal:info");
|
|
29
48
|
var UP_EXTENSION_ID = "cloud.universalprofile";
|
|
30
|
-
var
|
|
49
|
+
var WagmiService = class {
|
|
50
|
+
constructor() {
|
|
51
|
+
this.setup = null;
|
|
52
|
+
this.wagmiCore = null;
|
|
53
|
+
}
|
|
54
|
+
configure(setup) {
|
|
55
|
+
this.setup = setup;
|
|
56
|
+
}
|
|
57
|
+
getSetup() {
|
|
58
|
+
return this.setup;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Ensure wagmi/core is loaded and return initialized state
|
|
62
|
+
* Returns { core, config } if ready, null otherwise
|
|
63
|
+
*/
|
|
64
|
+
async init() {
|
|
65
|
+
if (!this.setup) return null;
|
|
66
|
+
if (!this.wagmiCore) {
|
|
67
|
+
try {
|
|
68
|
+
this.wagmiCore = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { core: this.wagmiCore, config: this.setup.wagmiConfig };
|
|
74
|
+
}
|
|
75
|
+
async getConnection() {
|
|
76
|
+
const wagmi = await this.init();
|
|
77
|
+
if (!wagmi) return null;
|
|
78
|
+
try {
|
|
79
|
+
return wagmi.core.getConnection(wagmi.config);
|
|
80
|
+
} catch (e2) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async watchConnection(callback) {
|
|
85
|
+
const wagmi = await this.init();
|
|
86
|
+
if (!wagmi) return null;
|
|
87
|
+
try {
|
|
88
|
+
return wagmi.core.watchConnection(wagmi.config, { onChange: callback });
|
|
89
|
+
} catch (e3) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async disconnect() {
|
|
94
|
+
const wagmi = await this.init();
|
|
95
|
+
if (!wagmi) return false;
|
|
96
|
+
try {
|
|
97
|
+
await wagmi.core.disconnect(wagmi.config);
|
|
98
|
+
return true;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.warn("Failed to disconnect from wagmi", error);
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var wagmiService = new WagmiService();
|
|
31
106
|
function fromWagmiConnector(connector, connectFn, chainId) {
|
|
32
107
|
let type = "injected";
|
|
33
108
|
const rdns = connector.id;
|
|
@@ -48,7 +123,27 @@ function fromWagmiConnector(connector, connectFn, chainId) {
|
|
|
48
123
|
connect: async () => {
|
|
49
124
|
await connectFn({ connector, chainId });
|
|
50
125
|
},
|
|
51
|
-
getProvider: connector.getProvider ? () => connector.getProvider() : void 0
|
|
126
|
+
getProvider: connector.getProvider ? () => connector.getProvider() : void 0,
|
|
127
|
+
switchChain: connector.switchChain ? async (params) => {
|
|
128
|
+
if (!params.chainId) {
|
|
129
|
+
console.warn("No chainId provided for switchChain, skipping");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
let addEthereumChainParameter = params.addEthereumChainParameter;
|
|
133
|
+
if (!addEthereumChainParameter) {
|
|
134
|
+
const chain = _chains.getChainById.call(void 0, params.chainId);
|
|
135
|
+
if (chain) {
|
|
136
|
+
addEthereumChainParameter = constructAddEthereumChainParameter(chain);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
await connector.switchChain({
|
|
140
|
+
chainId: params.chainId,
|
|
141
|
+
addEthereumChainParameter
|
|
142
|
+
});
|
|
143
|
+
logInfo(
|
|
144
|
+
`Switched to chainId ${params.chainId} via connector "${connector.name}"`
|
|
145
|
+
);
|
|
146
|
+
} : void 0
|
|
52
147
|
};
|
|
53
148
|
}
|
|
54
149
|
function fromWagmiConnectors(connectors, connectFn, chainId, embeddedWalletId) {
|
|
@@ -102,52 +197,20 @@ function fromWagmiConnectors(connectors, connectFn, chainId, embeddedWalletId) {
|
|
|
102
197
|
result.push(...others);
|
|
103
198
|
return result;
|
|
104
199
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
200
|
+
function setupWagmi(setup) {
|
|
201
|
+
wagmiService.configure(setup);
|
|
107
202
|
}
|
|
108
203
|
function getWagmiSetup() {
|
|
109
|
-
return
|
|
204
|
+
return wagmiService.getSetup();
|
|
110
205
|
}
|
|
111
|
-
async function
|
|
112
|
-
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
try {
|
|
116
|
-
const { getAccount } = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
117
|
-
const account = getAccount(globalWagmiSetup.wagmiConfig);
|
|
118
|
-
return account;
|
|
119
|
-
} catch (_error) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
206
|
+
async function getConnection() {
|
|
207
|
+
return wagmiService.getConnection();
|
|
122
208
|
}
|
|
123
|
-
async function
|
|
124
|
-
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
try {
|
|
128
|
-
const { watchAccount } = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
129
|
-
const unsubscribe = watchAccount(globalWagmiSetup.wagmiConfig, {
|
|
130
|
-
onChange: (account) => {
|
|
131
|
-
callback(account);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
return unsubscribe;
|
|
135
|
-
} catch (_error) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
209
|
+
async function watchConnection(callback) {
|
|
210
|
+
return wagmiService.watchConnection(callback);
|
|
138
211
|
}
|
|
139
|
-
async function
|
|
140
|
-
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
const { disconnect } = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
145
|
-
await disconnect(globalWagmiSetup.wagmiConfig);
|
|
146
|
-
return true;
|
|
147
|
-
} catch (error) {
|
|
148
|
-
console.warn("Failed to disconnect from wagmi", error);
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
212
|
+
async function disconnect() {
|
|
213
|
+
return wagmiService.disconnect();
|
|
151
214
|
}
|
|
152
215
|
|
|
153
216
|
// src/connect-modal/connect-modal.ts
|
|
@@ -200,7 +263,7 @@ var renderPlaceholder = (style2) => _lit.html`<div class="${_tools.cn.call(void
|
|
|
200
263
|
require('@lukso/web-components/dist/components/lukso-button');
|
|
201
264
|
require('@lukso/web-components/dist/components/lukso-icon');
|
|
202
265
|
require('@lukso/web-components/dist/components/lukso-tag');
|
|
203
|
-
var
|
|
266
|
+
var logInfo2 = _debug2.default.call(void 0, "connect-modal:info");
|
|
204
267
|
var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
205
268
|
_mixins.withDeviceService.call(void 0, ConnectModalBase)
|
|
206
269
|
) {
|
|
@@ -227,14 +290,14 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
227
290
|
);
|
|
228
291
|
return {
|
|
229
292
|
...wallet,
|
|
230
|
-
isInstalled: _optionalChain([connector, 'optionalAccess',
|
|
293
|
+
isInstalled: _optionalChain([connector, 'optionalAccess', _4 => _4.rdns]) === wallet.rdns,
|
|
231
294
|
connector
|
|
232
295
|
};
|
|
233
296
|
}).sort(
|
|
234
297
|
(a, b) => a.isInstalled === b.isInstalled ? 0 : a.isInstalled ? -1 : 1
|
|
235
298
|
);
|
|
236
299
|
},
|
|
237
|
-
args: () => [_optionalChain([this, 'access',
|
|
300
|
+
args: () => [_optionalChain([this, 'access', _5 => _5.device, 'optionalAccess', _6 => _6.isMobile])]
|
|
238
301
|
});
|
|
239
302
|
}
|
|
240
303
|
/**
|
|
@@ -257,31 +320,31 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
257
320
|
* @returns
|
|
258
321
|
*/
|
|
259
322
|
supportedWalletIds() {
|
|
260
|
-
return _optionalChain([this, 'access',
|
|
323
|
+
return _optionalChain([this, 'access', _7 => _7.device, 'optionalAccess', _8 => _8.isMobile]) ? SUPPORTED_WALLET_IDS_MOBILE : SUPPORTED_WALLET_IDS_DESKTOP;
|
|
261
324
|
}
|
|
262
325
|
/**
|
|
263
326
|
* Get device type
|
|
264
327
|
*/
|
|
265
328
|
deviceType() {
|
|
266
|
-
if (_optionalChain([this, 'access',
|
|
267
|
-
if (_optionalChain([this, 'access',
|
|
329
|
+
if (_optionalChain([this, 'access', _9 => _9.device, 'optionalAccess', _10 => _10.isMobile]) || _optionalChain([this, 'access', _11 => _11.device, 'optionalAccess', _12 => _12.isTablet])) {
|
|
330
|
+
if (_optionalChain([this, 'access', _13 => _13.device, 'optionalAccess', _14 => _14.isIOS])) {
|
|
268
331
|
return "ios";
|
|
269
332
|
}
|
|
270
333
|
return "android";
|
|
271
334
|
}
|
|
272
|
-
if (_optionalChain([this, 'access',
|
|
335
|
+
if (_optionalChain([this, 'access', _15 => _15.device, 'optionalAccess', _16 => _16.isChrome])) {
|
|
273
336
|
return "chrome";
|
|
274
337
|
}
|
|
275
|
-
if (_optionalChain([this, 'access',
|
|
338
|
+
if (_optionalChain([this, 'access', _17 => _17.device, 'optionalAccess', _18 => _18.isFirefox])) {
|
|
276
339
|
return "firefox";
|
|
277
340
|
}
|
|
278
|
-
if (_optionalChain([this, 'access',
|
|
341
|
+
if (_optionalChain([this, 'access', _19 => _19.device, 'optionalAccess', _20 => _20.isSafari])) {
|
|
279
342
|
return "safari";
|
|
280
343
|
}
|
|
281
|
-
if (_optionalChain([this, 'access',
|
|
344
|
+
if (_optionalChain([this, 'access', _21 => _21.device, 'optionalAccess', _22 => _22.isEdge])) {
|
|
282
345
|
return "edge";
|
|
283
346
|
}
|
|
284
|
-
if (_optionalChain([this, 'access',
|
|
347
|
+
if (_optionalChain([this, 'access', _23 => _23.device, 'optionalAccess', _24 => _24.isOpera])) {
|
|
285
348
|
return "opera";
|
|
286
349
|
}
|
|
287
350
|
return "browser";
|
|
@@ -310,7 +373,7 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
310
373
|
handleConnect(wallet, event) {
|
|
311
374
|
event.stopPropagation();
|
|
312
375
|
this.connectingRdns = wallet.rdns;
|
|
313
|
-
if (_optionalChain([this, 'access',
|
|
376
|
+
if (_optionalChain([this, 'access', _25 => _25.device, 'optionalAccess', _26 => _26.isMobile])) {
|
|
314
377
|
this.connectMobile(wallet);
|
|
315
378
|
return;
|
|
316
379
|
}
|
|
@@ -329,8 +392,10 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
329
392
|
const connector = wallet.connector;
|
|
330
393
|
if (connector) {
|
|
331
394
|
try {
|
|
332
|
-
|
|
395
|
+
logInfo2("Connecting via connector:", connector);
|
|
333
396
|
this.isConnecting = true;
|
|
397
|
+
const setup = getWagmiSetup();
|
|
398
|
+
await _optionalChain([connector, 'access', _27 => _27.switchChain, 'optionalCall', _28 => _28({ chainId: _optionalChain([setup, 'optionalAccess', _29 => _29.chainId]) })]);
|
|
334
399
|
await connector.connect();
|
|
335
400
|
this.dispatchEvent(
|
|
336
401
|
new CustomEvent("on-connect", {
|
|
@@ -359,15 +424,15 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
359
424
|
const connector = this.walletConnectConnector;
|
|
360
425
|
if (connector) {
|
|
361
426
|
try {
|
|
362
|
-
|
|
427
|
+
logInfo2("Connecting via WalletConnect connector:", connector);
|
|
363
428
|
this.isConnecting = true;
|
|
364
429
|
const connectPromise = connector.connect();
|
|
365
|
-
const provider = await _optionalChain([connector, 'access',
|
|
430
|
+
const provider = await _optionalChain([connector, 'access', _30 => _30.getProvider, 'optionalCall', _31 => _31()]);
|
|
366
431
|
if (provider) {
|
|
367
432
|
const handleDisplayUri = (displayUri) => {
|
|
368
|
-
|
|
433
|
+
logInfo2("WalletConnect URI received:", displayUri);
|
|
369
434
|
const encodedUri = encodeURIComponent(displayUri);
|
|
370
|
-
if (_optionalChain([wallet, 'access',
|
|
435
|
+
if (_optionalChain([wallet, 'access', _32 => _32.mobile, 'optionalAccess', _33 => _33.native])) {
|
|
371
436
|
window.location.href = `${wallet.mobile.native}wc?uri=${encodedUri}`;
|
|
372
437
|
} else if (wallet.rdns === "com.coinbase.wallet") {
|
|
373
438
|
window.location.href = `cbwallet://wc?uri=${encodedUri}`;
|
|
@@ -410,12 +475,12 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
410
475
|
const isInstalled = this.eoaConnectors.some(
|
|
411
476
|
(connector) => connector.rdns === wallet.rdns
|
|
412
477
|
);
|
|
413
|
-
const logo = _optionalChain([wallet, 'access',
|
|
478
|
+
const logo = _optionalChain([wallet, 'access', _34 => _34.image_url, 'optionalAccess', _35 => _35.sm]) ? _lit.html`<img src="${wallet.image_url.sm}" alt="${wallet.name} logo" class="h-8 rounded-full mr-2" />` : _lit.nothing;
|
|
414
479
|
return _keyedjs.keyed.call(void 0,
|
|
415
480
|
wallet.slug,
|
|
416
481
|
_lit.html`<lukso-button
|
|
417
482
|
variant="secondary"
|
|
418
|
-
size=${_optionalChain([this, 'access',
|
|
483
|
+
size=${_optionalChain([this, 'access', _36 => _36.device, 'optionalAccess', _37 => _37.isMobile]) ? "medium" : "large"}
|
|
419
484
|
is-full-width
|
|
420
485
|
?disabled=${this.isConnecting}
|
|
421
486
|
?is-loading=${isLoading}
|
|
@@ -443,7 +508,7 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
443
508
|
// Loading state
|
|
444
509
|
pending: () => _lit.html`${this.supportedWalletIds().map(
|
|
445
510
|
() => renderPlaceholder(
|
|
446
|
-
`w-full ${_optionalChain([this, 'access',
|
|
511
|
+
`w-full ${_optionalChain([this, 'access', _38 => _38.device, 'optionalAccess', _39 => _39.isMobile]) ? "h-10 !rounded-10" : "h-12 !rounded-12"}`
|
|
447
512
|
)
|
|
448
513
|
)}`,
|
|
449
514
|
// Error state
|
|
@@ -511,7 +576,7 @@ var walletConnectDeepLinkUrl = (data, options) => {
|
|
|
511
576
|
return "";
|
|
512
577
|
}
|
|
513
578
|
const dataUrl = new URL(data);
|
|
514
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
579
|
+
if (_optionalChain([options, 'optionalAccess', _40 => _40.withRedirectUrl])) {
|
|
515
580
|
const redirectUrl = new URL(location.href);
|
|
516
581
|
redirectUrl.searchParams.delete("modalTemplate");
|
|
517
582
|
redirectUrl.searchParams.delete("modalSize");
|
|
@@ -529,7 +594,7 @@ var walletConnectDeepLinkUrl = (data, options) => {
|
|
|
529
594
|
};
|
|
530
595
|
|
|
531
596
|
// src/connect-modal/components/connection-view.ts
|
|
532
|
-
var
|
|
597
|
+
var logInfo3 = _debug2.default.call(void 0, "connect-modal:info");
|
|
533
598
|
var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
534
599
|
_mixins.withDeviceService.call(void 0, ConnectModalBase)
|
|
535
600
|
) {
|
|
@@ -544,8 +609,8 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
544
609
|
this.handleConnectEmbedded = async () => {
|
|
545
610
|
const connector = this.embeddedWalletConnector;
|
|
546
611
|
try {
|
|
547
|
-
|
|
548
|
-
await _optionalChain([connector, 'optionalAccess',
|
|
612
|
+
logInfo3("Connecting via connector:", connector);
|
|
613
|
+
await _optionalChain([connector, 'optionalAccess', _41 => _41.connect, 'call', _42 => _42()]);
|
|
549
614
|
this.dispatchEvent(
|
|
550
615
|
new CustomEvent("on-connect", {
|
|
551
616
|
detail: { connector },
|
|
@@ -574,9 +639,11 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
574
639
|
}
|
|
575
640
|
if (connector) {
|
|
576
641
|
try {
|
|
577
|
-
|
|
642
|
+
logInfo3("Connecting via connector:", connector);
|
|
578
643
|
this.isConnecting = true;
|
|
579
644
|
this.connectingRdns = connector.rdns;
|
|
645
|
+
const setup = getWagmiSetup();
|
|
646
|
+
await _optionalChain([connector, 'access', _43 => _43.switchChain, 'optionalCall', _44 => _44({ chainId: _optionalChain([setup, 'optionalAccess', _45 => _45.chainId]) })]);
|
|
580
647
|
await connector.connect();
|
|
581
648
|
this.dispatchEvent(
|
|
582
649
|
new CustomEvent("on-connect", {
|
|
@@ -606,16 +673,16 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
606
673
|
const connector = this.walletConnectConnector;
|
|
607
674
|
if (connector) {
|
|
608
675
|
try {
|
|
609
|
-
|
|
676
|
+
logInfo3("Connecting via connector:", connector);
|
|
610
677
|
this.isConnecting = true;
|
|
611
678
|
this.connectingRdns = connector.rdns;
|
|
612
679
|
const connectPromise = connector.connect();
|
|
613
|
-
const provider = await _optionalChain([connector, 'access',
|
|
680
|
+
const provider = await _optionalChain([connector, 'access', _46 => _46.getProvider, 'optionalCall', _47 => _47()]);
|
|
614
681
|
if (provider) {
|
|
615
682
|
const handleDisplayUri = (displayUri) => {
|
|
616
|
-
|
|
683
|
+
logInfo3("WalletConnect original URI:", displayUri);
|
|
617
684
|
const deepLink = walletConnectDeepLinkUrl(displayUri);
|
|
618
|
-
|
|
685
|
+
logInfo3("Mobile App Deep Link:", deepLink);
|
|
619
686
|
if (this.device.isMobile) {
|
|
620
687
|
window.open(deepLink, "_blank");
|
|
621
688
|
} else {
|
|
@@ -726,7 +793,7 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
726
793
|
return _lit.html`
|
|
727
794
|
<lukso-button
|
|
728
795
|
variant="secondary"
|
|
729
|
-
size=${_optionalChain([this, 'access',
|
|
796
|
+
size=${_optionalChain([this, 'access', _48 => _48.device, 'optionalAccess', _49 => _49.isMobile]) ? "medium" : "large"}
|
|
730
797
|
is-full-width
|
|
731
798
|
?disabled=${isDisabled}
|
|
732
799
|
?is-loading=${isLoading}
|
|
@@ -735,7 +802,7 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
735
802
|
>
|
|
736
803
|
<lukso-icon
|
|
737
804
|
name=${iconName}
|
|
738
|
-
size=${_optionalChain([this, 'access',
|
|
805
|
+
size=${_optionalChain([this, 'access', _50 => _50.device, 'optionalAccess', _51 => _51.isMobile]) ? "small" : "medium"}
|
|
739
806
|
class="mr-2"
|
|
740
807
|
secondary-color="neutral-100"
|
|
741
808
|
></lukso-icon>
|
|
@@ -761,7 +828,7 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
761
828
|
this.extensionStore.icon,
|
|
762
829
|
this.formatMessage("connect_modal_connectors_up_browser_extension"),
|
|
763
830
|
this.handleConnectExtension,
|
|
764
|
-
this.isConnecting && this.connectingRdns === _optionalChain([this, 'access',
|
|
831
|
+
this.isConnecting && this.connectingRdns === _optionalChain([this, 'access', _52 => _52.upExtensionConnector, 'optionalAccess', _53 => _53.rdns]),
|
|
765
832
|
this.isConnecting || this.device.isMobile || !this.browserSupportExtension
|
|
766
833
|
)
|
|
767
834
|
);
|
|
@@ -809,20 +876,20 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
809
876
|
<p class="mb-6 paragraph-inter-16-regular">
|
|
810
877
|
${this.formatMessage("connect_modal_description")}
|
|
811
878
|
</p>
|
|
812
|
-
<div class="${_tools.cn.call(void 0, "flex w-full gap-2 mb-4", _optionalChain([this, 'access',
|
|
879
|
+
<div class="${_tools.cn.call(void 0, "flex w-full gap-2 mb-4", _optionalChain([this, 'access', _54 => _54.device, 'optionalAccess', _55 => _55.isMobile]) ? "flex-col-reverse" : "flex-col")}">
|
|
813
880
|
${this.renderConnectors()}
|
|
814
881
|
</div>
|
|
815
882
|
${this.renderDivider()}
|
|
816
883
|
<lukso-button
|
|
817
884
|
variant="secondary"
|
|
818
|
-
size=${_optionalChain([this, 'access',
|
|
885
|
+
size=${_optionalChain([this, 'access', _56 => _56.device, 'optionalAccess', _57 => _57.isMobile]) ? "medium" : "large"}
|
|
819
886
|
is-full-width
|
|
820
887
|
?disabled=${this.isConnecting}
|
|
821
888
|
@click=${this.handleShowEoaConnections}
|
|
822
889
|
>
|
|
823
890
|
<lukso-icon
|
|
824
891
|
name="wallet-outline"
|
|
825
|
-
size=${_optionalChain([this, 'access',
|
|
892
|
+
size=${_optionalChain([this, 'access', _58 => _58.device, 'optionalAccess', _59 => _59.isMobile]) ? "small" : "medium"}
|
|
826
893
|
class="mr-2"
|
|
827
894
|
></lukso-icon>
|
|
828
895
|
${this.formatMessage("connect_modal_other_connectors")}
|
|
@@ -898,7 +965,7 @@ _chunkZBDE64SDcjs.__decorateClass.call(void 0, [
|
|
|
898
965
|
customElements.define("qr-code-view", QrCodeView);
|
|
899
966
|
|
|
900
967
|
// src/connect-modal/connect-modal.ts
|
|
901
|
-
var
|
|
968
|
+
var logInfo4 = _debug2.default.call(void 0, "connect-modal:info");
|
|
902
969
|
var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectModalBase) {
|
|
903
970
|
constructor() {
|
|
904
971
|
super(...arguments);
|
|
@@ -976,9 +1043,9 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
976
1043
|
}
|
|
977
1044
|
}
|
|
978
1045
|
async loadConnectors() {
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
if (!
|
|
1046
|
+
const globalWagmiSetup = getWagmiSetup();
|
|
1047
|
+
logInfo4("Global wagmi setup:", globalWagmiSetup);
|
|
1048
|
+
if (!globalWagmiSetup) {
|
|
982
1049
|
console.warn(
|
|
983
1050
|
"No global wagmi setup found! Call setupConnectModal() first."
|
|
984
1051
|
);
|
|
@@ -986,9 +1053,9 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
986
1053
|
return;
|
|
987
1054
|
}
|
|
988
1055
|
try {
|
|
989
|
-
const { wagmiConfig, chainId, embeddedWalletId } =
|
|
990
|
-
const wagmiConnectors = _optionalChain([wagmiConfig, 'optionalAccess',
|
|
991
|
-
|
|
1056
|
+
const { wagmiConfig, chainId, embeddedWalletId } = globalWagmiSetup;
|
|
1057
|
+
const wagmiConnectors = _optionalChain([wagmiConfig, 'optionalAccess', _60 => _60.connectors]) || [];
|
|
1058
|
+
logInfo4("Initial connectors:", wagmiConnectors);
|
|
992
1059
|
const wagmiCore = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core"))).catch((error) => {
|
|
993
1060
|
throw new Error("@wagmi/core is required when using wagmi connectors", {
|
|
994
1061
|
cause: error
|
|
@@ -1005,7 +1072,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1005
1072
|
chainId,
|
|
1006
1073
|
embeddedWalletId
|
|
1007
1074
|
);
|
|
1008
|
-
|
|
1075
|
+
logInfo4("Converted connectors:", this.connectors);
|
|
1009
1076
|
} catch (error) {
|
|
1010
1077
|
console.warn("Failed to load connectors", error);
|
|
1011
1078
|
this.connectors = [];
|
|
@@ -1019,7 +1086,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1019
1086
|
handleOnConnectSuccess(event) {
|
|
1020
1087
|
event.stopPropagation();
|
|
1021
1088
|
const connector = event.detail.connector;
|
|
1022
|
-
|
|
1089
|
+
logInfo4("Connection success:", connector);
|
|
1023
1090
|
this.open = false;
|
|
1024
1091
|
this.dispatchEvent(
|
|
1025
1092
|
new CustomEvent("on-connect", {
|
|
@@ -1037,7 +1104,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1037
1104
|
handleOnConnectError(event) {
|
|
1038
1105
|
event.stopPropagation();
|
|
1039
1106
|
const error = event.detail.error;
|
|
1040
|
-
|
|
1107
|
+
logInfo4("Connection error:", error);
|
|
1041
1108
|
this.dispatchEvent(
|
|
1042
1109
|
new CustomEvent("on-error", {
|
|
1043
1110
|
detail: { error },
|
|
@@ -1087,7 +1154,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1087
1154
|
return _lit.html`
|
|
1088
1155
|
<lukso-modal
|
|
1089
1156
|
?is-open=${this.open}
|
|
1090
|
-
?has-bottom-padding=${!!(_optionalChain([this, 'access',
|
|
1157
|
+
?has-bottom-padding=${!!(_optionalChain([this, 'access', _61 => _61.device, 'optionalAccess', _62 => _62.isIOS]) && _optionalChain([this, 'access', _63 => _63.device, 'optionalAccess', _64 => _64.isSafari]))}
|
|
1091
1158
|
size="auto"
|
|
1092
1159
|
@on-backdrop-click=${this.handleClose}
|
|
1093
1160
|
>
|
|
@@ -1128,5 +1195,6 @@ customElements.define("connect-modal", ConnectModal);
|
|
|
1128
1195
|
|
|
1129
1196
|
|
|
1130
1197
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1198
|
+
|
|
1199
|
+
exports.ConnectModalBase = ConnectModalBase; exports.wagmiService = wagmiService; exports.fromWagmiConnector = fromWagmiConnector; exports.fromWagmiConnectors = fromWagmiConnectors; exports.setupWagmi = setupWagmi; exports.getWagmiSetup = getWagmiSetup; exports.getConnection = getConnection; exports.watchConnection = watchConnection; exports.disconnect = disconnect; exports.ConnectModal = ConnectModal;
|
|
1200
|
+
//# sourceMappingURL=chunk-GCYDV7FB.cjs.map
|