Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into temp
Browse files Browse the repository at this point in the history
  • Loading branch information
daywiss committed Nov 21, 2023
2 parents 2fae6d7 + 9d59703 commit 583b1bc
Show file tree
Hide file tree
Showing 51 changed files with 1,013 additions and 864 deletions.
5 changes: 3 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
VITE_HUB_URL=https://testnet.snapshot.org
VITE_RELAYER_URL=https://testnet.snapshot.org
VITE_HUB_URL=https://testnet.hub.snapshot.org
VITE_RELAYER_URL=https://testnet.hub.snapshot.org
VITE_SCORES_URL=https://score.snapshot.org
VITE_ENVELOP_URL=https://core.envelop.fyi
VITE_SIDEKICK_URL=https://sh5.co
VITE_BROVIDER_URL=https://rpc.snapshot.org
VITE_STAMP_URL=https://stamp.fyi
VITE_IPFS_GATEWAY=snapshot.mypinata.cloud
VITE_DEFAULT_NETWORK=1
VITE_PUSHER_BEAMS_INSTANCE_ID=2e080021-d495-456d-b2cf-84f9fd718442
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
'plugin:vue/vue3-recommended',
'eslint:recommended',
'@vue/eslint-config-typescript/recommended',
'@vue/eslint-config-prettier/skip-formatting',
'@vue/eslint-config-prettier',
'.eslintrc-auto-import.json'
],
ignorePatterns: ['/node_modules/**/*.*'],
Expand Down
6 changes: 0 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "@snapshot-labs/*"
- package-ecosystem: "npm"
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ yarn run lint

Use `http://localhost:8080/#/fabien.eth` for testing your code.

By default your instance will connect to the hub at `https://testnet.snapshot.org`. To change that (or other values) you can create a `.env.local` and overwrite the values from `.env`.
By default your instance will connect to the hub at `https://testnet.hub.snapshot.org`. To change that (or other values) you can create a `.env.local` and overwrite the values from `.env`.

## Running service locally with Docker
1. Run `docker build -t snapshot .` to build the image
Expand Down
51 changes: 25 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test:unit:coverage": "vitest run --coverage"
},
"dependencies": {
"@adraffy/ens-normalize": "^1.9.4",
"@apollo/client": "^3.8.3",
"@adraffy/ens-normalize": "^1.10.0",
"@apollo/client": "^3.8.7",
"@braintree/sanitize-url": "^6.0.4",
"@ensdomains/eth-ens-namehash": "^2.0.15",
"@ethersproject/abi": "^5.7.0",
Expand All @@ -30,37 +30,37 @@
"@ethersproject/strings": "^5.7.0",
"@ethersproject/units": "^5.7.0",
"@ethersproject/wallet": "^5.7.0",
"@headlessui-float/vue": "^0.11.3",
"@headlessui/vue": "^1.7.13",
"@headlessui-float/vue": "^0.12.0",
"@headlessui/vue": "^1.7.16",
"@pusher/push-notifications-web": "^1.1.0",
"@sentry/vite-plugin": "^2.5.0",
"@sentry/vue": "^7.55.2",
"@shutter-network/shutter-crypto": "0.1.0-beta.3",
"@snapshot-labs/lock": "^0.2.0",
"@sentry/vite-plugin": "^2.10.1",
"@sentry/vue": "^7.80.1",
"@shutter-network/shutter-crypto": "1.0.1",
"@snapshot-labs/lock": "^0.2.1",
"@snapshot-labs/pineapple": "^1.1.0",
"@snapshot-labs/snapshot.js": "^0.8.3",
"@snapshot-labs/snapshot.js": "^0.9.2",
"@snapshot-labs/tune": "^0.1.34",
"@vue/apollo-composable": "4.0.0-beta.4",
"@vueuse/core": "^10.4.0",
"@vueuse/head": "^1.3.1",
"@vue/apollo-composable": "4.0.0-beta.11",
"@vueuse/core": "^10.6.1",
"@vueuse/head": "^2.0.0",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"autolinker": "^4.0.0",
"bluebird": "^3.7.2",
"graphql": "^16.6.0",
"graphql": "16.6.0",
"graphql-tag": "^2.12.6",
"js-sha256": "^0.9.0",
"js-sha256": "^0.10.1",
"jsonexport": "^3.2.0",
"lodash": "^4.17.21",
"mixpanel-browser": "^2.47.0",
"readable-stream": "3.6.0",
"mixpanel-browser": "^2.48.1",
"remarkable": "^2.0.1",
"remove-markdown": "^0.5.0",
"typescript": "^5.0.4",
"typescript": "^5.2.2",
"v-viewer": "^3.0.11",
"vue": "^3.3.4",
"vue-i18n": "^9.2.2",
"vue-router": "^4.1.6",
"vite-compatible-readable-stream": "^3.6.1",
"vue": "^3.3.8",
"vue-i18n": "^9.7.0",
"vue-router": "^4.2.5",
"vue-tippy": "^6.3.1",
"vuedraggable": "^4.0.2"
},
Expand All @@ -76,27 +76,26 @@
"@vitejs/plugin-vue": "^2.3.4",
"@vitest/coverage-v8": "^0.34.5",
"@vitest/ui": "^0.33.0",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^9.0.0",
"@vue/test-utils": "^2.4.1",
"autoprefixer": "^10.4.15",
"env-cmd": "^10.1.0",
"eslint": "^8.46.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-vue": "^7.15.1",
"happy-dom": "^10.11.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"patch-package": "^7.0.0",
"postcss": "^8.4.28",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "0.4.1",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.7",
"rollup-plugin-visualizer": "^5.9.0",
"sass": "~1.62.1",
"sass-loader": "^13.2.2",
"start-server-and-test": "^2.0.0",
"tailwindcss": "^3.3.3",
"tailwindcss": "^3.3.5",
"unplugin-auto-import": "^0.16.1",
"unplugin-icons": "^0.16.5",
"unplugin-vue-components": "^0.25.2",
Expand Down
15 changes: 0 additions & 15 deletions patches/readable-stream+3.6.0.patch

