Skip to content

Commit

Permalink
Merge branch 'master' into uma-add-safe-transaction-file-import-to-os…
Browse files Browse the repository at this point in the history
…nap-plugin
  • Loading branch information
ChaituVR authored Apr 11, 2024
2 parents 9bbcc39 + d85e979 commit 13fc41a
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/components/ModalPostVote.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script setup lang="ts">
import { getChoiceString } from '@/helpers/utils';
import { ExtendedSpace, Proposal } from '@/helpers/interfaces';
import { getSafeAppLink } from '@/plugins/oSnap/utils';
const { shareVote, shareProposalX, shareProposalHey } = useSharing();
const { web3Account } = useWeb3();
const { web3, web3Account } = useWeb3();
const { userState, loadEmailSubscriptions, initialized } =
useEmailSubscription();
Expand Down Expand Up @@ -100,10 +101,13 @@ onMounted(() => {
<i-ho-mail class="text-skin-link" />
{{ $t('proposal.postVoteModal.subscribe') }}
</TuneButton>

<div v-if="props.waitingForSigners">
<BaseLink
:link="`https://gnosis-safe.io/app/eth:${web3Account}/transactions/queue`"
:link="
getSafeAppLink(web3.network.chainId, web3Account, {
path: 'transactions/queue'
})
"
hide-external-icon
>
<TuneButton tabindex="-1" class="w-full">
Expand Down
6 changes: 6 additions & 0 deletions src/locales/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,12 @@
"title": "Track proposals for {spaceName}",
"text": "Receive notifications every time a {space} proposal is created or ends"
},
"domino": {
"title": "Automations",
"information": "Create automated workflows with just a single click using Domino.",
"viewMore": "View More",
"createCustomWorkflow": "Create custom workflow"
},
"timeUnits": {
"second": "1 second | {n} seconds",
"minute": "1 minute | {n} minutes",
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/domino/ProposalSidebar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup>
import DominoCustomBlock from './components/CustomBlock.vue';
defineProps({
space: Object
});
</script>

<template>
<DominoCustomBlock v-if="space.plugins.domino" :space="space" />
</template>
105 changes: 105 additions & 0 deletions src/plugins/domino/components/CustomBlock.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<script setup>
const props = defineProps({
space: Object
});
const timezone = Intl.DateTimeFormat()?.resolvedOptions()?.timeZone ?? 'UTC';
const automationTemplates = computed(() => [
{
name: 'Send Discord Alert 48h Before Proposal End',
imageUrl: 'https://domino-static.s3.eu-west-3.amazonaws.com/discord-logo.svg',
url: `https://domino.run/explore/templates/32?spaceId=${encodeURIComponent(props.space.id)}`
},
{
name: 'Send Telegram Alert 24h Before Proposal End If Quorum Not Reached',
imageUrl: 'https://telegram.org/img/apple-touch-icon.png',
url: `https://domino.run/explore/templates/36?spaceId=${encodeURIComponent(props.space.id)}`
},
{
name: 'Send New Proposals to Discord',
imageUrl: 'https://domino-static.s3.eu-west-3.amazonaws.com/discord-logo.svg',
url: `https://domino.run/explore/templates/28?snapshotSpaceID=${encodeURIComponent(props.space.id)}&timezone=${encodeURIComponent(timezone)}`
},
{
name: 'Send New Proposals to Telegram',
imageUrl: 'https://telegram.org/img/apple-touch-icon.png',
url: `https://domino.run/explore/templates/29?snapshotSpaceID=${encodeURIComponent(props.space.id)}&timezone=${encodeURIComponent(timezone)}`
},
{
name: 'Send New Proposals to Slack',
imageUrl: 'https://domino-static.s3.eu-west-3.amazonaws.com/slack-logo.png',
url: `https://domino.run/explore/templates/30?snapshotSpaceID=${encodeURIComponent(props.space.id)}&timezone=${encodeURIComponent(timezone)}`
},
]);
const customWorkflowUrl = computed(() => {
const triggerConfig = {
conditions: [
{
"operator": "and",
"conditions": [
{
"key": "space",
"type": "string",
"value": {
"comparator": "eq",
"value": props.space.id
}
}
]
}
]
};
return `https://domino.run/automations/create?triggerUuid=${encodeURIComponent('[email protected]/proposal-event')}&triggerConfig=${encodeURIComponent(JSON.stringify(triggerConfig))}`;
});
</script>
<template>
<TuneBlock>
<template #header>
<TuneBlockHeader :title="$t('domino.title')" :information="$t('domino.information')"/>
</template>
<div>
<ul class="space-y-2">
<li v-for="(item, index) in automationTemplates" :key="index" class="flex items-center justify-between gap-4 group">
<a :href="`${item.url}`" target="_blank" class="flex items-center gap-2">
<img
class="mx-auto rounded-xl border border-skin-border opacity-95 group-hover:opacity-100"
:src="item.imageUrl"
:alt="item.name"
width="36"
height="36"
/>
<div class="text-sm leading-tight group-hover:text-gray-800">{{ item.name }}</div>
</a>
</li>
<li class="text-center">
<a href="https://domino.run/explore/apps/snapshot-tmkg6ni3l3r" target="_blank">
<div class="text-sm leading-tight group-hover:text-gray-800 text-skin-link">
{{ $t('domino.viewMore') }}
</div>
</a>
</li>
</ul>
<div class="py-3 text-center">
<a :href="customWorkflowUrl" target="_blank">
<TuneButton>{{ $t('domino.createCustomWorkflow') }}</TuneButton>
</a>
</div>
</div>
<div class="flex items-center justify-center pt-2">
<a href="https://domino.run/" target="_blank">
<img class="block flex-0 h-4" src="https://domino-static.s3.eu-west-3.amazonaws.com/domino-logo-full.png" alt="Domino" />
</a>
</div>
</TuneBlock>
</template>
8 changes: 8 additions & 0 deletions src/plugins/domino/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Domino",
"version": "1.0.0",
"author": "domino.run",
"website": "https://github.com/snapshot-labs/snapshot/tree/master/src/plugins/domino",
"icon": "ipfs://QmePXkJYHhkSMXi7qpvShtNg8Vhd5kVDYQNcPjAcZv3QdG"
}

5 changes: 3 additions & 2 deletions src/plugins/oSnap/utils/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
} from '../types';
import { getPagedEvents } from './events';
import { toChecksumAddress } from '@/helpers/utils';
import app from '../../../main';

