diff --git a/packages/namada/NamadaConsole.ts b/packages/namada/NamadaConsole.ts index 2bb3aa5d9d..f770db1c6e 100644 --- a/packages/namada/NamadaConsole.ts +++ b/packages/namada/NamadaConsole.ts @@ -22,8 +22,8 @@ export default class NamadaConsole extends Console { .log(' Stake: ', bold(validator.stake)) .log(' Voting power: ', bold(validator.votingPower)) .log(' Priority: ', bold(validator.proposerPriority)) - .log(' Commission: ', bold(validator.commission.commissionRate)) - .log(' Max change: ', bold(validator.commission.maxCommissionChangePerEpoch), 'per epoch') + .log(' Commission: ', bold(validator.commission?.commissionRate)) + .log(' Max change: ', bold(validator.commission?.maxCommissionChangePerEpoch), 'per epoch') .log('Email: ', bold(validator.metadata?.email||'')) .log('Website: ', bold(validator.metadata?.website||'')) .log('Discord: ', bold(validator.metadata?.discordHandle||'')) diff --git a/packages/namada/NamadaDecode.ts b/packages/namada/NamadaDecode.ts index e76cc47776..3745ac8fe3 100644 --- a/packages/namada/NamadaDecode.ts +++ b/packages/namada/NamadaDecode.ts @@ -26,7 +26,25 @@ export interface NamadaDecoder { gov_result (_: Uint8Array): Partial pgf_parameters (_: Uint8Array): Partial pos_validator_set (_: Uint8Array): { bondedStake: number|bigint }[] - pos_parameters (_: Uint8Array): Partial + pos_parameters (_: Uint8Array): Partial<{ + maxProposalPeriod: bigint + maxValidatorSlots: bigint + pipelineLen: bigint + unbondingLen: bigint + tmVotesPerToken: bigint + blockProposerReward: bigint + blockVoteReward: bigint + maxInflationRate: bigint + targetStakedRatio: bigint + duplicateVoteMinSlashRate: bigint + lightClientAttackMinSlashRate: bigint + cubicSlashingWindowLength: bigint + validatorStakeThreshold: bigint + livenessWindowCheck: bigint + livenessThreshold: bigint + rewardsGainP: bigint + rewardsGainD: bigint + }> pos_validator_state (_: Uint8Array): unknown storage_keys (): { epochDuration: string diff --git a/packages/namada/NamadaPoS.ts b/packages/namada/NamadaPoS.ts index 58f0d6575c..67ffb482e7 100644 --- a/packages/namada/NamadaPoS.ts +++ b/packages/namada/NamadaPoS.ts @@ -7,47 +7,6 @@ import type { Connection as NamadaConnection } from './Namada' -class NamadaPoSParameters { - maxProposalPeriod!: bigint - maxValidatorSlots!: bigint - pipelineLen!: bigint - unbondingLen!: bigint - tmVotesPerToken!: bigint - blockProposerReward!: bigint - blockVoteReward!: bigint - maxInflationRate!: bigint - targetStakedRatio!: bigint - duplicateVoteMinSlashRate!: bigint - lightClientAttackMinSlashRate!: bigint - cubicSlashingWindowLength!: bigint - validatorStakeThreshold!: bigint - livenessWindowCheck!: bigint - livenessThreshold!: bigint - rewardsGainP!: bigint - rewardsGainD!: bigint - constructor (properties: Partial = {}) { - assign(this, properties, [ - 'maxProposalPeriod', - 'maxValidatorSlots', - 'pipelineLen', - 'unbondingLen', - 'tmVotesPerToken', - 'blockProposerReward', - 'blockVoteReward', - 'maxInflationRate', - 'targetStakedRatio', - 'duplicateVoteMinSlashRate', - 'lightClientAttackMinSlashRate', - 'cubicSlashingWindowLength', - 'validatorStakeThreshold', - 'livenessWindowCheck', - 'livenessThreshold', - 'rewardsGainP', - 'rewardsGainD', - ]) - } -} - class NamadaValidator extends Staking.Validator { constructor (properties: Omit[0], 'chain'> & { chain: Namada, namadaAddress?: string, @@ -78,9 +37,10 @@ class NamadaValidator extends Staking.Validator { bondedStake?: number async fetchDetails (options?: { parallel?: boolean }) { - return fetchValidatorDetails(this.chain.getConnection(), { + await fetchValidatorDetails(this.chain.getConnection(), { ...options, validator: this }) + return this } } @@ -106,7 +66,7 @@ export async function fetchValidators ( parallelDetails?: boolean, interval?: number, } = {} -): Promise> { +): Promise { const connection = chain.getConnection() const validators: Record = @@ -129,7 +89,7 @@ export async function fetchValidators ( parallelDetails: options?.parallelDetails, }) } - return validators + return Object.values(validators) } export async function fetchValidatorAddresses (connection: NamadaConnection): Promise {