@lukso/up-connector 0.5.0-dev.1d32611 → 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-CN2BMW6Y.cjs → chunk-GCYDV7FB.cjs} +159 -101
- package/dist/chunk-GCYDV7FB.cjs.map +1 -0
- package/dist/{chunk-5P7EGEE5.js → chunk-KMCCANMJ.js} +4 -4
- package/dist/{chunk-5P7EGEE5.js.map → chunk-KMCCANMJ.js.map} +1 -1
- package/dist/{chunk-3ME6PKYE.js → chunk-SAQWNAQ6.js} +138 -80
- package/dist/chunk-SAQWNAQ6.js.map +1 -0
- package/dist/{chunk-M4UJAKZ2.cjs → chunk-W7QI6BTA.cjs} +3 -3
- package/dist/{chunk-M4UJAKZ2.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-BLnqILO_.d.cts → wagmi-DgjkdmGk.d.cts} +77 -21
- package/dist/{wagmi-BLnqILO_.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 -76
- package/src/connect-modal/utils/chainParams.ts +32 -0
- package/src/connector.ts +18 -12
- package/src/index.ts +6 -4
- package/dist/chunk-3ME6PKYE.js.map +0 -1
- package/dist/chunk-CN2BMW6Y.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,62 +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 { getConnection } = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
117
|
-
const connection = getConnection(globalWagmiSetup.wagmiConfig);
|
|
118
|
-
return {
|
|
119
|
-
isConnected: connection.status === "connected",
|
|
120
|
-
address: connection.address,
|
|
121
|
-
chainId: connection.chainId,
|
|
122
|
-
connector: connection.connector
|
|
123
|
-
};
|
|
124
|
-
} catch (_error) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
206
|
+
async function getConnection() {
|
|
207
|
+
return wagmiService.getConnection();
|
|
127
208
|
}
|
|
128
|
-
async function
|
|
129
|
-
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
try {
|
|
133
|
-
const { watchConnection } = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
134
|
-
const unsubscribe = watchConnection(globalWagmiSetup.wagmiConfig, {
|
|
135
|
-
onChange: (connection) => {
|
|
136
|
-
callback({
|
|
137
|
-
isConnected: connection.status === "connected",
|
|
138
|
-
address: connection.address,
|
|
139
|
-
chainId: connection.chainId,
|
|
140
|
-
connector: connection.connector
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return unsubscribe;
|
|
145
|
-
} catch (_error) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
209
|
+
async function watchConnection(callback) {
|
|
210
|
+
return wagmiService.watchConnection(callback);
|
|
148
211
|
}
|
|
149
|
-
async function
|
|
150
|
-
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
try {
|
|
154
|
-
const { disconnect } = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core")));
|
|
155
|
-
await disconnect(globalWagmiSetup.wagmiConfig);
|
|
156
|
-
return true;
|
|
157
|
-
} catch (error) {
|
|
158
|
-
console.warn("Failed to disconnect from wagmi", error);
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
212
|
+
async function disconnect() {
|
|
213
|
+
return wagmiService.disconnect();
|
|
161
214
|
}
|
|
162
215
|
|
|
163
216
|
// src/connect-modal/connect-modal.ts
|
|
@@ -210,7 +263,7 @@ var renderPlaceholder = (style2) => _lit.html`<div class="${_tools.cn.call(void
|
|
|
210
263
|
require('@lukso/web-components/dist/components/lukso-button');
|
|
211
264
|
require('@lukso/web-components/dist/components/lukso-icon');
|
|
212
265
|
require('@lukso/web-components/dist/components/lukso-tag');
|
|
213
|
-
var
|
|
266
|
+
var logInfo2 = _debug2.default.call(void 0, "connect-modal:info");
|
|
214
267
|
var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
215
268
|
_mixins.withDeviceService.call(void 0, ConnectModalBase)
|
|
216
269
|
) {
|
|
@@ -237,14 +290,14 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
237
290
|
);
|
|
238
291
|
return {
|
|
239
292
|
...wallet,
|
|
240
|
-
isInstalled: _optionalChain([connector, 'optionalAccess',
|
|
293
|
+
isInstalled: _optionalChain([connector, 'optionalAccess', _4 => _4.rdns]) === wallet.rdns,
|
|
241
294
|
connector
|
|
242
295
|
};
|
|
243
296
|
}).sort(
|
|
244
297
|
(a, b) => a.isInstalled === b.isInstalled ? 0 : a.isInstalled ? -1 : 1
|
|
245
298
|
);
|
|
246
299
|
},
|
|
247
|
-
args: () => [_optionalChain([this, 'access',
|
|
300
|
+
args: () => [_optionalChain([this, 'access', _5 => _5.device, 'optionalAccess', _6 => _6.isMobile])]
|
|
248
301
|
});
|
|
249
302
|
}
|
|
250
303
|
/**
|
|
@@ -267,31 +320,31 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
267
320
|
* @returns
|
|
268
321
|
*/
|
|
269
322
|
supportedWalletIds() {
|
|
270
|
-
return _optionalChain([this, 'access',
|
|
323
|
+
return _optionalChain([this, 'access', _7 => _7.device, 'optionalAccess', _8 => _8.isMobile]) ? SUPPORTED_WALLET_IDS_MOBILE : SUPPORTED_WALLET_IDS_DESKTOP;
|
|
271
324
|
}
|
|
272
325
|
/**
|
|
273
326
|
* Get device type
|
|
274
327
|
*/
|
|
275
328
|
deviceType() {
|
|
276
|
-
if (_optionalChain([this, 'access',
|
|
277
|
-
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])) {
|
|
278
331
|
return "ios";
|
|
279
332
|
}
|
|
280
333
|
return "android";
|
|
281
334
|
}
|
|
282
|
-
if (_optionalChain([this, 'access',
|
|
335
|
+
if (_optionalChain([this, 'access', _15 => _15.device, 'optionalAccess', _16 => _16.isChrome])) {
|
|
283
336
|
return "chrome";
|
|
284
337
|
}
|
|
285
|
-
if (_optionalChain([this, 'access',
|
|
338
|
+
if (_optionalChain([this, 'access', _17 => _17.device, 'optionalAccess', _18 => _18.isFirefox])) {
|
|
286
339
|
return "firefox";
|
|
287
340
|
}
|
|
288
|
-
if (_optionalChain([this, 'access',
|
|
341
|
+
if (_optionalChain([this, 'access', _19 => _19.device, 'optionalAccess', _20 => _20.isSafari])) {
|
|
289
342
|
return "safari";
|
|
290
343
|
}
|
|
291
|
-
if (_optionalChain([this, 'access',
|
|
344
|
+
if (_optionalChain([this, 'access', _21 => _21.device, 'optionalAccess', _22 => _22.isEdge])) {
|
|
292
345
|
return "edge";
|
|
293
346
|
}
|
|
294
|
-
if (_optionalChain([this, 'access',
|
|
347
|
+
if (_optionalChain([this, 'access', _23 => _23.device, 'optionalAccess', _24 => _24.isOpera])) {
|
|
295
348
|
return "opera";
|
|
296
349
|
}
|
|
297
350
|
return "browser";
|
|
@@ -320,7 +373,7 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
320
373
|
handleConnect(wallet, event) {
|
|
321
374
|
event.stopPropagation();
|
|
322
375
|
this.connectingRdns = wallet.rdns;
|
|
323
|
-
if (_optionalChain([this, 'access',
|
|
376
|
+
if (_optionalChain([this, 'access', _25 => _25.device, 'optionalAccess', _26 => _26.isMobile])) {
|
|
324
377
|
this.connectMobile(wallet);
|
|
325
378
|
return;
|
|
326
379
|
}
|
|
@@ -339,8 +392,10 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
339
392
|
const connector = wallet.connector;
|
|
340
393
|
if (connector) {
|
|
341
394
|
try {
|
|
342
|
-
|
|
395
|
+
logInfo2("Connecting via connector:", connector);
|
|
343
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]) })]);
|
|
344
399
|
await connector.connect();
|
|
345
400
|
this.dispatchEvent(
|
|
346
401
|
new CustomEvent("on-connect", {
|
|
@@ -369,15 +424,15 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
369
424
|
const connector = this.walletConnectConnector;
|
|
370
425
|
if (connector) {
|
|
371
426
|
try {
|
|
372
|
-
|
|
427
|
+
logInfo2("Connecting via WalletConnect connector:", connector);
|
|
373
428
|
this.isConnecting = true;
|
|
374
429
|
const connectPromise = connector.connect();
|
|
375
|
-
const provider = await _optionalChain([connector, 'access',
|
|
430
|
+
const provider = await _optionalChain([connector, 'access', _30 => _30.getProvider, 'optionalCall', _31 => _31()]);
|
|
376
431
|
if (provider) {
|
|
377
432
|
const handleDisplayUri = (displayUri) => {
|
|
378
|
-
|
|
433
|
+
logInfo2("WalletConnect URI received:", displayUri);
|
|
379
434
|
const encodedUri = encodeURIComponent(displayUri);
|
|
380
|
-
if (_optionalChain([wallet, 'access',
|
|
435
|
+
if (_optionalChain([wallet, 'access', _32 => _32.mobile, 'optionalAccess', _33 => _33.native])) {
|
|
381
436
|
window.location.href = `${wallet.mobile.native}wc?uri=${encodedUri}`;
|
|
382
437
|
} else if (wallet.rdns === "com.coinbase.wallet") {
|
|
383
438
|
window.location.href = `cbwallet://wc?uri=${encodedUri}`;
|
|
@@ -420,12 +475,12 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
420
475
|
const isInstalled = this.eoaConnectors.some(
|
|
421
476
|
(connector) => connector.rdns === wallet.rdns
|
|
422
477
|
);
|
|
423
|
-
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;
|
|
424
479
|
return _keyedjs.keyed.call(void 0,
|
|
425
480
|
wallet.slug,
|
|
426
481
|
_lit.html`<lukso-button
|
|
427
482
|
variant="secondary"
|
|
428
|
-
size=${_optionalChain([this, 'access',
|
|
483
|
+
size=${_optionalChain([this, 'access', _36 => _36.device, 'optionalAccess', _37 => _37.isMobile]) ? "medium" : "large"}
|
|
429
484
|
is-full-width
|
|
430
485
|
?disabled=${this.isConnecting}
|
|
431
486
|
?is-loading=${isLoading}
|
|
@@ -453,7 +508,7 @@ var EoaConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
453
508
|
// Loading state
|
|
454
509
|
pending: () => _lit.html`${this.supportedWalletIds().map(
|
|
455
510
|
() => renderPlaceholder(
|
|
456
|
-
`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"}`
|
|
457
512
|
)
|
|
458
513
|
)}`,
|
|
459
514
|
// Error state
|
|
@@ -521,7 +576,7 @@ var walletConnectDeepLinkUrl = (data, options) => {
|
|
|
521
576
|
return "";
|
|
522
577
|
}
|
|
523
578
|
const dataUrl = new URL(data);
|
|
524
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
579
|
+
if (_optionalChain([options, 'optionalAccess', _40 => _40.withRedirectUrl])) {
|
|
525
580
|
const redirectUrl = new URL(location.href);
|
|
526
581
|
redirectUrl.searchParams.delete("modalTemplate");
|
|
527
582
|
redirectUrl.searchParams.delete("modalSize");
|
|
@@ -539,7 +594,7 @@ var walletConnectDeepLinkUrl = (data, options) => {
|
|
|
539
594
|
};
|
|
540
595
|
|
|
541
596
|
// src/connect-modal/components/connection-view.ts
|
|
542
|
-
var
|
|
597
|
+
var logInfo3 = _debug2.default.call(void 0, "connect-modal:info");
|
|
543
598
|
var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
544
599
|
_mixins.withDeviceService.call(void 0, ConnectModalBase)
|
|
545
600
|
) {
|
|
@@ -554,8 +609,8 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
554
609
|
this.handleConnectEmbedded = async () => {
|
|
555
610
|
const connector = this.embeddedWalletConnector;
|
|
556
611
|
try {
|
|
557
|
-
|
|
558
|
-
await _optionalChain([connector, 'optionalAccess',
|
|
612
|
+
logInfo3("Connecting via connector:", connector);
|
|
613
|
+
await _optionalChain([connector, 'optionalAccess', _41 => _41.connect, 'call', _42 => _42()]);
|
|
559
614
|
this.dispatchEvent(
|
|
560
615
|
new CustomEvent("on-connect", {
|
|
561
616
|
detail: { connector },
|
|
@@ -584,9 +639,11 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
584
639
|
}
|
|
585
640
|
if (connector) {
|
|
586
641
|
try {
|
|
587
|
-
|
|
642
|
+
logInfo3("Connecting via connector:", connector);
|
|
588
643
|
this.isConnecting = true;
|
|
589
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]) })]);
|
|
590
647
|
await connector.connect();
|
|
591
648
|
this.dispatchEvent(
|
|
592
649
|
new CustomEvent("on-connect", {
|
|
@@ -616,16 +673,16 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
616
673
|
const connector = this.walletConnectConnector;
|
|
617
674
|
if (connector) {
|
|
618
675
|
try {
|
|
619
|
-
|
|
676
|
+
logInfo3("Connecting via connector:", connector);
|
|
620
677
|
this.isConnecting = true;
|
|
621
678
|
this.connectingRdns = connector.rdns;
|
|
622
679
|
const connectPromise = connector.connect();
|
|
623
|
-
const provider = await _optionalChain([connector, 'access',
|
|
680
|
+
const provider = await _optionalChain([connector, 'access', _46 => _46.getProvider, 'optionalCall', _47 => _47()]);
|
|
624
681
|
if (provider) {
|
|
625
682
|
const handleDisplayUri = (displayUri) => {
|
|
626
|
-
|
|
683
|
+
logInfo3("WalletConnect original URI:", displayUri);
|
|
627
684
|
const deepLink = walletConnectDeepLinkUrl(displayUri);
|
|
628
|
-
|
|
685
|
+
logInfo3("Mobile App Deep Link:", deepLink);
|
|
629
686
|
if (this.device.isMobile) {
|
|
630
687
|
window.open(deepLink, "_blank");
|
|
631
688
|
} else {
|
|
@@ -736,7 +793,7 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
736
793
|
return _lit.html`
|
|
737
794
|
<lukso-button
|
|
738
795
|
variant="secondary"
|
|
739
|
-
size=${_optionalChain([this, 'access',
|
|
796
|
+
size=${_optionalChain([this, 'access', _48 => _48.device, 'optionalAccess', _49 => _49.isMobile]) ? "medium" : "large"}
|
|
740
797
|
is-full-width
|
|
741
798
|
?disabled=${isDisabled}
|
|
742
799
|
?is-loading=${isLoading}
|
|
@@ -745,7 +802,7 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
745
802
|
>
|
|
746
803
|
<lukso-icon
|
|
747
804
|
name=${iconName}
|
|
748
|
-
size=${_optionalChain([this, 'access',
|
|
805
|
+
size=${_optionalChain([this, 'access', _50 => _50.device, 'optionalAccess', _51 => _51.isMobile]) ? "small" : "medium"}
|
|
749
806
|
class="mr-2"
|
|
750
807
|
secondary-color="neutral-100"
|
|
751
808
|
></lukso-icon>
|
|
@@ -771,7 +828,7 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
771
828
|
this.extensionStore.icon,
|
|
772
829
|
this.formatMessage("connect_modal_connectors_up_browser_extension"),
|
|
773
830
|
this.handleConnectExtension,
|
|
774
|
-
this.isConnecting && this.connectingRdns === _optionalChain([this, 'access',
|
|
831
|
+
this.isConnecting && this.connectingRdns === _optionalChain([this, 'access', _52 => _52.upExtensionConnector, 'optionalAccess', _53 => _53.rdns]),
|
|
775
832
|
this.isConnecting || this.device.isMobile || !this.browserSupportExtension
|
|
776
833
|
)
|
|
777
834
|
);
|
|
@@ -819,20 +876,20 @@ var ConnectionView = class extends _mixins.withIntlService.call(void 0,
|
|
|
819
876
|
<p class="mb-6 paragraph-inter-16-regular">
|
|
820
877
|
${this.formatMessage("connect_modal_description")}
|
|
821
878
|
</p>
|
|
822
|
-
<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")}">
|
|
823
880
|
${this.renderConnectors()}
|
|
824
881
|
</div>
|
|
825
882
|
${this.renderDivider()}
|
|
826
883
|
<lukso-button
|
|
827
884
|
variant="secondary"
|
|
828
|
-
size=${_optionalChain([this, 'access',
|
|
885
|
+
size=${_optionalChain([this, 'access', _56 => _56.device, 'optionalAccess', _57 => _57.isMobile]) ? "medium" : "large"}
|
|
829
886
|
is-full-width
|
|
830
887
|
?disabled=${this.isConnecting}
|
|
831
888
|
@click=${this.handleShowEoaConnections}
|
|
832
889
|
>
|
|
833
890
|
<lukso-icon
|
|
834
891
|
name="wallet-outline"
|
|
835
|
-
size=${_optionalChain([this, 'access',
|
|
892
|
+
size=${_optionalChain([this, 'access', _58 => _58.device, 'optionalAccess', _59 => _59.isMobile]) ? "small" : "medium"}
|
|
836
893
|
class="mr-2"
|
|
837
894
|
></lukso-icon>
|
|
838
895
|
${this.formatMessage("connect_modal_other_connectors")}
|
|
@@ -908,7 +965,7 @@ _chunkZBDE64SDcjs.__decorateClass.call(void 0, [
|
|
|
908
965
|
customElements.define("qr-code-view", QrCodeView);
|
|
909
966
|
|
|
910
967
|
// src/connect-modal/connect-modal.ts
|
|
911
|
-
var
|
|
968
|
+
var logInfo4 = _debug2.default.call(void 0, "connect-modal:info");
|
|
912
969
|
var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectModalBase) {
|
|
913
970
|
constructor() {
|
|
914
971
|
super(...arguments);
|
|
@@ -986,9 +1043,9 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
986
1043
|
}
|
|
987
1044
|
}
|
|
988
1045
|
async loadConnectors() {
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
if (!
|
|
1046
|
+
const globalWagmiSetup = getWagmiSetup();
|
|
1047
|
+
logInfo4("Global wagmi setup:", globalWagmiSetup);
|
|
1048
|
+
if (!globalWagmiSetup) {
|
|
992
1049
|
console.warn(
|
|
993
1050
|
"No global wagmi setup found! Call setupConnectModal() first."
|
|
994
1051
|
);
|
|
@@ -996,9 +1053,9 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
996
1053
|
return;
|
|
997
1054
|
}
|
|
998
1055
|
try {
|
|
999
|
-
const { wagmiConfig, chainId, embeddedWalletId } =
|
|
1000
|
-
const wagmiConnectors = _optionalChain([wagmiConfig, 'optionalAccess',
|
|
1001
|
-
|
|
1056
|
+
const { wagmiConfig, chainId, embeddedWalletId } = globalWagmiSetup;
|
|
1057
|
+
const wagmiConnectors = _optionalChain([wagmiConfig, 'optionalAccess', _60 => _60.connectors]) || [];
|
|
1058
|
+
logInfo4("Initial connectors:", wagmiConnectors);
|
|
1002
1059
|
const wagmiCore = await Promise.resolve().then(() => _interopRequireWildcard(require("@wagmi/core"))).catch((error) => {
|
|
1003
1060
|
throw new Error("@wagmi/core is required when using wagmi connectors", {
|
|
1004
1061
|
cause: error
|
|
@@ -1015,7 +1072,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1015
1072
|
chainId,
|
|
1016
1073
|
embeddedWalletId
|
|
1017
1074
|
);
|
|
1018
|
-
|
|
1075
|
+
logInfo4("Converted connectors:", this.connectors);
|
|
1019
1076
|
} catch (error) {
|
|
1020
1077
|
console.warn("Failed to load connectors", error);
|
|
1021
1078
|
this.connectors = [];
|
|
@@ -1029,7 +1086,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1029
1086
|
handleOnConnectSuccess(event) {
|
|
1030
1087
|
event.stopPropagation();
|
|
1031
1088
|
const connector = event.detail.connector;
|
|
1032
|
-
|
|
1089
|
+
logInfo4("Connection success:", connector);
|
|
1033
1090
|
this.open = false;
|
|
1034
1091
|
this.dispatchEvent(
|
|
1035
1092
|
new CustomEvent("on-connect", {
|
|
@@ -1047,7 +1104,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1047
1104
|
handleOnConnectError(event) {
|
|
1048
1105
|
event.stopPropagation();
|
|
1049
1106
|
const error = event.detail.error;
|
|
1050
|
-
|
|
1107
|
+
logInfo4("Connection error:", error);
|
|
1051
1108
|
this.dispatchEvent(
|
|
1052
1109
|
new CustomEvent("on-error", {
|
|
1053
1110
|
detail: { error },
|
|
@@ -1097,7 +1154,7 @@ var ConnectModal = class extends _mixins.withDeviceService.call(void 0, ConnectM
|
|
|
1097
1154
|
return _lit.html`
|
|
1098
1155
|
<lukso-modal
|
|
1099
1156
|
?is-open=${this.open}
|
|
1100
|
-
?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]))}
|
|
1101
1158
|
size="auto"
|
|
1102
1159
|
@on-backdrop-click=${this.handleClose}
|
|
1103
1160
|
>
|
|
@@ -1138,5 +1195,6 @@ customElements.define("connect-modal", ConnectModal);
|
|
|
1138
1195
|
|
|
1139
1196
|
|
|
1140
1197
|
|
|
1141
|
-
|
|
1142
|
-
|
|
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
|