Skip to content

Commit 9e65ee5

Browse files
Merge pull request #2307 from Web3Auth/feat/connect-sign
feat: connect-sign
2 parents 713cf03 + fd53f35 commit 9e65ee5

File tree

98 files changed

+1051
-437
lines changed

Some content is hidden

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

98 files changed

+1051
-437
lines changed

demo/vue-app-new/package-lock.json

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

demo/vue-app-new/package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,47 @@
1111
},
1212
"dependencies": {
1313
"@solana/web3.js": "^1.98.4",
14-
"@tanstack/vue-query": "^5.90.2",
15-
"@toruslabs/base-controllers": "^8.7.0",
14+
"@tanstack/vue-query": "^5.92.1",
15+
"@toruslabs/base-controllers": "^8.10.0",
1616
"@toruslabs/bs58": "^1.0.0",
17-
"@toruslabs/ethereum-controllers": "^8.7.0",
18-
"@toruslabs/solana-controllers": "^8.7.0",
17+
"@toruslabs/ethereum-controllers": "^8.10.0",
18+
"@toruslabs/solana-controllers": "^8.10.0",
1919
"@toruslabs/tweetnacl-js": "^1.0.4",
2020
"@toruslabs/vue-components": "^8.1.2",
21-
"@toruslabs/vue-icons": "^8.0.2",
21+
"@toruslabs/vue-icons": "^8.0.4",
2222
"@wagmi/vue": "^0.2.11",
23-
"@web3auth/auth": "^10.5.0",
23+
"@web3auth/auth": "^10.8.0",
2424
"@web3auth/modal": "file:../../packages/modal",
2525
"@web3auth/no-modal": "file:../../packages/no-modal",
2626
"@web3auth/sign-in-with-ethereum": "^5.0.0",
27-
"@web3auth/ws-embed": "^5.1.0",
28-
"ethers": "^6.15.0",
29-
"petite-vue-i18n": "^11.1.12",
30-
"vue": "^3.5.22",
31-
"react": "^19.2.0",
32-
"react-dom": "^19.2.0"
27+
"@web3auth/ws-embed": "^5.3.0",
28+
"ethers": "^6.16.0",
29+
"petite-vue-i18n": "^11.2.2",
30+
"vue": "^3.5.25",
31+
"react": "^19.2.1",
32+
"react-dom": "^19.2.1"
3333
},
3434
"overrides": {
35-
"react": "^19.2.0",
36-
"react-dom": "^19.2.0",
35+
"react": "^19.2.1",
36+
"react-dom": "^19.2.1",
3737
"use-sync-external-store": "^1.4.0"
3838
},
3939
"devDependencies": {
4040
"@toruslabs/eslint-config-vue": "^4.1.5",
41-
"@vitejs/plugin-vue": "^6.0.1",
42-
"autoprefixer": "^10.4.21",
43-
"eslint": "^9.36.0",
44-
"globals": "^16.4.0",
41+
"@vitejs/plugin-vue": "^6.0.2",
42+
"autoprefixer": "^10.4.22",
43+
"eslint": "^9.39.1",
44+
"globals": "^16.5.0",
4545
"postcss": "^8.5.6",
46-
"prettier": "^3.6.2",
46+
"prettier": "^3.7.4",
4747
"stream-browserify": "^3.0.0",
4848
"tailwindcss": "^3.4.13",
4949
"typescript": "^5.9.3",
50-
"vite": "^7.1.7",
51-
"vue-tsc": "^3.1.0"
50+
"vite": "^7.2.6",
51+
"vue-tsc": "^3.1.5"
5252
},
5353
"optionalDependencies": {
54-
"@esbuild/linux-x64": "0.25.10"
54+
"@esbuild/linux-x64": "0.27.1"
5555
},
5656
"lint-staged": {
5757
"!(*d).{js,ts}": [

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const options = computed((): Web3AuthOptions => {
139139
connectors: modalParams.value,
140140
hideWalletDiscovery: !formData.showWalletDiscovery,
141141
},
142+
initialAuthenticationMode: formData.initialAuthenticationMode,
142143
};
143144
});
144145
@@ -210,6 +211,7 @@ onBeforeMount(() => {
210211
formData.smartAccountChains = json.smartAccountChains || [];
211212
formData.smartAccountChainsConfig = json.smartAccountChainsConfig || {};
212213
formData.defaultChainId = json.defaultChainId;
214+
formData.initialAuthenticationMode = json.initialAuthenticationMode;
213215
}
214216
} catch (error) {}
215217
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
useWeb3AuthUser,
1515
useSwitchChain as useWeb3AuthSwitchChain,
1616
} from "@web3auth/modal/vue";
17-
import { type CustomChainConfig, type NFTCheckoutPluginType } from "@web3auth/no-modal";
17+
import { CONNECTOR_INITIAL_AUTHENTICATION_MODE, type CustomChainConfig, type NFTCheckoutPluginType } from "@web3auth/no-modal";
1818
import { useI18n } from "petite-vue-i18n";
1919
2020
import { useSignAndSendTransaction, useSignMessage as useSolanaSignMessage, useSignTransaction, useSolanaWallet } from "@web3auth/modal/vue/solana";
@@ -40,7 +40,7 @@ const props = defineProps<{
4040
chains: CustomChainConfig[];
4141
}>();
4242
43-
const { isConnected, provider, web3Auth, isMFAEnabled } = useWeb3Auth();
43+
const { isConnected, provider, web3Auth, isMFAEnabled, isAuthorized } = useWeb3Auth();
4444
const { userInfo, loading: userInfoLoading } = useWeb3AuthUser();
4545
const { enableMFA } = useEnableMFA();
4646
const { manageMFA } = useManageMFA();
@@ -92,7 +92,7 @@ const isDisplay = (name: "dashboard" | "ethServices" | "solServices" | "walletSe
9292
const chainNamespace = currentChainNamespace.value;
9393
switch (name) {
9494
case "dashboard":
95-
return isConnected.value;
95+
return formData.initialAuthenticationMode === CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN ? isAuthorized.value : isConnected.value;
9696
9797
case "ethServices":
9898
return chainNamespace === CHAIN_NAMESPACES.EIP155;

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@ import { Button } from "@toruslabs/vue-components";
33
import { useWeb3Auth, useWeb3AuthDisconnect } from "@web3auth/modal/vue";
44
import { useI18n } from "petite-vue-i18n";
55
import { watch } from "vue";
6+
import { formDataStore } from "../store/form";
7+
import { CONNECTOR_INITIAL_AUTHENTICATION_MODE } from "@web3auth/no-modal";
68
79
const { log } = console;
810
const { t } = useI18n({ useScope: "global" });
911
10-
const { status, isConnected } = useWeb3Auth();
12+
const { status, isConnected, isAuthorized } = useWeb3Auth();
1113
const { disconnect } = useWeb3AuthDisconnect();
14+
const formData = formDataStore;
1215
1316
const isDisplay = (name: string): boolean => {
1417
switch (name) {
1518
case "btnLogout":
16-
return isConnected.value;
19+
return formData.initialAuthenticationMode === CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN ? isAuthorized.value : isConnected.value;
1720
1821
case "appHeading":
19-
return isConnected.value;
22+
return formData.initialAuthenticationMode === CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_AND_SIGN ? isAuthorized.value : isConnected.value;
2023
2124
default: {
2225
return false;

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { Button, Card, Select, Tab, Tabs, Tag, TextField, Toggle } from "@toruslabs/vue-components";
3-
import { CHAIN_NAMESPACES, ChainNamespaceType, CONNECTOR_STATUS, log } from "@web3auth/modal";
3+
import { CHAIN_NAMESPACES, ChainNamespaceType, CONNECTOR_INITIAL_AUTHENTICATION_MODE, CONNECTOR_STATUS, log } from "@web3auth/modal";
44
import { useWeb3Auth, useWeb3AuthConnect } from "@web3auth/modal/vue";
55
import { computed, InputHTMLAttributes, ref } from "vue";
66
import {
@@ -19,7 +19,7 @@ import { getChainConfig } from "../utils/chainconfig";
1919
2020
const formData = formDataStore;
2121
22-
const { status, isConnected, isInitialized } = useWeb3Auth();
22+
const { status, isConnected, isInitialized, isAuthorized } = useWeb3Auth();
2323
const { connect } = useWeb3AuthConnect();
2424
2525
const chainOptions = computed(() => {
@@ -58,7 +58,7 @@ const connectorOptions = computed(() =>
5858
);
5959
6060
const isDisplay = (_name: string): boolean => {
61-
return !isConnected.value;
61+
return formData.initialAuthenticationMode === CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_ONLY ? !isConnected.value : !isAuthorized.value;
6262
};
6363
6464
const isDisabled = (name: string): boolean => {
@@ -229,6 +229,18 @@ const onSmartAccountChainChange = (chainIds: string[]) => {
229229
matchParentsWidth
230230
:show-check-box="true"
231231
/>
232+
<Select
233+
v-model="formData.initialAuthenticationMode"
234+
data-testid="selectInitialAuthenticationMode"
235+
:label="$t('app.initialAuthenticationMode')"
236+
:aria-label="$t('app.initialAuthenticationMode')"
237+
:placeholder="$t('app.initialAuthenticationMode')"
238+
:options="[
239+
{ name: 'Connect Only', value: 'connect-only' },
240+
{ name: 'Connect and Sign', value: 'connect-and-sign' },
241+
]"
242+
matchParentsWidth
243+
/>
232244
<Toggle
233245
v-model="formData.showWalletDiscovery"
234246
data-testid="showWalletDiscovery"

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
ChainNamespaceType,
55
CONFIRMATION_STRATEGY,
66
type CONFIRMATION_STRATEGY_TYPE,
7+
type ConnectorInitialAuthenticationModeType,
78
LoginMethodConfig,
89
ModalConfig,
910
SignTypedDataMessageV4,
@@ -62,6 +63,7 @@ export const languageOptions: { name: string; value: LANGUAGE_TYPE }[] = [
6263
{ name: "Portuguese", value: LANGUAGES.pt },
6364
{ name: "Dutch", value: LANGUAGES.nl },
6465
{ name: "Turkish", value: LANGUAGES.tr },
66+
{ name: "Amharic", value: LANGUAGES.am },
6567
];
6668

6769
export const defaultLoginMethod: Record<AUTH_CONNECTION_TYPE, ModalConfig> = loginProviderOptions.reduce(
@@ -109,6 +111,7 @@ export type FormData = {
109111
config: WhiteLabelData;
110112
};
111113
connectors: string[];
114+
initialAuthenticationMode: ConnectorInitialAuthenticationModeType;
112115
loginProviders: AUTH_CONNECTION_TYPE[];
113116
showWalletDiscovery: boolean;
114117
multiInjectedProviderDiscovery: boolean;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { WEB3AUTH_NETWORK } from "@web3auth/auth";
2-
import { CHAIN_NAMESPACES, WIDGET_TYPE } from "@web3auth/modal";
2+
import { CHAIN_NAMESPACES, CONNECTOR_INITIAL_AUTHENTICATION_MODE, WIDGET_TYPE } from "@web3auth/modal";
33
import { reactive } from "vue";
44

55
import { chainConfigs, defaultLoginMethod, FormData, initWhiteLabel } from "../config";
66

77
export const formDataStore = reactive<FormData>({
88
// authMode: "",
99
connectors: [],
10+
initialAuthenticationMode: CONNECTOR_INITIAL_AUTHENTICATION_MODE.CONNECT_ONLY,
1011
network: process.env.NODE_ENV === "production" ? WEB3AUTH_NETWORK.SAPPHIRE_MAINNET : WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
1112
chainNamespaces: [CHAIN_NAMESPACES.EIP155, CHAIN_NAMESPACES.SOLANA],
1213
chains: [chainConfigs[CHAIN_NAMESPACES.EIP155][0], chainConfigs[CHAIN_NAMESPACES.SOLANA][0]],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"defaultChainId": "Default Chain ID",
1010
"loginProviders": "Login provider",
1111
"connectors": "Connectors",
12+
"initialAuthenticationMode": "Authentication Mode",
1213
"showWalletDiscovery": "Show Wallet Discovery",
1314
"multiInjectedProviderDiscovery": "Multi Injected Provider Discovery",
1415
"greeting": "Let's configure Web3Auth!",

0 commit comments

Comments
 (0)