import { AxiosError } from 'axios'; import { Wallet } from '@ethersproject/wallet'; import { Signer } from '@ethersproject/abstract-signer'; import { TransactionRequest, Provider } from '@ethersproject/providers'; import { Bytes } from '@ethersproject/bytes'; import { Buffer } from 'buffer'; import { BigNumberish } from '@ethersproject/bignumber'; interface ServiceProperties { url: string; } declare abstract class Service implements ServiceProperties { url: string; /** * Cannot be constructed. */ protected constructor(); } declare class ErrAPI extends Error { raw: AxiosError; constructor(message?: string, error?: AxiosError); } type PaginationRequest = { page: number; limit: number; }; interface PaginationResponse { pagination: { totalItems: number; previousPage: number | null; currentPage: number; nextPage: number | null; lastPage: number; }; } declare abstract class API { /** * Cannot be constructed. */ protected constructor(); protected static isApiError(error: AxiosError): never; private static isVochainError; protected static isUndefinedError(error: AxiosError, message?: string): never; private static isFaucetError; protected static createQueryParams(params: Record): string; } type RemoteSignerProperties = { url: string; credentials: RemoteSignerCredentials; token: string; }; type RemoteSignerCredentials = { email: string; password: string; }; declare class RemoteSigner extends Signer { url: string; credentials: RemoteSignerCredentials; token: string; private _address; private _remoteSignerService; constructor(params: Partial); login(credentials?: RemoteSignerCredentials): Promise; refresh(): Promise; signMessage(message: string | Bytes): Promise; signTransactionRemotely(message: string | Bytes): Promise; getAddress(): Promise; signTransaction(_transaction: TransactionRequest): Promise; connect(_provider: Provider): Signer; get remoteSignerService(): RemoteSignerService; set remoteSignerService(value: RemoteSignerService); get address(): string; set address(value: string); } type WalletOption = { wallet: Wallet | Signer | RemoteSigner; }; type ElectionIdOption = { electionId: string; }; type VoteIdOption = { voteId: string; }; type SendTokensOptions = Partial & { to: string; amount: number; }; type IsInCensusOptions = Partial; type HasAlreadyVotedOptions = Partial; type VotesLeftCountOptions = Partial; type IsAbleToVoteOptions = Partial; /** * Represents a vote */ declare class Vote { private _votes; /** * Constructs a vote * * @param votes - The list of votes values */ constructor(votes: Array); get votes(): Array; set votes(value: Array); } declare class AnonymousVote extends Vote { private _password; private _signature; /** * Constructs an anonymous vote * * @param votes - The list of votes values * @param signature - The signature of the payload * @param password - The password of the anonymous vote */ constructor(votes: Array, signature?: string, password?: string); get password(): string; set password(value: string); get signature(): string; set signature(value: string); } declare class CspVote extends Vote { private _signature; private _proof_type; private _weight; /** * Constructs a csp vote * * @param votes - The list of votes values * @param signature - The CSP signature * @param proof -_type The CSP proof type * @param weight - The vote weight */ constructor(votes: Array, signature: string, proof_type?: CspProofType, weight?: bigint); get signature(): string; set signature(value: string); get proof_type(): CspProofType; set proof_type(value: CspProofType); get weight(): bigint; set weight(value: bigint); } type MultiLanguage = { default: T; [lang: string]: T; }; declare enum CensusType { WEIGHTED = "weighted", ANONYMOUS = "zkweighted", CSP = "csp", UNKNOWN = "unknown" } /** * Represents a generic census */ declare abstract class Census { protected _censusId: string | null; protected _censusURI: string | null; protected _type: CensusType; private _size; private _weight; /** * Constructs a generic census * * @param censusId - The id of the census * @param censusURI - The URI of the census * @param type - The type of the census * @param size - The size of the census * @param weight - The weight of the census */ protected constructor(censusId?: string, censusURI?: string, type?: CensusType, size?: number, weight?: bigint); get censusId(): string | null; set censusId(value: string | null); get censusURI(): string | null; set censusURI(value: string | null); get type(): CensusType; set type(value: CensusType); get size(): number | null; set size(value: number | null); get weight(): bigint | null; set weight(value: bigint | null); get isPublished(): boolean; static censusTypeFromCensusOrigin(censusOrigin: string, anonymous?: boolean): CensusType; } /** * Represents a published census */ declare class CspCensus extends Census { /** * Constructs a CSP census * * @param publicKey - The public * @param cspURI - The URI of the CSP server */ constructor(publicKey: string, cspURI: string); } interface ICensusParticipant { key: string; weight: bigint; } /** * Represents an offchain census */ declare abstract class OffchainCensus extends Census { private _participants; /** * Constructs an offchain census */ protected constructor(); protected addParticipants(participants: ICensusParticipant | ICensusParticipant[]): void; protected checkParticipant(participant: ICensusParticipant): ICensusParticipant; protected removeParticipant(key: string): void; get participants(): ICensusParticipant[]; set participants(value: ICensusParticipant[]); } /** * Represents a plain census */ declare class PlainCensus extends OffchainCensus { /** * Constructs a plain census */ constructor(); add(participants: string | string[]): void; remove(key: string): void; } /** * Represents a published census */ declare class PublishedCensus extends Census { /** * Constructs a published census * * @param censusId - The id of the census * @param censusURI - The URI of the census * @param type - The type of the census * @param size - The size of the census * @param weight - The weight of the census */ constructor(censusId: string, censusURI: string, type: CensusType, size?: number, weight?: bigint); } /** * Represents a weighted census */ declare class WeightedCensus extends OffchainCensus { /** * Constructs a weighted census */ constructor(); add(participants: ICensusParticipant | ICensusParticipant[]): void; remove(key: string): void; } /** * Represents a census3 census */ declare class TokenCensus extends PublishedCensus { private _token; /** * Constructs a census3 census * * @param censusId - The id of the census * @param censusURI - The URI of the census * @param anonymous - If the census is anonymous * @param token - The token of the census * @param size - The size of the census * @param weight - The weight of the census */ constructor(censusId: string, censusURI: string, anonymous: boolean, token: Token, size?: number, weight?: bigint); get token(): Token; set token(value: Token); } /** * Represents a census3 census */ declare class StrategyCensus extends PublishedCensus { private _strategy; /** * Constructs a census3 census * * @param censusId - The id of the census * @param censusURI - The URI of the census * @param anonymous - If the census is anonymous * @param strategy - The strategy information * @param size - The size of the census * @param weight - The weight of the census */ constructor(censusId: string, censusURI: string, anonymous: boolean, strategy: Strategy, size?: number, weight?: bigint); get strategy(): Strategy; set strategy(value: Strategy); } interface IVoteType { /** * Voter can only select one answer for question */ uniqueChoices?: boolean; /** * The number of times a voter con overwrite its vote (change vote option). */ maxVoteOverwrites?: number; /** * For weighted census, the user's balance will be used as the `maxCost`. This allows splitting the voting power among * several choices, even including quadratic voting scenarios. */ costFromWeight?: boolean; /** * Defines the `costExponent`, which is used in the computation of the total "cost" of the voted options. * This total cost is later compared against `maxTotalCost`. * * The formula used to calculate the total cost is: * totalCost = Σ (value[i] ^ costExponent) <= maxTotalCost * * To establish a quadratic voting election, the `costExponent` must be set to 2. As an illustration, consider a vote * array of `[3,4]` where: * - `3` represents the credits assigned to option 0, * - `4` represents the credits given to option 1. * * The total credits spent are calculated as: * * ``` * 3^2 = 9 (Credits for option 0) * 4^2 = 16 (Credits for option 1) * Total = 25 (Total credits spent) * ``` * * The total credits available for spending (i.e., `maxTotalCost`) can be set in two ways during the election creation: * - By explicitly defining the `maxTotalCost` parameter to set up same amount of credits for each voter, * - By setting the `costFromWeight` parameter to `true` and using a weighted census. In this method, the weight * assigned to each voter determines the credits they have available for voting. */ costExponent?: number; /** * Defines the maximum acceptable value for all fields in the voting process. * By default, this value corresponds to the total number of choices available in a question. * * In the context of a quadratic voting system, this value should typically be set to 0. */ maxValue?: number; /** * Determines the maximum count or number of votes that can be cast across all fields. * The default value corresponds to the total number of questions available in the voting process. * * For elections involving multiple questions (multiquestion elections), this value should be equivalent to the total * number of questions. In contrast, for elections that don't involve multiple questions (non-multiquestion elections), * this value should match the total number of choices available for voting. */ maxCount?: number; /** * Specifies the maximum limit on the total sum of all ballot fields' values, if applicable. * For instance, if the vote array is `[0,0,3,2]`, the `maxTotalCost` should be set to `3`. * * A value of 0 implies no maximum limit or that this parameter is not applicable in the current voting context. */ maxTotalCost?: number; } interface IElectionType { /** * The process can be paused and resumed. */ interruptible?: boolean; /** * Can add more voters to the census tree during the election. */ dynamicCensus?: boolean; /** * Protect the results until the end of the process if true. It will show live results otherwise. */ secretUntilTheEnd?: boolean; /** * Enable anonymous voting. */ anonymous?: boolean; /** * If the metadata has to be encrypted or not. */ metadata?: { /** * If the metadata has to be encrypted or not. */ encrypted?: boolean; /** * Password to encrypt the metadata. */ password?: string; }; } type AnyJson = boolean | number | string | null | JsonArray | JsonMap | any; interface JsonMap { [key: string]: AnyJson; } interface JsonArray extends Array { } type CustomMeta = AnyJson | JsonArray | JsonMap; /** * Define election parameters. */ interface IElectionParameters { /** * Election title */ title: string | MultiLanguage; /** * Election description */ description?: string | MultiLanguage; /** * Election header image url. */ header?: string; /** * Election stream Uri (ex: a video url) */ streamUri?: string; /** * Metadata (anything added by the election creator) */ meta?: CustomMeta; startDate?: string | number | Date; endDate: string | number | Date; census: Census; voteType?: IVoteType; electionType?: IElectionType; questions?: IQuestion[]; /** * Is used to limit the number of votes that can be registered for an election. This feature helps to prevent any * potential overflow of the blockchain when the number of votes goes beyond the maximum limit. * * In order to create an election, the creator is required to set the MaxCensusSize parameter to a proper value. * Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an * error will occur and the election cannot be created. * * If the number of votes exceeds this limit, will throw `Max census size for the election is greater than allowed * size` error. */ maxCensusSize?: number; /** * Is used to remove the secret identities of the voters once the process is done. */ temporarySecretIdentity?: boolean; /** * Used to add the SDK version to the election metadata */ addSDKVersion?: boolean; } /** * Represents an election */ declare abstract class Election { protected _title: MultiLanguage; protected _description: MultiLanguage; protected _header: string; protected _streamUri: string; protected _meta: CustomMeta; protected _startDate: Date; protected _endDate: Date; protected _electionType: IElectionType; protected _voteType: IVoteType; protected _questions: IQuestion[]; protected _census: Census; protected _maxCensusSize: number; protected _temporarySecretIdentity: boolean; protected _addSDKVersion: boolean; /** * Constructs an election * * @param params - Election parameters */ protected constructor(params?: IElectionParameters); /** * Returns an unpublished election object * * @param params - Unpublished Election parameters */ static from(params: IElectionParameters): UnpublishedElection; get title(): MultiLanguage; get description(): MultiLanguage; get header(): string; get streamUri(): string; get meta(): CustomMeta; get startDate(): Date; get endDate(): Date; get electionType(): IElectionType; get voteType(): IVoteType; get questions(): IQuestion[]; get census(): Census; get maxCensusSize(): number; get temporarySecretIdentity(): boolean; get addSDKVersion(): boolean; get(dot: string): any; } /** * Represents an unpublished election */ declare class UnpublishedElection extends Election { /** * Constructs an unpublished election * * @param params - Election parameters */ constructor(params: IElectionParameters); addQuestion(title: string | MultiLanguage, description: string | MultiLanguage, choices: Array<{ title: string; value?: number; meta?: CustomMeta; } | Choice>, meta?: CustomMeta): UnpublishedElection; removeQuestion(questionNumber: number): UnpublishedElection; private static fullElectionType; private static fullVoteType; generateMetadata(metadata?: ElectionMetadata): ElectionMetadata; summarizeMetadata(): string; generateVoteOptions(): object; get duration(): number; generateEnvelopeType(): object; generateMode(): object; get title(): MultiLanguage; set title(value: MultiLanguage); get description(): MultiLanguage; set description(value: MultiLanguage); get header(): string; set header(value: string); get streamUri(): string; set streamUri(value: string); get meta(): CustomMeta; set meta(value: CustomMeta); get startDate(): Date; set startDate(value: Date); get endDate(): Date; set endDate(value: Date); get electionType(): IElectionType; set electionType(value: IElectionType); get voteType(): IVoteType; set voteType(value: IVoteType); get questions(): IQuestion[]; set questions(value: IQuestion[]); get census(): Census; set census(value: Census); get maxCensusSize(): number; set maxCensusSize(value: number); get temporarySecretIdentity(): boolean; set temporarySecretIdentity(value: boolean); get addSDKVersion(): boolean; set addSDKVersion(value: boolean); } declare enum ElectionStatus { PROCESS_UNKNOWN = "PROCESS_UNKNOWN", UPCOMING = "UPCOMING", ONGOING = "ONGOING", ENDED = "ENDED", CANCELED = "CANCELED", PAUSED = "PAUSED", RESULTS = "RESULTS" } declare enum ElectionStatusReady { READY = "READY" } type AllElectionStatus = ElectionStatus | ElectionStatusReady; interface IPublishedElectionParameters extends IElectionParameters { id: string; organizationId: string; status: AllElectionStatus; voteCount: number; finalResults: boolean; results: Array>; manuallyEnded: boolean; chainId: string; creationTime: string; metadataURL: string; resultsType: ElectionResultsType; raw: object; } /** * Represents a published election */ declare class PublishedElection extends Election { private readonly _id; private readonly _organizationId; private readonly _status; private readonly _voteCount; private readonly _finalResults; private readonly _manuallyEnded; private readonly _chainId; private readonly _results; private readonly _creationTime; private readonly _metadataURL; private readonly _resultsType; private readonly _raw; /** * Constructs a published election * * @param params - Election parameters */ constructor(params: IPublishedElectionParameters); /** * Returns a published election object * * @param params - Published election parameters */ static build(params: IPublishedElectionParameters): PublishedElection; static getStatus(status: AllElectionStatus, startDate: Date): ElectionStatus; checkVote(vote: Vote): void; static checkVote(vote: Vote, voteType: IVoteType): void; get title(): MultiLanguage; get description(): MultiLanguage; get header(): string; get streamUri(): string; get startDate(): Date; get endDate(): Date; get electionType(): IElectionType; get voteType(): IVoteType; get questions(): IQuestion[]; get census(): PublishedCensus; get maxCensusSize(): number; get id(): string; get organizationId(): string; get status(): ElectionStatus; get voteCount(): number; get finalResults(): boolean; get results(): Array>; get manuallyEnded(): boolean; get chainId(): string; get creationTime(): Date; get metadataURL(): string; get resultsType(): ElectionResultsType; get raw(): object; get isValid(): boolean; } interface IInvalidElectionParameters { id: string; } /** * Represents an invalid election */ declare class InvalidElection { private readonly _id; /** * Constructs an invalid election * * @param params - Election parameters */ constructor(params: IInvalidElectionParameters); get id(): string; get isValid(): boolean; } interface IMultiChoiceElectionParameters extends IElectionParameters { maxNumberOfChoices: number; minNumberOfChoices?: number; canRepeatChoices?: boolean; canAbstain?: boolean; } /** * Represents a multi choice election */ declare class MultiChoiceElection extends UnpublishedElection { private _canAbstain; private _minNumberOfChoices; /** * Constructs a multi choice election * * @param params - Multi choice election parameters */ constructor(params: IMultiChoiceElectionParameters); static from(params: IMultiChoiceElectionParameters): MultiChoiceElection; addQuestion(title: string | MultiLanguage, description: string | MultiLanguage, choices: Array<{ title: string; value?: number; meta?: CustomMeta; } | Choice>, meta?: CustomMeta): UnpublishedElection; generateVoteOptions(): object; generateEnvelopeType(): object; generateMetadata(): ElectionMetadata; static checkVote(vote: Vote, voteType: IVoteType, voteProperties: ChoiceProperties): void; get maxNumberOfChoices(): number; set maxNumberOfChoices(value: number); get minNumberOfChoices(): number; set minNumberOfChoices(value: number); get canRepeatChoices(): boolean; set canRepeatChoices(value: boolean); get canAbstain(): boolean; set canAbstain(value: boolean); } interface IBudgetElectionParametersInfo extends IElectionParameters { minStep?: number; forceFullBudget?: boolean; } interface IBudgetElectionParametersWithCensusWeight extends IBudgetElectionParametersInfo { useCensusWeightAsBudget: true; } interface IBudgetElectionParametersWithBudget extends IBudgetElectionParametersInfo { useCensusWeightAsBudget: false; maxBudget: number; } type IBudgetElectionParameters = IBudgetElectionParametersWithCensusWeight | IBudgetElectionParametersWithBudget; /** * Represents a budget election */ declare class BudgetElection extends UnpublishedElection { private _minStep; private _forceFullBudget; /** * Constructs a budget election * * @param params - Budget election parameters */ constructor(params: IBudgetElectionParameters); static from(params: IBudgetElectionParameters): BudgetElection; addQuestion(title: string | MultiLanguage, description: string | MultiLanguage, choices: Array<{ title: string; value?: number; meta?: CustomMeta; } | Choice>, meta?: CustomMeta): UnpublishedElection; generateVoteOptions(): object; generateEnvelopeType(): object; generateMetadata(): ElectionMetadata; static checkVote(vote: Vote, resultsType: ElectionResultsType, voteType: IVoteType): void; get minStep(): number; set minStep(value: number); get forceFullBudget(): boolean; set forceFullBudget(value: boolean); get useCensusWeightAsBudget(): boolean; set useCensusWeightAsBudget(value: boolean); get maxBudget(): number; set maxBudget(value: number); } interface IApprovalElectionParameters extends IElectionParameters { } /** * Represents an approval election */ declare class ApprovalElection extends UnpublishedElection { /** * Constructs an approval election * * @param params - Approval election parameters */ constructor(params: IApprovalElectionParameters); static from(params: IApprovalElectionParameters): ApprovalElection; addQuestion(title: string | MultiLanguage, description: string | MultiLanguage, choices: Array<{ title: string; value?: number; meta?: CustomMeta; } | Choice>, meta?: CustomMeta): UnpublishedElection; generateVoteOptions(): object; generateEnvelopeType(): object; generateMetadata(): ElectionMetadata; static checkVote(vote: Vote, voteType: IVoteType): void; } /** * Asserts that the given metadata is valid. * Throws an exception if it is not. */ declare function checkValidElectionMetadata(electionMetadata: ElectionMetadata): ElectionMetadata; type Choice = Pick; type Question = Pick; interface IChoice { title: MultiLanguage; value: number; meta?: CustomMeta; results?: string; answer?: number; } interface IQuestion { title: MultiLanguage; description?: MultiLanguage; numAbstains?: string; meta?: CustomMeta; choices: Array; } declare enum ElectionResultsTypeNames { SINGLE_CHOICE_MULTIQUESTION = "single-choice-multiquestion", MULTIPLE_CHOICE = "multiple-choice", BUDGET = "budget-based", APPROVAL = "approval", QUADRATIC = "quadratic" } type AbstainProperties = { canAbstain: boolean; abstainValues: Array; }; type ChoiceProperties = { repeatChoice: boolean; numChoices: { min: number; max: number; }; }; type BudgetProperties = { useCensusWeightAsBudget: boolean; maxBudget: number; minStep: number; forceFullBudget: boolean; }; type ApprovalProperties = { rejectValue: number; acceptValue: number; }; type ElectionResultsType = { name: ElectionResultsTypeNames.SINGLE_CHOICE_MULTIQUESTION; properties: {}; } | { name: ElectionResultsTypeNames.MULTIPLE_CHOICE; properties: AbstainProperties & ChoiceProperties; } | { name: ElectionResultsTypeNames.BUDGET; properties: BudgetProperties; } | { name: ElectionResultsTypeNames.APPROVAL; properties: ApprovalProperties; } | { name: ElectionResultsTypeNames.QUADRATIC; properties: BudgetProperties & { quadraticCost: number; }; }; type ProtocolVersion$1 = '1.1' | '1.2'; /** * JSON metadata. Intended to be stored on IPFS or similar. * More info: https://vocdoni.io/docs/#/architecture/components/process?id=process-metadata-json */ interface ElectionMetadata { version: ProtocolVersion$1; title: MultiLanguage; description: MultiLanguage; media: { header?: string; streamUri?: string; }; /** Arbitrary key/value data that specific applications can use for their own needs */ meta?: { [key: string]: any; }; questions: Array; type: ElectionResultsType; } declare const ElectionMetadataTemplate: ElectionMetadata; declare const getElectionMetadataTemplate: () => any; /** * Asserts that the given metadata is valid. * Throws an exception if it is not. */ declare function checkValidAccountMetadata(accountMetadata: AccountMetadata): AccountMetadata; type ProtocolVersion = '1.0'; /** * JSON metadata. Intended to be stored on IPFS or similar. * More info: https://vocdoni.io/docs/#/architecture/components/entity?id=meta */ interface AccountMetadata { version: ProtocolVersion; languages: string[]; name: MultiLanguage; description: MultiLanguage; newsFeed: MultiLanguage; media: { avatar: string; header: string; logo: string; }; meta?: { [key: string]: any; }; } declare const AccountMetadataTemplate: AccountMetadata; interface IAccount { languages?: string[]; name?: string | MultiLanguage; description?: string | MultiLanguage; feed?: string | MultiLanguage; header?: string; avatar?: string; logo?: string; meta?: Array<{ key: string; value: any; }>; } /** * Represents an account */ declare class Account { private _languages; private _name; private _description; private _feed; private _header; private _avatar; private _logo; private _meta; /** * Constructs an account * * @param params - Account parameters */ constructor(params?: IAccount); /** * Returns an account object * * @param params - Account parameters */ static build(params: IAccount): Account; generateMetadata(): AccountMetadata; get name(): MultiLanguage; set name(value: MultiLanguage); get description(): MultiLanguage; set description(value: MultiLanguage); get header(): string; set header(value: string); get avatar(): string; set avatar(value: string); get logo(): string; set logo(value: string); get feed(): MultiLanguage; set feed(value: MultiLanguage); get meta(): Array<{ key: string; value: any; }>; set meta(value: Array<{ key: string; value: any; }>); get languages(): string[]; set languages(value: string[]); } type IAccountSummary = Pick; interface IAccountInfoResponse { /** * The address of the account */ address: string; /** * The current balance in tokens. */ balance: number; /** * The nonce of the account. */ nonce: number; /** * The sik of the account. */ sik: string; /** * The index of the elections created by the account. */ electionIndex: number; /** * The number of transfers of the account. */ transfersCount: number; /** * The number of fees of the account. */ feesCount: number; /** * The information URI of the account */ infoURL?: string; /** * The metadata of the account */ metadata: AccountMetadata; } interface IAccountSetInfoResponse { /** * The hash of the transaction */ txHash: string; /** * The metadata URL */ metadataURL: number; } interface IAccountsListResponse extends IAccountsList, PaginationResponse { } interface IAccountsList { /** * List of accounts */ accounts: Array; } declare abstract class AccountAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Returns list of accounts * * @param url - API endpoint URL * @param params - The parameters to filter the accounts */ static list(url: string, params?: Partial): Promise; /** * Fetches an Account information * * @param url - API endpoint URL * @param accountId - The account we want the info from */ static info(url: string, accountId: string): Promise; /** * Fetches the account metadata * * @param url - API endpoint URL * @param accountId - The account we want the info from */ static metadata(url: string, accountId: string): Promise; /** * Sets Account information * * @param url - API endpoint URL * @param payload - The set information info raw payload to be submitted to the chain * @param metadata - The base64 encoded metadata JSON object */ static setInfo(url: string, payload: string, metadata: string): Promise; } interface ICensusCreateResponse { /** * The identifier of the census */ censusID: string; } interface ICensusAddResponse { } interface ICensusPublishResponse { /** * The identifier of the published census */ censusID: string; /** * The URI of the published census */ uri: string; } interface ICensusPublishAsyncResponse { /** * The identifier of the published census */ censusID: string; } interface ICensusExportResponse { /** * The type of the census */ type: number; /** * The root hash of the census */ rootHash: string; /** * The data of the census */ data: string; /** * The max levels of the census */ maxLevels: number; } interface ICensusImportResponse { } interface ICensusProofResponse { /** * The type of the census */ type: CensusType; /** * The weight as a string */ weight: string; /** * The root (id) of the census */ censusRoot: string; /** * The proof for the given key */ censusProof: string; /** * The value for the given key */ value: string; /** * The census siblings */ censusSiblings?: Array; } interface ICensusSizeResponse { /** * The size of the census (number of participants) */ size: number; } interface ICensusWeightResponse { /** * The weight of the census as a BigInt (sum of all weights) */ weight: string; } interface ICensusTypeResponse { /** * The type of the census */ type: CensusType; } declare abstract class CensusAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Create's a new census in the API. * * @param url - API endpoint URL * @param authToken - Authentication token * @param type - Type of census to be created */ static create(url: string, authToken: string, type: CensusType): Promise; /** * Adds participants to a census * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The id of the census to which participants are being added * @param participants - An array of participants */ static add(url: string, authToken: string, censusId: string, participants: Array<{ key: string; weight?: bigint; }>): Promise; /** * Publishes the census, so it can be used in processes * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The census ID we're publishing * @returns on success */ static publishSync(url: string, authToken: string, censusId: string): Promise; /** * Publishes the census using an async call * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The census ID we're publishing * @returns on success */ static publishAsync(url: string, authToken: string, censusId: string): Promise; /** * Checks that the census is published * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The census ID we're checking * @returns on success */ static check(url: string, authToken: string, censusId: string): Promise; /** * Checks if the specified address is in the specified census * * @param url - API endpoint URL * @param censusId - The census ID of which we want the proof from * @param key - The address to be checked * @returns on success */ static proof(url: string, censusId: string, key: string): Promise; /** * Exports the given census identifier * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The census ID we want to export * @returns on success */ static export(url: string, authToken: string, censusId: string): Promise; /** * Imports data into the given census identifier * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The census ID we want to export * @param type - The type of the census * @param rootHash - The root hash of the census * @param data - The census data to be imported * @returns on success */ static import(url: string, authToken: string, censusId: string, type: number, rootHash: string, data: string): Promise; /** * Deletes the given census * * @param url - API endpoint URL * @param authToken - Authentication token * @param censusId - The census ID we want to export * @returns on success */ static delete(url: string, authToken: string, censusId: string): Promise; /** * Returns the size of a given census * * @param url - API endpoint URL * @param censusId - The census ID */ static size(url: string, censusId: string): Promise; /** * Returns the weight of a given census * * @param url - API endpoint URL * @param censusId - The census ID */ static weight(url: string, censusId: string): Promise; /** * Returns the type of given census * * @param url - API endpoint URL * @param censusId - The census ID */ static type(url: string, censusId: string): Promise; } type Census3Pagination = { /** * The next cursor. */ nextCursor?: string; /** * The previous cursor. */ prevCursor?: string; /** * The page size. */ pageSize?: number; }; interface ICensus3QueueResponse { /** * The identifier of queue for the census creation */ queueID: string; } declare abstract class Census3API extends API { /** * Cannot be constructed. */ protected constructor(); protected static serializePagination(pagination?: Census3Pagination): string; protected static isApiError(error: AxiosError): never; } interface ICensus3CensusListResponse { /** * The list of the strategies identifiers */ censuses: Array; } interface ICensus3CensusResponse { /** * The identifier of the census */ ID: number; /** * The identifier of the strategy of the built census */ strategyID: number; /** * The root of the census */ merkleRoot: string; /** * The URI of the census */ uri: string; /** * The size of the census (number of token holders) */ size: number; /** * The weight of the census (weight of all token holders) */ weight: string; /** * If the census is anonymous or not */ anonymous: boolean; /** * The accuracy for an anonymous census */ accuracy: number; } interface ICensus3CensusQueueResponse { /** * If the queue has been done */ done: boolean; /** * The error of the queue */ error: { /** * The code of the error */ code: number; /** * The string of the error */ error: string; }; /** * The census data */ data: ICensus3CensusResponse; /** * The creation progress */ progress: number; } declare abstract class Census3CensusAPI extends Census3API { /** * Cannot be constructed. */ private constructor(); /** * Fetches list of census based on given strategy * * @param url - API endpoint URL * @param strategy - The identifier of the strategy */ static list(url: string, strategy: number): Promise; /** * Returns the information of the census * * @param url - API endpoint URL * @param id - The identifier of the census */ static census(url: string, id: number): Promise; /** * Returns the information of the census queue * * @param url - API endpoint URL * @param id - The identifier of the census queue */ static queue(url: string, id: string): Promise; /** * Requests the creation of a new census with the strategy provided. * * @param url - API endpoint URL * @param strategyId - The strategy identifier * @param anonymous - If the census has to be anonymous * @returns The queue identifier */ static create(url: string, strategyId: number, anonymous?: boolean): Promise; } interface ICensus3StrategiesListResponse { /** * The list of the strategies identifiers */ strategies: Array; } interface ICensus3StrategiesListResponsePaginated extends ICensus3StrategiesListResponse { /** * The pagination information */ pagination: Census3Pagination; } type Census3Strategy = { /** * The strategy identifier */ ID: number; /** * The strategy alias */ alias: string; /** * The strategy predicate */ predicate: string; /** * The URI of the strategy */ uri: string; /** * The list of tokens */ tokens: { [key: string]: Census3StrategyToken; }; }; type Census3StrategyToken = { /** * The id (address) of the token. */ ID: string; /** * The chain id of the token. */ chainID: number; /** * The chain address of the token. */ chainAddress: string; /** * The external identifier of the token. */ externalID?: string; /** * The minimum balance for the strategy. */ minBalance?: string; /** * The token icon URI. */ iconURI?: string; }; type Census3CreateStrategyToken = Omit; interface ICensus3StrategyEstimationQueueResponse { /** * If the queue has been done */ done: boolean; /** * The error of the queue */ error: { /** * The code of the error */ code: number; /** * The string of the error */ error: string; }; /** * The estimation data of the strategy */ data: { /** * The estimation of the size */ size: number; /** * The estimation of the time to create the census */ timeToCreateCensus: number; /** * The accuracy for an anonymous census */ accuracy: number; }; /** * The estimation progress */ progress: number; } interface ICensus3StrategyImportQueueResponse { /** * If the queue has been done */ done: boolean; /** * The error of the queue */ error: { /** * The code of the error */ code: number; /** * The string of the error */ error: string; }; /** * The imported data strategy */ data: Census3Strategy; /** * The importing progress */ progress: number; } interface ICensus3StrategyHoldersQueueResponse { /** * If the queue has been done */ done: boolean; /** * The error of the queue */ error: { /** * The code of the error */ code: number; /** * The string of the error */ error: string; }; /** * The list of the strategy holders */ data: { [key: string]: string; }; /** * The importing progress */ progress: number; } interface ICensus3StrategyToken { /** * The id (address) of the token. */ id: string; /** * The name of the token. */ name: string; /** * The minimum balance. */ minBalance: string; /** * The method used for checking balances. */ method: string; } interface ICensus3StrategyCreateResponse { /** * The identifier of the created strategy */ strategyID: number; } interface ICensus3ValidatePredicateToken { /** * The literal of the predicate */ literal: string; } interface ICensus3ValidatePredicateChild { /** * The operator used in the predicate */ operator: string; /** * The list of tokens of the predicate */ tokens: Array; } interface ICensus3StrategiesOperator { /** * The description of the operator */ description: string; /** * The tag of the operator */ tag: string; } interface ICensus3StrategiesOperatorsResponse { /** * The list of supported operators */ operators: Array; } interface ICensus3ValidatePredicateResponse { /** * The parsed version of the predicate */ result: { /** * The childs of the predicate */ childs: ICensus3ValidatePredicateChild; }; } declare abstract class Census3StrategyAPI extends Census3API { /** * Cannot be constructed. */ private constructor(); /** * Fetches list of strategies * * @param url - API endpoint URL * @param pagination - Pagination options */ static list(url: string, pagination?: Census3Pagination): Promise; /** * Fetches list of holders by strategy * * @param url - API endpoint URL * @param id - The identifier of the strategy * @returns The queue identifier */ static holders(url: string, id: number): Promise; /** * Returns the information of the strategy holders queue * * @param url - API endpoint URL * @param id - The identifier of the strategy * @param queueId - The identifier of the strategy holders queue */ static holdersQueue(url: string, id: number, queueId: string): Promise; /** * Fetches list of strategies based on given token * * @param url - API endpoint URL * @param tokenId - The identifier of the token * @param chainId - The chain identifier of the token * @param externalId - The identifier used by external provider */ static listByToken(url: string, tokenId: string, chainId: number, externalId?: string): Promise; /** * Returns the information of the strategy * * @param url - API endpoint URL * @param id - The identifier of the strategy */ static strategy(url: string, id: number): Promise; /** * Returns the estimation of size and time (in milliseconds) to create the census generated for the provided strategy * * @param url - API endpoint URL * @param predicate - The predicate of the strategy * @param tokens - The token list for the strategy * @param anonymous - If the estimation should be done for anonymous census * @returns The queue identifier */ static estimation(url: string, predicate: string, tokens: { [key: string]: Census3CreateStrategyToken; }, anonymous?: boolean): Promise; /** * Returns the information of the strategy estimation queue * * @param url - API endpoint URL * @param queueId - The identifier of the strategy estimation queue */ static estimationQueue(url: string, queueId: string): Promise; /** * Returns the information of the strategy import queue * * @param url - API endpoint URL * @param queueId - The identifier of the strategy import queue */ static importQueue(url: string, queueId: string): Promise; /** * Imports a strategy from IPFS from the given cid. * * @param url - API endpoint URL * @param cid - The cid of the IPFS where the strategy is stored * @returns The queue identifier */ static import(url: string, cid: string): Promise; /** * Creates a new strategy based on the given token strategies and predicate. * * @param url - API endpoint URL * @param alias - The alias of the strategy * @param predicate - The predicate of the strategy * @param tokens - The token list for the strategy * @returns The identifier of the created strategy */ static create(url: string, alias: string, predicate: string, tokens: { [key: string]: Census3CreateStrategyToken; }): Promise; /** * Validates a predicate. * * @param url - API endpoint URL * @param predicate - The predicate of the strategy * @returns Parsed version of the predicate */ static validatePredicate(url: string, predicate: string): Promise; /** * Returns the list of supported operators to build strategy predicates. * * @param url - API endpoint URL */ static operators(url: string): Promise; } interface ICensus3SupportedChain { /** * The identifier of the chain */ chainID: number; /** * The short name of the chain */ shortName: string; /** * The name of the chain */ name: string; } interface ICensus3ServiceInfoResponse { /** * The list of supported chains */ supportedChains: Array; } declare abstract class Census3ServiceAPI extends Census3API { /** * Cannot be constructed. */ private constructor(); /** * Fetches supported chains from the service * * @param url - API endpoint URL */ static info(url: string): Promise; } type Census3SummaryToken = Omit & { synced: boolean; }; type Census3Token = { /** * The id (address) of the token. */ ID: string; /** * The name of the token. */ name: string; /** * The size (token holders) of the token. */ size: number; /** * The type of the token. */ type: string; /** * The chain id of the token. */ chainID: number; /** * The external identifier of the token. */ externalID?: string; /** * The chain address of the token. */ chainAddress: string; /** * The creation block. */ startBlock: number; /** * The symbol of the token. */ symbol: string; /** * The decimals of the token */ decimals: number; /** * The total supply of the token. */ totalSupply: string; /** * The default strategy assigned. */ defaultStrategy: number; /** * The tags of the token. */ tags?: string; /** * The icon URI of the token. */ iconURI?: string; /** * The census3 status of the token. */ status: { /** * If the token is already synced or not. */ synced: boolean; /** * At which number of block the token is synced */ atBlock: number; /** * The progress percentage of the sync */ progress: number; }; }; interface ICensus3TokenListResponse { /** * The list of the tokens */ tokens: Array; } interface ICensus3TokenHolderResponse { /** * The balance of the holder */ balance: string; } interface ICensus3TokenListResponsePaginated extends ICensus3TokenListResponse { /** * The pagination information */ pagination: Census3Pagination; } interface ICensus3TokenTypesResponse { /** * The list of the tokens types */ supportedTypes: Array; } declare abstract class Census3TokenAPI extends Census3API { /** * Cannot be constructed. */ private constructor(); /** * Fetches list of already added tokens * * @param url - API endpoint URL * @param pagination - Pagination options */ static list(url: string, pagination?: Census3Pagination): Promise; /** * Fetches list of tokens types * * @param url - API endpoint URL */ static types(url: string): Promise; /** * Fetch the full token information * * @param url - API endpoint URL * @param tokenId - The identifier of the token * @param chainId - The chain identifier of the token * @param externalId - The identifier used by external provider */ static token(url: string, tokenId: string, chainId: number, externalId?: string): Promise; /** * Returns if the holder ID is already registered in the database as a holder of the token ID and chain ID provided. * * @param url - API endpoint URL * @param tokenId - The identifier of the token * @param chainId - The chain identifier of the token * @param holderId - The identifier of the holder * @param externalId - The identifier used by external provider * @returns The balance of holder */ static holder(url: string, tokenId: string, chainId: number, holderId: string, externalId?: string): Promise; /** * Triggers a new scan for the provided token. * * @param url - API endpoint URL * @param id - The token address * @param type - The type of the token * @param chainId - The chain id of the token * @param tags - The tags assigned for the token * @param externalId - The identifier used by external provider * @returns promised IFileCIDResponse */ static create(url: string, id: string, type: string, chainId: number, tags?: string, externalId?: string): Promise; } declare class ErrNotFoundCensus extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetCensus extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeCensuses extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantCreateCensus extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantAddHoldersToCensus extends Error { static readonly code: number; constructor(message?: string); } declare class ErrPruningCensus extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetTokenHolders extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeStrategyHolders extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedCensusID extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNotFoundTokenHolders extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoTokens extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeCensus extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetTokenCount extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedCensusQueueID extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeQueueItem extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedStrategyQueueID extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCensusAlreadyExists extends Error { static readonly code: number; constructor(message?: string); } declare class ErrInitializingWeb3 extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetLastBlockNumber extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeAPIInfo extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedPagination extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoStrategies extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetStrategies extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeStrategies extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedStrategyID extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNotFoundStrategy extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetStrategy extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeStrategy extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedStrategy extends Error { static readonly code: number; constructor(message?: string); } declare class ErrInvalidStrategyPredicate extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoEnoughtStrategyTokens extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantCreateStrategy extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoStrategyHolders extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEvalStrategyPredicate extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeValidPredicate extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeStrategyPredicateOperators extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoStrategyTokens extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoIPFSUri extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantImportStrategy extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetStrategyHolders extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedToken extends Error { static readonly code: number; constructor(message?: string); } declare class ErrTokenAlreadyExists extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantCreateToken extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetToken extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNotFoundToken extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeTokens extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeTokenTypes extends Error { static readonly code: number; constructor(message?: string); } declare class ErrCantGetTokens extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeToken extends Error { static readonly code: number; constructor(message?: string); } declare class ErrEncodeTokenHolders extends Error { static readonly code: number; constructor(message?: string); } declare class ErrChainIDNotSupported extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedChainID extends Error { static readonly code: number; constructor(message?: string); } declare class ErrMalformedHolder extends Error { static readonly code: number; constructor(message?: string); } declare class ErrNoTokenHolderFound extends Error { static readonly code: number; constructor(message?: string); } interface Tx { tx?: { $case: 'vote'; vote: VoteEnvelope; } | { $case: 'newProcess'; newProcess: NewProcessTx; } | { $case: 'admin'; admin: AdminTx; } | { $case: 'setProcess'; setProcess: SetProcessTx; } | { $case: 'registerKey'; registerKey: RegisterKeyTx; } | { $case: 'mintTokens'; mintTokens: MintTokensTx; } | { $case: 'sendTokens'; sendTokens: SendTokensTx; } | { $case: 'setTransactionCosts'; setTransactionCosts: SetTransactionCostsTx; } | { $case: 'setAccount'; setAccountInfo: SetAccountTx; } | { $case: 'collectFaucet'; collectFaucet: CollectFaucetTx; }; txInfo: IChainTxReference; signature: string; } interface VoteEnvelope { /** * Unique number per vote attempt, so that replay attacks can't reuse this payload * */ nonce: string; /** * The process for which the vote is casted * */ processId: string; /** * Franchise proof * */ proof: Proof | undefined; /** * JSON string of the Vote Package (potentially encrypted), encoded as bytes. * */ votePackage: string; /** * Hash of the private key + processId * */ nullifier: string; /** * On encrypted votes, contains the (sorted) indexes of the keys used to encrypt * */ encryptionKeyIndexes: number[]; } interface NewProcessTx { txtype: TxType; nonce: number; process: Process | undefined; } interface AdminTx { txtype: TxType; processId: Uint8Array; address?: Uint8Array | undefined; encryptionPrivateKey?: Uint8Array | undefined; encryptionPublicKey?: Uint8Array | undefined; keyIndex?: number | undefined; power?: number | undefined; publicKey?: Uint8Array | undefined; nonce: number; } interface SetProcessTx { txtype: TxType; nonce: number; processId: Uint8Array; status?: ProcessStatus | undefined; questionIndex?: number | undefined; censusRoot?: Uint8Array | undefined; censusURI?: string | undefined; proof?: Proof | undefined; results?: ProcessResult | undefined; } interface RegisterKeyTx { /** Unique number per vote attempt, so that replay attacks can't reuse this payload */ nonce: number; /** The process for which the vote is casted */ processId: Uint8Array; /** Franchise proof */ proof: Proof | undefined; /** New key to register */ newKey: Uint8Array; /** Weight to delegate to newKey */ weight: string; } interface MintTokensTx { txtype: TxType; nonce: number; to: Uint8Array; value: number; } interface SendTokensTx { txtype: TxType; nonce: number; from: Uint8Array; to: Uint8Array; value: number; } interface SetTransactionCostsTx { txtype: TxType; nonce: number; value: number; } interface SetAccountTx { txtype: TxType; nonce?: number | undefined; infoURI?: string | undefined; account?: Uint8Array | undefined; faucetPackage?: FaucetPackage$1 | undefined; delegates: Uint8Array[]; } interface CollectFaucetTx { txType: TxType; faucetPackage: FaucetPackage$1 | undefined; nonce: number; } interface FaucetPackage$1 { payload: Uint8Array; signature: Uint8Array; } interface Process { processId: Uint8Array; /** EntityId identifies unequivocally an entity */ entityId: Uint8Array; /** StartBlock represents the tendermint block where the process goes from scheduled to active */ startBlock: number; /** BlockCount represents the amount of tendermint blocks that the process will last */ blockCount: number; /** CensusRoot merkle root of all the census in the process */ censusRoot: Uint8Array; /** CensusURI where to find the census */ censusURI?: string | undefined; /** EncryptionPrivateKeys are the keys required to decrypt the votes */ encryptionPrivateKeys: string[]; /** EncryptionPublicKeys are the keys required to encrypt the votes */ encryptionPublicKeys: string[]; keyIndex?: number | undefined; status: ProcessStatus; paramsSignature?: Uint8Array | undefined; namespace: number; envelopeType: EnvelopeType | undefined; mode: ProcessMode | undefined; questionIndex?: number | undefined; questionCount?: number | undefined; voteOptions: ProcessVoteOptions | undefined; censusOrigin: CensusOrigin; results: ProcessResult[]; resultsSignatures: Uint8Array[]; ethIndexSlot?: number | undefined; /** SourceBlockHeight is the block height of the origin blockchain (if any) */ sourceBlockHeight?: number | undefined; /** Owner is the creator of a process (if any) otherwise is assumed the creator is the entityId */ owner?: Uint8Array | undefined; /** Metadata is the content hashed URI of the JSON meta data (See Data Origins) */ metadata?: string | undefined; /** SourceNetworkId is the identifier of the network origin (where the process have been created) */ sourceNetworkId: SourceNetworkId; /** MaxCensusSize is set by the Process creator. */ maxCensusSize?: number | undefined; /** * RollingCensusRoot merkle root of the rolling census. Set by the * vocdoni-node when Mode.Process = true */ rollingCensusRoot?: Uint8Array | undefined; /** * RollingCensusSize is set by the vocdoni-node when Mode.PreRegister = * true and the StartBlock has been reached. */ rollingCensusSize?: number | undefined; /** * NullifiersRoot is the root of the pre-census nullifiers merkle tree. * Used when Mode.PreRegister = true. */ nullifiersRoot?: Uint8Array | undefined; /** * sourceNetworkContractAddr is used for EVM token based voting and it is * the contract address of the token that is going to define the census */ sourceNetworkContractAddr?: Uint8Array | undefined; /** * tokenDecimals represents the number of decimals of the token (i.e ERC20) used for voting. * It is normally used for processes with on-chain census */ tokenDecimals?: number | undefined; } declare enum CensusOrigin { CENSUS_UNKNOWN = 0, OFF_CHAIN_TREE = 1, OFF_CHAIN_TREE_WEIGHTED = 2, OFF_CHAIN_CA = 3, ERC20 = 11, ERC721 = 12, ERC1155 = 13, ERC777 = 14, MINI_ME = 15, UNRECOGNIZED = -1 } /** Scrutinizer */ interface ProcessResult { votes: QuestionResult[]; processId?: Uint8Array | undefined; entityId?: Uint8Array | undefined; oracleAddress?: Uint8Array | undefined; signature?: Uint8Array | undefined; } interface QuestionResult { question: Uint8Array[]; } interface ProcessVoteOptions { maxCount: number; maxValue: number; maxVoteOverwrites: number; maxTotalCost: number; costExponent: number; } declare enum SourceNetworkId { UNKNOWN = 0, ETH_MAINNET = 1, ETH_RINKEBY = 2, ETH_GOERLI = 3, POA_XDAI = 4, POA_SOKOL = 5, POLYGON = 6, BSC = 7, ETH_MAINNET_SIGNALING = 8, ETH_RINKEBY_SIGNALING = 9, AVAX_FUJI = 10, AVAX = 11, POLYGON_MUMBAI = 12, OPTIMISM = 13, ARBITRUM = 14, UNRECOGNIZED = -1 } interface ProcessMode { interruptible: boolean; dynamicCensus: boolean; encryptedMetaData: boolean; preRegister: boolean; } interface EnvelopeType { serial: boolean; anonymous: boolean; encryptedVotes: boolean; uniqueValues: boolean; costFromWeight: boolean; } declare enum ProcessStatus { PROCESS_UNKNOWN = 0, READY = 1, ENDED = 2, CANCELED = 3, PAUSED = 4, RESULTS = 5, UNRECOGNIZED = -1 } declare enum TxType { TX_UNKNOWN = 0, NEW_PROCESS = 1, SET_PROCESS_STATUS = 2, SET_PROCESS_CENSUS = 3, SET_PROCESS_QUESTION_INDEX = 4, ADD_PROCESS_KEYS = 5, REVEAL_PROCESS_KEYS = 6, ADD_ORACLE = 7, REMOVE_ORACLE = 8, ADD_VALIDATOR = 9, REMOVE_VALIDATOR = 10, VOTE = 11, SET_PROCESS_RESULTS = 12, REGISTER_VOTER_KEY = 13, MINT_TOKENS = 14, SEND_TOKENS = 15, SET_TRANSACTION_COSTS = 16, SET_ACCOUNT_INFO_URI = 17, ADD_DELEGATE_FOR_ACCOUNT = 18, DEL_DELEGATE_FOR_ACCOUNT = 19, COLLECT_FAUCET = 20, ADD_KEYKEEPER = 21, DELETE_KEYKEEPER = 22, CREATE_ACCOUNT = 23, UNRECOGNIZED = -1 } interface Proof { payload?: { $case: 'graviton'; graviton: { siblings: Uint8Array; }; } | { $case: 'iden3'; iden3: { siblings: Uint8Array; }; } | { $case: 'ethereumStorage'; ethereumStorage: { key: Uint8Array; value: Uint8Array; siblings: Uint8Array[]; }; } | { $case: 'ethereumAccount'; ethereumAccount: { nonce: Uint8Array; /** Big Int encoded as bytes */ balance: Uint8Array; storageHash: Uint8Array; codeHash: Uint8Array; siblings: Uint8Array[]; }; } | { $case: 'ca'; ca: { type: ProofCA_Type; bundle: { processId: Uint8Array; address: Uint8Array; } | undefined; signature: Uint8Array; }; } | { $case: 'arbo'; arbo: { type: ProofArbo_Type; siblings: Uint8Array; value: Uint8Array; keyType: ProofArbo_KeyType; }; } | { $case: 'zkSnark'; zkSnark: { circuitParametersIndex: number; a: string[]; b: string[]; c: string[]; publicInputs: string[]; }; } | { $case: 'minimeStorage'; minimeStorage: { proofPrevBlock: { key: Uint8Array; value: Uint8Array; siblings: Uint8Array[]; } | undefined; proofNextBlock?: { key: Uint8Array; value: Uint8Array; siblings: Uint8Array[]; } | undefined; }; }; } declare enum ProofCA_Type { UNKNOWN = 0, ECDSA = 1, ECDSA_PIDSALTED = 2, ECDSA_BLIND = 3, ECDSA_BLIND_PIDSALTED = 4, UNRECOGNIZED = -1 } declare enum ProofArbo_Type { BLAKE2B = 0, POSEIDON = 1, UNRECOGNIZED = -1 } declare enum ProofArbo_KeyType { PUBKEY = 0, ADDRESS = 1, UNRECOGNIZED = -1 } interface IChainGetInfoResponse { /** * The id of the current chain */ chainId: string; /** * The different block times from the chain. */ blockTime: number[]; /** * The number of elections existing on the Vochain. */ electionCount: number; /** * The number of organizations existing on the Vochain. */ organizationCount: number; /** * The time of the genesis block. */ genesisTime: string; /** * The height or actual block of the current chain. */ height: number; /** * Whether the blockchain is syncing. */ syncing: boolean; /** * The timestamp of the actual block. */ blockTimestamp: number; /** * The number of transactions. */ transactionCount: number; /** * The number of validators. */ validatorCount: number; /** * The number of votes. */ voteCount: number; /** * The circuit configuration tag. */ circuitConfigurationTag: string; /** * The maximum size of a census. */ maxCensusSize: number; } interface IChainGetCostsResponse { /** * The base price. */ basePrice: number; /** * The capacity of the chain. */ capacity: number; /** * The factors. */ factors: { k1: number; k2: number; k3: number; k4: number; k5: number; k6: number; k7: number; }; } interface IChainGetCircuitResponse { /** * The base uri of the files. */ uri: string; /** * The path of the circuit. */ circuitPath: string; /** * The circuit levels. */ levels: number; /** * The hash of the proving key file. */ zKeyHash: string; /** * The name of the proving key file. */ zKeyFilename: string; /** * The hash of the verification key file. */ vKeyHash: string; /** * The name of the verification key file. */ vKeyFilename: string; /** * The hash of the WASM file. */ wasmHash: string; /** * The name of the WASM file. */ wasmFilename: string; } declare enum TransactionType { VOTE_ENVELOPE = "vote", NEW_PROCESS_TX = "newProcess", ADMIN_TX = "admin", SET_PROCESS_TX = "setProcess", REGISTER_KEY_TX = "registerKey", MINT_TOKENS_TX = "mintTokens", SEND_TOKENS_TX = "sendTokens", SET_TRANSACTION_COSTS_TX = "setTransactionCosts", SET_ACCOUNT_TX = "setAccount", COLLECT_FAUCET_TX = "collectFaucet", SET_KEYKEEPER_TX = "setKeykeeper" } interface IChainTxCosts { costs: { AddDelegateForAccount: number; CollectFaucet: number; CreateAccount: number; DelAccountSIK: number; DelDelegateForAccount: number; NewProcess: number; RegisterKey: number; SendTokens: number; SetAccountInfoURI: number; SetAccountSIK: number; SetAccountValidator: number; SetProcessCensus: number; SetProcessDuration: number; SetProcessQuestionIndex: number; SetProcessStatus: number; }; } interface IChainTxReference { /** * The hash of the transaction. */ hash: string; /** * The number of the block where the transaction is. */ height: number; /** * The index of the transaction inside the block. */ index: number; /** * The type of the transaction. */ type: TransactionType; /** * The subtype of the transaction. */ subtype: string; /** * The signer of the transaction. */ signer: string; } interface IChainSubmitTxResponse { /** * The hash of the transaction */ hash: string; /** * The response data (can vary depending on the transaction type) */ response: string; /** * The response code */ code: number; } interface IChainTxListResponse extends IChainTxList, PaginationResponse { } interface IChainTxList { /** * List of transactions */ transactions: Array; } interface IChainBlocksListResponse extends IChainBlocksList, PaginationResponse { } interface IChainBlocksList { /** * List of blocks */ blocks: Array; } interface IBlock { chainId: string; height: number; time: string; hash: string; proposer: string; lastBlockHash: string; txCount: number; } interface IChainTransfersListResponse extends IChainTransfersList, PaginationResponse { } interface IChainTransfersList { /** * List of transfers */ transfers: Array; } interface ITransfer { amount: number; from: string; height: number; txHash: string; timestamp: string; to: string; } interface IChainOrganizationResponse { /** * The identifier of the organization */ organizationID: string; /** * The number of elections */ electionCount: number; } interface IChainOrganizationListResponse extends OrganizationList, PaginationResponse { } interface OrganizationList { /** * The list of organizations */ organizations: Array; } interface BlockID { hash: string; parts: { total: number; hash: string; }; } interface IChainBlockInfoResponse { hash: string; header: { appHash: string; chainId: string; consensusHash: string; dataHash: string; evidenceHash: string; height: number; lastBlockId: BlockID; lastCommitHash: string; lastResultsHash: string; nextValidatorsHash: string; proposerAddress: string; time: string; validatorsHash: string; version: { block: number; app: number; }; }; txCount: number; } interface IDateToBlockResponse { height: number; } interface IBlockToDateResponse { date: string; } interface IChainValidator { /** * Current power of the validator */ power: number; /** * Validator public key */ pubKey: string; /** * Validator address */ address: string; /** * Validator name reference. Could be empty. */ name: string; /** * Block height when validator joint */ joinHeight: number; /** * Total block proposals count */ proposals: number; /** * Validatos effectivity. Between 0 and 100 */ score: number; /** * Validator address */ validatorAddress: string; /** * Number ob validated blocks (not created) */ votes: number; } interface IChainValidatorsListResponse { /** * The list of validators */ validators: Array; } type Fee = { /** * The cost of the transaction */ cost: number; /** * The account generating the transaction */ from: string; /** * The block number */ height: number; /** * The transaction hash */ reference: string; /** * The timestamp of the transaction */ timestamp: string; /** * The type of the transaction */ txType: string; }; interface IChainFeesListResponse extends IFeesList, PaginationResponse { } interface IFeesList { /** * The list of fees */ fees: Array; } declare abstract class ChainAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Fetches info about the blockchain status. * * @param url - API endpoint URL */ static info(url: string): Promise; /** * Fetches info about the blockchain costs. * * @param url - API endpoint URL */ static costs(url: string): Promise; /** * Fetches info about the blockchain anonymous circuits. * * @param url - API endpoint URL */ static circuits(url: string): Promise; /** * Fetches a circuit. * * @param url - Circuit URL */ static circuit(url: string): Promise; /** * Returns the list of transactions and its cost * @param url - API endpoint URL */ static txCosts(url: string): Promise; /** * Fetches information about a transaction from the blockchain. * * @param url - API endpoint URL * @param txHash - The transaction hash which we want to retrieve the info from */ static txInfo(url: string, txHash: string): Promise; /** * Submits a transaction to the blockchain * * @param url - API endpoint URL * @param payload - The transaction data payload */ static submitTx(url: string, payload: string): Promise; /** * Returns the list of transactions * * @param url - {string} url API endpoint URL * @param params - The parameters to filter the transactions */ static txList(url: string, params?: Partial): Promise; /** * Returns the list of transfers * * @param url - {string} url API endpoint URL * @param params - The parameters to filter the transfers */ static transfers(url: string, params?: Partial): Promise; /** * Returns the list of fees * * @param url - {string} url API endpoint URL * @param params - The parameters to filter the fees */ static feesList(url: string, params?: Partial): Promise; /** * Returns the list of organizations * * @param url - API endpoint URL * @param params - The parameters to filter the organizations */ static organizationList(url: string, params?: Partial): Promise; /** * Returns the list of validators * * @param url - API endpoint URL */ static validatorsList(url: string): Promise; /** * Get block information by hash * * @param url - API endpoint URL * @param hash - block hash */ static blockInfoHash(url: string, hash: string): Promise; /** * Get block information by height * * @param url - API endpoint URL * @param height - block height */ static blockInfoHeight(url: string, height: number): Promise; /** * Returns the list of blocks * * @param url - {string} url API endpoint URL * @param params - The parameters to filter the blocks */ static blocksList(url: string, params?: Partial): Promise; /** * By a given date give the estimate block for the current Vochain. * @param url - API URL * @param timeStamp - unix format timestamp */ static dateToBlock(url: string, timeStamp: number): Promise; /** * Return approximate date by a given block height. * * @param url - API URL * @param height - block height to calculate approximate timestamp * @return {Promise} */ static blockToDate(url: string, height: number): Promise; } interface ICensus { /** * The type of the census */ censusOrigin: CensusTypeEnum; /** * The root of the census */ censusRoot: string; /** * The post register root of the census */ postRegisterCensusRoot: string; /** * The URL of the census */ censusURL: string; /** * Max size of the census. How many voters the census can have. */ maxCensusSize: number; } interface IVoteMode { /** * If the vote is serial */ serial: boolean; /** * If the vote is anonymous */ anonymous: boolean; /** * If the vote is encrypted */ encryptedVotes: boolean; /** * If the vote values are unique */ uniqueValues: boolean; /** * Cost from weight of the election */ costFromWeight: boolean; } interface IElectionMode { /** * If the election is interruptible */ interruptible: boolean; /** * If the election has a dynamic census */ dynamicCensus: boolean; /** * If the election has encrypted metadata */ encryptedMetaData: boolean; /** * If the election has preregister phase */ preRegister: boolean; } interface ITallyMode { /** * The max count of the vote's values sum */ maxCount: number; /** * The max value of the vote's values */ maxValue: number; /** * The max number of votes overwrites */ maxVoteOverwrites: number; /** * The max total cost of the votes */ maxTotalCost: number; /** * The cost exponent of the vote */ costExponent: number; } interface IElectionCreateResponse { /** * The hash of the transaction */ txHash: string; /** * The election identifier */ electionID: string; /** * The metadata URL */ metadataURL: number; } interface IElectionNextIdResponse { /** * The next election identifier */ electionID: string; } declare enum CensusTypeEnum { CENSUS_UNKNOWN = "CENSUS_UNKNOWN", OFF_CHAIN_TREE = "OFF_CHAIN_TREE", OFF_CHAIN_TREE_WEIGHTED = "OFF_CHAIN_TREE_WEIGHTED", OFF_CHAIN_CA = "OFF_CHAIN_CA", ERC20 = "ERC20", ERC721 = "ERC721", ERC1155 = "ERC1155", ERC777 = "ERC777", MINI_ME = "MINI_ME" } interface IElectionInfoResponse { /** * The id of the election */ electionId: string; /** * The id of the organization that created the election */ organizationId: string; /** * The status of the election */ status: Exclude; /** * The start date of the election */ startDate: string; /** * The end date of the election */ endDate: string; /** * The number of votes of the election */ voteCount: number; /** * If the election has the final results */ finalResults: boolean; /** * The result of the election */ result?: Array>; /** * If the election has been ended manually */ manuallyEnded: boolean; /** * The chain identifier of the election */ chainId: string; /** * The census of the election */ census: ICensus; /** * The URL of the metadata */ metadataURL: string; /** * The date of creation of the election */ creationTime: string; /** * The voting mode of the election */ voteMode: IVoteMode; /** * The election mode of the election */ electionMode: IElectionMode; /** * The tally mode of the vote */ tallyMode: ITallyMode; /** * The metadata of the election (can be encrypted) */ metadata: ElectionMetadata | string; } interface IEncryptionKey { /** * The index of the encryption key */ index: number; /** * The encryption key */ key: string; } interface IElectionKeysResponse { publicKeys: IEncryptionKey[]; privateKeys: IEncryptionKey[]; } interface IElectionCalculatePriceResponse { /** * The price of the election */ price: number; } interface IElectionSummary { /** * The id of the election */ electionId: string; /** * The id of the organization */ organizationId: string; /** * The status of the election */ status: Exclude; /** * The start date of the election */ startDate: string; /** * The end date of the election */ endDate: string; /** * The number of votes of the election */ voteCount: number; /** * If the election has the final results */ finalResults: boolean; /** * If the election has been ended manually */ manuallyEnded: boolean; /** * The chain identifier */ chainId: string; } interface IElectionListResponse extends IElectionList, PaginationResponse { } interface IElectionList { /** * List of election summaries */ elections: Array; } declare abstract class ElectionAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Fetches info about the specified process. * * @param url - API endpoint URL * @param electionId - The identifier of the election */ static info(url: string, electionId: string): Promise; /** * Fetches the encryption keys from the specified process. * * @param url - API endpoint URL * @param electionId - The identifier of the election */ static keys(url: string, electionId: string): Promise; /** * Creates a new election. * * @param url - API endpoint URL * @param payload - The set information info raw payload to be submitted to the chain * @param metadata - The base64 encoded metadata JSON object */ static create(url: string, payload: string, metadata: string): Promise; /** * Returns the next election id. * * @param url - API endpoint URL * @param organizationId - The identifier of the organization * @param censusOrigin - The census origin * @param delta - The stride to next election id, being 0 the next one * @param envelopeType - The envelope type */ static nextElectionId(url: string, organizationId: string, censusOrigin: number, delta?: number, envelopeType?: Partial): Promise; /** * Return list of all elections in the chain * * @param url - API endpoint URL * @param params - The parameters to filter the elections */ static list(url: string, params?: Partial): Promise; /** * Calculates the election price. * * @param url - API endpoint URL * @param maxCensusSize - * @param electionDuration - * @param encryptedVotes - * @param anonymousVotes - * @param maxVoteOverwrite - */ static price(url: string, maxCensusSize: number, electionDuration: number, encryptedVotes: boolean, anonymousVotes: boolean, maxVoteOverwrite: number): Promise; } declare class ErrAddressMalformed extends Error { constructor(message?: string); } declare class ErrDstAddressMalformed extends Error { constructor(message?: string); } declare class ErrDstAccountUnknown extends Error { constructor(message?: string); } declare class ErrAccountNotFound extends Error { constructor(message?: string); } declare class ErrAccountAlreadyExists extends Error { constructor(message?: string); } declare class ErrOrgNotFound extends Error { constructor(message?: string); } declare class ErrTransactionNotFound extends Error { constructor(message?: string); } declare class ErrBlockNotFound extends Error { constructor(message?: string); } declare class ErrMetadataProvidedButNoURI extends Error { constructor(message?: string); } declare class ErrMetadataURINotMatchContent extends Error { constructor(message?: string); } declare class ErrMarshalingJSONFailed extends Error { constructor(message?: string); } declare class ErrFileSizeTooBig extends Error { constructor(message?: string); } declare class ErrCantParseOrgID extends Error { constructor(message?: string); } declare class ErrCantParseAccountID extends Error { constructor(message?: string); } declare class ErrCantParseBearerToken extends Error { constructor(message?: string); } declare class ErrCantParseDataAsJSON extends Error { constructor(message?: string); } declare class ErrCantParseElectionID extends Error { constructor(message?: string); } declare class ErrCantParseMetadataAsJSON extends Error { constructor(message?: string); } declare class ErrCantParseNumber extends Error { constructor(message?: string); } declare class ErrCantParsePayloadAsJSON extends Error { constructor(message?: string); } declare class ErrCantParseVoteID extends Error { constructor(message?: string); } declare class ErrCantExtractMetadataURI extends Error { constructor(message?: string); } declare class ErrVoteIDMalformed extends Error { constructor(message?: string); } declare class ErrVoteNotFound extends Error { constructor(message?: string); } declare class ErrCensusIDLengthInvalid extends Error { constructor(message?: string); } declare class ErrCensusRootIsNil extends Error { constructor(message?: string); } declare class ErrCensusTypeUnknown extends Error { constructor(message?: string); } declare class ErrCensusTypeMismatch extends Error { constructor(message?: string); } declare class ErrCensusIndexedFlagMismatch extends Error { constructor(message?: string); } declare class ErrCensusRootHashMismatch extends Error { constructor(message?: string); } declare class ErrParamStatusInvalid extends Error { constructor(message?: string); } declare class ErrParamParticipantsMissing extends Error { constructor(message?: string); } declare class ErrParamParticipantsTooBig extends Error { constructor(message?: string); } declare class ErrParamDumpOrRootMissing extends Error { constructor(message?: string); } declare class ErrParamKeyOrProofMissing extends Error { constructor(message?: string); } declare class ErrParamRootInvalid extends Error { constructor(message?: string); } declare class ErrParamNetworkInvalid extends Error { constructor(message?: string); } declare class ErrParamToInvalid extends Error { constructor(message?: string); } declare class ErrParticipantKeyMissing extends Error { constructor(message?: string); } declare class ErrIndexedCensusCantUseWeight extends Error { constructor(message?: string); } declare class ErrWalletNotFound extends Error { constructor(message?: string); } declare class ErrWalletPrivKeyAlreadyExists extends Error { constructor(message?: string); } declare class ErrElectionEndDateInThePast extends Error { constructor(message?: string); } declare class ErrElectionEndDateBeforeStart extends Error { constructor(message?: string); } declare class ErrElectionNotFound extends Error { constructor(message?: string); } declare class ErrCensusNotFound extends Error { constructor(message?: string); } declare class ErrNoElectionKeys extends Error { constructor(message?: string); } declare class ErrMissingParameter extends Error { constructor(message?: string); } declare class ErrKeyNotFoundInCensus extends Error { constructor(message?: string); } declare class ErrInvalidStatus extends Error { constructor(message?: string); } declare class ErrInvalidCensusKeyLength extends Error { constructor(message?: string); } declare class ErrUnmarshalingServerProto extends Error { constructor(message?: string); } declare class ErrMarshalingServerProto extends Error { constructor(message?: string); } declare class ErrSIKNotFound extends Error { constructor(message?: string); } declare class ErrCantParseBoolean extends Error { constructor(message?: string); } declare class ErrCantParseHexString extends Error { constructor(message?: string); } declare class ErrPageNotFound extends Error { constructor(message?: string); } declare class ErrVochainEmptyReply extends Error { constructor(message?: string); } declare class ErrVochainSendTxFailed extends Error { constructor(message?: string); } declare class ErrVochainGetTxFailed extends Error { constructor(message?: string); } declare class ErrVochainReturnedErrorCode extends Error { constructor(message?: string); } declare class ErrVochainReturnedInvalidElectionID extends Error { constructor(message?: string); } declare class ErrVochainReturnedWrongMetadataCID extends Error { constructor(message?: string); } declare class ErrMarshalingServerJSONFailed extends Error { constructor(message?: string); } declare class ErrCantFetchElection extends Error { constructor(message?: string); } declare class ErrCantFetchTokenTransfers extends Error { constructor(message?: string); } declare class ErrCantFetchEnvelopeHeight extends Error { constructor(message?: string); } declare class ErrCantFetchEnvelope extends Error { constructor(message?: string); } declare class ErrCantCheckTxType extends Error { constructor(message?: string); } declare class ErrCantABIEncodeResults extends Error { constructor(message?: string); } declare class ErrCantComputeKeyHash extends Error { constructor(message?: string); } declare class ErrCantAddKeyAndValueToTree extends Error { constructor(message?: string); } declare class ErrCantAddKeyToTree extends Error { constructor(message?: string); } declare class ErrCantGenerateFaucetPkg extends Error { constructor(message?: string); } declare class ErrCantEstimateBlockHeight extends Error { constructor(message?: string); } declare class ErrCantMarshalMetadata extends Error { constructor(message?: string); } declare class ErrCantPublishMetadata extends Error { constructor(message?: string); } declare class ErrTxTypeMismatch extends Error { constructor(message?: string); } declare class ErrElectionIsNil extends Error { constructor(message?: string); } declare class ErrElectionResultsNotYetAvailable extends Error { constructor(message?: string); } declare class ErrElectionResultsIsNil extends Error { constructor(message?: string); } declare class ErrElectionResultsMismatch extends Error { constructor(message?: string); } declare class ErrCantGetCircomSiblings extends Error { constructor(message?: string); } declare class ErrCensusProofVerificationFailed extends Error { constructor(message?: string); } declare class ErrCantCountVotes extends Error { constructor(message?: string); } declare class ErrVochainOverloaded extends Error { constructor(message?: string); } declare class ErrGettingSIK extends Error { constructor(message?: string); } declare class ErrCensusBuild extends Error { constructor(message?: string); } declare class ErrIndexerQueryFailed extends Error { constructor(message?: string); } declare class ErrCantFetchTokenFees extends Error { constructor(message?: string); } declare class ErrFaucetAlreadyFunded extends Error { untilDate: Date; constructor(message?: string); } declare class ErrElectionNotStarted extends Error { constructor(message?: string); } declare class ErrElectionFinished extends Error { constructor(message?: string); } declare class CensusStillNotPublished extends Error { constructor(message?: string); } interface IFaucetCollectResponse { /** * The amount of tokens. */ amount: string; /** * The base64 JSON containing the payload and the signature */ faucetPackage: string; } declare abstract class FaucetAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Calls the collect tokens method. * * @param url - API endpoint URL * @param address - Address to send the tokens to */ static collect(url: string, address: string): Promise; } interface IFileCIDResponse { /** * The calculated CID of the data */ cid: string; } declare abstract class FileAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * CID generator method via API. * * @param url - API endpoint URL * @param payload - Full payload string of which we want the CID of * @returns promised IFileCIDResponse */ static cid(url: string, payload: string): Promise; } interface IVoteSubmitResponse { /** * The hash of the transaction */ txHash: string; /** * The identifier of the vote, also called nullifier. */ voteID: string; } interface IVotePackage { /** * The nonce of the vote package */ nonce: string; /** * The raw vote package */ votes: number[]; } interface IVoteEncryptedPackage { /** * The base64 encrypted vote package */ encrypted: string; } interface IVoteListResponse extends VotesList, PaginationResponse { } interface VotesList { /** * The list of votes */ votes: Array; } type VoteSummary = Pick; type VoteInfoResponse = { /** * The hash of the transaction */ txHash: string; /** * The identifier of the vote, also called nullifier. */ voteID: string; /** * Encryption key indexes used */ encryptionKeys?: number[]; /** * The vote package. */ package: IVotePackage | IVoteEncryptedPackage; /** * The weight of the vote. */ weight: string; /** * The identifier of the election. */ electionID: string; /** * The identifier of the voter. */ voterID: string; /** * The block number where the transaction is mined. */ blockHeight: number; /** * The index inside the block where the transaction is mined. */ transactionIndex: number; /** * The number of votes overwrites. */ overwriteCount: number; /** * Date when the vote was emitted */ date: string; }; declare abstract class VoteAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Submits a payload representing the vote transaction to the chain * * @param url - API endpoint URL * @param payload - The base64 encoded vote transaction * */ static submit(url: string, payload: string): Promise; /** * Vote info * * @param url - API endpoint URL * @param voteId - The identifier of the vote * */ static info(url: string, voteId: string): Promise; /** * Fetches the vote list * * @param url - API endpoint URL * @param params - The parameters to filter the votes */ static list(url: string, params?: Partial): Promise; /** * Verify vote. A vote exists in a process. * * @param url - API endpoint URL * @param electionId - The process identifier * @param voteId - The identifier of the vote * * @returns Return true if response has status 200 */ static verify(url: string, electionId: string, voteId: string): Promise; } interface IWalletAddResponse { /** * The address of the added account */ address: string; /** * The new token added */ token: string; } declare abstract class WalletAPI extends API { /** * Cannot be constructed. */ private constructor(); static add(url: string, privateKey: string): Promise; } interface ICspAuthStep { /** * The title of the step */ title: string; /** * The type of data of the step */ type: string; } interface ICspInfoResponse { /** * The title of the CSP Information */ title: string; /** * The types of signature of the CSP */ signatureType: Array; /** * The authentication type of the CSP */ authType: string; /** * The auth steps to follow in order to get a blind signature */ authSteps: Array; } interface ICspIntermediateStepResponse { /** * The auth token for the following requests */ authToken: string; /** * The response of the CSP */ response: Array; } interface ICspFinalStepResponse { /** * The final token */ token: string; } interface ICspSignResponse { /** * The blind signature */ signature: string; } declare abstract class CspAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * CSP info * * @param url - CSP endpoint URL * */ static info(url: string): Promise; /** * CSP step * * @param url - CSP endpoint URL * @param electionId - The election identifier * @param signatureType - The type of the signature * @param authType - The type of the auth method * @param stepNr - The step number * @param data - The auth data * @param authToken - The auth token from the previous step * */ static step(url: string, electionId: string, signatureType: string, authType: string, stepNr: number, data: Array, authToken?: string): Promise; /** * CSP sign * * @param url - CSP endpoint URL * @param electionId - The election identifier * @param signatureType - The type of the signature * @param payload - The payload from the user * @param token - The token from the last step * */ static sign(url: string, electionId: string, signatureType: string, payload: string, token: string): Promise; } interface IZkProofResponse { /** * The root (id) of the census */ censusRoot: string; /** * The proof for the given key */ censusProof: string; /** * The value for the given key */ value: string; /** * The value for the census siblings */ censusSiblings: Array; } interface IZkSIKResponse { /** * The sik of the address */ sik: string; } declare abstract class ZkAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Returns the ZK proof on given address * * @param url - API endpoint URL * @param key - The address to be checked * @returns The ZK proof */ static proof(url: string, key: string): Promise; /** * Returns the SIK on given address * * @param url - API endpoint URL * @param key - The address to be checked * @returns The ZK proof */ static sik(url: string, key: string): Promise; } interface IRemoteSignerLoginResponse { /** * The JWT token */ token: string; /** * The JWT token expiry */ expirity: string; } interface IRemoteSignerRefreshResponse { /** * The JWT token */ token: string; /** * The JWT token expiry */ expirity: string; } interface IRemoteSignerAddressesResponse { /** * The list of addresses */ addresses: Array; } interface IRemoteSignerSignTxResponse { /** * The signed transaction payload */ txPayload: string; } interface IRemoteSignerSignResponse { /** * The signed payload */ signature: string; } declare abstract class RemoteSignerAPI extends API { /** * Cannot be constructed. */ private constructor(); /** * Logs in a user using email and password. * * @param url - API endpoint URL * @param email - The email address * @param password - The password */ static login(url: string, email: string, password: string): Promise; /** * Refreshes the JWT token. * * @param url - API endpoint URL * @param authToken - Authentication token */ static refresh(url: string, authToken: string): Promise; /** * Gets the writable addresses of the logged-in user. * * @param url - API endpoint URL * @param authToken - Authentication token */ static addresses(url: string, authToken: string): Promise; /** * Signs the transaction using the remote signer. * * @param url - API endpoint URL * @param authToken - Authentication token * @param address - The address * @param payload - The transaction payload */ static signTransaction(url: string, authToken: string, address: string, payload: string): Promise; /** * Signs the payload using the remote signer. * * @param url - API endpoint URL * @param authToken - Authentication token * @param address - The address * @param payload - The payload */ static sign(url: string, authToken: string, address: string, payload: string): Promise; } declare class UnauthorizedError extends Error { constructor(message?: string); } declare class EmailMalformedError extends Error { constructor(message?: string); } declare class PasswordTooShortError extends Error { constructor(message?: string); } declare class MalformedBodyError extends Error { constructor(message?: string); } declare class DuplicateConflictError extends Error { constructor(message?: string); } declare class InvalidUserDataError extends Error { constructor(message?: string); } declare class CouldNotSignTransactionError extends Error { constructor(message?: string); } declare class InvalidTxFormatError extends Error { constructor(message?: string); } declare class TxTypeNotAllowedError extends Error { constructor(message?: string); } declare class OrganizationNotFoundError extends Error { constructor(message?: string); } declare class MalformedURLParamError extends Error { constructor(message?: string); } declare class NoOrganizationProvidedError extends Error { constructor(message?: string); } declare class NoOrganizationsError extends Error { constructor(message?: string); } declare class MarshalingServerJSONFailedError extends Error { constructor(message?: string); } declare class GenericInternalServerError extends Error { constructor(message?: string); } declare class CouldNotCreateFaucetPackageError extends Error { constructor(message?: string); } interface ChainServiceProperties { chainCosts: ChainCosts; chainData: ChainData; txWait: TxWaitOptions$1; } type ChainServiceParameters = ServiceProperties & ChainServiceProperties; type ChainCosts = IChainGetCostsResponse; type ChainTx = Tx; type FetchOrganizationParametersWithPagination = FetchOrganizationParameters & PaginationRequest; type FetchFeesParametersWithPagination = FetchFeesParameters & PaginationRequest; type FetchTransactionsParametersWithPagination = FetchTransactionsParameters & PaginationRequest; type FetchTransfersParametersWithPagination = FetchTransfersParameters & PaginationRequest; type FetchBlocksParametersWithPagination = FetchBlocksParameters & PaginationRequest; interface FetchOrganizationParameters { organizationId: string; } interface FetchFeesParameters { reference: string; type: string; accountId: string; } interface FetchTransfersParameters { accountId: string; accountIdFrom: string; accountIdTo: string; } interface FetchTransactionsParameters { hash: string; height: number; index: number; type: string; subtype: string; signer: string; } interface FetchBlocksParameters { hash: string; chainId: string; proposerAddress: string; } /** * Specify custom retry times and attempts when waiting for a transaction. * * @typedef TxWaitOptions * @property {number} retryTime * @property {number} attempts */ type TxWaitOptions$1 = { retryTime: number; attempts: number; }; type ChainData = { chainId: string; blockTime: number[]; height: number; blockTimestamp: number; maxCensusSize: number; }; declare class ChainService extends Service implements ChainServiceProperties { chainCosts: ChainCosts; chainData: ChainData; txWait: TxWaitOptions$1; /** * Instantiate the chain service. * * @param params - The service parameters */ constructor(params: Partial); /** * Fetches blockchain information if needed. * */ fetchChainData(): Promise; /** * Fetches blockchain costs information if needed. * */ fetchChainCosts(): Promise; /** * Submits a transaction to the blockchain * * @param payload - The transaction data payload * @returns The transaction hash */ submitTx(payload: string): Promise; /** * Fetches information about a transaction from the blockchain. * * @param txHash - The transaction hash which we want to retrieve the info from * @returns The chain transaction */ txInfo(txHash: string): Promise; /** * Returns the block number for a given date. * * @param date - The date which we want to retrieve the block number from * @returns The block number */ dateToBlock(date: Date): Promise; /** * A convenience method to wait for a transaction to be executed. It will * loop trying to get the transaction information, and will retry every time * it fails. * * @param tx - Transaction to wait for * @param wait - The delay in milliseconds between tries * @param attempts - The attempts to try before failing */ waitForTransaction(tx: string, wait?: number, attempts?: number): Promise; } interface AccountServiceProperties { chainService: ChainService; } type FetchAccountsParametersWithPagination = FetchAccountsParameters & PaginationRequest; interface FetchAccountsParameters { } type AccountServiceParameters = ServiceProperties & AccountServiceProperties; /** * @typedef AccountData * @property {string} address * @property {number} balance * @property {number} nonce * @property {number} electionIndex * @property {string | null} infoURL * @property {Account} account */ type AccountData = { account: Account; } & Pick; type ArchivedAccountData = Pick; declare class AccountService extends Service implements AccountServiceProperties { chainService: ChainService; /** * Instantiate the election service. * * @param params - The service parameters */ constructor(params: Partial); /** * Fetches account information. * * @param address - The account address to fetch the information */ fetchAccountInfo(address: string): Promise; /** * Updates an account with information * * @param tx - The transaction for setting the account * @param metadata - The account metadata * @returns The transaction hash */ setInfo(tx: string, metadata: string): Promise; signTransaction(tx: Uint8Array, message: string, walletOrSigner: Wallet | Signer | RemoteSigner): Promise; } interface CspServiceProperties { info: ICspInfoResponse; } type CspServiceParameters = ServiceProperties & CspServiceProperties; declare enum CspProofType { ECDSA = 1, ECDSA_PIDSALTED = 2, ECDSA_BLIND = 3, ECDSA_BLIND_PIDSALTED = 4 } declare class CspService extends Service implements CspServiceProperties { info: ICspInfoResponse; /** * Instantiate the CSP service. * * @param params - The service parameters */ constructor(params: Partial); static fetchUrlFromElection(election: Election): string; setUrlFromElection(election: Election): string; setInfo(): Promise; cspStep(electionId: string, stepNumber: number, data: any[], authToken?: string): Promise; cspSign(electionId: string, address: string, token: string): Promise; cspVote(vote: Vote, signature: string, proof_type?: CspProofType): CspVote; static cspVote(vote: Vote, signature: string, proof_type?: CspProofType): CspVote; } interface CensusServiceProperties { auth: CensusAuth; chunk_size: number; async: CensusAsync; } type CensusServiceParameters = ServiceProperties & CensusServiceProperties; type CensusAuth = { identifier: string; wallet?: Wallet; }; type CensusAsync = { async: boolean; wait: number; }; /** * @typedef CensusProof * @property {string} weight * @property {string} proof * @property {string} value */ type CensusProof = { type: CensusType; weight: string; root: string; proof: string; value: string; siblings?: Array; }; /** * @typedef CensusImportExport * @property {number} type * @property {string} rootHash * @property {string} data * @property {number} maxLevels */ type CensusImportExport = { type: number; rootHash: string; data: string; maxLevels: number; }; /** * @typedef CspCensusProof * @property {string} type * @property {string} address * @property {string} signature * @property {bigint} weight */ type CspCensusProof = { type?: number; address: string; signature: string; weight?: bigint; proof_type?: CspProofType; }; declare class CensusService extends Service implements CensusServiceProperties { auth: CensusAuth; chunk_size: number; async: CensusAsync; /** * Instantiate the census service. * * @param params - The service parameters */ constructor(params: Partial); /** * Fetches the information of a given census. * * @param censusId - */ get(censusId: string): Promise<{ size: number; weight: bigint; type: CensusType; }>; /** * Deletes the given census. * * @param censusId - */ delete(censusId: string): Promise; /** * Fetches proof that an address is part of the specified census. * * @param censusId - Census we want to check the address against * @param key - The address to be found */ fetchProof(censusId: string, key: string): Promise; create(censusType: CensusType): Promise<{ id: string; auth: string; }>; add(censusId: string, participants: ICensusParticipant[]): Promise; private addParallel; /** * Publishes the given census identifier. * * @param censusId - The census identifier * @param async - If the publication has to be done asynchronously */ publish(censusId: string, async?: boolean): Promise; /** * Exports the given census identifier. * * @param censusId - The census identifier */ export(censusId: string): Promise; /** * Imports data into the given census identifier. * * @param censusId - The census identifier * @param data - The census data */ import(censusId: string, data: CensusImportExport): Promise; /** * Publishes the given census. * * @param census - The census to be published. */ createCensus(census: PlainCensus | WeightedCensus): Promise; /** * Publishes the given census. * * @param census - The census to be published. */ private createCensusParallel; /** * Fetches the specific account token auth and sets it to the current instance. * */ fetchAccountToken(): Promise; } interface ElectionServiceProperties { censusService: CensusService; chainService: ChainService; } type ElectionServiceParameters = ServiceProperties & ElectionServiceProperties; type FetchElectionsParametersWithPagination = FetchElectionsParameters & PaginationRequest; interface FetchElectionsParameters { organizationId: string; electionId: string; withResults: boolean; finalResults: boolean; manuallyEnded: boolean; status: Exclude; } type ElectionList = Array; type ElectionListWithPagination = { elections: ElectionList; } & PaginationResponse; type ElectionKeys = IElectionKeysResponse; type ElectionCreatedInformation = IElectionCreateResponse; declare enum ElectionCreationSteps { GET_CHAIN_DATA = "get-chain-data", CENSUS_CREATED = "census-created", GET_ACCOUNT_DATA = "get-account-data", GET_DATA_PIN = "get-data-pin", GENERATE_TX = "generate-tx", SIGN_TX = "sign-tx", CREATING = "creating", DONE = "done" } type ElectionCreationStepValue = { key: ElectionCreationSteps.GET_CHAIN_DATA; } | { key: ElectionCreationSteps.CENSUS_CREATED; } | { key: ElectionCreationSteps.GET_ACCOUNT_DATA; } | { key: ElectionCreationSteps.GET_DATA_PIN; } | { key: ElectionCreationSteps.GENERATE_TX; } | { key: ElectionCreationSteps.SIGN_TX; } | { key: ElectionCreationSteps.CREATING; txHash: string; } | { key: ElectionCreationSteps.DONE; electionId: string; }; declare class ElectionService extends Service implements ElectionServiceProperties { censusService: CensusService; chainService: ChainService; /** * Instantiate the election service. * * @param params - The service parameters */ constructor(params: Partial); signTransaction(tx: Uint8Array, message: string, walletOrSigner: Wallet | Signer | RemoteSigner): Promise; private buildPublishedCensus; private buildCensus; decryptMetadata(electionInfo: any, password: any): any; /** * Fetches info about an election. * * @param electionId - The id of the election * @param password - The password to decrypt the metadata */ fetchElection(electionId: string, password?: string): Promise; private calculateChoiceResults; private calculateMultichoiceAbstains; fetchElections(params?: Partial): Promise; /** * Creates a new election. * * @param payload - The set information info raw payload to be submitted to the chain * @param metadata - The base64 encoded metadata JSON object * @returns The created election information */ create(payload: string, metadata: string): Promise; /** * Returns the next election id. * * @param address - The address of the account * @param election - The unpublished election * @param delta - The stride to next election id, being 0 the next one * @returns The next election identifier */ nextElectionId(address: string, election: UnpublishedElection, delta?: number): Promise; /** * Returns an election salt for address * * @param address - The address of the account * @param electionCount - The election count * @returns The election salt */ getElectionSalt(address: string, electionCount: number): Promise; /** * Returns a numeric election identifier * * @param electionId - The identifier of the election * @returns The numeric identifier */ getNumericElectionId(electionId: string): number; /** * Fetches the encryption keys from the specified process. * * @param electionId - The identifier of the election */ keys(electionId: string): Promise; /** * Estimates the election cost * * @returns The cost in tokens. */ estimateElectionCost(election: UnpublishedElection): Promise; /** * Calculate the election cost * * @returns The cost in tokens. */ calculateElectionCost(election: UnpublishedElection): Promise; } /** * Specify custom Faucet. * * @typedef FaucetOptions * @property {number} token_limit */ interface FaucetServiceProperties { token_limit: number; } type FaucetServiceParameters = ServiceProperties & FaucetServiceProperties; /** * @typedef FaucetPackage * @property {string} payload * @property {string} signature */ type FaucetPackage = { payload: string; signature: string; }; type FaucetOptions = FaucetServiceParameters; declare class FaucetService extends Service implements FaucetServiceProperties { token_limit: number; /** * Instantiate the chain service. * * @param params - The service parameters */ constructor(params: Partial); /** * Fetches a faucet payload. Only for development. * * @param address - The address where to send the tokens * @returns The encoded faucet package */ fetchPayload(address: string): Promise; /** * Parses a faucet package. * */ parseFaucetPackage(faucetPackage: string): FaucetPackage; } interface FileServiceProperties { } type FileServiceParameters = ServiceProperties & FileServiceProperties; declare class FileService extends Service implements FileServiceProperties { /** * Instantiate the election service. * * @param params - The service parameters */ constructor(params: Partial); /** * Fetches the CID expected for the specified data content. * * @param data - The data of which we want the CID of * @returns Resulting CID */ calculateCID(data: string): Promise; } interface AnonymousServiceProperties { chainCircuits: ChainCircuits; } type AnonymousServiceParameters = ServiceProperties & AnonymousServiceProperties; type ZkProof = { proof: { pi_a: string[]; pi_b: string[][]; pi_c: string[]; protocol: string; curve: string; }; publicSignals: string[]; }; interface CircuitInputs { electionId: string[]; nullifier: string; availableWeight: string; voteHash: string[]; sikRoot: string; censusRoot: string; address: string; password: string; signature: string; voteWeight: string; sikSiblings: string[]; censusSiblings: string[]; } type ChainCircuits = { zKeyData: Uint8Array; zKeyHash: string; zKeyURI: string; vKeyData: Uint8Array; vKeyHash: string; vKeyURI: string; wasmData: Uint8Array; wasmHash: string; wasmURI: string; }; declare class AnonymousService extends Service implements AnonymousServiceProperties { chainCircuits: ChainCircuits; /** * Instantiate the anonymous service. * * @param params - The service parameters */ constructor(params: Partial); generateZkProof(inputs: CircuitInputs): Promise; fetchAccountSIK(address: string): Promise; hasRegisteredSIK(address: string, signature: string, password?: string): Promise; fetchZKProof(address: string): Promise; signSIKPayload(wallet: Wallet | Signer | RemoteSigner): Promise; /** * Checks circuit hashes * * @returns The checked circuit parameters */ checkCircuitsHashes(): ChainCircuits; /** * Fetches circuits for anonymous voting * * @param circuits - Additional options for custom circuits */ fetchCircuits(circuits?: Omit): Promise; /** * Sets circuits for anonymous voting * * @param circuits - Custom circuits */ setCircuits(circuits: ChainCircuits): ChainCircuits; static generateGroth16Proof(inputs: CircuitInputs, circuitPath: Uint8Array, provingKey: Uint8Array): Promise; static prepareCircuitInputs(electionId: string, address: string, password: string, signature: string, voteWeight: string, availableWeight: string, sikRoot: string, sikSiblings: string[], censusRoot: string, censusSiblings: string[], votePackage: Buffer): Promise; static calcCircuitInputs(signature: string, password: string, electionId: string): Promise<{ nullifier: any; arboElectionId: string[]; ffsignature: string; ffpassword: string; }>; static calcNullifier(signature: string, password: string, electionId: string): Promise; static calcVoteId(signature: string, password: string, electionId: string): Promise; static calcSik(address: string, personal_sign: string, password?: string): Promise; static signatureToVocdoniSikSignature(personal_sign: string): string; static arbo_utils: { toBigInt: (str: string) => bigint; toString: (n: bigint) => string; toHash: (input: string) => Promise; }; static hex_utils: { fromBigInt: (bi: bigint) => string; fromArrayBuffer: (input: Uint8Array) => string; toArrayBuffer: (input: string) => Uint8Array; }; static ff_utils: { q: bigint; bigIntToFF: (bi: bigint) => bigint; hexToFFBigInt: (hexStr: string) => bigint; }; } interface VoteServiceProperties { chainService: ChainService; } type VoteServiceParameters = ServiceProperties & VoteServiceProperties; type FetchVotesParametersWithPagination = FetchVotesParameters & PaginationRequest; interface FetchVotesParameters { electionId: string; } type VoteInfo = VoteInfoResponse; type VoteSubmit = IVoteSubmitResponse; declare enum VoteSteps { GET_ELECTION = "get-election", GET_PROOF = "get-proof", GET_SIGNATURE = "get-signature", CALC_ZK_PROOF = "calc-zk-proof", GENERATE_TX = "generate-tx", SIGN_TX = "sign-tx", DONE = "done" } type VoteStepValue = { key: VoteSteps.GET_ELECTION; electionId: string; } | { key: VoteSteps.GET_PROOF; } | { key: VoteSteps.GET_SIGNATURE; signature: string; } | { key: VoteSteps.CALC_ZK_PROOF; } | { key: VoteSteps.GENERATE_TX; } | { key: VoteSteps.SIGN_TX; } | { key: VoteSteps.DONE; voteId: string; }; declare class VoteService extends Service implements VoteServiceProperties { chainService: ChainService; /** * Instantiate the election service. * * @param params - The service parameters */ constructor(params: Partial); signTransaction(tx: Uint8Array, message: string, walletOrSigner: Wallet | Signer | RemoteSigner): Promise; encodeTransaction(tx: Uint8Array): string; /** * Get the vote information * * @param voteId - The identifier of the vote * */ info(voteId: string): Promise; /** * Submit the vote to the chain * * @param payload - The base64 encoded vote transaction * */ vote(payload: string): Promise; } interface RemoteSignerServiceProperties { remoteSigner: RemoteSigner; } type RemoteSignerServiceParameters = ServiceProperties & RemoteSignerServiceProperties; declare class RemoteSignerService extends Service implements RemoteSignerServiceProperties { remoteSigner: RemoteSigner; /** * Instantiate the remote signer service. * * @param params - The service parameters */ constructor(params: Partial); /** * Logs in to the remote signer. * * @returns The JWT token */ login(credentials?: RemoteSignerCredentials): Promise; /** * Refreshes the JWT token. * * @returns The JWT token */ refresh(): Promise; /** * Returns the writable addresses. * * @returns The writable addresses */ addresses(): Promise>; /** * Returns the address of the remote signer. * * @returns The remote signer address */ getAddress(): Promise; signTxPayload(payload: string | Bytes): Promise; signPayload(payload: string | Bytes): Promise; } declare enum EnvOptions { DEV = "dev", STG = "stg", PROD = "prod" } /** * Specify custom retry times and attempts when waiting for a transaction. * * @typedef TxWaitOptions * @property {number | null} retry_time * @property {number | null} attempts */ type TxWaitOptions = { retry_time?: number; attempts?: number; }; /** * Specify custom census service options. * * @typedef CensusOptions * @property {boolean} async If the census upload has to be done asynchronously * @property {number | null} wait_time The waiting time between each check * @property {number | null} chunk The size of the chunks to be uploaded each request */ type CensusOptions = { async: boolean; wait_time?: number; chunk?: number; }; /** * Optional VocdoniSDKClient arguments * * @typedef ClientOptions * @property {EnvOptions} env enum with possible values `DEV`, `STG`, `PROD` * @property {string | null } api_url API url location * @property {Wallet | Signer | RemoteSigner | null} wallet `Wallet` or `Signer` object from `ethersproject` library * @property {string | null} electionId Required by other methods like `submitVote` or `createElection`. * @property {FaucetOptions | null} faucet Specify custom Faucet options */ type ClientOptions = { env: EnvOptions; api_url?: string; wallet?: Wallet | Signer | RemoteSigner; electionId?: string; faucet?: Partial; tx_wait?: TxWaitOptions; census?: CensusOptions; }; /** * Main Vocdoni client object. It's a wrapper for all the methods in api, core * and types, allowing you to easily use the vocdoni API from a single entry * point. */ declare class VocdoniSDKClient { private accountData; private election; censusService: CensusService; chainService: ChainService; anonymousService: AnonymousService; cspService: CspService; electionService: ElectionService; voteService: VoteService; fileService: FileService; faucetService: FaucetService; accountService: AccountService; url: string; wallet: Wallet | Signer | RemoteSigner | null; electionId: string | null; explorerUrl: string; /** * Instantiate new VocdoniSDK client. * * To instantiate the client just pass the `ClientOptions` you want or empty object to let defaults. * * `const client = new VocdoniSDKClient({EnvOptions.PROD})` * * @param opts - optional arguments */ constructor(opts: ClientOptions); /** * Sets an election id. Required by other methods like submitVote or createElection. * @category Election * * @param electionId - Election id string */ setElectionId(electionId: string): void; /** * Fetches account information. * @category Account * * @param address - The account address to fetch the information */ fetchAccountInfo(address?: string): Promise; /** * Fetches account. * @category Account * * @param address - The account address to fetch the information */ fetchAccount(address?: string): Promise; /** * Fetches info about an election. * @category Election * * @param electionId - The id of the election * @param password - The password to decrypt the metadata */ fetchElection(electionId?: string, password?: string): Promise; /** * Fetches info about all elections * @category Election * * @param params - The parameters to filter the elections */ fetchElections(params?: Partial): Promise; /** * Fetches proof that an address is part of the specified census. * * @param censusId - * @param wallet - */ private fetchProofForWallet; private setAccountSIK; /** * Calculates ZK proof from given wallet. * * @param election - * @param wallet - * @param signature - * @param votePackage - * @param password - */ private calcZKProofForWallet; /** * Creates an account with information. * @category Account * * @param options - Additional options, * like extra information of the account, or the faucet package string. */ createAccountInfo(options: { account: Account; faucetPackage?: string; signedSikPayload?: string; password?: string; }): Promise; /** * Updates an account with information * @category Account * * @param account - Account data. */ updateAccountInfo(account: Account): Promise; /** * Updates an account with information * @category Account * * @param promAccountData - Account data promise in Tx form. */ private setAccountInfo; /** * Registers an account against vochain, so it can create new elections. * @category Account * * @param options - Additional options, like extra information of the account, * or the faucet package string */ createAccount(options?: { account?: Account; faucetPackage?: string; sik?: boolean; password?: string; }): Promise; /** * Send tokens from one account to another. * * @param options - Options for send tokens */ sendTokens(options: SendTokensOptions): Promise; /** * Calls the faucet to get new tokens. Under development environments, if no faucet package is provided, one is created and tokens are allocated. * * @param faucetPackage - The faucet package * @returns Account data information updated with new balance */ collectFaucetTokens(faucetPackage?: string): Promise; /** * Creates a new voting election. * @category Election * * @param election - The election object to be created. * @returns Resulting election id. */ createElection(election: UnpublishedElection): Promise; /** * Creates a new voting election by steps with async returns. * @category Election * * @param election - The election object to be created. * @returns The async step returns. */ createElectionSteps(election: UnpublishedElection): AsyncGenerator; /** * Ends an election. * @category Election * * @param electionId - The id of the election */ endElection(electionId?: string): Promise; /** * Pauses an election. * @category Election * * @param electionId - The id of the election */ pauseElection(electionId?: string): Promise; /** * Cancels an election. * @category Election * * @param electionId - The id of the election */ cancelElection(electionId?: string): Promise; /** * Continues an election. * @category Election * * @param electionId - The id of the election */ continueElection(electionId?: string): Promise; /** * Changes the status of an election. * @category Election * * @param electionId - The id of the election * @param newStatus - The new status */ private changeElectionStatus; /** * Changes the census of an election. * @category Election * * @param electionId - The id of the election * @param censusId - The new census id (root) * @param censusURI - The new census URI * @param maxCensusSize - The new max census size */ changeElectionCensus(electionId: string, censusId: string, censusURI: string, maxCensusSize?: number): Promise; /** * Changes the max census size of an election. * @category Election * * @param electionId - The id of the election * @param maxCensusSize - The new max census size */ changeElectionMaxCensusSize(electionId: string, maxCensusSize: number): Promise; /** * Changes the duration of an election. * @category Election * * @param electionId - The id of the election * @param duration - The new duration of the election */ changeElectionDuration(electionId: string, duration: number): Promise; /** * Changes the end date of an election. * @category Election * * @param electionId - The id of the election * @param endDate - The new end date */ changeElectionEndDate(electionId: string, endDate: string | number | Date): Promise; /** * Checks if the user is in census. * @category Voting * * @param options - Options for is in census */ isInCensus(options?: IsInCensusOptions): Promise; /** * Checks if the user has already voted * @category Voting * * @param options - Options for has already voted * @returns The id of the vote */ hasAlreadyVoted(options?: HasAlreadyVotedOptions): Promise; /** * Checks if the user is able to vote * @category Voting * * @param options - Options for is able to vote */ isAbleToVote(options?: IsAbleToVoteOptions): Promise; /** * Checks how many times a user can submit their vote * @category Voting * * @param options - Options for votes left count */ votesLeftCount(options?: VotesLeftCountOptions): Promise; /** * Submits a vote. * @category Voting * * @param vote - The vote (or votes) to be sent. * @returns Vote confirmation id. */ submitVote(vote: Vote | CspVote | AnonymousVote): Promise; /** * Submits a vote by steps. * @category Voting * * @param vote - The vote (or votes) to be sent. * @returns Vote confirmation id. */ submitVoteSteps(vote: Vote | CspVote | AnonymousVote): AsyncGenerator; /** * Assigns a random Wallet to the client and returns its private key. * * @returns The private key. */ generateRandomWallet(): string; /** * Returns a Wallet based on the inputs. * * @param data - The data inputs which should generate the Wallet * @returns The deterministic wallet. */ static generateWalletFromData(data: string | string[]): Wallet; /** * This functions will be deprecated */ /** * Fetches proof that an address is part of the specified census. * * @param censusId - Census we want to check the address against * @param key - The address to be found */ fetchProof(censusId: string, key: string): Promise; /** * Publishes the given census. * * @param census - The census to be published. */ createCensus(census: PlainCensus | WeightedCensus): Promise; /** * Fetches the information of a given census. * * @param censusId - */ fetchCensusInfo(censusId: string): Promise<{ size: number; weight: bigint; type: CensusType; }>; /** * Fetches circuits for anonymous voting * * @param circuits - Additional options for custom circuits */ fetchCircuits(circuits?: Omit): Promise; /** * Sets circuits for anonymous voting * * @param circuits - Custom circuits */ setCircuits(circuits: ChainCircuits): ChainCircuits; cspUrl(): Promise; cspInfo(): Promise; cspStep(stepNumber: number, data: any[], authToken?: string): Promise; cspSign(address: string, token: string): Promise; cspVote(vote: Vote, signature: string, proof_type?: CspProofType): CspVote; /** * Fetches blockchain costs information if needed. * */ fetchChainCosts(): Promise; /** * Fetches blockchain information if needed and returns the chain id. * */ fetchChainId(): Promise; /** * Estimates the election cost * @category Election * * @returns The cost in tokens. */ estimateElectionCost(election: UnpublishedElection): Promise; /** * Calculate the election cost * @category Election * * @returns The cost in tokens. */ calculateElectionCost(election: UnpublishedElection): Promise; /** * Fetches the CID expected for the specified data content. * * @param data - The data of which we want the CID of * @returns Resulting CID */ calculateCID(data: string): Promise; /** * Fetches a faucet payload. Only for development. * */ fetchFaucetPayload(): Promise; /** * Parses a faucet package. * * @param faucetPackage - The encoded faucet package */ parseFaucetPackage(faucetPackage: string): FaucetPackage; /** * A convenience method to wait for a transaction to be executed. It will * loop trying to get the transaction information, and will retry every time * it fails. * * @param tx - Transaction to wait for * @param wait - The delay in milliseconds between tries * @param attempts - The attempts to try before failing */ waitForTransaction(tx: string, wait?: number, attempts?: number): Promise; } type Token = Omit & { tags: string[]; }; type TokenSummary = Omit & { tags: string[]; }; type Strategy = Census3Strategy; type StrategyHolder = { holder: string; weight: bigint; }; type StrategyHolders = StrategyHolder[]; type StrategyToken = Census3CreateStrategyToken; type Census3Census = ICensus3CensusResponse; type SupportedChain = ICensus3SupportedChain; type SupportedOperator = ICensus3StrategiesOperator; type ParsedPredicate = ICensus3ValidatePredicateResponse; declare class VocdoniCensus3Client { url: string; queueWait: { retryTime: number; attempts: number; }; /** * Instantiate new VocdoniCensus3 client. * * To instantiate the client just pass the `ClientOptions` you want or use an empty object for the defaults. * * `const client = new VocdoniCensus3Client({EnvOptions.PROD})` * * @param opts - optional arguments */ constructor(opts: ClientOptions); /** * Returns a list of summary tokens supported by the service * * @returns Token summary list */ getSupportedTokens(): Promise; /** * Returns a list of supported chain identifiers * * @returns Supported chain list */ getSupportedChains(): Promise; /** * Returns a list of supported tokens type * * @returns Supported tokens type list */ getSupportedTypes(): Promise; /** * Returns a list of supported strategies operators * * @returns Supported strategies operators list */ getSupportedOperators(): Promise; /** * Returns the full token information based on the id (address) * * @param id - The id (address) of the token * @param chainId - The id of the chain * @param externalId - The identifier used by external provider * @returns The token information */ getToken(id: string, chainId: number, externalId?: string): Promise; /** * Returns if the holder ID is already registered in the database as a holder of the token. * * @param tokenId - The id (address) of the token * @param chainId - The id of the chain * @param holderId - The identifier of the holder * @param externalId - The identifier used by external provider * @returns If the holder is in the token */ isHolderInToken(tokenId: string, chainId: number, holderId: string, externalId?: string): Promise; /** * Returns the balance of the holder based on the token and chain * * @param tokenId - The id (address) of the token * @param chainId - The id of the chain * @param holderId - The identifier of the holder * @param externalId - The identifier used by external provider * @returns The balance of the holder */ tokenHolderBalance(tokenId: string, chainId: number, holderId: string, externalId?: string): Promise; /** * Creates a new token to be tracked in the service * * @param address - The address of the token * @param type - The type of the token * @param chainId - The chain id of the token * @param externalId - The identifier used by external provider * @param tags - The tag list to associate the token with */ createToken(address: string, type: string, chainId?: number, externalId?: string, tags?: string[]): Promise; /** * Returns the strategies * * @returns The list of strategies */ getStrategies(): Promise; /** * Returns the strategy holders * * @param id - The id of the strategy * @returns The list strategy holders */ getStrategyHolders(id: number): Promise; /** * Returns the strategies from the given token * * @param id - The id (address) of the token * @param chainId - The id of the chain * @param externalId - The identifier used by external provider * @returns The list of strategies */ getStrategiesByToken(id: string, chainId: number, externalId?: string): Promise; /** * Returns the information of the strategy based on the id * * @param id - The id of the strategy * @returns The strategy information */ getStrategy(id: number): Promise; /** * Returns the estimation of size and time (in milliseconds) to create the census generated for the provided strategy * * @param id - The id of the strategy * @param anonymous - If the estimation should be done for anonymous census * @returns The strategy estimation */ getStrategyEstimation(id: number, anonymous?: boolean): Promise<{ size: number; timeToCreateCensus: number; accuracy: number; }>; /** * Returns the estimation of size and time (in milliseconds) to create the census generated for the provided predicate and tokens * * @param predicate - The predicate of the strategy * @param tokens - The token list for the strategy * @param anonymous - If the estimation should be done for anonymous census * @returns The predicate estimation */ getPredicateEstimation(predicate: string, tokens: { [key: string]: StrategyToken; }, anonymous?: boolean): Promise<{ size: number; timeToCreateCensus: number; accuracy: number; }>; /** * Creates a new strategy based on the given tokens and predicate * * @param alias - The alias of the strategy * @param predicate - The predicate of the strategy * @param tokens - The token list for the strategy * @returns The strategy id */ createStrategy(alias: string, predicate: string, tokens: { [key: string]: StrategyToken; }): Promise; /** * Imports a strategy from IPFS from the given cid. * * @param cid - The IPFS cid of the strategy to import * @returns The strategy information */ importStrategy(cid: string): Promise; /** * Validates a predicate * * @param predicate - The predicate of the strategy * @returns The parsed predicate */ validatePredicate(predicate: string): Promise; /** * Returns the census3 censuses * * @param strategyId - The strategy identifier * @returns The list of census3 censuses */ getCensuses(strategyId: number): Promise; /** * Returns the census3 census based on the given identifier * * @param id - The id of the census * @returns The census3 census */ getCensus(id: number): Promise; /** * Creates the census based on the given strategy * * @param strategyId - The id of the strategy * @param anonymous - If the census has to be anonymous * @returns The census information */ createCensus(strategyId: number, anonymous?: boolean): Promise; /** * Returns the actual census based on the given token using the default strategy set * * @param address - The address of the token * @param chainId - The id of the chain * @param anonymous - If the census has to be anonymous * @param externalId - The identifier used by external provider * @returns The token census */ createTokenCensus(address: string, chainId: number, anonymous?: boolean, externalId?: string): Promise; /** * Returns the actual census based on the given strategy id * * @param strategyId - The strategy id * @param anonymous - If the census has to be anonymous * @returns The strategy census */ createStrategyCensus(strategyId: number, anonymous?: boolean): Promise; } declare const delay: (ms: any) => Promise; declare function strip0x(value: string): string; declare function ensure0x(value: string): string; declare function getBytes(count: number): Uint8Array; /** * Generates a random seed and returns a 32 byte keccak256 hash of it (starting with "0x") */ declare function getHex(): string; /** * Compares two hex strings checking if they're the same. It ensures both * have hex prefix and are lowercase. * * @param hex -1 * @param hex -2 */ declare function areEqualHexStrings(hex1?: string, hex2?: string): boolean; /** * Returns a string representation of value formatted with decimals digits * * @param value - The value in native BigInt * @param decimals - The number of decimals * @returns The formatted string */ declare function formatUnits(value: BigNumberish, decimals?: number): string; /** * Dot notation to object conversion. Takes any object as first argument and uses the string dot notation from the * second argument (i.e. 'a.child.node') to access that given object value. * * @param obj - Object to be accessed by dot notation * @param dot - Dot notation string to extract object data * @returns Return the object data */ declare const dotobject: (obj: any, dot: string) => any; export { API, type AbstainProperties, Account, AccountAPI, type AccountData, type AccountMetadata, AccountMetadataTemplate, AccountService, type AdminTx, type AllElectionStatus, AnonymousService, AnonymousVote, ApprovalElection, type ApprovalProperties, type ArchivedAccountData, BudgetElection, type BudgetProperties, Census, type Census3Census, Census3CensusAPI, type Census3CreateStrategyToken, Census3ServiceAPI, type Census3Strategy, Census3StrategyAPI, type Census3StrategyToken, type Census3SummaryToken, type Census3Token, Census3TokenAPI, CensusAPI, type CensusImportExport, CensusOrigin, type CensusProof, CensusService, CensusStillNotPublished, CensusType, CensusTypeEnum, ChainAPI, type ChainCircuits, type ChainCosts, type ChainData, ChainService, type ChainTx, type Choice, type ChoiceProperties, type CircuitInputs, type ClientOptions, type CollectFaucetTx, CouldNotCreateFaucetPackageError, CouldNotSignTransactionError, CspAPI, CspCensus, type CspCensusProof, CspProofType, CspService, CspVote, type CustomMeta, DuplicateConflictError, Election, ElectionAPI, type ElectionCreatedInformation, type ElectionCreationStepValue, ElectionCreationSteps, type ElectionIdOption, type ElectionKeys, type ElectionList, type ElectionListWithPagination, type ElectionMetadata, ElectionMetadataTemplate, type ElectionResultsType, ElectionResultsTypeNames, ElectionService, ElectionStatus, ElectionStatusReady, EmailMalformedError, EnvOptions, ErrAPI, ErrAccountAlreadyExists, ErrAccountNotFound, ErrAddressMalformed, ErrBlockNotFound, ErrCantABIEncodeResults, ErrCantAddHoldersToCensus, ErrCantAddKeyAndValueToTree, ErrCantAddKeyToTree, ErrCantCheckTxType, ErrCantComputeKeyHash, ErrCantCountVotes, ErrCantCreateCensus, ErrCantCreateStrategy, ErrCantCreateToken, ErrCantEstimateBlockHeight, ErrCantExtractMetadataURI, ErrCantFetchElection, ErrCantFetchEnvelope, ErrCantFetchEnvelopeHeight, ErrCantFetchTokenFees, ErrCantFetchTokenTransfers, ErrCantGenerateFaucetPkg, ErrCantGetCensus, ErrCantGetCircomSiblings, ErrCantGetLastBlockNumber, ErrCantGetStrategies, ErrCantGetStrategy, ErrCantGetStrategyHolders, ErrCantGetToken, ErrCantGetTokenCount, ErrCantGetTokenHolders, ErrCantGetTokens, ErrCantImportStrategy, ErrCantMarshalMetadata, ErrCantParseAccountID, ErrCantParseBearerToken, ErrCantParseBoolean, ErrCantParseDataAsJSON, ErrCantParseElectionID, ErrCantParseHexString, ErrCantParseMetadataAsJSON, ErrCantParseNumber, ErrCantParseOrgID, ErrCantParsePayloadAsJSON, ErrCantParseVoteID, ErrCantPublishMetadata, ErrCensusAlreadyExists, ErrCensusBuild, ErrCensusIDLengthInvalid, ErrCensusIndexedFlagMismatch, ErrCensusNotFound, ErrCensusProofVerificationFailed, ErrCensusRootHashMismatch, ErrCensusRootIsNil, ErrCensusTypeMismatch, ErrCensusTypeUnknown, ErrChainIDNotSupported, ErrDstAccountUnknown, ErrDstAddressMalformed, ErrElectionEndDateBeforeStart, ErrElectionEndDateInThePast, ErrElectionFinished, ErrElectionIsNil, ErrElectionNotFound, ErrElectionNotStarted, ErrElectionResultsIsNil, ErrElectionResultsMismatch, ErrElectionResultsNotYetAvailable, ErrEncodeAPIInfo, ErrEncodeCensus, ErrEncodeCensuses, ErrEncodeQueueItem, ErrEncodeStrategies, ErrEncodeStrategy, ErrEncodeStrategyHolders, ErrEncodeStrategyPredicateOperators, ErrEncodeToken, ErrEncodeTokenHolders, ErrEncodeTokenTypes, ErrEncodeTokens, ErrEncodeValidPredicate, ErrEvalStrategyPredicate, ErrFaucetAlreadyFunded, ErrFileSizeTooBig, ErrGettingSIK, ErrIndexedCensusCantUseWeight, ErrIndexerQueryFailed, ErrInitializingWeb3, ErrInvalidCensusKeyLength, ErrInvalidStatus, ErrInvalidStrategyPredicate, ErrKeyNotFoundInCensus, ErrMalformedCensusID, ErrMalformedCensusQueueID, ErrMalformedChainID, ErrMalformedHolder, ErrMalformedPagination, ErrMalformedStrategy, ErrMalformedStrategyID, ErrMalformedStrategyQueueID, ErrMalformedToken, ErrMarshalingJSONFailed, ErrMarshalingServerJSONFailed, ErrMarshalingServerProto, ErrMetadataProvidedButNoURI, ErrMetadataURINotMatchContent, ErrMissingParameter, ErrNoElectionKeys, ErrNoEnoughtStrategyTokens, ErrNoIPFSUri, ErrNoStrategies, ErrNoStrategyHolders, ErrNoStrategyTokens, ErrNoTokenHolderFound, ErrNoTokens, ErrNotFoundCensus, ErrNotFoundStrategy, ErrNotFoundToken, ErrNotFoundTokenHolders, ErrOrgNotFound, ErrPageNotFound, ErrParamDumpOrRootMissing, ErrParamKeyOrProofMissing, ErrParamNetworkInvalid, ErrParamParticipantsMissing, ErrParamParticipantsTooBig, ErrParamRootInvalid, ErrParamStatusInvalid, ErrParamToInvalid, ErrParticipantKeyMissing, ErrPruningCensus, ErrSIKNotFound, ErrTokenAlreadyExists, ErrTransactionNotFound, ErrTxTypeMismatch, ErrUnmarshalingServerProto, ErrVochainEmptyReply, ErrVochainGetTxFailed, ErrVochainOverloaded, ErrVochainReturnedErrorCode, ErrVochainReturnedInvalidElectionID, ErrVochainReturnedWrongMetadataCID, ErrVochainSendTxFailed, ErrVoteIDMalformed, ErrVoteNotFound, ErrWalletNotFound, ErrWalletPrivKeyAlreadyExists, FaucetAPI, type FaucetOptions, type FaucetPackage, FaucetService, type Fee, type FetchAccountsParameters, type FetchAccountsParametersWithPagination, type FetchBlocksParameters, type FetchBlocksParametersWithPagination, type FetchElectionsParameters, type FetchElectionsParametersWithPagination, type FetchFeesParameters, type FetchFeesParametersWithPagination, type FetchOrganizationParameters, type FetchOrganizationParametersWithPagination, type FetchTransactionsParameters, type FetchTransactionsParametersWithPagination, type FetchTransfersParameters, type FetchTransfersParametersWithPagination, type FetchVotesParameters, type FetchVotesParametersWithPagination, FileAPI, FileService, GenericInternalServerError, type HasAlreadyVotedOptions, type IAccount, type IAccountInfoResponse, type IAccountSummary, type IAccountsList, type IAccountsListResponse, type IApprovalElectionParameters, type IBlock, type IBudgetElectionParameters, type IBudgetElectionParametersInfo, type IBudgetElectionParametersWithBudget, type IBudgetElectionParametersWithCensusWeight, type ICensus, type ICensus3CensusListResponse, type ICensus3CensusQueueResponse, type ICensus3CensusResponse, type ICensus3ServiceInfoResponse, type ICensus3StrategiesListResponse, type ICensus3StrategiesListResponsePaginated, type ICensus3StrategiesOperator, type ICensus3StrategiesOperatorsResponse, type ICensus3StrategyCreateResponse, type ICensus3StrategyEstimationQueueResponse, type ICensus3StrategyHoldersQueueResponse, type ICensus3StrategyImportQueueResponse, type ICensus3StrategyToken, type ICensus3SupportedChain, type ICensus3TokenHolderResponse, type ICensus3TokenListResponse, type ICensus3TokenListResponsePaginated, type ICensus3TokenTypesResponse, type ICensus3ValidatePredicateChild, type ICensus3ValidatePredicateResponse, type ICensus3ValidatePredicateToken, type ICensusExportResponse, type ICensusImportResponse, type ICensusParticipant, type ICensusProofResponse, type ICensusPublishAsyncResponse, type ICensusPublishResponse, type IChainBlockInfoResponse, type IChainBlocksList, type IChainBlocksListResponse, type IChainFeesListResponse, type IChainGetCircuitResponse, type IChainGetCostsResponse, type IChainGetInfoResponse, type IChainOrganizationListResponse, type IChainOrganizationResponse, type IChainSubmitTxResponse, type IChainTransfersList, type IChainTransfersListResponse, type IChainTxCosts, type IChainTxList, type IChainTxListResponse, type IChainTxReference, type IChainValidator, type IChainValidatorsListResponse, type IChoice, type ICspAuthStep, type ICspFinalStepResponse, type ICspInfoResponse, type ICspIntermediateStepResponse, type ICspSignResponse, type IElectionCreateResponse, type IElectionInfoResponse, type IElectionKeysResponse, type IElectionList, type IElectionListResponse, type IElectionMode, type IElectionNextIdResponse, type IElectionParameters, type IElectionSummary, type IElectionType, type IEncryptionKey, type IFeesList, type IInvalidElectionParameters, type IMultiChoiceElectionParameters, type IPublishedElectionParameters, type IQuestion, type IRemoteSignerAddressesResponse, type IRemoteSignerLoginResponse, type IRemoteSignerRefreshResponse, type IRemoteSignerSignResponse, type IRemoteSignerSignTxResponse, type ITallyMode, type ITransfer, type IVoteEncryptedPackage, type IVoteListResponse, type IVoteMode, type IVotePackage, type IVoteSubmitResponse, type IVoteType, type IZkProofResponse, type IZkSIKResponse, InvalidElection, InvalidTxFormatError, InvalidUserDataError, type IsAbleToVoteOptions, type IsInCensusOptions, MalformedBodyError, MalformedURLParamError, MarshalingServerJSONFailedError, type MintTokensTx, MultiChoiceElection, type MultiLanguage, type NewProcessTx, NoOrganizationProvidedError, NoOrganizationsError, OffchainCensus, type OrganizationList, OrganizationNotFoundError, type PaginationRequest, type PaginationResponse, type ParsedPredicate, PasswordTooShortError, PlainCensus, type Process, type Proof, PublishedCensus, PublishedElection, type Question, type RegisterKeyTx, RemoteSigner, RemoteSignerAPI, type RemoteSignerCredentials, type RemoteSignerProperties, RemoteSignerService, type SendTokensOptions, type SendTokensTx, Service, type ServiceProperties, type SetAccountTx, type SetProcessTx, type SetTransactionCostsTx, type Strategy, StrategyCensus, type StrategyHolder, type StrategyHolders, type StrategyToken, type SupportedChain, type SupportedOperator, type Token, TokenCensus, type TokenSummary, TransactionType, type Tx, TxType, TxTypeNotAllowedError, type TxWaitOptions$1 as TxWaitOptions, UnauthorizedError, UnpublishedElection, VocdoniCensus3Client, VocdoniSDKClient, Vote, VoteAPI, type VoteEnvelope, type VoteIdOption, type VoteInfo, type VoteInfoResponse, VoteService, type VoteStepValue, VoteSteps, type VoteSubmit, type VoteSummary, type VotesLeftCountOptions, type VotesList, WalletAPI, type WalletOption, WeightedCensus, ZkAPI, type ZkProof, areEqualHexStrings, checkValidAccountMetadata, checkValidElectionMetadata, delay, dotobject, ensure0x, formatUnits, getBytes, getElectionMetadataTemplate, getHex, strip0x };