@metamask/connect-multichain 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -1
- package/dist/browser/es/connect-multichain.mjs +48 -40
- package/dist/browser/es/connect-multichain.mjs.map +1 -1
- package/dist/browser/es/metafile-esm.json +1 -1
- package/dist/browser/iife/connect-multichain.js +1887 -91
- package/dist/browser/iife/connect-multichain.js.map +1 -1
- package/dist/browser/iife/metafile-iife.json +1 -1
- package/dist/browser/umd/connect-multichain.js +48 -40
- package/dist/browser/umd/connect-multichain.js.map +1 -1
- package/dist/browser/umd/metafile-cjs.json +1 -1
- package/dist/node/cjs/connect-multichain.js +41 -40
- package/dist/node/cjs/connect-multichain.js.map +1 -1
- package/dist/node/cjs/metafile-cjs.json +1 -1
- package/dist/node/es/connect-multichain.mjs +41 -40
- package/dist/node/es/connect-multichain.mjs.map +1 -1
- package/dist/node/es/metafile-esm.json +1 -1
- package/dist/react-native/es/connect-multichain.mjs +48 -40
- package/dist/react-native/es/connect-multichain.mjs.map +1 -1
- package/dist/react-native/es/metafile-esm.json +1 -1
- package/dist/src/index.browser.d.ts +1 -0
- package/dist/src/index.browser.d.ts.map +1 -1
- package/dist/src/index.browser.js +4 -2
- package/dist/src/index.browser.js.map +1 -1
- package/dist/src/index.native.d.ts +1 -0
- package/dist/src/index.native.d.ts.map +1 -1
- package/dist/src/index.native.js +4 -2
- package/dist/src/index.native.js.map +1 -1
- package/dist/src/index.node.js +2 -2
- package/dist/src/index.node.js.map +1 -1
- package/dist/src/multichain/index.d.ts +2 -2
- package/dist/src/multichain/index.d.ts.map +1 -1
- package/dist/src/multichain/index.js +82 -80
- package/dist/src/multichain/index.js.map +1 -1
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts +3 -3
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.js +10 -10
- package/dist/src/multichain/transports/multichainApiClientWrapper/index.js.map +1 -1
- package/dist/src/polyfills/buffer-shim.d.ts +2 -0
- package/dist/src/polyfills/buffer-shim.d.ts.map +1 -0
- package/dist/src/polyfills/buffer-shim.js +22 -0
- package/dist/src/polyfills/buffer-shim.js.map +1 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.2]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `ConnectMultichain.connect()` will send `sessionProperties` as undefined when called with an empty object `{}` in order to ensure that the initial `wallet_createSession` request does not fail immediately ([#138](https://github.com/MetaMask/connect-monorepo/pull/138))
|
|
15
|
+
|
|
16
|
+
## [0.5.1]
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- fix: Resolve Buffer polyfill requirement for browser/React Native consumers ([#121](https://github.com/MetaMask/connect-monorepo/pull/121))
|
|
21
|
+
|
|
10
22
|
## [0.5.0]
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -110,7 +122,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
110
122
|
|
|
111
123
|
- Initial release
|
|
112
124
|
|
|
113
|
-
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.5.
|
|
125
|
+
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.5.2...HEAD
|
|
126
|
+
[0.5.2]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.5.1...@metamask/connect-multichain@0.5.2
|
|
127
|
+
[0.5.1]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.5.0...@metamask/connect-multichain@0.5.1
|
|
114
128
|
[0.5.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.4.0...@metamask/connect-multichain@0.5.0
|
|
115
129
|
[0.4.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.3.2...@metamask/connect-multichain@0.4.0
|
|
116
130
|
[0.3.2]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.3.1...@metamask/connect-multichain@0.3.2
|
|
@@ -1167,6 +1167,13 @@ var init_web2 = __esm({
|
|
|
1167
1167
|
}
|
|
1168
1168
|
});
|
|
1169
1169
|
|
|
1170
|
+
// src/polyfills/buffer-shim.ts
|
|
1171
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
1172
|
+
var g = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {};
|
|
1173
|
+
if (!g.Buffer) {
|
|
1174
|
+
g.Buffer = Buffer2;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1170
1177
|
// src/multichain/index.ts
|
|
1171
1178
|
import { analytics as analytics2 } from "@metamask/analytics";
|
|
1172
1179
|
import {
|
|
@@ -2233,15 +2240,15 @@ var getUniqueId = () => {
|
|
|
2233
2240
|
};
|
|
2234
2241
|
var _MultichainApiClientWrapperTransport_instances, walletCreateSession_fn, walletGetSession_fn, walletRevokeSession_fn, walletInvokeMethod_fn;
|
|
2235
2242
|
var MultichainApiClientWrapperTransport = class {
|
|
2236
|
-
constructor(
|
|
2237
|
-
this.
|
|
2243
|
+
constructor(metamaskConnectMultichain) {
|
|
2244
|
+
this.metamaskConnectMultichain = metamaskConnectMultichain;
|
|
2238
2245
|
__privateAdd(this, _MultichainApiClientWrapperTransport_instances);
|
|
2239
2246
|
this.requestId = getUniqueId();
|
|
2240
2247
|
this.notificationCallbacks = /* @__PURE__ */ new Set();
|
|
2241
2248
|
}
|
|
2242
2249
|
isTransportDefined() {
|
|
2243
2250
|
try {
|
|
2244
|
-
return Boolean(this.
|
|
2251
|
+
return Boolean(this.metamaskConnectMultichain.transport);
|
|
2245
2252
|
} catch (error) {
|
|
2246
2253
|
return false;
|
|
2247
2254
|
}
|
|
@@ -2255,7 +2262,7 @@ var MultichainApiClientWrapperTransport = class {
|
|
|
2255
2262
|
});
|
|
2256
2263
|
}
|
|
2257
2264
|
setupNotifcationListener() {
|
|
2258
|
-
this.
|
|
2265
|
+
this.metamaskConnectMultichain.transport.onNotification(
|
|
2259
2266
|
this.notifyCallbacks.bind(this)
|
|
2260
2267
|
);
|
|
2261
2268
|
}
|
|
@@ -2302,7 +2309,7 @@ var MultichainApiClientWrapperTransport = class {
|
|
|
2302
2309
|
this.notificationCallbacks.delete(callback);
|
|
2303
2310
|
};
|
|
2304
2311
|
}
|
|
2305
|
-
return this.
|
|
2312
|
+
return this.metamaskConnectMultichain.transport.onNotification(callback);
|
|
2306
2313
|
}
|
|
2307
2314
|
};
|
|
2308
2315
|
_MultichainApiClientWrapperTransport_instances = new WeakSet();
|
|
@@ -2325,13 +2332,13 @@ walletCreateSession_fn = function(request) {
|
|
|
2325
2332
|
});
|
|
2326
2333
|
const accounts = [...new Set(scopeAccounts)];
|
|
2327
2334
|
console.log("\u{1F4DA} SDK connect");
|
|
2328
|
-
yield this.
|
|
2335
|
+
yield this.metamaskConnectMultichain.connect(
|
|
2329
2336
|
scopes,
|
|
2330
2337
|
accounts,
|
|
2331
2338
|
createSessionParams.sessionProperties
|
|
2332
2339
|
);
|
|
2333
2340
|
console.log("\u{1F4DA} SDK connected");
|
|
2334
|
-
return this.
|
|
2341
|
+
return this.metamaskConnectMultichain.transport.request({
|
|
2335
2342
|
method: "wallet_getSession"
|
|
2336
2343
|
});
|
|
2337
2344
|
});
|
|
@@ -2347,7 +2354,7 @@ walletGetSession_fn = function(request) {
|
|
|
2347
2354
|
}
|
|
2348
2355
|
};
|
|
2349
2356
|
}
|
|
2350
|
-
return this.
|
|
2357
|
+
return this.metamaskConnectMultichain.transport.request({
|
|
2351
2358
|
method: "wallet_getSession"
|
|
2352
2359
|
});
|
|
2353
2360
|
});
|
|
@@ -2358,7 +2365,7 @@ walletRevokeSession_fn = function(request) {
|
|
|
2358
2365
|
return { jsonrpc: "2.0", id: request.id, result: true };
|
|
2359
2366
|
}
|
|
2360
2367
|
try {
|
|
2361
|
-
this.
|
|
2368
|
+
this.metamaskConnectMultichain.disconnect();
|
|
2362
2369
|
return { jsonrpc: "2.0", id: request.id, result: true };
|
|
2363
2370
|
} catch (error) {
|
|
2364
2371
|
return { jsonrpc: "2.0", id: request.id, result: false };
|
|
@@ -2370,7 +2377,7 @@ walletInvokeMethod_fn = function(request) {
|
|
|
2370
2377
|
if (!this.isTransportDefined()) {
|
|
2371
2378
|
return { error: providerErrors.unauthorized() };
|
|
2372
2379
|
}
|
|
2373
|
-
const result = this.
|
|
2380
|
+
const result = this.metamaskConnectMultichain.invokeMethod(
|
|
2374
2381
|
request.params
|
|
2375
2382
|
);
|
|
2376
2383
|
return {
|
|
@@ -2381,8 +2388,8 @@ walletInvokeMethod_fn = function(request) {
|
|
|
2381
2388
|
|
|
2382
2389
|
// src/multichain/index.ts
|
|
2383
2390
|
var logger2 = createLogger("metamask-sdk:core");
|
|
2384
|
-
var _a, _provider, _providerTransportWrapper, _transport2, _dappClient, _beforeUnloadListener, _listener, _sdkInfo,
|
|
2385
|
-
var
|
|
2391
|
+
var _a, _provider, _providerTransportWrapper, _transport2, _dappClient, _beforeUnloadListener, _listener, _sdkInfo, _MetaMaskConnectMultichain_instances, setupAnalytics_fn, onTransportNotification_fn, getStoredTransport_fn, setupTransport_fn, init_fn, createDappClient_fn, setupMWP_fn, onBeforeUnload_fn, createBeforeUnloadListener_fn, renderInstallModalAsync_fn, showInstallModal_fn, headlessConnect_fn, setupDefaultTransport_fn, deeplinkConnect_fn, handleConnection_fn;
|
|
2392
|
+
var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends MultichainCore {
|
|
2386
2393
|
constructor(options) {
|
|
2387
2394
|
var _a2, _b, _c, _d, _e, _f;
|
|
2388
2395
|
const withDappMetadata = setupDappMetadata(options);
|
|
@@ -2398,7 +2405,7 @@ var _MultichainSDK = class _MultichainSDK extends MultichainCore {
|
|
|
2398
2405
|
})
|
|
2399
2406
|
});
|
|
2400
2407
|
super(allOptions);
|
|
2401
|
-
__privateAdd(this,
|
|
2408
|
+
__privateAdd(this, _MetaMaskConnectMultichain_instances);
|
|
2402
2409
|
__privateAdd(this, _provider);
|
|
2403
2410
|
__privateAdd(this, _providerTransportWrapper);
|
|
2404
2411
|
__privateAdd(this, _transport2);
|
|
@@ -2445,7 +2452,7 @@ var _MultichainSDK = class _MultichainSDK extends MultichainCore {
|
|
|
2445
2452
|
static create(options) {
|
|
2446
2453
|
return __async(this, null, function* () {
|
|
2447
2454
|
var _a2;
|
|
2448
|
-
const instance = new
|
|
2455
|
+
const instance = new _MetaMaskConnectMultichain(options);
|
|
2449
2456
|
const isEnabled2 = yield isEnabled(
|
|
2450
2457
|
"metamask-sdk:core",
|
|
2451
2458
|
instance.options.storage
|
|
@@ -2453,7 +2460,7 @@ var _MultichainSDK = class _MultichainSDK extends MultichainCore {
|
|
|
2453
2460
|
if (isEnabled2) {
|
|
2454
2461
|
enableDebug("metamask-sdk:core");
|
|
2455
2462
|
}
|
|
2456
|
-
yield __privateMethod(_a2 = instance,
|
|
2463
|
+
yield __privateMethod(_a2 = instance, _MetaMaskConnectMultichain_instances, init_fn).call(_a2);
|
|
2457
2464
|
return instance;
|
|
2458
2465
|
});
|
|
2459
2466
|
}
|
|
@@ -2492,8 +2499,9 @@ var _MultichainSDK = class _MultichainSDK extends MultichainCore {
|
|
|
2492
2499
|
} catch (error) {
|
|
2493
2500
|
logger2("Error tracking connection_initiated event", error);
|
|
2494
2501
|
}
|
|
2502
|
+
const nonEmptySessionProperites = Object.keys(sessionProperties != null ? sessionProperties : {}).length > 0 ? sessionProperties : void 0;
|
|
2495
2503
|
if (((_a2 = __privateGet(this, _transport2)) == null ? void 0 : _a2.isConnected()) && !secure) {
|
|
2496
|
-
return __privateMethod(this,
|
|
2504
|
+
return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, __privateGet(this, _transport2).connect({ scopes, caipAccountIds, sessionProperties: nonEmptySessionProperites, forceRequest }).then(() => __async(this, null, function* () {
|
|
2497
2505
|
if (__privateGet(this, _transport2) instanceof MWPTransport) {
|
|
2498
2506
|
return this.storage.setTransport("mwp" /* MWP */);
|
|
2499
2507
|
}
|
|
@@ -2501,19 +2509,19 @@ var _MultichainSDK = class _MultichainSDK extends MultichainCore {
|
|
|
2501
2509
|
})), scopes, transportType);
|
|
2502
2510
|
}
|
|
2503
2511
|
if (platformType === "in-app-browser" /* MetaMaskMobileWebview */) {
|
|
2504
|
-
const defaultTransport = yield __privateMethod(this,
|
|
2505
|
-
return __privateMethod(this,
|
|
2512
|
+
const defaultTransport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupDefaultTransport_fn).call(this);
|
|
2513
|
+
return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, defaultTransport.connect({ scopes, caipAccountIds, sessionProperties: nonEmptySessionProperites, forceRequest }), scopes, transportType);
|
|
2506
2514
|
}
|
|
2507
2515
|
if (isWeb && hasExtensionInstalled && preferExtension) {
|
|
2508
|
-
const defaultTransport = yield __privateMethod(this,
|
|
2509
|
-
return __privateMethod(this,
|
|
2516
|
+
const defaultTransport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupDefaultTransport_fn).call(this);
|
|
2517
|
+
return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, defaultTransport.connect({ scopes, caipAccountIds, sessionProperties: nonEmptySessionProperites, forceRequest }), scopes, transportType);
|
|
2510
2518
|
}
|
|
2511
|
-
yield __privateMethod(this,
|
|
2519
|
+
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupMWP_fn).call(this);
|
|
2512
2520
|
const shouldShowInstallModal = hasExtensionInstalled ? showInstallModal : !preferExtension || showInstallModal;
|
|
2513
2521
|
if (secure && !shouldShowInstallModal) {
|
|
2514
|
-
return __privateMethod(this,
|
|
2522
|
+
return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, __privateMethod(this, _MetaMaskConnectMultichain_instances, deeplinkConnect_fn).call(this, scopes, caipAccountIds, nonEmptySessionProperites), scopes, transportType);
|
|
2515
2523
|
}
|
|
2516
|
-
return __privateMethod(this,
|
|
2524
|
+
return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, __privateMethod(this, _MetaMaskConnectMultichain_instances, showInstallModal_fn).call(this, shouldShowInstallModal, scopes, caipAccountIds, nonEmptySessionProperites), scopes, transportType);
|
|
2517
2525
|
});
|
|
2518
2526
|
}
|
|
2519
2527
|
emit(event, args) {
|
|
@@ -2573,7 +2581,7 @@ _dappClient = new WeakMap();
|
|
|
2573
2581
|
_beforeUnloadListener = new WeakMap();
|
|
2574
2582
|
_listener = new WeakMap();
|
|
2575
2583
|
_sdkInfo = new WeakMap();
|
|
2576
|
-
|
|
2584
|
+
_MetaMaskConnectMultichain_instances = new WeakSet();
|
|
2577
2585
|
setupAnalytics_fn = function() {
|
|
2578
2586
|
return __async(this, null, function* () {
|
|
2579
2587
|
var _a2;
|
|
@@ -2616,19 +2624,19 @@ getStoredTransport_fn = function() {
|
|
|
2616
2624
|
__privateSet(this, _transport2, apiTransport);
|
|
2617
2625
|
__privateGet(this, _providerTransportWrapper).setupNotifcationListener();
|
|
2618
2626
|
__privateSet(this, _listener, apiTransport.onNotification(
|
|
2619
|
-
__privateMethod(this,
|
|
2627
|
+
__privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
|
|
2620
2628
|
));
|
|
2621
2629
|
return apiTransport;
|
|
2622
2630
|
}
|
|
2623
2631
|
} else if (transportType === "mwp" /* MWP */) {
|
|
2624
2632
|
const { adapter: kvstore } = this.options.storage;
|
|
2625
|
-
const dappClient = yield __privateMethod(this,
|
|
2633
|
+
const dappClient = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, createDappClient_fn).call(this);
|
|
2626
2634
|
const apiTransport = new MWPTransport(dappClient, kvstore);
|
|
2627
2635
|
__privateSet(this, _dappClient, dappClient);
|
|
2628
2636
|
__privateSet(this, _transport2, apiTransport);
|
|
2629
2637
|
__privateGet(this, _providerTransportWrapper).setupNotifcationListener();
|
|
2630
2638
|
__privateSet(this, _listener, apiTransport.onNotification(
|
|
2631
|
-
__privateMethod(this,
|
|
2639
|
+
__privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
|
|
2632
2640
|
));
|
|
2633
2641
|
return apiTransport;
|
|
2634
2642
|
}
|
|
@@ -2639,7 +2647,7 @@ getStoredTransport_fn = function() {
|
|
|
2639
2647
|
};
|
|
2640
2648
|
setupTransport_fn = function() {
|
|
2641
2649
|
return __async(this, null, function* () {
|
|
2642
|
-
const transport = yield __privateMethod(this,
|
|
2650
|
+
const transport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, getStoredTransport_fn).call(this);
|
|
2643
2651
|
if (transport) {
|
|
2644
2652
|
if (!this.transport.isConnected()) {
|
|
2645
2653
|
this.status = "connecting";
|
|
@@ -2663,8 +2671,8 @@ init_fn = function() {
|
|
|
2663
2671
|
if (typeof window !== "undefined" && ((_a2 = window.mmsdk) == null ? void 0 : _a2.isInitialized)) {
|
|
2664
2672
|
logger2("MetaMaskSDK: init already initialized");
|
|
2665
2673
|
} else {
|
|
2666
|
-
yield __privateMethod(this,
|
|
2667
|
-
yield __privateMethod(this,
|
|
2674
|
+
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupAnalytics_fn).call(this);
|
|
2675
|
+
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupTransport_fn).call(this);
|
|
2668
2676
|
try {
|
|
2669
2677
|
const baseProps = yield getBaseAnalyticsProperties(
|
|
2670
2678
|
this.options,
|
|
@@ -2708,13 +2716,13 @@ setupMWP_fn = function() {
|
|
|
2708
2716
|
return;
|
|
2709
2717
|
}
|
|
2710
2718
|
const { adapter: kvstore } = this.options.storage;
|
|
2711
|
-
const dappClient = yield __privateMethod(this,
|
|
2719
|
+
const dappClient = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, createDappClient_fn).call(this);
|
|
2712
2720
|
__privateSet(this, _dappClient, dappClient);
|
|
2713
2721
|
const apiTransport = new MWPTransport(dappClient, kvstore);
|
|
2714
2722
|
__privateSet(this, _transport2, apiTransport);
|
|
2715
2723
|
__privateGet(this, _providerTransportWrapper).setupNotifcationListener();
|
|
2716
2724
|
__privateSet(this, _listener, this.transport.onNotification(
|
|
2717
|
-
__privateMethod(this,
|
|
2725
|
+
__privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
|
|
2718
2726
|
));
|
|
2719
2727
|
yield this.storage.setTransport("mwp" /* MWP */);
|
|
2720
2728
|
});
|
|
@@ -2729,13 +2737,13 @@ onBeforeUnload_fn = function() {
|
|
|
2729
2737
|
};
|
|
2730
2738
|
createBeforeUnloadListener_fn = function() {
|
|
2731
2739
|
if (typeof window !== "undefined" && typeof window.addEventListener !== "undefined") {
|
|
2732
|
-
window.addEventListener("beforeunload", __privateMethod(this,
|
|
2740
|
+
window.addEventListener("beforeunload", __privateMethod(this, _MetaMaskConnectMultichain_instances, onBeforeUnload_fn).bind(this));
|
|
2733
2741
|
}
|
|
2734
2742
|
return () => {
|
|
2735
2743
|
if (typeof window !== "undefined" && typeof window.removeEventListener !== "undefined") {
|
|
2736
2744
|
window.removeEventListener(
|
|
2737
2745
|
"beforeunload",
|
|
2738
|
-
__privateMethod(this,
|
|
2746
|
+
__privateMethod(this, _MetaMaskConnectMultichain_instances, onBeforeUnload_fn).bind(this)
|
|
2739
2747
|
);
|
|
2740
2748
|
}
|
|
2741
2749
|
};
|
|
@@ -2811,11 +2819,11 @@ renderInstallModalAsync_fn = function(desktopPreferred, scopes, caipAccountIds,
|
|
|
2811
2819
|
showInstallModal_fn = function(desktopPreferred, scopes, caipAccountIds, sessionProperties) {
|
|
2812
2820
|
return __async(this, null, function* () {
|
|
2813
2821
|
var _a2;
|
|
2814
|
-
(_a2 = __privateGet(this, _beforeUnloadListener)) != null ? _a2 : __privateSet(this, _beforeUnloadListener, __privateMethod(this,
|
|
2822
|
+
(_a2 = __privateGet(this, _beforeUnloadListener)) != null ? _a2 : __privateSet(this, _beforeUnloadListener, __privateMethod(this, _MetaMaskConnectMultichain_instances, createBeforeUnloadListener_fn).call(this));
|
|
2815
2823
|
if (this.options.ui.headless) {
|
|
2816
|
-
yield __privateMethod(this,
|
|
2824
|
+
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, headlessConnect_fn).call(this, scopes, caipAccountIds, sessionProperties);
|
|
2817
2825
|
} else {
|
|
2818
|
-
yield __privateMethod(this,
|
|
2826
|
+
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, renderInstallModalAsync_fn).call(this, desktopPreferred, scopes, caipAccountIds, sessionProperties);
|
|
2819
2827
|
}
|
|
2820
2828
|
});
|
|
2821
2829
|
};
|
|
@@ -2867,7 +2875,7 @@ setupDefaultTransport_fn = function() {
|
|
|
2867
2875
|
yield this.storage.setTransport("browser" /* Browser */);
|
|
2868
2876
|
const transport = new DefaultTransport();
|
|
2869
2877
|
__privateSet(this, _listener, transport.onNotification(
|
|
2870
|
-
__privateMethod(this,
|
|
2878
|
+
__privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
|
|
2871
2879
|
));
|
|
2872
2880
|
__privateSet(this, _transport2, transport);
|
|
2873
2881
|
__privateGet(this, _providerTransportWrapper).setupNotifcationListener();
|
|
@@ -2980,7 +2988,7 @@ handleConnection_fn = function(promise, scopes, transportType) {
|
|
|
2980
2988
|
}));
|
|
2981
2989
|
});
|
|
2982
2990
|
};
|
|
2983
|
-
var
|
|
2991
|
+
var MetaMaskConnectMultichain = _MetaMaskConnectMultichain;
|
|
2984
2992
|
|
|
2985
2993
|
// src/store/index.ts
|
|
2986
2994
|
import * as uuid from "uuid";
|
|
@@ -3344,7 +3352,7 @@ var createMultichainClient = (options) => __async(null, null, function* () {
|
|
|
3344
3352
|
storage = options.storage;
|
|
3345
3353
|
}
|
|
3346
3354
|
const factory = new ModalFactory(uiModules);
|
|
3347
|
-
return
|
|
3355
|
+
return MetaMaskConnectMultichain.create(__spreadProps(__spreadValues({}, options), {
|
|
3348
3356
|
storage,
|
|
3349
3357
|
ui: __spreadProps(__spreadValues({}, options.ui), {
|
|
3350
3358
|
factory
|