This file was deleted.

2 changes: 1 addition & 1 deletion snapshot-spaces
5 changes: 2 additions & 3 deletions src/components/AvatarToken.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ withDefaults(
}"
alt="Token logo"
@error="
(
$event.target as HTMLImageElement
).src = `https://cdn.stamp.fyi/token/eth:${address}?s=100`
($event.target as HTMLImageElement).src =
`https://cdn.stamp.fyi/token/eth:${address}?s=100`
"
/>
</template>
4 changes: 2 additions & 2 deletions src/components/ButtonFollow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ watch(
loadingFollow !== ''
? null
: canFollow
? clickFollow(space.id)
: (modalTermsOpen = true)
? clickFollow(space.id)
: (modalTermsOpen = true)
"
>
<span v-if="!isFollowing"> {{ $t('join') }} </span>
Expand Down
43 changes: 43 additions & 0 deletions src/components/MessageWarningHibernated.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<script setup lang="ts">
import { ExtendedSpace } from '@/helpers/interfaces';
const props = defineProps<{
space: ExtendedSpace;
}>();
const { web3Account } = useWeb3();
const { loadSpaceController, isSpaceController } = useSpaceController();
const isAuthorized = computed(() => {
const admins = (props.space.admins || []).map(admin => admin.toLowerCase());
return (
admins.includes(web3Account.value?.toLowerCase()) || isSpaceController.value
);
});
onMounted(async () => {
await loadSpaceController();
});
</script>

<template>
<BaseMessageBlock v-if="space.hibernated" level="warning-red" is-responsive>
{{
isAuthorized
? $t('create.errorSpaceHibernatedAdmin')
: $t('create.errorSpaceHibernatedUsers')
}}
<BaseLink
v-if="isAuthorized"
link="https://docs.snapshot.org/user-guides/spaces/space-hibernation"
>
{{ $t('learnMore') }}
</BaseLink>

<p v-if="isAuthorized" class="mt-3">
<router-link :to="{ name: 'spaceSettings' }">
<BaseButton> Go to Settings </BaseButton>
</router-link>
</p>
</BaseMessageBlock>
</template>
17 changes: 12 additions & 5 deletions src/components/MessageWarningValidation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ const tPath = computed(() => {
</template>

<template v-else-if="validationName === 'passport-gated'">
<template v-if="validationName === 'passport-gated'">
{{
$t(`${tPath}.passport-gated.invalidMessage`, {
scoreThreshold: validationParams?.scoreThreshold || 0
})
}}<span v-if="props.validationParams?.operator === 'NONE'">. </span>

<template v-else>
{{
$t(`${tPath}.passport-gated.invalidMessage`, {
operator: validationParams?.operator === 'AND' ? 'all' : 'one',
stamps: validationParams?.stamps.join(', '),
scoreThreshold: validationParams?.scoreThreshold || 0
$t(`${tPath}.passport-gated.invalidMessageStamps`, {
operator:
props.validationParams?.operator === 'AND' ? 'all' : 'one',
stamps:
validationParams.stamps && validationParams.stamps.join(', ')
})
}}
</template>
Expand Down
36 changes: 30 additions & 6 deletions src/components/ModalValidation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const props = defineProps<{
const DEFAULT_PARAMS: Record<string, any> = {};
const emit = defineEmits(['add', 'close']);
const emit = defineEmits(['add', 'close', 'resetMinScore']);
const { open } = toRefs(props);
const { t } = useI18n();
Expand Down Expand Up @@ -41,12 +41,23 @@ type Validations = Record<
>;
const validationDefinition = computed(() => {
return (
const definition =
validations.value?.[input.value.name]?.schema?.definitions?.Validation ||
null
);
null;
if (input.value.name === 'passport-gated')
return definePassportGated(clone(definition));
return definition;
});
function definePassportGated(definition: any) {
if (input.value.params.operator === 'NONE')
delete definition.properties.stamps;
return definition;
}
const validationErrors = computed(() => {
return validateForm(validationDefinition.value || {}, input.value.params);
});
Expand All @@ -64,6 +75,7 @@ function handleSelect(n: string) {
if (n === 'any') {
handleSubmit();
emit('resetMinScore');
}
if (n === 'basic') {
Expand All @@ -75,12 +87,14 @@ function handleSelect(n: string) {
}
}
if (n === 'passport-gated' && !input.value.params.operator) {
input.value.params.operator = 'OR';
if (n === 'passport-gated') {
if (!input.value.params.operator) input.value.params.operator = 'NONE';
}
}
function handleSubmit() {
if (input.value.name === 'passport-gated') handlePassportGated();
if (!isValid.value || !isValidParams.value) {
strategiesFormRef.value?.forceShowError();
formRef?.value?.forceShowError();
Expand All @@ -91,6 +105,16 @@ function handleSubmit() {
emit('close');
}
function handlePassportGated() {
if (!input.value.params.stamps?.[0]) {
input.value.params.stamps = undefined;
input.value.params.operator = 'NONE';
}
if (input.value.params.operator === 'NONE') {
input.value.params.stamps = undefined;
}
}
function removeVoteValidationOnly(validations: Validations) {
Object.keys(validations).forEach(key => {
if (validations[key]?.voteValidationOnly) {
Expand Down
33 changes: 28 additions & 5 deletions src/components/ModalVoteValidation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,23 @@ const isValidationsLoaded = ref(false);
const updateIndex = ref(0);
const validationDefinition = computed(() => {
return (
const definition =
validations.value?.[input.value.name]?.schema?.definitions?.Validation ||
null
);
null;
if (input.value.name === 'passport-gated')
return definePassportGated(clone(definition));
return definition;
});
function definePassportGated(definition: any) {
if (input.value.params.operator === 'NONE')
delete definition.properties.stamps;
return definition;
}
const validationErrors = computed(() => {
return validateForm(validationDefinition.value || {}, input.value.params);
});
Expand All @@ -73,12 +84,14 @@ function select(n: string) {
}
}
if (n === 'passport-gated' && !input.value.params.operator) {
input.value.params.operator = 'OR';
if (n === 'passport-gated') {
if (!input.value.params.operator) input.value.params.operator = 'NONE';
}
}
function handleSubmit() {
if (input.value.name === 'passport-gated') handlePassportGatedNoneOperator();
if (!isValid.value || !isValidParams.value) {
strategiesFormRef.value?.forceShowError();
formRef?.value?.forceShowError();
Expand All @@ -89,6 +102,16 @@ function handleSubmit() {
emit('close');
}
function handlePassportGatedNoneOperator() {
if (!input.value.params.stamps?.[0]) {
input.value.params.stamps = undefined;
input.value.params.operator = 'NONE';
}
if (input.value.params.operator === 'NONE') {
input.value.params.stamps = undefined;
}
}
function removeProposalValidationOnly(validations: Validations) {
Object.keys(validations).forEach(key => {
if (validations[key]?.proposalValidationOnly) {
Expand Down
Loading

0 comments on commit 583b1bc

Please sign in to comment.