@gzeoneth/gov-tracker 0.4.0-beta.fb8713f → 0.5.0
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/README.md +94 -7
- package/dist/abis-json.d.ts +2315 -0
- package/dist/abis-json.d.ts.map +1 -0
- package/dist/abis-json.js +3207 -0
- package/dist/abis-json.js.map +1 -0
- package/dist/abis.d.ts +12 -7
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +32 -1
- package/dist/abis.js.map +1 -1
- package/dist/calldata/parameter-decoder.d.ts.map +1 -1
- package/dist/calldata/parameter-decoder.js +19 -25
- package/dist/calldata/parameter-decoder.js.map +1 -1
- package/dist/cli/cli.js +73 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/lib/cli.d.ts.map +1 -1
- package/dist/cli/lib/cli.js +3 -2
- package/dist/cli/lib/cli.js.map +1 -1
- package/dist/cli/lib/election-check.d.ts.map +1 -1
- package/dist/cli/lib/election-check.js +2 -1
- package/dist/cli/lib/election-check.js.map +1 -1
- package/dist/cli/tui/components/VotingStats.d.ts.map +1 -1
- package/dist/cli/tui/components/VotingStats.js +2 -1
- package/dist/cli/tui/components/VotingStats.js.map +1 -1
- package/dist/cli/tui/hooks/useNavigation.d.ts.map +1 -1
- package/dist/cli/tui/hooks/useNavigation.js +2 -3
- package/dist/cli/tui/hooks/useNavigation.js.map +1 -1
- package/dist/cli/tui/hooks/useProposals.js +2 -2
- package/dist/cli/tui/hooks/useProposals.js.map +1 -1
- package/dist/cli/tui/utils/index.d.ts +2 -2
- package/dist/cli/tui/utils/index.d.ts.map +1 -1
- package/dist/cli/tui/utils/index.js +5 -1
- package/dist/cli/tui/utils/index.js.map +1 -1
- package/dist/cli/tui/utils/navigation.d.ts +1 -0
- package/dist/cli/tui/utils/navigation.d.ts.map +1 -1
- package/dist/cli/tui/utils/navigation.js +4 -4
- package/dist/cli/tui/utils/navigation.js.map +1 -1
- package/dist/cli/tui/utils/stage-status.d.ts +4 -0
- package/dist/cli/tui/utils/stage-status.d.ts.map +1 -1
- package/dist/cli/tui/utils/stage-status.js +47 -1
- package/dist/cli/tui/utils/stage-status.js.map +1 -1
- package/dist/cli/tui/views/CalldataView.d.ts.map +1 -1
- package/dist/cli/tui/views/CalldataView.js +3 -2
- package/dist/cli/tui/views/CalldataView.js.map +1 -1
- package/dist/cli/tui/views/ElectionView.d.ts.map +1 -1
- package/dist/cli/tui/views/ElectionView.js +4 -9
- package/dist/cli/tui/views/ElectionView.js.map +1 -1
- package/dist/constants.d.ts +43 -22
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +62 -17
- package/dist/constants.js.map +1 -1
- package/dist/data/bundled-cache.json +393 -20
- package/dist/data/delegate-cache.json +118014 -0
- package/dist/deduplication.d.ts.map +1 -1
- package/dist/deduplication.js +28 -51
- package/dist/deduplication.js.map +1 -1
- package/dist/delegates/cache.d.ts +44 -0
- package/dist/delegates/cache.d.ts.map +1 -0
- package/dist/delegates/cache.js +202 -0
- package/dist/delegates/cache.js.map +1 -0
- package/dist/delegates/index.d.ts +13 -0
- package/dist/delegates/index.d.ts.map +1 -0
- package/dist/delegates/index.js +32 -0
- package/dist/delegates/index.js.map +1 -0
- package/dist/delegates/indexer.d.ts +32 -0
- package/dist/delegates/indexer.d.ts.map +1 -0
- package/dist/delegates/indexer.js +191 -0
- package/dist/delegates/indexer.js.map +1 -0
- package/dist/delegates/queries.d.ts +30 -0
- package/dist/delegates/queries.d.ts.map +1 -0
- package/dist/delegates/queries.js +79 -0
- package/dist/delegates/queries.js.map +1 -0
- package/dist/discovery/governor-discovery.d.ts +21 -1
- package/dist/discovery/governor-discovery.d.ts.map +1 -1
- package/dist/discovery/governor-discovery.js +46 -12
- package/dist/discovery/governor-discovery.js.map +1 -1
- package/dist/discovery/timelock-discovery.d.ts.map +1 -1
- package/dist/discovery/timelock-discovery.js +1 -2
- package/dist/discovery/timelock-discovery.js.map +1 -1
- package/dist/election/details.d.ts.map +1 -1
- package/dist/election/details.js +2 -2
- package/dist/election/details.js.map +1 -1
- package/dist/election/index.d.ts +3 -1
- package/dist/election/index.d.ts.map +1 -1
- package/dist/election/index.js +12 -1
- package/dist/election/index.js.map +1 -1
- package/dist/election/params.d.ts.map +1 -1
- package/dist/election/params.js +11 -16
- package/dist/election/params.js.map +1 -1
- package/dist/election/proposal-ids.js +2 -2
- package/dist/election/proposal-ids.js.map +1 -1
- package/dist/election/status.d.ts +28 -1
- package/dist/election/status.d.ts.map +1 -1
- package/dist/election/status.js +110 -3
- package/dist/election/status.js.map +1 -1
- package/dist/election/write.d.ts +132 -0
- package/dist/election/write.d.ts.map +1 -0
- package/dist/election/write.js +184 -0
- package/dist/election/write.js.map +1 -0
- package/dist/governance/index.d.ts +5 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +28 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/read.d.ts +50 -0
- package/dist/governance/read.d.ts.map +1 -0
- package/dist/governance/read.js +194 -0
- package/dist/governance/read.js.map +1 -0
- package/dist/governance/write.d.ts +54 -0
- package/dist/governance/write.d.ts.map +1 -0
- package/dist/governance/write.js +132 -0
- package/dist/governance/write.js.map +1 -0
- package/dist/index.d.ts +40 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +149 -13
- package/dist/index.js.map +1 -1
- package/dist/simulation/index.d.ts +4 -1
- package/dist/simulation/index.d.ts.map +1 -1
- package/dist/simulation/index.js +5 -1
- package/dist/simulation/index.js.map +1 -1
- package/dist/simulation/simulation-data.d.ts +31 -0
- package/dist/simulation/simulation-data.d.ts.map +1 -1
- package/dist/simulation/simulation-data.js +34 -0
- package/dist/simulation/simulation-data.js.map +1 -1
- package/dist/simulation/tenderly-payloads.d.ts +107 -0
- package/dist/simulation/tenderly-payloads.d.ts.map +1 -0
- package/dist/simulation/tenderly-payloads.js +103 -0
- package/dist/simulation/tenderly-payloads.js.map +1 -0
- package/dist/stages/l2-to-l1-message.d.ts.map +1 -1
- package/dist/stages/l2-to-l1-message.js +40 -60
- package/dist/stages/l2-to-l1-message.js.map +1 -1
- package/dist/stages/proposal-queued.js.map +1 -1
- package/dist/stages/retryables.js.map +1 -1
- package/dist/stages/timelock.d.ts +41 -3
- package/dist/stages/timelock.d.ts.map +1 -1
- package/dist/stages/timelock.js +159 -48
- package/dist/stages/timelock.js.map +1 -1
- package/dist/stages/utils.d.ts +56 -1
- package/dist/stages/utils.d.ts.map +1 -1
- package/dist/stages/utils.js +144 -28
- package/dist/stages/utils.js.map +1 -1
- package/dist/tracker/bundled-cache.d.ts +136 -0
- package/dist/tracker/bundled-cache.d.ts.map +1 -0
- package/dist/tracker/bundled-cache.js +207 -0
- package/dist/tracker/bundled-cache.js.map +1 -0
- package/dist/tracker/checkpoint-helpers.d.ts +18 -0
- package/dist/tracker/checkpoint-helpers.d.ts.map +1 -1
- package/dist/tracker/checkpoint-helpers.js +37 -0
- package/dist/tracker/checkpoint-helpers.js.map +1 -1
- package/dist/tracker/discovery.d.ts +3 -0
- package/dist/tracker/discovery.d.ts.map +1 -1
- package/dist/tracker/discovery.js +3 -0
- package/dist/tracker/discovery.js.map +1 -1
- package/dist/tracker/pipeline.d.ts +3 -10
- package/dist/tracker/pipeline.d.ts.map +1 -1
- package/dist/tracker/pipeline.js +18 -32
- package/dist/tracker/pipeline.js.map +1 -1
- package/dist/tracker.d.ts +27 -4
- package/dist/tracker.d.ts.map +1 -1
- package/dist/tracker.js +47 -14
- package/dist/tracker.js.map +1 -1
- package/dist/types/config.d.ts +39 -3
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/delegates.d.ts +55 -0
- package/dist/types/delegates.d.ts.map +1 -0
- package/dist/types/delegates.js +9 -0
- package/dist/types/delegates.js.map +1 -0
- package/dist/types/election.d.ts +23 -0
- package/dist/types/election.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/tracking.d.ts +2 -2
- package/dist/types/tracking.d.ts.map +1 -1
- package/dist/utils/chain.d.ts +5 -1
- package/dist/utils/chain.d.ts.map +1 -1
- package/dist/utils/chain.js +7 -0
- package/dist/utils/chain.js.map +1 -1
- package/dist/utils/formatters.d.ts +2 -6
- package/dist/utils/formatters.d.ts.map +1 -1
- package/dist/utils/formatters.js +9 -12
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/logger.d.ts +2 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +2 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/rpc-utils.d.ts +0 -6
- package/dist/utils/rpc-utils.d.ts.map +1 -1
- package/dist/utils/rpc-utils.js +0 -9
- package/dist/utils/rpc-utils.js.map +1 -1
- package/dist/utils/stage-metadata.d.ts +19 -0
- package/dist/utils/stage-metadata.d.ts.map +1 -1
- package/dist/utils/stage-metadata.js +44 -0
- package/dist/utils/stage-metadata.js.map +1 -1
- package/dist/utils/timing.d.ts +2 -9
- package/dist/utils/timing.d.ts.map +1 -1
- package/dist/utils/timing.js +3 -20
- package/dist/utils/timing.js.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Election write action preparation
|
|
4
|
+
*
|
|
5
|
+
* Prepares transactions and typed data for election participation:
|
|
6
|
+
* - Contender registration (EIP-712 sign → addContender)
|
|
7
|
+
* - Vote casting (castVoteWithReasonAndParams with encoded params)
|
|
8
|
+
*
|
|
9
|
+
* Following the SDK's prepare-only philosophy: this module builds
|
|
10
|
+
* transaction data and typed data structures, but never executes.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.encodeElectionVoteParams = encodeElectionVoteParams;
|
|
14
|
+
exports.decodeElectionVoteParams = decodeElectionVoteParams;
|
|
15
|
+
exports.getAddContenderTypedData = getAddContenderTypedData;
|
|
16
|
+
exports.prepareAddContender = prepareAddContender;
|
|
17
|
+
exports.prepareContenderRegistration = prepareContenderRegistration;
|
|
18
|
+
exports.prepareNomineeElectionVote = prepareNomineeElectionVote;
|
|
19
|
+
exports.prepareMemberElectionVote = prepareMemberElectionVote;
|
|
20
|
+
const ethers_1 = require("ethers");
|
|
21
|
+
const constants_1 = require("../constants");
|
|
22
|
+
const abis_1 = require("../abis");
|
|
23
|
+
const types_1 = require("../types");
|
|
24
|
+
const logger_1 = require("../utils/logger");
|
|
25
|
+
const log = logger_1.loggers.election;
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Vote Parameter Encoding
|
|
28
|
+
// ============================================================================
|
|
29
|
+
/**
|
|
30
|
+
* Encode vote parameters for election castVoteWithReasonAndParams.
|
|
31
|
+
*
|
|
32
|
+
* Both NomineeElectionGovernor and MemberElectionGovernor use the same
|
|
33
|
+
* param encoding: abi.encode(address target, uint256 votes).
|
|
34
|
+
*
|
|
35
|
+
* @param target - Address of the contender/nominee to vote for
|
|
36
|
+
* @param votes - Vote amount in wei (full 18-decimal precision)
|
|
37
|
+
* @returns ABI-encoded bytes string
|
|
38
|
+
*/
|
|
39
|
+
function encodeElectionVoteParams(target, votes) {
|
|
40
|
+
if (!ethers_1.ethers.utils.isAddress(target)) {
|
|
41
|
+
throw new Error(`Invalid target address: ${target}`);
|
|
42
|
+
}
|
|
43
|
+
const votesBN = ethers_1.BigNumber.isBigNumber(votes) ? votes : ethers_1.BigNumber.from(votes);
|
|
44
|
+
return ethers_1.ethers.utils.defaultAbiCoder.encode(["address", "uint256"], [target, votesBN]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Decode vote parameters from election castVoteWithReasonAndParams.
|
|
48
|
+
*
|
|
49
|
+
* @param params - ABI-encoded bytes from castVoteWithReasonAndParams
|
|
50
|
+
* @returns Decoded target address and vote amount
|
|
51
|
+
*/
|
|
52
|
+
function decodeElectionVoteParams(params) {
|
|
53
|
+
const [target, votes] = ethers_1.ethers.utils.defaultAbiCoder.decode(["address", "uint256"], params);
|
|
54
|
+
return { target: target, votes: votes };
|
|
55
|
+
}
|
|
56
|
+
// ============================================================================
|
|
57
|
+
// Contender Registration
|
|
58
|
+
// ============================================================================
|
|
59
|
+
/**
|
|
60
|
+
* Build EIP-712 typed data for contender registration signing.
|
|
61
|
+
*
|
|
62
|
+
* The nominee election governor requires an EIP-712 signature of
|
|
63
|
+
* AddContenderMessage(uint256 proposalId) to register as a contender.
|
|
64
|
+
*
|
|
65
|
+
* @param governorName - The name() of the nominee election governor
|
|
66
|
+
* @param proposalId - The nominee election proposal ID
|
|
67
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
68
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
69
|
+
*/
|
|
70
|
+
function getAddContenderTypedData(governorName, proposalId, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
71
|
+
return {
|
|
72
|
+
domain: {
|
|
73
|
+
name: governorName,
|
|
74
|
+
version: "1",
|
|
75
|
+
chainId,
|
|
76
|
+
verifyingContract: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
77
|
+
},
|
|
78
|
+
types: {
|
|
79
|
+
AddContenderMessage: [{ name: "proposalId", type: "uint256" }],
|
|
80
|
+
},
|
|
81
|
+
primaryType: "AddContenderMessage",
|
|
82
|
+
message: {
|
|
83
|
+
proposalId: BigInt(proposalId),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Prepare the addContender transaction.
|
|
89
|
+
*
|
|
90
|
+
* @param proposalId - The nominee election proposal ID
|
|
91
|
+
* @param signature - The EIP-712 signature bytes
|
|
92
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
93
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
94
|
+
*/
|
|
95
|
+
function prepareAddContender(proposalId, signature, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
96
|
+
log("prepareAddContender for proposal %s", proposalId);
|
|
97
|
+
const calldata = abis_1.nomineeElectionGovernorInterface.encodeFunctionData("addContender", [
|
|
98
|
+
ethers_1.BigNumber.from(proposalId),
|
|
99
|
+
signature,
|
|
100
|
+
]);
|
|
101
|
+
return {
|
|
102
|
+
to: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
103
|
+
data: calldata,
|
|
104
|
+
value: "0",
|
|
105
|
+
chain: (0, types_1.chainIdToChain)(chainId),
|
|
106
|
+
chainId,
|
|
107
|
+
description: `addContender(${proposalId}) on NomineeElectionGovernor`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Prepare contender registration with both typed data and transaction builder.
|
|
112
|
+
*
|
|
113
|
+
* Usage:
|
|
114
|
+
* 1. Get governorName from the contract (e.g., via provider)
|
|
115
|
+
* 2. Call prepareContenderRegistration(governorName, proposalId)
|
|
116
|
+
* 3. Have the user sign the typedData
|
|
117
|
+
* 4. Call result.buildTransaction(signature) to get the PreparedTransaction
|
|
118
|
+
*
|
|
119
|
+
* @param governorName - The name() of the nominee election governor
|
|
120
|
+
* @param proposalId - The nominee election proposal ID
|
|
121
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
122
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
123
|
+
*/
|
|
124
|
+
function prepareContenderRegistration(governorName, proposalId, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
125
|
+
log("prepareContenderRegistration for proposal %s", proposalId);
|
|
126
|
+
return {
|
|
127
|
+
typedData: getAddContenderTypedData(governorName, proposalId, governorAddress, chainId),
|
|
128
|
+
buildTransaction: (signature) => prepareAddContender(proposalId, signature, governorAddress, chainId),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// ============================================================================
|
|
132
|
+
// Vote Casting
|
|
133
|
+
// ============================================================================
|
|
134
|
+
/**
|
|
135
|
+
* Prepare a castVoteWithReasonAndParams transaction for a nominee election.
|
|
136
|
+
*
|
|
137
|
+
* Used during NOMINEE_SELECTION phase to vote for contenders.
|
|
138
|
+
*
|
|
139
|
+
* @param proposalId - The nominee election proposal ID
|
|
140
|
+
* @param target - Address of the contender to vote for
|
|
141
|
+
* @param votes - Vote amount in wei
|
|
142
|
+
* @param reason - Optional vote reason (default: "")
|
|
143
|
+
* @param governorAddress - NomineeElectionGovernor contract address
|
|
144
|
+
* @param chainId - Chain ID (default: 42161)
|
|
145
|
+
*/
|
|
146
|
+
function prepareNomineeElectionVote(proposalId, target, votes, reason = "", governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
147
|
+
log("prepareNomineeElectionVote for proposal %s, target %s", proposalId, target);
|
|
148
|
+
const params = encodeElectionVoteParams(target, votes);
|
|
149
|
+
const calldata = abis_1.nomineeElectionGovernorInterface.encodeFunctionData("castVoteWithReasonAndParams", [ethers_1.BigNumber.from(proposalId), 1, reason, params]);
|
|
150
|
+
return {
|
|
151
|
+
to: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
152
|
+
data: calldata,
|
|
153
|
+
value: "0",
|
|
154
|
+
chain: (0, types_1.chainIdToChain)(chainId),
|
|
155
|
+
chainId,
|
|
156
|
+
description: `castVoteWithReasonAndParams on NomineeElectionGovernor for ${target}`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Prepare a castVoteWithReasonAndParams transaction for a member election.
|
|
161
|
+
*
|
|
162
|
+
* Used during MEMBER_ELECTION phase to vote for nominees.
|
|
163
|
+
*
|
|
164
|
+
* @param proposalId - The member election proposal ID
|
|
165
|
+
* @param target - Address of the nominee to vote for
|
|
166
|
+
* @param votes - Vote amount in wei
|
|
167
|
+
* @param reason - Optional vote reason (default: "")
|
|
168
|
+
* @param governorAddress - MemberElectionGovernor contract address
|
|
169
|
+
* @param chainId - Chain ID (default: 42161)
|
|
170
|
+
*/
|
|
171
|
+
function prepareMemberElectionVote(proposalId, target, votes, reason = "", governorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
172
|
+
log("prepareMemberElectionVote for proposal %s, target %s", proposalId, target);
|
|
173
|
+
const params = encodeElectionVoteParams(target, votes);
|
|
174
|
+
const calldata = abis_1.memberElectionGovernorInterface.encodeFunctionData("castVoteWithReasonAndParams", [ethers_1.BigNumber.from(proposalId), 1, reason, params]);
|
|
175
|
+
return {
|
|
176
|
+
to: ethers_1.ethers.utils.getAddress(governorAddress),
|
|
177
|
+
data: calldata,
|
|
178
|
+
value: "0",
|
|
179
|
+
chain: (0, types_1.chainIdToChain)(chainId),
|
|
180
|
+
chainId,
|
|
181
|
+
description: `castVoteWithReasonAndParams on MemberElectionGovernor for ${target}`,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/election/write.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AA+DH,4DAMC;AAQD,4DAMC;AAiBD,4DAqBC;AAUD,kDAqBC;AAgBD,oEAaC;AAkBD,gEAwBC;AAcD,8DAwBC;AAnQD,mCAA2C;AAC3C,4CAAoD;AACpD,kCAA4F;AAC5F,oCAA+D;AAC/D,4CAA0C;AAE1C,MAAM,GAAG,GAAG,gBAAO,CAAC,QAAQ,CAAC;AAyC7B,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E;;;;;;;;;GASG;AACH,SAAgB,wBAAwB,CAAC,MAAc,EAAE,KAAyB;IAChF,IAAI,CAAC,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAA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AAM,EAAE;KACnF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { prepareCastVote, prepareCastVoteWithReason, prepareCastVoteWithReasonAndParams, } from "./write";
|
|
2
|
+
export type { GovernorTarget } from "./write";
|
|
3
|
+
export { readProposalState, readProposalVotes, readProposalSnapshot, readProposalDeadline, readQuorum, readVotingPower, readGetVotes, readHasVoted, readCurrentVotingPower, readDelegate, readNomineeElectionState, readMemberElectionState, readElectionCount, readVotesUsed, readIsContender, readGovernorName, } from "./read";
|
|
4
|
+
export type { ReadContractParameters } from "./read";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAChB,YAAY,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Governance Module Public API
|
|
4
|
+
// ============================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readGovernorName = exports.readIsContender = exports.readVotesUsed = exports.readElectionCount = exports.readMemberElectionState = exports.readNomineeElectionState = exports.readDelegate = exports.readCurrentVotingPower = exports.readHasVoted = exports.readGetVotes = exports.readVotingPower = exports.readQuorum = exports.readProposalDeadline = exports.readProposalSnapshot = exports.readProposalVotes = exports.readProposalState = exports.prepareCastVoteWithReasonAndParams = exports.prepareCastVoteWithReason = exports.prepareCastVote = void 0;
|
|
7
|
+
var write_1 = require("./write");
|
|
8
|
+
Object.defineProperty(exports, "prepareCastVote", { enumerable: true, get: function () { return write_1.prepareCastVote; } });
|
|
9
|
+
Object.defineProperty(exports, "prepareCastVoteWithReason", { enumerable: true, get: function () { return write_1.prepareCastVoteWithReason; } });
|
|
10
|
+
Object.defineProperty(exports, "prepareCastVoteWithReasonAndParams", { enumerable: true, get: function () { return write_1.prepareCastVoteWithReasonAndParams; } });
|
|
11
|
+
var read_1 = require("./read");
|
|
12
|
+
Object.defineProperty(exports, "readProposalState", { enumerable: true, get: function () { return read_1.readProposalState; } });
|
|
13
|
+
Object.defineProperty(exports, "readProposalVotes", { enumerable: true, get: function () { return read_1.readProposalVotes; } });
|
|
14
|
+
Object.defineProperty(exports, "readProposalSnapshot", { enumerable: true, get: function () { return read_1.readProposalSnapshot; } });
|
|
15
|
+
Object.defineProperty(exports, "readProposalDeadline", { enumerable: true, get: function () { return read_1.readProposalDeadline; } });
|
|
16
|
+
Object.defineProperty(exports, "readQuorum", { enumerable: true, get: function () { return read_1.readQuorum; } });
|
|
17
|
+
Object.defineProperty(exports, "readVotingPower", { enumerable: true, get: function () { return read_1.readVotingPower; } });
|
|
18
|
+
Object.defineProperty(exports, "readGetVotes", { enumerable: true, get: function () { return read_1.readGetVotes; } });
|
|
19
|
+
Object.defineProperty(exports, "readHasVoted", { enumerable: true, get: function () { return read_1.readHasVoted; } });
|
|
20
|
+
Object.defineProperty(exports, "readCurrentVotingPower", { enumerable: true, get: function () { return read_1.readCurrentVotingPower; } });
|
|
21
|
+
Object.defineProperty(exports, "readDelegate", { enumerable: true, get: function () { return read_1.readDelegate; } });
|
|
22
|
+
Object.defineProperty(exports, "readNomineeElectionState", { enumerable: true, get: function () { return read_1.readNomineeElectionState; } });
|
|
23
|
+
Object.defineProperty(exports, "readMemberElectionState", { enumerable: true, get: function () { return read_1.readMemberElectionState; } });
|
|
24
|
+
Object.defineProperty(exports, "readElectionCount", { enumerable: true, get: function () { return read_1.readElectionCount; } });
|
|
25
|
+
Object.defineProperty(exports, "readVotesUsed", { enumerable: true, get: function () { return read_1.readVotesUsed; } });
|
|
26
|
+
Object.defineProperty(exports, "readIsContender", { enumerable: true, get: function () { return read_1.readIsContender; } });
|
|
27
|
+
Object.defineProperty(exports, "readGovernorName", { enumerable: true, get: function () { return read_1.readGovernorName; } });
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;;;AAE/E,iCAIiB;AAHf,wGAAA,eAAe,OAAA;AACf,kHAAA,yBAAyB,OAAA;AACzB,2HAAA,kCAAkC,OAAA;AAIpC,+BAiBgB;AAhBd,yGAAA,iBAAiB,OAAA;AACjB,yGAAA,iBAAiB,OAAA;AACjB,4GAAA,oBAAoB,OAAA;AACpB,4GAAA,oBAAoB,OAAA;AACpB,kGAAA,UAAU,OAAA;AACV,uGAAA,eAAe,OAAA;AACf,oGAAA,YAAY,OAAA;AACZ,oGAAA,YAAY,OAAA;AACZ,8GAAA,sBAAsB,OAAA;AACtB,oGAAA,YAAY,OAAA;AACZ,gHAAA,wBAAwB,OAAA;AACxB,+GAAA,uBAAuB,OAAA;AACvB,yGAAA,iBAAiB,OAAA;AACjB,qGAAA,aAAa,OAAA;AACb,uGAAA,eAAe,OAAA;AACf,wGAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance read helpers for wagmi/viem consumers.
|
|
3
|
+
*
|
|
4
|
+
* Each function returns a plain object compatible with wagmi's
|
|
5
|
+
* `useReadContract` and `useReadContracts` (multicall) hooks:
|
|
6
|
+
*
|
|
7
|
+
* @example Single read
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { readProposalState } from "@gzeoneth/gov-tracker";
|
|
10
|
+
* const { data } = useReadContract(readProposalState(proposalId));
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example Batched reads (multicall)
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const { data } = useReadContracts({
|
|
16
|
+
* contracts: delegates.map(d => readVotingPower(d, snapshotBlock)),
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
import type { GovernorTarget } from "./write";
|
|
21
|
+
/**
|
|
22
|
+
* Shape compatible with wagmi's useReadContract parameters.
|
|
23
|
+
* Consumers pass this directly: `useReadContract(readProposalState(id))`.
|
|
24
|
+
*/
|
|
25
|
+
export interface ReadContractParameters {
|
|
26
|
+
address: `0x${string}`;
|
|
27
|
+
abi: readonly Record<string, unknown>[];
|
|
28
|
+
functionName: string;
|
|
29
|
+
args: readonly unknown[];
|
|
30
|
+
chainId?: number;
|
|
31
|
+
}
|
|
32
|
+
type GovernorAddress = GovernorTarget | `0x${string}`;
|
|
33
|
+
export declare function readProposalState(proposalId: bigint | string, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
34
|
+
export declare function readProposalVotes(proposalId: bigint | string, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
35
|
+
export declare function readProposalSnapshot(proposalId: bigint | string, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
36
|
+
export declare function readProposalDeadline(proposalId: bigint | string, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
37
|
+
export declare function readQuorum(blockNumber: bigint | number, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
38
|
+
export declare function readVotingPower(account: `0x${string}` | string, blockNumber: bigint | number, tokenAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
39
|
+
export declare function readGetVotes(account: `0x${string}` | string, blockNumber: bigint | number, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
40
|
+
export declare function readHasVoted(proposalId: bigint | string, account: `0x${string}` | string, governor?: GovernorAddress, chainId?: number): ReadContractParameters;
|
|
41
|
+
export declare function readCurrentVotingPower(account: `0x${string}` | string, tokenAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
42
|
+
export declare function readDelegate(account: `0x${string}` | string, tokenAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
43
|
+
export declare function readNomineeElectionState(proposalId: bigint | string, governorAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
44
|
+
export declare function readMemberElectionState(proposalId: bigint | string, governorAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
45
|
+
export declare function readElectionCount(governorAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
46
|
+
export declare function readVotesUsed(proposalId: bigint | string, account: `0x${string}` | string, governorAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
47
|
+
export declare function readIsContender(proposalId: bigint | string, account: `0x${string}` | string, governorAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
48
|
+
export declare function readGovernorName(governorAddress?: `0x${string}` | string, chainId?: number): ReadContractParameters;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/governance/read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAUH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;IACvB,GAAG,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EA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EAAE,GAAG,MAAM,EAC/B,eAAe,GAAE,KAAK,MAAM,EAAE,GAAG,MAA4C,EAC7E,OAAO,GAAE,MAA0B,GAClC,sBAAsB,CAQxB;AAED,wBAAgB,gBAAgB,CAC9B,eAAe,GAAE,KAAK,MAAM,EAAE,GAAG,MAA4C,EAC7E,OAAO,GAAE,MAA0B,GAClC,sBAAsB,CAQxB"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Governance read helpers for wagmi/viem consumers.
|
|
4
|
+
*
|
|
5
|
+
* Each function returns a plain object compatible with wagmi's
|
|
6
|
+
* `useReadContract` and `useReadContracts` (multicall) hooks:
|
|
7
|
+
*
|
|
8
|
+
* @example Single read
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { readProposalState } from "@gzeoneth/gov-tracker";
|
|
11
|
+
* const { data } = useReadContract(readProposalState(proposalId));
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @example Batched reads (multicall)
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const { data } = useReadContracts({
|
|
17
|
+
* contracts: delegates.map(d => readVotingPower(d, snapshotBlock)),
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.readProposalState = readProposalState;
|
|
23
|
+
exports.readProposalVotes = readProposalVotes;
|
|
24
|
+
exports.readProposalSnapshot = readProposalSnapshot;
|
|
25
|
+
exports.readProposalDeadline = readProposalDeadline;
|
|
26
|
+
exports.readQuorum = readQuorum;
|
|
27
|
+
exports.readVotingPower = readVotingPower;
|
|
28
|
+
exports.readGetVotes = readGetVotes;
|
|
29
|
+
exports.readHasVoted = readHasVoted;
|
|
30
|
+
exports.readCurrentVotingPower = readCurrentVotingPower;
|
|
31
|
+
exports.readDelegate = readDelegate;
|
|
32
|
+
exports.readNomineeElectionState = readNomineeElectionState;
|
|
33
|
+
exports.readMemberElectionState = readMemberElectionState;
|
|
34
|
+
exports.readElectionCount = readElectionCount;
|
|
35
|
+
exports.readVotesUsed = readVotesUsed;
|
|
36
|
+
exports.readIsContender = readIsContender;
|
|
37
|
+
exports.readGovernorName = readGovernorName;
|
|
38
|
+
const constants_1 = require("../constants");
|
|
39
|
+
const abis_json_1 = require("../abis-json");
|
|
40
|
+
const write_1 = require("./write");
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Governor reads
|
|
43
|
+
// ============================================================================
|
|
44
|
+
function readProposalState(proposalId, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
45
|
+
return {
|
|
46
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
47
|
+
abi: abis_json_1.governorReadAbi,
|
|
48
|
+
functionName: "state",
|
|
49
|
+
args: [BigInt(proposalId)],
|
|
50
|
+
chainId,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function readProposalVotes(proposalId, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
54
|
+
return {
|
|
55
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
56
|
+
abi: abis_json_1.governorReadAbi,
|
|
57
|
+
functionName: "proposalVotes",
|
|
58
|
+
args: [BigInt(proposalId)],
|
|
59
|
+
chainId,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function readProposalSnapshot(proposalId, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
63
|
+
return {
|
|
64
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
65
|
+
abi: abis_json_1.governorReadAbi,
|
|
66
|
+
functionName: "proposalSnapshot",
|
|
67
|
+
args: [BigInt(proposalId)],
|
|
68
|
+
chainId,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function readProposalDeadline(proposalId, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
72
|
+
return {
|
|
73
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
74
|
+
abi: abis_json_1.governorReadAbi,
|
|
75
|
+
functionName: "proposalDeadline",
|
|
76
|
+
args: [BigInt(proposalId)],
|
|
77
|
+
chainId,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function readQuorum(blockNumber, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
81
|
+
return {
|
|
82
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
83
|
+
abi: abis_json_1.governorReadAbi,
|
|
84
|
+
functionName: "quorum",
|
|
85
|
+
args: [BigInt(blockNumber)],
|
|
86
|
+
chainId,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// Token / voting power reads
|
|
91
|
+
// ============================================================================
|
|
92
|
+
function readVotingPower(account, blockNumber, tokenAddress = constants_1.ADDRESSES.ARB_TOKEN, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
93
|
+
return {
|
|
94
|
+
address: tokenAddress,
|
|
95
|
+
abi: abis_json_1.erc20VotesAbi,
|
|
96
|
+
functionName: "getPastVotes",
|
|
97
|
+
args: [account, BigInt(blockNumber)],
|
|
98
|
+
chainId,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function readGetVotes(account, blockNumber, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
102
|
+
return {
|
|
103
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
104
|
+
abi: abis_json_1.governorReadAbi,
|
|
105
|
+
functionName: "getVotes",
|
|
106
|
+
args: [account, BigInt(blockNumber)],
|
|
107
|
+
chainId,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function readHasVoted(proposalId, account, governor, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
111
|
+
return {
|
|
112
|
+
address: (0, write_1.resolveGovernorAddress)(governor),
|
|
113
|
+
abi: abis_json_1.governorReadAbi,
|
|
114
|
+
functionName: "hasVoted",
|
|
115
|
+
args: [BigInt(proposalId), account],
|
|
116
|
+
chainId,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function readCurrentVotingPower(account, tokenAddress = constants_1.ADDRESSES.ARB_TOKEN, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
120
|
+
return {
|
|
121
|
+
address: tokenAddress,
|
|
122
|
+
abi: abis_json_1.erc20VotesAbi,
|
|
123
|
+
functionName: "getVotes",
|
|
124
|
+
args: [account],
|
|
125
|
+
chainId,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function readDelegate(account, tokenAddress = constants_1.ADDRESSES.ARB_TOKEN, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
129
|
+
return {
|
|
130
|
+
address: tokenAddress,
|
|
131
|
+
abi: abis_json_1.erc20VotesAbi,
|
|
132
|
+
functionName: "delegates",
|
|
133
|
+
args: [account],
|
|
134
|
+
chainId,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
// ============================================================================
|
|
138
|
+
// Election reads
|
|
139
|
+
// ============================================================================
|
|
140
|
+
function readNomineeElectionState(proposalId, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
141
|
+
return {
|
|
142
|
+
address: governorAddress,
|
|
143
|
+
abi: abis_json_1.nomineeElectionGovernorReadAbi,
|
|
144
|
+
functionName: "state",
|
|
145
|
+
args: [BigInt(proposalId)],
|
|
146
|
+
chainId,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function readMemberElectionState(proposalId, governorAddress = constants_1.ADDRESSES.ELECTION_MEMBER_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
150
|
+
return {
|
|
151
|
+
address: governorAddress,
|
|
152
|
+
abi: abis_json_1.memberElectionGovernorReadAbi,
|
|
153
|
+
functionName: "state",
|
|
154
|
+
args: [BigInt(proposalId)],
|
|
155
|
+
chainId,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function readElectionCount(governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
159
|
+
return {
|
|
160
|
+
address: governorAddress,
|
|
161
|
+
abi: abis_json_1.nomineeElectionGovernorReadAbi,
|
|
162
|
+
functionName: "electionCount",
|
|
163
|
+
args: [],
|
|
164
|
+
chainId,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function readVotesUsed(proposalId, account, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
168
|
+
return {
|
|
169
|
+
address: governorAddress,
|
|
170
|
+
abi: abis_json_1.nomineeElectionGovernorReadAbi,
|
|
171
|
+
functionName: "votesUsed",
|
|
172
|
+
args: [BigInt(proposalId), account],
|
|
173
|
+
chainId,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function readIsContender(proposalId, account, governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
177
|
+
return {
|
|
178
|
+
address: governorAddress,
|
|
179
|
+
abi: abis_json_1.nomineeElectionGovernorReadAbi,
|
|
180
|
+
functionName: "isContender",
|
|
181
|
+
args: [BigInt(proposalId), account],
|
|
182
|
+
chainId,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function readGovernorName(governorAddress = constants_1.ADDRESSES.ELECTION_NOMINEE_GOVERNOR, chainId = constants_1.CHAIN_IDS.ARB_ONE) {
|
|
186
|
+
return {
|
|
187
|
+
address: governorAddress,
|
|
188
|
+
abi: abis_json_1.nomineeElectionGovernorReadAbi,
|
|
189
|
+
functionName: "name",
|
|
190
|
+
args: [],
|
|
191
|
+
chainId,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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Y,EAAE,MAAM;QACpB,IAAI,EAAE,EAAE;QACR,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Governance proposal vote preparation
|
|
3
|
+
*
|
|
4
|
+
* Prepares transactions for casting votes on Core Governor and Treasury
|
|
5
|
+
* Governor proposals. Following the SDK's prepare-only philosophy: builds
|
|
6
|
+
* transaction data but never executes.
|
|
7
|
+
*
|
|
8
|
+
* Supports all OpenZeppelin Governor voting methods:
|
|
9
|
+
* - castVote(proposalId, support)
|
|
10
|
+
* - castVoteWithReason(proposalId, support, reason)
|
|
11
|
+
* - castVoteWithReasonAndParams(proposalId, support, reason, params)
|
|
12
|
+
*/
|
|
13
|
+
import type { VoteSupport } from "../constants";
|
|
14
|
+
import { PreparedTransaction } from "../types";
|
|
15
|
+
export type GovernorTarget = "constitutional" | "non-constitutional";
|
|
16
|
+
export declare function resolveGovernorAddress(governorAddressOrTarget?: GovernorTarget | string): `0x${string}`;
|
|
17
|
+
/**
|
|
18
|
+
* Prepare a castVote transaction.
|
|
19
|
+
*
|
|
20
|
+
* Simplest voting method — just proposal ID and support value.
|
|
21
|
+
*
|
|
22
|
+
* @param proposalId - The proposal ID to vote on
|
|
23
|
+
* @param support - Vote support: 0 (Against), 1 (For), 2 (Abstain) — use VOTE_SUPPORT constants
|
|
24
|
+
* @param governorAddress - Governor contract address, or "constitutional"/"non-constitutional" shorthand
|
|
25
|
+
* @param chainId - Chain ID (default: 42161 for Arbitrum One)
|
|
26
|
+
*/
|
|
27
|
+
export declare function prepareCastVote(proposalId: string, support: VoteSupport, governorAddress?: GovernorTarget | string, chainId?: number): PreparedTransaction;
|
|
28
|
+
/**
|
|
29
|
+
* Prepare a castVoteWithReason transaction.
|
|
30
|
+
*
|
|
31
|
+
* Same as castVote but includes an on-chain reason string.
|
|
32
|
+
*
|
|
33
|
+
* @param proposalId - The proposal ID to vote on
|
|
34
|
+
* @param support - Vote support: 0 (Against), 1 (For), 2 (Abstain)
|
|
35
|
+
* @param reason - On-chain reason for the vote
|
|
36
|
+
* @param governorAddress - Governor contract address or shorthand
|
|
37
|
+
* @param chainId - Chain ID (default: 42161)
|
|
38
|
+
*/
|
|
39
|
+
export declare function prepareCastVoteWithReason(proposalId: string, support: VoteSupport, reason: string, governorAddress?: GovernorTarget | string, chainId?: number): PreparedTransaction;
|
|
40
|
+
/**
|
|
41
|
+
* Prepare a castVoteWithReasonAndParams transaction.
|
|
42
|
+
*
|
|
43
|
+
* Most flexible voting method — includes reason and arbitrary params bytes.
|
|
44
|
+
* Used by governors with custom counting modules.
|
|
45
|
+
*
|
|
46
|
+
* @param proposalId - The proposal ID to vote on
|
|
47
|
+
* @param support - Vote support: 0 (Against), 1 (For), 2 (Abstain)
|
|
48
|
+
* @param reason - On-chain reason for the vote
|
|
49
|
+
* @param params - ABI-encoded params bytes (interpretation depends on counting module)
|
|
50
|
+
* @param governorAddress - Governor contract address or shorthand
|
|
51
|
+
* @param chainId - Chain ID (default: 42161)
|
|
52
|
+
*/
|
|
53
|
+
export declare function prepareCastVoteWithReasonAndParams(proposalId: string, support: VoteSupport, reason: string, params: string, governorAddress?: GovernorTarget | string, chainId?: number): PreparedTransaction;
|
|
54
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/governance/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAkB,MAAM,UAAU,CAAC;AAS/D,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAMrE,wBAAgB,sBAAsB,CACpC,uBAAuB,CAAC,EAAE,cAAc,GAAG,MAAM,GAChD,KAAK,MAAM,EAAE,CAMf;AAYD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,cAAc,GAAG,MAAM,EACzC,OAAO,GAAE,MAA0B,GAClC,mBAAmB,CAiBrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,cAAc,GAAG,MAAM,EACzC,OAAO,GAAE,MAA0B,GAClC,mBAAmB,CAkBrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,eAAe,CAAC,EAAE,cAAc,GAAG,MAAM,EACzC,OAAO,GAAE,MAA0B,GAClC,mBAAmB,CAmBrB"}
|