Skip to content

Commit 29e714e

Browse files
allow config confirmation strategy
1 parent 09f5175 commit 29e714e

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const externalAdapters = ref<IAdapter<unknown>[]>([]);
3636
3737
const walletPlugins = computed(() => {
3838
if (formData.chainNamespace !== CHAIN_NAMESPACES.EIP155 || !formData.walletPlugin.enable) return [];
39-
const { logoDark, logoLight } = formData.walletPlugin;
39+
const { logoDark, logoLight, confirmationStrategy } = formData.walletPlugin;
4040
const walletServicesPlugin = new WalletServicesPlugin({
4141
walletInitOptions: {
4242
whiteLabel: { showWidgetButton: true, logoDark: logoDark || "logo", logoLight: logoLight || "logo" },
@@ -46,6 +46,7 @@ const walletPlugins = computed(() => {
4646
logLevel: "debug",
4747
},
4848
},
49+
confirmationStrategy,
4950
},
5051
});
5152
return [walletServicesPlugin];

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ import { ADAPTER_STATUS, CHAIN_NAMESPACES, ChainNamespaceType, log } from "@web3
44
import { useWeb3Auth } from "@web3auth/modal-vue-composables";
55
import { computed, InputHTMLAttributes, ref } from "vue";
66
7-
import { chainConfigs, chainNamespaceOptions, languageOptions, loginProviderOptions, networkOptions, SmartAccountOptions } from "../config";
7+
import {
8+
chainConfigs,
9+
chainNamespaceOptions,
10+
confirmationStrategyOptions,
11+
languageOptions,
12+
loginProviderOptions,
13+
networkOptions,
14+
SmartAccountOptions,
15+
} from "../config";
816
import { formDataStore } from "../store/form";
917
1018
const formData = formDataStore;
@@ -350,6 +358,15 @@ const onChainNamespaceChange = (value: string) => {
350358
:placeholder="$t('app.walletPlugin.logoDark')"
351359
class="sm:col-span-2"
352360
/>
361+
<Select
362+
v-model="formData.walletPlugin.confirmationStrategy"
363+
data-testid="selectLoginProviders"
364+
:label="$t('app.walletPlugin.confirmationStrategy')"
365+
:aria-label="$t('app.walletPlugin.confirmationStrategy')"
366+
:placeholder="$t('app.walletPlugin.confirmationStrategy')"
367+
:options="confirmationStrategyOptions"
368+
class=""
369+
/>
353370
</Card>
354371
<Card v-if="isActiveTab(4)" class="grid grid-cols-1 gap-2 px-4 py-4" :shadow="false">
355372
<Toggle

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { LANGUAGE_TYPE, LANGUAGES, LOGIN_PROVIDER, LOGIN_PROVIDER_TYPE, WhiteLabelData } from "@web3auth/auth";
22
import { CHAIN_NAMESPACES, ChainNamespaceType, CustomChainConfig, WEB3AUTH_NETWORK, WEB3AUTH_NETWORK_TYPE } from "@web3auth/base";
33
import { SignTypedDataMessageV4 } from "@web3auth/ethereum-provider";
4+
import { CONFIRMATION_STRATEGY, CONFIRMATION_STRATEGY_TYPE } from "@web3auth/wallet-services-plugin";
45

56
import { FormConfigSettings } from "./interfaces";
67

@@ -184,6 +185,7 @@ export type FormData = {
184185
enable: boolean;
185186
logoDark: string;
186187
logoLight: string;
188+
confirmationStrategy: Exclude<CONFIRMATION_STRATEGY_TYPE, "popup">;
187189
};
188190
useAccountAbstractionProvider: boolean;
189191
useAAWithExternalWallet?: boolean;
@@ -240,3 +242,9 @@ export const getV4TypedData = (chainId: string): SignTypedDataMessageV4 => ({
240242
contents: "Hello, Bob!",
241243
},
242244
});
245+
246+
export const confirmationStrategyOptions: { name: string; value: string }[] = [
247+
{ name: "Modal", value: CONFIRMATION_STRATEGY.MODAL },
248+
{ name: "Auto Approve", value: CONFIRMATION_STRATEGY.AUTO_APPROVE },
249+
{ name: "Default", value: CONFIRMATION_STRATEGY.DEFAULT },
250+
];

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"walletPlugin": {
1515
"title": "Wallet Service Plugin",
1616
"logoLight": "Logo Light",
17-
"logoDark": "Logo Dark"
17+
"logoDark": "Logo Dark",
18+
"confirmationStrategy": "Confirmation Strategy"
1819
},
1920
"accountAbstractionProvider": {
2021
"title": "Account Abstraction Provider",
@@ -49,7 +50,6 @@
4950
"sessionTime": "Session Time"
5051
},
5152
"chainNamespace": "Chain namespace",
52-
5353
"w3aStatus": "Web3Auth status ::::: {status}",
5454
"isConnected": "Is connected ::::: {isConnected}",
5555
"isInitialized": "Is initialized ::::: {isInitialized}",

0 commit comments

Comments
 (0)