Skip to content

Commit

Permalink
feat(governance): add new endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
1000101 committed Jan 20, 2024
1 parent 8fc2c36 commit 03dcf5d
Show file tree
Hide file tree
Showing 26 changed files with 2,175 additions and 79 deletions.
592 changes: 592 additions & 0 deletions openapi.json

Large diffs are not rendered by default.

425 changes: 425 additions & 0 deletions openapi.yaml

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@ paths:

# governance

# /governance/actions:
# $ref: ./paths/api/governance/actions.yaml

/governance/dreps:
$ref: ./paths/api/governance/dreps/index.yaml

Expand All @@ -342,17 +339,20 @@ paths:
/governance/dreps/{drep_id}/updates:
$ref: ./paths/api/governance/dreps/{drep_id}/updates.yaml

# /governance/proposals:
# $ref: ./paths/api/governance/proposals/index.yaml
/governance/dreps/{drep_id}/votes:
$ref: ./paths/api/governance/dreps/{drep_id}/votes.yaml

/governance/proposals:
$ref: ./paths/api/governance/proposals/index.yaml

# /governance/proposals/voting:
# $ref: ./paths/api/governance/proposals/voting.yaml
/governance/proposals/{tx_hash}/{tx_index}:
$ref: ./paths/api/governance/proposals/{tx_hash}/{tx_index}/index.yaml

# /governance/treasury:
# $ref: ./paths/api/governance/treasury.yaml
/governance/proposals/{tx_hash}/{tx_index}/votes:
$ref: ./paths/api/governance/proposals/{tx_hash}/{tx_index}/votes.yaml

# /governance/voting:
# $ref: ./paths/api/governance/voting.yaml
/governance/votes:
$ref: ./paths/api/governance/votes.yaml

# epochs

