From b95effae20c3334ba28687ceb01a547e1b4dbfab Mon Sep 17 00:00:00 2001 From: fibonacci998 Date: Fri, 8 Nov 2024 09:41:12 +0700 Subject: [PATCH] feat: add original value from lcd when crawl validator --- src/models/validator.ts | 6 ++++-- .../evm/story/crawl-validator/crawl_validator.service.ts | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/models/validator.ts b/src/models/validator.ts index 8b1f3eccf..40d850931 100644 --- a/src/models/validator.ts +++ b/src/models/validator.ts @@ -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 { diff --git a/src/services/evm/story/crawl-validator/crawl_validator.service.ts b/src/services/evm/story/crawl-validator/crawl_validator.service.ts index 1b364f0c8..48f3ee2d1 100644 --- a/src/services/evm/story/crawl-validator/crawl_validator.service.ts +++ b/src/services/evm/story/crawl-validator/crawl_validator.service.ts @@ -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; @@ -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(