Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion apps/api-gateway/meshrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export default processConfig(
},
},
transforms: [
{
filterSchema: {
filters: [
'Query.!{accountBalance}',
'Query.!{accountBalances}'
]
}
},
{
rename: {
renames: [
Expand Down Expand Up @@ -57,7 +65,7 @@ export default processConfig(
];
}),
],
additionalTypeDefs:`
additionalTypeDefs: `
type AverageDelegationPercentageItem {
date: String!
high: String!
Expand Down
1 change: 1 addition & 0 deletions apps/api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@graphql-mesh/openapi": "^0.109.8",
"@graphql-mesh/runtime": "^0.106.3",
"@graphql-mesh/transform-rename": "^0.105.7",
"@graphql-mesh/transform-filter-schema": "^0.104.18",
"@graphql-mesh/types": "^0.104.3",
"dotenv": "^16.5.0",
"graphql": "^16.11.0"
Expand Down
117 changes: 60 additions & 57 deletions apps/api-gateway/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ directive @httpOperation(subgraph: String, path: String, operationSpecificHeader
directive @transport(subgraph: String, kind: String, location: String, headers: [[String]], queryStringOptions: ObjMap, queryParams: [[String]]) repeatable on SCHEMA

type Query {
"""Get property data for a specific token"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/token`\nGet property data for a specific token\n"
token(currency: queryInput_token_currency = usd): token_200_response
tokens(where: tokenFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): tokenPage!
account(id: String!): account
accounts(where: accountFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): accountPage!
accountBalance(accountId: String!, tokenId: String!): accountBalance
accountBalances(where: accountBalanceFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): accountBalancePage!
accountPower(accountId: String!): accountPower
accountPowers(where: accountPowerFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): accountPowerPage!
votingPowerHistory(transactionHash: String!, accountId: String!, logIndex: Float!): votingPowerHistory
Expand All @@ -38,72 +36,61 @@ type Query {
tokenPrices(where: tokenPriceFilter, orderBy: String, orderDirection: String, before: String, after: String, limit: Int): tokenPricePage!
_meta: Meta

"""Get total assets"""
totalAssets(days: queryInput_totalAssets_days = _7d): [query_totalAssets_items]

"""Get historical market data for a specific token"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/token/historical-data`\nGet historical market data for a specific token\n"
historicalTokenData(skip: NonNegativeInt, limit: Float = 365): [query_historicalTokenData_items]

"""Compare total supply between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/total-supply/compare`\nCompare total supply between periods\n"
compareTotalSupply(days: queryInput_compareTotalSupply_days = _90d): compareTotalSupply_200_response

"""Compare delegated supply between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/delegated-supply/compare`\nCompare delegated supply between periods\n"
compareDelegatedSupply(days: queryInput_compareDelegatedSupply_days = _90d): compareDelegatedSupply_200_response

"""Compare circulating supply between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/circulating-supply/compare`\nCompare circulating supply between periods\n"
compareCirculatingSupply(days: queryInput_compareCirculatingSupply_days = _90d): compareCirculatingSupply_200_response

"""Compare treasury between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/treasury/compare`\nCompare treasury between periods\n"
compareTreasury(days: queryInput_compareTreasury_days = _90d): compareTreasury_200_response

"""Compare cex supply between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/cex-supply/compare`\nCompare cex supply between periods\n"
compareCexSupply(days: queryInput_compareCexSupply_days = _90d): compareCexSupply_200_response

"""Compare dex supply between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/dex-supply/compare`\nCompare dex supply between periods\n"
compareDexSupply(days: queryInput_compareDexSupply_days = _90d): compareDexSupply_200_response

"""Compare lending supply between periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/lending-supply/compare`\nCompare lending supply between periods\n"
compareLendingSupply(days: queryInput_compareLendingSupply_days = _90d): compareLendingSupply_200_response

"""Get active token supply for DAO"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/active-supply/compare`\nGet active token supply for DAO\n"
compareActiveSupply(days: queryInput_compareActiveSupply_days = _90d): compareActiveSupply_200_response

"""Compare number of proposals between time periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/compare`\nCompare number of proposals between time periods\n"
compareProposals(days: queryInput_compareProposals_days = _90d): compareProposals_200_response

"""Compare number of votes between time periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/votes/compare`\nCompare number of votes between time periods\n"
compareVotes(days: queryInput_compareVotes_days = _90d): compareVotes_200_response

"""Compare average turnout between time periods"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/average-turnout/compare`\nCompare average turnout between time periods\n"
compareAverageTurnout(days: queryInput_compareAverageTurnout_days = _90d): compareAverageTurnout_200_response

"""
Returns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window
"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals-activity`\nReturns proposal activity data including voting history, win rates, and detailed proposal information for the specified delegate within the given time window\n"
proposalsActivity(address: String!, fromDate: NonNegativeInt, skip: NonNegativeInt, limit: PositiveInt = 10, orderBy: queryInput_proposalsActivity_orderBy = timestamp, orderDirection: queryInput_proposalsActivity_orderDirection = desc, userVoteFilter: queryInput_proposalsActivity_userVoteFilter): proposalsActivity_200_response

"""Returns a list of proposal"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals`\nReturns a list of proposal\n"
proposals(skip: NonNegativeInt, limit: PositiveInt = 10, orderDirection: queryInput_proposals_orderDirection = desc, status: JSON, fromDate: Float, fromEndDate: Float, includeOptimisticProposals: queryInput_proposals_includeOptimisticProposals = TRUE): proposals_200_response

"""Returns a single proposal by its ID"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/{args.id}`\nReturns a single proposal by its ID\n"
proposal(id: String!): proposal_200_response

"""Returns the active delegates that did not vote on a given proposal"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/proposals/{args.id}/non-voters`\nReturns the active delegates that did not vote on a given proposal\n"
proposalNonVoters(id: String!, skip: NonNegativeInt, limit: PositiveInt = 10, orderDirection: queryInput_proposalNonVoters_orderDirection = desc, addresses: JSON): proposalNonVoters_200_response

"""
Fetch historical token balances for multiple addresses at a specific time period using multicall
"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/account-balances/historical`\nFetch historical token balances for multiple addresses at a specific time period using multicall\n"
historicalBalances(addresses: JSON!, days: queryInput_historicalBalances_days = _7d): [query_historicalBalances_items]

"""
Fetch historical voting power for multiple addresses at a specific time period using multicall
"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/historical-voting-power`\nFetch historical voting power for multiple addresses at a specific time period using multicall\n"
historicalVotingPower(addresses: JSON!, days: queryInput_historicalVotingPower_days = _7d, fromDate: Float): [query_historicalVotingPower_items]

"""
Get transactions with their associated transfers and delegations, with optional filtering and sorting
"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/transactions`\nGet transactions with their associated transfers and delegations, with optional filtering and sorting\n"
transactions(
limit: PositiveInt = 50
offset: NonNegativeInt
Expand All @@ -125,32 +112,37 @@ type Query {
includes: JSON
): transactions_200_response

"""Get the last update time"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/last-update`\nGet the last update time\n"
lastUpdate(chart: queryInput_lastUpdate_chart!): lastUpdate_200_response

"""Get delegation percentage day buckets with forward-fill"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/delegation-percentage`\nGet delegation percentage day buckets with forward-fill\n"
delegationPercentageByDay(startDate: String, endDate: String, orderDirection: queryInput_delegationPercentageByDay_orderDirection = asc, limit: NonNegativeInt = 365, after: String, before: String): delegationPercentageByDay_200_response

"""Returns a list of voting power changes"""
votingPowers(account: String!, fromAddresses: JSON, toAddresses: JSON, skip: NonNegativeInt, limit: PositiveInt = 10, orderBy: queryInput_votingPowers_orderBy = timestamp, orderDirection: queryInput_votingPowers_orderDirection = desc, minDelta: String, maxDelta: String): votingPowers_200_response
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/voting-powers`\nReturns a list of voting power changes\n"
votingPowers(account: String!, skip: NonNegativeInt, limit: PositiveInt = 10, orderBy: queryInput_votingPowers_orderBy = timestamp, orderDirection: queryInput_votingPowers_orderDirection = desc, minDelta: String, maxDelta: String): votingPowers_200_response

"""
Returns a mapping of the biggest changes to voting power associated by delegate address
"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/voting-power/variations`\nReturns a mapping of the biggest changes to voting power associated by delegate address\n"
votingPowerVariations(days: queryInput_votingPowerVariations_days = _90d, limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_votingPowerVariations_orderDirection = desc): votingPowerVariations_200_response

"""
Returns a mapping of the biggest variations to account balances associated by account address
"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/account-balance/variations`\nReturns a mapping of the biggest variations to account balances associated by account address\n"
accountBalanceVariations(days: queryInput_accountBalanceVariations_days = _90d, limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountBalanceVariations_orderDirection = desc): accountBalanceVariations_200_response

"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/account-balances`\nReturns account balances\n"
accountBalances(limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountBalances_orderDirection = desc, addresses: [String] = [], delegates: [String] = [], balanceGreaterThan: String, balanceLessThan: String): accountBalances_200_response

"""
Returns a mapping of the largest interactions between accounts.
Positive amounts signify net token transfers FROM <accountId>, whilst negative amounts refer to net transfers TO <accountId>
"""
accountInteractions(days: queryInput_accountInteractions_days = _90d, limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountInteractions_orderDirection = desc, accountId: String!, minAmount: String, maxAmount: String, orderBy: queryInput_accountInteractions_orderBy = count, address: String): accountInteractions_200_response

"""Returns current governance parameters for this DAO"""
"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/account-balances/{args.accountId}`\nReturns account balance\n"
accountBalanceByAccountId(accountId: String!): accountBalanceByAccountId_200_response

"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/account-balance/interactions`\nReturns a mapping of the largest interactions between accounts. \nPositive amounts signify net token transfers FROM <accountId>, whilst negative amounts refer to net transfers TO <accountId>\n"
accountInteractions(days: queryInput_accountInteractions_days = _90d, limit: PositiveInt = 20, skip: NonNegativeInt, orderDirection: queryInput_accountInteractions_orderDirection = desc, accountId: String!, minAmount: String, maxAmount: String, orderBy: queryInput_accountInteractions_orderBy = count, address: String): accountInteractions_200_response

"\n>**Method**: `GET`\n>**Base URL**: `http://localhost:42069`\n>**Path**: `/dao`\nReturns current governance parameters for this DAO\n"
dao: dao_200_response

"""
Expand Down Expand Up @@ -1330,19 +1322,6 @@ input tokenPriceFilter {
timestamp_lte: BigInt
}

type query_totalAssets_items {
totalAssets: String!
date: String!
}

enum queryInput_totalAssets_days {
_7d
_30d
_90d
_180d
_365d
}

type query_historicalTokenData_items {
price: String!
timestamp: Float!
Expand Down Expand Up @@ -1884,6 +1863,30 @@ enum queryInput_accountBalanceVariations_orderDirection {
desc
}

type accountBalances_200_response {
items: [query_accountBalances_items_items]!
totalCount: Float!
}

type query_accountBalances_items_items {
accountId: String!
balance: String!
tokenId: String!
delegate: String!
}

enum queryInput_accountBalances_orderDirection {
asc
desc
}

type accountBalanceByAccountId_200_response {
accountId: String!
balance: String!
tokenId: String!
delegate: String!
}

type accountInteractions_200_response {
period: query_accountInteractions_period!
totalCount: Float!
Expand Down
1 change: 0 additions & 1 deletion apps/api-gateway/src/resolvers/item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const daoItemQueries = [
"account",
"accountBalance",
"accountPower",
"daoMetricsDayBucket",
"delegation",
Expand Down
1 change: 0 additions & 1 deletion apps/api-gateway/src/resolvers/list.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

const daoListQueries = [
'accountBalances',
'accountPowers',
'accounts',
'daoMetricsDayBuckets',
Expand Down
20 changes: 11 additions & 9 deletions apps/api-gateway/src/resolvers/rest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const daoItemQueries = [
'accountInteractions',
"accountBalanceByAccountId",
"accountBalanceVariations",
"accountBalances",
"accountInteractions",
"compareActiveSupply",
"compareAverageTurnout",
"compareCexSupply",
Expand All @@ -11,23 +14,22 @@ const daoItemQueries = [
"compareTotalSupply",
"compareTreasury",
"compareVotes",
"dao",
"delegationPercentageByDay",
"getTotalAssets",
"getVotingPower",
"historicalTokenData",
"proposalsActivity",
"historicalBalances",
"historicalTokenData",
"historicalVotingPower",
"proposals",
"transactions",
"lastUpdate",
"proposal",
"votingPowers",
"proposalNonVoters",
"proposals",
"proposalsActivity",
"token",
"transactions",
"votingPowerVariations",
"accountBalanceVariations",
"delegationPercentageByDay",
"dao",
"votingPowers",
];

export const restResolvers = daoItemQueries.reduce((acc, fieldName) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export function historicalBalances(
createRoute({
method: "get",
operationId: "historicalBalances",
path: "/historical-balances",
path: "/account-balances/historical",
summary: "Get historical token balances",
description:
"Fetch historical token balances for multiple addresses at a specific time period using multicall",
tags: ["historical-onchain"],
tags: ["account-balances"],
request: {
query: z.object({
addresses: z
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./historical-balances";
export * from "./interactions";
export * from "./variations";
export * from "./listing";
Loading
Loading