Skip to main content
Version: v2.x

Minimal Anti Collusion Infrastructure (MACI) v2.2.0 / MaciState

Class: MaciState

A representation of the MACI contract.

Implements

  • IMaciState

Constructors

new MaciState()

new MaciState(stateTreeDepth): MaciState

Constructs a new MaciState object.

Parameters

stateTreeDepth: number

The 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:96


deployNullPoll()

deployNullPoll(): void

Deploy a null poll.

Returns

void

Implementation of

IMaciState.deployNullPoll

Defined in

MaciState.ts:88


deployPoll()

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

Deploy a new poll with the given parameters.

Parameters

pollEndTimestamp: bigint

The Unix timestamp at which the poll ends.

treeDepths: TreeDepths

The depths of the tree.

messageBatchSize: number

The batch size for processing messages.

coordinatorKeypair: Keypair

The keypair of the MACI round coordinator.

Returns

bigint

The index of the newly deployed poll.

Implementation of

IMaciState.deployPoll

Defined in

MaciState.ts:64


equals()

equals(m): boolean

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

Parameters

m: MaciState

The MaciState object to compare.

Returns

boolean

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

Implementation of

IMaciState.equals

Defined in

MaciState.ts:111


signUp()

signUp(pubKey, initialVoiceCreditBalance, timestamp): number

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

Parameters

pubKey: PubKey

The public key of the user.

initialVoiceCreditBalance: bigint

The initial voice credit balance of the user.

timestamp: bigint

The 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:139


fromJSON()

static fromJSON(json): MaciState

Create a new MaciState object from a JSON object.

Parameters

json: IJsonMaciState

The 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:155