Skip to main content
Version: v2.0_alpha

Cli Module

Table of contents

Interfaces

Functions

Functions

checkVerifyingKeys

checkVerifyingKeys(CheckVerifyingKeysArgs): Promise<boolean>

Command to confirm that the verifying keys in the contract match the local ones

Parameters

NameTypeDescription
CheckVerifyingKeysArgsCheckVerifyingKeysArgsThe arguments for the checkVerifyingKeys command

Returns

Promise<boolean>

Whether the verifying keys match or not

Note

see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing

Defined in

commands/checkVerifyingKeys.ts:27


deploy

deploy(DeployArgs): Promise<DeployedContracts>

Deploy MACI and related contracts

Parameters

NameTypeDescription
DeployArgsDeployArgsThe arguments for the deploy command

Returns

Promise<DeployedContracts>

The addresses of the deployed contracts

Defined in

commands/deploy.ts:25


deployPoll

deployPoll(DeployPollArgs): Promise<PollContracts>

Deploy a new Poll for the set of MACI's contracts already deployed

Parameters

NameTypeDescription
DeployPollArgsDeployPollArgsThe arguments for the deployPoll command

Returns

Promise<PollContracts>

The addresses of the deployed contracts

Defined in

commands/deployPoll.ts:21


deployVkRegistryContract

deployVkRegistryContract(quiet): Promise<string>

Deploy the vkRegistry contract

Parameters

NameTypeDescription
quietDeployVkRegistryArgswhether to print the contract address

Returns

Promise<string>

Defined in

commands/deployVkRegistry.ts:20


fundWallet

fundWallet(«destructured»): Promise<void>

Fund a new wallet with Ether

Parameters

NameType
«destructured»FundWalletArgs

Returns

Promise<void>

Defined in

commands/fundWallet.ts:9


genKeyPair

genKeyPair(args): Object

Generate a new Maci Key Pair and print it to the screen

Parameters

NameTypeDescription
argsIGenKeypairArgskeypair generation params

Returns

Object

  • keypair
NameType
privateKeystring
publicKeystring

Defined in

commands/genKeyPair.ts:15


genLocalState

genLocalState(GenLocalStateArgs): Promise<void>

Generate a local MACI state from the smart contracts events

Parameters

NameTypeDescription
GenLocalStateArgsGenLocalStateArgsThe arguments for the genLocalState command

Returns

Promise<void>

Defined in

commands/genLocalState.ts:29


genMaciPubKey

genMaciPubKey(privkey, quiet?): string

Generate a new Maci Public key from a private key

Parameters

NameTypeDefault valueDescription
privkeystringundefined-
quietbooleantruewhether to log the output

Returns

string

the public key serialized

Defined in

commands/genPubKey.ts:13


genProofs

genProofs(GenProofsArgs): Promise<TallyData>

Generate proofs for the message processing and tally calculations

Parameters

NameTypeDescription
GenProofsArgsGenProofsArgsThe arguments for the genProofs command

Returns

Promise<TallyData>

The tally data

Note

see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing

Defined in

commands/genProofs.ts:40


getPoll

getPoll(args): Promise<IGetPollData>

Get deployed poll from MACI contract

Parameters

NameTypeDescription
argsIGetPollArgsThe arguments for the get poll command

Returns

Promise<IGetPollData>

poll data

Defined in

commands/poll.ts:14


isRegisteredUser

isRegisteredUser(IRegisteredArgs): Promise<{ isRegistered: boolean ; stateIndex?: string ; voiceCredits?: string }>

Checks if user is registered with public key

Parameters

NameTypeDescription
IRegisteredArgsIRegisteredUserArgsThe arguments for the register check command

Returns

Promise<{ isRegistered: boolean ; stateIndex?: string ; voiceCredits?: string }>

user registered or not and state index, voice credit balance

Defined in

commands/signup.ts:94


mergeMessages

mergeMessages(MergeMessagesArgs): Promise<void>

Merge the message queue on chain

Parameters

NameTypeDescription
MergeMessagesArgsMergeMessagesArgsThe arguments for the mergeMessages command

Returns

Promise<void>

Defined in

commands/mergeMessages.ts:25


mergeSignups

mergeSignups(MergeSignupsArgs): Promise<void>

Command to merge the signups of a MACI contract

Parameters

NameTypeDescription
MergeSignupsArgsMergeSignupsArgsThe arguments for the mergeSignups command

Returns

Promise<void>

Defined in

commands/mergeSignups.ts:20


proveOnChain

proveOnChain(ProveOnChainArgs): Promise<void>

Command to prove the result of a poll on-chain

Parameters

NameTypeDescription
ProveOnChainArgsProveOnChainArgsThe arguments for the proveOnChain command

Returns

Promise<void>

Defined in

commands/proveOnChain.ts:41


publish

publish(PublishArgs): Promise<string>

Publish a new message to a MACI Poll contract

Parameters

NameTypeDescription
PublishArgsPublishArgsThe arguments for the publish command

Returns

Promise<string>

The ephemeral private key used to encrypt the message

Defined in

commands/publish.ts:24


publishBatch

publishBatch(args): Promise<IPublishBatchData>

Batch publish new messages to a MACI Poll contract

Parameters

NameTypeDescription
argsIPublishBatchArgsThe arguments for the publish command

Returns

Promise<IPublishBatchData>

The ephemeral private key used to encrypt the message, transaction hash

Defined in

commands/publish.ts:145


setVerifyingKeys

setVerifyingKeys(SetVerifyingKeysArgs): Promise<void>

Function that sets the verifying keys in the VkRegistry contract

Parameters

NameTypeDescription
SetVerifyingKeysArgsSetVerifyingKeysArgsThe arguments for the setVerifyingKeys command

Returns

Promise<void>

Note

see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing

Defined in

commands/setVerifyingKeys.ts:26


signup

signup(args): Promise<ISignupData>

Signup a user to the MACI contract

Parameters

NameTypeDescription
argsSignupArgsThe arguments for the signup command

Returns

Promise<ISignupData>

The state index of the user and transaction hash

Defined in

commands/signup.ts:17


timeTravel

timeTravel(«destructured»): Promise<void>

Utility to travel in time when using a local blockchain

Parameters

NameType
«destructured»TimeTravelArgs

Returns

Promise<void>

Defined in

commands/timeTravel.ts:10


verify

verify(VerifyArgs): Promise<void>

Verify the results of a poll on-chain

Parameters

NameTypeDescription
VerifyArgsVerifyArgsThe arguments for the verify command

Returns

Promise<void>

Defined in

commands/verify.ts:19