@moonwell-fi/moonwell-sdk 0.20.3 → 0.20.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/_cjs/actions/governance/common.js +15 -2
- package/_cjs/actions/governance/common.js.map +1 -1
- package/_cjs/actions/governance/governor-api-client.js +3 -2
- package/_cjs/actions/governance/governor-api-client.js.map +1 -1
- package/_cjs/actions/governance/proposals/common.js +11 -296
- package/_cjs/actions/governance/proposals/common.js.map +1 -1
- package/_cjs/actions/governance/proposals/getProposal.js +9 -25
- package/_cjs/actions/governance/proposals/getProposal.js.map +1 -1
- package/_cjs/actions/governance/proposals/getProposals.js +23 -14
- package/_cjs/actions/governance/proposals/getProposals.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/types/proposal.js.map +1 -1
- package/_esm/actions/governance/common.js +29 -3
- package/_esm/actions/governance/common.js.map +1 -1
- package/_esm/actions/governance/governor-api-client.js +21 -4
- package/_esm/actions/governance/governor-api-client.js.map +1 -1
- package/_esm/actions/governance/ipfs.js +2 -2
- package/_esm/actions/governance/proposals/common.js +28 -302
- package/_esm/actions/governance/proposals/common.js.map +1 -1
- package/_esm/actions/governance/proposals/getProposal.js +23 -35
- package/_esm/actions/governance/proposals/getProposal.js.map +1 -1
- package/_esm/actions/governance/proposals/getProposals.js +48 -20
- package/_esm/actions/governance/proposals/getProposals.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/types/proposal.js.map +1 -1
- package/_types/actions/governance/common.d.ts.map +1 -1
- package/_types/actions/governance/getUserVoteReceipt.d.ts +4 -4
- package/_types/actions/governance/governor-api-client.d.ts +34 -4
- package/_types/actions/governance/governor-api-client.d.ts.map +1 -1
- package/_types/actions/governance/ipfs.d.ts +2 -2
- package/_types/actions/governance/proposals/common.d.ts +12 -39
- package/_types/actions/governance/proposals/common.d.ts.map +1 -1
- package/_types/actions/governance/proposals/getProposal.d.ts +2 -1
- package/_types/actions/governance/proposals/getProposal.d.ts.map +1 -1
- package/_types/actions/governance/proposals/getProposals.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/types/proposal.d.ts +11 -0
- package/_types/types/proposal.d.ts.map +1 -1
- package/actions/governance/common.ts +39 -3
- package/actions/governance/getUserVoteReceipt.ts +4 -4
- package/actions/governance/governor-api-client.ts +35 -4
- package/actions/governance/ipfs.ts +2 -2
- package/actions/governance/proposals/common.ts +28 -466
- package/actions/governance/proposals/getProposal.ts +25 -49
- package/actions/governance/proposals/getProposals.ts +57 -30
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/types/proposal.ts +11 -0
|
@@ -4,7 +4,7 @@ import * as logger from "../../../logger/console.js";
|
|
|
4
4
|
import { ProposalState } from "../../../types/proposal.js";
|
|
5
5
|
import { fetchAllProposals } from "../governor-api-client.js";
|
|
6
6
|
import { resolveIpfsDescriptions } from "../ipfs.js";
|
|
7
|
-
import {
|
|
7
|
+
import { formatApiProposalData, getProposalsOnChainData, readCrossChainQuorums, } from "./common.js";
|
|
8
8
|
export async function getProposals(client, args) {
|
|
9
9
|
const logId = logger.start("getProposals", "Starting to get proposals...");
|
|
10
10
|
const environments = getEnvironmentsFromArgs(client, args);
|
|
@@ -16,11 +16,11 @@ export async function getProposals(client, args) {
|
|
|
16
16
|
}
|
|
17
17
|
const allProposals = await Promise.all(governanceEnvironments.map(async (governanceEnvironment) => {
|
|
18
18
|
if (governanceEnvironment.chainId === moonbeam.id) {
|
|
19
|
-
// Moonbeam
|
|
19
|
+
// Moonbeam + Ethereum: Governor API (chainIds 1 and 1284)
|
|
20
20
|
return getMoonbeamProposals(governanceEnvironment);
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
// Moonriver:
|
|
23
|
+
// Moonriver: Governor API, single legacy governor (chainId 1285)
|
|
24
24
|
return getMoonriverProposals(governanceEnvironment);
|
|
25
25
|
}
|
|
26
26
|
}));
|
|
@@ -67,6 +67,44 @@ async function getMoonbeamProposals(governanceEnvironment) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
return buildProposals(apiProposals, governanceEnvironment);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Fetch proposals for Moonriver using the Governor API.
|
|
74
|
+
*
|
|
75
|
+
* Moonriver runs a single legacy standalone governor (no multichain governor),
|
|
76
|
+
* so we fetch only its chainId from the same lunar indexer and reuse the shared
|
|
77
|
+
* pipeline. `getProposalsOnChainData` classifies these as non-multichain and
|
|
78
|
+
* reads state/quorum from the legacy governor (via `getQuorum`).
|
|
79
|
+
*/
|
|
80
|
+
async function getMoonriverProposals(governanceEnvironment) {
|
|
81
|
+
// Moonriver is a single chain, so there's no other chain to "continue with"
|
|
82
|
+
// like the Moonbeam fan-out — but a bare throw would reject the whole
|
|
83
|
+
// `Promise.all` in getProposals and drop Moonbeam/Ethereum results too. Mirror
|
|
84
|
+
// the per-chain handling getMoonbeamProposals uses: report the outage via
|
|
85
|
+
// onError and degrade to an empty Moonriver list instead of rejecting.
|
|
86
|
+
let apiProposals = [];
|
|
87
|
+
try {
|
|
88
|
+
apiProposals = await fetchAllProposals(governanceEnvironment, {
|
|
89
|
+
chainId: moonriver.id,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch (reason) {
|
|
93
|
+
console.warn(`[getProposals] Failed to fetch proposals for chainId=${moonriver.id}; continuing with an empty Moonriver list.`, reason);
|
|
94
|
+
governanceEnvironment.onError?.(reason, {
|
|
95
|
+
source: "governance-proposals",
|
|
96
|
+
chainId: moonriver.id,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return buildProposals(apiProposals, governanceEnvironment);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Shared Governor-API pipeline: resolve IPFS descriptions + cross-chain quorums
|
|
103
|
+
* in parallel, read on-chain data, then map each ApiProposal to a Proposal.
|
|
104
|
+
* Used by both the Moonbeam/Ethereum and Moonriver paths so the mapping stays
|
|
105
|
+
* in one place.
|
|
106
|
+
*/
|
|
107
|
+
async function buildProposals(apiProposals, governanceEnvironment) {
|
|
70
108
|
// IPFS resolution and cross-chain quorum reads are independent — run them in
|
|
71
109
|
// parallel to save one network round-trip on the proposal list path.
|
|
72
110
|
const [, crossChainQuorums] = await Promise.all([
|
|
@@ -126,10 +164,16 @@ async function getMoonbeamProposals(governanceEnvironment) {
|
|
|
126
164
|
description: apiProposal.description,
|
|
127
165
|
targets: apiProposal.targets,
|
|
128
166
|
calldatas: apiProposal.calldatas,
|
|
129
|
-
|
|
167
|
+
// Legacy-governor proposals (Moonriver, early Moonbeam) carry the function
|
|
168
|
+
// signature separately from the selector-less calldata; pass it through so
|
|
169
|
+
// consumers can decode the call. Empty for multichain-governor proposals.
|
|
170
|
+
signatures: apiProposal.signatures ?? [],
|
|
130
171
|
stateChanges: formattedData.stateChanges,
|
|
131
172
|
environment: governanceEnvironment,
|
|
132
173
|
};
|
|
174
|
+
if (apiProposal.snapshotBlocks) {
|
|
175
|
+
proposal.snapshotBlocks = apiProposal.snapshotBlocks;
|
|
176
|
+
}
|
|
133
177
|
if (isMultichain) {
|
|
134
178
|
proposal.multichain = {
|
|
135
179
|
id: apiProposal.proposalId,
|
|
@@ -140,20 +184,4 @@ async function getMoonbeamProposals(governanceEnvironment) {
|
|
|
140
184
|
});
|
|
141
185
|
return proposals;
|
|
142
186
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Fetch proposals for Moonriver using the old Ponder-based approach
|
|
145
|
-
*/
|
|
146
|
-
async function getMoonriverProposals(governanceEnvironment) {
|
|
147
|
-
const [_proposals, _xcProposals, _extendedDatas] = await Promise.all([
|
|
148
|
-
getProposalData({ environment: governanceEnvironment }),
|
|
149
|
-
getCrossChainProposalData({ environment: governanceEnvironment }),
|
|
150
|
-
getExtendedProposalData({ environment: governanceEnvironment }),
|
|
151
|
-
]);
|
|
152
|
-
const proposals = [..._proposals, ..._xcProposals];
|
|
153
|
-
proposals.forEach((proposal) => {
|
|
154
|
-
proposal.environment = governanceEnvironment;
|
|
155
|
-
});
|
|
156
|
-
appendProposalExtendedData(proposals, _extendedDatas);
|
|
157
|
-
return proposals;
|
|
158
|
-
}
|
|
159
187
|
//# sourceMappingURL=getProposals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProposals.js","sourceRoot":"","sources":["../../../../actions/governance/proposals/getProposals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAiB,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"getProposals.js","sourceRoot":"","sources":["../../../../actions/governance/proposals/getProposals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,KAAK,MAAM,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAiB,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAoB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AASrB,MAAM,CAAC,KAAK,UAAU,YAAY,CAIhC,MAAsB,EACtB,IAAoD;IAEpD,MAAM,KAAK,GAAG,MAAM,CAAC,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aAAa;YACpB,gBAAgB;YAChB,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,QAAQ,EAAE,aAAa,CAAC,QAAQ;YAChC,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,2EAA2E;YAC3E,2EAA2E;YAC3E,0EAA0E;YAC1E,UAAU,EAAE,WAAW,CAAC,UAAU,IAAI,EAAE;YACxC,YAAY,EAAE,aAAa,CAAC,YAAY;YACxC,WAAW,EAAE,qBAAqB;SACnC,CAAC;QAEF,IAAI,WAAW,CAAC,cAAc,EAAE,CAAC;YAC/B,QAAQ,CAAC,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC;QACvD,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,QAAQ,CAAC,UAAU,GAAG;gBACpB,EAAE,EAAE,WAAW,CAAC,UAAU;gBAC1B,cAAc,EAAE,WAAW,CAAC,cAAc;aAC3C,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/_esm/errors/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '0.20.
|
|
1
|
+
export const version = '0.20.5';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal.js","sourceRoot":"","sources":["../../types/proposal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proposal.js","sourceRoot":"","sources":["../../types/proposal.ts"],"names":[],"mappings":"AAqDA,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,qDAAU,CAAA;IACV,yDAAY,CAAA;IACZ,yDAAY,CAAA;IACZ,2DAAa,CAAA;IACb,qDAAU,CAAA;IACV,uDAAW,CAAA;IACX,yDAAY,CA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AAM,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../actions/governance/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AA2CpC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAqCF,+EAA+E;AAC/E,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,EAAE,CAAC,CAiCnB;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,WAAW,EAAE,CAAC,CAiHxB;AAED,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
|
|
@@ -9,10 +9,10 @@ export type GetUserVoteReceiptParameters<environments, network extends Chain | u
|
|
|
9
9
|
userAddress: Address;
|
|
10
10
|
/**
|
|
11
11
|
* The chain the proposal lives on (1 = Ethereum multigov,
|
|
12
|
-
* 1284 = Moonbeam historical). When omitted, every
|
|
13
|
-
* and non-empty receipts are concatenated —
|
|
14
|
-
* chains (they represent different proposals),
|
|
15
|
-
* can have votes on
|
|
12
|
+
* 1284 = Moonbeam historical, 1285 = Moonriver legacy). When omitted, every
|
|
13
|
+
* supported chain is queried and non-empty receipts are concatenated —
|
|
14
|
+
* proposalIds may collide across chains (they represent different proposals),
|
|
15
|
+
* so a single bare proposalId can have votes on more than one chain.
|
|
16
16
|
*/
|
|
17
17
|
chainId?: number;
|
|
18
18
|
};
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import type { Environment } from "../../environments/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Chains the governor indexer serves. Ethereum first because that's where the
|
|
4
|
-
* active multigov contract lives; Moonbeam follows for the historical archive
|
|
4
|
+
* active multigov contract lives; Moonbeam follows for the historical archive,
|
|
5
|
+
* then Moonriver (legacy standalone governor).
|
|
6
|
+
*
|
|
7
|
+
* This is the fan-out set for `getUserVoteReceipt` — a bare proposalId is
|
|
8
|
+
* queried on every chain and non-empty receipts are concatenated. Do NOT use it
|
|
9
|
+
* as the single-proposal fallback in `getProposal`: Moonriver has its own
|
|
10
|
+
* explicit route there, and reaching a 1285 proposal through a Moonbeam env
|
|
11
|
+
* would surface a degraded result (see `MULTIGOV_PROPOSAL_FALLBACK_CHAIN_IDS`).
|
|
12
|
+
*/
|
|
13
|
+
export declare const SUPPORTED_GOVERNOR_CHAIN_IDS: readonly [1, 1284, 1285];
|
|
14
|
+
/**
|
|
15
|
+
* Fallback chains for a single multigov proposal lookup (`getProposal` with no
|
|
16
|
+
* explicit `chainId`), tried first-hit-wins. Deliberately excludes Moonriver
|
|
17
|
+
* (1285): Moonriver proposals are fetched through their own env via an explicit
|
|
18
|
+
* chainId, so a bare Moonbeam/Ethereum lookup must never resolve to a 1285
|
|
19
|
+
* proposal — that would return `quorum: 0n` (cross-chain quorum skips
|
|
20
|
+
* governor-less chains) and the wrong `environment`.
|
|
5
21
|
*/
|
|
6
|
-
export declare const
|
|
22
|
+
export declare const MULTIGOV_PROPOSAL_FALLBACK_CHAIN_IDS: readonly [1, 1284];
|
|
7
23
|
/**
|
|
8
24
|
* Build the chain-prefixed proposal key the indexer requires
|
|
9
25
|
* (e.g. chainId=1, proposalId=7 → "1-0000000007").
|
|
@@ -45,6 +61,13 @@ export type ApiProposal = {
|
|
|
45
61
|
targets: string[];
|
|
46
62
|
values: string[];
|
|
47
63
|
calldatas: string[];
|
|
64
|
+
/**
|
|
65
|
+
* Legacy/Artemis-governor function signatures (e.g. "setDirectPrice(address,uint256)"),
|
|
66
|
+
* parallel to `targets`/`calldatas`. Present for legacy-governor proposals
|
|
67
|
+
* (Moonriver, early Moonbeam) whose calldata carries no 4-byte selector;
|
|
68
|
+
* empty/absent for multichain-governor proposals (selector is in the calldata).
|
|
69
|
+
*/
|
|
70
|
+
signatures?: string[];
|
|
48
71
|
votingStartTime: number;
|
|
49
72
|
votingEndTime: number;
|
|
50
73
|
description: string;
|
|
@@ -55,6 +78,12 @@ export type ApiProposal = {
|
|
|
55
78
|
timestamp: number;
|
|
56
79
|
transactionHash: string;
|
|
57
80
|
stateChanges?: ApiProposalStateChange[];
|
|
81
|
+
/**
|
|
82
|
+
* Per-chain voting-power snapshot blocks resolved by the indexer, keyed by
|
|
83
|
+
* chain name (`mainnet`, `base`, `optimism`, `moonbeam`). Decimal strings.
|
|
84
|
+
* Omitted for proposals indexed before this field existed.
|
|
85
|
+
*/
|
|
86
|
+
snapshotBlocks?: Record<string, string>;
|
|
58
87
|
};
|
|
59
88
|
export type ApiVote = {
|
|
60
89
|
id: string;
|
|
@@ -104,8 +133,9 @@ export type FetchProposalsOptions = PaginationOptions & {
|
|
|
104
133
|
/**
|
|
105
134
|
* Fetch proposals from Governor API
|
|
106
135
|
*
|
|
107
|
-
* `chainId` is required by the indexer — 1 (Ethereum multigov)
|
|
108
|
-
* 1284 (Moonbeam historical). Missing/unsupported
|
|
136
|
+
* `chainId` is required by the indexer — 1 (Ethereum multigov),
|
|
137
|
+
* 1284 (Moonbeam historical), or 1285 (Moonriver legacy). Missing/unsupported
|
|
138
|
+
* chainId returns 400.
|
|
109
139
|
*/
|
|
110
140
|
export declare function fetchProposals(environment: Environment, options: FetchProposalsOptions): Promise<PaginatedResponse<ApiProposal>>;
|
|
111
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governor-api-client.d.ts","sourceRoot":"","sources":["../../../actions/governance/governor-api-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAW/D
|
|
1
|
+
{"version":3,"file":"governor-api-client.d.ts","sourceRoot":"","sources":["../../../actions/governance/governor-api-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAW/D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,0BAA2B,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,oCAAoC,oBAAqB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,MAAM,EACf,YAAY,MAAM,GAAG,MAAM,KAC1B,MAA8D,CAAC;AAElE;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;gBAChC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;CAQzD;AAED,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,OAGhD,CAAC;AA8BF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,E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,MAAM,EACf,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAgBzC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,EAAE,CAAC,CAexB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAgBrC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,EAAE,CAAC,CAepB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,cAAc,EAAE,CAAC,CAS3B"}
|
|
@@ -22,8 +22,8 @@ export declare const fetchIpfsContent: (hash: string) => Promise<string>;
|
|
|
22
22
|
* fetches run in parallel.
|
|
23
23
|
*
|
|
24
24
|
* Failures are logged via console.warn AND surfaced through
|
|
25
|
-
* `env.onError` (matching the convention used by `
|
|
26
|
-
* `
|
|
25
|
+
* `env.onError` (matching the convention used by `getProposalsOnChainData` /
|
|
26
|
+
* `readCrossChainQuorums`), then swallowed per-proposal: the `ipfs://` URI
|
|
27
27
|
* is left untouched so consumers can detect (e.g. via
|
|
28
28
|
* `description.startsWith("ipfs://")`) and render a fallback. The bulk call
|
|
29
29
|
* never rejects, so a single bad pin doesn't kill `getProposals()` for
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import { Amount } from "../../../common/index.js";
|
|
2
2
|
import type { Environment } from "../../../environments/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ProposalState } from "../../../types/proposal.js";
|
|
4
4
|
import type { ApiProposal } from "../governor-api-client.js";
|
|
5
5
|
export declare const WORMHOLE_CONTRACT = "0xc8e2b0cd52cf01b0ce87d389daa3d414d4ce29f3";
|
|
6
|
-
type PonderExtendedProposalData = {
|
|
7
|
-
id: number;
|
|
8
|
-
title: string;
|
|
9
|
-
subtitle: string;
|
|
10
|
-
description: string;
|
|
11
|
-
targets: string[];
|
|
12
|
-
calldatas: string[];
|
|
13
|
-
signatures: string[];
|
|
14
|
-
stateChanges: {
|
|
15
|
-
blockNumber: number;
|
|
16
|
-
transactionHash: string;
|
|
17
|
-
state: string;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
6
|
/**
|
|
21
7
|
* Extract proposal subtitle from description
|
|
22
8
|
*/
|
|
@@ -58,12 +44,20 @@ export declare const isMultichainHomeChain: (chainId: number) => boolean;
|
|
|
58
44
|
* falls back to the home/bridge checks. Omit it or pass `undefined` when the
|
|
59
45
|
* count read failed so the unknown-cutoff bias above applies. (No `= 0` default:
|
|
60
46
|
* that would coerce an explicit `undefined` back to 0 and defeat the bias.)
|
|
47
|
+
*
|
|
48
|
+
* `hasMultichainGovernor` gates rule 4: the unknown-cutoff bias only makes sense
|
|
49
|
+
* on a chain that actually has a multichain governor to route to. On a
|
|
50
|
+
* legacy-only chain (Moonriver — legacy `governor`, no `multichainGovernor`) a
|
|
51
|
+
* failed Artemis count must NOT flip the proposal to multichain, which would
|
|
52
|
+
* route reads to a null contract and surface a spurious `multichain` field.
|
|
53
|
+
* Defaults to `true` so callers that don't supply it keep the dual-governor
|
|
54
|
+
* (Moonbeam) bias behavior.
|
|
61
55
|
*/
|
|
62
56
|
export declare const classifyProposalMultichain: (proposal: {
|
|
63
57
|
targets?: string[];
|
|
64
58
|
proposalId: number;
|
|
65
59
|
chainId: number;
|
|
66
|
-
}, legacyArtemisMaxId?: number) => boolean;
|
|
60
|
+
}, legacyArtemisMaxId?: number, hasMultichainGovernor?: boolean) => boolean;
|
|
67
61
|
/**
|
|
68
62
|
* @deprecated Use `classifyProposalMultichain` — this variant misses hub-homed
|
|
69
63
|
* proposals when the Artemis count is unavailable. Kept for compatibility.
|
|
@@ -127,9 +121,8 @@ export type ProposalOnChainData = {
|
|
|
127
121
|
* the `options.crossChainQuorums?.get(...) ?? 0n` pattern.
|
|
128
122
|
*
|
|
129
123
|
* Read failures are routed through `onError` so Sentry-wired consumers see
|
|
130
|
-
* them — matching `
|
|
131
|
-
* `
|
|
132
|
-
* `onError` since we don't have one per foreign chain in scope.
|
|
124
|
+
* them — matching `getProposalsOnChainData`. The caller's `governanceEnvironment`
|
|
125
|
+
* carries `onError` since we don't have one per foreign chain in scope.
|
|
133
126
|
*/
|
|
134
127
|
export declare const getEnvironmentByChainId: (chainId: number) => Environment | undefined;
|
|
135
128
|
export declare const readCrossChainQuorums: (apiProposals: ApiProposal[], governanceEnvironment: Environment) => Promise<Map<number, bigint>>;
|
|
@@ -139,24 +132,4 @@ export declare const readCrossChainQuorums: (apiProposals: ApiProposal[], govern
|
|
|
139
132
|
export declare const getProposalsOnChainData: (apiProposals: ApiProposal[], governanceEnvironment: Environment, options?: {
|
|
140
133
|
crossChainQuorums?: Map<number, bigint>;
|
|
141
134
|
}) => Promise<ProposalOnChainData[]>;
|
|
142
|
-
/**
|
|
143
|
-
* Get proposal data from on-chain (Ponder-based, for Moonriver)
|
|
144
|
-
*/
|
|
145
|
-
export declare const getProposalData: (params: {
|
|
146
|
-
environment: Environment;
|
|
147
|
-
id?: number;
|
|
148
|
-
}) => Promise<Proposal[]>;
|
|
149
|
-
/**
|
|
150
|
-
* Get cross-chain proposal data (Ponder-based, for Moonriver)
|
|
151
|
-
*/
|
|
152
|
-
export declare const getCrossChainProposalData: (params: {
|
|
153
|
-
environment: Environment;
|
|
154
|
-
id?: number;
|
|
155
|
-
}) => Promise<Proposal[]>;
|
|
156
|
-
export declare const appendProposalExtendedData: (proposals: Proposal[], extendedDatas: PonderExtendedProposalData[]) => void;
|
|
157
|
-
export declare const getExtendedProposalData: (params: {
|
|
158
|
-
environment: Environment;
|
|
159
|
-
id?: number;
|
|
160
|
-
}) => Promise<PonderExtendedProposalData[]>;
|
|
161
|
-
export {};
|
|
162
135
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../actions/governance/proposals/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../actions/governance/proposals/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAGL,aAAa,EACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,eAAO,MAAM,iBAAiB,+CAA+C,CAAC;AAc9E;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAoDvD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,UAAU,MAAM,EAAE,KAAG,OAEnD,CAAC;AAER;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,KAAG,OAGvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EACrE,qBAAqB,MAAM,EAC3B,+BAA4B,KAC3B,OAM0C,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,UAA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AAuB,GAClC,cAAc,WAAW,EAAE,EAC3B,uBAAuB,WAAW,EAClC,UAAU;IAAE,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,KACpD,OAAO,CAAC,mBAAmB,EAAE,CA0L/B,CAAC"}
|
|
@@ -6,7 +6,8 @@ export type GetProposalParameters<environments, network extends Chain | undefine
|
|
|
6
6
|
proposalId: number;
|
|
7
7
|
/**
|
|
8
8
|
* The chain the proposal lives on (1 = Ethereum multigov,
|
|
9
|
-
* 1284 = Moonbeam historical). When omitted,
|
|
9
|
+
* 1284 = Moonbeam historical, 1285 = Moonriver legacy). When omitted, the
|
|
10
|
+
* supported chains are tried in turn.
|
|
10
11
|
*/
|
|
11
12
|
chainId?: number;
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProposal.d.ts","sourceRoot":"","sources":["../../../../actions/governance/proposals/getProposal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"getProposal.d.ts","sourceRoot":"","sources":["../../../../actions/governance/proposals/getProposal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,4BAA4B,CAAC;AAc1E,MAAM,MAAM,qBAAqB,CAC/B,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,IAC/B,oBAAoB,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;AAElE,wBAAsB,WAAW,CAC/B,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,EAEjC,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,qBAAqB,CAAC,YAAY,EAAE,OAAO,CAAC,GACjD,qBAAqB,CAuCvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProposals.d.ts","sourceRoot":"","sources":["../../../../actions/governance/proposals/getProposals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"getProposals.d.ts","sourceRoot":"","sources":["../../../../actions/governance/proposals/getProposals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,4BAA4B,CAAC;AAS1E,MAAM,MAAM,sBAAsB,CAChC,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,IAC/B,4BAA4B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAExD,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEzD,wBAAsB,YAAY,CAChC,YAAY,EACZ,OAAO,SAAS,KAAK,GAAG,SAAS,EAEjC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,sBAAsB,CAAC,YAAY,EAAE,OAAO,CAAC,GACnD,sBAAsB,CAyCxB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.20.
|
|
1
|
+
export declare const version = "0.20.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -22,6 +22,17 @@ export type Proposal = {
|
|
|
22
22
|
id: number;
|
|
23
23
|
votesCollected: boolean;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Authoritative per-chain voting-power snapshot blocks resolved by the
|
|
27
|
+
* lunar-indexer, keyed by chain name (`mainnet` → 1, `base` → 8453,
|
|
28
|
+
* `optimism` → 10, `moonbeam` → 1284). Block numbers are decimal strings.
|
|
29
|
+
*
|
|
30
|
+
* Present on indexer-sourced multichain proposals; absent for older
|
|
31
|
+
* proposals indexed before the field existed and for on-chain (Moonriver)
|
|
32
|
+
* proposals. Consumers reading voting power should prefer these blocks over
|
|
33
|
+
* resolving the snapshot timestamp to a block client-side.
|
|
34
|
+
*/
|
|
35
|
+
snapshotBlocks?: Record<string, string>;
|
|
25
36
|
title?: string;
|
|
26
37
|
subtitle?: string;
|
|
27
38
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal.d.ts","sourceRoot":"","sources":["../../types/proposal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;I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,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;CACL,CAAC"}
|
|
@@ -70,10 +70,24 @@ type CampaignIdsCache = {
|
|
|
70
70
|
fetchedAt: number;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
type MerklBreakdown =
|
|
74
|
+
MerklRewardsResponse["rewards"][number]["breakdowns"][number];
|
|
75
|
+
|
|
73
76
|
const MOONWELL_MERKL_CREATOR = "0x8b621804a7637b781e2BbD58e256a591F2dF7d51";
|
|
74
77
|
const CAMPAIGN_IDS_CACHE_TTL_MS = 4 * 60 * 60 * 1000; // 4 hours
|
|
75
78
|
const MAX_BREAKDOWN_PAGES = 10;
|
|
76
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Stable identity for a Merkl reward breakdown. The Merkl `/rewards` endpoint
|
|
82
|
+
* clamps an out-of-range `breakdownPage` back to the first page instead of
|
|
83
|
+
* returning an empty page, so appending each page's breakdowns blindly
|
|
84
|
+
* re-counts the same rewards and inflates the total by the page count (up to
|
|
85
|
+
* 10x). Keying on the full breakdown content lets us skip exact repeats while
|
|
86
|
+
* still keeping genuinely distinct distributions that share a campaignId.
|
|
87
|
+
*/
|
|
88
|
+
const breakdownKey = (b: MerklBreakdown): string =>
|
|
89
|
+
`${b.campaignId}|${b.reason}|${b.amount}|${b.claimed}|${b.pending}|${b.subCampaignId ?? ""}`;
|
|
90
|
+
|
|
77
91
|
let campaignIdsCache: CampaignIdsCache | null = null;
|
|
78
92
|
|
|
79
93
|
/** Resets the in-memory campaign IDs cache. Intended for use in tests only. */
|
|
@@ -150,6 +164,14 @@ export async function getMerklRewardsData(
|
|
|
150
164
|
return [];
|
|
151
165
|
}
|
|
152
166
|
|
|
167
|
+
// Track breakdowns already collected (seeded from page 0) so repeated
|
|
168
|
+
// pages don't double-count. See breakdownKey for why Merkl repeats them.
|
|
169
|
+
const seenBreakdowns = new Set(
|
|
170
|
+
data.flatMap((reward) =>
|
|
171
|
+
reward.rewards.flatMap((r) => r.breakdowns.map(breakdownKey)),
|
|
172
|
+
),
|
|
173
|
+
);
|
|
174
|
+
|
|
153
175
|
// Paginate through remaining breakdown pages to collect all breakdowns
|
|
154
176
|
for (let page = 1; page < MAX_BREAKDOWN_PAGES; page++) {
|
|
155
177
|
const pageResponse = await fetch(
|
|
@@ -173,7 +195,8 @@ export async function getMerklRewardsData(
|
|
|
173
195
|
break;
|
|
174
196
|
}
|
|
175
197
|
|
|
176
|
-
// Merge breakdowns
|
|
198
|
+
// Merge only breakdowns we haven't collected yet.
|
|
199
|
+
let addedNewBreakdown = false;
|
|
177
200
|
for (const pageReward of pageData) {
|
|
178
201
|
const baseReward = data.find((d) => d.chain.id === pageReward.chain.id);
|
|
179
202
|
if (!baseReward) continue;
|
|
@@ -184,11 +207,24 @@ export async function getMerklRewardsData(
|
|
|
184
207
|
r.token.address.toLowerCase() ===
|
|
185
208
|
pageRewardEntry.token.address.toLowerCase(),
|
|
186
209
|
);
|
|
187
|
-
if (baseRewardEntry)
|
|
188
|
-
|
|
210
|
+
if (!baseRewardEntry) continue;
|
|
211
|
+
|
|
212
|
+
for (const breakdown of pageRewardEntry.breakdowns) {
|
|
213
|
+
const key = breakdownKey(breakdown);
|
|
214
|
+
if (seenBreakdowns.has(key)) continue;
|
|
215
|
+
seenBreakdowns.add(key);
|
|
216
|
+
baseRewardEntry.breakdowns.push(breakdown);
|
|
217
|
+
addedNewBreakdown = true;
|
|
189
218
|
}
|
|
190
219
|
}
|
|
191
220
|
}
|
|
221
|
+
|
|
222
|
+
// A page that only repeats breakdowns we've already seen means the API
|
|
223
|
+
// has stopped advancing (out-of-range page clamped to page 0), so
|
|
224
|
+
// continuing would just re-count the same rewards.
|
|
225
|
+
if (!addedNewBreakdown) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
192
228
|
}
|
|
193
229
|
|
|
194
230
|
return data
|
|
@@ -23,10 +23,10 @@ export type GetUserVoteReceiptParameters<
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* The chain the proposal lives on (1 = Ethereum multigov,
|
|
26
|
-
* 1284 = Moonbeam historical). When omitted, every
|
|
27
|
-
* and non-empty receipts are concatenated —
|
|
28
|
-
* chains (they represent different proposals),
|
|
29
|
-
* can have votes on
|
|
26
|
+
* 1284 = Moonbeam historical, 1285 = Moonriver legacy). When omitted, every
|
|
27
|
+
* supported chain is queried and non-empty receipts are concatenated —
|
|
28
|
+
* proposalIds may collide across chains (they represent different proposals),
|
|
29
|
+
* so a single bare proposalId can have votes on more than one chain.
|
|
30
30
|
*/
|
|
31
31
|
chainId?: number;
|
|
32
32
|
};
|
|
@@ -12,9 +12,26 @@ const getGovernorApiUrl = (environment: Environment): string => {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Chains the governor indexer serves. Ethereum first because that's where the
|
|
15
|
-
* active multigov contract lives; Moonbeam follows for the historical archive
|
|
15
|
+
* active multigov contract lives; Moonbeam follows for the historical archive,
|
|
16
|
+
* then Moonriver (legacy standalone governor).
|
|
17
|
+
*
|
|
18
|
+
* This is the fan-out set for `getUserVoteReceipt` — a bare proposalId is
|
|
19
|
+
* queried on every chain and non-empty receipts are concatenated. Do NOT use it
|
|
20
|
+
* as the single-proposal fallback in `getProposal`: Moonriver has its own
|
|
21
|
+
* explicit route there, and reaching a 1285 proposal through a Moonbeam env
|
|
22
|
+
* would surface a degraded result (see `MULTIGOV_PROPOSAL_FALLBACK_CHAIN_IDS`).
|
|
23
|
+
*/
|
|
24
|
+
export const SUPPORTED_GOVERNOR_CHAIN_IDS = [1, 1284, 1285] as const;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Fallback chains for a single multigov proposal lookup (`getProposal` with no
|
|
28
|
+
* explicit `chainId`), tried first-hit-wins. Deliberately excludes Moonriver
|
|
29
|
+
* (1285): Moonriver proposals are fetched through their own env via an explicit
|
|
30
|
+
* chainId, so a bare Moonbeam/Ethereum lookup must never resolve to a 1285
|
|
31
|
+
* proposal — that would return `quorum: 0n` (cross-chain quorum skips
|
|
32
|
+
* governor-less chains) and the wrong `environment`.
|
|
16
33
|
*/
|
|
17
|
-
export const
|
|
34
|
+
export const MULTIGOV_PROPOSAL_FALLBACK_CHAIN_IDS = [1, 1284] as const;
|
|
18
35
|
|
|
19
36
|
/**
|
|
20
37
|
* Build the chain-prefixed proposal key the indexer requires
|
|
@@ -103,6 +120,13 @@ export type ApiProposal = {
|
|
|
103
120
|
targets: string[];
|
|
104
121
|
values: string[];
|
|
105
122
|
calldatas: string[];
|
|
123
|
+
/**
|
|
124
|
+
* Legacy/Artemis-governor function signatures (e.g. "setDirectPrice(address,uint256)"),
|
|
125
|
+
* parallel to `targets`/`calldatas`. Present for legacy-governor proposals
|
|
126
|
+
* (Moonriver, early Moonbeam) whose calldata carries no 4-byte selector;
|
|
127
|
+
* empty/absent for multichain-governor proposals (selector is in the calldata).
|
|
128
|
+
*/
|
|
129
|
+
signatures?: string[];
|
|
106
130
|
votingStartTime: number;
|
|
107
131
|
votingEndTime: number;
|
|
108
132
|
description: string;
|
|
@@ -113,6 +137,12 @@ export type ApiProposal = {
|
|
|
113
137
|
timestamp: number;
|
|
114
138
|
transactionHash: string;
|
|
115
139
|
stateChanges?: ApiProposalStateChange[];
|
|
140
|
+
/**
|
|
141
|
+
* Per-chain voting-power snapshot blocks resolved by the indexer, keyed by
|
|
142
|
+
* chain name (`mainnet`, `base`, `optimism`, `moonbeam`). Decimal strings.
|
|
143
|
+
* Omitted for proposals indexed before this field existed.
|
|
144
|
+
*/
|
|
145
|
+
snapshotBlocks?: Record<string, string>;
|
|
116
146
|
};
|
|
117
147
|
|
|
118
148
|
export type ApiVote = {
|
|
@@ -168,8 +198,9 @@ export type FetchProposalsOptions = PaginationOptions & {
|
|
|
168
198
|
/**
|
|
169
199
|
* Fetch proposals from Governor API
|
|
170
200
|
*
|
|
171
|
-
* `chainId` is required by the indexer — 1 (Ethereum multigov)
|
|
172
|
-
* 1284 (Moonbeam historical). Missing/unsupported
|
|
201
|
+
* `chainId` is required by the indexer — 1 (Ethereum multigov),
|
|
202
|
+
* 1284 (Moonbeam historical), or 1285 (Moonriver legacy). Missing/unsupported
|
|
203
|
+
* chainId returns 400.
|
|
173
204
|
*/
|
|
174
205
|
export async function fetchProposals(
|
|
175
206
|
environment: Environment,
|
|
@@ -50,8 +50,8 @@ export const fetchIpfsContent = async (hash: string): Promise<string> => {
|
|
|
50
50
|
* fetches run in parallel.
|
|
51
51
|
*
|
|
52
52
|
* Failures are logged via console.warn AND surfaced through
|
|
53
|
-
* `env.onError` (matching the convention used by `
|
|
54
|
-
* `
|
|
53
|
+
* `env.onError` (matching the convention used by `getProposalsOnChainData` /
|
|
54
|
+
* `readCrossChainQuorums`), then swallowed per-proposal: the `ipfs://` URI
|
|
55
55
|
* is left untouched so consumers can detect (e.g. via
|
|
56
56
|
* `description.startsWith("ipfs://")`) and render a fallback. The bulk call
|
|
57
57
|
* never rejects, so a single bad pin doesn't kill `getProposals()` for
|