Skip to content

VotingChallenge defines a rule for approval in the form of a voting/multi-sig challenge. Requires a weighted quorum threshold to be met through votes from…

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1399

VotingChallenge defines a rule for approval in the form of a voting/multi-sig challenge. Requires a weighted quorum threshold to be met through votes from specified voters. All challenges must be met with valid solutions for the transfer to be approved.

IMPORTANT: Votes are stored separately and can be updated. The threshold is calculated as a percentage of total possible weight (all voters), not just voted weight. If you update the proposal ID, then the vote tracker will reset and start a new tally. We recommend using a unique proposal ID for each challenge to prevent overlap and unexpected behavior.

Extends

Type Parameters

T

T extends NumberType

Implements

Constructors

Constructor

new VotingChallenge<T>(votingChallenge): VotingChallenge<T>

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1408

Parameters

votingChallenge

iVotingChallenge<T>

Returns

VotingChallenge<T>

Overrides

BaseNumberTypeClass.constructor

Properties

customData?

optional customData?: string

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1404

Arbitrary custom data associated with this voting challenge.

Implementation of

iVotingChallenge.customData


delayAfterQuorum?

optional delayAfterQuorum?: T

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1406

Mandatory delay in milliseconds after quorum is reached before the transfer can execute.

Implementation of

iVotingChallenge.delayAfterQuorum


proposalId

proposalId: string

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1400

The ID of this voting challenge for tracking votes (scoped like challengeTrackerId). Format: collectionId-approverAddress-approvalLevel-approvalId-challengeId

Implementation of

iVotingChallenge.proposalId


quorumThreshold

quorumThreshold: T

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1401

The quorum threshold as a percentage (0-100) of total possible weight that must vote "yes". Example: 50 means 50% of total voter weight must vote yes for approval.

Implementation of

iVotingChallenge.quorumThreshold


resetAfterExecution?

optional resetAfterExecution?: boolean

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1405

If true, all votes for this challenge are cleared after a successful transfer execution.

Implementation of

iVotingChallenge.resetAfterExecution


uri?

optional uri?: string

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1403

The URI associated with this voting challenge.

Implementation of

iVotingChallenge.uri


voters

voters: Voter<T>[]

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1402

List of voters with their weights. Each voter can cast a weighted vote.

Implementation of

iVotingChallenge.voters

Methods

clone()

clone(): VotingChallenge

Defined in: packages/bitbadgesjs-sdk/src/common/base.ts:151

Deep copies the object and returns a new instance.

Returns

VotingChallenge

Inherited from

BaseNumberTypeClass.clone


convert()

convert<U>(convertFunction, options?): VotingChallenge<U>

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1423

Converts the object to a different NumberType equivalent.

Type Parameters

U

U extends NumberType

Parameters

convertFunction

(item) => U

options?

ConvertOptions

Returns

VotingChallenge<U>

Overrides

BaseNumberTypeClass.convert


equals()

equals<U>(other, normalizeNumberTypes?): boolean

Defined in: packages/bitbadgesjs-sdk/src/common/base.ts:147

Compares this object's fields to another object's fields for equality. Equality is determined by comparing the JSON representations of the objects.

If normalizeNumberTypes is true, then all number types will be compared as strings (i.e. "1n" === "1" === 1). Else, they will be compared as their native types (i.e. 1n !== 1 !== "1").

Type Parameters

U

U extends CustomType<U>

Parameters

other

CustomType<U> | null | undefined

normalizeNumberTypes?

boolean

Returns

boolean

Inherited from

BaseNumberTypeClass.equals


getNumberFieldNames()

getNumberFieldNames(): string[]

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1419

Internal helper method to convert the number fields of the object to a different NumberType equivalent.

Returns

string[]

Overrides

BaseNumberTypeClass.getNumberFieldNames


hasNumberFields()

hasNumberFields(): boolean

Defined in: packages/bitbadgesjs-sdk/src/common/base.ts:161

Checks if the object has number fields.

Returns

boolean

Inherited from

BaseNumberTypeClass.hasNumberFields


toJson()

toJson(): JsonObject

Defined in: packages/bitbadgesjs-sdk/src/common/base.ts:139

Converts the object to a JSON object with all primitive types.

Returns

JsonObject

Inherited from

BaseNumberTypeClass.toJson


toJsonString()

toJsonString(): string

Defined in: packages/bitbadgesjs-sdk/src/common/base.ts:143

Converts the object to a JSON string.

Returns

string

Inherited from

BaseNumberTypeClass.toJsonString


fromProto()

static fromProto<U>(item, convertFunction): VotingChallenge<U>

Defined in: packages/bitbadgesjs-sdk/src/core/misc.ts:1427

Type Parameters

U

U extends NumberType

Parameters

item

VotingChallenge

convertFunction

(item) => U

Returns

VotingChallenge<U>

Edit this page on GitHub