@web3auth/no-modal 11.1.0 → 11.3.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/connector/baseConnector.js +42 -11
- package/dist/lib.cjs/base/errors/index.js +5 -1
- package/dist/lib.cjs/base/utils.js +1 -1
- package/dist/lib.cjs/base/wallet/index.js +3 -1
- package/dist/lib.cjs/connectors/auth-connector/authConnector.js +13 -4
- package/dist/lib.cjs/connectors/base-account-connector/baseAccountConnector.js +211 -0
- package/dist/lib.cjs/connectors/base-account-connector/index.js +7 -0
- package/dist/lib.cjs/connectors/coinbase-connector/coinbaseConnector.js +5 -5
- package/dist/lib.cjs/connectors/injected-evm-connector/injectedEvmConnector.js +6 -5
- package/dist/lib.cjs/connectors/injected-solana-connector/walletStandardConnector.js +6 -5
- package/dist/lib.cjs/connectors/metamask-connector/metamaskConnector.js +82 -31
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +8 -6
- package/dist/lib.cjs/index.js +1 -0
- package/dist/lib.cjs/noModal.js +44 -21
- package/dist/lib.cjs/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js +9 -2
- package/dist/lib.cjs/react/context/useWeb3AuthInnerContextValue.js +10 -0
- package/dist/lib.cjs/react/solana/provider.js +65 -32
- package/dist/lib.cjs/types/base/connector/baseConnector.d.ts +2 -1
- package/dist/lib.cjs/types/base/connector/interfaces.d.ts +1 -0
- package/dist/lib.cjs/types/base/core/IWeb3Auth.d.ts +3 -0
- package/dist/lib.cjs/types/base/errors/index.d.ts +1 -0
- package/dist/lib.cjs/types/base/interfaces.d.ts +2 -1
- package/dist/lib.cjs/types/base/wallet/index.d.ts +3 -0
- package/dist/lib.cjs/types/connectors/base-account-connector/baseAccountConnector.d.ts +10 -0
- package/dist/lib.cjs/types/connectors/base-account-connector/index.d.ts +1 -0
- package/dist/lib.cjs/types/connectors/metamask-connector/metamaskConnector.d.ts +1 -0
- package/dist/lib.cjs/types/vue/solana/provider.d.ts +2 -2
- package/dist/lib.cjs/vue/solana/provider.js +55 -21
- package/dist/lib.cjs/vue/useWeb3AuthInnerContextValue.js +12 -2
- package/dist/lib.esm/base/connector/baseConnector.js +42 -11
- package/dist/lib.esm/base/errors/index.js +5 -1
- package/dist/lib.esm/base/utils.js +1 -1
- package/dist/lib.esm/base/wallet/index.js +3 -1
- package/dist/lib.esm/connectors/auth-connector/authConnector.js +13 -5
- package/dist/lib.esm/connectors/base-account-connector/baseAccountConnector.js +198 -0
- package/dist/lib.esm/connectors/base-account-connector/index.js +1 -0
- package/dist/lib.esm/connectors/coinbase-connector/coinbaseConnector.js +5 -5
- package/dist/lib.esm/connectors/injected-evm-connector/injectedEvmConnector.js +6 -5
- package/dist/lib.esm/connectors/injected-solana-connector/walletStandardConnector.js +6 -5
- package/dist/lib.esm/connectors/metamask-connector/metamaskConnector.js +86 -31
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +8 -7
- package/dist/lib.esm/index.js +1 -1
- package/dist/lib.esm/noModal.js +46 -22
- package/dist/lib.esm/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js +9 -2
- package/dist/lib.esm/react/context/useWeb3AuthInnerContextValue.js +10 -0
- package/dist/lib.esm/react/solana/provider.js +64 -30
- package/dist/lib.esm/vue/solana/provider.js +55 -19
- package/dist/lib.esm/vue/useWeb3AuthInnerContextValue.js +10 -0
- package/package.json +15 -2
|
@@ -12,13 +12,12 @@ var baseControllers = require('@toruslabs/base-controllers');
|
|
|
12
12
|
require('@toruslabs/session-manager');
|
|
13
13
|
require('@web3auth/auth');
|
|
14
14
|
require('../../base/errors/index.js');
|
|
15
|
-
require('
|
|
16
|
-
require('@toruslabs/http-helpers');
|
|
17
|
-
require('../../base/constants.js');
|
|
15
|
+
var utils = require('../../base/utils.js');
|
|
18
16
|
require('../../base/wallet/index.js');
|
|
19
17
|
require('../../base/connector/connectorStatus.js');
|
|
20
18
|
require('../../base/connector/constants.js');
|
|
21
19
|
require('jwt-decode');
|
|
20
|
+
require('../../base/constants.js');
|
|
22
21
|
require('../../base/plugin/errors.js');
|
|
23
22
|
require('../../base/plugin/IPlugin.js');
|
|
24
23
|
require('../context/Web3AuthInnerContext.js');
|
|
@@ -54,12 +53,28 @@ function makePlaceholder(rpc) {
|
|
|
54
53
|
});
|
|
55
54
|
}
|
|
56
55
|
function dispose(client) {
|
|
57
|
-
void client.actions.disconnectWallet().catch(() => {});
|
|
58
56
|
client.destroy();
|
|
59
57
|
}
|
|
58
|
+
function resolveSolanaChain(web3Auth, connection) {
|
|
59
|
+
var _web3Auth$coreOptions3;
|
|
60
|
+
const currentChain = web3Auth === null || web3Auth === void 0 ? void 0 : web3Auth.currentChain;
|
|
61
|
+
if ((currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) === baseControllers.CHAIN_NAMESPACES.SOLANA) {
|
|
62
|
+
return currentChain;
|
|
63
|
+
}
|
|
64
|
+
const connectedScope = connection !== null && connection !== void 0 && connection.solanaWallet && "scope" in connection.solanaWallet && typeof connection.solanaWallet.scope === "string" ? connection.solanaWallet.scope : null;
|
|
65
|
+
if (connectedScope) {
|
|
66
|
+
var _web3Auth$coreOptions2;
|
|
67
|
+
const connectedChain = web3Auth === null || web3Auth === void 0 || (_web3Auth$coreOptions2 = web3Auth.coreOptions.chains) === null || _web3Auth$coreOptions2 === void 0 ? void 0 : _web3Auth$coreOptions2.find(chain => {
|
|
68
|
+
return chain.chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA && utils.getCaipChainId(chain) === connectedScope;
|
|
69
|
+
});
|
|
70
|
+
if (connectedChain) return connectedChain;
|
|
71
|
+
}
|
|
72
|
+
return (web3Auth === null || web3Auth === void 0 || (_web3Auth$coreOptions3 = web3Auth.coreOptions.chains) === null || _web3Auth$coreOptions3 === void 0 ? void 0 : _web3Auth$coreOptions3.find(chain => chain.chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA)) || null;
|
|
73
|
+
}
|
|
60
74
|
/**
|
|
61
|
-
* Builds the SolanaClient for Framework Kit React hooks
|
|
62
|
-
*
|
|
75
|
+
* Builds the SolanaClient for Framework Kit React hooks.
|
|
76
|
+
* For multichain wallets, keep the Solana client warm across namespace switches so
|
|
77
|
+
* switching back to Solana can reuse the existing wallet session.
|
|
63
78
|
*/
|
|
64
79
|
function useFrameworkKitSolanaClient() {
|
|
65
80
|
const {
|
|
@@ -72,12 +87,13 @@ function useFrameworkKitSolanaClient() {
|
|
|
72
87
|
chainId,
|
|
73
88
|
chainNamespace
|
|
74
89
|
} = useChain.useChain();
|
|
75
|
-
const
|
|
90
|
+
const solClientRef = react.useRef(null);
|
|
91
|
+
const connectedClientRef = react.useRef(null);
|
|
76
92
|
const [client$1, setClient] = react.useState(() => {
|
|
77
93
|
const c = makePlaceholder({
|
|
78
94
|
rpcTarget: DEVNET_ENDPOINT
|
|
79
95
|
});
|
|
80
|
-
|
|
96
|
+
solClientRef.current = c;
|
|
81
97
|
return c;
|
|
82
98
|
});
|
|
83
99
|
react.useEffect(() => {
|
|
@@ -86,53 +102,61 @@ function useFrameworkKitSolanaClient() {
|
|
|
86
102
|
});
|
|
87
103
|
}, [isInitialized, web3Auth]);
|
|
88
104
|
react.useEffect(() => () => {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
const connectedClient = connectedClientRef.current;
|
|
106
|
+
const currentClient = solClientRef.current;
|
|
107
|
+
if (currentClient) {
|
|
108
|
+
dispose(currentClient);
|
|
109
|
+
solClientRef.current = null;
|
|
110
|
+
}
|
|
111
|
+
if (connectedClient && connectedClient !== currentClient) {
|
|
112
|
+
dispose(connectedClient);
|
|
93
113
|
}
|
|
114
|
+
connectedClientRef.current = null;
|
|
94
115
|
}, []);
|
|
95
116
|
react.useEffect(() => {
|
|
96
117
|
let stale = false;
|
|
97
|
-
const adopt =
|
|
118
|
+
const adopt = nextClient => {
|
|
98
119
|
if (stale) {
|
|
99
|
-
dispose(
|
|
120
|
+
dispose(nextClient);
|
|
100
121
|
return;
|
|
101
122
|
}
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
setClient(
|
|
123
|
+
const prevClient = solClientRef.current;
|
|
124
|
+
if (prevClient === nextClient) return;
|
|
125
|
+
if (prevClient) dispose(prevClient);
|
|
126
|
+
solClientRef.current = nextClient;
|
|
127
|
+
setClient(nextClient);
|
|
107
128
|
};
|
|
108
|
-
(async
|
|
129
|
+
(async () => {
|
|
109
130
|
const rpc = placeholderRpc(isInitialized, web3Auth);
|
|
110
|
-
const solanaWallet = connection === null || connection === void 0 ? void 0 : connection.solanaWallet;
|
|
111
|
-
const onSolana = isConnected && Boolean(solanaWallet) && chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA && (web3Auth === null || web3Auth === void 0 || (_web3Auth$currentChai = web3Auth.currentChain) === null || _web3Auth$currentChai === void 0 ? void 0 : _web3Auth$currentChai.chainNamespace) === baseControllers.CHAIN_NAMESPACES.SOLANA;
|
|
112
|
-
if (!onSolana) {
|
|
113
|
-
adopt(makePlaceholder(rpc));
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
131
|
const conn = connection;
|
|
117
|
-
|
|
132
|
+
const currentChain = web3Auth === null || web3Auth === void 0 ? void 0 : web3Auth.currentChain;
|
|
133
|
+
if ((currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) !== baseControllers.CHAIN_NAMESPACES.SOLANA) {
|
|
118
134
|
adopt(makePlaceholder(rpc));
|
|
119
135
|
return;
|
|
120
136
|
}
|
|
121
|
-
|
|
122
|
-
|
|
137
|
+
const preferredSolanaChain = resolveSolanaChain(web3Auth, conn);
|
|
138
|
+
const shouldKeepSolanaClient = isConnected && Boolean(conn === null || conn === void 0 ? void 0 : conn.solanaWallet) && Boolean(preferredSolanaChain) &&
|
|
139
|
+
// only manage the client for the primary connector
|
|
140
|
+
(conn === null || conn === void 0 ? void 0 : conn.connectorName) === (web3Auth === null || web3Auth === void 0 ? void 0 : web3Auth.primaryConnectorName);
|
|
141
|
+
if (!shouldKeepSolanaClient) {
|
|
142
|
+
const connectedClient = connectedClientRef.current;
|
|
143
|
+
connectedClientRef.current = null;
|
|
144
|
+
if (connectedClient) {
|
|
145
|
+
dispose(connectedClient);
|
|
146
|
+
}
|
|
123
147
|
adopt(makePlaceholder(rpc));
|
|
124
148
|
return;
|
|
125
149
|
}
|
|
126
150
|
try {
|
|
127
151
|
const solanaWalletId = "wallet-standard:" + conn.connectorName;
|
|
128
|
-
const connector = client.createWalletStandardConnector(solanaWallet, {
|
|
152
|
+
const connector = client.createWalletStandardConnector(conn.solanaWallet, {
|
|
129
153
|
id: solanaWalletId,
|
|
130
154
|
name: conn.connectorName
|
|
131
155
|
});
|
|
132
156
|
const {
|
|
133
157
|
rpcTarget,
|
|
134
158
|
wsTarget
|
|
135
|
-
} =
|
|
159
|
+
} = preferredSolanaChain;
|
|
136
160
|
const wired = client.createClient({
|
|
137
161
|
endpoint: rpcTarget,
|
|
138
162
|
websocketEndpoint: wsTarget,
|
|
@@ -145,7 +169,16 @@ function useFrameworkKitSolanaClient() {
|
|
|
145
169
|
dispose(wired);
|
|
146
170
|
return;
|
|
147
171
|
}
|
|
148
|
-
|
|
172
|
+
const prevConnectedClient = connectedClientRef.current;
|
|
173
|
+
connectedClientRef.current = wired;
|
|
174
|
+
if (chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA && (currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) === baseControllers.CHAIN_NAMESPACES.SOLANA) {
|
|
175
|
+
adopt(wired);
|
|
176
|
+
} else {
|
|
177
|
+
adopt(makePlaceholder(rpc));
|
|
178
|
+
}
|
|
179
|
+
if (prevConnectedClient && prevConnectedClient !== wired) {
|
|
180
|
+
dispose(prevConnectedClient);
|
|
181
|
+
}
|
|
149
182
|
} catch (e) {
|
|
150
183
|
loglevel.log.error("Failed to create or connect Solana client", e);
|
|
151
184
|
adopt(makePlaceholder(rpc));
|
|
@@ -40,6 +40,7 @@ export declare abstract class BaseConnector<T> extends SafeEventEmitter<Connecto
|
|
|
40
40
|
challenge: string;
|
|
41
41
|
authServer: string;
|
|
42
42
|
}): Promise<AuthTokenInfo>;
|
|
43
|
+
protected authorizeOrDisconnect(getAuthTokenInfo?: boolean, chainId?: string): Promise<void>;
|
|
43
44
|
protected clearWalletSession(): Promise<void>;
|
|
44
45
|
abstract init(options?: ConnectorInitOptions): Promise<void>;
|
|
45
46
|
abstract connect(params: T & BaseConnectorLoginParams): Promise<Connection | null>;
|
|
@@ -47,7 +48,7 @@ export declare abstract class BaseConnector<T> extends SafeEventEmitter<Connecto
|
|
|
47
48
|
abstract getUserInfo(): Promise<Partial<UserInfo>>;
|
|
48
49
|
abstract enableMFA(params?: T): Promise<void>;
|
|
49
50
|
abstract manageMFA(params?: T): Promise<void>;
|
|
50
|
-
abstract getAuthTokenInfo(): Promise<AuthTokenInfo>;
|
|
51
|
+
abstract getAuthTokenInfo(chainId?: string): Promise<AuthTokenInfo>;
|
|
51
52
|
abstract generateChallengeAndSign(authServerUrl?: string, accounts?: string[]): Promise<{
|
|
52
53
|
challenge: string;
|
|
53
54
|
signature: string;
|
|
@@ -79,6 +79,7 @@ export interface Connection {
|
|
|
79
79
|
readonly ethereumProvider: IProvider | null;
|
|
80
80
|
readonly solanaWallet: Wallet | null;
|
|
81
81
|
readonly connectorName: WALLET_CONNECTOR_TYPE | string;
|
|
82
|
+
readonly connectorNamespace: ConnectorNamespaceType;
|
|
82
83
|
}
|
|
83
84
|
export interface IConnector<T> extends SafeEventEmitter {
|
|
84
85
|
connectorNamespace: ConnectorNamespaceType;
|
|
@@ -153,6 +153,9 @@ export type LoginParamMap = {
|
|
|
153
153
|
[WALLET_CONNECTORS.COINBASE]: {
|
|
154
154
|
chainNamespace: ChainNamespaceType;
|
|
155
155
|
};
|
|
156
|
+
[WALLET_CONNECTORS.BASE_ACCOUNT]: {
|
|
157
|
+
chainNamespace: ChainNamespaceType;
|
|
158
|
+
};
|
|
156
159
|
[WALLET_CONNECTORS.WALLET_CONNECT_V2]: {
|
|
157
160
|
chainNamespace: ChainNamespaceType;
|
|
158
161
|
};
|
|
@@ -48,6 +48,7 @@ export declare class WalletLoginError extends Web3AuthError {
|
|
|
48
48
|
static unsupportedOperation(extraMessage?: string, cause?: unknown): IWeb3AuthError;
|
|
49
49
|
static sfaKeyNotFound(extraMessage?: string, cause?: unknown): IWeb3AuthError;
|
|
50
50
|
static userNotLoggedIn(extraMessage?: string, cause?: unknown): IWeb3AuthError;
|
|
51
|
+
static userBlocked(extraMessage?: string, cause?: unknown): IWeb3AuthError;
|
|
51
52
|
}
|
|
52
53
|
export declare class WalletOperationsError extends Web3AuthError {
|
|
53
54
|
protected static messages: ErrorCodes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BUTTON_POSITION_TYPE } from "@toruslabs/base-controllers";
|
|
2
2
|
import type { SmartAccountEipStandardType, SmartAccountType } from "@toruslabs/ethereum-controllers";
|
|
3
3
|
import { AuthConnectionConfigItem, type WhiteLabelData } from "@web3auth/auth";
|
|
4
|
-
import { type ChainNamespaceType, type CustomChainConfig } from "./chain/IChainInterface";
|
|
4
|
+
import { type ChainNamespaceType, ConnectorNamespaceType, type CustomChainConfig } from "./chain/IChainInterface";
|
|
5
5
|
import { LinkedAccountInfo } from "./connector";
|
|
6
6
|
import { LOGIN_MODE, MODAL_SIGN_IN_METHODS, SMART_ACCOUNT_WALLET_SCOPE, WIDGET_TYPE } from "./constants";
|
|
7
7
|
import { WALLET_CONNECTOR_TYPE } from "./wallet";
|
|
@@ -11,6 +11,7 @@ export interface WhitelistResponse {
|
|
|
11
11
|
}
|
|
12
12
|
export interface IWeb3AuthState {
|
|
13
13
|
cachedConnector: string | null;
|
|
14
|
+
cachedConnectorNamespace: ConnectorNamespaceType | null;
|
|
14
15
|
primaryConnectorName: WALLET_CONNECTOR_TYPE | null;
|
|
15
16
|
currentChainId: string;
|
|
16
17
|
idToken: string | null;
|
|
@@ -15,12 +15,14 @@ export declare const EVM_CONNECTORS: {
|
|
|
15
15
|
readonly WALLET_CONNECT_V2: "wallet-connect-v2";
|
|
16
16
|
readonly METAMASK: "metamask";
|
|
17
17
|
readonly COINBASE: "coinbase";
|
|
18
|
+
readonly BASE_ACCOUNT: "base-account";
|
|
18
19
|
};
|
|
19
20
|
export declare const WALLET_CONNECTORS: {
|
|
20
21
|
readonly AUTH: "auth";
|
|
21
22
|
readonly WALLET_CONNECT_V2: "wallet-connect-v2";
|
|
22
23
|
readonly METAMASK: "metamask";
|
|
23
24
|
readonly COINBASE: "coinbase";
|
|
25
|
+
readonly BASE_ACCOUNT: "base-account";
|
|
24
26
|
};
|
|
25
27
|
export type WALLET_CONNECTOR_TYPE = (typeof WALLET_CONNECTORS)[keyof typeof WALLET_CONNECTORS];
|
|
26
28
|
export type SOLANA_CONNECTOR_TYPE = (typeof SOLANA_CONNECTORS)[keyof typeof SOLANA_CONNECTORS];
|
|
@@ -30,6 +32,7 @@ export declare const CONNECTOR_NAMES: {
|
|
|
30
32
|
auth: string;
|
|
31
33
|
"wallet-connect-v2": string;
|
|
32
34
|
coinbase: string;
|
|
35
|
+
"base-account": string;
|
|
33
36
|
metamask: string;
|
|
34
37
|
};
|
|
35
38
|
export declare const WEB3AUTH_ICON: WalletIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AppMetadata, Preference } from "@base-org/account";
|
|
2
|
+
import { BaseConnectorSettings, ConnectorFn } from "../../base";
|
|
3
|
+
export type BaseAccountSDKOptions = Partial<AppMetadata & {
|
|
4
|
+
preference?: Preference;
|
|
5
|
+
paymasterUrls?: Record<number, string>;
|
|
6
|
+
}>;
|
|
7
|
+
export interface BaseAccountConnectorOptions extends BaseConnectorSettings {
|
|
8
|
+
connectorSettings?: BaseAccountSDKOptions;
|
|
9
|
+
}
|
|
10
|
+
export declare const baseAccountConnector: (params?: BaseAccountSDKOptions) => ConnectorFn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./baseAccountConnector";
|
|
@@ -21,6 +21,7 @@ export interface MetaMaskConnectorSettings {
|
|
|
21
21
|
export interface MetaMaskConnectorOptions extends BaseConnectorSettings {
|
|
22
22
|
connectorSettings?: MetaMaskConnectorSettings;
|
|
23
23
|
}
|
|
24
|
+
export declare const METAMASK_ERC_6963_PROVIDER_RDNS = "io.metamask.mmc";
|
|
24
25
|
/**
|
|
25
26
|
* Factory function to create a MetaMask connector
|
|
26
27
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Syncs Web3Auth Solana connection with Framework Kit client.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* For multichain wallets, keep the Solana client warm across namespace switches so
|
|
4
|
+
* switching back to Solana can reuse the existing wallet session.
|
|
5
5
|
*/
|
|
6
6
|
export declare const SolanaProvider: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
7
7
|
[key: string]: any;
|
|
@@ -10,13 +10,12 @@ var baseControllers = require('@toruslabs/base-controllers');
|
|
|
10
10
|
require('@toruslabs/session-manager');
|
|
11
11
|
require('@web3auth/auth');
|
|
12
12
|
require('../../base/errors/index.js');
|
|
13
|
-
require('
|
|
14
|
-
require('@toruslabs/http-helpers');
|
|
15
|
-
require('../../base/constants.js');
|
|
13
|
+
var utils = require('../../base/utils.js');
|
|
16
14
|
require('../../base/wallet/index.js');
|
|
17
15
|
require('../../base/connector/connectorStatus.js');
|
|
18
16
|
require('../../base/connector/constants.js');
|
|
19
17
|
require('jwt-decode');
|
|
18
|
+
require('../../base/constants.js');
|
|
20
19
|
require('../../base/plugin/errors.js');
|
|
21
20
|
require('../../base/plugin/IPlugin.js');
|
|
22
21
|
var useChain = require('../composables/useChain.js');
|
|
@@ -24,17 +23,28 @@ var useWeb3Auth = require('../composables/useWeb3Auth.js');
|
|
|
24
23
|
var constants = require('./constants.js');
|
|
25
24
|
|
|
26
25
|
const disposeClient = async client => {
|
|
27
|
-
try {
|
|
28
|
-
await client.actions.disconnectWallet();
|
|
29
|
-
} catch (e) {
|
|
30
|
-
loglevel.log.warn("Solana client disconnect", e);
|
|
31
|
-
}
|
|
32
26
|
client.destroy();
|
|
33
27
|
};
|
|
28
|
+
const resolveSolanaChain = (web3Auth, connection) => {
|
|
29
|
+
var _web3Auth$coreOptions2;
|
|
30
|
+
const currentChain = web3Auth === null || web3Auth === void 0 ? void 0 : web3Auth.currentChain;
|
|
31
|
+
if ((currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) === baseControllers.CHAIN_NAMESPACES.SOLANA) {
|
|
32
|
+
return currentChain;
|
|
33
|
+
}
|
|
34
|
+
const connectedScope = connection !== null && connection !== void 0 && connection.solanaWallet && "scope" in connection.solanaWallet && typeof connection.solanaWallet.scope === "string" ? connection.solanaWallet.scope : null;
|
|
35
|
+
if (connectedScope) {
|
|
36
|
+
var _web3Auth$coreOptions;
|
|
37
|
+
const connectedChain = web3Auth === null || web3Auth === void 0 || (_web3Auth$coreOptions = web3Auth.coreOptions.chains) === null || _web3Auth$coreOptions === void 0 ? void 0 : _web3Auth$coreOptions.find(chain => {
|
|
38
|
+
return chain.chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA && utils.getCaipChainId(chain) === connectedScope;
|
|
39
|
+
});
|
|
40
|
+
if (connectedChain) return connectedChain;
|
|
41
|
+
}
|
|
42
|
+
return (web3Auth === null || web3Auth === void 0 || (_web3Auth$coreOptions2 = web3Auth.coreOptions.chains) === null || _web3Auth$coreOptions2 === void 0 ? void 0 : _web3Auth$coreOptions2.find(chain => chain.chainNamespace === baseControllers.CHAIN_NAMESPACES.SOLANA)) || null;
|
|
43
|
+
};
|
|
34
44
|
/**
|
|
35
45
|
* Syncs Web3Auth Solana connection with Framework Kit client.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
46
|
+
* For multichain wallets, keep the Solana client warm across namespace switches so
|
|
47
|
+
* switching back to Solana can reuse the existing wallet session.
|
|
38
48
|
*/
|
|
39
49
|
const SolanaProvider = vue.defineComponent({
|
|
40
50
|
name: "SolanaProvider",
|
|
@@ -50,6 +60,8 @@ const SolanaProvider = vue.defineComponent({
|
|
|
50
60
|
chainId
|
|
51
61
|
} = useChain.useChain();
|
|
52
62
|
const clientRef = vue.ref(null);
|
|
63
|
+
let connectedClient = null;
|
|
64
|
+
// let connectedClientKey: string | null = null;
|
|
53
65
|
// Holds the token for the newest requested sync run. Older async runs compare against it
|
|
54
66
|
// before publishing results so a slower reconnect cannot overwrite a newer chain/account update.
|
|
55
67
|
let activeSyncToken = null;
|
|
@@ -64,21 +76,26 @@ const SolanaProvider = vue.defineComponent({
|
|
|
64
76
|
const newIsConnected = isConnected.value;
|
|
65
77
|
const newConnection = connection.value;
|
|
66
78
|
const currentChain = (_web3Auth$value = web3Auth.value) === null || _web3Auth$value === void 0 ? void 0 : _web3Auth$value.currentChain;
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
if ((currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) !== baseControllers.CHAIN_NAMESPACES.SOLANA) {
|
|
80
|
+
// Mirror the React provider behavior: hide the live Solana client from injected
|
|
81
|
+
// consumers whenever Web3Auth is currently scoped to a non-Solana namespace.
|
|
82
|
+
clientRef.value = null;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const preferredSolanaChain = resolveSolanaChain(web3Auth.value, newConnection);
|
|
86
|
+
const shouldKeepSolanaClient = newIsConnected && Boolean(newConnection === null || newConnection === void 0 ? void 0 : newConnection.solanaWallet) && Boolean(preferredSolanaChain) &&
|
|
87
|
+
// only manage the client for the primary connector
|
|
88
|
+
(newConnection === null || newConnection === void 0 ? void 0 : newConnection.connectorName) === ((_web3Auth$value2 = web3Auth.value) === null || _web3Auth$value2 === void 0 ? void 0 : _web3Auth$value2.primaryConnectorName);
|
|
89
|
+
if (!shouldKeepSolanaClient) {
|
|
71
90
|
clientRef.value = null;
|
|
91
|
+
const prevClient = connectedClient;
|
|
92
|
+
connectedClient = null;
|
|
93
|
+
// connectedClientKey = null;
|
|
72
94
|
if (prevClient) {
|
|
73
95
|
await disposeClient(prevClient);
|
|
74
96
|
}
|
|
75
97
|
return;
|
|
76
98
|
}
|
|
77
|
-
const prevClient = clientRef.value;
|
|
78
|
-
clientRef.value = null;
|
|
79
|
-
if (prevClient) {
|
|
80
|
-
await disposeClient(prevClient);
|
|
81
|
-
}
|
|
82
99
|
let client$1 = null;
|
|
83
100
|
try {
|
|
84
101
|
// create a wallet standard connector from connected wallet
|
|
@@ -91,7 +108,7 @@ const SolanaProvider = vue.defineComponent({
|
|
|
91
108
|
const {
|
|
92
109
|
rpcTarget,
|
|
93
110
|
wsTarget
|
|
94
|
-
} =
|
|
111
|
+
} = preferredSolanaChain;
|
|
95
112
|
client$1 = client.createClient({
|
|
96
113
|
endpoint: rpcTarget,
|
|
97
114
|
websocketEndpoint: wsTarget,
|
|
@@ -106,7 +123,13 @@ const SolanaProvider = vue.defineComponent({
|
|
|
106
123
|
await disposeClient(client$1);
|
|
107
124
|
return;
|
|
108
125
|
}
|
|
109
|
-
|
|
126
|
+
const prevClient = connectedClient;
|
|
127
|
+
connectedClient = client$1;
|
|
128
|
+
// connectedClientKey = nextClientKey;
|
|
129
|
+
clientRef.value = (currentChain === null || currentChain === void 0 ? void 0 : currentChain.chainNamespace) === baseControllers.CHAIN_NAMESPACES.SOLANA ? client$1 : null;
|
|
130
|
+
if (prevClient) {
|
|
131
|
+
await disposeClient(prevClient);
|
|
132
|
+
}
|
|
110
133
|
} catch (err) {
|
|
111
134
|
if (client$1) {
|
|
112
135
|
await disposeClient(client$1);
|
|
@@ -124,6 +147,17 @@ const SolanaProvider = vue.defineComponent({
|
|
|
124
147
|
}, {
|
|
125
148
|
immediate: true
|
|
126
149
|
});
|
|
150
|
+
vue.onBeforeUnmount(() => {
|
|
151
|
+
const publishedClient = clientRef.value;
|
|
152
|
+
clientRef.value = null;
|
|
153
|
+
const prevClient = connectedClient;
|
|
154
|
+
connectedClient = null;
|
|
155
|
+
if (prevClient) {
|
|
156
|
+
void disposeClient(prevClient);
|
|
157
|
+
} else if (publishedClient) {
|
|
158
|
+
void disposeClient(publishedClient);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
127
161
|
return () => {
|
|
128
162
|
var _slots$default, _slots$default2;
|
|
129
163
|
return vue.h(vue.Fragment, null, (_slots$default = (_slots$default2 = slots.default) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots)) !== null && _slots$default !== void 0 ? _slots$default : []);
|
|
@@ -161,6 +161,14 @@ function useWeb3AuthInnerContextValue({
|
|
|
161
161
|
chainId.value = web3Auth.value.currentChainId;
|
|
162
162
|
chainNamespace.value = (_web3Auth$value$curre7 = (_web3Auth$value$curre8 = web3Auth.value.currentChain) === null || _web3Auth$value$curre8 === void 0 ? void 0 : _web3Auth$value$curre8.chainNamespace) !== null && _web3Auth$value$curre7 !== void 0 ? _web3Auth$value$curre7 : null;
|
|
163
163
|
};
|
|
164
|
+
const connectorDataUpdatedListener = data => {
|
|
165
|
+
const updatedData = data.data;
|
|
166
|
+
if (updatedData.chainId && chainId.value !== updatedData.chainId) {
|
|
167
|
+
var _web3Auth$value$curre9;
|
|
168
|
+
chainId.value = updatedData.chainId;
|
|
169
|
+
chainNamespace.value = (_web3Auth$value$curre9 = web3Auth.value.currentChain) === null || _web3Auth$value$curre9 === void 0 ? void 0 : _web3Auth$value$curre9.chainNamespace;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
164
172
|
if (prevWeb3Auth && newWeb3Auth !== prevWeb3Auth) {
|
|
165
173
|
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.NOT_READY, notReadyListener);
|
|
166
174
|
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.READY, readyListener);
|
|
@@ -172,6 +180,7 @@ function useWeb3AuthInnerContextValue({
|
|
|
172
180
|
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.REHYDRATION_ERROR, errorListener);
|
|
173
181
|
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
|
|
174
182
|
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.CONNECTION_UPDATED, connectionUpdatedListener);
|
|
183
|
+
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.CONNECTOR_DATA_UPDATED, connectorDataUpdatedListener);
|
|
175
184
|
if (prevWeb3Auth.loginMode === constants$1.LOGIN_MODE.MODAL) {
|
|
176
185
|
prevWeb3Auth.removeListener(constants.CONNECTOR_EVENTS.CONSENT_ACCEPTED, consentAcceptedListener);
|
|
177
186
|
}
|
|
@@ -188,6 +197,7 @@ function useWeb3AuthInnerContextValue({
|
|
|
188
197
|
newWeb3Auth.on(constants.CONNECTOR_EVENTS.REHYDRATION_ERROR, errorListener);
|
|
189
198
|
newWeb3Auth.on(constants.CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
|
|
190
199
|
newWeb3Auth.on(constants.CONNECTOR_EVENTS.CONNECTION_UPDATED, connectionUpdatedListener);
|
|
200
|
+
newWeb3Auth.on(constants.CONNECTOR_EVENTS.CONNECTOR_DATA_UPDATED, connectorDataUpdatedListener);
|
|
191
201
|
if (newWeb3Auth.loginMode === constants$1.LOGIN_MODE.MODAL) {
|
|
192
202
|
newWeb3Auth.on(constants.CONNECTOR_EVENTS.CONSENT_ACCEPTED, consentAcceptedListener);
|
|
193
203
|
}
|
|
@@ -198,9 +208,9 @@ function useWeb3AuthInnerContextValue({
|
|
|
198
208
|
vue.watch(connection, (newConnection, prevConnection) => {
|
|
199
209
|
var _prevConnection$ether, _newConnection$ethere;
|
|
200
210
|
const handleChainChange = newChainId => {
|
|
201
|
-
var _web3Auth$value$
|
|
211
|
+
var _web3Auth$value$curre0, _web3Auth$value;
|
|
202
212
|
chainId.value = newChainId;
|
|
203
|
-
chainNamespace.value = (_web3Auth$value$
|
|
213
|
+
chainNamespace.value = (_web3Auth$value$curre0 = (_web3Auth$value = web3Auth.value) === null || _web3Auth$value === void 0 || (_web3Auth$value = _web3Auth$value.currentChain) === null || _web3Auth$value === void 0 ? void 0 : _web3Auth$value.chainNamespace) !== null && _web3Auth$value$curre0 !== void 0 ? _web3Auth$value$curre0 : null;
|
|
204
214
|
};
|
|
205
215
|
const prevProvider = (_prevConnection$ether = prevConnection === null || prevConnection === void 0 ? void 0 : prevConnection.ethereumProvider) !== null && _prevConnection$ether !== void 0 ? _prevConnection$ether : null;
|
|
206
216
|
const newProvider = (_newConnection$ethere = newConnection === null || newConnection === void 0 ? void 0 : newConnection.ethereumProvider) !== null && _newConnection$ethere !== void 0 ? _newConnection$ethere : null;
|
|
@@ -130,17 +130,28 @@ class BaseConnector extends SafeEventEmitter {
|
|
|
130
130
|
return cached;
|
|
131
131
|
}
|
|
132
132
|
async verifyAndAuthorize(params) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
let tokens;
|
|
134
|
+
try {
|
|
135
|
+
tokens = await verifySignedChallenge({
|
|
136
|
+
chainNamespace: params.chainNamespace,
|
|
137
|
+
signedMessage: params.signedMessage,
|
|
138
|
+
challenge: params.challenge,
|
|
139
|
+
connector: this.name,
|
|
140
|
+
authServer: params.authServer,
|
|
141
|
+
web3AuthClientId: this.coreOptions.clientId,
|
|
142
|
+
web3AuthNetwork: this.coreOptions.web3AuthNetwork,
|
|
143
|
+
sessionTimeout: this.coreOptions.sessionTime,
|
|
144
|
+
deviceInfo: getDeviceInfo()
|
|
145
|
+
});
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (error instanceof Response && error.status === 401) {
|
|
148
|
+
const body = await error.clone().json().catch(() => ({}));
|
|
149
|
+
if (body.message === "ACCESS_CONTROL_DENIED") {
|
|
150
|
+
throw WalletLoginError.userBlocked("User is blocked by the application", error);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
144
155
|
await this.saveAuthTokenInfo(tokens);
|
|
145
156
|
const tokenInfo = {
|
|
146
157
|
idToken: tokens.idToken,
|
|
@@ -154,6 +165,26 @@ class BaseConnector extends SafeEventEmitter {
|
|
|
154
165
|
});
|
|
155
166
|
return tokenInfo;
|
|
156
167
|
}
|
|
168
|
+
async authorizeOrDisconnect(getAuthTokenInfo, chainId) {
|
|
169
|
+
if (!getAuthTokenInfo) return;
|
|
170
|
+
try {
|
|
171
|
+
await this.getAuthTokenInfo(chainId);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
log.error("Authorization failed after connect; disconnecting wallet to keep state consistent", error);
|
|
174
|
+
const wasRehydrated = this.rehydrated;
|
|
175
|
+
try {
|
|
176
|
+
// getAuthTokenInfo moved status to AUTHORIZING; restore CONNECTED so disconnect requirements pass.
|
|
177
|
+
if (!this.connected) this.status = CONNECTOR_STATUS.CONNECTED;
|
|
178
|
+
await this.disconnect();
|
|
179
|
+
} catch (disconnectError) {
|
|
180
|
+
log.error("Failed to disconnect wallet after authorization error", disconnectError);
|
|
181
|
+
} finally {
|
|
182
|
+
// disconnect() resets rehydrated=false; restore so caller catch emits the right event.
|
|
183
|
+
this.rehydrated = wasRehydrated;
|
|
184
|
+
}
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
157
188
|
async clearWalletSession() {
|
|
158
189
|
if (!this.authSessionManager) return;
|
|
159
190
|
try {
|
|
@@ -163,6 +163,9 @@ class WalletLoginError extends Web3AuthError {
|
|
|
163
163
|
static userNotLoggedIn(extraMessage = "", cause) {
|
|
164
164
|
return WalletLoginError.fromCode(5119, extraMessage, cause);
|
|
165
165
|
}
|
|
166
|
+
static userBlocked(extraMessage = "", cause) {
|
|
167
|
+
return WalletLoginError.fromCode(5120, extraMessage, cause);
|
|
168
|
+
}
|
|
166
169
|
}
|
|
167
170
|
_defineProperty(WalletLoginError, "messages", {
|
|
168
171
|
5000: "Custom",
|
|
@@ -174,7 +177,8 @@ _defineProperty(WalletLoginError, "messages", {
|
|
|
174
177
|
5116: "Chain config has not been added. Please add the chain config before calling switchChain",
|
|
175
178
|
5117: "Unsupported operation",
|
|
176
179
|
5118: "useSFAKey flag is enabled but SFA key is not available",
|
|
177
|
-
5119: "User not logged in."
|
|
180
|
+
5119: "User not logged in.",
|
|
181
|
+
5120: "User is blocked by the application"
|
|
178
182
|
});
|
|
179
183
|
class WalletOperationsError extends Web3AuthError {
|
|
180
184
|
constructor(code, message, cause) {
|
|
@@ -149,7 +149,7 @@ const getWalletServicesAnalyticsProperties = walletServicesConfig => {
|
|
|
149
149
|
ws_default_portfolio: walletServicesConfig === null || walletServicesConfig === void 0 || (_walletServicesConfig10 = walletServicesConfig.whiteLabel) === null || _walletServicesConfig10 === void 0 ? void 0 : _walletServicesConfig10.defaultPortfolio
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
|
-
const sdkVersion = "11.
|
|
152
|
+
const sdkVersion = "11.3.0";
|
|
153
153
|
const getErrorAnalyticsProperties = error => {
|
|
154
154
|
try {
|
|
155
155
|
const code = error instanceof Web3AuthError ? error.code : error === null || error === void 0 ? void 0 : error.code;
|
|
@@ -7,13 +7,15 @@ const MULTI_CHAIN_CONNECTORS = {
|
|
|
7
7
|
};
|
|
8
8
|
const SOLANA_CONNECTORS = _objectSpread({}, MULTI_CHAIN_CONNECTORS);
|
|
9
9
|
const EVM_CONNECTORS = _objectSpread({
|
|
10
|
-
COINBASE: "coinbase"
|
|
10
|
+
COINBASE: "coinbase",
|
|
11
|
+
BASE_ACCOUNT: "base-account"
|
|
11
12
|
}, MULTI_CHAIN_CONNECTORS);
|
|
12
13
|
const WALLET_CONNECTORS = _objectSpread(_objectSpread({}, EVM_CONNECTORS), SOLANA_CONNECTORS);
|
|
13
14
|
const CONNECTOR_NAMES = {
|
|
14
15
|
[MULTI_CHAIN_CONNECTORS.AUTH]: "Auth",
|
|
15
16
|
[MULTI_CHAIN_CONNECTORS.WALLET_CONNECT_V2]: "Wallet Connect v2",
|
|
16
17
|
[EVM_CONNECTORS.COINBASE]: "Coinbase Smart Wallet",
|
|
18
|
+
[EVM_CONNECTORS.BASE_ACCOUNT]: "Base Account",
|
|
17
19
|
[EVM_CONNECTORS.METAMASK]: "MetaMask"
|
|
18
20
|
};
|
|
19
21
|
const WEB3AUTH_ICON = `data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTciIHZpZXdCb3g9IjAgMCA5NiA5NyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik00NC4wMzQ2IDczLjI2MjRDNDMuODU5NSA3My45MTU5IDQ0LjM1MTkgNzQuNTU3NiA0NS4wMjg1IDc0LjU1NzZINTAuOTUzOUM1MS42MzA0IDc0LjU1NzYgNTIuMTIyOSA3My45MTU5IDUxLjk0NzggNzMuMjYyNEw0OC45ODUgNjIuMjA1M0M0OC43MTI2IDYxLjE4ODUgNDcuMjY5OCA2MS4xODg1IDQ2Ljk5NzMgNjIuMjA1M0w0NC4wMzQ2IDczLjI2MjRaIiBmaWxsPSIjMDM2NEZGIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMzguMTM0NSA4MC4zMzk2QzM3LjY4MDcgODIuMDMzIDM2LjE0NjEgODMuMjEwNiAzNC4zOTI5IDgzLjIxMDZIMjYuMzcyNkMyMy44MjU2IDgzLjIxMDYgMjEuOTcxOSA4MC43OTQ3IDIyLjYzMTEgNzguMzM0NUwzOS4wODQ0IDE2LjkyOTlDMzkuNTgwNyAxNS4wNzc3IDQxLjI1OTEgMTMuNzg5NyA0My4xNzY3IDEzLjc4OTdINTIuNzIxOUM1NC42Mzk0IDEzLjc4OTcgNTYuMzE3OSAxNS4wNzc3IDU2LjgxNDIgMTYuOTI5OUw3My4yNjc1IDc4LjMzNDVDNzMuOTI2NyA4MC43OTQ3IDcyLjA3MjkgODMuMjEwNiA2OS41MjYgODMuMjEwNkg2MS41MDU2QzU5Ljc1MjQgODMuMjEwNiA1OC4yMTc4IDgyLjAzMyA1Ny43NjQxIDgwLjMzOTZMNDkuNzYxNiA1MC40NzM4QzQ5LjI2NDggNDguNjE5NyA0Ni42MzM4IDQ4LjYxOTcgNDYuMTM3IDUwLjQ3MzhMMzguMTM0NSA4MC4zMzk2WiIgZmlsbD0iIzAzNjRGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTc4LjQ3NzQgNjguNzY4NUM3Ny45NjQ2IDcwLjY4MjQgNzUuMjQ4NyA3MC42ODI0IDc0LjczNTkgNjguNzY4NUw2OC43NjI2IDQ2LjQ3NTlDNjguNjQ3MSA0Ni4wNDQ5IDY4LjY0NzEgNDUuNTkxIDY4Ljc2MjYgNDUuMTZMNzYuMzc1MSAxNi43NUM3Ni44NDMgMTUuMDAzNiA3OC40MjU2IDEzLjc4OTMgODAuMjMzNSAxMy43ODkzSDg4LjAwMzJDOTAuNjI5OCAxMy43ODkzIDkyLjU0MTUgMTYuMjgwNyA5MS44NjE3IDE4LjgxNzhMNzguNDc3NCA2OC43Njg1Wk0yNy4yMjc0IDQ2LjQzODdDMjcuMzQyOSA0Ni4wMDc3IDI3LjM0MjkgNDUuNTUzOSAyNy4yMjc0IDQ1LjEyMjhMMTkuNjI0OSAxNi43NUMxOS4xNTcgMTUuMDAzNiAxNy41NzQ0IDEzLjc4OTMgMTUuNzY2NSAxMy43ODkzSDcuOTk2NzdDNS4zNzAyMyAxMy43ODkzIDMuNDU4NTEgMTYuMjgwNyA0LjEzODMxIDE4LjgxNzhMMTcuNTEyNiA2OC43MzEzQzE4LjAyNTQgNzAuNjQ1MiAyMC43NDEzIDcwLjY0NTIgMjEuMjU0MSA2OC43MzEzTDI3LjIyNzQgNDYuNDM4N1oiIGZpbGw9IiMwMzY0RkYiLz4KPC9zdmc+Cg==`;
|
|
@@ -206,7 +206,8 @@ class AuthConnector extends BaseConnector {
|
|
|
206
206
|
return {
|
|
207
207
|
ethereumProvider: this.provider,
|
|
208
208
|
solanaWallet: this._solanaWallet,
|
|
209
|
-
connectorName: this.name
|
|
209
|
+
connectorName: this.name,
|
|
210
|
+
connectorNamespace: this.connectorNamespace
|
|
210
211
|
};
|
|
211
212
|
} catch (error) {
|
|
212
213
|
var _message;
|
|
@@ -817,7 +818,7 @@ class AuthConnector extends BaseConnector {
|
|
|
817
818
|
}
|
|
818
819
|
throw WalletLoginError.sfaKeyNotFound("This typically occurs when the authentication method used does not provide SFA keys (e.g., default auth connection).");
|
|
819
820
|
}
|
|
820
|
-
|
|
821
|
+
const connectorNamespace = this.connectorNamespace;
|
|
821
822
|
// setup WS embed if chainNamespace is EIP155 or SOLANA
|
|
822
823
|
if (chainNamespace === CHAIN_NAMESPACES.EIP155 || chainNamespace === CHAIN_NAMESPACES.SOLANA) {
|
|
823
824
|
// wait for ws embed instance to be ready.
|
|
@@ -843,7 +844,8 @@ class AuthConnector extends BaseConnector {
|
|
|
843
844
|
connectorName: WALLET_CONNECTORS.AUTH,
|
|
844
845
|
reconnected: this.rehydrated,
|
|
845
846
|
ethereumProvider: this.provider,
|
|
846
|
-
solanaWallet: this._solanaWallet
|
|
847
|
+
solanaWallet: this._solanaWallet,
|
|
848
|
+
connectorNamespace
|
|
847
849
|
});
|
|
848
850
|
if (params.getAuthTokenInfo) {
|
|
849
851
|
await this.getAuthTokenInfo();
|
|
@@ -860,7 +862,8 @@ class AuthConnector extends BaseConnector {
|
|
|
860
862
|
connectorName: WALLET_CONNECTORS.AUTH,
|
|
861
863
|
ethereumProvider: this.provider,
|
|
862
864
|
solanaWallet: this._solanaWallet,
|
|
863
|
-
reconnected: this.rehydrated
|
|
865
|
+
reconnected: this.rehydrated,
|
|
866
|
+
connectorNamespace
|
|
864
867
|
});
|
|
865
868
|
}
|
|
866
869
|
}
|
|
@@ -963,7 +966,12 @@ class AuthConnector extends BaseConnector {
|
|
|
963
966
|
if (error instanceof Web3AuthError) {
|
|
964
967
|
throw error;
|
|
965
968
|
}
|
|
966
|
-
|
|
969
|
+
const errorMessage = error instanceof Error ? error.message : error;
|
|
970
|
+
if (errorMessage === "Access control denied") {
|
|
971
|
+
reject(WalletLoginError.userBlocked(errorMessage, error));
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
reject(WalletLoginError.connectionError(errorMessage || "Failed to login with social"));
|
|
967
975
|
});
|
|
968
976
|
});
|
|
969
977
|
}
|