Skip to content

Commit

Permalink
hotfix: Publish button disabled because of snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
samuveth committed Jan 26, 2023
1 parent 3e21add commit ebcc444
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/SpaceCreateVoting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ onMounted(async () => {
form.value.start = Number((Date.now() / 1e3).toFixed());
// Initialize the proposal type if set in space
if (props.space?.voting?.type) form.value.type = props.space.voting.type;
getSnapshot(props.space.network);
form.value.snapshot = await getSnapshot(props.space.network);
});
</script>

Expand Down
5 changes: 3 additions & 2 deletions src/composables/useSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ const isLoading = ref(false);
const error = ref(false);

export function useSnapshot() {
async function getSnapshot(network: string) {
async function getSnapshot(network: string): Promise<number> {
try {
isLoading.value = true;
error.value = false;
const currentBlock = await getBlockNumber(getProvider(network));
console.log('Snapshot block number', currentBlock);
isLoading.value = false;
return currentBlock - 4;
} catch (e) {
error.value = true;
return 0;
} finally {
isLoading.value = false;
}
}
Expand Down

0 comments on commit ebcc444

Please sign in to comment.