LogoLogo
  • Introduction
    • Chain Info
    • Smart Contracts
    • About Onyx
  • DEVELOPERS
    • Building dApp
    • Estimating Gas
    • Development Framework
    • Web3 Toolkits
    • Onyx SDK
    • Run Full Node
  • GOVERNANCE
    • Overview
    • Governor
    • Security
    • Quorum Votes
    • Proposal Threshold
    • Proposal Max Operations
    • Voting Delay
    • Voting Period
    • Propose
    • Queue
    • Execute
    • Cancel
    • Get Action
    • Get Receipt
    • Proposal State
    • Cast Vote
    • Vote By Signature
    • Timelock
  • Points
    • Onyx Points
    • Earning Points
      • 🟢Passive Points
      • 🔜Activity Points
      • 🔜App Points
  • Whitelisted Assets
  • Onyx AI
    • AI Agent
    • Core Features
    • Wallet Infrastructure
    • 🔜Roadmap
  • API
    • Onyx Governance API
    • Core API Endpoints
    • GET: /proposal
    • GET: /proposal/:proposalId
    • GET: /voter/:proposalId
    • GET: /voter/accounts
    • GET: /voter/history/:address
  • RESOURCES
    • Terms of Service
    • Bug Bounty
Powered by GitBook
On this page
  • Core API Endpoints
  • Fetch Governance Proposals
  • Get Proposal Details
  • Cast a Vote
  • Fetch Voter Receipts
  • Get Proposal State
Export as PDF
  1. API

Core API Endpoints

Core API Endpoints

Fetch Governance Proposals

Retrieve a list of active and past governance proposals.

GET /proposals
Response:
[
  {
    "proposalId": 1,
    "title": "Update Risk Parameters",
    "state": "Active",
    "createdAt": "2024-02-05T12:00:00Z",
    "votesFor": 150000000,
    "votesAgainst": 50000000
  }
]

Get Proposal Details

Retrieve details of a specific proposal by proposalId.


GET /proposals/{proposalId}
Response:
{
  "proposalId": 1,
  "title": "Update Risk Parameters",
  "description": "Adjust risk parameters for oETH market.",
  "state": "Active",
  "votesFor": 150000000,
  "votesAgainst": 50000000,
  "quorum": 200000000,
  "timelockExpiration": "2024-02-07T12:00:00Z"
}

Cast a Vote

Submit a vote for a proposal.

POST /vote
Request Body:
{
  "proposalId": 1,
  "voter": "0x123456789abcdef",
  "support": true,
  "signature": "0xabcdef..."
}
Response:
{
  "status": "success",
  "message": "Vote successfully recorded."
}

Fetch Voter Receipts

Retrieve voting receipt details for a given proposalId and voter address.

GET /receipts/{proposalId}/{voter}
Response:
{
  "proposalId": 1,
  "voter": "0x123456789abcdef",
  "hasVoted": true,
  "support": true,
  "votes": 5000000
}

Get Proposal State

Retrieve the current state of a proposal.

GET /proposals/{proposalId}/state
Response:
{
  "proposalId": 1,
  "state": "Active"
}

Security Considerations

  • Rate limits apply to prevent abuse of the API.

  • Authentication may be required for certain endpoints, such as submitting votes.

  • All API interactions should be performed using secure HTTPS connections.

PreviousOnyx Governance APINextGET: /proposal

Last updated 3 months ago