Skip to main content
Version: v1.2

MaciState

A representation of the MACI contract.

Implements​

  • IMaciState

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new MaciState(stateTreeDepth): MaciState

Constructs a new MaciState object.

Parameters​

NameTypeDescription
stateTreeDepthnumberThe depth of the state tree.

Returns​

MaciState

Defined in​

MaciState.ts:32

Properties​

currentPollBeingProcessed​

• Optional currentPollBeingProcessed: bigint

Defined in​

MaciState.ts:26


numSignUps​

• numSignUps: number = 0

Defined in​

MaciState.ts:21


pollBeingProcessed​

• Optional pollBeingProcessed: boolean

Defined in​

MaciState.ts:24


polls​

• polls: Map<bigint, Poll>

Defined in​

MaciState.ts:13


stateLeaves​

• stateLeaves: StateLeaf[] = []

Defined in​

MaciState.ts:16


stateTreeDepth​

• stateTreeDepth: number

Defined in​

MaciState.ts:19

Methods​

copy​

▸ copy(): MaciState

Create a deep copy of the MaciState object.

Returns​

MaciState

A new instance of the MaciState object with the same properties.

Implementation of​

IMaciState.copy

Defined in​

MaciState.ts:100


deployNullPoll​

▸ deployNullPoll(): void

Deploy a null poll.

Returns​

void

Implementation of​

IMaciState.deployNullPoll

Defined in​

MaciState.ts:92


deployPoll​

▸ deployPoll(pollEndTimestamp, maxValues, treeDepths, messageBatchSize, coordinatorKeypair): bigint

Deploy a new poll with the given parameters.

Parameters​

NameTypeDescription
pollEndTimestampbigintThe Unix timestamp at which the poll ends.
maxValuesMaxValuesThe maximum number of values for each vote option.
treeDepthsTreeDepthsThe depths of the tree.
messageBatchSizenumberThe batch size for processing messages.
coordinatorKeypairKeypairThe keypair of the MACI round coordinator.

Returns​

bigint

The index of the newly deployed poll.

Implementation of​

IMaciState.deployPoll

Defined in​

MaciState.ts:65


equals​

▸ equals(m): boolean

Check if the MaciState object is equal to another MaciState object.

Parameters​

NameTypeDescription
mMaciStateThe MaciState object to compare.

Returns​

boolean

True if the two MaciState objects are equal, false otherwise.

Implementation of​

IMaciState.equals

Defined in​

MaciState.ts:115


signUp​

▸ signUp(pubKey, initialVoiceCreditBalance, timestamp): number

Sign up a user with the given public key, initial voice credit balance, and timestamp.

Parameters​

NameTypeDescription
pubKeyPubKeyThe public key of the user.
initialVoiceCreditBalancebigintThe initial voice credit balance of the user.
timestampbigintThe timestamp of the sign-up.

Returns​

number

The index of the newly signed-up user in the state tree.

Implementation of​

IMaciState.signUp

Defined in​

MaciState.ts:49


toJSON​

▸ toJSON(): IJsonMaciState

Serialize the MaciState object to a JSON object.

Returns​

IJsonMaciState

A JSON object representing the MaciState object.

Implementation of​

IMaciState.toJSON

Defined in​

MaciState.ts:143


fromJSON​

▸ fromJSON(json): MaciState

Create a new MaciState object from a JSON object.

Parameters​

NameTypeDescription
jsonIJsonMaciStateThe JSON object representing the MaciState object.

Returns​

MaciState

A new instance of the MaciState object with the properties from the JSON object.

Defined in​

MaciState.ts:159