Skip to content

Commit 93f758d

Browse files
Merge branch 'master' into feat/sdk-v10-wallet-discovery
2 parents f77d6bd + b42d5af commit 93f758d

File tree

41 files changed

+213
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+213
-573
lines changed

demo/vue-app-new/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@web3auth/modal": "file:../../packages/modal",
2222
"@web3auth/no-modal": "file:../../packages/no-modal",
2323
"@web3auth/sign-in-with-ethereum": "^4.2.2",
24-
"@web3auth/ws-embed": "^4.0.7",
24+
"@web3auth/ws-embed": "^4.0.14",
2525
"bs58": "^6.0.0",
2626
"ethers": "^6.13.5",
2727
"petite-vue-i18n": "^11.1.2",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,11 @@ const options = computed((): Web3AuthOptions => {
9595
useAAWithExternalWallet: formData.useAAWithExternalWallet,
9696
// TODO: Add more options
9797
// enableLogging?: boolean;
98-
// storageKey?: "session" | "local";
98+
// storageType?: "session" | "local";
9999
// sessionTime?: number;
100100
// useCoreKitKey?: boolean;
101101
chains,
102+
defaultChainId: formData.defaultChainId,
102103
enableLogging: true,
103104
connectors: externalConnectors.value,
104105
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: 11 additions & 12 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
@@ -62,7 +62,7 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal {
6262

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

8282
// setup common JRPC provider
83-
await this.setupCommonJRPCProvider(projectConfig);
83+
await this.setupCommonJRPCProvider();
8484

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

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

0 commit comments

Comments
 (0)