/**
* Calls the Gnosis Safe Transaction API
Expand Down Expand Up @@ -745,10 +746,10 @@ export function getSafeNetworkPrefix(network: Network): SafeNetworkPrefix {
export function getSafeAppLink(
network: Network,
safeAddress: string,
appUrl = 'https://gnosis-safe.io/app/'
{appUrl = 'https://app.safe.global', path = '/home' } = {appUrl: 'https://app.safe.global', path: '/home'}
) {
const prefix = getSafeNetworkPrefix(network);
return `${appUrl}${prefix}:${safeAddress}`;
return new URL(`${path}?safe=${prefix}:${safeAddress}`, appUrl).toString();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/safeSnap/components/SafeTransactions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Plugin, {
getGnosisSafeBalances,
getGnosisSafeCollectibles
} from '../index';
import { getSafeAppLink } from '@/plugins/oSnap/utils';
const plugin = new Plugin();
Expand Down Expand Up @@ -210,8 +211,7 @@ export default {
},
computed: {
safeLink() {
const prefix = EIP3770_PREFIXES[this.network];
return `https://gnosis-safe.io/app/${prefix}:${this.gnosisSafeAddress}`;
return getSafeAppLink(this.network, this.gnosisSafeAddress);
},
networkName() {
if (this.network === '1') return 'Mainnet';
Expand Down

0 comments on commit 13fc41a

Please sign in to comment.