Skip to content

Commit 00fc49e

Browse files
committed
Merge branch 'master' of github.com:Web3Auth/Web3Auth into feat/auth-adapter-v10
2 parents 050f930 + d22af09 commit 00fc49e

File tree

40 files changed

+233
-585
lines changed

40 files changed

+233
-585
lines changed

demo/vue-app-new/src/MainView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ const options = computed((): Web3AuthOptions => {
8787
useAAWithExternalWallet: formData.useAAWithExternalWallet,
8888
// TODO: Add more options
8989
// enableLogging?: boolean;
90-
// storageKey?: "session" | "local";
90+
// storageType?: "session" | "local";
9191
// sessionTime?: number;
9292
// useCoreKitKey?: boolean;
9393
chains,
94+
defaultChainId: formData.defaultChainId,
9495
enableLogging: true,
9596
connectors: [...externalConnectors.value, authConnector({ connectorSettings: { buildEnv: "development" }, loginSettings: { mfaLevel: "mandatory"}})],
9697
plugins,

demo/vue-app-new/src/components/AppSettings.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ const chainOptions = computed(() => {
3737
return allChains;
3838
});
3939
40+
const defaultChainOptions = computed(() => {
41+
return formData.chains.map((chain) => ({ name: chain, value: chain }));
42+
});
43+
4044
const adapterOptions = computed(() =>
4145
formData.chainNamespaces.includes(CHAIN_NAMESPACES.EIP155)
4246
? [
@@ -90,6 +94,7 @@ const isActiveTab = (index: number) => activeTab.value === index;
9094
const onChainNamespaceChange = (value: string[]) => {
9195
log.info("onChainNamespaceChange", value);
9296
formData.chains = value.map((namespace) => chainConfigs[namespace as ChainNamespaceType][0]);
97+
formData.defaultChainId = formData.chains[0];
9398
formData.connectors = [];
9499
};
95100
</script>
@@ -155,6 +160,14 @@ const onChainNamespaceChange = (value: string[]) => {
155160
:multiple="true"
156161
:options="chainOptions"
157162
/>
163+
<Select
164+
v-model="formData.defaultChainId"
165+
data-testid="selectDefaultChainId"
166+
:label="$t('app.defaultChainId')"
167+
:aria-label="$t('app.defaultChainId')"
168+
:placeholder="$t('app.defaultChainId')"
169+
:options="defaultChainOptions"
170+
/>
158171
<Select
159172
v-model="formData.connectors"
160173
data-testid="selectAdapters"

demo/vue-app-new/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export type FormData = {
102102
network: WEB3AUTH_NETWORK_TYPE;
103103
chainNamespaces: ChainNamespaceType[];
104104
chains: string[];
105+
defaultChainId: string;
105106
whiteLabel: {
106107
enable: boolean;
107108
config: WhiteLabelData;

demo/vue-app-new/src/store/form.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const formDataStore = reactive<FormData>({
99
network: WEB3AUTH_NETWORK.TESTNET,
1010
chainNamespaces: [CHAIN_NAMESPACES.EIP155],
1111
chains: [chainConfigs[CHAIN_NAMESPACES.EIP155][0], chainConfigs[CHAIN_NAMESPACES.EIP155][1]],
12+
defaultChainId: chainConfigs[CHAIN_NAMESPACES.EIP155][0],
1213
whiteLabel: {
1314
enable: false,
1415
config: initWhiteLabel,

demo/vue-app-new/src/translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"documentation": "Documentation",
77
"network": "Network",
88
"chains": "Chains",
9+
"defaultChainId": "Default Chain ID",
910
"loginProviders": "Login provider",
1011
"adapters": "Adapters",
1112
"showWalletDiscovery": "Show Wallet Discovery",

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "10.0.0-alpha.0",
2+
"version": "10.0.0-alpha.1",
33
"npmClient": "npm"
44
}

package-lock.json

Lines changed: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/modal/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3auth/modal",
3-
"version": "10.0.0-alpha.0",
3+
"version": "10.0.0-alpha.1",
44
"description": "Multi chain wallet aggregator for web3Auth",
55
"keywords": [
66
"web3Auth/ui",
@@ -74,7 +74,7 @@
7474
"dependencies": {
7575
"@toruslabs/http-helpers": "^7.0.0",
7676
"@web3auth/auth": "^9.6.4",
77-
"@web3auth/no-modal": "^10.0.0-alpha.0",
77+
"@web3auth/no-modal": "^10.0.0-alpha.1",
7878
"bowser": "^2.11.0",
7979
"classnames": "^2.5.1",
8080
"copy-to-clipboard": "^3.3.3",

packages/modal/src/modalManager.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
6363

6464
public async initModal(params?: ModalConfigParams): Promise<void> {
6565
super.checkInitRequirements();
66-
66+
super.initCachedConnectorAndChainId();
6767
// get project config and wallet registry
6868
const { projectConfig, walletRegistry } = await this.getProjectAndWalletConfig(params);
6969
this.options.uiConfig = deepmerge(cloneDeep(projectConfig.whitelabel || {}), this.options.uiConfig || {});
@@ -81,10 +81,12 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
8181
await this.loginModal.initModal();
8282

8383
// setup common JRPC provider
84-
await this.setupCommonJRPCProvider(projectConfig);
84+
await this.setupCommonJRPCProvider();
8585

8686
// initialize connectors
87-
this.on(CONNECTOR_EVENTS.CONNECTORS_UPDATED, ({ connectors }) => this.initConnectors({ connectors, projectConfig, modalConfig: params }));
87+
this.on(CONNECTOR_EVENTS.CONNECTORS_UPDATED, ({ connectors: newConnectors }) =>
88+
this.initConnectors({ connectors: newConnectors, projectConfig, modalConfig: params })
89+
);
8890
await this.loadConnectors({ projectConfig });
8991

9092
// initialize plugins
@@ -172,6 +174,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
172174
// update auth connector config
173175
const { sms_otp_enabled: smsOtpEnabled } = projectConfig;
174176
if (smsOtpEnabled !== undefined) {
177+
// TODO: use the new login config method
175178
const connectorConfig: Record<WALLET_CONNECTOR_TYPE, ModalConfig> = {
176179
[WALLET_CONNECTORS.AUTH]: {
177180
label: WALLET_CONNECTORS.AUTH,

packages/no-modal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3auth/no-modal",
3-
"version": "10.0.0-alpha.0",
3+
"version": "10.0.0-alpha.1",
44
"description": "Multi chain wallet aggregator for web3Auth",
55
"keywords": [
66
"web3Auth/no-modal",

0 commit comments

Comments
 (0)