@celo/contractkit › "wrappers/Validators" › ValidatorsWrapper
Class: ValidatorsWrapper
Contract for voting for validators and managing validator groups.
Hierarchy
- BaseWrapper‹Validators›
↳ ValidatorsWrapper
Index
Constructors
Properties
- affiliate
- deaffiliate
- eventTypes
- events
- forceDeaffiliateIfValidator
- getAccountLockedGoldRequirement
- getCommissionUpdateDelay
- getDowntimeGracePeriod
- getEpochNumber
- getEpochSize
- getRegisteredValidatorGroupsAddresses
- getSlashingMultiplierResetPeriod
- getValidatorGroupSize
- getValidatorMembershipHistory
- getValidatorMembershipHistoryExtraData
- isValidator
- isValidatorGroup
- methodIds
- registerValidator
- removeMember
- resetSlashingMultiplier
- setNextCommissionUpdate
- updateBlsPublicKey
- updateCommission
Accessors
Methods
- addMember
- currentSignerSet
- currentValidatorAccountsSet
- deregisterValidator
- deregisterValidatorGroup
- findValidatorMembershipHistoryIndex
- getConfig
- getGroupLockedGoldRequirements
- getHumanReadableConfig
- getPastEvents
- getRegisteredValidatorGroups
- getRegisteredValidators
- getRegisteredValidatorsAddresses
- getValidator
- getValidatorFromSigner
- getValidatorGroup
- getValidatorLockedGoldRequirements
- getValidatorMembershipHistoryIndex
- getValidatorRewards
- meetsValidatorBalanceRequirements
- meetsValidatorGroupBalanceRequirements
- registerValidatorGroup
- reorderMember
- signerToAccount
- validatorSignerToAccount
- version
Constructors
constructor
+ new ValidatorsWrapper(kit
: ContractKit, contract
: Validators): ValidatorsWrapper
Inherited from BaseWrapper.constructor
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:30
Parameters:
Name | Type |
---|---|
kit |
ContractKit |
contract |
Validators |
Returns: ValidatorsWrapper
Properties
affiliate
• affiliate: function = proxySend( this.kit, this.contract.methods.affiliate )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:489
Affiliates a validator with a group, allowing it to be added as a member. De-affiliates with the previously affiliated group if present.
param
The validator group with which to affiliate.
Type declaration:
▸ (group
: Address): CeloTransactionObject‹boolean›
Parameters:
Name | Type |
---|---|
group |
Address |
deaffiliate
• deaffiliate: function = proxySend(this.kit, this.contract.methods.deaffiliate)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:499
De-affiliates a validator, removing it from the group for which it is a member. Fails if the account is not a validator with non-zero affiliation.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
eventTypes
• eventTypes: EventsEnum‹T› = Object.keys(this.events).reduce
Inherited from BaseWrapper.eventTypes
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61
events
• events: Validators["events"] = this.contract.events
Inherited from BaseWrapper.events
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:59
forceDeaffiliateIfValidator
• forceDeaffiliateIfValidator: function = proxySend( this.kit, this.contract.methods.forceDeaffiliateIfValidator )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:505
Removes a validator from the group for which it is a member.
param
The validator to deaffiliate from their affiliated validator group.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getAccountLockedGoldRequirement
• getAccountLockedGoldRequirement: function = proxyCall( this.contract.methods.getAccountLockedGoldRequirement, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:129
Returns the Locked Gold requirements for specific account.
returns
The Locked Gold requirements for a specific account.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getCommissionUpdateDelay
• getCommissionUpdateDelay: function = proxyCall( this.contract.methods.commissionUpdateDelay, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:147
Returns the update delay, in blocks, for the group commission.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getDowntimeGracePeriod
• getDowntimeGracePeriod: function = proxyCall( this.contract.methods.downtimeGracePeriod, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:156
Returns the validator downtime grace period
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getEpochNumber
• getEpochNumber: function = proxyCall(this.contract.methods.getEpochNumber, undefined, valueToBigNumber)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:425
Registers a validator unaffiliated with any validator group.
Fails if the account is already a validator or validator group.
param
The address that the validator is using for consensus, should match
the validator signer.
param
The ECDSA public key that the validator is using for consensus. 64 bytes.
param
The BLS public key that the validator is using for consensus, should pass proof
of possession. 48 bytes.
param
The BLS public key proof-of-possession, which consists of a signature on the
account address. 96 bytes.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getEpochSize
• getEpochSize: function = proxyCall(this.contract.methods.getEpochSize, undefined, valueToBigNumber)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:427
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getRegisteredValidatorGroupsAddresses
• getRegisteredValidatorGroupsAddresses: function = proxyCall( this.contract.methods.getRegisteredValidatorGroups )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:395
Get list of registered validator group addresses
Type declaration:
▸ (): Promise‹Address[]›
getSlashingMultiplierResetPeriod
• getSlashingMultiplierResetPeriod: function = proxyCall( this.contract.methods.slashingMultiplierResetPeriod, undefined, valueToBigNumber )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:138
Returns the reset period, in seconds, for slashing multiplier.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getValidatorGroupSize
• getValidatorGroupSize: function = proxyCall( this.contract.methods.getGroupNumMembers, undefined, valueToInt )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:382
Get the size (amount of members) of a ValidatorGroup
Type declaration:
▸ (group
: Address): Promise‹number›
Parameters:
Name | Type |
---|---|
group |
Address |
getValidatorMembershipHistory
• getValidatorMembershipHistory: function = proxyCall( this.contract.methods.getMembershipHistory, undefined, (res) => zip((epoch, group): GroupMembership => ({ epoch: valueToInt(epoch), group }), res[0], res[1]) )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:361
Returns the Validator's group membership history
param
The validator whose membership history to return.
returns
The group membership history of a validator.
Type declaration:
▸ (validator
: Address): Promise‹GroupMembership[]›
Parameters:
Name | Type |
---|---|
validator |
Address |
getValidatorMembershipHistoryExtraData
• getValidatorMembershipHistoryExtraData: function = proxyCall( this.contract.methods.getMembershipHistory, undefined, (res) => ({ lastRemovedFromGroupTimestamp: valueToInt(res[2]), tail: valueToInt(res[3]) }) )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:373
Returns extra data from the Validator's group membership history
param
The validator whose membership history to return.
returns
The group membership history of a validator.
Type declaration:
▸ (validator
: Address): Promise‹MembershipHistoryExtraData›
Parameters:
Name | Type |
---|---|
validator |
Address |
isValidator
• isValidator: function = proxyCall(this.contract.methods.isValidator)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:253
Returns whether a particular account has a registered validator.
param
The account.
returns
Whether a particular address is a registered validator.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
isValidatorGroup
• isValidatorGroup: function = proxyCall(this.contract.methods.isValidatorGroup)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:260
Returns whether a particular account has a registered validator group.
param
The account.
returns
Whether a particular address is a registered validator group.
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
methodIds
• methodIds: Record‹keyof T["methods"], string› = Object.keys(this.contract.methods).reduce
acc[method] =
methodABI === undefined
? '0x'
: this.kit.connection.getAbiCoder().encodeFunctionSignature(methodABI)
return acc
},
{} as any
)
Inherited from BaseWrapper.methodIds
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:66
registerValidator
• registerValidator: function = proxySend( this.kit, this.contract.methods.registerValidator, tupleParser(stringToSolidityBytes, stringToSolidityBytes, stringToSolidityBytes) )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:429
Type declaration:
▸ (ecdsaPublicKey
: string, blsPublicKey
: string, blsPop
: string): CeloTransactionObject‹boolean›
Parameters:
Name | Type |
---|---|
ecdsaPublicKey |
string |
blsPublicKey |
string |
blsPop |
string |
removeMember
• removeMember: function = proxySend(this.kit, this.contract.methods.removeMember)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:543
Removes a member from a ValidatorGroup
The ValidatorGroup is specified by the from
of the tx.
param
The Validator to remove from the group
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
resetSlashingMultiplier
• resetSlashingMultiplier: function = proxySend(this.kit, this.contract.methods.resetSlashingMultiplier)
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:514
Resets a group's slashing multiplier if it has been >= the reset period since the last time the group was slashed.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
setNextCommissionUpdate
• setNextCommissionUpdate: function = proxySend( this.kit, this.contract.methods.setNextCommissionUpdate, tupleParser(valueToFixidityString) )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:87
Queues an update to a validator group's commission.
param
Fixidity representation of the commission this group receives on epoch
payments made to its members. Must be in the range [0, 1.0].
Type declaration:
▸ (commission
: BigNumber.Value): CeloTransactionObject‹void›
Parameters:
Name | Type |
---|---|
commission |
BigNumber.Value |
updateBlsPublicKey
• updateBlsPublicKey: function = proxySend( this.kit, this.contract.methods.updateBlsPublicKey, tupleParser(stringToSolidityBytes, stringToSolidityBytes) )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:239
Updates a validator's BLS key.
param
The BLS public key that the validator is using for consensus, should pass proof
of possession. 48 bytes.
param
The BLS public key proof-of-possession, which consists of a signature on the
account address. 96 bytes.
returns
True upon success.
Type declaration:
▸ (blsPublicKey
: string, blsPop
: string): CeloTransactionObject‹boolean›
Parameters:
Name | Type |
---|---|
blsPublicKey |
string |
blsPop |
string |
updateCommission
• updateCommission: function = proxySend( this.kit, this.contract.methods.updateCommission )
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:96
Updates a validator group's commission based on the previously queued update
Type declaration:
▸ (): CeloTransactionObject‹void›
Accessors
address
• get address(): string
Inherited from BaseWrapper.address
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:35
Contract address
Returns: string
Methods
addMember
▸ addMember(group
: Address, validator
: Address): Promise‹CeloTransactionObject‹boolean››
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:521
Adds a member to the end of a validator group's list of members.
Fails if validator
has not set their affiliation to this account.
Parameters:
Name | Type | Description |
---|---|---|
group |
Address | - |
validator |
Address | The validator to add to the group |
Returns: Promise‹CeloTransactionObject‹boolean››
currentSignerSet
▸ currentSignerSet(): Promise‹Address[]›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:611
Returns the current set of validator signer addresses
Returns: Promise‹Address[]›
currentValidatorAccountsSet
▸ currentValidatorAccountsSet(): Promise‹object[]›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:621
Returns the current set of validator signer and account addresses
Returns: Promise‹object[]›
deregisterValidator
▸ deregisterValidator(validatorAddress
: Address): Promise‹CeloTransactionObject‹boolean››
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:443
De-registers a validator, removing it from the group for which it is a member.
Parameters:
Name | Type | Description |
---|---|---|
validatorAddress |
Address | Address of the validator to deregister |
Returns: Promise‹CeloTransactionObject‹boolean››
deregisterValidatorGroup
▸ deregisterValidatorGroup(validatorGroupAddress
: Address): Promise‹CeloTransactionObject‹boolean››
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:471
De-registers a validator Group
Parameters:
Name | Type | Description |
---|---|---|
validatorGroupAddress |
Address | Address of the validator group to deregister |
Returns: Promise‹CeloTransactionObject‹boolean››
findValidatorMembershipHistoryIndex
▸ findValidatorMembershipHistoryIndex(epoch
: number, history
: GroupMembership[]): number
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:654
Returns the index into history
for epoch
.
Parameters:
Name | Type | Description |
---|---|---|
epoch |
number | The needle. |
history |
GroupMembership[] | The haystack. |
Returns: number
Index for epoch or -1.
getConfig
▸ getConfig(): Promise‹ValidatorsConfig›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:165
Returns current configuration parameters.
Returns: Promise‹ValidatorsConfig›
getGroupLockedGoldRequirements
▸ getGroupLockedGoldRequirements(): Promise‹LockedGoldRequirements›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:117
Returns the Locked Gold requirements for validator groups.
Returns: Promise‹LockedGoldRequirements›
The Locked Gold requirements for validator groups.
getHumanReadableConfig
▸ getHumanReadableConfig(): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:190
dev
Returns human readable configuration of the validators contract
Returns: Promise‹object›
ValidatorsConfig object
getPastEvents
▸ getPastEvents(event
: Events‹Validators›, options
: PastEventOptions): Promise‹EventLog[]›
Inherited from BaseWrapper.getPastEvents
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:55
Contract getPastEvents
Parameters:
Name | Type |
---|---|
event |
Events‹Validators› |
options |
PastEventOptions |
Returns: Promise‹EventLog[]›
getRegisteredValidatorGroups
▸ getRegisteredValidatorGroups(): Promise‹ValidatorGroup[]›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:406
Get list of registered validator groups
Returns: Promise‹ValidatorGroup[]›
getRegisteredValidators
▸ getRegisteredValidators(blockNumber?
: undefined | number): Promise‹Validator[]›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:400
Get list of registered validators
Parameters:
Name | Type |
---|---|
blockNumber? |
undefined | number |
Returns: Promise‹Validator[]›
getRegisteredValidatorsAddresses
▸ getRegisteredValidatorsAddresses(blockNumber?
: undefined | number): Promise‹Address[]›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:389
Get list of registered validator addresses
Parameters:
Name | Type |
---|---|
blockNumber? |
undefined | number |
Returns: Promise‹Address[]›
getValidator
▸ getValidator(address
: Address, blockNumber?
: undefined | number): Promise‹Validator›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:288
Get Validator information
Parameters:
Name | Type |
---|---|
address |
Address |
blockNumber? |
undefined | number |
Returns: Promise‹Validator›
getValidatorFromSigner
▸ getValidatorFromSigner(address
: Address, blockNumber?
: undefined | number): Promise‹Validator›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:305
Parameters:
Name | Type |
---|---|
address |
Address |
blockNumber? |
undefined | number |
Returns: Promise‹Validator›
getValidatorGroup
▸ getValidatorGroup(address
: Address, getAffiliates
: boolean, blockNumber?
: undefined | number): Promise‹ValidatorGroup›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:323
Get ValidatorGroup information
Parameters:
Name | Type | Default |
---|---|---|
address |
Address | - |
getAffiliates |
boolean | true |
blockNumber? |
undefined | number | - |
Returns: Promise‹ValidatorGroup›
getValidatorLockedGoldRequirements
▸ getValidatorLockedGoldRequirements(): Promise‹LockedGoldRequirements›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:105
Returns the Locked Gold requirements for validators.
Returns: Promise‹LockedGoldRequirements›
The Locked Gold requirements for validators.
getValidatorMembershipHistoryIndex
▸ getValidatorMembershipHistoryIndex(account
: Address, blockNumber?
: undefined | number): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:635
Returns the group membership for validator account.
Parameters:
Name | Type | Description |
---|---|---|
account |
Address | Address of validator account to retrieve group membership for. |
blockNumber? |
undefined | number | Block number to retrieve group membership at. |
Returns: Promise‹object›
Group and membership history index for validator
.
getValidatorRewards
▸ getValidatorRewards(epochNumber
: number): Promise‹ValidatorReward[]›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:585
Retrieves ValidatorRewards for epochNumber.
Parameters:
Name | Type | Description |
---|---|---|
epochNumber |
number | The epoch to retrieve ValidatorRewards at. |
Returns: Promise‹ValidatorReward[]›
meetsValidatorBalanceRequirements
▸ meetsValidatorBalanceRequirements(address
: Address): Promise‹boolean›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:267
Returns whether an account meets the requirements to register a validator.
Parameters:
Name | Type |
---|---|
address |
Address |
Returns: Promise‹boolean›
Whether an account meets the requirements to register a validator.
meetsValidatorGroupBalanceRequirements
▸ meetsValidatorGroupBalanceRequirements(address
: Address): Promise‹boolean›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:280
Returns whether an account meets the requirements to register a group.
Parameters:
Name | Type |
---|---|
address |
Address |
Returns: Promise‹boolean›
Whether an account meets the requirements to register a group.
registerValidatorGroup
▸ registerValidatorGroup(commission
: BigNumber): Promise‹CeloTransactionObject‹boolean››
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:460
Registers a validator group with no member validators. Fails if the account is already a validator or validator group. Fails if the account does not have sufficient weight.
Parameters:
Name | Type | Description |
---|---|---|
commission |
BigNumber | the commission this group receives on epoch payments made to its members. |
Returns: Promise‹CeloTransactionObject‹boolean››
reorderMember
▸ reorderMember(groupAddr
: Address, validator
: Address, newIndex
: number): Promise‹CeloTransactionObject‹boolean››
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:552
Reorders a member within a validator group.
Fails if validator
is not a member of the account's validator group.
Parameters:
Name | Type | Description |
---|---|---|
groupAddr |
Address | The validator group |
validator |
Address | The validator to reorder. |
newIndex |
number | New position for the validator |
Returns: Promise‹CeloTransactionObject‹boolean››
signerToAccount
▸ signerToAccount(signerAddress
: Address): Promise‹string›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:226
Returns the account associated with signer
.
dev
Fails if the signer
is not an account or previously authorized signer.
Parameters:
Name | Type |
---|---|
signerAddress |
Address |
Returns: Promise‹string›
The associated account.
validatorSignerToAccount
▸ validatorSignerToAccount(signerAddress
: Address): Promise‹string›
Defined in packages/sdk/contractkit/src/wrappers/Validators.ts:215
Returns the account associated with signer
.
dev
Fails if the signer
is not an account or currently authorized validator.
Parameters:
Name | Type |
---|---|
signerAddress |
Address |
Returns: Promise‹string›
The associated account.
version
▸ version(): Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››
Inherited from BaseWrapper.version
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:39
Returns: Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››