Skip to content

Commit

Permalink
feat: add original value from lcd when crawl validator
Browse files Browse the repository at this point in the history
  • Loading branch information
fibonacci998 committed Nov 8, 2024
1 parent 6760569 commit b95effa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/models/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { PowerEvent } from './power_event';
import { Delegator } from './delegator';

export interface IConsensusPubkey {
type: string;
key: string;
type?: string;
key?: string;
value?: string;
original_value?: any;
}

export class Validator extends BaseModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ export default class CrawlValidatorService extends BullableService {
)}`;
validatorEntity = foundValidator;
validatorEntity.evm_address = evmAddress;
validatorEntity.consensus_pubkey = validator.consensus_pubkey;
validatorEntity.consensus_pubkey = {
type: validator.consensus_pubkey.type,
value: validator.consensus_pubkey.value.compressed_base64_pubkey,
original_value: validator.consensus_pubkey,
};
validatorEntity.jailed = validator.jailed ?? false;
validatorEntity.status = validator.status;
validatorEntity.tokens = validator.tokens;
Expand Down Expand Up @@ -214,6 +218,7 @@ export default class CrawlValidatorService extends BullableService {
type: validator.consensus_pubkey.type,
value:
validator.consensus_pubkey.value.compressed_base64_pubkey.toString(),
original_value: validator.consensus_pubkey.value,
};

const unCompressPubKey = Secp256k1.uncompressPubkey(
Expand Down

0 comments on commit b95effa

Please sign in to comment.