eas-poll-action-module
Version:
A helper library for creating and voting on polls with the EasPollActionModule Open Action.
52 lines (51 loc) • 2.77 kB
TypeScript
import { ActOnOpenActionRequest, OpenActionModuleInput } from "@lens-protocol/client";
import { Signer } from "ethers";
import { EasPoll, EasVote, GetVoteCountVariables, GetVoteCountForOptionIndexVariables, GetVoteForActorVariables, PollOption, VoteAttestation } from "./lib/types";
/**
* Creates an OpenActionModuleInput for initializing a poll on the EAS Poll Action Module.
*
* @param poll The poll to create.
*/
export declare const createPollActionModuleInput: (poll: EasPoll) => OpenActionModuleInput;
/**
* Creates an ActOnOpenActionRequest for voting on a poll on the EAS Poll Action Module.
*
* @param vote The vote to create.
* @param signer Optional Signer to use for creating a signed vote attestation. If not provided, an unsigned vote attestation will be created.
*/
export declare const createVoteActionRequest: (vote: EasVote, signer?: Signer) => Promise<ActOnOpenActionRequest>;
/**
* Creates graphql query variables for getting the vote count of a poll on the EAS Poll Action Module.
*
* @param publicationId The full ID of the publication as a hex string (e.g. 0xd8-0x01).
* @param testnet Whether to use the testnet schema.
*/
export declare const createVoteCountQueryVariables: (publicationId: string, testnet?: boolean) => GetVoteCountVariables;
/**
* Creates graphql query variables for getting the vote count of a specific poll option on the EAS Poll Action Module.
*
* @param publicationId The full ID of the publication as a hex string (e.g. 0xd8-0x01).
* @param optionIndex The index of the option to get the vote count for.
* @param testnet Whether to use the testnet schema.
*/
export declare const createVoteCountForOptionQueryVariables: (publicationId: string, optionIndex: PollOption, testnet?: boolean) => GetVoteCountForOptionIndexVariables;
export declare const createVoteForActorQueryVariables: (publicationId: string, actorProfileId: string, testnet?: boolean) => GetVoteForActorVariables;
/**
* Gets the vote count of a poll on the EAS Poll Action Module.
*
* @param variables The graphql query variables.
* @param testnet Whether to use the testnet schema.
*
* @see createVoteCountQueryVariables
*/
export declare const getVoteCount: (variables: GetVoteCountVariables, testnet?: boolean) => Promise<number>;
/**
* Gets the vote count of a specific poll option on the EAS Poll Action Module.
*
* @param variables The graphql query variables.
* @param testnet Whether to use the testnet schema.
*
* @see createVoteCountForOptionQueryVariables
*/
export declare const getVoteCountForOption: (variables: GetVoteCountForOptionIndexVariables, testnet?: boolean) => Promise<number>;
export declare const getVoteForActor: (variables: GetVoteForActorVariables, testnet?: boolean) => Promise<VoteAttestation>;