VotingProcedures.ts
VotingProcedures overview
Table of contents
- arbitrary
- constructors
- encoding
- helpers
- model
- parsing
- pattern matching
- predicates
- schemas
- utils
arbitrary
arbitrary
FastCheck arbitrary for VotingProcedures.
Signature
export declare const arbitrary: FastCheck.Arbitrary<VotingProcedures>Added in v2.0.0
constructors
abstain
Create an Abstain vote.
Signature
export declare const abstain: () => VoteAdded in v2.0.0
no
Create a No vote.
Signature
export declare const no: () => VoteAdded in v2.0.0
yes
Create a Yes vote.
Signature
export declare const yes: () => VoteAdded in v2.0.0
encoding
toCBORBytes
Encode VotingProcedures to CBOR bytes.
Signature
export declare const toCBORBytes: (data: VotingProcedures, options?: CBOR.CodecOptions) => anyAdded in v2.0.0
toCBORHex
Encode VotingProcedures to CBOR hex string.
Signature
export declare const toCBORHex: (data: VotingProcedures, options?: CBOR.CodecOptions) => stringAdded in v2.0.0
helpers
multiVote
Create VotingProcedures for one voter voting on multiple proposals.
Convenience function for submitting multiple votes from a single voter.
Signature
export declare const multiVote: (
voter: Voter,
votes: ReadonlyArray<readonly [GovernanceAction.GovActionId, VotingProcedure]>
) => VotingProceduresAdded in v2.0.0
singleVote
Create VotingProcedures for a single vote.
Convenience function for the common case of one voter voting on one proposal.
Signature
export declare const singleVote: (
voter: Voter,
govActionId: GovernanceAction.GovActionId,
procedure: VotingProcedure
) => VotingProceduresAdded in v2.0.0
model
VotingProcedures (class)
VotingProcedures based on Conway CDDL specification.
voting_procedures = {+ voter => {+ gov_action_id => voting_procedure}}A nested map structure where voters map to their votes on specific governance actions.
Signature
export declare class VotingProceduresAdded in v2.0.0
toJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberAdded in v2.0.0
parsing
fromCBORBytes
Parse VotingProcedures from CBOR bytes.
Signature
export declare const fromCBORBytes: (bytes: Uint8Array, options?: CBOR.CodecOptions) => VotingProceduresAdded in v2.0.0
fromCBORHex
Parse VotingProcedures from CBOR hex string.
Signature
export declare const fromCBORHex: (hex: string, options?: CBOR.CodecOptions) => VotingProceduresAdded in v2.0.0
pattern matching
matchVote
Pattern match on a Vote.
Signature
export declare const matchVote: <R>(patterns: {
NoVote: () => R
YesVote: () => R
AbstainVote: () => R
}) => (vote: Vote) => RAdded in v2.0.0
matchVoter
Pattern match on a Voter.
Signature
export declare const matchVoter: <R>(patterns: {
ConstitutionalCommitteeVoter: (credential: Credential.Credential) => R
DRepVoter: (drep: DRep.DRep) => R
StakePoolVoter: (poolKeyHash: PoolKeyHash.PoolKeyHash) => R
}) => (voter: Voter) => RAdded in v2.0.0
predicates
isAbstainVote
Check if a vote is an Abstain vote.
Signature
export declare const isAbstainVote: (vote: Vote) => vote is Schema.Schema.Type<typeof AbstainVote>Added in v2.0.0
isConstitutionalCommitteeVoter
Check if a voter is a Constitutional Committee voter.
Signature
export declare const isConstitutionalCommitteeVoter: (
voter: Voter
) => voter is Schema.Schema.Type<typeof ConstitutionalCommitteeVoter>Added in v2.0.0
isDRepVoter
Check if a voter is a DRep voter.
Signature
export declare const isDRepVoter: (voter: Voter) => voter is Schema.Schema.Type<typeof DRepVoter>Added in v2.0.0
isNoVote
Check if a vote is a No vote.
Signature
export declare const isNoVote: (vote: Vote) => vote is Schema.Schema.Type<typeof NoVote>Added in v2.0.0
isStakePoolVoter
Check if a voter is a Stake Pool voter.
Signature
export declare const isStakePoolVoter: (voter: Voter) => voter is Schema.Schema.Type<typeof StakePoolVoter>Added in v2.0.0
isYesVote
Check if a vote is a Yes vote.
Signature
export declare const isYesVote: (vote: Vote) => vote is Schema.Schema.Type<typeof YesVote>Added in v2.0.0
schemas
CDDLSchema
CDDL schema for VotingProcedures map structure.
Signature
export declare const CDDLSchema: Schema.MapFromSelf<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[4n]>, typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.MapFromSelf<
Schema.Tuple2<typeof Schema.Uint8ArrayFromSelf, typeof Schema.BigIntFromSelf>,
Schema.Tuple2<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.NullOr<Schema.Tuple2<typeof Schema.String, typeof Schema.Uint8ArrayFromSelf>>
>
>
>Added in v2.0.0
ConstitutionalCommitteeVoter (class)
Voter types based on Conway CDDL specification.
Conway / CML mapping:
- [0, addr_keyhash] ConstitutionalCommitteeHotKeyHash
- [1, script_hash] ConstitutionalCommitteeHotScriptHash
- [2, addr_keyhash] DRepKeyHash
- [3, script_hash] DRepScriptHash
- [4, pool_keyhash] StakingPoolKeyHash
Signature
export declare class ConstitutionalCommitteeVoterAdded in v2.0.0
toJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberFromCBORBytes
CBOR bytes transformation schema for VotingProcedures.
Signature
export declare const FromCBORBytes: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.MapFromSelf<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[4n]>, typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.MapFromSelf<
Schema.Tuple2<typeof Schema.Uint8ArrayFromSelf, typeof Schema.BigIntFromSelf>,
Schema.Tuple2<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.NullOr<Schema.Tuple2<typeof Schema.String, typeof Schema.Uint8ArrayFromSelf>>
>
>
>,
Schema.SchemaClass<VotingProcedures, VotingProcedures, never>,
never
>
>Added in v2.0.0
FromCBORHex
CBOR hex transformation schema for VotingProcedures.
Signature
export declare const FromCBORHex: (
options?: CBOR.CodecOptions
) => Schema.transform<
Schema.Schema<Uint8Array, string, never>,
Schema.transform<
Schema.transformOrFail<
typeof Schema.Uint8ArrayFromSelf,
Schema.declare<CBOR.CBOR, CBOR.CBOR, readonly [], never>,
never
>,
Schema.transformOrFail<
Schema.MapFromSelf<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[4n]>, typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.MapFromSelf<
Schema.Tuple2<typeof Schema.Uint8ArrayFromSelf, typeof Schema.BigIntFromSelf>,
Schema.Tuple2<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.NullOr<Schema.Tuple2<typeof Schema.String, typeof Schema.Uint8ArrayFromSelf>>
>
>
>,
Schema.SchemaClass<VotingProcedures, VotingProcedures, never>,
never
>
>
>Added in v2.0.0
FromCDDL
CDDL transformation schema for VotingProcedures.
Signature
export declare const FromCDDL: Schema.transformOrFail<
Schema.MapFromSelf<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[4n]>, typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.MapFromSelf<
Schema.Tuple2<typeof Schema.Uint8ArrayFromSelf, typeof Schema.BigIntFromSelf>,
Schema.Tuple2<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.NullOr<Schema.Tuple2<typeof Schema.String, typeof Schema.Uint8ArrayFromSelf>>
>
>
>,
Schema.SchemaClass<VotingProcedures, VotingProcedures, never>,
never
>Added in v2.0.0
NoVote (class)
Vote types based on Conway CDDL specification.
vote = 0 / 1 / 2 ; No / Yes / AbstainSignature
export declare class NoVoteAdded in v2.0.0
toJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberVote
Vote union schema.
Signature
export declare const Vote: Schema.Union<[typeof NoVote, typeof YesVote, typeof AbstainVote]>Added in v2.0.0
VoteCDDL
CDDL schema for Vote.
Signature
export declare const VoteCDDL: Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>Added in v2.0.0
VoteFromCDDL
CDDL transformation schema for Vote.
Signature
export declare const VoteFromCDDL: Schema.transformOrFail<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.SchemaClass<NoVote | YesVote | AbstainVote, NoVote | YesVote | AbstainVote, never>,
never
>Added in v2.0.0
Voter
Voter union schema.
Signature
export declare const Voter: Schema.Union<[typeof ConstitutionalCommitteeVoter, typeof DRepVoter, typeof StakePoolVoter]>Added in v2.0.0
VoterCDDL
CDDL schema for Voter as tuple structure.
Maps to: [voter_type, voter_data]Signature
export declare const VoterCDDL: Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[4n]>, typeof Schema.Uint8ArrayFromSelf>
]
>Added in v2.0.0
VoterFromCDDL
CDDL transformation schema for Voter.
Signature
export declare const VoterFromCDDL: Schema.transformOrFail<
Schema.Union<
[
Schema.Tuple2<Schema.Literal<[0n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[1n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[2n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[3n]>, typeof Schema.Uint8ArrayFromSelf>,
Schema.Tuple2<Schema.Literal<[4n]>, typeof Schema.Uint8ArrayFromSelf>
]
>,
Schema.SchemaClass<
ConstitutionalCommitteeVoter | DRepVoter | StakePoolVoter,
ConstitutionalCommitteeVoter | DRepVoter | StakePoolVoter,
never
>,
never
>Added in v2.0.0
VotingProcedure (class)
Voting procedure based on Conway CDDL specification.
voting_procedure = [ vote, anchor / null ]Signature
export declare class VotingProcedureAdded in v2.0.0
toJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberVotingProcedureCDDL
CDDL schema for VotingProcedure tuple structure.
Signature
export declare const VotingProcedureCDDL: Schema.Tuple2<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.NullOr<Schema.Tuple2<typeof Schema.String, typeof Schema.Uint8ArrayFromSelf>>
>Added in v2.0.0
VotingProcedureFromCDDL
CDDL transformation schema for VotingProcedure.
Signature
export declare const VotingProcedureFromCDDL: Schema.transformOrFail<
Schema.Tuple2<
Schema.Union<[Schema.Literal<[0n]>, Schema.Literal<[1n]>, Schema.Literal<[2n]>]>,
Schema.NullOr<Schema.Tuple2<typeof Schema.String, typeof Schema.Uint8ArrayFromSelf>>
>,
Schema.SchemaClass<VotingProcedure, VotingProcedure, never>,
never
>Added in v2.0.0
utils
AbstainVote (class)
Signature
export declare class AbstainVotetoJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberDRepVoter (class)
Signature
export declare class DRepVotertoJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberStakePoolVoter (class)
Signature
export declare class StakePoolVotertoJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): numberVote (type alias)
Signature
export type Vote = typeof Vote.TypeVoter (type alias)
Signature
export type Voter = typeof Voter.TypeYesVote (class)
Signature
export declare class YesVotetoJSON (method)
Signature
toJSON()toString (method)
Signature
toString(): string[Inspectable.NodeInspectSymbol] (method)
Signature
[Inspectable.NodeInspectSymbol](): unknown[Equal.symbol] (method)
Signature
[Equal.symbol](that: unknown): boolean[Hash.symbol] (method)
Signature
[Hash.symbol](): number