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
Name | Type | Description |
---|---|---|
stateTreeDepth | number | The depth of the state tree. |
Returns
Defined in
Properties
currentPollBeingProcessed
• Optional
currentPollBeingProcessed: bigint
Defined in
numSignUps
• numSignUps: number
= 0
Defined in
pollBeingProcessed
• Optional
pollBeingProcessed: boolean
Defined in
polls
• polls: Map
<bigint
, Poll
>
Defined in
stateLeaves
• stateLeaves: StateLeaf
[] = []
Defined in
stateTreeDepth
• stateTreeDepth: number
Defined in
Methods
copy
▸ copy(): MaciState
Create a deep copy of the MaciState object.
Returns
A new instance of the MaciState object with the same properties.
Implementation of
IMaciState.copy
Defined in
deployNullPoll
▸ deployNullPoll(): void
Deploy a null poll.
Returns
void
Implementation of
IMaciState.deployNullPoll
Defined in
deployPoll
▸ deployPoll(pollEndTimestamp
, maxValues
, treeDepths
, messageBatchSize
, coordinatorKeypair
): bigint
Deploy a new poll with the given parameters.
Parameters
Name | Type | Description |
---|---|---|
pollEndTimestamp | bigint | The Unix timestamp at which the poll ends. |
maxValues | MaxValues | The maximum number of values for each vote option. |
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
equals
▸ equals(m
): boolean
Check if the MaciState object is equal to another MaciState object.
Parameters
Name | Type | Description |
---|---|---|
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
signUp
▸ signUp(pubKey
, initialVoiceCreditBalance
, timestamp
): number
Sign up a user with the given public key, initial voice credit balance, and timestamp.
Parameters
Name | Type | Description |
---|---|---|
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
toJSON
▸ toJSON(): IJsonMaciState
Serialize the MaciState object to a JSON object.
Returns
A JSON object representing the MaciState object.
Implementation of
IMaciState.toJSON
Defined in
fromJSON
▸ fromJSON(json
): MaciState
Create a new MaciState object from a JSON object.
Parameters
Name | Type | Description |
---|---|---|
json | IJsonMaciState | The JSON object representing the MaciState object. |
Returns
A new instance of the MaciState object with the properties from the JSON object.