-
Notifications
You must be signed in to change notification settings - Fork 2
[DEV-200] Implement voting power rest endpoint #1500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PedroBinotto
wants to merge
10
commits into
dev
Choose a base branch
from
chore/port-power-query-to-rest
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+819
−492
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
…into chore/port-power-query-to-rest
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removed Endpoints
accountPowerfrom item queriesvotingPowerHistoryfrom item queriesaccountPowersfrom list queriesvotingPowerHistorysfrom list querieshistoricalVotingPowersfrom rest queriesAdded/Reorganized Endpoints
votingPowerstohistoricalVotingPowersvotingPowersendpointvotingPowerByAccountIdendpointvotingPowerVariationsByAccountIdendpointChangelog
votingPowerByAccountId:accountId(required param): index by account address;{ accountId, votingPower, votesCount, proposalsCount, delegationsCount };votingPowers: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);items: Array of resulting items, including{ accountId, votingPower, votesCount, proposalsCount, delegationsCount };totalCount: total number of hits given filter parameters;votingPowerVariationsByAccountId:accountId(required param): index by account address;days(required param): variation period;data: Resulting item, including{ accountId, previousVotingPower, currentVotingPower, absoluteChange, percentageChange };period: Time period data relating to the query, containing{ days, startTimestamp, endTimestamp };historicalVotingPower: (RENAME) oldvotingPowersendpoint;Query.accountPower(ponder auto-generated):GetAccountPowerGQL Query:useVoterInforeact hook:GetDelegatorVotingPowerDetails:useVotingPowerreact hook:useVotingPowerDatareact hook:Query.accountPowers(ponder auto-generated):GetDelegatesGQL Query:useDaoOverviewDatareact hook:useDelegatesreact hook:GetDelegatesCountGQL Query:useDelegatesreact hook:GetVetoCouncilVotingPowerGQL Query:useVetoCouncilVotingPowerreact hook:Query.votingPowerHistory(ponder auto-generated):Query.votingPowerHistorys(ponder auto-generated):GetDelegateDelegationHistoryGQL Query (dead code);GetDelegateDelegationHistoryDeltaRangeGQL Query (dead code);GetDelegateDelegationHistoryGraphGQL Query:useDelegateDelegationHistoryGraphreact hook:Query.historicalVotingPower(old endpoint):GetHistoricalVotingAndActivityGQL Query:useDelegatesreact hook:GetVotingPowerChangeGQL Query:useVotesreact hook:Resource correspondence
Migration from the old queries to the new REST endpoints could me implemented according to the following relation:
Query.accountPowervotingPowerByAccountId(/voting-powers/{address})Query.accountPowersvotingPowers(/voting-powers)Query.votingPowershistoricalVotingPowers(/voting-powers/{address}/historical)Query.votingPowerHistoryshistoricalVotingPowers(/voting-powers/{address}/historical)Query.historicalVotingPowervotingPowerVariationsByAccountId(/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" ] } } } } } } }, }, }