@boardroom/powerpool
Advanced tools
Comparing version 2.0.0-alpha.0 to 3.0.0-alpha.0
@@ -5,7 +5,201 @@ "use strict"; | ||
// THIS IS AN AUTOGENERATED FILE | ||
const load_files_1 = require("@graphql-tools/load-files"); | ||
const merge_1 = require("@graphql-tools/merge"); | ||
const path_1 = require("path"); | ||
const typeDefsFiles = load_files_1.loadFilesSync(path_1.join(__dirname, "./schema.graphql")); | ||
exports.typeDefs = merge_1.mergeTypeDefs(typeDefsFiles); | ||
const typeDefsString = `interface Delegate { | ||
id: ID! | ||
delegatedVotesRaw: String! | ||
delegatedVotes: String! | ||
votingPower: String! | ||
voteWeight: String! | ||
proposalsCreated: String! | ||
proposalsVoted: String! | ||
tokenHoldersRepresentedAmount: Int! | ||
quorum: String! | ||
cumulativePower: String! | ||
} | ||
interface Governance { | ||
protocol: String! | ||
hasDelegation: Boolean! | ||
hasStaking: Boolean! | ||
currentDelegates: Int | ||
currentTokenHolders: Int | ||
delegatedVotes: Int | ||
paidRewards: Float | ||
proposalsQueued: Int | ||
totalDelegates: Int | ||
totalTokenHolders: Int | ||
totalProposalCount: Int! | ||
totalVotes: Int | ||
totalVoterCount: Int | ||
totalStakers: Int | ||
totalStakedAmount: Float | ||
} | ||
enum ProposalStatus { | ||
active | ||
approved | ||
cancelled | ||
executed | ||
expired | ||
pending | ||
proposed | ||
rejected | ||
wip | ||
initializing | ||
voting | ||
validating | ||
} | ||
enum VoteType { | ||
offchain | ||
onchain | ||
} | ||
type ProposalStates { | ||
endTime: String! | ||
startTime: String! | ||
status: String! | ||
txHash: String! | ||
} | ||
type ProposalMetadata { | ||
authors: [String!] | ||
originalUrl: String | ||
} | ||
interface Proposal { | ||
id: ID! | ||
title: String | ||
description: String | ||
author: String | ||
} | ||
interface Protocol { | ||
name: String! | ||
needsStakeToVote: Boolean | ||
hasDelegation: Boolean | ||
stakingContract: String | ||
canPropose: Boolean | ||
iconUrl: String! | ||
iconWhite: String | ||
path: String! | ||
isNew: Boolean | ||
available: Boolean! | ||
description: String! | ||
suffix: String! | ||
hasSnapshot: Boolean! | ||
} | ||
interface Receipt { | ||
id: ID | ||
proposalId: ID! | ||
protocol: String! | ||
support: Boolean! | ||
} | ||
interface TokenHolder { | ||
id: ID! | ||
tokenBalanceRaw: Int! | ||
tokenBalance: Float! | ||
totalTokensHeldRaw: Int! | ||
totalTokensHeld: Float! | ||
} | ||
type Query { | ||
getPowerpoolProposals(pageSize: Int, filter: String): [PowerpoolProposal!]! | ||
getPowerpoolVoters(pageSize: Int, filter: String): [PowerpoolDelegate!]! | ||
getPowerpoolGovernance(pageSize: Int, filter: String): [PowerpoolGovernance!]! | ||
getPowerpoolReceipts(pageSize: Int, filter: String): [PowerpoolReceipt!]! | ||
getPowerpoolTokenHolders(pageSize: Int, filter: String): [PowerpoolTokenHolder!]! | ||
} | ||
type PowerpoolVote { | ||
id: ID! | ||
support: Boolean! | ||
votes: Float! | ||
voterId: Int! | ||
proposalId: Int! | ||
} | ||
type PowerpoolTokenHolder implements TokenHolder { | ||
id: ID! | ||
tokenBalanceRaw: Int! | ||
tokenBalance: Float! | ||
totalTokensHeldRaw: Int! | ||
totalTokensHeld: Float! | ||
delegateId: Int! | ||
} | ||
type PowerpoolReceipt implements Receipt { | ||
id: ID | ||
proposalId: ID! | ||
protocol: String! | ||
support: Boolean! | ||
votesRaw: Int! | ||
voterId: Int! | ||
votes: [String]! | ||
} | ||
type PowerpoolProposal implements Proposal { | ||
id: ID! | ||
title: String | ||
description: String | ||
author: String | ||
proposerId: Int! | ||
targets: [String!] | ||
values: [Int!] | ||
calldatas: [String!] | ||
executionETA: Int | ||
votes: [PowerpoolVote!]! | ||
startBlock: Int! | ||
endBlock: Int! | ||
status: String! | ||
} | ||
type PowerpoolGovernance implements Governance { | ||
protocol: String! | ||
hasDelegation: Boolean! | ||
hasStaking: Boolean! | ||
currentDelegates: Int | ||
currentTokenHolders: Int | ||
delegatedVotes: Int | ||
paidRewards: Float | ||
proposalsQueued: Int | ||
totalDelegates: Int | ||
totalTokenHolders: Int | ||
totalProposalCount: Int! | ||
totalVotes: Int | ||
totalVoterCount: Int | ||
totalStakers: Int | ||
totalStakedAmount: Float | ||
delegatedVotesRaw: Int! | ||
} | ||
type PowerpoolDelegate implements Delegate { | ||
id: ID! | ||
delegatedVotesRaw: String! | ||
delegatedVotes: String! | ||
votingPower: String! | ||
voteWeight: String! | ||
proposalsCreated: String! | ||
proposalsVoted: String! | ||
tokenHoldersRepresentedAmount: Int! | ||
quorum: String! | ||
cumulativePower: String! | ||
lpVotesRaw: Int! | ||
lpVotes: Float! | ||
lpVotesLast: Int! | ||
tokenHoldersRepresented: [PowerpoolTokenHolder!]! | ||
votes: [PowerpoolVote!]! | ||
proposalIds: [Int!]! | ||
name: String | ||
description: String | ||
website: String | ||
} | ||
schema { | ||
query: Query | ||
} | ||
`; | ||
exports.typeDefs = merge_1.mergeTypeDefs([typeDefsString]); | ||
//# sourceMappingURL=typeDefs.js.map |
@@ -7,2 +7,8 @@ export declare type Maybe<T> = T | null; | ||
}; | ||
export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & { | ||
[SubKey in K]?: Maybe<T[SubKey]>; | ||
}; | ||
export declare type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { | ||
[SubKey in K]: Maybe<T[SubKey]>; | ||
}; | ||
/** All built-in and custom scalars, mapped to their actual values */ | ||
@@ -9,0 +15,0 @@ export declare type Scalars = { |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -7,8 +16,7 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
exports.resolvers = exports.getTokenHoldersResolver = exports.getReceiptsResolver = exports.getGovernanceResolver = exports.getVotersResolver = exports.getProposalsResolver = void 0; | ||
const dist_1 = require("@boardroom/base/dist"); | ||
const base_1 = require("@boardroom/base"); | ||
const graphql_tag_1 = __importDefault(require("graphql-tag")); | ||
const dist_2 = require("../../base/dist"); | ||
const mappers_1 = require("./mappers"); | ||
const graphQLFetcher = new dist_1.GraphqlFetcher('https://api.thegraph.com/subgraphs/name/powerpool-finance/powerpool-governance'); | ||
const getProposalsResolver = async (_, args) => { | ||
const graphQLFetcher = new base_1.GraphqlFetcher('https://api.thegraph.com/subgraphs/name/powerpool-finance/powerpool-governance'); | ||
const getProposalsResolver = (_, args) => __awaiter(void 0, void 0, void 0, function* () { | ||
const query = graphql_tag_1.default ` | ||
@@ -44,8 +52,8 @@ { | ||
`; | ||
const data = await graphQLFetcher.query(query); | ||
const data = yield graphQLFetcher.query(query); | ||
const formattedProposals = data.proposals.map(mappers_1.proposalMapper); | ||
return formattedProposals; | ||
}; | ||
}); | ||
exports.getProposalsResolver = getProposalsResolver; | ||
const getVotersResolver = async (_, args) => { | ||
const getVotersResolver = (_, args) => __awaiter(void 0, void 0, void 0, function* () { | ||
const query = graphql_tag_1.default ` | ||
@@ -89,18 +97,14 @@ { | ||
`; | ||
const data = await graphQLFetcher.query(query); | ||
const data = yield graphQLFetcher.query(query); | ||
const addresses = data.delegates.map((v) => v.id); | ||
const metadata = await dist_1.get3BoxProfiles(addresses); | ||
const metadata = yield base_1.get3BoxProfiles(addresses); | ||
const combinedData = data.delegates.map((v) => { | ||
return { | ||
...v, | ||
name: metadata[v.id]?.name, | ||
description: metadata[v.id]?.description, | ||
website: metadata[v.id]?.website | ||
}; | ||
var _a, _b, _c; | ||
return Object.assign(Object.assign({}, v), { name: (_a = metadata[v.id]) === null || _a === void 0 ? void 0 : _a.name, description: (_b = metadata[v.id]) === null || _b === void 0 ? void 0 : _b.description, website: (_c = metadata[v.id]) === null || _c === void 0 ? void 0 : _c.website }); | ||
}); | ||
const formattedDelegates = combinedData.map(mappers_1.delegateMapper); | ||
return dist_2.setQuorum(formattedDelegates); | ||
}; | ||
return base_1.setQuorum(formattedDelegates); | ||
}); | ||
exports.getVotersResolver = getVotersResolver; | ||
const getGovernanceResolver = async (_, args) => { | ||
const getGovernanceResolver = (_, args) => __awaiter(void 0, void 0, void 0, function* () { | ||
const query = graphql_tag_1.default ` | ||
@@ -120,8 +124,8 @@ { | ||
`; | ||
const data = await graphQLFetcher.query(query); | ||
const data = yield graphQLFetcher.query(query); | ||
const formatteboardroomernance = data.governances.map(mappers_1.governanceMapper); | ||
return formatteboardroomernance; | ||
}; | ||
}); | ||
exports.getGovernanceResolver = getGovernanceResolver; | ||
const getReceiptsResolver = async (_, args) => { | ||
const getReceiptsResolver = (_, args) => __awaiter(void 0, void 0, void 0, function* () { | ||
const query = graphql_tag_1.default ` | ||
@@ -143,8 +147,8 @@ { | ||
`; | ||
const data = await graphQLFetcher.query(query); | ||
const data = yield graphQLFetcher.query(query); | ||
const formattedReceipts = data.votes.map(mappers_1.receiptMapper); | ||
return formattedReceipts; | ||
}; | ||
}); | ||
exports.getReceiptsResolver = getReceiptsResolver; | ||
const getTokenHoldersResolver = async (_, args) => { | ||
const getTokenHoldersResolver = (_, args) => __awaiter(void 0, void 0, void 0, function* () { | ||
const query = graphql_tag_1.default ` | ||
@@ -164,16 +168,16 @@ { | ||
`; | ||
const data = await graphQLFetcher.query(query); | ||
const data = yield graphQLFetcher.query(query); | ||
const formattedTokenHolders = data.tokenHolders.map(mappers_1.tokenHolderMapper); | ||
return formattedTokenHolders; | ||
}; | ||
}); | ||
exports.getTokenHoldersResolver = getTokenHoldersResolver; | ||
exports.resolvers = { | ||
Query: { | ||
getProposals: dist_1.addFilter(exports.getProposalsResolver), | ||
getVoters: dist_1.addFilter(exports.getVotersResolver), | ||
getGovernance: dist_1.addFilter(exports.getGovernanceResolver), | ||
getReceipts: dist_1.addFilter(exports.getReceiptsResolver), | ||
getTokenHolders: dist_1.addFilter(exports.getTokenHoldersResolver) | ||
getProposals: base_1.addFilter(exports.getProposalsResolver), | ||
getVoters: base_1.addFilter(exports.getVotersResolver), | ||
getGovernance: base_1.addFilter(exports.getGovernanceResolver), | ||
getReceipts: base_1.addFilter(exports.getReceiptsResolver), | ||
getTokenHolders: base_1.addFilter(exports.getTokenHoldersResolver) | ||
}, | ||
}; | ||
//# sourceMappingURL=resolvers.js.map |
{ | ||
"name": "@boardroom/powerpool", | ||
"version": "2.0.0-alpha.0", | ||
"version": "3.0.0-alpha.0", | ||
"main": "./dist/index.js", | ||
@@ -11,3 +11,5 @@ "files": [ | ||
"build": "rm -rf dist && tsc -p . && npm run copy:generated", | ||
"copy:generated": "copyfiles -u 2 ./src/generated/*.graphql ./dist/generated/ && copyfiles -u 4 ./src/generated/operations/queries/* ./dist/generated/operations/queries/", | ||
"copy:generated": "copyfiles -u 2 ./src/generated/*.graphql ./dist/generated/ && npm run copy:queries && npm run copy:mutations", | ||
"copy:queries": "copyfiles -u 4 ./src/generated/operations/queries/* ./dist/generated/operations/queries/", | ||
"copy:mutations": "copyfiles -u 4 ./src/generated/operations/mutations/* ./dist/generated/operations/mutations/", | ||
"test": "jest --runInBand" | ||
@@ -17,3 +19,3 @@ }, | ||
"dependencies": { | ||
"@boardroom/base": "^2.0.0-alpha.0", | ||
"@boardroom/base": "^3.0.0-alpha.0", | ||
"graphql": "^15.3.0", | ||
@@ -26,3 +28,3 @@ "graphql-tag": "^1.0.0" | ||
"copyfiles": "^2.3.0", | ||
"jest": "^26.4.2", | ||
"jest": "^24.9.0", | ||
"node-fetch": "^2.6.1", | ||
@@ -43,3 +45,3 @@ "ts-jest": "^26.4.0", | ||
}, | ||
"gitHead": "045b162bbfe402f0a3fc6655c7eef7614a174da8" | ||
"gitHead": "77009a3b97cec7ff988c3ef5ffeeef907285a15f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
45565
924
1
27
+ Added@boardroom/base@3.0.0-alpha.0(transitive)
- Removed@boardroom/base@2.0.0-alpha.0(transitive)