@web3auth/modal 10.0.0-beta.9 → 10.0.1-beta.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/README.md +2 -2
- package/dist/lib.cjs/packages/modal/src/config.js +1 -1
- package/dist/lib.cjs/packages/modal/src/connectors/coinbase-connector/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/modalManager.js +165 -92
- package/dist/lib.cjs/packages/modal/src/providers/ethereum-mpc-provider/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/providers/xrpl-provider/index.js +12 -0
- package/dist/lib.cjs/packages/modal/src/react/Web3AuthProvider.js +3 -1
- package/dist/lib.cjs/packages/modal/src/react/context/Web3AuthInnerContext.js +23 -19
- package/dist/lib.cjs/packages/modal/src/react/hooks/useIdentityToken.js +3 -3
- package/dist/lib.cjs/packages/modal/src/react/hooks/useWeb3AuthConnect.js +17 -1
- package/dist/lib.cjs/packages/modal/src/react/solana/hooks/useSolanaWallet.js +1 -1
- package/dist/lib.cjs/packages/modal/src/react/wagmi/constants.js +16 -0
- package/dist/lib.cjs/packages/modal/src/react/wagmi/provider.js +12 -6
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +36 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +8 -5
- package/dist/lib.cjs/packages/modal/src/ui/components/Footer/Footer.js +6 -9
- package/dist/lib.cjs/packages/modal/src/ui/components/Login/Login.js +23 -4
- package/dist/lib.cjs/packages/modal/src/ui/components/Root/Root.js +6 -2
- package/dist/lib.cjs/packages/modal/src/ui/components/Widget/Widget.js +2 -2
- package/dist/lib.cjs/packages/modal/src/ui/context/AnalyticsContext.js +9 -0
- package/dist/lib.cjs/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.cjs/packages/modal/src/ui/loginModal.js +42 -15
- package/dist/lib.cjs/packages/modal/src/utils.js +22 -0
- package/dist/lib.cjs/packages/modal/src/vue/Web3AuthProvider.js +11 -2
- package/dist/lib.cjs/packages/modal/src/vue/composables/useIdentityToken.js +3 -3
- package/dist/lib.cjs/packages/modal/src/vue/composables/useManageMFA.js +1 -1
- package/dist/lib.cjs/packages/modal/src/vue/composables/useWeb3AuthConnect.js +17 -1
- package/dist/lib.cjs/packages/modal/src/vue/solana/composables/useSolanaWallet.js +17 -14
- package/dist/lib.cjs/packages/modal/src/vue/wagmi/constants.js +16 -0
- package/dist/lib.cjs/packages/modal/src/vue/wagmi/provider.js +32 -13
- package/dist/lib.cjs/types/connectors/coinbase-connector/index.d.ts +1 -0
- package/dist/lib.cjs/types/interface.d.ts +0 -3
- package/dist/lib.cjs/types/modalManager.d.ts +5 -4
- package/dist/lib.cjs/types/providers/ethereum-mpc-provider/index.d.ts +1 -0
- package/dist/lib.cjs/types/providers/xrpl-provider/index.d.ts +1 -0
- package/dist/lib.cjs/types/react/Web3AuthProvider.d.ts +1 -1
- package/dist/lib.cjs/types/react/hooks/useIdentityToken.d.ts +2 -2
- package/dist/lib.cjs/types/react/hooks/useWeb3AuthConnect.d.ts +2 -1
- package/dist/lib.cjs/types/react/interfaces.d.ts +2 -1
- package/dist/lib.cjs/types/react/wagmi/constants.d.ts +43 -0
- package/dist/lib.cjs/types/ui/context/AnalyticsContext.d.ts +4 -0
- package/dist/lib.cjs/types/ui/interfaces.d.ts +4 -2
- package/dist/lib.cjs/types/ui/loginModal.d.ts +1 -0
- package/dist/lib.cjs/types/utils.d.ts +17 -0
- package/dist/lib.cjs/types/vue/composables/useIdentityToken.d.ts +1 -1
- package/dist/lib.cjs/types/vue/composables/useWeb3AuthConnect.d.ts +2 -1
- package/dist/lib.cjs/types/vue/wagmi/constants.d.ts +43 -0
- package/dist/lib.cjs/types/vue/wagmi/provider.d.ts +1 -0
- package/dist/lib.esm/packages/modal/src/config.js +1 -1
- package/dist/lib.esm/packages/modal/src/connectors/coinbase-connector/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/modalManager.js +173 -98
- package/dist/lib.esm/packages/modal/src/providers/ethereum-mpc-provider/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/providers/xrpl-provider/index.js +1 -0
- package/dist/lib.esm/packages/modal/src/react/Web3AuthProvider.js +3 -1
- package/dist/lib.esm/packages/modal/src/react/context/Web3AuthInnerContext.js +25 -21
- package/dist/lib.esm/packages/modal/src/react/hooks/useIdentityToken.js +3 -3
- package/dist/lib.esm/packages/modal/src/react/hooks/useWeb3AuthConnect.js +17 -1
- package/dist/lib.esm/packages/modal/src/react/solana/hooks/useSolanaWallet.js +1 -1
- package/dist/lib.esm/packages/modal/src/react/wagmi/constants.js +14 -0
- package/dist/lib.esm/packages/modal/src/react/wagmi/provider.js +14 -9
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWallet.js +40 -6
- package/dist/lib.esm/packages/modal/src/ui/components/ConnectWallet/ConnectWalletChainFilter/ConnectWalletChainFilter.js +8 -5
- package/dist/lib.esm/packages/modal/src/ui/components/Footer/Footer.js +6 -9
- package/dist/lib.esm/packages/modal/src/ui/components/Login/Login.js +24 -5
- package/dist/lib.esm/packages/modal/src/ui/components/Root/Root.js +6 -2
- package/dist/lib.esm/packages/modal/src/ui/components/Widget/Widget.js +2 -2
- package/dist/lib.esm/packages/modal/src/ui/context/AnalyticsContext.js +7 -0
- package/dist/lib.esm/packages/modal/src/ui/css/index.css.js +1 -1
- package/dist/lib.esm/packages/modal/src/ui/loginModal.js +41 -14
- package/dist/lib.esm/packages/modal/src/utils.js +20 -0
- package/dist/lib.esm/packages/modal/src/vue/Web3AuthProvider.js +12 -3
- package/dist/lib.esm/packages/modal/src/vue/composables/useIdentityToken.js +3 -3
- package/dist/lib.esm/packages/modal/src/vue/composables/useManageMFA.js +1 -1
- package/dist/lib.esm/packages/modal/src/vue/composables/useWeb3AuthConnect.js +17 -1
- package/dist/lib.esm/packages/modal/src/vue/solana/composables/useSolanaWallet.js +17 -14
- package/dist/lib.esm/packages/modal/src/vue/wagmi/constants.js +14 -0
- package/dist/lib.esm/packages/modal/src/vue/wagmi/provider.js +35 -16
- package/dist/modal.umd.min.js +1 -1
- package/dist/modal.umd.min.js.LICENSE.txt +4 -6
- package/package.json +41 -16
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Hop on to the [Web3Auth Dashboard](https://dashboard.web3auth.io/) and create a
|
|
|
43
43
|
Web3Auth needs to initialise as soon as your app loads up to enable the user to log in. Preferably done within a constructor, initialisation is the step where you can pass on all the configurations for Web3Auth you want. A simple integration for Ethereum blockchain will look like this:
|
|
44
44
|
|
|
45
45
|
```js
|
|
46
|
-
import { Web3Auth } from "
|
|
46
|
+
import { Web3Auth } from "web3auth";
|
|
47
47
|
|
|
48
48
|
//Initialize within your constructor
|
|
49
49
|
const web3auth = new Web3Auth({
|
|
@@ -54,7 +54,7 @@ const web3auth = new Web3Auth({
|
|
|
54
54
|
},
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
await web3auth.
|
|
57
|
+
await web3auth.init();
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
### Login your User
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var coinbaseConnector = require('@web3auth/no-modal/connectors/coinbase-connector');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(coinbaseConnector).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return coinbaseConnector[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -12,8 +12,8 @@ var loginModal = require('./ui/loginModal.js');
|
|
|
12
12
|
var utils = require('./ui/utils.js');
|
|
13
13
|
|
|
14
14
|
class Web3Auth extends noModal.Web3AuthNoModal {
|
|
15
|
-
constructor(options) {
|
|
16
|
-
super(options);
|
|
15
|
+
constructor(options, initialState) {
|
|
16
|
+
super(options, initialState);
|
|
17
17
|
_defineProperty(this, "loginModal", void 0);
|
|
18
18
|
_defineProperty(this, "options", void 0);
|
|
19
19
|
_defineProperty(this, "modalConfig", noModal.cloneDeep(config.defaultConnectorsModalConfig));
|
|
@@ -27,14 +27,25 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
27
27
|
});
|
|
28
28
|
_defineProperty(this, "onSocialLogin", async params => {
|
|
29
29
|
try {
|
|
30
|
-
await this.connectTo(noModal.WALLET_CONNECTORS.AUTH, params.loginParams);
|
|
30
|
+
await this.connectTo(noModal.WALLET_CONNECTORS.AUTH, params.loginParams, noModal.LOGIN_MODE.MODAL);
|
|
31
31
|
} catch (error) {
|
|
32
32
|
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
_defineProperty(this, "onExternalWalletLogin", async params => {
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
var _params$loginParams;
|
|
38
|
+
const connector = this.getConnector(params.connector, (_params$loginParams = params.loginParams) === null || _params$loginParams === void 0 ? void 0 : _params$loginParams.chainNamespace);
|
|
39
|
+
// auto-connect WalletConnect and non-injected MetaMask in background to generate QR code URI without interfering with user's selected connection
|
|
40
|
+
const shouldStartConnectionInBackground = connector.name === noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2 || connector.name === noModal.WALLET_CONNECTORS.METAMASK && !connector.isInjected;
|
|
41
|
+
if (shouldStartConnectionInBackground) {
|
|
42
|
+
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
43
|
+
await connector.connect({
|
|
44
|
+
chainId: initialChain.chainId
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
await this.connectTo(params.connector, params.loginParams, noModal.LOGIN_MODE.MODAL);
|
|
48
|
+
}
|
|
38
49
|
} catch (error) {
|
|
39
50
|
noModal.log.error(`Error while connecting to connector: ${params.connector}`, error);
|
|
40
51
|
}
|
|
@@ -96,65 +107,102 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
96
107
|
if (this.options.modalConfig) this.modalConfig = this.options.modalConfig;
|
|
97
108
|
noModal.log.info("modalConfig", this.modalConfig);
|
|
98
109
|
}
|
|
99
|
-
async
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
projectConfig,
|
|
107
|
-
walletRegistry
|
|
108
|
-
} = await this.getProjectAndWalletConfig();
|
|
109
|
-
// init config
|
|
110
|
-
this.initUIConfig(projectConfig);
|
|
111
|
-
super.initAccountAbstractionConfig(projectConfig);
|
|
112
|
-
super.initChainsConfig(projectConfig);
|
|
113
|
-
super.initCachedConnectorAndChainId();
|
|
114
|
-
// init login modal
|
|
115
|
-
const {
|
|
116
|
-
filteredWalletRegistry,
|
|
117
|
-
disabledExternalWallets
|
|
118
|
-
} = this.filterWalletRegistry(walletRegistry, projectConfig);
|
|
119
|
-
this.loginModal = new loginModal.LoginModal(_objectSpread(_objectSpread({}, this.options.uiConfig), {}, {
|
|
120
|
-
connectorListener: this,
|
|
121
|
-
web3authClientId: this.options.clientId,
|
|
122
|
-
web3authNetwork: this.options.web3AuthNetwork,
|
|
123
|
-
authBuildEnv: this.options.authBuildEnv,
|
|
124
|
-
chainNamespaces: this.getChainNamespaces(),
|
|
125
|
-
walletRegistry: filteredWalletRegistry
|
|
126
|
-
}), {
|
|
127
|
-
onInitExternalWallets: this.onInitExternalWallets,
|
|
128
|
-
onSocialLogin: this.onSocialLogin,
|
|
129
|
-
onExternalWalletLogin: this.onExternalWalletLogin,
|
|
130
|
-
onModalVisibility: this.onModalVisibility
|
|
110
|
+
async init(options) {
|
|
111
|
+
// init analytics
|
|
112
|
+
const startTime = Date.now();
|
|
113
|
+
this.analytics.init();
|
|
114
|
+
this.analytics.identify(this.options.clientId, {
|
|
115
|
+
web3auth_client_id: this.options.clientId,
|
|
116
|
+
web3auth_network: this.options.web3AuthNetwork
|
|
131
117
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
noModal.withAbort(() => this.initConnectors({
|
|
147
|
-
connectors: newConnectors,
|
|
118
|
+
this.analytics.setGlobalProperties({
|
|
119
|
+
dapp_url: window.location.origin,
|
|
120
|
+
sdk_name: noModal.ANALYTICS_SDK_TYPE.WEB_MODAL,
|
|
121
|
+
sdk_version: noModal.sdkVersion
|
|
122
|
+
});
|
|
123
|
+
let trackData = {};
|
|
124
|
+
try {
|
|
125
|
+
var _authConnector$authIn, _this$coreOptions$uiC;
|
|
126
|
+
const {
|
|
127
|
+
signal
|
|
128
|
+
} = options || {};
|
|
129
|
+
super.checkInitRequirements();
|
|
130
|
+
// get project config and wallet registry
|
|
131
|
+
const {
|
|
148
132
|
projectConfig,
|
|
133
|
+
walletRegistry
|
|
134
|
+
} = await this.getProjectAndWalletConfig();
|
|
135
|
+
// init config
|
|
136
|
+
this.initUIConfig(projectConfig);
|
|
137
|
+
super.initAccountAbstractionConfig(projectConfig);
|
|
138
|
+
super.initChainsConfig(projectConfig);
|
|
139
|
+
super.initCachedConnectorAndChainId();
|
|
140
|
+
super.initWalletServicesConfig(projectConfig);
|
|
141
|
+
trackData = this.getInitializationTrackData();
|
|
142
|
+
// init login modal
|
|
143
|
+
const {
|
|
144
|
+
filteredWalletRegistry,
|
|
149
145
|
disabledExternalWallets
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
} = this.filterWalletRegistry(walletRegistry, projectConfig);
|
|
147
|
+
this.loginModal = new loginModal.LoginModal(_objectSpread(_objectSpread({}, this.options.uiConfig), {}, {
|
|
148
|
+
connectorListener: this,
|
|
149
|
+
web3authClientId: this.options.clientId,
|
|
150
|
+
web3authNetwork: this.options.web3AuthNetwork,
|
|
151
|
+
authBuildEnv: this.options.authBuildEnv,
|
|
152
|
+
chainNamespaces: this.getChainNamespaces(),
|
|
153
|
+
walletRegistry: filteredWalletRegistry,
|
|
154
|
+
analytics: this.analytics
|
|
155
|
+
}), {
|
|
156
|
+
onInitExternalWallets: this.onInitExternalWallets,
|
|
157
|
+
onSocialLogin: this.onSocialLogin,
|
|
158
|
+
onExternalWalletLogin: this.onExternalWalletLogin,
|
|
159
|
+
onModalVisibility: this.onModalVisibility
|
|
160
|
+
});
|
|
161
|
+
await noModal.withAbort(() => this.loginModal.initModal(), signal);
|
|
162
|
+
// setup common JRPC provider
|
|
163
|
+
await noModal.withAbort(() => this.setupCommonJRPCProvider(), signal);
|
|
164
|
+
// initialize connectors
|
|
165
|
+
this.on(noModal.CONNECTOR_EVENTS.CONNECTORS_UPDATED, ({
|
|
166
|
+
connectors: newConnectors
|
|
167
|
+
}) => {
|
|
168
|
+
const onAbortHandler = () => {
|
|
169
|
+
var _this$connectors;
|
|
170
|
+
noModal.log.debug("init aborted");
|
|
171
|
+
if (((_this$connectors = this.connectors) === null || _this$connectors === void 0 ? void 0 : _this$connectors.length) > 0) {
|
|
172
|
+
super.cleanup();
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
noModal.withAbort(() => this.initConnectors({
|
|
176
|
+
connectors: newConnectors,
|
|
177
|
+
projectConfig,
|
|
178
|
+
disabledExternalWallets
|
|
179
|
+
}), signal, onAbortHandler);
|
|
180
|
+
});
|
|
181
|
+
await noModal.withAbort(() => super.loadConnectors({
|
|
182
|
+
projectConfig,
|
|
183
|
+
modalMode: true
|
|
184
|
+
}), signal);
|
|
185
|
+
// initialize plugins
|
|
186
|
+
await noModal.withAbort(() => super.initPlugins(), signal);
|
|
187
|
+
// track completion event
|
|
188
|
+
const authConnector = this.getConnector(noModal.WALLET_CONNECTORS.AUTH);
|
|
189
|
+
trackData = _objectSpread(_objectSpread({}, trackData), {}, {
|
|
190
|
+
connectors: this.connectors.map(connector => connector.name),
|
|
191
|
+
plugins: Object.keys(this.plugins),
|
|
192
|
+
auth_ux_mode: (authConnector === null || authConnector === void 0 || (_authConnector$authIn = authConnector.authInstance) === null || _authConnector$authIn === void 0 || (_authConnector$authIn = _authConnector$authIn.options) === null || _authConnector$authIn === void 0 ? void 0 : _authConnector$authIn.uxMode) || ((_this$coreOptions$uiC = this.coreOptions.uiConfig) === null || _this$coreOptions$uiC === void 0 ? void 0 : _this$coreOptions$uiC.uxMode)
|
|
193
|
+
});
|
|
194
|
+
this.analytics.track(noModal.ANALYTICS_EVENTS.SDK_INITIALIZATION_COMPLETED, _objectSpread(_objectSpread({}, trackData), {}, {
|
|
195
|
+
duration: Date.now() - startTime
|
|
196
|
+
}));
|
|
197
|
+
} catch (error) {
|
|
198
|
+
if (error instanceof DOMException && error.name === "AbortError") return;
|
|
199
|
+
// track failure event
|
|
200
|
+
this.analytics.track(noModal.ANALYTICS_EVENTS.SDK_INITIALIZATION_FAILED, _objectSpread(_objectSpread(_objectSpread({}, trackData), noModal.getErrorAnalyticsProperties(error)), {}, {
|
|
201
|
+
duration: Date.now() - startTime
|
|
202
|
+
}));
|
|
203
|
+
noModal.log.error("Failed to initialize modal", error);
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
158
206
|
}
|
|
159
207
|
async connect() {
|
|
160
208
|
if (!this.loginModal) throw noModal.WalletInitializationError.notReady("Login modal is not initialized");
|
|
@@ -187,6 +235,49 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
187
235
|
this.once(interfaces.LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, handleVisibility);
|
|
188
236
|
});
|
|
189
237
|
}
|
|
238
|
+
initUIConfig(projectConfig) {
|
|
239
|
+
super.initUIConfig(projectConfig);
|
|
240
|
+
this.options.uiConfig = deepmerge(noModal.cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
|
|
241
|
+
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = utils.getUserLanguage(this.options.uiConfig.defaultLanguage);
|
|
242
|
+
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "light";
|
|
243
|
+
this.options.uiConfig = deepmerge(projectConfig.loginModal || {}, this.options.uiConfig, {
|
|
244
|
+
arrayMerge: (_, sourceArray) => sourceArray
|
|
245
|
+
});
|
|
246
|
+
// merge login methods order from project config and user config, with user config taking precedence
|
|
247
|
+
const defaultAuthConnections = projectConfig.embeddedWalletAuth.filter(x => x.isDefault).map(x => x.authConnection);
|
|
248
|
+
const mergedAuthConnections = [...(this.options.uiConfig.loginMethodsOrder || []), ...defaultAuthConnections];
|
|
249
|
+
const loginMethodsOrder = [];
|
|
250
|
+
const authConnectionSet = new Set();
|
|
251
|
+
for (const authConnection of mergedAuthConnections) {
|
|
252
|
+
if (authConnectionSet.has(authConnection)) continue;
|
|
253
|
+
authConnectionSet.add(authConnection);
|
|
254
|
+
loginMethodsOrder.push(authConnection);
|
|
255
|
+
}
|
|
256
|
+
this.options.uiConfig.loginMethodsOrder = loginMethodsOrder;
|
|
257
|
+
}
|
|
258
|
+
getInitializationTrackData() {
|
|
259
|
+
var _this$modalConfig, _this$modalConfig2, _this$modalConfig3, _this$options$uiConfi, _this$options$uiConfi2, _this$options$uiConfi3, _this$options$uiConfi4, _this$options$uiConfi5, _this$options$uiConfi6, _this$options$uiConfi7, _this$options$uiConfi8, _this$options$uiConfi9, _this$options$uiConfi0, _this$options$uiConfi1, _this$options$uiConfi10, _this$options$uiConfi11, _this$options$uiConfi12;
|
|
260
|
+
return _objectSpread(_objectSpread({}, super.getInitializationTrackData()), {}, {
|
|
261
|
+
modal_hide_wallet_discovery: (_this$modalConfig = this.modalConfig) === null || _this$modalConfig === void 0 ? void 0 : _this$modalConfig.hideWalletDiscovery,
|
|
262
|
+
modal_connectors: Object.keys(((_this$modalConfig2 = this.modalConfig) === null || _this$modalConfig2 === void 0 ? void 0 : _this$modalConfig2.connectors) || {}),
|
|
263
|
+
modal_auth_connector_login_methods: Object.keys(((_this$modalConfig3 = this.modalConfig) === null || _this$modalConfig3 === void 0 || (_this$modalConfig3 = _this$modalConfig3.connectors) === null || _this$modalConfig3 === void 0 || (_this$modalConfig3 = _this$modalConfig3[noModal.WALLET_CONNECTORS.AUTH]) === null || _this$modalConfig3 === void 0 ? void 0 : _this$modalConfig3.loginMethods) || {}),
|
|
264
|
+
// UI config
|
|
265
|
+
ui_login_methods_order: (_this$options$uiConfi = this.options.uiConfig) === null || _this$options$uiConfi === void 0 ? void 0 : _this$options$uiConfi.loginMethodsOrder,
|
|
266
|
+
ui_modal_z_index: (_this$options$uiConfi2 = this.options.uiConfig) === null || _this$options$uiConfi2 === void 0 ? void 0 : _this$options$uiConfi2.modalZIndex,
|
|
267
|
+
ui_display_errors_on_modal: (_this$options$uiConfi3 = this.options.uiConfig) === null || _this$options$uiConfi3 === void 0 ? void 0 : _this$options$uiConfi3.displayErrorsOnModal,
|
|
268
|
+
ui_login_grid_col: (_this$options$uiConfi4 = this.options.uiConfig) === null || _this$options$uiConfi4 === void 0 ? void 0 : _this$options$uiConfi4.loginGridCol,
|
|
269
|
+
ui_primary_button: (_this$options$uiConfi5 = this.options.uiConfig) === null || _this$options$uiConfi5 === void 0 ? void 0 : _this$options$uiConfi5.primaryButton,
|
|
270
|
+
ui_modal_widget_type: (_this$options$uiConfi6 = this.options.uiConfig) === null || _this$options$uiConfi6 === void 0 ? void 0 : _this$options$uiConfi6.widgetType,
|
|
271
|
+
ui_modal_target_id_used: Boolean((_this$options$uiConfi7 = this.options.uiConfig) === null || _this$options$uiConfi7 === void 0 ? void 0 : _this$options$uiConfi7.targetId),
|
|
272
|
+
ui_modal_logo_alignment: (_this$options$uiConfi8 = this.options.uiConfig) === null || _this$options$uiConfi8 === void 0 ? void 0 : _this$options$uiConfi8.logoAlignment,
|
|
273
|
+
ui_modal_border_radius_type: (_this$options$uiConfi9 = this.options.uiConfig) === null || _this$options$uiConfi9 === void 0 ? void 0 : _this$options$uiConfi9.borderRadiusType,
|
|
274
|
+
ui_modal_button_radius_type: (_this$options$uiConfi0 = this.options.uiConfig) === null || _this$options$uiConfi0 === void 0 ? void 0 : _this$options$uiConfi0.buttonRadiusType,
|
|
275
|
+
ui_modal_sign_in_methods: (_this$options$uiConfi1 = this.options.uiConfig) === null || _this$options$uiConfi1 === void 0 ? void 0 : _this$options$uiConfi1.signInMethods,
|
|
276
|
+
ui_modal_add_previous_login_hint: (_this$options$uiConfi10 = this.options.uiConfig) === null || _this$options$uiConfi10 === void 0 ? void 0 : _this$options$uiConfi10.addPreviousLoginHint,
|
|
277
|
+
ui_modal_display_installed_external_wallets: (_this$options$uiConfi11 = this.options.uiConfig) === null || _this$options$uiConfi11 === void 0 ? void 0 : _this$options$uiConfi11.displayInstalledExternalWallets,
|
|
278
|
+
ui_modal_display_external_wallets_count: (_this$options$uiConfi12 = this.options.uiConfig) === null || _this$options$uiConfi12 === void 0 ? void 0 : _this$options$uiConfi12.displayExternalWalletsCount
|
|
279
|
+
});
|
|
280
|
+
}
|
|
190
281
|
filterWalletRegistry(walletRegistry, projectConfig) {
|
|
191
282
|
const {
|
|
192
283
|
disableAllRecommendedWallets,
|
|
@@ -215,7 +306,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
215
306
|
};
|
|
216
307
|
}
|
|
217
308
|
async getProjectAndWalletConfig() {
|
|
218
|
-
var _this$options$account, _this$
|
|
309
|
+
var _this$options$account, _this$modalConfig4;
|
|
219
310
|
const [projectConfigResult, walletRegistryResult] = await Promise.allSettled([noModal.fetchProjectConfig({
|
|
220
311
|
clientId: this.options.clientId,
|
|
221
312
|
web3AuthNetwork: this.options.web3AuthNetwork,
|
|
@@ -235,7 +326,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
235
326
|
default: {}
|
|
236
327
|
};
|
|
237
328
|
const isExternalWalletEnabled = Boolean(projectConfig.externalWalletAuth);
|
|
238
|
-
if (isExternalWalletEnabled && !((_this$
|
|
329
|
+
if (isExternalWalletEnabled && !((_this$modalConfig4 = this.modalConfig) !== null && _this$modalConfig4 !== void 0 && _this$modalConfig4.hideWalletDiscovery)) {
|
|
239
330
|
if (walletRegistryResult.status === "fulfilled") {
|
|
240
331
|
walletRegistry = walletRegistryResult.value;
|
|
241
332
|
} else {
|
|
@@ -247,25 +338,6 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
247
338
|
walletRegistry
|
|
248
339
|
};
|
|
249
340
|
}
|
|
250
|
-
initUIConfig(projectConfig) {
|
|
251
|
-
this.options.uiConfig = deepmerge(noModal.cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
|
|
252
|
-
if (!this.options.uiConfig.defaultLanguage) this.options.uiConfig.defaultLanguage = utils.getUserLanguage(this.options.uiConfig.defaultLanguage);
|
|
253
|
-
if (!this.options.uiConfig.mode) this.options.uiConfig.mode = "light";
|
|
254
|
-
this.options.uiConfig = deepmerge(projectConfig.loginModal || {}, this.options.uiConfig, {
|
|
255
|
-
arrayMerge: (_, sourceArray) => sourceArray
|
|
256
|
-
});
|
|
257
|
-
// merge login methods order from project config and user config, with user config taking precedence
|
|
258
|
-
const defaultAuthConnections = projectConfig.embeddedWalletAuth.filter(x => x.isDefault).map(x => x.authConnection);
|
|
259
|
-
const mergedAuthConnections = [...(this.options.uiConfig.loginMethodsOrder || []), ...defaultAuthConnections];
|
|
260
|
-
const loginMethodsOrder = [];
|
|
261
|
-
const authConnectionSet = new Set();
|
|
262
|
-
for (const authConnection of mergedAuthConnections) {
|
|
263
|
-
if (authConnectionSet.has(authConnection)) continue;
|
|
264
|
-
authConnectionSet.add(authConnection);
|
|
265
|
-
loginMethodsOrder.push(authConnection);
|
|
266
|
-
}
|
|
267
|
-
this.options.uiConfig.loginMethodsOrder = loginMethodsOrder;
|
|
268
|
-
}
|
|
269
341
|
async initConnectors({
|
|
270
342
|
connectors,
|
|
271
343
|
projectConfig,
|
|
@@ -314,7 +386,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
314
386
|
projectConfig,
|
|
315
387
|
disabledExternalWallets
|
|
316
388
|
}) {
|
|
317
|
-
var _this$
|
|
389
|
+
var _this$modalConfig5;
|
|
318
390
|
// Auth connector config: populate this with the default config for auth connectors.
|
|
319
391
|
const loginMethods = {};
|
|
320
392
|
const embedWalletConfigMap = new Map();
|
|
@@ -345,7 +417,7 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
345
417
|
}
|
|
346
418
|
};
|
|
347
419
|
// populate the user config data with the dashboard config.
|
|
348
|
-
if ((_this$
|
|
420
|
+
if ((_this$modalConfig5 = this.modalConfig) !== null && _this$modalConfig5 !== void 0 && (_this$modalConfig5 = _this$modalConfig5.connectors) !== null && _this$modalConfig5 !== void 0 && _this$modalConfig5[noModal.WALLET_CONNECTORS.AUTH]) {
|
|
349
421
|
if (!this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods) this.modalConfig.connectors[noModal.WALLET_CONNECTORS.AUTH].loginMethods = {};
|
|
350
422
|
}
|
|
351
423
|
const authProviders = new Set(config$1.AUTH_PROVIDERS);
|
|
@@ -375,13 +447,13 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
375
447
|
// merge default connectors with the custom configured connectors.
|
|
376
448
|
const allConnectorNames = [...new Set([...Object.keys(this.modalConfig.connectors || {}), ...this.connectors.map(connector => connector.name)])];
|
|
377
449
|
const connectorNames = allConnectorNames.map(connectorName => {
|
|
378
|
-
var _this$
|
|
450
|
+
var _this$modalConfig6, _this$modalConfig$con, _this$modalConfig$con2;
|
|
379
451
|
// start with the default config of connector.
|
|
380
452
|
const defaultConnectorConfig = {
|
|
381
453
|
label: noModal.CONNECTOR_NAMES[connectorName] || connectorName.split("-").map(config$1.capitalizeFirstLetter).join(" "),
|
|
382
454
|
showOnModal: true
|
|
383
455
|
};
|
|
384
|
-
this.modalConfig.connectors[connectorName] = _objectSpread(_objectSpread({}, defaultConnectorConfig), ((_this$
|
|
456
|
+
this.modalConfig.connectors[connectorName] = _objectSpread(_objectSpread({}, defaultConnectorConfig), ((_this$modalConfig6 = this.modalConfig) === null || _this$modalConfig6 === void 0 || (_this$modalConfig6 = _this$modalConfig6.connectors) === null || _this$modalConfig6 === void 0 ? void 0 : _this$modalConfig6[connectorName]) || {});
|
|
385
457
|
// check if connector is configured/added by user and exist in connectors map.
|
|
386
458
|
const connector = this.getConnector(connectorName);
|
|
387
459
|
noModal.log.debug("connector config", connectorName, (_this$modalConfig$con = this.modalConfig.connectors) === null || _this$modalConfig$con === void 0 || (_this$modalConfig$con = _this$modalConfig$con[connectorName]) === null || _this$modalConfig$con === void 0 ? void 0 : _this$modalConfig$con.showOnModal, connector);
|
|
@@ -401,9 +473,9 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
401
473
|
}
|
|
402
474
|
// skip WC connector if external wallets are disabled or hideWalletDiscovery is true
|
|
403
475
|
if (connectorName === noModal.WALLET_CONNECTORS.WALLET_CONNECT_V2) {
|
|
404
|
-
var _this$
|
|
476
|
+
var _this$modalConfig7;
|
|
405
477
|
if (!isExternalWalletEnabled) return;
|
|
406
|
-
if ((_this$
|
|
478
|
+
if ((_this$modalConfig7 = this.modalConfig) !== null && _this$modalConfig7 !== void 0 && _this$modalConfig7.hideWalletDiscovery) return;
|
|
407
479
|
}
|
|
408
480
|
this.modalConfig.connectors[connectorName] = connectorConfig;
|
|
409
481
|
return connectorName;
|
|
@@ -447,19 +519,20 @@ class Web3Auth extends noModal.Web3AuthNoModal {
|
|
|
447
519
|
// external wallets are initialized on INIT_EXTERNAL_WALLET event.
|
|
448
520
|
this.subscribeToConnectorEvents(connector);
|
|
449
521
|
const initialChain = this.getInitialChainIdForConnector(connector);
|
|
522
|
+
const autoConnect = super.checkIfAutoConnect(connector);
|
|
450
523
|
await connector.init({
|
|
451
|
-
autoConnect
|
|
524
|
+
autoConnect,
|
|
452
525
|
chainId: initialChain.chainId
|
|
453
526
|
});
|
|
454
527
|
// note: not adding cachedWallet to modal if it is external wallet.
|
|
455
528
|
// adding it later if no in-app wallets are available.
|
|
456
529
|
if (connector.type === noModal.CONNECTOR_CATEGORY.IN_APP) {
|
|
457
|
-
var _this$modalConfig$con6, _this$options$
|
|
530
|
+
var _this$modalConfig$con6, _this$options$uiConfi13, _this$options$uiConfi14, _this$options$uiConfi15;
|
|
458
531
|
noModal.log.info("connectorInitResults", connectorName);
|
|
459
532
|
const loginMethods = ((_this$modalConfig$con6 = this.modalConfig.connectors[connectorName]) === null || _this$modalConfig$con6 === void 0 ? void 0 : _this$modalConfig$con6.loginMethods) || {};
|
|
460
|
-
this.loginModal.addSocialLogins(connectorName, loginMethods, ((_this$options$
|
|
461
|
-
loginGridCol: ((_this$options$
|
|
462
|
-
primaryButton: ((_this$options$
|
|
533
|
+
this.loginModal.addSocialLogins(connectorName, loginMethods, ((_this$options$uiConfi13 = this.options.uiConfig) === null || _this$options$uiConfi13 === void 0 ? void 0 : _this$options$uiConfi13.loginMethodsOrder) || config$1.AUTH_PROVIDERS, _objectSpread(_objectSpread({}, this.options.uiConfig), {}, {
|
|
534
|
+
loginGridCol: ((_this$options$uiConfi14 = this.options.uiConfig) === null || _this$options$uiConfi14 === void 0 ? void 0 : _this$options$uiConfi14.loginGridCol) || 3,
|
|
535
|
+
primaryButton: ((_this$options$uiConfi15 = this.options.uiConfig) === null || _this$options$uiConfi15 === void 0 ? void 0 : _this$options$uiConfi15.primaryButton) || "socialLogin"
|
|
463
536
|
}));
|
|
464
537
|
}
|
|
465
538
|
} catch (error) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ethereumMpcProvider = require('@web3auth/no-modal/providers/ethereum-mpc-provider');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(ethereumMpcProvider).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return ethereumMpcProvider[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var xrplProvider = require('@web3auth/no-modal/providers/xrpl-provider');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.keys(xrplProvider).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return xrplProvider[k]; }
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -6,13 +6,15 @@ var Web3AuthInnerContext = require('./context/Web3AuthInnerContext.js');
|
|
|
6
6
|
|
|
7
7
|
function Web3AuthProvider({
|
|
8
8
|
config,
|
|
9
|
+
initialState,
|
|
9
10
|
children
|
|
10
11
|
}) {
|
|
11
12
|
const pluginChild = /*#__PURE__*/react.createElement(WalletServicesInnerContext.WalletServicesContextProvider, {
|
|
12
13
|
context: Web3AuthInnerContext.Web3AuthInnerContext
|
|
13
14
|
}, children);
|
|
14
15
|
return /*#__PURE__*/react.createElement(Web3AuthInnerContext.Web3AuthInnerProvider, {
|
|
15
|
-
config
|
|
16
|
+
config,
|
|
17
|
+
initialState
|
|
16
18
|
}, pluginChild);
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -8,40 +8,37 @@ const Web3AuthInnerContext = /*#__PURE__*/react.createContext(null);
|
|
|
8
8
|
function Web3AuthInnerProvider(params) {
|
|
9
9
|
const {
|
|
10
10
|
children,
|
|
11
|
-
config
|
|
11
|
+
config,
|
|
12
|
+
initialState
|
|
12
13
|
} = params;
|
|
13
|
-
const
|
|
14
|
+
const {
|
|
15
|
+
web3AuthOptions
|
|
16
|
+
} = config;
|
|
14
17
|
const [isInitializing, setIsInitializing] = react.useState(false);
|
|
15
18
|
const [initError, setInitError] = react.useState(null);
|
|
16
|
-
const [isConnected, setIsConnected] = react.useState(false);
|
|
17
19
|
const [provider, setProvider] = react.useState(null);
|
|
18
20
|
const [isInitialized, setIsInitialized] = react.useState(false);
|
|
19
|
-
const [status, setStatus] = react.useState(null);
|
|
20
21
|
const [isMFAEnabled, setIsMFAEnabled] = react.useState(false);
|
|
22
|
+
const web3Auth = react.useMemo(() => {
|
|
23
|
+
setProvider(null);
|
|
24
|
+
return new modalManager.Web3Auth(web3AuthOptions, initialState);
|
|
25
|
+
}, [web3AuthOptions, initialState]);
|
|
26
|
+
const [isConnected, setIsConnected] = react.useState(web3Auth.status === noModal.CONNECTOR_STATUS.CONNECTED);
|
|
27
|
+
const [status, setStatus] = react.useState(web3Auth.status);
|
|
21
28
|
const getPlugin = react.useCallback(name => {
|
|
22
29
|
if (!web3Auth) throw noModal.WalletInitializationError.notReady();
|
|
23
30
|
return web3Auth.getPlugin(name);
|
|
24
31
|
}, [web3Auth]);
|
|
25
|
-
react.useEffect(() => {
|
|
26
|
-
const resetHookState = () => {
|
|
27
|
-
setProvider(null);
|
|
28
|
-
setIsConnected(false);
|
|
29
|
-
setStatus(null);
|
|
30
|
-
};
|
|
31
|
-
resetHookState();
|
|
32
|
-
const {
|
|
33
|
-
web3AuthOptions
|
|
34
|
-
} = config;
|
|
35
|
-
const web3AuthInstance = new modalManager.Web3Auth(web3AuthOptions);
|
|
36
|
-
setWeb3Auth(web3AuthInstance);
|
|
37
|
-
}, [config]);
|
|
38
32
|
react.useEffect(() => {
|
|
39
33
|
const controller = new AbortController();
|
|
40
34
|
async function init() {
|
|
41
35
|
try {
|
|
42
36
|
setInitError(null);
|
|
43
37
|
setIsInitializing(true);
|
|
44
|
-
|
|
38
|
+
web3Auth.setAnalyticsProperties({
|
|
39
|
+
integration_type: noModal.ANALYTICS_INTEGRATION_TYPE.REACT_HOOKS
|
|
40
|
+
});
|
|
41
|
+
await web3Auth.init({
|
|
45
42
|
signal: controller.signal
|
|
46
43
|
});
|
|
47
44
|
} catch (error) {
|
|
@@ -79,7 +76,12 @@ function Web3AuthInnerProvider(params) {
|
|
|
79
76
|
setStatus(web3Auth.status);
|
|
80
77
|
};
|
|
81
78
|
const errorListener = () => {
|
|
82
|
-
setStatus(
|
|
79
|
+
setStatus(web3Auth.status);
|
|
80
|
+
};
|
|
81
|
+
const rehydrationErrorListener = () => {
|
|
82
|
+
setStatus(web3Auth.status);
|
|
83
|
+
setIsConnected(false);
|
|
84
|
+
setProvider(null);
|
|
83
85
|
};
|
|
84
86
|
const mfaEnabledListener = isMFAEnabled => {
|
|
85
87
|
if (typeof isMFAEnabled === "boolean") setIsMFAEnabled(isMFAEnabled);
|
|
@@ -93,6 +95,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
93
95
|
web3Auth.on(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
94
96
|
web3Auth.on(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
95
97
|
web3Auth.on(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
98
|
+
web3Auth.on(noModal.CONNECTOR_EVENTS.REHYDRATION_ERROR, rehydrationErrorListener);
|
|
96
99
|
web3Auth.on(noModal.CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
|
|
97
100
|
}
|
|
98
101
|
return () => {
|
|
@@ -103,6 +106,7 @@ function Web3AuthInnerProvider(params) {
|
|
|
103
106
|
web3Auth.off(noModal.CONNECTOR_EVENTS.DISCONNECTED, disconnectedListener);
|
|
104
107
|
web3Auth.off(noModal.CONNECTOR_EVENTS.CONNECTING, connectingListener);
|
|
105
108
|
web3Auth.off(noModal.CONNECTOR_EVENTS.ERRORED, errorListener);
|
|
109
|
+
web3Auth.off(noModal.CONNECTOR_EVENTS.REHYDRATION_ERROR, rehydrationErrorListener);
|
|
106
110
|
web3Auth.off(noModal.CONNECTOR_EVENTS.MFA_ENABLED, mfaEnabledListener);
|
|
107
111
|
web3Auth.cleanup();
|
|
108
112
|
}
|
|
@@ -11,11 +11,11 @@ const useIdentityToken = () => {
|
|
|
11
11
|
const [loading, setLoading] = react.useState(false);
|
|
12
12
|
const [error, setError] = react.useState(null);
|
|
13
13
|
const [token, setToken] = react.useState(null);
|
|
14
|
-
const
|
|
14
|
+
const getIdentityToken = react.useCallback(async () => {
|
|
15
15
|
setLoading(true);
|
|
16
16
|
setError(null);
|
|
17
17
|
try {
|
|
18
|
-
const userAuthInfo = await web3Auth.
|
|
18
|
+
const userAuthInfo = await web3Auth.getIdentityToken();
|
|
19
19
|
if (userAuthInfo !== null && userAuthInfo !== void 0 && userAuthInfo.idToken) {
|
|
20
20
|
setToken(userAuthInfo.idToken);
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ const useIdentityToken = () => {
|
|
|
35
35
|
loading,
|
|
36
36
|
error,
|
|
37
37
|
token,
|
|
38
|
-
|
|
38
|
+
getIdentityToken
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -35,12 +35,28 @@ const useWeb3AuthConnect = () => {
|
|
|
35
35
|
setLoading(false);
|
|
36
36
|
}
|
|
37
37
|
}, [web3Auth]);
|
|
38
|
+
const connectTo = react.useCallback(async (connector, params) => {
|
|
39
|
+
setLoading(true);
|
|
40
|
+
setError(null);
|
|
41
|
+
try {
|
|
42
|
+
const provider = await web3Auth.connectTo(connector, params);
|
|
43
|
+
if (provider) {
|
|
44
|
+
setConnectorName(web3Auth.connectedConnectorName);
|
|
45
|
+
}
|
|
46
|
+
return provider;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
setError(error);
|
|
49
|
+
} finally {
|
|
50
|
+
setLoading(false);
|
|
51
|
+
}
|
|
52
|
+
}, [web3Auth]);
|
|
38
53
|
return {
|
|
39
54
|
isConnected,
|
|
40
55
|
loading,
|
|
41
56
|
error,
|
|
42
57
|
connectorName,
|
|
43
|
-
connect
|
|
58
|
+
connect,
|
|
59
|
+
connectTo
|
|
44
60
|
};
|
|
45
61
|
};
|
|
46
62
|
|
|
@@ -26,7 +26,7 @@ const useSolanaWallet = () => {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
if (!solanaWallet) return;
|
|
29
|
-
const accounts = await solanaWallet.
|
|
29
|
+
const accounts = await solanaWallet.getAccounts();
|
|
30
30
|
if ((accounts === null || accounts === void 0 ? void 0 : accounts.length) > 0) {
|
|
31
31
|
setAccounts(accounts);
|
|
32
32
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var wagmi = require('wagmi');
|
|
4
|
+
var chains = require('wagmi/chains');
|
|
5
|
+
|
|
6
|
+
const defaultWagmiConfig = wagmi.createConfig({
|
|
7
|
+
chains: [chains.mainnet],
|
|
8
|
+
connectors: [],
|
|
9
|
+
// or your basic wallets
|
|
10
|
+
ssr: true,
|
|
11
|
+
transports: {
|
|
12
|
+
[chains.mainnet.id]: wagmi.http(chains.mainnet.rpcUrls.default.http[0])
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
exports.defaultWagmiConfig = defaultWagmiConfig;
|