@boardroom/powerpool
Advanced tools
Comparing version 1.0.0-alpha.4 to 2.0.0-alpha.0
@@ -1,5 +0,5 @@ | ||
export declare const getPowerpoolProposals = "\n query getPowerpoolProposals {\n getPowerpoolProposals (filter: $filter) @client {\n id\n title\n description\n author\n proposerId\n targets\n values\n calldatas\n executionETA\n votes{\n id\n support\n votes\n voterId\n proposalId\n }\n }\n}\n "; | ||
export declare const getPowerpoolDelegates = "\n query getPowerpoolDelegates {\n getPowerpoolDelegates (filter: $filter) @client {\n lpVotesRaw\n lpVotes\n lpVotesLast\n tokenHoldersRepresented{\n id\n tokenBalanceRaw\n tokenBalance\n totalTokensHeldRaw\n totalTokensHeld\n delegateId\n }\n votes{\n id\n support\n votes\n voterId\n proposalId\n }\n proposalIds\n }\n}\n "; | ||
export declare const getPowerpoolGovernance = "\n query getPowerpoolGovernance {\n getPowerpoolGovernance (filter: $filter) @client {\n protocol\n hasDelegation\n hasStaking\n currentDelegates\n currentTokenHolders\n delegatedVotes\n paidRewards\n proposalsQueued\n totalDelegates\n totalTokenHolders\n totalProposalCount\n totalVotes\n totalVoterCount\n totalStakers\n totalStakedAmount\n id\n proposals\n currentLPDelegates\n delegatedVotesRaw\n }\n}\n "; | ||
export declare const getPowerpoolReceipts = "\n query getPowerpoolReceipts {\n getPowerpoolReceipts (filter: $filter) @client {\n id\n proposalId\n protocol\n support\n votesRaw\n voterId\n votes\n }\n}\n "; | ||
export declare const getPowerpoolTokenHolders = "\n query getPowerpoolTokenHolders {\n getPowerpoolTokenHolders (filter: $filter) @client {\n id\n tokenBalanceRaw\n tokenBalance\n totalTokensHeldRaw\n totalTokensHeld\n delegateId\n }\n}\n "; | ||
export declare const getPowerpoolProposals = "\n query getPowerpoolProposals {\n getPowerpoolProposals (pageSize: $pageSize, filter: $filter) @client {\n id\n title\n description\n author\n proposerId\n targets\n values\n calldatas\n executionETA\n votes{\n id\n support\n votes\n voterId\n proposalId\n }\n startBlock\n endBlock\n status\n }\n}\n "; | ||
export declare const getPowerpoolVoters = "\n query getPowerpoolVoters {\n getPowerpoolVoters (pageSize: $pageSize, filter: $filter) @client {\n id\n delegatedVotesRaw\n delegatedVotes\n votingPower\n voteWeight\n proposalsCreated\n proposalsVoted\n tokenHoldersRepresentedAmount\n quorum\n cumulativePower\n lpVotesRaw\n lpVotes\n lpVotesLast\n tokenHoldersRepresented{\n id\n tokenBalanceRaw\n tokenBalance\n totalTokensHeldRaw\n totalTokensHeld\n delegateId\n }\n votes{\n id\n support\n votes\n voterId\n proposalId\n }\n proposalIds\n name\n description\n website\n }\n}\n "; | ||
export declare const getPowerpoolGovernance = "\n query getPowerpoolGovernance {\n getPowerpoolGovernance (pageSize: $pageSize, filter: $filter) @client {\n protocol\n hasDelegation\n hasStaking\n currentDelegates\n currentTokenHolders\n delegatedVotes\n paidRewards\n proposalsQueued\n totalDelegates\n totalTokenHolders\n totalProposalCount\n totalVotes\n totalVoterCount\n totalStakers\n totalStakedAmount\n delegatedVotesRaw\n }\n}\n "; | ||
export declare const getPowerpoolReceipts = "\n query getPowerpoolReceipts {\n getPowerpoolReceipts (pageSize: $pageSize, filter: $filter) @client {\n id\n proposalId\n protocol\n support\n votesRaw\n voterId\n votes\n }\n}\n "; | ||
export declare const getPowerpoolTokenHolders = "\n query getPowerpoolTokenHolders {\n getPowerpoolTokenHolders (pageSize: $pageSize, filter: $filter) @client {\n id\n tokenBalanceRaw\n tokenBalance\n totalTokensHeldRaw\n totalTokensHeld\n delegateId\n }\n}\n "; |
"use strict"; | ||
//THIS IS AN AUTOGENERATED FILE | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPowerpoolTokenHolders = exports.getPowerpoolReceipts = exports.getPowerpoolGovernance = exports.getPowerpoolDelegates = exports.getPowerpoolProposals = void 0; | ||
exports.getPowerpoolTokenHolders = exports.getPowerpoolReceipts = exports.getPowerpoolGovernance = exports.getPowerpoolVoters = exports.getPowerpoolProposals = void 0; | ||
exports.getPowerpoolProposals = ` | ||
query getPowerpoolProposals { | ||
getPowerpoolProposals (filter: $filter) @client { | ||
getPowerpoolProposals (pageSize: $pageSize, filter: $filter) @client { | ||
id | ||
@@ -24,8 +24,21 @@ title | ||
} | ||
startBlock | ||
endBlock | ||
status | ||
} | ||
} | ||
`; | ||
exports.getPowerpoolDelegates = ` | ||
query getPowerpoolDelegates { | ||
getPowerpoolDelegates (filter: $filter) @client { | ||
exports.getPowerpoolVoters = ` | ||
query getPowerpoolVoters { | ||
getPowerpoolVoters (pageSize: $pageSize, filter: $filter) @client { | ||
id | ||
delegatedVotesRaw | ||
delegatedVotes | ||
votingPower | ||
voteWeight | ||
proposalsCreated | ||
proposalsVoted | ||
tokenHoldersRepresentedAmount | ||
quorum | ||
cumulativePower | ||
lpVotesRaw | ||
@@ -50,2 +63,5 @@ lpVotes | ||
proposalIds | ||
name | ||
description | ||
website | ||
} | ||
@@ -56,3 +72,3 @@ } | ||
query getPowerpoolGovernance { | ||
getPowerpoolGovernance (filter: $filter) @client { | ||
getPowerpoolGovernance (pageSize: $pageSize, filter: $filter) @client { | ||
protocol | ||
@@ -73,5 +89,2 @@ hasDelegation | ||
totalStakedAmount | ||
id | ||
proposals | ||
currentLPDelegates | ||
delegatedVotesRaw | ||
@@ -83,3 +96,3 @@ } | ||
query getPowerpoolReceipts { | ||
getPowerpoolReceipts (filter: $filter) @client { | ||
getPowerpoolReceipts (pageSize: $pageSize, filter: $filter) @client { | ||
id | ||
@@ -97,3 +110,3 @@ proposalId | ||
query getPowerpoolTokenHolders { | ||
getPowerpoolTokenHolders (filter: $filter) @client { | ||
getPowerpoolTokenHolders (pageSize: $pageSize, filter: $filter) @client { | ||
id | ||
@@ -100,0 +113,0 @@ tokenBalanceRaw |
@@ -5,5 +5,5 @@ const fs = require('fs'); | ||
module.exports.getPowerpoolProposals = fs.readFileSync(path.join(__dirname, 'getPowerpoolProposals.gql'), 'utf8'); | ||
module.exports.getPowerpoolDelegates = fs.readFileSync(path.join(__dirname, 'getPowerpoolDelegates.gql'), 'utf8'); | ||
module.exports.getPowerpoolVoters = fs.readFileSync(path.join(__dirname, 'getPowerpoolVoters.gql'), 'utf8'); | ||
module.exports.getPowerpoolGovernance = fs.readFileSync(path.join(__dirname, 'getPowerpoolGovernance.gql'), 'utf8'); | ||
module.exports.getPowerpoolReceipts = fs.readFileSync(path.join(__dirname, 'getPowerpoolReceipts.gql'), 'utf8'); | ||
module.exports.getPowerpoolTokenHolders = fs.readFileSync(path.join(__dirname, 'getPowerpoolTokenHolders.gql'), 'utf8'); |
export declare const resolvers: { | ||
Query: { | ||
getPowerpoolProposals: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
getPowerpoolDelegates: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
getPowerpoolVoters: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
getPowerpoolGovernance: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
@@ -6,0 +6,0 @@ getPowerpoolReceipts: (root: any, args: any, context: any, info: any) => Promise<any[]>; |
@@ -9,3 +9,3 @@ "use strict"; | ||
getPowerpoolProposals: resolvers_1.resolvers.Query.getProposals, | ||
getPowerpoolDelegates: resolvers_1.resolvers.Query.getDelegates, | ||
getPowerpoolVoters: resolvers_1.resolvers.Query.getVoters, | ||
getPowerpoolGovernance: resolvers_1.resolvers.Query.getGovernance, | ||
@@ -12,0 +12,0 @@ getPowerpoolReceipts: resolvers_1.resolvers.Query.getReceipts, |
@@ -19,3 +19,9 @@ export declare type Maybe<T> = T | null; | ||
delegatedVotes: Scalars['String']; | ||
votingPower: Scalars['String']; | ||
voteWeight: Scalars['String']; | ||
proposalsCreated: Scalars['String']; | ||
proposalsVoted: Scalars['String']; | ||
tokenHoldersRepresentedAmount: Scalars['Int']; | ||
quorum: Scalars['String']; | ||
cumulativePower: Scalars['String']; | ||
}; | ||
@@ -26,14 +32,14 @@ export declare type Governance = { | ||
hasStaking: Scalars['Boolean']; | ||
currentDelegates: Scalars['Int']; | ||
currentTokenHolders: Scalars['Int']; | ||
delegatedVotes: Scalars['Int']; | ||
paidRewards: Scalars['Float']; | ||
proposalsQueued: Scalars['Int']; | ||
totalDelegates: Scalars['Int']; | ||
totalTokenHolders: Scalars['Int']; | ||
currentDelegates?: Maybe<Scalars['Int']>; | ||
currentTokenHolders?: Maybe<Scalars['Int']>; | ||
delegatedVotes?: Maybe<Scalars['Int']>; | ||
paidRewards?: Maybe<Scalars['Float']>; | ||
proposalsQueued?: Maybe<Scalars['Int']>; | ||
totalDelegates?: Maybe<Scalars['Int']>; | ||
totalTokenHolders?: Maybe<Scalars['Int']>; | ||
totalProposalCount: Scalars['Int']; | ||
totalVotes: Scalars['Int']; | ||
totalVoterCount: Scalars['Int']; | ||
totalStakers: Scalars['Int']; | ||
totalStakedAmount: Scalars['Float']; | ||
totalVotes?: Maybe<Scalars['Int']>; | ||
totalVoterCount?: Maybe<Scalars['Int']>; | ||
totalStakers?: Maybe<Scalars['Int']>; | ||
totalStakedAmount?: Maybe<Scalars['Float']>; | ||
}; | ||
@@ -49,3 +55,6 @@ export declare enum ProposalStatus { | ||
Rejected = "rejected", | ||
Wip = "wip" | ||
Wip = "wip", | ||
Initializing = "initializing", | ||
Voting = "voting", | ||
Validating = "validating" | ||
} | ||
@@ -90,3 +99,3 @@ export declare enum VoteType { | ||
export declare type Receipt = { | ||
id: Scalars['ID']; | ||
id?: Maybe<Scalars['ID']>; | ||
proposalId: Scalars['ID']; | ||
@@ -96,47 +105,2 @@ protocol: Scalars['String']; | ||
}; | ||
export declare type Metadata = { | ||
metadata?: Maybe<Scalars['String']>; | ||
}; | ||
export declare type SnapshotMessagePayload = { | ||
choice: Scalars['Int']; | ||
proposal: Scalars['String']; | ||
metadata: Metadata; | ||
}; | ||
export declare type SnapshotMessage = { | ||
timestamp: Scalars['String']; | ||
space: Scalars['String']; | ||
type: Scalars['String']; | ||
version: Scalars['String']; | ||
payload: Array<Maybe<SnapshotMessagePayload>>; | ||
}; | ||
export declare type SnapshotVoter = { | ||
address: Scalars['String']; | ||
authorIpfsHash: Scalars['String']; | ||
relayerIpfsHash: Scalars['String']; | ||
sig: Scalars['String']; | ||
msg: SnapshotMessage; | ||
}; | ||
export declare type SnapshotProposalMessagePayload = { | ||
end: Scalars['Int']; | ||
body: Scalars['String']; | ||
name: Scalars['String']; | ||
start: Scalars['Int']; | ||
choices: Array<Scalars['String']>; | ||
metadata: Metadata; | ||
snapshot: Scalars['String']; | ||
}; | ||
export declare type SnapshotProposalMessage = { | ||
timestamp: Scalars['String']; | ||
space: Scalars['String']; | ||
type: Scalars['String']; | ||
version: Scalars['String']; | ||
payload: Array<Maybe<SnapshotProposalMessagePayload>>; | ||
}; | ||
export declare type SnapshotProposal = { | ||
address: Scalars['String']; | ||
msg: SnapshotProposalMessage; | ||
sig: Scalars['String']; | ||
authorIpfsHash: Scalars['String']; | ||
relayerIpfsHash: Scalars['String']; | ||
}; | ||
export declare type TokenHolder = { | ||
@@ -149,16 +113,6 @@ id: Scalars['ID']; | ||
}; | ||
export declare type Voter = { | ||
activeProtocols?: Maybe<Array<Maybe<Scalars['String']>>>; | ||
allKnownAddresses?: Maybe<Array<Maybe<Scalars['String']>>>; | ||
description: Scalars['String']; | ||
name: Scalars['String']; | ||
hash: Scalars['String']; | ||
imageUrl: Scalars['String']; | ||
tags?: Maybe<Array<Maybe<Scalars['String']>>>; | ||
twitter?: Maybe<Scalars['String']>; | ||
}; | ||
export declare type Query = { | ||
__typename?: 'Query'; | ||
getPowerpoolProposals: Array<PowerpoolProposal>; | ||
getPowerpoolDelegates: Array<PowerpoolDelegate>; | ||
getPowerpoolVoters: Array<PowerpoolDelegate>; | ||
getPowerpoolGovernance: Array<PowerpoolGovernance>; | ||
@@ -169,14 +123,19 @@ getPowerpoolReceipts: Array<PowerpoolReceipt>; | ||
export declare type QueryGetPowerpoolProposalsArgs = { | ||
pageSize?: Maybe<Scalars['Int']>; | ||
filter?: Maybe<Scalars['String']>; | ||
}; | ||
export declare type QueryGetPowerpoolDelegatesArgs = { | ||
export declare type QueryGetPowerpoolVotersArgs = { | ||
pageSize?: Maybe<Scalars['Int']>; | ||
filter?: Maybe<Scalars['String']>; | ||
}; | ||
export declare type QueryGetPowerpoolGovernanceArgs = { | ||
pageSize?: Maybe<Scalars['Int']>; | ||
filter?: Maybe<Scalars['String']>; | ||
}; | ||
export declare type QueryGetPowerpoolReceiptsArgs = { | ||
pageSize?: Maybe<Scalars['Int']>; | ||
filter?: Maybe<Scalars['String']>; | ||
}; | ||
export declare type QueryGetPowerpoolTokenHoldersArgs = { | ||
pageSize?: Maybe<Scalars['Int']>; | ||
filter?: Maybe<Scalars['String']>; | ||
@@ -203,3 +162,3 @@ }; | ||
__typename?: 'PowerpoolReceipt'; | ||
id: Scalars['ID']; | ||
id?: Maybe<Scalars['ID']>; | ||
proposalId: Scalars['ID']; | ||
@@ -224,2 +183,5 @@ protocol: Scalars['String']; | ||
votes: Array<PowerpoolVote>; | ||
startBlock: Scalars['Int']; | ||
endBlock: Scalars['Int']; | ||
status: Scalars['String']; | ||
}; | ||
@@ -231,21 +193,28 @@ export declare type PowerpoolGovernance = Governance & { | ||
hasStaking: Scalars['Boolean']; | ||
currentDelegates: Scalars['Int']; | ||
currentTokenHolders: Scalars['Int']; | ||
delegatedVotes: Scalars['Int']; | ||
paidRewards: Scalars['Float']; | ||
proposalsQueued: Scalars['Int']; | ||
totalDelegates: Scalars['Int']; | ||
totalTokenHolders: Scalars['Int']; | ||
currentDelegates?: Maybe<Scalars['Int']>; | ||
currentTokenHolders?: Maybe<Scalars['Int']>; | ||
delegatedVotes?: Maybe<Scalars['Int']>; | ||
paidRewards?: Maybe<Scalars['Float']>; | ||
proposalsQueued?: Maybe<Scalars['Int']>; | ||
totalDelegates?: Maybe<Scalars['Int']>; | ||
totalTokenHolders?: Maybe<Scalars['Int']>; | ||
totalProposalCount: Scalars['Int']; | ||
totalVotes: Scalars['Int']; | ||
totalVoterCount: Scalars['Int']; | ||
totalStakers: Scalars['Int']; | ||
totalStakedAmount: Scalars['Float']; | ||
id: Scalars['ID']; | ||
proposals: Scalars['Int']; | ||
currentLPDelegates: Scalars['Int']; | ||
totalVotes?: Maybe<Scalars['Int']>; | ||
totalVoterCount?: Maybe<Scalars['Int']>; | ||
totalStakers?: Maybe<Scalars['Int']>; | ||
totalStakedAmount?: Maybe<Scalars['Float']>; | ||
delegatedVotesRaw: Scalars['Int']; | ||
}; | ||
export declare type PowerpoolDelegate = { | ||
export declare type PowerpoolDelegate = Delegate & { | ||
__typename?: 'PowerpoolDelegate'; | ||
id: Scalars['ID']; | ||
delegatedVotesRaw: Scalars['String']; | ||
delegatedVotes: Scalars['String']; | ||
votingPower: Scalars['String']; | ||
voteWeight: Scalars['String']; | ||
proposalsCreated: Scalars['String']; | ||
proposalsVoted: Scalars['String']; | ||
tokenHoldersRepresentedAmount: Scalars['Int']; | ||
quorum: Scalars['String']; | ||
cumulativePower: Scalars['String']; | ||
lpVotesRaw: Scalars['Int']; | ||
@@ -257,2 +226,5 @@ lpVotes: Scalars['Float']; | ||
proposalIds: Array<Scalars['Int']>; | ||
name?: Maybe<Scalars['String']>; | ||
description?: Maybe<Scalars['String']>; | ||
website?: Maybe<Scalars['String']>; | ||
}; |
@@ -16,2 +16,5 @@ "use strict"; | ||
ProposalStatus["Wip"] = "wip"; | ||
ProposalStatus["Initializing"] = "initializing"; | ||
ProposalStatus["Voting"] = "voting"; | ||
ProposalStatus["Validating"] = "validating"; | ||
})(ProposalStatus = exports.ProposalStatus || (exports.ProposalStatus = {})); | ||
@@ -18,0 +21,0 @@ var VoteType; |
@@ -1,72 +0,6 @@ | ||
export declare const proposalMapper: (proposal: any) => { | ||
id: any; | ||
protocol: string; | ||
proposerId: any; | ||
title: null; | ||
author: any; | ||
startBlock: any; | ||
endBlock: any; | ||
description: any; | ||
status: any; | ||
targets: any; | ||
calldatas: any; | ||
values: any; | ||
executionETA: any; | ||
votes: any; | ||
__typename: string; | ||
}; | ||
export declare const delegateMapper: (delegate: any) => { | ||
id: any; | ||
delegatedVotesRaw: any; | ||
delegatedVotes: any; | ||
lpVotesRaw: any; | ||
lpVotes: any; | ||
lpVotesLast: any; | ||
tokenHoldersRepresentedAmount: any; | ||
tokenHoldersRepresented: any; | ||
votes: any; | ||
proposalIds: any; | ||
__typename: string; | ||
}; | ||
export declare const governanceMapper: (governance: any) => { | ||
protocol: string; | ||
hasDelegation: boolean; | ||
hasStaking: boolean; | ||
paidRewards: null; | ||
totalProposalCount: null; | ||
totalVotes: null; | ||
totalVoterCount: null; | ||
totalStakers: null; | ||
totalStakedAmount: null; | ||
id: null; | ||
currentLPDelegates: null; | ||
delegatedVotesRaw: null; | ||
proposals: any; | ||
currentDelegates: any; | ||
currentTokenHolders: any; | ||
totalDelegates: any; | ||
totalTokenHolders: any; | ||
delegatedVotes: any; | ||
proposalsQueued: any; | ||
__typename: string; | ||
}; | ||
export declare const receiptMapper: (receipt: any) => { | ||
id: any; | ||
protocol: string; | ||
support: any; | ||
votesRaw: any; | ||
votes: any; | ||
proposalId: any; | ||
voterId: any; | ||
__typename: string; | ||
}; | ||
export declare const tokenHolderMapper: (tokenHolder: any) => { | ||
id: any; | ||
tokenBalance: any; | ||
tokenBalanceRaw: any; | ||
totalTokensHeld: any; | ||
totalTokensHeldRaw: any; | ||
delegateId: any; | ||
__typename: string; | ||
_: null; | ||
}; | ||
import { PowerpoolProposal, PowerpoolDelegate, PowerpoolGovernance, PowerpoolReceipt, PowerpoolTokenHolder } from "./generated/types"; | ||
export declare const proposalMapper: (proposal: any) => PowerpoolProposal; | ||
export declare const delegateMapper: (delegate: any) => PowerpoolDelegate; | ||
export declare const governanceMapper: (governance: any) => PowerpoolGovernance; | ||
export declare const receiptMapper: (receipt: any) => PowerpoolReceipt; | ||
export declare const tokenHolderMapper: (tokenHolder: any) => PowerpoolTokenHolder; |
@@ -10,3 +10,2 @@ "use strict"; | ||
votes: vote.votes, | ||
votesRaw: vote.votesRaw, | ||
proposalId: idMapper(vote.proposal), | ||
@@ -17,6 +16,5 @@ voterId: idMapper(vote.voter), | ||
}; | ||
exports.proposalMapper = (proposal) => { | ||
const proposalMapper = (proposal) => { | ||
return { | ||
id: proposal.id, | ||
protocol: "Powerpool", | ||
proposerId: idMapper(proposal.proposer), | ||
@@ -37,3 +35,4 @@ title: null, | ||
}; | ||
exports.delegateMapper = (delegate) => { | ||
exports.proposalMapper = proposalMapper; | ||
const delegateMapper = (delegate) => { | ||
return { | ||
@@ -48,8 +47,18 @@ id: delegate.id, | ||
tokenHoldersRepresented: delegate.tokenHoldersRepresented.map(exports.tokenHolderMapper), | ||
votingPower: delegate.delegatedVotes, | ||
voteWeight: (Number(delegate.delegatedVotes) / 100000000 * 100).toFixed(6), | ||
proposalsCreated: delegate.proposals.length, | ||
proposalsVoted: delegate.votes.length, | ||
votes: delegate.votes.map(voteMapper), | ||
proposalIds: delegate.proposals.map(idMapper), | ||
name: delegate.name ? delegate.name : null, | ||
description: delegate.description ? delegate.description : null, | ||
website: delegate.website ? delegate.website : null, | ||
cumulativePower: '0', | ||
quorum: '0', | ||
__typename: "PowerpoolDelegate" | ||
}; | ||
}; | ||
exports.governanceMapper = (governance) => { | ||
exports.delegateMapper = delegateMapper; | ||
const governanceMapper = (governance) => { | ||
return { | ||
@@ -60,3 +69,3 @@ protocol: "Powerpool", | ||
paidRewards: null, | ||
totalProposalCount: null, | ||
totalProposalCount: governance.proposals, | ||
totalVotes: null, | ||
@@ -66,6 +75,3 @@ totalVoterCount: null, | ||
totalStakedAmount: null, | ||
id: null, | ||
currentLPDelegates: null, | ||
delegatedVotesRaw: null, | ||
proposals: governance.proposals, | ||
delegatedVotesRaw: governance.delegatedVotesRaw, | ||
currentDelegates: governance.currentDelegates, | ||
@@ -80,3 +86,4 @@ currentTokenHolders: governance.currentTokenHolders, | ||
}; | ||
exports.receiptMapper = (receipt) => { | ||
exports.governanceMapper = governanceMapper; | ||
const receiptMapper = (receipt) => { | ||
return { | ||
@@ -93,3 +100,4 @@ id: receipt.id, | ||
}; | ||
exports.tokenHolderMapper = (tokenHolder) => { | ||
exports.receiptMapper = receiptMapper; | ||
const tokenHolderMapper = (tokenHolder) => { | ||
return { | ||
@@ -103,5 +111,5 @@ id: tokenHolder.id, | ||
__typename: "PowerpoolTokenHolder", | ||
_: null, | ||
}; | ||
}; | ||
exports.tokenHolderMapper = tokenHolderMapper; | ||
//# sourceMappingURL=mappers.js.map |
@@ -1,10 +0,10 @@ | ||
export declare const getProposalsResolver: () => Promise<any>; | ||
export declare const getDelegatesResolver: () => Promise<any>; | ||
export declare const getGovernanceResolver: () => Promise<any>; | ||
export declare const getReceiptsResolver: () => Promise<any>; | ||
export declare const getTokenHoldersResolver: () => Promise<any>; | ||
export declare const getProposalsResolver: (_: any, args: any) => Promise<any>; | ||
export declare const getVotersResolver: (_: any, args: any) => Promise<any[]>; | ||
export declare const getGovernanceResolver: (_: any, args: any) => Promise<any>; | ||
export declare const getReceiptsResolver: (_: any, args: any) => Promise<any>; | ||
export declare const getTokenHoldersResolver: (_: any, args: any) => Promise<any>; | ||
export declare const resolvers: { | ||
Query: { | ||
getProposals: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
getDelegates: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
getVoters: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
getGovernance: (root: any, args: any, context: any, info: any) => Promise<any[]>; | ||
@@ -11,0 +11,0 @@ getReceipts: (root: any, args: any, context: any, info: any) => Promise<any[]>; |
@@ -6,11 +6,12 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolvers = exports.getTokenHoldersResolver = exports.getReceiptsResolver = exports.getGovernanceResolver = exports.getDelegatesResolver = exports.getProposalsResolver = void 0; | ||
exports.resolvers = exports.getTokenHoldersResolver = exports.getReceiptsResolver = exports.getGovernanceResolver = exports.getVotersResolver = exports.getProposalsResolver = void 0; | ||
const dist_1 = require("@boardroom/base/dist"); | ||
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'); | ||
exports.getProposalsResolver = async () => { | ||
const getProposalsResolver = async (_, args) => { | ||
const query = graphql_tag_1.default ` | ||
{ | ||
proposals(last: 100) { | ||
proposals(first: ${(args && args.pageSize) || 1000}) { | ||
id | ||
@@ -47,6 +48,7 @@ proposer { | ||
}; | ||
exports.getDelegatesResolver = async () => { | ||
exports.getProposalsResolver = getProposalsResolver; | ||
const getVotersResolver = async (_, args) => { | ||
const query = graphql_tag_1.default ` | ||
{ | ||
delegates(last: 1000) { | ||
delegates(first: ${(args && args.pageSize) || 1000}) { | ||
id | ||
@@ -88,6 +90,17 @@ delegatedVotesRaw | ||
const data = await graphQLFetcher.query(query); | ||
const formattedDelegates = data.delegates.map(mappers_1.delegateMapper); | ||
return formattedDelegates; | ||
const addresses = data.delegates.map((v) => v.id); | ||
const metadata = await dist_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 | ||
}; | ||
}); | ||
const formattedDelegates = combinedData.map(mappers_1.delegateMapper); | ||
return dist_2.setQuorum(formattedDelegates); | ||
}; | ||
exports.getGovernanceResolver = async () => { | ||
exports.getVotersResolver = getVotersResolver; | ||
const getGovernanceResolver = async (_, args) => { | ||
const query = graphql_tag_1.default ` | ||
@@ -102,2 +115,3 @@ { | ||
delegatedVotes | ||
delegatedVotesRaw | ||
proposalsQueued | ||
@@ -108,9 +122,10 @@ } | ||
const data = await graphQLFetcher.query(query); | ||
const formatteboardroomernance = data.governances.map(mappers_1.governanceMapper)[0]; | ||
const formatteboardroomernance = data.governances.map(mappers_1.governanceMapper); | ||
return formatteboardroomernance; | ||
}; | ||
exports.getReceiptsResolver = async () => { | ||
exports.getGovernanceResolver = getGovernanceResolver; | ||
const getReceiptsResolver = async (_, args) => { | ||
const query = graphql_tag_1.default ` | ||
{ | ||
votes(last: 1000) { | ||
votes(first: ${(args && args.pageSize) || 1000}) { | ||
id | ||
@@ -133,6 +148,7 @@ support | ||
}; | ||
exports.getTokenHoldersResolver = async () => { | ||
exports.getReceiptsResolver = getReceiptsResolver; | ||
const getTokenHoldersResolver = async (_, args) => { | ||
const query = graphql_tag_1.default ` | ||
{ | ||
tokenHolders(last: 1000) { | ||
tokenHolders(first: ${(args && args.pageSize) || 1000}) { | ||
id | ||
@@ -153,6 +169,7 @@ tokenBalance | ||
}; | ||
exports.getTokenHoldersResolver = getTokenHoldersResolver; | ||
exports.resolvers = { | ||
Query: { | ||
getProposals: dist_1.addFilter(exports.getProposalsResolver), | ||
getDelegates: dist_1.addFilter(exports.getDelegatesResolver), | ||
getVoters: dist_1.addFilter(exports.getVotersResolver), | ||
getGovernance: dist_1.addFilter(exports.getGovernanceResolver), | ||
@@ -159,0 +176,0 @@ getReceipts: dist_1.addFilter(exports.getReceiptsResolver), |
{ | ||
"name": "@boardroom/powerpool", | ||
"version": "1.0.0-alpha.4", | ||
"version": "2.0.0-alpha.0", | ||
"main": "./dist/index.js", | ||
@@ -16,3 +16,3 @@ "files": [ | ||
"dependencies": { | ||
"@boardroom/base": "^1.0.0-alpha.4", | ||
"@boardroom/base": "^2.0.0-alpha.0", | ||
"graphql": "^15.3.0", | ||
@@ -34,3 +34,3 @@ "graphql-tag": "^1.0.0" | ||
"ts-jest": { | ||
"tsConfig": false | ||
"tsconfig": false | ||
} | ||
@@ -42,3 +42,3 @@ }, | ||
}, | ||
"gitHead": "7c7669ee03bce90d269f85be15407b1ac92ba787" | ||
"gitHead": "045b162bbfe402f0a3fc6655c7eef7614a174da8" | ||
} |
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
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
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
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
42134
30
720
+ Added3box@1.22.2(transitive)
+ Added3box-orbitdb-plugins@2.1.2(transitive)
+ Added3box-shared-cache@1.1.0(transitive)
+ Added3id-blockchain-utils@0.4.1(transitive)
+ Added3id-connect@0.1.0(transitive)
+ Added3id-resolver@1.0.1(transitive)
+ Added@boardroom/base@2.0.0-alpha.0(transitive)
+ Added@hapi/inert@5.2.2(transitive)
+ Added@jclem/logfmt2@2.4.3(transitive)
+ Added@kikobeats/time-span@1.0.5(transitive)
+ Addedarray-shuffle@1.0.1(transitive)
+ Addedasync.nexttick@0.5.2(transitive)
+ Addedasync.util.nexttick@0.5.2(transitive)
+ Addedasync.util.setimmediate@0.5.2(transitive)
+ Addedbyteman@1.3.5(transitive)
+ Addedchai-checkmark@1.0.1(transitive)
+ Addedcrdts@0.1.5(transitive)
+ Addeddag-cbor-links@1.3.6(transitive)
+ Addeddatastore-fs@1.1.0(transitive)
+ Addeddatastore-pubsub@0.3.3(transitive)
+ Addeddebug-logfmt@1.2.3(transitive)
+ Addedgc-stats@1.4.1(transitive)
+ Addedhapi-pino@6.5.0(transitive)
+ Addedhas-localstorage@1.0.1(transitive)
+ Addedhttps-did-resolver@1.0.0(transitive)
+ Addedhumble-localstorage@1.4.2(transitive)
+ Addedhyperdiff@2.0.18(transitive)
+ Addedidentity-wallet@1.4.1(transitive)
+ Addedipfs@0.46.1(transitive)
+ Addedipfs-block-service@0.17.1(transitive)
+ Addedipfs-did-document@1.2.3(transitive)
+ Addedipfs-http-response@0.5.1(transitive)
+ Addedipfs-log@4.6.5(transitive)
+ Addedipfs-pubsub-1on1@0.0.8(transitive)
+ Addedipfs-pubsub-peer-monitor@0.0.10(transitive)
+ Addedipfs-pubsub-room@2.0.2(transitive)
+ Addedipfs-repo@3.0.3(transitive)
+ Addedipfs-repo-migrations@0.2.2(transitive)
+ Addedipld@0.26.4(transitive)
+ Addedipld-bitcoin@0.3.2(transitive)
+ Addedipld-block@0.9.2(transitive)
+ Addedipld-dag-cbor@0.15.30.16.0(transitive)
+ Addedipld-dag-pb@0.18.50.19.0(transitive)
+ Addedipld-ethereum@4.0.2(transitive)
+ Addedipld-git@0.5.3(transitive)
+ Addedipld-raw@4.0.15.0.0(transitive)
+ Addedipld-zcash@0.4.3(transitive)
+ Addedis-domain-name@1.0.1(transitive)
+ Addedis-ipfs@0.6.31.0.3(transitive)
+ Addedis-node@1.0.2(transitive)
+ Addediso-constants@0.1.2(transitive)
+ Addedit-buffer@0.1.3(transitive)
+ Addedit-concat@1.0.3(transitive)
+ Addedit-goodbye@2.0.2(transitive)
+ Addedit-multipart@1.0.9(transitive)
+ Addedit-pb-rpc@0.1.13(transitive)
+ Addedit-tar@1.2.2(transitive)
+ Addedjust-safe-get@2.1.2(transitive)
+ Addedjust-safe-set@2.2.3(transitive)
+ Addedlibp2p-bootstrap@0.10.4(transitive)
+ Addedlibp2p-crypto-secp256k1@0.3.1(transitive)
+ Addedlibp2p-delegated-content-routing@0.4.5(transitive)
+ Addedlibp2p-delegated-peer-routing@0.4.3(transitive)
+ Addedlibp2p-floodsub@0.20.4(transitive)
+ Addedlibp2p-gossipsub@0.3.1(transitive)
+ Addedlibp2p-interfaces@0.2.8(transitive)
+ Addedlibp2p-kad-dht@0.18.7(transitive)
+ Addedlibp2p-keychain@0.6.1(transitive)
+ Addedlibp2p-mdns@0.13.3(transitive)
+ Addedlibp2p-mplex@0.9.5(transitive)
+ Addedlibp2p-noise@1.1.2(transitive)
+ Addedlibp2p-pubsub@0.4.7(transitive)
+ Addedlibp2p-record@0.7.3(transitive)
+ Addedlibp2p-secio@0.12.6(transitive)
+ Addedlibp2p-tcp@0.14.6(transitive)
+ Addedlibp2p-utils@0.1.3(transitive)
+ Addedlibp2p-webrtc-star@0.17.11(transitive)
+ Addedlibp2p-websockets@0.13.6(transitive)
+ Addedlocalstorage-down@0.6.7(transitive)
+ Addedlocalstorage-memory@1.0.3(transitive)
+ Addedlogplease@1.2.15(transitive)
+ Addedmafmt@7.1.0(transitive)
+ Addedmenoetius@0.0.2(transitive)
+ Addedmultihashing@0.3.4(transitive)
+ Addedmuport-did-resolver@1.0.3(transitive)
+ Addedorbit-db@0.24.20.25.3(transitive)
+ Addedorbit-db-access-controllers@0.2.6(transitive)
+ Addedorbit-db-cache@0.3.0(transitive)
+ Addedorbit-db-counterstore@1.11.01.9.0(transitive)
+ Addedorbit-db-docstore@1.11.01.9.1(transitive)
+ Addedorbit-db-eventstore@1.11.01.9.0(transitive)
+ Addedorbit-db-feedstore@1.11.01.9.0(transitive)
+ Addedorbit-db-identity-provider@0.3.1(transitive)
+ Addedorbit-db-io@0.2.0(transitive)
+ Addedorbit-db-keystore@0.3.5(transitive)
+ Addedorbit-db-kvstore@1.11.01.9.0(transitive)
+ Addedorbit-db-pubsub@0.5.7(transitive)
+ Addedorbit-db-storage-adapter@0.5.3(transitive)
+ Addedorbit-db-store@3.3.13.5.0(transitive)
+ Addedp-do-whilst@1.1.0(transitive)
+ Addedp-forever@2.1.0(transitive)
+ Addedp-times@2.1.0(transitive)
+ Addedp-try-each@1.0.1(transitive)
+ Addedp-whilst@2.1.0(transitive)
+ Addedpeer-info@0.17.5(transitive)
+ Addedpostmsg-rpc@2.4.0(transitive)
+ Addedprometheus-gc-stats@0.6.5(transitive)
+ Addedprotons@1.2.1(transitive)
+ Addedtime-cache@0.3.0(transitive)
+ Addedunique-by@1.0.0(transitive)
+ Addeduri-to-multiaddr@3.0.2(transitive)
+ Addedwebcrypto@0.1.1(transitive)
+ Addedxor-distance@2.0.0(transitive)
+ Addedyargs-promise@1.1.0(transitive)
+ Addedzcash-block@2.0.0(transitive)
- Removed@boardroom/base@1.1.0(transitive)
- Removedweb3-batch-call@1.0.13(transitive)