@web3auth/no-modal 10.8.1 → 10.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/dist/lib.cjs/base/utils.js +4 -3
- package/dist/lib.cjs/connectors/metamask-connector/metamaskConnector.js +1 -1
- package/dist/lib.cjs/noModal.js +5 -10
- package/dist/lib.cjs/types/base/interfaces.d.ts +2 -1
- package/dist/lib.cjs/types/base/utils.d.ts +2 -1
- package/dist/lib.esm/base/utils.js +4 -3
- package/dist/lib.esm/connectors/metamask-connector/metamaskConnector.js +1 -1
- package/dist/lib.esm/noModal.js +6 -12
- package/dist/noModal.umd.min.js +1 -1
- package/package.json +9 -9
|
@@ -128,7 +128,7 @@ const getAaAnalyticsProperties = accountAbstractionConfig => {
|
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
const getWalletServicesAnalyticsProperties = walletServicesConfig => {
|
|
131
|
-
var _walletServicesConfig, _walletServicesConfig2, _walletServicesConfig3, _walletServicesConfig4, _walletServicesConfig5, _walletServicesConfig6, _walletServicesConfig7, _walletServicesConfig8, _walletServicesConfig9, _walletServicesConfig0, _walletServicesConfig1;
|
|
131
|
+
var _walletServicesConfig, _walletServicesConfig2, _walletServicesConfig3, _walletServicesConfig4, _walletServicesConfig5, _walletServicesConfig6, _walletServicesConfig7, _walletServicesConfig8, _walletServicesConfig9, _walletServicesConfig0, _walletServicesConfig1, _walletServicesConfig10;
|
|
132
132
|
return {
|
|
133
133
|
ws_confirmation_strategy: walletServicesConfig === null || walletServicesConfig === void 0 ? void 0 : walletServicesConfig.confirmationStrategy,
|
|
134
134
|
ws_enable_key_export: walletServicesConfig === null || walletServicesConfig === void 0 ? void 0 : walletServicesConfig.enableKeyExport,
|
|
@@ -142,10 +142,11 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
|
|
|
142
142
|
ws_hide_swap: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig8 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig8 === void 0 ? void 0 : _walletServicesConfig8.hideSwap,
|
|
143
143
|
ws_hide_show_all_tokens: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig9 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig9 === void 0 ? void 0 : _walletServicesConfig9.hideShowAllTokens,
|
|
144
144
|
ws_hide_wallet_connect: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig0 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig0 === void 0 ? void 0 : _walletServicesConfig0.hideWalletConnect,
|
|
145
|
-
|
|
145
|
+
ws_hide_defi_positions_display: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig1 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig1 === void 0 ? void 0 : _walletServicesConfig1.hideDefiPositionsDisplay,
|
|
146
|
+
ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig10 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig10 === void 0 ? void 0 : _walletServicesConfig10.defaultPortfolio
|
|
146
147
|
};
|
|
147
148
|
};
|
|
148
|
-
const sdkVersion = "10.
|
|
149
|
+
const sdkVersion = "10.9.0";
|
|
149
150
|
const getErrorAnalyticsProperties = error => {
|
|
150
151
|
try {
|
|
151
152
|
const code = error instanceof index.Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
|
|
@@ -215,7 +215,7 @@ class MetaMaskConnector extends baseEvmConnector.BaseEvmConnector {
|
|
|
215
215
|
} catch (error) {
|
|
216
216
|
// If the error code is 4902, the network needs to be added
|
|
217
217
|
if ((error === null || error === void 0 ? void 0 : error.code) === 4902) {
|
|
218
|
-
const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [baseControllers.CHAIN_NAMESPACES.EIP155
|
|
218
|
+
const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [baseControllers.CHAIN_NAMESPACES.EIP155].includes(x.chainNamespace));
|
|
219
219
|
await this.addChain(chainConfig);
|
|
220
220
|
await requestSwitchChain();
|
|
221
221
|
} else {
|
package/dist/lib.cjs/noModal.js
CHANGED
|
@@ -506,6 +506,7 @@ class Web3AuthNoModal extends auth.SafeEventEmitter {
|
|
|
506
506
|
enableReceiveButton = true,
|
|
507
507
|
enableShowAllTokensButton = true,
|
|
508
508
|
enableConfirmationModal = false,
|
|
509
|
+
enableDefiPositionsDisplay = true,
|
|
509
510
|
portfolioWidgetPosition = baseControllers.BUTTON_POSITION.BOTTOM_LEFT,
|
|
510
511
|
defaultPortfolio = "token"
|
|
511
512
|
} = walletUi || {};
|
|
@@ -519,6 +520,7 @@ class Web3AuthNoModal extends auth.SafeEventEmitter {
|
|
|
519
520
|
hideSwap: !enableSwapButton,
|
|
520
521
|
hideShowAllTokens: !enableShowAllTokensButton,
|
|
521
522
|
hideWalletConnect: !enableWalletConnect,
|
|
523
|
+
hideDefiPositionsDisplay: !enableDefiPositionsDisplay,
|
|
522
524
|
buttonPosition: portfolioWidgetPosition,
|
|
523
525
|
defaultPortfolio
|
|
524
526
|
};
|
|
@@ -597,9 +599,9 @@ class Web3AuthNoModal extends auth.SafeEventEmitter {
|
|
|
597
599
|
const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
|
|
598
600
|
const isMipdEnabled = isExternalWalletEnabled && ((_this$coreOptions$mul = this.coreOptions.multiInjectedProviderDiscovery) !== null && _this$coreOptions$mul !== void 0 ? _this$coreOptions$mul : true);
|
|
599
601
|
const chainNamespaces = new Set(this.coreOptions.chains.map(chain => chain.chainNamespace));
|
|
600
|
-
//
|
|
601
|
-
|
|
602
|
-
|
|
602
|
+
// prioritize using MM connector over injected connector for EVM chains
|
|
603
|
+
if (utils.isBrowser() && chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155)) {
|
|
604
|
+
// only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
|
|
603
605
|
connectorFns.push(metamaskConnector.metaMaskConnector(modalMode ? {
|
|
604
606
|
headless: true
|
|
605
607
|
} : undefined));
|
|
@@ -635,13 +637,6 @@ class Web3AuthNoModal extends auth.SafeEventEmitter {
|
|
|
635
637
|
connectorFns.push(...evmMipd.getProviders().map(injectedEvmConnector));
|
|
636
638
|
}
|
|
637
639
|
}
|
|
638
|
-
// it's safe to add it here as if there is a MetaMask injected provider, this won't override it
|
|
639
|
-
// only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
|
|
640
|
-
if (utils.isBrowser() && (chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155))) {
|
|
641
|
-
connectorFns.push(metamaskConnector.metaMaskConnector(modalMode ? {
|
|
642
|
-
headless: true
|
|
643
|
-
} : undefined));
|
|
644
|
-
}
|
|
645
640
|
// add WalletConnectV2 connector if external wallets are enabled
|
|
646
641
|
if (utils.isBrowser() && isExternalWalletEnabled && (chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(baseControllers.CHAIN_NAMESPACES.EIP155))) {
|
|
647
642
|
const {
|
|
@@ -45,8 +45,9 @@ export interface WalletUiConfig {
|
|
|
45
45
|
enableSendButton?: boolean;
|
|
46
46
|
enableSwapButton?: boolean;
|
|
47
47
|
enableReceiveButton?: boolean;
|
|
48
|
+
enableDefiPositionsDisplay?: boolean;
|
|
48
49
|
portfolioWidgetPosition?: BUTTON_POSITION_TYPE;
|
|
49
|
-
defaultPortfolio?: "token" | "nft";
|
|
50
|
+
defaultPortfolio?: "token" | "nft" | "defi";
|
|
50
51
|
}
|
|
51
52
|
export type ModalSignInMethodType = (typeof MODAL_SIGN_IN_METHODS)[keyof typeof MODAL_SIGN_IN_METHODS];
|
|
52
53
|
export type WidgetType = (typeof WIDGET_TYPE)[keyof typeof WIDGET_TYPE];
|
|
@@ -56,7 +56,8 @@ export declare const getWalletServicesAnalyticsProperties: (walletServicesConfig
|
|
|
56
56
|
ws_hide_swap: boolean;
|
|
57
57
|
ws_hide_show_all_tokens: boolean;
|
|
58
58
|
ws_hide_wallet_connect: boolean;
|
|
59
|
-
|
|
59
|
+
ws_hide_defi_positions_display: boolean;
|
|
60
|
+
ws_default_portfolio: "token" | "nft" | "defi";
|
|
60
61
|
};
|
|
61
62
|
export declare const sdkVersion: string;
|
|
62
63
|
export declare const getErrorAnalyticsProperties: (error: unknown) => {
|
|
@@ -128,7 +128,7 @@ const getAaAnalyticsProperties = accountAbstractionConfig => {
|
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
const getWalletServicesAnalyticsProperties = walletServicesConfig => {
|
|
131
|
-
var _walletServicesConfig, _walletServicesConfig2, _walletServicesConfig3, _walletServicesConfig4, _walletServicesConfig5, _walletServicesConfig6, _walletServicesConfig7, _walletServicesConfig8, _walletServicesConfig9, _walletServicesConfig0, _walletServicesConfig1;
|
|
131
|
+
var _walletServicesConfig, _walletServicesConfig2, _walletServicesConfig3, _walletServicesConfig4, _walletServicesConfig5, _walletServicesConfig6, _walletServicesConfig7, _walletServicesConfig8, _walletServicesConfig9, _walletServicesConfig0, _walletServicesConfig1, _walletServicesConfig10;
|
|
132
132
|
return {
|
|
133
133
|
ws_confirmation_strategy: walletServicesConfig === null || walletServicesConfig === void 0 ? void 0 : walletServicesConfig.confirmationStrategy,
|
|
134
134
|
ws_enable_key_export: walletServicesConfig === null || walletServicesConfig === void 0 ? void 0 : walletServicesConfig.enableKeyExport,
|
|
@@ -142,10 +142,11 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
|
|
|
142
142
|
ws_hide_swap: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig8 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig8 === void 0 ? void 0 : _walletServicesConfig8.hideSwap,
|
|
143
143
|
ws_hide_show_all_tokens: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig9 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig9 === void 0 ? void 0 : _walletServicesConfig9.hideShowAllTokens,
|
|
144
144
|
ws_hide_wallet_connect: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig0 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig0 === void 0 ? void 0 : _walletServicesConfig0.hideWalletConnect,
|
|
145
|
-
|
|
145
|
+
ws_hide_defi_positions_display: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig1 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig1 === void 0 ? void 0 : _walletServicesConfig1.hideDefiPositionsDisplay,
|
|
146
|
+
ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig10 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig10 === void 0 ? void 0 : _walletServicesConfig10.defaultPortfolio
|
|
146
147
|
};
|
|
147
148
|
};
|
|
148
|
-
const sdkVersion = "10.
|
|
149
|
+
const sdkVersion = "10.9.0";
|
|
149
150
|
const getErrorAnalyticsProperties = error => {
|
|
150
151
|
try {
|
|
151
152
|
const code = error instanceof Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
|
|
@@ -215,7 +215,7 @@ class MetaMaskConnector extends BaseEvmConnector {
|
|
|
215
215
|
} catch (error) {
|
|
216
216
|
// If the error code is 4902, the network needs to be added
|
|
217
217
|
if ((error === null || error === void 0 ? void 0 : error.code) === 4902) {
|
|
218
|
-
const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [CHAIN_NAMESPACES.EIP155
|
|
218
|
+
const chainConfig = this.coreOptions.chains.find(x => x.chainId === params.chainId && [CHAIN_NAMESPACES.EIP155].includes(x.chainNamespace));
|
|
219
219
|
await this.addChain(chainConfig);
|
|
220
220
|
await requestSwitchChain();
|
|
221
221
|
} else {
|
package/dist/lib.esm/noModal.js
CHANGED
|
@@ -11,9 +11,9 @@ import { Analytics, ANALYTICS_INTEGRATION_TYPE, ANALYTICS_SDK_TYPE, ANALYTICS_EV
|
|
|
11
11
|
import { sdkVersion, fetchProjectConfig, withAbort, getErrorAnalyticsProperties, getCaipChainId, isHexStrict, getHostname, getWhitelabelAnalyticsProperties, getAaAnalyticsProperties, getWalletServicesAnalyticsProperties, isBrowser } from './base/utils.js';
|
|
12
12
|
import { CommonJRPCProvider } from './providers/base-provider/CommonJRPCProvider.js';
|
|
13
13
|
import { authConnector } from './connectors/auth-connector/authConnector.js';
|
|
14
|
-
import { metaMaskConnector } from './connectors/metamask-connector/metamaskConnector.js';
|
|
15
14
|
import { walletServicesPlugin } from './plugins/wallet-services-plugin/plugin.js';
|
|
16
15
|
import { storageAvailable } from './base/connector/utils.js';
|
|
16
|
+
import { metaMaskConnector } from './connectors/metamask-connector/metamaskConnector.js';
|
|
17
17
|
import { CONNECTOR_STATUS, CONNECTOR_EVENTS } from './base/connector/constants.js';
|
|
18
18
|
import { WalletInitializationError, WalletLoginError } from './base/errors/index.js';
|
|
19
19
|
import { log } from './base/loglevel.js';
|
|
@@ -515,6 +515,7 @@ class Web3AuthNoModal extends SafeEventEmitter {
|
|
|
515
515
|
enableReceiveButton = true,
|
|
516
516
|
enableShowAllTokensButton = true,
|
|
517
517
|
enableConfirmationModal = false,
|
|
518
|
+
enableDefiPositionsDisplay = true,
|
|
518
519
|
portfolioWidgetPosition = BUTTON_POSITION.BOTTOM_LEFT,
|
|
519
520
|
defaultPortfolio = "token"
|
|
520
521
|
} = walletUi || {};
|
|
@@ -528,6 +529,7 @@ class Web3AuthNoModal extends SafeEventEmitter {
|
|
|
528
529
|
hideSwap: !enableSwapButton,
|
|
529
530
|
hideShowAllTokens: !enableShowAllTokensButton,
|
|
530
531
|
hideWalletConnect: !enableWalletConnect,
|
|
532
|
+
hideDefiPositionsDisplay: !enableDefiPositionsDisplay,
|
|
531
533
|
buttonPosition: portfolioWidgetPosition,
|
|
532
534
|
defaultPortfolio
|
|
533
535
|
};
|
|
@@ -609,9 +611,9 @@ class Web3AuthNoModal extends SafeEventEmitter {
|
|
|
609
611
|
const isMipdEnabled = isExternalWalletEnabled && ((_this$coreOptions$mul = this.coreOptions.multiInjectedProviderDiscovery) !== null && _this$coreOptions$mul !== void 0 ? _this$coreOptions$mul : true);
|
|
610
612
|
const chainNamespaces = new Set(this.coreOptions.chains.map(chain => chain.chainNamespace));
|
|
611
613
|
|
|
612
|
-
//
|
|
613
|
-
|
|
614
|
-
|
|
614
|
+
// prioritize using MM connector over injected connector for EVM chains
|
|
615
|
+
if (isBrowser() && chainNamespaces.has(CHAIN_NAMESPACES.EIP155)) {
|
|
616
|
+
// only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
|
|
615
617
|
connectorFns.push(metaMaskConnector(modalMode ? {
|
|
616
618
|
headless: true
|
|
617
619
|
} : undefined));
|
|
@@ -648,14 +650,6 @@ class Web3AuthNoModal extends SafeEventEmitter {
|
|
|
648
650
|
}
|
|
649
651
|
}
|
|
650
652
|
|
|
651
|
-
// it's safe to add it here as if there is a MetaMask injected provider, this won't override it
|
|
652
|
-
// only set headless to true if modal SDK is used, otherwise just use the modal from native Metamask SDK
|
|
653
|
-
if (isBrowser() && (chainNamespaces.has(CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(CHAIN_NAMESPACES.EIP155))) {
|
|
654
|
-
connectorFns.push(metaMaskConnector(modalMode ? {
|
|
655
|
-
headless: true
|
|
656
|
-
} : undefined));
|
|
657
|
-
}
|
|
658
|
-
|
|
659
653
|
// add WalletConnectV2 connector if external wallets are enabled
|
|
660
654
|
if (isBrowser() && isExternalWalletEnabled && (chainNamespaces.has(CHAIN_NAMESPACES.SOLANA) || chainNamespaces.has(CHAIN_NAMESPACES.EIP155))) {
|
|
661
655
|
const {
|