eas-poll-action-module
Version:
A helper library for creating and voting on polls with the EasPollActionModule Open Action.
63 lines (62 loc) • 2.67 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GET_VOTE_FOR_ACTOR_QUERY = exports.GET_VOTE_COUNT_FOR_OPTION_QUERY = exports.GET_VOTE_COUNT_QUERY = exports.EAS_GRAPHQL_ENDPOINT_TESTNET = exports.EAS_VOTE_SCHEMA_UID_TESTNET = exports.EAS_ADDRESS_TESTNET = exports.EAS_GRAPHQL_ENDPOINT = exports.EAS_VOTE_SCHEMA_UID = exports.EAS_ADDRESS = exports.EAS_POLL_ACTION_MODULE_ADDRESS = exports.EAS_VOTE_ABI = exports.EAS_VOTE_SCHEMA = void 0;
exports.EAS_VOTE_SCHEMA = "uint256 publicationProfileId,uint256 publicationId,uint256 actorProfileId,address actorProfileOwner,address transactionExecutor,uint8 optionIndex,uint40 timestamp";
exports.EAS_VOTE_ABI = [
{ type: "uint256", name: "publicationProfileId" },
{ type: "uint256", name: "publicationId" },
{ type: "uint256", name: "actorProfileId" },
{ type: "address", name: "actorProfileOwner" },
{ type: "address", name: "transactionExecutor" },
{ type: "uint8", name: "optionIndex" },
{ type: "uint40", name: "timestamp" },
];
exports.EAS_POLL_ACTION_MODULE_ADDRESS = "0xc91C3d3eD7089a9b52945c8967CF0854f08E9e7a";
exports.EAS_ADDRESS = "0x5E634ef5355f45A855d02D66eCD687b1502AF790";
exports.EAS_VOTE_SCHEMA_UID = "0x5e67b8b854d74789f6fa56f202907f85e3e53b87abe3d218c9f6dee1cc60ecbd";
exports.EAS_GRAPHQL_ENDPOINT = "https://polygon.easscan.org/graphql";
exports.EAS_ADDRESS_TESTNET = "0xaEF4103A04090071165F78D45D83A0C0782c2B2a";
exports.EAS_VOTE_SCHEMA_UID_TESTNET = "0x44c235a2465c4d70bd980bdcf968d1997b237e2c7d30a2de1b59b98fee4a1f37";
exports.EAS_GRAPHQL_ENDPOINT_TESTNET = "https://polygon-mumbai.easscan.org/graphql";
exports.GET_VOTE_COUNT_QUERY = `
query GetVoteCount($schemaId: String!, $pollId: String!) {
groupByAttestation(
where: { schemaId: { equals: $schemaId }, data: { startsWith: $pollId }, revoked: { equals: false } }
by: [schemaId]
orderBy: [{ _count: { schemaId: asc } }]
) {
_count {
_all
}
}
}
`;
exports.GET_VOTE_COUNT_FOR_OPTION_QUERY = `
query GetVoteCountForOptionIndex($schemaId: String!, $pollId: String!, $optionIndex: String!) {
groupByAttestation(
where: {
schemaId: { equals: $schemaId }
decodedDataJson: { contains: $optionIndex }
data: { startsWith: $pollId }
revoked: { equals: false }
}
by: [schemaId]
) {
_count {
_all
}
}
}
`;
exports.GET_VOTE_FOR_ACTOR_QUERY = `
query GetVote($schemaId: String!, $data: String!) {
attestations(
where: {schemaId: {equals: $schemaId}, data: {startsWith: $data}}
) {
attester
id
revoked
data
}
}
`;