Expand Down
311 changes: 311 additions & 0 deletions src/generated-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,182 @@ export interface paths {
};
};
};
"/governance/dreps/{drep_id}/votes": {
/**
* DRep votes
* @description History of Drep votes.
*/
get: {
parameters: {
query?: {
/** @description The number of results displayed on one page. */
count?: number;
/** @description The page number for listing the results. */
page?: number;
/**
* @description The ordering of items from the point of view of the blockchain,
* not the page listing itself. By default, we return oldest first, newest last.
*/
order?: "asc" | "desc";
};
path: {
/**
* @description Bech32 or hexadecimal drep ID.
* @example drep1mvdu8slennngja7w4un6knwezufra70887zuxpprd64jxfveahn
*/
drep_id: string;
};
};
responses: {
/** @description Return the DRep votes */
200: {
content: {
"application/json": components["schemas"]["drep_votes"];
};
};
400: components["responses"]["400"];
403: components["responses"]["403"];
418: components["responses"]["418"];
429: components["responses"]["429"];
500: components["responses"]["500"];
};
};
};
"/governance/proposals": {
/**
* Proposals
* @description Return the information about Proposals
*/
get: {
parameters: {
query?: {
/** @description The number of results displayed on one page. */
count?: number;
/** @description The page number for listing the results. */
page?: number;
/**
* @description The ordering of items from the point of view of the blockchain,
* not the page listing itself. By default, we return oldest first, newest last.
* Ordering in this case is based on the time of the first mint transaction.
*/
order?: "asc" | "desc";
};
};
responses: {
/** @description Paginated array with the proposal data */
200: {
content: {
"application/json": components["schemas"]["proposal_content"];
};
};
400: components["responses"]["400"];
403: components["responses"]["403"];
418: components["responses"]["418"];
429: components["responses"]["429"];
500: components["responses"]["500"];
};
};
};
"/governance/proposals/{tx_hash}/{tx_index}": {
/**
* Specific proposal
* @description Proposal information.
*/
get: {
parameters: {
path: {
/**
* @description Transaction hash.
* @example drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc
*/
tx_hash: string;
/**
* @description Transaction index.
* @example 1
*/
tx_index: number;
};
};
responses: {
/** @description Return the proposal information content */
200: {
content: {
"application/json": components["schemas"]["proposal_details_content"];
};
};
400: components["responses"]["400"];
403: components["responses"]["403"];
418: components["responses"]["418"];
429: components["responses"]["429"];
500: components["responses"]["500"];
};
};
};
"/governance/proposals/{tx_hash}/{tx_index}/votes": {
/**
* Proposal votes
* @description History of Proposal votes.
*/
get: {
parameters: {
query?: {
/** @description The number of results displayed on one page. */
count?: number;
/** @description The page number for listing the results. */
page?: number;
/**
* @description The ordering of items from the point of view of the blockchain,
* not the page listing itself. By default, we return oldest first, newest last.
*/
order?: "asc" | "desc";
};
path: {
/**
* @description Transaction hash.
* @example drep15cfxz9exyn5rx0807zvxfrvslrjqfchrd4d47kv9e0f46uedqtc
*/
tx_hash: string;
/**
* @description Transaction index.
* @example 1
*/
tx_index: number;
};
};
responses: {
/** @description Return the Proposal votes */
200: {
content: {
"application/json": components["schemas"]["proposal_details_votes"];
};
};
400: components["responses"]["400"];
403: components["responses"]["403"];
418: components["responses"]["418"];
429: components["responses"]["429"];
500: components["responses"]["500"];
};
};
};
"/governance/votes": {
/**
* xxx
* @description xxx
*/
get: {
responses: {
/** @description Return the voting parameters. */
200: {
content: never;
};
400: components["responses"]["400"];
403: components["responses"]["403"];
418: components["responses"]["418"];
429: components["responses"]["429"];
500: components["responses"]["500"];
};
};
};
"/epochs/latest": {
/**
* Latest epoch
Expand Down Expand Up @@ -4146,6 +4322,141 @@ export interface components {
*/
action: "registered" | "deregistered";
})[];
/**
* @example [
* {
* "tx_hash": "b302de601defdf11a5261ed31a263804dac4a582a888c998ce24dec5",
* "tx_index": 2,
* "voter_role": "spo",
* "committee_voter_hash": null,
* "vote": "yes"
* },
* {
* "tx_hash": "b302de601defdf11a5261ed31a263804dac4a582a888c998ce24dec5",
* "tx_index": 3,
* "voter_role": "constitutional_committee",
* "committee_voter_hash": "53a42debdc7ffd90085ab7fd9800b63e6d1c9ac481ba6eb7b6a844e4",
* "vote": "abstain"
* }
* ]
*/
drep_votes: ({
/** @description Hash of the transaction. */
tx_hash: string;
/** @description Transaction index within the block. */
tx_index: number;
/**
* @description The role of the voter. Can be one of ConstitutionalCommittee, DRep, SPO.
* @enum {string}
*/
voter_role: "constitutional_committee" | "drep" | "spo";
committee_voter_hash: string | null;
/**
* @description The Vote. Can be one of yes, no, abstain.
* @enum {string}
*/
vote: "yes" | "no" | "abstain";
})[];
/**
* @example [
* {
* "tx_hash": "2dd15e0ef6e6a17841cb9541c27724072ce4d4b79b91e58432fbaa32d9572531",
* "tx_index": 1,
* "governance_type": "TreasuryWithdrawals"
* },
* {
* "tx_hash": "71317e951b20aa46e9fbf45a46a6e950d5723a481225519655bf6c60",
* "tx_index": 4,
* "governance_type": "NoConfidence"
* }
* ]
*/
proposal_content: {
/** @description Hash of the transaction. */
tx_hash: string;
/** @description Transaction index within the block. */
tx_index: number;
/** @description Type of proposal. */
governance_type: string;
}[];
/**
* @example [
* {
* "tx_hash": "2dd15e0ef6e6a17841cb9541c27724072ce4d4b79b91e58432fbaa32d9572531",
* "tx_index": 1,
* "governance_type": "TreasuryWithdrawals",
* "deposit": 12000,
* "return_address": "stake_test1urd3hs7rlxwwdzthe6hj026dmyt3y0heuulctscyydh2kgck6nkmz",
* "description": "TreasuryWithdrawals (fromList [(RewardAcnt {getRwdNetwork = Testnet, getRwdCred = KeyHashObj (KeyHash \"71317e951b20aa46e9fbf45a46a6e950d5723a481225519655bf6c60\")},Coin 20000000)])",
* "ratified_epoch": null,
* "enacted_epoch": 123,
* "dropped_epoch": null,
* "expired_epoch": null,
* "expiration": 120,
* "anchor_url": "https://gist.github.com/123",
* "anchor_hash": "50b340624d49823720505e3f0095be0d6cd8f26501e094a6ab9068dd"
* }
* ]
*/
proposal_details_content: {
/** @description Hash of the transaction. */
tx_hash: string;
/** @description Transaction index within the block. */
tx_index: number;
/** @description Type of proposal. */
governance_type: string;
/** @description A Text describing the content of this GovActionProposal in a readable way. */
governance_description?: string;
/** @description The deposit amount paid for this proposal. */
deposit: string;
/** @description Bech32 stake address of the reward address to receive the deposit when it is repaid. */
return_address: string;
ratified_epoch: number | null;
enacted_epoch: number | null;
dropped_epoch: number | null;
expired_epoch: number | null;
/** @description Shows the epoch at which this governance action will expire. */
expiration: number;
/** @description The URL of the offchain anchor data. */
anchor_url: string | null;
/** @description The hash of the offchain anchor data. */
anchor_hash: string | null;
};
/**
* @example [
* {
* "tx_hash": "b302de601defdf11a5261ed31a263804dac4a582a888c998ce24dec5",
* "tx_index": 2,
* "voter_role": "spo",
* "committee_voter_hash": null,
* "vote": "yes"
* },
* {
* "tx_hash": "b302de601defdf11a5261ed31a263804dac4a582a888c998ce24dec5",
* "tx_index": 3,
* "voter_role": "constitutional_committee",
* "committee_voter_hash": "53a42debdc7ffd90085ab7fd9800b63e6d1c9ac481ba6eb7b6a844e4",
* "vote": "abstain"
* }
* ]
*/
proposal_details_votes: ({
/** @description Hash of the transaction. */
tx_hash?: string;
/** @description Transaction index within the block. */
tx_index?: number;
/**
* @description The role of the voter. Can be one of ConstitutionalCommittee, DRep, SPO.
* @enum {string}
*/
voter_role?: "constitutional_committee" | "drep" | "spo";
committee_voter_hash?: string | null;
/**
* @description The Vote. Can be one of yes, no, abstain.
* @enum {string}
*/
vote?: "yes" | "no" | "abstain";
})[];
epoch_content: {
/**
* @description Epoch number
Expand Down
12 changes: 6 additions & 6 deletions src/paths/api/governance/dreps/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ get:
not the page listing itself. By default, we return oldest first, newest last.
Ordering in this case is based on the time of the first mint transaction.
responses:
'200':
"200":
description: Paginated array with the Delegate Representatives (DReps) data
content:
application/json:
schema:
$ref: ../../../../schemas/governance/drep_content.yaml
'400':
"400":
$ref: ../../../../responses/errors/400.yaml
'403':
"403":
$ref: ../../../../responses/errors/403.yaml
'429':
"429":
$ref: ../../../../responses/errors/429.yaml
'418':
"418":
$ref: ../../../../responses/errors/418.yaml
'500':
"500":
$ref: ../../../../responses/errors/500.yaml
Loading

0 comments on commit 03dcf5d

Please sign in to comment.