@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
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.9.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `versions` constructor option to `createMultichainClient` so chain-specific packages (`connect-evm`, `connect-solana`) can report their version in analytics events. Versions are merged into the singleton on each call, following the same pattern as `api.supportedNetworks`. ([#206](https://github.com/MetaMask/connect-monorepo/pull/206))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **BREAKING** `mmconnect_versions` analytics property is now a `Record<string, string>` keyed by package name instead of a plain version string ([#206](https://github.com/MetaMask/connect-monorepo/pull/206))
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
|
|
22
|
+
- Stop passing `sdkVersion` to install and OTP modals ([#212](https://github.com/MetaMask/connect-monorepo/pull/212))
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Fix a bug where wallet_sessionChanged events were failing to propagate to the `ConnectMultichain` instance when the `DefaultTransport` is using the `WindowPostMessageTransport`. This was affecting Firefox, both iOS and Android in-app browsers ([#204](https://github.com/MetaMask/connect-monorepo/pull/204))
|
|
27
|
+
|
|
28
|
+
## [0.8.0]
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Enable `ConnectMultichain` to automatically handle `wallet_sessionChanged` events when MetaMask extension is detected (Desktop Chrome/Firefox, or Mobile In-App Browser) and `preferExtension: true` without needing the user to explicitly connect via `ConnectMultichain.connect()` ([#198](https://github.com/MetaMask/connect-monorepo/pull/198/))
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- Bump `@metamask/mobile-wallet-protocol-core` to `^0.4.0` ([#201](https://github.com/MetaMask/connect-monorepo/pull/201))
|
|
37
|
+
- Bump `@metamask/mobile-wallet-protocol-dapp-client` to `^0.3.0` ([#201](https://github.com/MetaMask/connect-monorepo/pull/201))
|
|
38
|
+
|
|
10
39
|
## [0.7.0]
|
|
11
40
|
|
|
12
41
|
### Changed
|
|
@@ -170,7 +199,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
170
199
|
|
|
171
200
|
- Initial release
|
|
172
201
|
|
|
173
|
-
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.
|
|
202
|
+
[Unreleased]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.9.0...HEAD
|
|
203
|
+
[0.9.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.8.0...@metamask/connect-multichain@0.9.0
|
|
204
|
+
[0.8.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.7.0...@metamask/connect-multichain@0.8.0
|
|
174
205
|
[0.7.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.6.0...@metamask/connect-multichain@0.7.0
|
|
175
206
|
[0.6.0]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.5.3...@metamask/connect-multichain@0.6.0
|
|
176
207
|
[0.5.3]: https://github.com/MetaMask/connect-monorepo/compare/@metamask/connect-multichain@0.5.2...@metamask/connect-multichain@0.5.3
|
package/README.md
CHANGED
|
@@ -134,28 +134,29 @@ This package is written in TypeScript and includes full type definitions. No add
|
|
|
134
134
|
|
|
135
135
|
Factory function to create a new Multichain SDK instance.
|
|
136
136
|
|
|
137
|
-
> **Singleton:** `createMultichainClient` returns a single shared instance per global context. Calling it a second time with different options will merge the new `api.supportedNetworks`, `ui.*`, `mobile.*`, `transport.extensionId`, and `debug` values into the existing instance rather than creating a new one. The `dapp` value is never overwritten on subsequent calls.
|
|
137
|
+
> **Singleton:** `createMultichainClient` returns a single shared instance per global context. Calling it a second time with different options will merge the new `api.supportedNetworks`, `versions`, `ui.*`, `mobile.*`, `transport.extensionId`, and `debug` values into the existing instance rather than creating a new one. The `dapp` value is never overwritten on subsequent calls.
|
|
138
138
|
|
|
139
139
|
#### Parameters
|
|
140
140
|
|
|
141
|
-
| Option | Type | Required | Description
|
|
142
|
-
| --------------------------- | --------------------------------------------- | -------- |
|
|
143
|
-
| `dapp.name` | `string` | Yes | Name of your dApp
|
|
144
|
-
| `api.supportedNetworks` | `RpcUrlsMap` | Yes | Map of [CAIP-2 chain IDs](https://chainagnostic.org/CAIPs/caip-2) to RPC URLs
|
|
145
|
-
| `dapp.url` | `string` | No | URL of your dApp
|
|
146
|
-
| `dapp.iconUrl` | `string` | No | Icon URL for your dApp
|
|
147
|
-
| `dapp.base64Icon` | `string` | No | Base64-encoded icon (alternative to iconUrl)
|
|
148
|
-
| `storage` | `StoreClient` | No | Custom storage adapter
|
|
149
|
-
| `ui.factory` | `BaseModalFactory` | No | Custom modal factory
|
|
150
|
-
| `ui.headless` | `boolean` | No | Run without UI (for custom QR implementations)
|
|
151
|
-
| `ui.preferExtension` | `boolean` | No | Prefer browser extension (default: true)
|
|
152
|
-
| `ui.showInstallModal` | `boolean` | No | Show installation modal
|
|
153
|
-
| `mobile.preferredOpenLink` | `(deeplink: string, target?: string) => void` | No | Custom deeplink handler
|
|
154
|
-
| `mobile.useDeeplink` | `boolean` | No | Use `metamask://` instead of universal links
|
|
155
|
-
| `analytics.integrationType` | `string` | No | Integration type for analytics
|
|
156
|
-
| `transport.extensionId` | `string` | No | Custom extension ID
|
|
157
|
-
| `transport.onNotification` | `(notification: unknown) => void` | No | Notification handler
|
|
158
|
-
| `
|
|
141
|
+
| Option | Type | Required | Description |
|
|
142
|
+
| --------------------------- | --------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
|
|
143
|
+
| `dapp.name` | `string` | Yes | Name of your dApp |
|
|
144
|
+
| `api.supportedNetworks` | `RpcUrlsMap` | Yes | Map of [CAIP-2 chain IDs](https://chainagnostic.org/CAIPs/caip-2) to RPC URLs |
|
|
145
|
+
| `dapp.url` | `string` | No | URL of your dApp |
|
|
146
|
+
| `dapp.iconUrl` | `string` | No | Icon URL for your dApp |
|
|
147
|
+
| `dapp.base64Icon` | `string` | No | Base64-encoded icon (alternative to iconUrl) |
|
|
148
|
+
| `storage` | `StoreClient` | No | Custom storage adapter |
|
|
149
|
+
| `ui.factory` | `BaseModalFactory` | No | Custom modal factory |
|
|
150
|
+
| `ui.headless` | `boolean` | No | Run without UI (for custom QR implementations) |
|
|
151
|
+
| `ui.preferExtension` | `boolean` | No | Prefer browser extension (default: true) |
|
|
152
|
+
| `ui.showInstallModal` | `boolean` | No | Show installation modal |
|
|
153
|
+
| `mobile.preferredOpenLink` | `(deeplink: string, target?: string) => void` | No | Custom deeplink handler |
|
|
154
|
+
| `mobile.useDeeplink` | `boolean` | No | Use `metamask://` instead of universal links |
|
|
155
|
+
| `analytics.integrationType` | `string` | No | Integration type for analytics |
|
|
156
|
+
| `transport.extensionId` | `string` | No | Custom extension ID |
|
|
157
|
+
| `transport.onNotification` | `(notification: unknown) => void` | No | Notification handler |
|
|
158
|
+
| `versions` | `Partial<ConnectVersions>` | No | Internal: set automatically by `createEVMClient` / `createSolanaClient`. Consumers do not need to provide this. |
|
|
159
|
+
| `debug` | `boolean` | No | Enable debug logging |
|
|
159
160
|
|
|
160
161
|
#### Returns
|
|
161
162
|
|
|
@@ -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 };
|