Skip to content

feat(common): add governance and stake pool fetcher interfaces - #864

Open
lisicky wants to merge 3 commits into
mainfrom
feat/governance-fetcher-interfaces
Open

lisicky wants to merge 3 commits into
mainfrom
feat/governance-fetcher-interfaces

Conversation

@lisicky

@lisicky lisicky commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

What

Adds two fetcher interfaces to @meshsdk/common for ledger state that IFetcher does not cover: governance state (DReps, the constitutional committee, the last enacted action of each purpose, the treasury, the constitution) and stake pool registrations. AccountInfo also gains the account's vote delegation and its registration deposit.

Contents

packages/mesh-common/src/interfaces/fetcher.ts:

  • IGovernanceFetcher:
    • fetchDRepState(drepId): a DRep's registration and deposit, by CIP-105 or CIP-129 id. An unknown DRep is reported as not registered.
    • fetchCommitteeState(): the constitutional committee, its sitting members and those proposed to join it.
    • fetchLastEnactedGovernanceActions(): the last enacted action of each governance purpose that has one.
    • fetchTreasury(): the treasury, in lovelace.
    • fetchConstitution(): the constitution in force, with its guardrail script hash.
  • IStakePoolFetcher: fetchPoolState(poolId), a stake pool's registration, by bech32 id or key hash. An unknown pool is reported as not registered.
  • Every method is required. A provider that cannot answer one throws.

packages/mesh-common/src/types/:

  • governance.ts: DRepState, CommitteeMemberState, EnactedGovernanceAction, ConstitutionState.
  • pool-params.ts: PoolState (registration, deposit, announced retirement epoch, reward address).
  • account-info.ts:
    • AccountInfo.drep: the CIP-129 id of the DRep the stake address delegates its vote to, alwaysAbstain or alwaysNoConfidence; null when it delegates its vote to none; left out when the provider does not report it.
    • AccountInfo.deposit: the registration deposit, when the provider reports it.

Types and interfaces only, no runtime code. The new AccountInfo fields are optional, so existing providers and callers are unaffected.

Validation

npx tsc --noEmit -p packages/mesh-common/tsconfig.json
npm test --workspace @meshsdk/common
npx prettier --check packages/mesh-common/src/interfaces/fetcher.ts packages/mesh-common/src/types/account-info.ts packages/mesh-common/src/types/governance.ts packages/mesh-common/src/types/pool-params.ts
  • @meshsdk/common: 20 suites, 179 tests pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant