Skip to content

Conversation

@PedroBinotto
Copy link
Contributor

@PedroBinotto PedroBinotto commented Dec 17, 2025

Removed Endpoints

  • Removed accountPower from item queries
  • Removed votingPowerHistory from item queries
  • Removed accountPowers from list queries
  • Removed votingPowerHistorys from list queries
  • Removed historicalVotingPowers from rest queries

Added/Reorganized Endpoints

  • Renamed votingPowers to historicalVotingPowers
  • Added new votingPowers endpoint
  • Added votingPowerByAccountId endpoint
  • Added votingPowerVariationsByAccountId endpoint

Changelog

  • [Additions] New API endpoints (REST):
    • votingPowerByAccountId:
      method: "get",
      operationId: "votingPowerByAccountId",
      path: "/voting-powers/{accountId}",
      summary: "Get account powers",
      description: "Returns voting power information for a specific address (account)",
      
      • Input:
        • accountId (required param): index by account address;
      • Output:
        • Resulting item, including { accountId, votingPower, votesCount, proposalsCount, delegationsCount };
    • votingPowers:
      method: "get",
      operationId: "votingPowers",
      path: "/voting-powers",
      summary: "Get voting powers",
      description: "Returns sorted and paginated account voting power records",
      
      • Input:
        • addresses (optional param): filter by address (array);
        • fromValue (optional param): filter by minimum voting power;
        • toValue (optional param): filter by maximum voting power;
        • limit (optional param);
        • skip (pagination param);
        • orderDirection (pagination param);
      • Output:
        • items: Array of resulting items, including { accountId, votingPower, votesCount, proposalsCount, delegationsCount };
        • totalCount: total number of hits given filter parameters;
    • votingPowerVariationsByAccountId:
      method: "get",
      operationId: "votingPowerVariationsByAccountId",
      path: "/voting-powers/{accountId}/variations",
      summary: "Get top changes in voting power for a given period for a single account",
      description: "Returns a the changes to voting power by period and accountId",
      
      • Input:
        • accountId (required param): index by account address;
        • days (required param): variation period;
      • Output:
        • data: Resulting item, including { accountId, previousVotingPower, currentVotingPower, absoluteChange, percentageChange };
        • period: Time period data relating to the query, containing { days, startTimestamp, endTimestamp };
    • historicalVotingPower: (RENAME) old votingPowers endpoint;
  • [Deletions] Removed API endpoints (GQL Queries):
    • Query.accountPower (ponder auto-generated):
      • Mapped references to query:
        • GetAccountPower GQL Query:
          • useVoterInfo react hook:
            • ProposalSection.tsx;
        • GetDelegatorVotingPowerDetails:
          • useVotingPower react hook:
            • useVotingPowerData react hook:
              • VotingPower.tsx;
          • VotingPowerTable.tsx;
    • Query.accountPowers (ponder auto-generated):
      • Mapped references to query:
        • GetDelegates GQL Query:
          • useDaoOverviewData react hook:
            • DaoOverviewSection.tsx;
          • useDelegates react hook:
            • Delegates.tsx;
        • GetDelegatesCount GQL Query:
          • useDelegates react hook:
            • Delegates.tsx;
        • GetVetoCouncilVotingPower GQL Query:
          • useVetoCouncilVotingPower react hook:
            • AttackCostBarChart.tsx;
    • Query.votingPowerHistory (ponder auto-generated):
      • Mapped references to query:
        • N/A;
    • Query.votingPowerHistorys (ponder auto-generated):
      • Mapped references to query:
        • GetDelegateDelegationHistory GQL Query (dead code);
        • GetDelegateDelegationHistoryDeltaRange GQL Query (dead code);
        • GetDelegateDelegationHistoryGraph GQL Query:
          • useDelegateDelegationHistoryGraph react hook:
            • VotingPowerVariationGraph.tsx;
    • Query.historicalVotingPower (old endpoint):
      • Mapped references to query:
        • GetHistoricalVotingAndActivity GQL Query:
          • useDelegates react hook:
            • Delegates.tsx;
        • GetVotingPowerChange GQL Query:
          • useVotes react hook:
            • TabsVotedContent.tsx;

Resource correspondence

Migration from the old queries to the new REST endpoints could me implemented according to the following relation:

Old New
Query.accountPower votingPowerByAccountId(/voting-powers/{address})
Query.accountPowers votingPowers(/voting-powers)
Query.votingPowers historicalVotingPowers(/voting-powers/{address}/historical)
Query.votingPowerHistorys historicalVotingPowers(/voting-powers/{address}/historical)
Query.historicalVotingPower votingPowerVariationsByAccountId(/voting-powers/{address}/variations)
OpenAPI Spec
{
  "openapi": "3.0.2",
  ...
  },
  "paths": {
    ...
    "/voting-powers/{accountId}/historical": {
      "get": {
        "operationId": "historicalVotingPowers",
        "summary": "Get voting power changes",
        "description": "Returns a list of voting power changes",
        "tags": [
          "proposals"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "accountId",
            "in": "path"
          },
          {
            "schema": {
              "type": "integer",
              "nullable": true,
              "minimum": 0,
              "default": 0
            },
            "required": false,
            "name": "skip",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "timestamp",
                "delta"
              ],
              "default": "timestamp"
            },
            "required": false,
            "name": "orderBy",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "required": false,
            "name": "orderDirection",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "minDelta",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "maxDelta",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved voting power changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "transactionHash": {
                            "type": "string"
                          },
                          "daoId": {
                            "type": "string"
                          },
                          "accountId": {
                            "type": "string"
                          },
                          "votingPower": {
                            "type": "string"
                          },
                          "delta": {
                            "type": "string"
                          },
                          "timestamp": {
                            "type": "string"
                          },
                          "logIndex": {
                            "type": "number"
                          },
                          "delegation": {
                            "type": "object",
                            "nullable": true,
                            "properties": {
                              "from": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "to": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "from",
                              "value",
                              "to"
                            ]
                          },
                          "transfer": {
                            "type": "object",
                            "nullable": true,
                            "properties": {
                              "value": {
                                "type": "string"
                              },
                              "from": {
                                "type": "string"
                              },
                              "to": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "value",
                              "from",
                              "to"
                            ]
                          }
                        },
                        "required": [
                          "transactionHash",
                          "daoId",
                          "accountId",
                          "votingPower",
                          "delta",
                          "timestamp",
                          "logIndex",
                          "delegation",
                          "transfer"
                        ]
                      }
                    },
                    "totalCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "totalCount"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/voting-powers/variations": {
      "get": {
        "operationId": "votingPowerVariations",
        "summary": "Get top changes in voting power for a given period",
        "description": "Returns a mapping of the biggest changes to voting power associated by delegate address",
        "tags": [
          "proposals"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ],
              "default": "90d"
            },
            "required": false,
            "name": "days",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "nullable": true,
              "minimum": 0,
              "default": 0
            },
            "required": false,
            "name": "skip",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "required": false,
            "name": "orderDirection",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved voting power changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "type": "object",
                      "properties": {
                        "days": {
                          "type": "string"
                        },
                        "startTimestamp": {
                          "type": "string"
                        },
                        "endTimestamp": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "days",
                        "startTimestamp",
                        "endTimestamp"
                      ]
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string"
                          },
                          "previousVotingPower": {
                            "type": "string",
                            "nullable": true
                          },
                          "currentVotingPower": {
                            "type": "string"
                          },
                          "absoluteChange": {
                            "type": "string"
                          },
                          "percentageChange": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "accountId",
                          "currentVotingPower",
                          "absoluteChange",
                          "percentageChange"
                        ]
                      }
                    }
                  },
                  "required": [
                    "period",
                    "items"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/voting-powers/{accountId}/variations": {
      "get": {
        "operationId": "votingPowerVariationsByAccountId",
        "summary": "Get top changes in voting power for a given period for a single account",
        "description": "Returns a the changes to voting power by period and accountId",
        "tags": [
          "proposals"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "accountId",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d",
                "90d",
                "180d",
                "365d"
              ],
              "default": "90d"
            },
            "required": false,
            "name": "days",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved voting power changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "type": "object",
                      "properties": {
                        "days": {
                          "type": "string"
                        },
                        "startTimestamp": {
                          "type": "string"
                        },
                        "endTimestamp": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "days",
                        "startTimestamp",
                        "endTimestamp"
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "accountId": {
                          "type": "string"
                        },
                        "previousVotingPower": {
                          "type": "string",
                          "nullable": true
                        },
                        "currentVotingPower": {
                          "type": "string"
                        },
                        "absoluteChange": {
                          "type": "string"
                        },
                        "percentageChange": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "accountId",
                        "currentVotingPower",
                        "absoluteChange",
                        "percentageChange"
                      ]
                    }
                  },
                  "required": [
                    "period",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/voting-powers": {
      "get": {
        "operationId": "votingPowers",
        "summary": "Get voting powers",
        "description": "Returns sorted and paginated account voting power records",
        "tags": [
          "proposals"
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "nullable": true,
              "minimum": 0,
              "default": 0
            },
            "required": false,
            "name": "skip",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "required": false,
            "name": "orderDirection",
            "in": "query"
          },
          {
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "default": []
            },
            "required": false,
            "name": "addresses",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "fromValue",
            "in": "query"
          },
          {
            "schema": {
              "type": "string"
            },
            "required": false,
            "name": "toValue",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved voting power changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string"
                          },
                          "votingPower": {
                            "type": "string"
                          },
                          "votesCount": {
                            "type": "number"
                          },
                          "proposalsCount": {
                            "type": "number"
                          },
                          "delegationsCount": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "accountId",
                          "votingPower",
                          "votesCount",
                          "proposalsCount",
                          "delegationsCount"
                        ]
                      }
                    },
                    "totalCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "totalCount"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/voting-powers/{accountId}": {
      "get": {
        "operationId": "votingPowerByAccountId",
        "summary": "Get account powers",
        "description": "Returns voting power information for a specific address (account)",
        "tags": [
          "proposals"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "required": true,
            "name": "accountId",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved voting power changes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accountId": {
                      "type": "string"
                    },
                    "votingPower": {
                      "type": "string"
                    },
                    "votesCount": {
                      "type": "number"
                    },
                    "proposalsCount": {
                      "type": "number"
                    },
                    "delegationsCount": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "accountId",
                    "votingPower",
                    "votesCount",
                    "proposalsCount",
                    "delegationsCount"
                  ]
                }
              }
            }
          }
        }
      }
    },
  },
}

@vercel
Copy link

vercel bot commented Dec 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Review Updated (UTC)
anticapture Ignored Ignored Preview Jan 7, 2026 9:09pm
anticapture-storybook Skipped Skipped Jan 7, 2026 9:09pm

@PedroBinotto PedroBinotto changed the title Chore/port power query to rest [DEV-200] Implement voting power rest endpoint Dec 22, 2025
@vercel vercel bot temporarily deployed to Preview – anticapture-storybook December 22, 2025 15:04 Inactive
@pikonha pikonha added the enhancement Improving an already existing feature label Jan 6, 2026
@vercel vercel bot temporarily deployed to Preview – anticapture-storybook January 7, 2026 21:09 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an already existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants