Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@dimensiondev/holoflows-kit": "^0.9.0-20210902104757-7c3d0d0",
"@dimensiondev/mask-wallet-core": "0.1.0-20211013082857-eb62e5f",
"@dimensiondev/metamask-extension-provider": "3.0.6-20210519045409-1835d4d",
"@dimensiondev/snapshot.js": "0.2.0",
"@snapshot-labs/snapshot.js": "^0.3.31",
"@ethersproject/abi": "^5.4.0",
"@ethersproject/address": "^5.0.4",
"@ethersproject/providers": "^5.0.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export function usePower(identifier: ProposalIdentifier) {
const { value: blockNumber = 0 } = useBlockNumber()
return useAsyncRetry(async () => {
if (!account) return 0
if (!blockNumber) return 0
return (
await PluginSnapshotRPC.getScores(
proposal.snapshot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ async function Suspender(identifier: ProposalIdentifier) {
const { value: blockNumber = 0 } = useBlockNumber()
const { payload: proposal } = useProposal(identifier.id)

if (!blockNumber) return []

const voters = proposal.votes.map((v) => v.voter)
const scores = await PluginSnapshotRPC.getScores(
proposal.snapshot,
Expand Down
5 changes: 3 additions & 2 deletions packages/mask/src/plugins/Snapshot/Worker/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import ss from '@dimensiondev/snapshot.js'
import ss from '@snapshot-labs/snapshot.js'
import type { Proposal, Profile3Box, ProposalIdentifier, VoteSuccess, RawVote, Strategy } from '../../types'
import Services from '../../../../extension/service'
import { transform } from 'lodash-unified'
import { SNAPSHOT_GET_SCORE_API } from '../../constants'

export async function fetchProposal(id: string) {
const { votes, proposal } = await fetchProposalFromGraphql(id)
Expand Down Expand Up @@ -117,9 +118,9 @@ export async function getScores(
space,
strategies,
network,
provider,
voters,
blockTag,
SNAPSHOT_GET_SCORE_API,
)
return scores.map((score) =>
transform(score, function (result: { [key in string]: number }, val, key: string) {
Expand Down
1 change: 1 addition & 0 deletions packages/mask/src/plugins/Snapshot/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export const SNAPSHOT_PLUGIN_NAME = 'Snapshot'
export const SNAPSHOT_PLUGIN_ID = 'org.snapshot'
export const SNAPSHOT_GET_SCORE_API = 'https://score.snapshot.org/api/scores'
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import { styled, ListItemButton, Typography, ListItemIcon, useMediaQuery } from

const mindsBreakPoint = 1221 /** px */

const Container = styled('div')``
const Container = styled('div')`
height: 45px;
margin-bottom: 10px;
`
const Item = styled(ListItemButton)`
border-radius: 8px;
height: 45px;
padding: 4px 12px 4px 0;
color: ${({ theme }) => (theme.palette.mode === 'dark' ? '#b8c1ca' : '#72727c')};
&:hover {
Expand All @@ -32,6 +36,7 @@ const Text = styled(Typography)`
const Icon = styled(ListItemIcon)`
color: inherit;
min-width: 48px;
margin-left: 6px;
@media screen and (max-width: ${mindsBreakPoint}px) {
min-width: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const postEditorInTimelineSelector: () => LiveSelector<E, true> = () =>
querySelector<E>('m-newsfeed m-composer', true)

export const toolBoxInSideBarSelector: () => LiveSelector<E, true> = () =>
querySelector<E>('.m-sidebarNavigation__list li:nth-child(11)')
querySelector<E>('.m-sidebarNavigation__list li:nth-child(7)')

export const postEditorDraftContentSelector = () => {
return querySelector<HTMLElement>('m-composer__modal m-composer__textarea textarea.m-composerTextarea__message')
Expand Down
Loading