@metamask/connect-multichain 0.7.0 → 0.9.0
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 +32 -1
- package/README.md +20 -19
- package/dist/browser/es/connect-multichain.d.mts +19 -5
- package/dist/browser/es/connect-multichain.mjs +157 -104
- 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.d.ts +19 -5
- package/dist/browser/iife/connect-multichain.js +2717 -5028
- 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.d.ts +19 -5
- package/dist/browser/umd/connect-multichain.js +156 -103
- 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.d.ts +19 -5
- package/dist/node/cjs/connect-multichain.js +156 -102
- 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.d.mts +19 -5
- package/dist/node/es/connect-multichain.mjs +157 -103
- 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.d.mts +19 -5
- package/dist/react-native/es/connect-multichain.mjs +157 -103
- package/dist/react-native/es/connect-multichain.mjs.map +1 -1
- package/dist/react-native/es/metafile-esm.json +1 -1
- package/dist/src/domain/multichain/index.d.ts +1 -1
- package/dist/src/domain/multichain/index.d.ts.map +1 -1
- package/dist/src/domain/multichain/index.js +3 -3
- package/dist/src/domain/multichain/index.js.map +1 -1
- package/dist/src/domain/multichain/types.d.ts +13 -1
- package/dist/src/domain/multichain/types.d.ts.map +1 -1
- package/dist/src/multichain/index.d.ts.map +1 -1
- package/dist/src/multichain/index.js +76 -39
- package/dist/src/multichain/index.js.map +1 -1
- package/dist/src/multichain/rpc/requestRouter.d.ts +3 -2
- package/dist/src/multichain/rpc/requestRouter.d.ts.map +1 -1
- package/dist/src/multichain/rpc/requestRouter.js +14 -15
- package/dist/src/multichain/rpc/requestRouter.js.map +1 -1
- package/dist/src/multichain/transports/default/index.d.ts +1 -0
- package/dist/src/multichain/transports/default/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/default/index.js +34 -32
- package/dist/src/multichain/transports/default/index.js.map +1 -1
- package/dist/src/multichain/transports/mwp/KeyManager.d.ts +1 -0
- package/dist/src/multichain/transports/mwp/KeyManager.d.ts.map +1 -1
- package/dist/src/multichain/transports/mwp/KeyManager.js +4 -1
- package/dist/src/multichain/transports/mwp/KeyManager.js.map +1 -1
- package/dist/src/multichain/transports/mwp/index.d.ts +1 -0
- package/dist/src/multichain/transports/mwp/index.d.ts.map +1 -1
- package/dist/src/multichain/transports/mwp/index.js +6 -1
- package/dist/src/multichain/transports/mwp/index.js.map +1 -1
- package/dist/src/multichain/utils/analytics.d.ts +6 -3
- package/dist/src/multichain/utils/analytics.d.ts.map +1 -1
- package/dist/src/multichain/utils/analytics.js +8 -8
- package/dist/src/multichain/utils/analytics.js.map +1 -1
- package/dist/src/ui/ModalFactory.d.ts.map +1 -1
- package/dist/src/ui/ModalFactory.js +1 -3
- package/dist/src/ui/ModalFactory.js.map +1 -1
- package/dist/src/ui/modals/web/install.d.ts.map +1 -1
- package/dist/src/ui/modals/web/install.js +0 -1
- package/dist/src/ui/modals/web/install.js.map +1 -1
- package/dist/types/connect-multichain.d.ts +19 -5
- package/package.json +5 -5
|
@@ -386,6 +386,14 @@ type ConnectionRequest = {
|
|
|
386
386
|
};
|
|
387
387
|
};
|
|
388
388
|
};
|
|
389
|
+
/**
|
|
390
|
+
* Package versions keyed by connect package name.
|
|
391
|
+
* connect-multichain is always present; chain-specific packages
|
|
392
|
+
* appear only when their client is instantiated.
|
|
393
|
+
*/
|
|
394
|
+
type ConnectVersions = {
|
|
395
|
+
'connect-multichain': string;
|
|
396
|
+
} & Partial<Record<'connect-evm' | 'connect-solana', string>>;
|
|
389
397
|
/**
|
|
390
398
|
* Constructor options for creating a Multichain SDK instance.
|
|
391
399
|
*
|
|
@@ -431,6 +439,8 @@ type MultichainOptions = {
|
|
|
431
439
|
};
|
|
432
440
|
/** Enable debug logging */
|
|
433
441
|
debug?: boolean;
|
|
442
|
+
/** Package versions contributed by chain-specific clients (merged on each createMultichainClient call) */
|
|
443
|
+
versions?: Partial<ConnectVersions>;
|
|
434
444
|
};
|
|
435
445
|
type MultiChainFNOptions = Omit<MultichainOptions, 'storage' | 'ui'> & {
|
|
436
446
|
ui?: Omit<MultichainOptions['ui'], 'factory'>;
|
|
@@ -441,11 +451,12 @@ type MultiChainFNOptions = Omit<MultichainOptions, 'storage' | 'ui'> & {
|
|
|
441
451
|
* Options that can be merged/overwritten when createMultichainClient is called
|
|
442
452
|
* with an existing singleton.
|
|
443
453
|
*/
|
|
444
|
-
type MergeableMultichainOptions = Omit<MultichainOptions, 'dapp' | 'analytics' | 'storage' | 'api' | 'ui' | 'transport'> & {
|
|
454
|
+
type MergeableMultichainOptions = Omit<MultichainOptions, 'dapp' | 'analytics' | 'storage' | 'api' | 'ui' | 'transport' | 'versions'> & {
|
|
445
455
|
api?: MultichainOptions['api'];
|
|
446
456
|
ui?: Pick<MultichainOptions['ui'], 'headless' | 'preferExtension' | 'showInstallModal'>;
|
|
447
457
|
transport?: Pick<NonNullable<MultichainOptions['transport']>, 'extensionId'>;
|
|
448
458
|
debug?: boolean;
|
|
459
|
+
versions?: Partial<ConnectVersions>;
|
|
449
460
|
};
|
|
450
461
|
/**
|
|
451
462
|
* Complete options for Multichain SDK configuration.
|
|
@@ -455,6 +466,7 @@ type MergeableMultichainOptions = Omit<MultichainOptions, 'dapp' | 'analytics' |
|
|
|
455
466
|
*/
|
|
456
467
|
type CreateMultichainFN = (options: MultiChainFNOptions) => Promise<MultichainCore>;
|
|
457
468
|
type ExtendedTransport = Omit<Transport, 'connect'> & {
|
|
469
|
+
init: () => Promise<void>;
|
|
458
470
|
connect: (props?: {
|
|
459
471
|
scopes: Scope[];
|
|
460
472
|
caipAccountIds: CaipAccountId[];
|
|
@@ -518,7 +530,7 @@ declare abstract class MultichainCore extends EventEmitter<SDKEvents> {
|
|
|
518
530
|
constructor(options: MultichainOptions);
|
|
519
531
|
/**
|
|
520
532
|
* Merges the given options into the current instance options.
|
|
521
|
-
* Only the mergeable keys are updated (api.supportedNetworks, ui.*, mobile.*, transport.extensionId, debug).
|
|
533
|
+
* Only the mergeable keys are updated (api.supportedNetworks, versions, ui.*, mobile.*, transport.extensionId, debug).
|
|
522
534
|
* The main thing to note is that the value for `dapp` is not merged as it does not make sense for
|
|
523
535
|
* subsequent calls to `createMultichainClient` to have a different `dapp` value.
|
|
524
536
|
* Used when createMultichainClient is called with an existing singleton.
|
|
@@ -657,15 +669,17 @@ declare function isRejectionError(error: unknown): boolean;
|
|
|
657
669
|
* @param options - Multichain options containing dapp and analytics config
|
|
658
670
|
* @param storage - Storage client for getting anonymous ID
|
|
659
671
|
* @param invokeOptions - The invoke method options containing method and scope
|
|
672
|
+
* @param transportType - The transport type to use for the analytics event
|
|
660
673
|
* @returns Wallet action analytics properties
|
|
661
674
|
*/
|
|
662
|
-
declare function getWalletActionAnalyticsProperties(options: MultichainOptions, storage: StoreClient, invokeOptions: InvokeMethodOptions): Promise<{
|
|
663
|
-
|
|
675
|
+
declare function getWalletActionAnalyticsProperties(options: MultichainOptions, storage: StoreClient, invokeOptions: InvokeMethodOptions, transportType: TransportType): Promise<{
|
|
676
|
+
mmconnect_versions: Record<string, string>;
|
|
664
677
|
dapp_id: string;
|
|
665
678
|
method: string;
|
|
666
679
|
integration_type: string;
|
|
667
680
|
caip_chain_id: string;
|
|
668
681
|
anon_id: string;
|
|
682
|
+
transport_type: TransportType;
|
|
669
683
|
}>;
|
|
670
684
|
|
|
671
685
|
/**
|
|
@@ -677,4 +691,4 @@ declare function getVersion(): string;
|
|
|
677
691
|
|
|
678
692
|
declare const createMultichainClient: CreateMultichainFN;
|
|
679
693
|
|
|
680
|
-
export { type ConnectionRequest, type ConnectionStatus, type CreateMultichainFN, type DappSettings, type DataType, type DomainErrorCodes, type Enumerate, type ErrorCodeRange, type ErrorCodes, EventEmitter, type EventTypes, type ExtendedTransport, type InstallWidgetProps, type InvokeMethodOptions, type LoggerNameSpaces, type MergeableMultichainOptions, Modal, type ModalFactoryConnectOptions, type ModalFactoryOptions, MultichainCore, type MultichainOptions, type NotificationCallback, type OTPCode, type OTPCodeWidgetProps, PlatformType, type QRLink, type RPCAPI, type RPCErrorCodes, RPCHttpErr, RPCInvokeMethodErr, RPCReadonlyRequestErr, RPCReadonlyResponseErr, type RPCResponse, RPC_HANDLED_METHODS, type RpcMethod, type RpcUrlsMap, type SDKEvents, SDK_HANDLED_METHODS, type Scope, type StorageErrorCodes, StoreAdapter, StoreClient, type StoreOptions, TransportType, createLogger, createMultichainClient, enableDebug, getInfuraRpcUrls, getPlatformType, getTransportType, getVersion, getWalletActionAnalyticsProperties, hasExtension, infuraRpcUrls, isEnabled, isMetamaskExtensionInstalled, isRejectionError, isSecure };
|
|
694
|
+
export { type ConnectVersions, type ConnectionRequest, type ConnectionStatus, type CreateMultichainFN, type DappSettings, type DataType, type DomainErrorCodes, type Enumerate, type ErrorCodeRange, type ErrorCodes, EventEmitter, type EventTypes, type ExtendedTransport, type InstallWidgetProps, type InvokeMethodOptions, type LoggerNameSpaces, type MergeableMultichainOptions, Modal, type ModalFactoryConnectOptions, type ModalFactoryOptions, MultichainCore, type MultichainOptions, type NotificationCallback, type OTPCode, type OTPCodeWidgetProps, PlatformType, type QRLink, type RPCAPI, type RPCErrorCodes, RPCHttpErr, RPCInvokeMethodErr, RPCReadonlyRequestErr, RPCReadonlyResponseErr, type RPCResponse, RPC_HANDLED_METHODS, type RpcMethod, type RpcUrlsMap, type SDKEvents, SDK_HANDLED_METHODS, type Scope, type StorageErrorCodes, StoreAdapter, StoreClient, type StoreOptions, TransportType, createLogger, createMultichainClient, enableDebug, getInfuraRpcUrls, getPlatformType, getTransportType, getVersion, getWalletActionAnalyticsProperties, hasExtension, infuraRpcUrls, isEnabled, isMetamaskExtensionInstalled, isRejectionError, isSecure };
|
|
@@ -422,7 +422,7 @@ var init_multichain = __esm({
|
|
|
422
422
|
}
|
|
423
423
|
/**
|
|
424
424
|
* Merges the given options into the current instance options.
|
|
425
|
-
* Only the mergeable keys are updated (api.supportedNetworks, ui.*, mobile.*, transport.extensionId, debug).
|
|
425
|
+
* Only the mergeable keys are updated (api.supportedNetworks, versions, ui.*, mobile.*, transport.extensionId, debug).
|
|
426
426
|
* The main thing to note is that the value for `dapp` is not merged as it does not make sense for
|
|
427
427
|
* subsequent calls to `createMultichainClient` to have a different `dapp` value.
|
|
428
428
|
* Used when createMultichainClient is called with an existing singleton.
|
|
@@ -430,22 +430,23 @@ var init_multichain = __esm({
|
|
|
430
430
|
* @param partial - Options to merge/overwrite onto the current instance
|
|
431
431
|
*/
|
|
432
432
|
mergeOptions(partial) {
|
|
433
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
433
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
434
434
|
const opts = this.options;
|
|
435
435
|
this.options = __spreadProps(__spreadValues({}, opts), {
|
|
436
436
|
api: __spreadProps(__spreadValues({}, opts.api), {
|
|
437
437
|
supportedNetworks: __spreadValues(__spreadValues({}, opts.api.supportedNetworks), (_b = (_a3 = partial.api) == null ? void 0 : _a3.supportedNetworks) != null ? _b : {})
|
|
438
438
|
}),
|
|
439
|
+
versions: __spreadValues(__spreadValues({}, opts.versions), (_c = partial.versions) != null ? _c : {}),
|
|
439
440
|
ui: __spreadProps(__spreadValues({}, opts.ui), {
|
|
440
|
-
headless: (
|
|
441
|
-
preferExtension: (
|
|
442
|
-
showInstallModal: (
|
|
441
|
+
headless: (_e = (_d = partial.ui) == null ? void 0 : _d.headless) != null ? _e : opts.ui.headless,
|
|
442
|
+
preferExtension: (_g = (_f = partial.ui) == null ? void 0 : _f.preferExtension) != null ? _g : opts.ui.preferExtension,
|
|
443
|
+
showInstallModal: (_i = (_h = partial.ui) == null ? void 0 : _h.showInstallModal) != null ? _i : opts.ui.showInstallModal
|
|
443
444
|
}),
|
|
444
|
-
mobile: __spreadValues(__spreadValues({}, opts.mobile), (
|
|
445
|
-
transport: __spreadProps(__spreadValues({}, (
|
|
446
|
-
extensionId: (
|
|
445
|
+
mobile: __spreadValues(__spreadValues({}, opts.mobile), (_j = partial.mobile) != null ? _j : {}),
|
|
446
|
+
transport: __spreadProps(__spreadValues({}, (_k = opts.transport) != null ? _k : {}), {
|
|
447
|
+
extensionId: (_n = (_l = partial.transport) == null ? void 0 : _l.extensionId) != null ? _n : (_m = opts.transport) == null ? void 0 : _m.extensionId
|
|
447
448
|
}),
|
|
448
|
-
debug: (
|
|
449
|
+
debug: (_o = partial.debug) != null ? _o : opts.debug
|
|
449
450
|
});
|
|
450
451
|
}
|
|
451
452
|
};
|
|
@@ -647,14 +648,13 @@ function isRejectionError(error) {
|
|
|
647
648
|
}
|
|
648
649
|
function getBaseAnalyticsProperties(options, storage) {
|
|
649
650
|
return __async(this, null, function* () {
|
|
650
|
-
var _a3, _b;
|
|
651
|
-
const version = getVersion();
|
|
651
|
+
var _a3, _b, _c;
|
|
652
652
|
const dappId = getDappId(options.dapp);
|
|
653
653
|
const platform = getPlatformType();
|
|
654
654
|
const anonId = yield storage.getAnonId();
|
|
655
655
|
const integrationType = (_b = (_a3 = options.analytics) == null ? void 0 : _a3.integrationType) != null ? _b : "unknown" /* UNKNOWN */;
|
|
656
656
|
return {
|
|
657
|
-
|
|
657
|
+
mmconnect_versions: (_c = options.versions) != null ? _c : {},
|
|
658
658
|
dapp_id: dappId,
|
|
659
659
|
platform,
|
|
660
660
|
integration_type: integrationType,
|
|
@@ -662,20 +662,20 @@ function getBaseAnalyticsProperties(options, storage) {
|
|
|
662
662
|
};
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
function getWalletActionAnalyticsProperties(options, storage, invokeOptions) {
|
|
665
|
+
function getWalletActionAnalyticsProperties(options, storage, invokeOptions, transportType) {
|
|
666
666
|
return __async(this, null, function* () {
|
|
667
|
-
var _a3, _b;
|
|
668
|
-
const version = getVersion();
|
|
667
|
+
var _a3, _b, _c;
|
|
669
668
|
const dappId = getDappId(options.dapp);
|
|
670
669
|
const anonId = yield storage.getAnonId();
|
|
671
670
|
const integrationType = (_b = (_a3 = options.analytics) == null ? void 0 : _a3.integrationType) != null ? _b : "unknown";
|
|
672
671
|
return {
|
|
673
|
-
|
|
672
|
+
mmconnect_versions: (_c = options.versions) != null ? _c : {},
|
|
674
673
|
dapp_id: dappId,
|
|
675
674
|
method: invokeOptions.request.method,
|
|
676
675
|
integration_type: integrationType,
|
|
677
676
|
caip_chain_id: invokeOptions.scope,
|
|
678
|
-
anon_id: anonId
|
|
677
|
+
anon_id: anonId,
|
|
678
|
+
transport_type: transportType
|
|
679
679
|
};
|
|
680
680
|
});
|
|
681
681
|
}
|
|
@@ -1111,7 +1111,6 @@ var init_install = __esm({
|
|
|
1111
1111
|
"mm-install-modal"
|
|
1112
1112
|
);
|
|
1113
1113
|
modal.showInstallModal = options.showInstallModal;
|
|
1114
|
-
modal.sdkVersion = options.sdkVersion;
|
|
1115
1114
|
modal.addEventListener("close", (ev) => {
|
|
1116
1115
|
const { detail } = ev;
|
|
1117
1116
|
options.onClose(detail == null ? void 0 : detail.shouldTerminate);
|
|
@@ -1464,10 +1463,11 @@ init_utils2();
|
|
|
1464
1463
|
init_analytics();
|
|
1465
1464
|
var _RequestRouter_instances, withAnalyticsTracking_fn, trackWalletActionRequested_fn, trackWalletActionSucceeded_fn, trackWalletActionFailed_fn, trackWalletActionRejected_fn;
|
|
1466
1465
|
var RequestRouter = class {
|
|
1467
|
-
constructor(transport, rpcClient, config) {
|
|
1466
|
+
constructor(transport, rpcClient, config, transportType) {
|
|
1468
1467
|
this.transport = transport;
|
|
1469
1468
|
this.rpcClient = rpcClient;
|
|
1470
1469
|
this.config = config;
|
|
1470
|
+
this.transportType = transportType;
|
|
1471
1471
|
__privateAdd(this, _RequestRouter_instances);
|
|
1472
1472
|
}
|
|
1473
1473
|
/**
|
|
@@ -1537,16 +1537,14 @@ var RequestRouter = class {
|
|
|
1537
1537
|
*/
|
|
1538
1538
|
handleWithRpcNode(options) {
|
|
1539
1539
|
return __async(this, null, function* () {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
return this.handleWithWallet(options);
|
|
1546
|
-
}
|
|
1547
|
-
throw error;
|
|
1540
|
+
try {
|
|
1541
|
+
return yield this.rpcClient.request(options);
|
|
1542
|
+
} catch (error) {
|
|
1543
|
+
if (error instanceof MissingRpcEndpointErr) {
|
|
1544
|
+
return this.handleWithWallet(options);
|
|
1548
1545
|
}
|
|
1549
|
-
|
|
1546
|
+
throw error;
|
|
1547
|
+
}
|
|
1550
1548
|
});
|
|
1551
1549
|
}
|
|
1552
1550
|
/**
|
|
@@ -1590,7 +1588,8 @@ trackWalletActionRequested_fn = function(options) {
|
|
|
1590
1588
|
const props = yield getWalletActionAnalyticsProperties(
|
|
1591
1589
|
this.config,
|
|
1592
1590
|
this.config.storage,
|
|
1593
|
-
options
|
|
1591
|
+
options,
|
|
1592
|
+
this.transportType
|
|
1594
1593
|
);
|
|
1595
1594
|
import_analytics2.analytics.track("mmconnect_wallet_action_requested", props);
|
|
1596
1595
|
});
|
|
@@ -1600,7 +1599,8 @@ trackWalletActionSucceeded_fn = function(options) {
|
|
|
1600
1599
|
const props = yield getWalletActionAnalyticsProperties(
|
|
1601
1600
|
this.config,
|
|
1602
1601
|
this.config.storage,
|
|
1603
|
-
options
|
|
1602
|
+
options,
|
|
1603
|
+
this.transportType
|
|
1604
1604
|
);
|
|
1605
1605
|
import_analytics2.analytics.track("mmconnect_wallet_action_succeeded", props);
|
|
1606
1606
|
});
|
|
@@ -1610,7 +1610,8 @@ trackWalletActionFailed_fn = function(options) {
|
|
|
1610
1610
|
const props = yield getWalletActionAnalyticsProperties(
|
|
1611
1611
|
this.config,
|
|
1612
1612
|
this.config.storage,
|
|
1613
|
-
options
|
|
1613
|
+
options,
|
|
1614
|
+
this.transportType
|
|
1614
1615
|
);
|
|
1615
1616
|
import_analytics2.analytics.track("mmconnect_wallet_action_failed", props);
|
|
1616
1617
|
});
|
|
@@ -1620,7 +1621,8 @@ trackWalletActionRejected_fn = function(options) {
|
|
|
1620
1621
|
const props = yield getWalletActionAnalyticsProperties(
|
|
1621
1622
|
this.config,
|
|
1622
1623
|
this.config.storage,
|
|
1623
|
-
options
|
|
1624
|
+
options,
|
|
1625
|
+
this.transportType
|
|
1624
1626
|
);
|
|
1625
1627
|
import_analytics2.analytics.track("mmconnect_wallet_action_rejected", props);
|
|
1626
1628
|
});
|
|
@@ -1630,7 +1632,7 @@ trackWalletActionRejected_fn = function(options) {
|
|
|
1630
1632
|
var import_multichain_api_client = require("@metamask/multichain-api-client");
|
|
1631
1633
|
init_utils2();
|
|
1632
1634
|
var DEFAULT_REQUEST_TIMEOUT = 60 * 1e3;
|
|
1633
|
-
var _notificationCallbacks, _transport, _defaultRequestOptions, _pendingRequests, _handleResponseListener, _handleNotificationListener, _DefaultTransport_instances, notifyCallbacks_fn, isMetamaskProviderEvent_fn, handleResponse_fn, handleNotification_fn, setupMessageListener_fn;
|
|
1635
|
+
var _notificationCallbacks, _transport, _defaultRequestOptions, _pendingRequests, _handleResponseListener, _handleNotificationListener, _DefaultTransport_instances, notifyCallbacks_fn, isMetamaskProviderEvent_fn, handleResponse_fn, handleNotification_fn, setupMessageListener_fn, init_fn;
|
|
1634
1636
|
var DefaultTransport = class {
|
|
1635
1637
|
constructor() {
|
|
1636
1638
|
__privateAdd(this, _DefaultTransport_instances);
|
|
@@ -1678,11 +1680,31 @@ var DefaultTransport = class {
|
|
|
1678
1680
|
});
|
|
1679
1681
|
});
|
|
1680
1682
|
}
|
|
1683
|
+
init() {
|
|
1684
|
+
return __async(this, null, function* () {
|
|
1685
|
+
yield __privateMethod(this, _DefaultTransport_instances, init_fn).call(this);
|
|
1686
|
+
let walletSession = { sessionScopes: {} };
|
|
1687
|
+
try {
|
|
1688
|
+
const sessionRequest = yield this.request(
|
|
1689
|
+
{ method: "wallet_getSession" },
|
|
1690
|
+
__privateGet(this, _defaultRequestOptions)
|
|
1691
|
+
);
|
|
1692
|
+
walletSession = sessionRequest.result;
|
|
1693
|
+
} catch (e) {
|
|
1694
|
+
console.error(
|
|
1695
|
+
"Failed to get wallet session during DefaultTransport init"
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1698
|
+
__privateMethod(this, _DefaultTransport_instances, notifyCallbacks_fn).call(this, {
|
|
1699
|
+
method: "wallet_sessionChanged",
|
|
1700
|
+
params: walletSession
|
|
1701
|
+
});
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1681
1704
|
connect(options) {
|
|
1682
1705
|
return __async(this, null, function* () {
|
|
1683
1706
|
var _a3, _b, _c, _d, _e;
|
|
1684
|
-
__privateMethod(this, _DefaultTransport_instances,
|
|
1685
|
-
yield __privateGet(this, _transport).connect();
|
|
1707
|
+
yield __privateMethod(this, _DefaultTransport_instances, init_fn).call(this);
|
|
1686
1708
|
const sessionRequest = yield this.request(
|
|
1687
1709
|
{ method: "wallet_getSession" },
|
|
1688
1710
|
__privateGet(this, _defaultRequestOptions)
|
|
@@ -1739,26 +1761,6 @@ var DefaultTransport = class {
|
|
|
1739
1761
|
disconnect() {
|
|
1740
1762
|
return __async(this, arguments, function* (scopes = []) {
|
|
1741
1763
|
yield this.request({ method: "wallet_revokeSession", params: { scopes } });
|
|
1742
|
-
const response = yield this.request({ method: "wallet_getSession" });
|
|
1743
|
-
const { sessionScopes } = response.result;
|
|
1744
|
-
if (Object.keys(sessionScopes).length > 0) {
|
|
1745
|
-
return;
|
|
1746
|
-
}
|
|
1747
|
-
__privateGet(this, _notificationCallbacks).clear();
|
|
1748
|
-
if (__privateGet(this, _handleResponseListener)) {
|
|
1749
|
-
window.removeEventListener("message", __privateGet(this, _handleResponseListener));
|
|
1750
|
-
__privateSet(this, _handleResponseListener, void 0);
|
|
1751
|
-
}
|
|
1752
|
-
if (__privateGet(this, _handleNotificationListener)) {
|
|
1753
|
-
window.removeEventListener("message", __privateGet(this, _handleNotificationListener));
|
|
1754
|
-
__privateSet(this, _handleNotificationListener, void 0);
|
|
1755
|
-
}
|
|
1756
|
-
for (const [, request] of __privateGet(this, _pendingRequests)) {
|
|
1757
|
-
clearTimeout(request.timeout);
|
|
1758
|
-
request.reject(new Error("Transport disconnected"));
|
|
1759
|
-
}
|
|
1760
|
-
__privateGet(this, _pendingRequests).clear();
|
|
1761
|
-
yield __privateGet(this, _transport).disconnect();
|
|
1762
1764
|
});
|
|
1763
1765
|
}
|
|
1764
1766
|
isConnected() {
|
|
@@ -1847,7 +1849,7 @@ handleNotification_fn = function(event) {
|
|
|
1847
1849
|
return;
|
|
1848
1850
|
}
|
|
1849
1851
|
const responseData = (_b = (_a3 = event == null ? void 0 : event.data) == null ? void 0 : _a3.data) == null ? void 0 : _b.data;
|
|
1850
|
-
if (typeof responseData === "object" && responseData.method === "metamask_chainChanged" || responseData.method === "metamask_accountsChanged") {
|
|
1852
|
+
if (typeof responseData === "object" && responseData !== null && (responseData.method === "metamask_chainChanged" || responseData.method === "metamask_accountsChanged")) {
|
|
1851
1853
|
__privateMethod(this, _DefaultTransport_instances, notifyCallbacks_fn).call(this, responseData);
|
|
1852
1854
|
}
|
|
1853
1855
|
};
|
|
@@ -1860,6 +1862,14 @@ setupMessageListener_fn = function() {
|
|
|
1860
1862
|
window.addEventListener("message", __privateGet(this, _handleResponseListener));
|
|
1861
1863
|
window.addEventListener("message", __privateGet(this, _handleNotificationListener));
|
|
1862
1864
|
};
|
|
1865
|
+
init_fn = function() {
|
|
1866
|
+
return __async(this, null, function* () {
|
|
1867
|
+
__privateMethod(this, _DefaultTransport_instances, setupMessageListener_fn).call(this);
|
|
1868
|
+
if (!__privateGet(this, _transport).isConnected()) {
|
|
1869
|
+
yield __privateGet(this, _transport).connect();
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
};
|
|
1863
1873
|
|
|
1864
1874
|
// src/multichain/transports/multichainApiClientWrapper/index.ts
|
|
1865
1875
|
var import_rpc_errors = require("@metamask/rpc-errors");
|
|
@@ -2257,6 +2267,10 @@ var MWPTransport = class {
|
|
|
2257
2267
|
}
|
|
2258
2268
|
});
|
|
2259
2269
|
}
|
|
2270
|
+
init() {
|
|
2271
|
+
return __async(this, null, function* () {
|
|
2272
|
+
});
|
|
2273
|
+
}
|
|
2260
2274
|
// TODO: Rename this
|
|
2261
2275
|
sendEip1193Message(payload, options) {
|
|
2262
2276
|
return __async(this, null, function* () {
|
|
@@ -2609,7 +2623,7 @@ var MWPTransport = class {
|
|
|
2609
2623
|
getActiveSession() {
|
|
2610
2624
|
return __async(this, null, function* () {
|
|
2611
2625
|
const { kvstore } = this;
|
|
2612
|
-
const sessionStore =
|
|
2626
|
+
const sessionStore = yield import_mobile_wallet_protocol_core.SessionStore.create(kvstore);
|
|
2613
2627
|
try {
|
|
2614
2628
|
const [activeSession] = yield sessionStore.list();
|
|
2615
2629
|
return activeSession;
|
|
@@ -2683,6 +2697,9 @@ var KeyManager = class {
|
|
|
2683
2697
|
return Buffer.from(decryptedBuffer).toString("utf8");
|
|
2684
2698
|
});
|
|
2685
2699
|
}
|
|
2700
|
+
validatePeerKey(key) {
|
|
2701
|
+
import_eciesjs.PublicKey.fromHex(Buffer.from(key).toString("hex"));
|
|
2702
|
+
}
|
|
2686
2703
|
};
|
|
2687
2704
|
var keymanager = new KeyManager();
|
|
2688
2705
|
|
|
@@ -2690,10 +2707,10 @@ var keymanager = new KeyManager();
|
|
|
2690
2707
|
init_utils2();
|
|
2691
2708
|
var logger2 = createLogger("metamask-sdk:core");
|
|
2692
2709
|
var SINGLETON_KEY = "__METAMASK_CONNECT_MULTICHAIN_SINGLETON__";
|
|
2693
|
-
var _a2, _provider, _providerTransportWrapper, _transport2, _dappClient, _beforeUnloadListener, _listener, _sdkInfo, _MetaMaskConnectMultichain_instances, setupAnalytics_fn, onTransportNotification_fn, getStoredTransport_fn, setupTransport_fn,
|
|
2710
|
+
var _a2, _provider, _providerTransportWrapper, _transport2, _dappClient, _beforeUnloadListener, _listener, _sdkInfo, _MetaMaskConnectMultichain_instances, setupAnalytics_fn, onTransportNotification_fn, getStoredTransport_fn, setupTransport_fn, init_fn2, createDappClient_fn, setupMWP_fn, onBeforeUnload_fn, createBeforeUnloadListener_fn, renderInstallModalAsync_fn, showInstallModal_fn, headlessConnect_fn, setupDefaultTransport_fn, deeplinkConnect_fn, handleConnection_fn, getCaipSession_fn, openConnectDeeplinkIfNeeded_fn;
|
|
2694
2711
|
var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends MultichainCore {
|
|
2695
2712
|
constructor(options) {
|
|
2696
|
-
var _a3, _b, _c, _d, _e, _f;
|
|
2713
|
+
var _a3, _b, _c, _d, _e, _f, _g;
|
|
2697
2714
|
const withDappMetadata = setupDappMetadata(options);
|
|
2698
2715
|
const integrationType = (_b = (_a3 = options.analytics) == null ? void 0 : _a3.integrationType) != null ? _b : "direct";
|
|
2699
2716
|
const allOptions = __spreadProps(__spreadValues({}, withDappMetadata), {
|
|
@@ -2704,7 +2721,10 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2704
2721
|
}),
|
|
2705
2722
|
analytics: __spreadProps(__spreadValues({}, (_f = options.analytics) != null ? _f : {}), {
|
|
2706
2723
|
integrationType
|
|
2707
|
-
})
|
|
2724
|
+
}),
|
|
2725
|
+
versions: __spreadValues({
|
|
2726
|
+
"connect-multichain": "0.9.0"
|
|
2727
|
+
}, (_g = options.versions) != null ? _g : {})
|
|
2708
2728
|
});
|
|
2709
2729
|
super(allOptions);
|
|
2710
2730
|
__privateAdd(this, _MetaMaskConnectMultichain_instances);
|
|
@@ -2728,6 +2748,9 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2728
2748
|
}
|
|
2729
2749
|
set status(value) {
|
|
2730
2750
|
var _a3, _b;
|
|
2751
|
+
if (this._status === value) {
|
|
2752
|
+
return;
|
|
2753
|
+
}
|
|
2731
2754
|
this._status = value;
|
|
2732
2755
|
(_b = (_a3 = this.options.transport) == null ? void 0 : _a3.onNotification) == null ? void 0 : _b.call(_a3, {
|
|
2733
2756
|
method: "stateChanged",
|
|
@@ -2758,23 +2781,28 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2758
2781
|
// Creates a singleton instance of MetaMaskConnectMultichain.
|
|
2759
2782
|
// If the singleton already exists, it merges the incoming options with the
|
|
2760
2783
|
// existing singleton options for the following keys: `api.supportedNetworks`,
|
|
2761
|
-
// `ui.*`, `mobile.*`, `transport.extensionId`, `debug`. Take note
|
|
2762
|
-
// value for `dapp` is not merged as it does not make sense for
|
|
2763
|
-
// `createMultichainClient` to have a different `dapp` value.
|
|
2784
|
+
// `versions`, `ui.*`, `mobile.*`, `transport.extensionId`, `debug`. Take note
|
|
2785
|
+
// that the value for `dapp` is not merged as it does not make sense for
|
|
2786
|
+
// subsequent calls to `createMultichainClient` to have a different `dapp` value.
|
|
2764
2787
|
static create(options) {
|
|
2765
2788
|
return __async(this, null, function* () {
|
|
2789
|
+
var _a3;
|
|
2766
2790
|
const globalObject = getGlobalObject();
|
|
2767
2791
|
const existing = globalObject[SINGLETON_KEY];
|
|
2768
2792
|
if (existing) {
|
|
2769
2793
|
const instance = yield existing;
|
|
2770
2794
|
instance.mergeOptions(options);
|
|
2795
|
+
import_analytics4.analytics.setGlobalProperty(
|
|
2796
|
+
"mmconnect_versions",
|
|
2797
|
+
(_a3 = instance.options.versions) != null ? _a3 : {}
|
|
2798
|
+
);
|
|
2771
2799
|
if (options.debug) {
|
|
2772
2800
|
enableDebug("metamask-sdk:*");
|
|
2773
2801
|
}
|
|
2774
2802
|
return instance;
|
|
2775
2803
|
}
|
|
2776
2804
|
const instancePromise = (() => __async(null, null, function* () {
|
|
2777
|
-
var
|
|
2805
|
+
var _a4;
|
|
2778
2806
|
const instance = new _MetaMaskConnectMultichain(options);
|
|
2779
2807
|
const isEnabled2 = yield isEnabled(
|
|
2780
2808
|
"metamask-sdk:core",
|
|
@@ -2783,7 +2811,7 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2783
2811
|
if (isEnabled2) {
|
|
2784
2812
|
enableDebug("metamask-sdk:core");
|
|
2785
2813
|
}
|
|
2786
|
-
yield __privateMethod(
|
|
2814
|
+
yield __privateMethod(_a4 = instance, _MetaMaskConnectMultichain_instances, init_fn2).call(_a4);
|
|
2787
2815
|
return instance;
|
|
2788
2816
|
}))();
|
|
2789
2817
|
globalObject[SINGLETON_KEY] = instancePromise;
|
|
@@ -2893,14 +2921,16 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2893
2921
|
);
|
|
2894
2922
|
yield (_a3 = __privateGet(this, _transport2)) == null ? void 0 : _a3.disconnect(scopes);
|
|
2895
2923
|
if (remainingScopes.length === 0) {
|
|
2896
|
-
yield (_b = __privateGet(this, _listener)) == null ? void 0 : _b.call(this);
|
|
2897
|
-
(_c = __privateGet(this, _beforeUnloadListener)) == null ? void 0 : _c.call(this);
|
|
2898
2924
|
yield this.storage.removeTransport();
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2925
|
+
if (this.transportType !== "browser" /* Browser */) {
|
|
2926
|
+
yield (_b = __privateGet(this, _listener)) == null ? void 0 : _b.call(this);
|
|
2927
|
+
(_c = __privateGet(this, _beforeUnloadListener)) == null ? void 0 : _c.call(this);
|
|
2928
|
+
__privateSet(this, _listener, void 0);
|
|
2929
|
+
__privateSet(this, _beforeUnloadListener, void 0);
|
|
2930
|
+
__privateSet(this, _transport2, void 0);
|
|
2931
|
+
__privateGet(this, _providerTransportWrapper).clearTransportNotificationListener();
|
|
2932
|
+
__privateSet(this, _dappClient, void 0);
|
|
2933
|
+
}
|
|
2904
2934
|
this.status = "disconnected";
|
|
2905
2935
|
}
|
|
2906
2936
|
});
|
|
@@ -2909,7 +2939,12 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2909
2939
|
return __async(this, null, function* () {
|
|
2910
2940
|
const { transport, options } = this;
|
|
2911
2941
|
const rpcClient = new RpcClient(options, __privateGet(this, _sdkInfo));
|
|
2912
|
-
const requestRouter = new RequestRouter(
|
|
2942
|
+
const requestRouter = new RequestRouter(
|
|
2943
|
+
transport,
|
|
2944
|
+
rpcClient,
|
|
2945
|
+
options,
|
|
2946
|
+
this.transportType
|
|
2947
|
+
);
|
|
2913
2948
|
return requestRouter.invokeMethod(request);
|
|
2914
2949
|
});
|
|
2915
2950
|
}
|
|
@@ -2939,16 +2974,16 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2939
2974
|
// without having to concern themselves with the current transport connection status.
|
|
2940
2975
|
emitSessionChanged() {
|
|
2941
2976
|
return __async(this, null, function* () {
|
|
2942
|
-
var _a3;
|
|
2977
|
+
var _a3, _b;
|
|
2943
2978
|
const emptySession = { sessionScopes: {} };
|
|
2944
|
-
if (this
|
|
2979
|
+
if (!((_a3 = __privateGet(this, _transport2)) == null ? void 0 : _a3.isConnected())) {
|
|
2945
2980
|
this.emit("wallet_sessionChanged", emptySession);
|
|
2946
2981
|
return;
|
|
2947
2982
|
}
|
|
2948
2983
|
const response = yield this.transport.request({
|
|
2949
2984
|
method: "wallet_getSession"
|
|
2950
2985
|
});
|
|
2951
|
-
this.emit("wallet_sessionChanged", (
|
|
2986
|
+
this.emit("wallet_sessionChanged", (_b = response.result) != null ? _b : emptySession);
|
|
2952
2987
|
});
|
|
2953
2988
|
}
|
|
2954
2989
|
};
|
|
@@ -2962,20 +2997,22 @@ _sdkInfo = new WeakMap();
|
|
|
2962
2997
|
_MetaMaskConnectMultichain_instances = new WeakSet();
|
|
2963
2998
|
setupAnalytics_fn = function() {
|
|
2964
2999
|
return __async(this, null, function* () {
|
|
2965
|
-
var _a3;
|
|
3000
|
+
var _a3, _b;
|
|
2966
3001
|
const platform = getPlatformType();
|
|
2967
3002
|
const isBrowser = platform === "in-app-browser" /* MetaMaskMobileWebview */ || platform === "web-desktop" /* DesktopWeb */ || platform === "web-mobile" /* MobileWeb */;
|
|
2968
3003
|
const isReactNative2 = platform === "react-native" /* ReactNative */;
|
|
2969
3004
|
if (!isBrowser && !isReactNative2) {
|
|
2970
3005
|
return;
|
|
2971
3006
|
}
|
|
2972
|
-
const version = getVersion();
|
|
2973
3007
|
const dappId = getDappId(this.options.dapp);
|
|
2974
3008
|
const anonId = yield this.storage.getAnonId();
|
|
2975
3009
|
const { integrationType } = (_a3 = this.options.analytics) != null ? _a3 : {
|
|
2976
3010
|
integrationType: ""
|
|
2977
3011
|
};
|
|
2978
|
-
import_analytics4.analytics.setGlobalProperty(
|
|
3012
|
+
import_analytics4.analytics.setGlobalProperty(
|
|
3013
|
+
"mmconnect_versions",
|
|
3014
|
+
(_b = this.options.versions) != null ? _b : {}
|
|
3015
|
+
);
|
|
2979
3016
|
import_analytics4.analytics.setGlobalProperty("dapp_id", dappId);
|
|
2980
3017
|
import_analytics4.analytics.setGlobalProperty("anon_id", anonId);
|
|
2981
3018
|
import_analytics4.analytics.setGlobalProperty("platform", platform);
|
|
@@ -2985,9 +3022,17 @@ setupAnalytics_fn = function() {
|
|
|
2985
3022
|
};
|
|
2986
3023
|
onTransportNotification_fn = function(payload) {
|
|
2987
3024
|
return __async(this, null, function* () {
|
|
2988
|
-
var _a3;
|
|
3025
|
+
var _a3, _b, _c;
|
|
2989
3026
|
if (typeof payload === "object" && payload !== null && "method" in payload) {
|
|
2990
|
-
|
|
3027
|
+
if (payload.method === "wallet_sessionChanged") {
|
|
3028
|
+
const sessionScopes = (_b = (_a3 = payload.params) == null ? void 0 : _a3.sessionScopes) != null ? _b : {};
|
|
3029
|
+
const hasScopes = Object.keys(sessionScopes).length > 0;
|
|
3030
|
+
if (this.status === "loaded" && !hasScopes) {
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
3033
|
+
this.status = hasScopes ? "connected" : "disconnected";
|
|
3034
|
+
}
|
|
3035
|
+
this.emit(payload.method, (_c = payload.params) != null ? _c : payload.result);
|
|
2991
3036
|
}
|
|
2992
3037
|
});
|
|
2993
3038
|
};
|
|
@@ -3025,6 +3070,7 @@ getStoredTransport_fn = function() {
|
|
|
3025
3070
|
};
|
|
3026
3071
|
setupTransport_fn = function() {
|
|
3027
3072
|
return __async(this, null, function* () {
|
|
3073
|
+
var _a3;
|
|
3028
3074
|
const transport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, getStoredTransport_fn).call(this);
|
|
3029
3075
|
if (transport) {
|
|
3030
3076
|
if (!this.transport.isConnected()) {
|
|
@@ -3039,23 +3085,24 @@ setupTransport_fn = function() {
|
|
|
3039
3085
|
}
|
|
3040
3086
|
} else {
|
|
3041
3087
|
this.status = "loaded";
|
|
3088
|
+
const hasExtensionInstalled = yield hasExtension();
|
|
3089
|
+
const preferExtension = (_a3 = this.options.ui.preferExtension) != null ? _a3 : true;
|
|
3090
|
+
if (hasExtensionInstalled && preferExtension) {
|
|
3091
|
+
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupDefaultTransport_fn).call(this, { persist: false });
|
|
3092
|
+
try {
|
|
3093
|
+
yield this.transport.init();
|
|
3094
|
+
} catch (error) {
|
|
3095
|
+
console.error("Passive init failed:", error);
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3042
3098
|
}
|
|
3043
3099
|
});
|
|
3044
3100
|
};
|
|
3045
|
-
|
|
3101
|
+
init_fn2 = function() {
|
|
3046
3102
|
return __async(this, null, function* () {
|
|
3047
3103
|
try {
|
|
3048
3104
|
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupAnalytics_fn).call(this);
|
|
3049
3105
|
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupTransport_fn).call(this);
|
|
3050
|
-
try {
|
|
3051
|
-
const baseProps = yield getBaseAnalyticsProperties(
|
|
3052
|
-
this.options,
|
|
3053
|
-
this.storage
|
|
3054
|
-
);
|
|
3055
|
-
import_analytics4.analytics.track("mmconnect_initialized", baseProps);
|
|
3056
|
-
} catch (error) {
|
|
3057
|
-
logger2("Error tracking initialized event", error);
|
|
3058
|
-
}
|
|
3059
3106
|
} catch (error) {
|
|
3060
3107
|
yield this.storage.removeTransport();
|
|
3061
3108
|
this.status = "pending";
|
|
@@ -3066,7 +3113,7 @@ init_fn = function() {
|
|
|
3066
3113
|
createDappClient_fn = function() {
|
|
3067
3114
|
return __async(this, null, function* () {
|
|
3068
3115
|
const { adapter: kvstore } = this.options.storage;
|
|
3069
|
-
const sessionstore =
|
|
3116
|
+
const sessionstore = yield import_mobile_wallet_protocol_core2.SessionStore.create(kvstore);
|
|
3070
3117
|
const websocket = (
|
|
3071
3118
|
// eslint-disable-next-line no-negated-condition
|
|
3072
3119
|
typeof window !== "undefined" ? WebSocket : (yield import("ws")).WebSocket
|
|
@@ -3243,9 +3290,13 @@ headlessConnect_fn = function(scopes, caipAccountIds, sessionProperties) {
|
|
|
3243
3290
|
});
|
|
3244
3291
|
};
|
|
3245
3292
|
setupDefaultTransport_fn = function() {
|
|
3246
|
-
return __async(this,
|
|
3247
|
-
this
|
|
3248
|
-
|
|
3293
|
+
return __async(this, arguments, function* (options = { persist: true }) {
|
|
3294
|
+
if (__privateGet(this, _transport2) instanceof DefaultTransport) {
|
|
3295
|
+
return __privateGet(this, _transport2);
|
|
3296
|
+
}
|
|
3297
|
+
if (options == null ? void 0 : options.persist) {
|
|
3298
|
+
yield this.storage.setTransport("browser" /* Browser */);
|
|
3299
|
+
}
|
|
3249
3300
|
const transport = new DefaultTransport();
|
|
3250
3301
|
__privateSet(this, _listener, transport.onNotification(
|
|
3251
3302
|
__privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
|
|
@@ -3363,16 +3414,20 @@ handleConnection_fn = function(promise, scopes, transportType) {
|
|
|
3363
3414
|
};
|
|
3364
3415
|
getCaipSession_fn = function() {
|
|
3365
3416
|
return __async(this, null, function* () {
|
|
3417
|
+
var _a3;
|
|
3366
3418
|
let sessionData = {
|
|
3367
3419
|
sessionScopes: {},
|
|
3368
3420
|
sessionProperties: {}
|
|
3369
3421
|
};
|
|
3370
|
-
if (this
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3422
|
+
if ((_a3 = __privateGet(this, _transport2)) == null ? void 0 : _a3.isConnected()) {
|
|
3423
|
+
try {
|
|
3424
|
+
const response = yield this.transport.request({
|
|
3425
|
+
method: "wallet_getSession"
|
|
3426
|
+
});
|
|
3427
|
+
if (response.result) {
|
|
3428
|
+
sessionData = response.result;
|
|
3429
|
+
}
|
|
3430
|
+
} catch (e) {
|
|
3376
3431
|
}
|
|
3377
3432
|
}
|
|
3378
3433
|
return sessionData;
|
|
@@ -3701,7 +3756,6 @@ var BaseModalFactory = class {
|
|
|
3701
3756
|
parentElement,
|
|
3702
3757
|
showInstallModal,
|
|
3703
3758
|
link: qrCodeLink,
|
|
3704
|
-
sdkVersion: getVersion(),
|
|
3705
3759
|
generateQRCode: (request) => __async(this, null, function* () {
|
|
3706
3760
|
var _a4;
|
|
3707
3761
|
const newLink = this.createConnectionDeeplink(request);
|
|
@@ -3727,7 +3781,6 @@ var BaseModalFactory = class {
|
|
|
3727
3781
|
const otpCode = yield createOTPCode();
|
|
3728
3782
|
const modal = new this.options.OTPCodeModal({
|
|
3729
3783
|
parentElement: container,
|
|
3730
|
-
sdkVersion: getVersion(),
|
|
3731
3784
|
otpCode,
|
|
3732
3785
|
onClose: this.onCloseModal.bind(this),
|
|
3733
3786
|
createOTPCode,
|