@metamask/connect-multichain 0.8.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 +20 -1
- package/README.md +20 -19
- package/dist/browser/es/connect-multichain.d.mts +18 -5
- package/dist/browser/es/connect-multichain.mjs +63 -55
- 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 +18 -5
- package/dist/browser/iife/connect-multichain.js +68 -71
- 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 +18 -5
- package/dist/browser/umd/connect-multichain.js +63 -55
- 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 +18 -5
- package/dist/node/cjs/connect-multichain.js +63 -54
- 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 +18 -5
- package/dist/node/es/connect-multichain.mjs +63 -54
- 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 +18 -5
- package/dist/react-native/es/connect-multichain.mjs +63 -54
- 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 +12 -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 +11 -17
- 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.map +1 -1
- package/dist/src/multichain/transports/default/index.js +7 -1
- package/dist/src/multichain/transports/default/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 +18 -5
- package/package.json +3 -3
|
@@ -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.
|
|
@@ -519,7 +530,7 @@ declare abstract class MultichainCore extends EventEmitter<SDKEvents> {
|
|
|
519
530
|
constructor(options: MultichainOptions);
|
|
520
531
|
/**
|
|
521
532
|
* Merges the given options into the current instance options.
|
|
522
|
-
* 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).
|
|
523
534
|
* The main thing to note is that the value for `dapp` is not merged as it does not make sense for
|
|
524
535
|
* subsequent calls to `createMultichainClient` to have a different `dapp` value.
|
|
525
536
|
* Used when createMultichainClient is called with an existing singleton.
|
|
@@ -658,15 +669,17 @@ declare function isRejectionError(error: unknown): boolean;
|
|
|
658
669
|
* @param options - Multichain options containing dapp and analytics config
|
|
659
670
|
* @param storage - Storage client for getting anonymous ID
|
|
660
671
|
* @param invokeOptions - The invoke method options containing method and scope
|
|
672
|
+
* @param transportType - The transport type to use for the analytics event
|
|
661
673
|
* @returns Wallet action analytics properties
|
|
662
674
|
*/
|
|
663
|
-
declare function getWalletActionAnalyticsProperties(options: MultichainOptions, storage: StoreClient, invokeOptions: InvokeMethodOptions): Promise<{
|
|
664
|
-
|
|
675
|
+
declare function getWalletActionAnalyticsProperties(options: MultichainOptions, storage: StoreClient, invokeOptions: InvokeMethodOptions, transportType: TransportType): Promise<{
|
|
676
|
+
mmconnect_versions: Record<string, string>;
|
|
665
677
|
dapp_id: string;
|
|
666
678
|
method: string;
|
|
667
679
|
integration_type: string;
|
|
668
680
|
caip_chain_id: string;
|
|
669
681
|
anon_id: string;
|
|
682
|
+
transport_type: TransportType;
|
|
670
683
|
}>;
|
|
671
684
|
|
|
672
685
|
/**
|
|
@@ -678,4 +691,4 @@ declare function getVersion(): string;
|
|
|
678
691
|
|
|
679
692
|
declare const createMultichainClient: CreateMultichainFN;
|
|
680
693
|
|
|
681
|
-
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
|
});
|
|
@@ -1863,7 +1865,9 @@ setupMessageListener_fn = function() {
|
|
|
1863
1865
|
init_fn = function() {
|
|
1864
1866
|
return __async(this, null, function* () {
|
|
1865
1867
|
__privateMethod(this, _DefaultTransport_instances, setupMessageListener_fn).call(this);
|
|
1866
|
-
|
|
1868
|
+
if (!__privateGet(this, _transport).isConnected()) {
|
|
1869
|
+
yield __privateGet(this, _transport).connect();
|
|
1870
|
+
}
|
|
1867
1871
|
});
|
|
1868
1872
|
};
|
|
1869
1873
|
|
|
@@ -2706,7 +2710,7 @@ var SINGLETON_KEY = "__METAMASK_CONNECT_MULTICHAIN_SINGLETON__";
|
|
|
2706
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;
|
|
2707
2711
|
var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends MultichainCore {
|
|
2708
2712
|
constructor(options) {
|
|
2709
|
-
var _a3, _b, _c, _d, _e, _f;
|
|
2713
|
+
var _a3, _b, _c, _d, _e, _f, _g;
|
|
2710
2714
|
const withDappMetadata = setupDappMetadata(options);
|
|
2711
2715
|
const integrationType = (_b = (_a3 = options.analytics) == null ? void 0 : _a3.integrationType) != null ? _b : "direct";
|
|
2712
2716
|
const allOptions = __spreadProps(__spreadValues({}, withDappMetadata), {
|
|
@@ -2717,7 +2721,10 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2717
2721
|
}),
|
|
2718
2722
|
analytics: __spreadProps(__spreadValues({}, (_f = options.analytics) != null ? _f : {}), {
|
|
2719
2723
|
integrationType
|
|
2720
|
-
})
|
|
2724
|
+
}),
|
|
2725
|
+
versions: __spreadValues({
|
|
2726
|
+
"connect-multichain": "0.9.0"
|
|
2727
|
+
}, (_g = options.versions) != null ? _g : {})
|
|
2721
2728
|
});
|
|
2722
2729
|
super(allOptions);
|
|
2723
2730
|
__privateAdd(this, _MetaMaskConnectMultichain_instances);
|
|
@@ -2774,23 +2781,28 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2774
2781
|
// Creates a singleton instance of MetaMaskConnectMultichain.
|
|
2775
2782
|
// If the singleton already exists, it merges the incoming options with the
|
|
2776
2783
|
// existing singleton options for the following keys: `api.supportedNetworks`,
|
|
2777
|
-
// `ui.*`, `mobile.*`, `transport.extensionId`, `debug`. Take note
|
|
2778
|
-
// value for `dapp` is not merged as it does not make sense for
|
|
2779
|
-
// `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.
|
|
2780
2787
|
static create(options) {
|
|
2781
2788
|
return __async(this, null, function* () {
|
|
2789
|
+
var _a3;
|
|
2782
2790
|
const globalObject = getGlobalObject();
|
|
2783
2791
|
const existing = globalObject[SINGLETON_KEY];
|
|
2784
2792
|
if (existing) {
|
|
2785
2793
|
const instance = yield existing;
|
|
2786
2794
|
instance.mergeOptions(options);
|
|
2795
|
+
import_analytics4.analytics.setGlobalProperty(
|
|
2796
|
+
"mmconnect_versions",
|
|
2797
|
+
(_a3 = instance.options.versions) != null ? _a3 : {}
|
|
2798
|
+
);
|
|
2787
2799
|
if (options.debug) {
|
|
2788
2800
|
enableDebug("metamask-sdk:*");
|
|
2789
2801
|
}
|
|
2790
2802
|
return instance;
|
|
2791
2803
|
}
|
|
2792
2804
|
const instancePromise = (() => __async(null, null, function* () {
|
|
2793
|
-
var
|
|
2805
|
+
var _a4;
|
|
2794
2806
|
const instance = new _MetaMaskConnectMultichain(options);
|
|
2795
2807
|
const isEnabled2 = yield isEnabled(
|
|
2796
2808
|
"metamask-sdk:core",
|
|
@@ -2799,7 +2811,7 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2799
2811
|
if (isEnabled2) {
|
|
2800
2812
|
enableDebug("metamask-sdk:core");
|
|
2801
2813
|
}
|
|
2802
|
-
yield __privateMethod(
|
|
2814
|
+
yield __privateMethod(_a4 = instance, _MetaMaskConnectMultichain_instances, init_fn2).call(_a4);
|
|
2803
2815
|
return instance;
|
|
2804
2816
|
}))();
|
|
2805
2817
|
globalObject[SINGLETON_KEY] = instancePromise;
|
|
@@ -2927,7 +2939,12 @@ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends Multic
|
|
|
2927
2939
|
return __async(this, null, function* () {
|
|
2928
2940
|
const { transport, options } = this;
|
|
2929
2941
|
const rpcClient = new RpcClient(options, __privateGet(this, _sdkInfo));
|
|
2930
|
-
const requestRouter = new RequestRouter(
|
|
2942
|
+
const requestRouter = new RequestRouter(
|
|
2943
|
+
transport,
|
|
2944
|
+
rpcClient,
|
|
2945
|
+
options,
|
|
2946
|
+
this.transportType
|
|
2947
|
+
);
|
|
2931
2948
|
return requestRouter.invokeMethod(request);
|
|
2932
2949
|
});
|
|
2933
2950
|
}
|
|
@@ -2980,20 +2997,22 @@ _sdkInfo = new WeakMap();
|
|
|
2980
2997
|
_MetaMaskConnectMultichain_instances = new WeakSet();
|
|
2981
2998
|
setupAnalytics_fn = function() {
|
|
2982
2999
|
return __async(this, null, function* () {
|
|
2983
|
-
var _a3;
|
|
3000
|
+
var _a3, _b;
|
|
2984
3001
|
const platform = getPlatformType();
|
|
2985
3002
|
const isBrowser = platform === "in-app-browser" /* MetaMaskMobileWebview */ || platform === "web-desktop" /* DesktopWeb */ || platform === "web-mobile" /* MobileWeb */;
|
|
2986
3003
|
const isReactNative2 = platform === "react-native" /* ReactNative */;
|
|
2987
3004
|
if (!isBrowser && !isReactNative2) {
|
|
2988
3005
|
return;
|
|
2989
3006
|
}
|
|
2990
|
-
const version = getVersion();
|
|
2991
3007
|
const dappId = getDappId(this.options.dapp);
|
|
2992
3008
|
const anonId = yield this.storage.getAnonId();
|
|
2993
3009
|
const { integrationType } = (_a3 = this.options.analytics) != null ? _a3 : {
|
|
2994
3010
|
integrationType: ""
|
|
2995
3011
|
};
|
|
2996
|
-
import_analytics4.analytics.setGlobalProperty(
|
|
3012
|
+
import_analytics4.analytics.setGlobalProperty(
|
|
3013
|
+
"mmconnect_versions",
|
|
3014
|
+
(_b = this.options.versions) != null ? _b : {}
|
|
3015
|
+
);
|
|
2997
3016
|
import_analytics4.analytics.setGlobalProperty("dapp_id", dappId);
|
|
2998
3017
|
import_analytics4.analytics.setGlobalProperty("anon_id", anonId);
|
|
2999
3018
|
import_analytics4.analytics.setGlobalProperty("platform", platform);
|
|
@@ -3084,15 +3103,6 @@ init_fn2 = function() {
|
|
|
3084
3103
|
try {
|
|
3085
3104
|
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupAnalytics_fn).call(this);
|
|
3086
3105
|
yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupTransport_fn).call(this);
|
|
3087
|
-
try {
|
|
3088
|
-
const baseProps = yield getBaseAnalyticsProperties(
|
|
3089
|
-
this.options,
|
|
3090
|
-
this.storage
|
|
3091
|
-
);
|
|
3092
|
-
import_analytics4.analytics.track("mmconnect_initialized", baseProps);
|
|
3093
|
-
} catch (error) {
|
|
3094
|
-
logger2("Error tracking initialized event", error);
|
|
3095
|
-
}
|
|
3096
3106
|
} catch (error) {
|
|
3097
3107
|
yield this.storage.removeTransport();
|
|
3098
3108
|
this.status = "pending";
|
|
@@ -3746,7 +3756,6 @@ var BaseModalFactory = class {
|
|
|
3746
3756
|
parentElement,
|
|
3747
3757
|
showInstallModal,
|
|
3748
3758
|
link: qrCodeLink,
|
|
3749
|
-
sdkVersion: getVersion(),
|
|
3750
3759
|
generateQRCode: (request) => __async(this, null, function* () {
|
|
3751
3760
|
var _a4;
|
|
3752
3761
|
const newLink = this.createConnectionDeeplink(request);
|
|
@@ -3772,7 +3781,6 @@ var BaseModalFactory = class {
|
|
|
3772
3781
|
const otpCode = yield createOTPCode();
|
|
3773
3782
|
const modal = new this.options.OTPCodeModal({
|
|
3774
3783
|
parentElement: container,
|
|
3775
|
-
sdkVersion: getVersion(),
|
|
3776
3784
|
otpCode,
|
|
3777
3785
|
onClose: this.onCloseModal.bind(this),
|
|
3778
3786
|
createOTPCode,
|