@sage-protocol/sdk 0.0.7 → 0.0.8
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 +30 -0
- package/dist/index.cjs +3283 -2992
- package/dist/index.mjs +3283 -2992
- package/package.json +1 -1
- package/types/index.d.ts +2 -0
package/README.md
CHANGED
|
@@ -212,6 +212,36 @@ const tx = await sdk.governance.buildDelegateSelfTx({ provider, governor, accoun
|
|
|
212
212
|
// send via userOp (CDP) or EOA
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
+
Votes token resolution and gates
|
|
216
|
+
```js
|
|
217
|
+
// Resolve the IVotes token used for proposals
|
|
218
|
+
const votesToken = await sdk.governance.resolveVotesToken({ provider, governor });
|
|
219
|
+
|
|
220
|
+
// Build preferred self-delegate using resolved token
|
|
221
|
+
const del = await sdk.governance.buildDelegateSelfPreferred({ provider, governor, account: user });
|
|
222
|
+
|
|
223
|
+
// Delegate and verify votes (no throw)
|
|
224
|
+
const res = await sdk.governance.delegateSelfAndVerify({ provider, governor, account: user, signer, minVotes: 1n });
|
|
225
|
+
// → { txHash, ok, votes, payload }
|
|
226
|
+
|
|
227
|
+
// Readiness to propose (preflight)
|
|
228
|
+
const gates = await sdk.governance.ensureProposeGates({ provider, governor, proposer: user });
|
|
229
|
+
// Optionally include execution check (registry update as timelock)
|
|
230
|
+
const ready = await sdk.governance.readinessToPropose({
|
|
231
|
+
provider,
|
|
232
|
+
governor,
|
|
233
|
+
proposer: user,
|
|
234
|
+
execution: { registry, timelock, subdao, libraryId: 'main', manifestCID, promptCount: 12 },
|
|
235
|
+
});
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Subgraph normalization
|
|
239
|
+
```js
|
|
240
|
+
// listProposalsFiltered now returns both state (string) and stateNum (0–7)
|
|
241
|
+
const items = await sdk.subgraph.listProposalsFiltered({ url: SUBGRAPH_URL, governor });
|
|
242
|
+
// item.state → 'PENDING' | 'ACTIVE' | ... ; item.stateNum → 0..7 or null when unknown
|
|
243
|
+
```
|
|
244
|
+
|
|
215
245
|
Proposal timeline (subgraph)
|
|
216
246
|
```js
|
|
217
247
|
const t = await sdk.subgraph.getProposalTimeline({ url: SUBGRAPH_URL, id: idHexOrDecimal });
|