Skip to content

Commit 5b421c0

Browse files
committed
fix: snapshot box proposal rendering
The Box API uses different request formats than snapshot.org hub. Key differences: 1. Proposal query expects combined ID: "space/proposal" (e.g., "0x07bd.../54") 2. Space query uses separate parameters: indexer="sn" and id=space_address 3. Votes query expects string proposal ID and space identifier with prefix Implementation: - Parse space identifier to extract indexer ("sn") and space address - Fetch space data using correct indexer/id parameters - Fetch proposal data using combined ID format - Map voting_power_validation_strategies_parsed_metadata from Space API - Preserve original space identifier for votes query - Add proper network, state, and default values for missing fields Fixes MF-6774
1 parent a91a7cf commit 5b421c0

File tree

2 files changed

+197
-125
lines changed

2 files changed

+197
-125
lines changed

packages/plugins/Snapshot/src/Worker/apis.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ChainId } from '@masknet/web3-shared-evm'
22
import { SNAPSHOT_RELAY_URL, SNAPSHOT_SEQ_URL } from '../constants.js'
33
import type { HubProposal, Proposal, RawVote, VoteResult } from '../types.js'
4-
import { formatBoxProposal, fetchProposalFromBoxApi, fetchVotesFromBox, formatBoxVote } from './box.js'
4+
import { fetchProposalFromBoxApi, fetchVotesFromBox, formatBoxVote } from './box.js'
55

66
export async function fetchProposal(id: string) {
77
const proposal = await fetchProposalFromGraphql(id)
@@ -82,8 +82,7 @@ async function fetchVotesFromGraphql(id: string, first: number, skip: number, sp
8282

8383
async function fetchProposalFromGraphql(id: string): Promise<HubProposal> {
8484
if (id.includes('/')) {
85-
const proposal = await fetchProposalFromBoxApi(id)
86-
return formatBoxProposal(proposal.proposal)
85+
return fetchProposalFromBoxApi(id)
8786
}
8887
const response = await fetch('https://hub.snapshot.org/graphql', {
8988
method: 'POST',

0 commit comments

Comments
 (0)