diff --git a/src/components/SettingsVotingBlock.vue b/src/components/SettingsVotingBlock.vue
index a1ffc43f075..40209d32e87 100644
--- a/src/components/SettingsVotingBlock.vue
+++ b/src/components/SettingsVotingBlock.vue
@@ -103,6 +103,17 @@ const votingPeriod = computed({
v-model="form.voting.hideAbstain"
:text-right="$t('settings.hideAbstain')"
/>
+
+
+
+
diff --git a/src/composables/useClient.ts b/src/composables/useClient.ts
index 00d47a74de3..a4dd163cef5 100644
--- a/src/composables/useClient.ts
+++ b/src/composables/useClient.ts
@@ -5,6 +5,7 @@ import clientGnosisSafe from '@/helpers/clientGnosisSafe';
import clientEIP712 from '@/helpers/clientEIP712';
import { useWeb3 } from '@/composables/useWeb3';
import { useFlashNotification } from '@/composables/useFlashNotification';
+import { useAliasAction } from '@/composables/useAliasAction';
import { getInstance } from '@snapshot-labs/lock/plugins/vue3';
export function useClient() {
@@ -12,6 +13,7 @@ export function useClient() {
const { web3 } = useWeb3();
const auth = getInstance();
const { notify } = useFlashNotification();
+ const { setAlias, aliasWallet, isValidAlias, checkAlias } = useAliasAction();
const isSending = ref(false);
@@ -55,43 +57,65 @@ export function useClient() {
}
async function sendEIP712(space, type, payload) {
- if (type === 'proposal') {
- let plugins = {};
- if (Object.keys(payload.metadata?.plugins).length !== 0)
- plugins = payload.metadata.plugins;
- return clientEIP712.proposal(auth.web3, web3.value.account, {
- space: space.id,
- type: payload.type,
- title: payload.name,
- body: payload.body,
- discussion: payload.discussion,
- choices: payload.choices,
- start: payload.start,
- end: payload.end,
- snapshot: payload.snapshot,
- plugins: JSON.stringify(plugins),
- app: 'snapshot'
- });
- } else if (type === 'vote') {
- return clientEIP712.vote(auth.web3, web3.value.account, {
- space: space.id,
- proposal: payload.proposal.id,
- type: payload.proposal.type,
- choice: payload.choice,
- privacy: payload.privacy,
- app: 'snapshot',
- reason: payload.reason
- });
- } else if (type === 'delete-proposal') {
- return clientEIP712.cancelProposal(auth.web3, web3.value.account, {
- space: space.id,
- proposal: payload.proposal.id
- });
- } else if (type === 'settings') {
- return clientEIP712.space(auth.web3, web3.value.account, {
- space: space.id,
- settings: JSON.stringify(payload)
- });
+ const aliased = space.voting?.aliased;
+ try {
+ if (aliased) {
+ await checkAlias();
+ if (!aliasWallet.value || !isValidAlias.value) await setAlias();
+ }
+
+ const [provider, address] = aliased
+ ? [aliasWallet.value, aliasWallet.value.address]
+ : [auth.web3, web3.value.account];
+
+ if (type === 'proposal') {
+ let plugins = {};
+ if (Object.keys(payload.metadata?.plugins).length !== 0)
+ plugins = payload.metadata.plugins;
+ return clientEIP712.proposal(provider, address, {
+ from: web3.value.account,
+ space: space.id,
+ type: payload.type,
+ title: payload.name,
+ body: payload.body,
+ discussion: payload.discussion,
+ choices: payload.choices,
+ start: payload.start,
+ end: payload.end,
+ snapshot: payload.snapshot,
+ plugins: JSON.stringify(plugins),
+ app: 'snapshot'
+ });
+ } else if (type === 'vote') {
+ return clientEIP712.vote(provider, address, {
+ from: web3.value.account,
+ space: space.id,
+ proposal: payload.proposal.id,
+ type: payload.proposal.type,
+ choice: payload.choice,
+ privacy: payload.privacy,
+ app: 'snapshot',
+ reason: payload.reason
+ });
+ } else if (type === 'delete-proposal') {
+ return clientEIP712.cancelProposal(provider, address, {
+ from: web3.value.account,
+ space: space.id,
+ proposal: payload.proposal.id
+ });
+ } else if (type === 'settings') {
+ return clientEIP712.space(auth.web3, web3.value.account, {
+ space: space.id,
+ settings: JSON.stringify(payload)
+ });
+ }
+ } catch (e: any) {
+ const errorMessage =
+ e?.error_description && typeof e.error_description === 'string'
+ ? `Oops, ${e.error_description}`
+ : t('notify.somethingWentWrong');
+ notify(['red', errorMessage]);
+ return e;
}
}
diff --git a/src/composables/useSpaceForm.ts b/src/composables/useSpaceForm.ts
index 08dc5353f86..dff102fce48 100644
--- a/src/composables/useSpaceForm.ts
+++ b/src/composables/useSpaceForm.ts
@@ -25,7 +25,8 @@ const EMPTY_SPACE_FORM = {
period: 0,
quorum: 0,
type: '',
- privacy: ''
+ privacy: '',
+ aliased: false
},
validation: BASIC_VALIDATION,
name: '',
diff --git a/src/helpers/interfaces.ts b/src/helpers/interfaces.ts
index ef518efae90..f3cf24fe56b 100644
--- a/src/helpers/interfaces.ts
+++ b/src/helpers/interfaces.ts
@@ -116,6 +116,7 @@ export interface ExtendedSpace {
quorum: number | null;
type: string | null;
privacy: string | null;
+ aliased: boolean;
};
}
diff --git a/src/helpers/queries.ts b/src/helpers/queries.ts
index f99d02663fb..fa71519ed5f 100644
--- a/src/helpers/queries.ts
+++ b/src/helpers/queries.ts
@@ -222,6 +222,7 @@ export const SPACES_QUERY = gql`
quorum
privacy
hideAbstain
+ aliased
}
strategies {
name
diff --git a/src/locales/default.json b/src/locales/default.json
index a6c86430375..b96f5646009 100644
--- a/src/locales/default.json
+++ b/src/locales/default.json
@@ -359,12 +359,14 @@
"information": "The minimum amount of voting power required to create a proposal"
},
"allowOnlyAuthors": "Allow only authors to submit a proposal",
+ "enableAliased": "Allow actions with session keys",
"editValidation": "Edit validation",
"selectValidation": "Select validation",
"validationParameters": "Validation parameters",
"voting": "Voting",
"votingDelay": "Voting delay",
"votingPeriod": "Voting period",
+ "votingAliased": "Voting, creating and deleting proposals will no longer require the user to manually sign each time.",
"hours": "Hours",
"days": "Days",
"quorum": {